BaseApp.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/BaseApp", ["exports", "jquery", "Plugin", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("jquery"), require("Plugin"), require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.jQuery, global.Plugin, global.Site);
  11. global.BaseApp = mod.exports;
  12. }
  13. })(this, function (_exports, _jquery, _Plugin, _Site2) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.default = void 0;
  19. _jquery = babelHelpers.interopRequireDefault(_jquery);
  20. _Site2 = babelHelpers.interopRequireDefault(_Site2);
  21. var BaseApp =
  22. /*#__PURE__*/
  23. function (_Site) {
  24. babelHelpers.inherits(BaseApp, _Site);
  25. function BaseApp() {
  26. babelHelpers.classCallCheck(this, BaseApp);
  27. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(BaseApp).apply(this, arguments));
  28. }
  29. babelHelpers.createClass(BaseApp, [{
  30. key: "initialize",
  31. value: function initialize() {
  32. babelHelpers.get(babelHelpers.getPrototypeOf(BaseApp.prototype), "initialize", this).call(this);
  33. this.handlSlidePanelPlugin();
  34. }
  35. }, {
  36. key: "process",
  37. value: function process() {
  38. babelHelpers.get(babelHelpers.getPrototypeOf(BaseApp.prototype), "process", this).call(this);
  39. this.bindSlidePanelPlugin();
  40. }
  41. }, {
  42. key: "handlSlidePanelPlugin",
  43. value: function handlSlidePanelPlugin() {
  44. var self = this;
  45. this.slidepanelOptions = _jquery.default.extend({}, (0, _Plugin.getDefaults)('slidePanel'), {
  46. template: function template(options) {
  47. return "<div class=\"".concat(options.classes.base, " ").concat(options.classes.base, "-").concat(options.direction, "\">\n <div class=\"").concat(options.classes.base, "-scrollable\">\n <div><div class=\"").concat(options.classes.content, "\"></div></div>\n </div>\n <div class=\"").concat(options.classes.base, "-handler\"></div>\n </div>");
  48. },
  49. afterLoad: function afterLoad() {
  50. this.$panel.find(".".concat(this.options.classes.base, "-scrollable")).asScrollable({
  51. namespace: 'scrollable',
  52. contentSelector: '>',
  53. containerSelector: '>'
  54. });
  55. self.initializePlugins(this.$panel);
  56. },
  57. afterShow: function afterShow() {
  58. var _this = this;
  59. (0, _jquery.default)(document).on('click.slidePanelShow', function (e) {
  60. if ((0, _jquery.default)(e.target).closest('.slidePanel').length === 0 && (0, _jquery.default)(e.target).closest('html').length === 1) {
  61. _this.hide();
  62. }
  63. });
  64. },
  65. afterHide: function afterHide() {
  66. (0, _jquery.default)(document).off('click.slidePanelShow');
  67. (0, _jquery.default)(document).off('click.slidePanelDatepicker');
  68. }
  69. }, this.getSlidePanelOptions());
  70. }
  71. }, {
  72. key: "bindSlidePanelPlugin",
  73. value: function bindSlidePanelPlugin() {
  74. var self = this;
  75. (0, _jquery.default)(document).on('click', '[data-toggle="slidePanel"]', function (e) {
  76. self.openSlidePanel((0, _jquery.default)(this).data('url'));
  77. e.stopPropagation();
  78. });
  79. }
  80. }, {
  81. key: "getSlidePanelOptions",
  82. value: function getSlidePanelOptions() {
  83. return {};
  84. }
  85. }, {
  86. key: "openSlidePanel",
  87. value: function openSlidePanel() {
  88. var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  89. _jquery.default.slidePanel.show({
  90. url: url,
  91. settings: {
  92. cache: false
  93. }
  94. }, this.slidepanelOptions);
  95. }
  96. }]);
  97. return BaseApp;
  98. }(_Site2.default);
  99. var _default = BaseApp;
  100. _exports.default = _default;
  101. });