Mailbox.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/App/Mailbox", ["exports", "BaseApp"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("BaseApp"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.BaseApp);
  11. global.AppMailbox = mod.exports;
  12. }
  13. })(this, function (_exports, _BaseApp2) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.run = run;
  19. _exports.getInstance = getInstance;
  20. _exports.default = _exports.AppMailbox = void 0;
  21. _BaseApp2 = babelHelpers.interopRequireDefault(_BaseApp2);
  22. var AppMailbox =
  23. /*#__PURE__*/
  24. function (_BaseApp) {
  25. babelHelpers.inherits(AppMailbox, _BaseApp);
  26. function AppMailbox() {
  27. babelHelpers.classCallCheck(this, AppMailbox);
  28. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(AppMailbox).apply(this, arguments));
  29. }
  30. babelHelpers.createClass(AppMailbox, [{
  31. key: "initialize",
  32. value: function initialize() {
  33. babelHelpers.get(babelHelpers.getPrototypeOf(AppMailbox.prototype), "initialize", this).call(this);
  34. this.$actionBtn = $('.site-action');
  35. this.$actionToggleBtn = this.$actionBtn.find('.site-action-toggle');
  36. this.$addMainForm = $('#addMailForm').modal({
  37. show: false
  38. });
  39. this.$content = $('#mailContent'); // states
  40. this.states = {
  41. checked: false
  42. };
  43. }
  44. }, {
  45. key: "process",
  46. value: function process() {
  47. babelHelpers.get(babelHelpers.getPrototypeOf(AppMailbox.prototype), "process", this).call(this);
  48. this.setupActionBtn();
  49. this.bindListChecked();
  50. }
  51. }, {
  52. key: "listChecked",
  53. value: function listChecked(checked) {
  54. var api = this.$actionBtn.data('actionBtn');
  55. if (checked) {
  56. api.show();
  57. } else {
  58. api.hide();
  59. }
  60. this.states.checked = checked;
  61. }
  62. }, {
  63. key: "setupActionBtn",
  64. value: function setupActionBtn() {
  65. var _this = this;
  66. this.$actionToggleBtn.on('click', function (e) {
  67. if (!_this.states.checked) {
  68. _this.$addMainForm.modal('show');
  69. e.stopPropagation();
  70. }
  71. });
  72. }
  73. }, {
  74. key: "bindListChecked",
  75. value: function bindListChecked() {
  76. var _this2 = this;
  77. this.$content.on('asSelectable::change', function (e, api, checked) {
  78. _this2.listChecked(checked);
  79. });
  80. }
  81. }]);
  82. return AppMailbox;
  83. }(_BaseApp2.default);
  84. _exports.AppMailbox = AppMailbox;
  85. var instance = null;
  86. function getInstance() {
  87. if (!instance) {
  88. instance = new AppMailbox();
  89. }
  90. return instance;
  91. }
  92. function run() {
  93. var app = getInstance();
  94. app.run();
  95. }
  96. var _default = AppMailbox;
  97. _exports.default = _default;
  98. });