mirror of https://github.com/ColorlibHQ/AdminLTE
1 line
31 KiB
Plaintext
1 line
31 KiB
Plaintext
|
{"version":3,"file":"adminlte.js","sources":["../../build/js/ControlSidebar.js","../../build/js/Layout.js","../../build/js/PushMenu.js","../../build/js/Treeview.js","../../build/js/Widget.js"],"sourcesContent":["/**\n * --------------------------------------------\n * AdminLTE ControlSidebar.js\n * License MIT\n * --------------------------------------------\n */\n\nconst ControlSidebar = (($) => {\n /**\n * Constants\n * ====================================================\n */\n\n const NAME = 'ControlSidebar'\n const DATA_KEY = 'lte.control.sidebar'\n const EVENT_KEY = `.${DATA_KEY}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const DATA_API_KEY = '.data-api'\n\n const Event = {\n CLICK_DATA_API: `click${EVENT_KEY}${DATA_API_KEY}`\n }\n\n const Selector = {\n CONTROL_SIDEBAR: '.control-sidebar',\n DATA_TOGGLE : '[data-widget=\"control-sidebar\"]',\n MAIN_HEADER : '.main-header'\n }\n\n const ClassName = {\n CONTROL_SIDEBAR_OPEN : 'control-sidebar-open',\n CONTROL_SIDEBAR_SLIDE: 'control-sidebar-slide-open'\n }\n\n const Default = {\n slide: true\n }\n\n /**\n * Class Definition\n * ====================================================\n */\n\n class ControlSidebar {\n constructor(element, config) {\n this._element = element\n this._config = this._getConfig(config)\n }\n\n // Public\n\n show() {\n // Show the control sidebar\n if (this._config.slide) {\n $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE)\n } else {\n $('body').removeClass(ClassName.CONTROL_SIDEBAR_OPEN)\n }\n }\n\n collapse() {\n // Collapse the control sidebar\n if (this._config.slide) {\n $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE)\n } else {\n $('body').addClass(ClassName.CONTROL_SIDEBAR_OPEN)\n }\n }\n\n toggle() {\n this._setMargin()\n\n const shouldOpen = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body')\n .hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)\n if (shouldOpen) {\n // Open the control sidebar\n this.show()\n } else {\n // Close the control sidebar\n this.collapse()\n }\n }\n\n // Private\n\n _getConfig(config) {\n return $.extend({}, Default, config)\n }\n\n _setMargin() {\n $(Selector.CONTROL_SIDEBAR).css({\n top: $(Selector.MAIN_HEADER).outerHeight()\n })\n }\n\n // Static\n\n static _jQueryInterface(operation) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n\n if (!data) {\n data = new ControlSidebar(this, $(this).data())\n $(this).data(DATA_KEY, data)\n }\n\n if (data[operation] === 'undefined') {\n throw new Error(`${operation} is not a function`)\n }\n\n data[operation]()\n })\n }\n }\n\n /**\n *\n * Data Api implementation\n * ====================================================\n */\n $(document).on('click', Selector.DATA_TOGGLE, function (event) {\n event.preventDefault()\n\n ControlSidebar._jQueryInterface.call($(this), 'toggle')\n })\n\n /**\n * jQuery API\n * ====================================================\n */\n\n $.fn[NAME] = ControlSidebar._jQueryInterface\n $.fn[NAME].Constructor = ControlSidebar\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return ControlSidebar._jQueryInterface\n }\n\n return ControlSidebar\n})(jQuery)\n\nexport default ControlSidebar\n","/**\n * --------------------------------------------\n * AdminLTE Layout.js\n * License MIT\n * --------------------------------------------\n */\n\nconst Layout = (($) => {\n /**\n * Constants\n * ====================================================\n */\n\n const NAME = 'Layout'\n const DATA_KEY = 'lte.layout'\n const EVENT_KEY = `.${DATA_KEY}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Event = {\n SIDEBAR: 'sidebar'\n }
|