adminlte.min.js 5.1 KB
Newer Older
1
"use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),Layout=function(a){var b="Layout",c="lte.layout",d=a.fn[b],e={SIDEBAR:".main-sidebar",HEADER:".main-header",CONTENT:".content-wrapper",CONTENT_HEADER:".content-header",WRAPPER:".wrapper",CONTROL_SIDEBAR:".control-sidebar",LAYOUT_FIXED:".layout-fixed",FOOTER:".main-footer"},f={HOLD:"hold-transition",SIDEBAR:"main-sidebar",LAYOUT_FIXED:"layout-fixed"},g=function(){function b(a){_classCallCheck(this,b),this._element=a,this._init()}return _createClass(b,[{key:"fixLayoutHeight",value:function(){var b=[a(window).height(),a(e.HEADER).outerHeight(),a(e.FOOTER).outerHeight()];a(e.CONTENT).css("min-height",b[0]-(b[1]+b[2])),console.log(b[0]-(b[1]+b[2]))}},{key:"_init",value:function(){var b=this;a("body").removeClass(f.HOLD),this.fixLayoutHeight(),a(e.SIDEBAR).on("collapsed.lte.treeview expanded.lte.treeview",function(){b.fixLayoutHeight()}),a(window).resize(function(){b.fixLayoutHeight()})}},{key:"_max",value:function(a){var b=0;return a.forEach(function(a){a>b&&(b=a)}),b}}],[{key:"_jQueryInterface",value:function(d){return this.each(function(){var e=a(this).data(c);e||(e=new b(this),a(this).data(c,e)),d&&e[d]()})}}]),b}();return a.fn[b]=g._jQueryInterface,a.fn[b].Constructor=g,a.fn[b].noConflict=function(){return a.fn[b]=d,g._jQueryInterface},g}(jQuery),Treeview=function(a){var b="Treeview",c="lte.treeview",d="."+c,e=a.fn[b],f={SELECTED:"selected"+d,EXPANDED:"expanded"+d,COLLAPSED:"collapsed"+d,LOAD_DATA_API:"load"+d},g={LI:".nav-item",LINK:".nav-link",TREEVIEW_MENU:".nav-treeview",OPEN:".menu-open",DATA_WIDGET:'[data-widget="treeview"]'},h={LI:"nav-item",LINK:"nav-link",TREEVIEW_MENU:"nav-treeview",OPEN:"menu-open"},i={trigger:g.DATA_WIDGET+" "+g.LINK,animationSpeed:300,accordion:!1},j=function(){function b(a,c){_classCallCheck(this,b),this._config=c,this._element=a}return _createClass(b,[{key:"init",value:function(){this._setupListeners()}},{key:"expand",value:function(b,c){var d=this,e=a.Event(f.EXPANDED);if(this._config.accordion){var i=c.siblings(g.OPEN).first(),j=i.find(g.TREEVIEW_MENU).first();this.collapse(j,i)}b.slideDown(this._config.animationSpeed,function(){c.addClass(h.OPEN),a(d._element).trigger(e)})}},{key:"collapse",value:function(b,c){var d=this,e=a.Event(f.COLLAPSED);b.slideUp(this._config.animationSpeed,function(){c.removeClass(h.OPEN),a(d._element).trigger(e),b.find(g.OPEN+" > "+g.TREEVIEW_MENU).slideUp(),b.find(g.OPEN).removeClass(h.OPEN)})}},{key:"collapseAll",value:function(){}},{key:"expandAll",value:function(){}},{key:"toggle",value:function(b){var c=a(b.currentTarget),d=c.next();if(d.is(g.TREEVIEW_MENU)){b.preventDefault();var e=c.parents(g.LI).first(),f=e.hasClass(h.OPEN);f?this.collapse(a(d),e):this.expand(a(d),e)}}},{key:"_setupListeners",value:function(){var b=this;a(document).on("click",this._config.trigger,function(a){b.toggle(a)})}}],[{key:"_jQueryInterface",value:function(d){return this.each(function(){var e=a(this).data(c),f=a.extend({},i,a(this).data());e||(e=new b(a(this),f),a(this).data(c,e)),"init"===d&&e[d]()})}}]),b}();return a(window).on(f.LOAD_DATA_API,function(){a(g.DATA_WIDGET).each(function(){var b=a(this);j._jQueryInterface.call(b,"init")})}),a.fn[b]=j._jQueryInterface,a.fn[b].Constructor=j,a.fn[b].noConflict=function(){return a.fn[b]=e,j._jQueryInterface},j}(jQuery),PushMenu=function(a){var b="PushMenu",c="lte.pushmenu",d="."+c,e=a.fn[b],f={COLLAPSED:"collapsed"+d,SHOWN:"shown"+d},g={COLLAPSED:"sidebar-collapse",TOGGLE_BUTTON:'[data-widget="pushmenu"]'},h=function(){function b(c){_classCallCheck(this,b),this._element=c,this._isShown=!a("body").hasClass(g.COLLAPSED)||a("body").hasClass("sidebar-open")}return _createClass(b,[{key:"show",value:function(){a("body").addClass("sidebar-open").removeClass(g.COLLAPSED),this._isShown=!0;var b=a.Event(f.SHOWN);a(this._element).trigger(b)}},{key:"collapse",value:function(){a("body").removeClass("sidebar-open").addClass(g.COLLAPSED),this._isShown=!1;var b=a.Event(f.COLLAPSED);a(this._element).trigger(b)}},{key:"toggle",value:function(){"undefined"==typeof this._isShown&&(this._isShown=!a("body").hasClass(g.COLLAPSED)||a("body").hasClass("sidebar-open")),this._isShown?this.collapse():this.show()}}],[{key:"_jQueryInterface",value:function(d){return this.each(function(){var e=a(this).data(c);e||(e=new b(this),a(this).data(c,e)),d&&e[d]()})}}]),b}();return a(document).on("click",g.TOGGLE_BUTTON,function(b){b.preventDefault();var c=b.currentTarget;"pushmenu"!==a(c).data("widget")&&(c=a(c).closest(g.TOGGLE_BUTTON)),h._jQueryInterface.call(a(c),"toggle")}),a.fn[b]=h._jQueryInterface,a.fn[b].Constructor=h,a.fn[b].noConflict=function(){return a.fn[b]=e,h._jQueryInterface},h}(jQuery),Widget=function(a){var b=function(){function b(a){_classCallCheck(this,b),this._element=a}return _createClass(b,null,[{key:"_jQueryInterface",value:function(b){var c=a(b);c.show()}}]),b}();return b}(jQuery);