mirror of https://github.com/ColorlibHQ/AdminLTE
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
7.8 KiB
1 line
7.8 KiB
{"version":3,"sources":["../src/Treeview.js"],"names":[],"mappings":";;;;;;;;;;;;;AAOA,IAAM,QAAQ,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;AAOvB,MAAM,IAAI,GAAiB,UAAU,CAAA;AACrC,MAAM,QAAQ,GAAa,cAAc,CAAA;AACzC,MAAM,SAAS,SAAgB,QAAQ,AAAE,CAAA;AACzC,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,MAAM,KAAK,GAAG;AACZ,YAAQ,eAAa,SAAS,AAAE;AAChC,YAAQ,eAAa,SAAS,AAAE;AAChC,aAAS,gBAAc,SAAS,AAAE;AAClC,iBAAa,WAAS,SAAS,AAAE;GAClC,CAAA;;AAED,MAAM,QAAQ,GAAG;AACf,MAAE,EAAE,WAAW;AACf,QAAI,EAAE,WAAW;AACjB,iBAAa,EAAE,eAAe;AAC9B,QAAI,EAAE,YAAY;AAClB,eAAW,EAAE,0BAA0B;GACxC,CAAA;;AAED,MAAM,SAAS,GAAG;AAChB,MAAE,EAAE,UAAU;AACd,QAAI,EAAE,UAAU;AAChB,iBAAa,EAAE,cAAc;AAC7B,QAAI,EAAE,WAAW;GAClB,CAAA;;AAED,MAAM,OAAO,GAAG;AACd,WAAO,EAAK,QAAQ,CAAC,WAAW,SAAI,QAAQ,CAAC,IAAI,AAAE;AACnD,kBAAc,EAAE,GAAG;AACnB,aAAS,EAAE,KAAK;GACjB;;;;;;AAAA;MAMK,QAAQ;AAEZ,aAFI,QAAQ,CAEA,OAAO,EAAE,MAAM,EAAE;4BAFzB,QAAQ;;AAGV,UAAI,CAAC,OAAO,GAAI,MAAM,CAAA;AACtB,UAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;KACxB;;;;AAAA,iBALG,QAAQ;;6BASL;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I,CAAC,IAAI,EAAE;AACT,gBAAI,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;AACrC,aAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;WAC7B;;AAED,cAAI,MAAM,KAAK,MAAM,EAAE;AACrB,gBAAI,CAAC,MAAM,CAAC,EAAE,CAAA;WACf;SACF,CAAC,CAAA;OACH;;;WA3FG,QAAQ;;;;;;;;AAoGd,GAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,YAAM;AACtC,KAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY;AACvC,UAAI,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;AACvB,cAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;KAClD,CAAC,CAAA;GACH,CAAC;;;;;;;AAAA,AAOF,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAA;AACtC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,QAAQ,CAAA;AACjC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,QAAQ,CAAC,gBAAgB,CAAA;GACjC,CAAA;;AAED,SAAO,QAAQ,CAAA;CAEhB,CAAA,CAAE,MAAM,CAAC,CAAA","file":"Treeview.js","sourcesContent":["/**\n * --------------------------------------------\n * AdminLTE Treeview.js\n * License MIT\n * --------------------------------------------\n */\n\nconst Treeview = (($) => {\n\n /**\n * Constants\n * ====================================================\n */\n\n const NAME = 'Treeview'\n const DATA_KEY = 'lte.treeview'\n const EVENT_KEY = `.${DATA_KEY}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Event = {\n SELECTED: `selected${EVENT_KEY}`,\n EXPANDED: `expanded${EVENT_KEY}`,\n COLLAPSED: `collapsed${EVENT_KEY}`,\n LOAD_DATA_API: `load${EVENT_KEY}`\n }\n\n const Selector = {\n LI: '.nav-item',\n LINK: '.nav-link',\n TREEVIEW_MENU: '.nav-treeview',\n OPEN: '.menu-open',\n DATA_WIDGET: '[data-widget=\"treeview\"]'\n }\n\n const ClassName = {\n LI: 'nav-item',\n LINK: 'nav-link',\n TREEVIEW_MENU: 'nav-treeview',\n OPEN: 'menu-open'\n }\n\n const Default = {\n trigger: `${Selector.DATA_WIDGET} ${Selector.LINK}`,\n animationSpeed: 300,\n accordion: false\n }\n\n /**\n * Class Definition\n * ====================================================\n */\n class Treeview {\n\n constructor(element, config) {\n this._config = config\n this._element = element\n }\n\n // Public\n\n init() {\n this._setupListeners()\n }\n\n expand(treeviewMenu, parentLi) {\n let expandedEvent = $.Event(Event.EXPANDED)\n\n if (this._config.accordion) {\n let openMenuLi = parentLi.siblings(Selector.OPEN).first()\n let openTreeview = openMenuLi.find(Selector.TREEVIEW_MENU).first()\n this.collapse(openTreeview, openMenuLi)\n }\n\n treeviewMenu.slideDown(this._config.animationSpeed, () => {\n parentLi.addClass(ClassName.OPEN)\n $(this._element).trigger(expandedEvent)\n })\n }\n\n collapse(treeviewMenu, parentLi) {\n let collapsedEvent = $.Event(Event.COLLAPSED)\n\n treeviewMenu.slideUp(this._config.animationSpeed, () => {\n parentLi.removeClass(ClassName.OPEN)\n $(this._element).trigger(collapsedEvent)\n treeviewMenu.find(`${Selector.OPEN} > ${Selector.TREEVIEW_MENU}`).slideUp()\n treeviewMenu.find(Selector.OPEN).removeClass(ClassName.OPEN)\n })\n }\n\n collapseAll() {\n\n }\n\n expandAll() {\n\n }\n\n toggle(event) {\n let $relativeTarget = $(event.currentTarget)\n let treeviewMenu = $relativeTarget.next()\n\n if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) {\n return\n }\n\n event.preventDefault()\n\n let parentLi = $relativeTarget.parents(Selector.LI).first()\n let isOpen = parentLi.hasClass(ClassName.OPEN)\n\n if (isOpen) {\n this.collapse($(treeviewMenu), parentLi)\n } else {\n this.expand($(treeviewMenu), parentLi)\n }\n }\n\n // Private\n\n _setupListeners() {\n $(document).on('click', this._config.trigger, (event) => {\n this.toggle(event)\n })\n }\n\n // Static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = $.extend({}, Default, $(this).data())\n\n if (!data) {\n data = new Treeview($(this), _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (config === 'init') {\n data[config]()\n }\n })\n }\n\n }\n\n /**\n * Data API\n * ====================================================\n */\n\n $(window).on(Event.LOAD_DATA_API, () => {\n $(Selector.DATA_WIDGET).each(function () {\n let $treeview = $(this)\n Treeview._jQueryInterface.call($treeview, 'init')\n })\n })\n\n /**\n * jQuery API\n * ====================================================\n */\n\n $.fn[NAME] = Treeview._jQueryInterface\n $.fn[NAME].Constructor = Treeview\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Treeview._jQueryInterface\n }\n\n return Treeview\n\n})(jQuery)\n"]} |