adminlte.js 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760
  1. /*!
  2. * AdminLTE v3.0.0-rc.1 (https://adminlte.io)
  3. * Copyright 2014-2019 Colorlib <http://colorlib.com>
  4. * Licensed under MIT (https://github.com/almasaeed2010/AdminLTE/blob/master/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  8. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  9. (global = global || self, factory(global.adminlte = {}));
  10. }(this, function (exports) { 'use strict';
  11. /**
  12. * --------------------------------------------
  13. * AdminLTE ControlSidebar.js
  14. * License MIT
  15. * --------------------------------------------
  16. */
  17. var ControlSidebar = function ($) {
  18. /**
  19. * Constants
  20. * ====================================================
  21. */
  22. var NAME = 'ControlSidebar';
  23. var DATA_KEY = 'lte.controlsidebar';
  24. var EVENT_KEY = "." + DATA_KEY;
  25. var JQUERY_NO_CONFLICT = $.fn[NAME];
  26. var Event = {
  27. COLLAPSED: "collapsed" + EVENT_KEY,
  28. EXPANDED: "expanded" + EVENT_KEY
  29. };
  30. var Selector = {
  31. CONTROL_SIDEBAR: '.control-sidebar',
  32. CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content',
  33. DATA_TOGGLE: '[data-widget="control-sidebar"]',
  34. CONTENT: '.content-wrapper',
  35. HEADER: '.main-header',
  36. FOOTER: '.main-footer'
  37. };
  38. var ClassName = {
  39. CONTROL_SIDEBAR_ANIMATE: 'control-sidebar-animate',
  40. CONTROL_SIDEBAR_OPEN: 'control-sidebar-open',
  41. CONTROL_SIDEBAR_SLIDE: 'control-sidebar-slide-open',
  42. LAYOUT_FIXED: 'layout-fixed',
  43. NAVBAR_FIXED: 'layout-navbar-fixed',
  44. NAVBAR_SM_FIXED: 'layout-sm-navbar-fixed',
  45. NAVBAR_MD_FIXED: 'layout-md-navbar-fixed',
  46. NAVBAR_LG_FIXED: 'layout-lg-navbar-fixed',
  47. NAVBAR_XL_FIXED: 'layout-xl-navbar-fixed',
  48. FOOTER_FIXED: 'layout-footer-fixed',
  49. FOOTER_SM_FIXED: 'layout-sm-footer-fixed',
  50. FOOTER_MD_FIXED: 'layout-md-footer-fixed',
  51. FOOTER_LG_FIXED: 'layout-lg-footer-fixed',
  52. FOOTER_XL_FIXED: 'layout-xl-footer-fixed'
  53. };
  54. /**
  55. * Class Definition
  56. * ====================================================
  57. */
  58. var ControlSidebar =
  59. /*#__PURE__*/
  60. function () {
  61. function ControlSidebar(element, config) {
  62. this._element = element;
  63. this._config = config;
  64. this._init();
  65. } // Public
  66. var _proto = ControlSidebar.prototype;
  67. _proto.show = function show() {
  68. // Show the control sidebar
  69. if (this._config.controlsidebarSlide) {
  70. $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
  71. $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () {
  72. $(Selector.CONTROL_SIDEBAR).hide();
  73. $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
  74. $(this).dequeue();
  75. });
  76. } else {
  77. $('body').removeClass(ClassName.CONTROL_SIDEBAR_OPEN);
  78. }
  79. var expandedEvent = $.Event(Event.EXPANDED);
  80. $(this._element).trigger(expandedEvent);
  81. };
  82. _proto.collapse = function collapse() {
  83. // Collapse the control sidebar
  84. if (this._config.controlsidebarSlide) {
  85. $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
  86. $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function () {
  87. $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () {
  88. $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
  89. $(this).dequeue();
  90. });
  91. $(this).dequeue();
  92. });
  93. } else {
  94. $('body').addClass(ClassName.CONTROL_SIDEBAR_OPEN);
  95. }
  96. var collapsedEvent = $.Event(Event.COLLAPSED);
  97. $(this._element).trigger(collapsedEvent);
  98. };
  99. _proto.toggle = function toggle() {
  100. var shouldOpen = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE);
  101. if (shouldOpen) {
  102. // Open the control sidebar
  103. this.show();
  104. } else {
  105. // Close the control sidebar
  106. this.collapse();
  107. }
  108. } // Private
  109. ;
  110. _proto._init = function _init() {
  111. var _this = this;
  112. this._fixHeight();
  113. this._fixScrollHeight();
  114. $(window).resize(function () {
  115. _this._fixHeight();
  116. _this._fixScrollHeight();
  117. });
  118. $(window).scroll(function () {
  119. if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)) {
  120. _this._fixScrollHeight();
  121. }
  122. });
  123. };
  124. _proto._fixScrollHeight = function _fixScrollHeight() {
  125. var heights = {
  126. scroll: $(document).height(),
  127. window: $(window).height(),
  128. header: $(Selector.HEADER).outerHeight(),
  129. footer: $(Selector.FOOTER).outerHeight()
  130. };
  131. var positions = {
  132. bottom: Math.abs(heights.window + $(window).scrollTop() - heights.scroll),
  133. top: $(window).scrollTop()
  134. };
  135. var navbarFixed = false;
  136. var footerFixed = false;
  137. if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
  138. if ($('body').hasClass(ClassName.NAVBAR_FIXED) || $('body').hasClass(ClassName.NAVBAR_SM_FIXED) || $('body').hasClass(ClassName.NAVBAR_MD_FIXED) || $('body').hasClass(ClassName.NAVBAR_LG_FIXED) || $('body').hasClass(ClassName.NAVBAR_XL_FIXED)) {
  139. if ($(Selector.HEADER).css("position") === "fixed") {
  140. navbarFixed = true;
  141. }
  142. }
  143. if ($('body').hasClass(ClassName.FOOTER_FIXED) || $('body').hasClass(ClassName.FOOTER_SM_FIXED) || $('body').hasClass(ClassName.FOOTER_MD_FIXED) || $('body').hasClass(ClassName.FOOTER_LG_FIXED) || $('body').hasClass(ClassName.FOOTER_XL_FIXED)) {
  144. if ($(Selector.FOOTER).css("position") === "fixed") {
  145. footerFixed = true;
  146. }
  147. }
  148. if (positions.top === 0 && positions.bottom === 0) {
  149. $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer);
  150. $(Selector.CONTROL_SIDEBAR).css('top', heights.header);
  151. $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header + heights.footer));
  152. } else if (positions.bottom <= heights.footer) {
  153. if (footerFixed === false) {
  154. $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer - positions.bottom);
  155. $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.footer - positions.bottom));
  156. } else {
  157. $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer);
  158. }
  159. } else if (positions.top <= heights.header) {
  160. if (navbarFixed === false) {
  161. $(Selector.CONTROL_SIDEBAR).css('top', heights.header - positions.top);
  162. $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header - positions.top));
  163. } else {
  164. $(Selector.CONTROL_SIDEBAR).css('top', heights.header);
  165. }
  166. } else {
  167. if (navbarFixed === false) {
  168. $(Selector.CONTROL_SIDEBAR).css('top', 0);
  169. $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window);
  170. } else {
  171. $(Selector.CONTROL_SIDEBAR).css('top', heights.header);
  172. }
  173. }
  174. }
  175. };
  176. _proto._fixHeight = function _fixHeight() {
  177. var heights = {
  178. window: $(window).height(),
  179. header: $(Selector.HEADER).outerHeight(),
  180. footer: $(Selector.FOOTER).outerHeight()
  181. };
  182. if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
  183. var sidebarHeight = heights.window - heights.header;
  184. if ($('body').hasClass(ClassName.FOOTER_FIXED) || $('body').hasClass(ClassName.FOOTER_SM_FIXED) || $('body').hasClass(ClassName.FOOTER_MD_FIXED) || $('body').hasClass(ClassName.FOOTER_LG_FIXED) || $('body').hasClass(ClassName.FOOTER_XL_FIXED)) {
  185. if ($(Selector.FOOTER).css("position") === "fixed") {
  186. sidebarHeight = heights.window - heights.header - heights.footer;
  187. }
  188. }
  189. $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', sidebarHeight);
  190. if (typeof $.fn.overlayScrollbars !== 'undefined') {
  191. $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).overlayScrollbars({
  192. className: this._config.scrollbarTheme,
  193. sizeAutoCapable: true,
  194. scrollbars: {
  195. autoHide: this._config.scrollbarAutoHide,
  196. clickScrolling: true
  197. }
  198. });
  199. }
  200. }
  201. } // Static
  202. ;
  203. ControlSidebar._jQueryInterface = function _jQueryInterface(operation) {
  204. return this.each(function () {
  205. var data = $(this).data(DATA_KEY);
  206. if (!data) {
  207. data = new ControlSidebar(this, $(this).data());
  208. $(this).data(DATA_KEY, data);
  209. }
  210. if (data[operation] === 'undefined') {
  211. throw new Error(operation + " is not a function");
  212. }
  213. data[operation]();
  214. });
  215. };
  216. return ControlSidebar;
  217. }();
  218. /**
  219. *
  220. * Data Api implementation
  221. * ====================================================
  222. */
  223. $(document).on('click', Selector.DATA_TOGGLE, function (event) {
  224. event.preventDefault();
  225. ControlSidebar._jQueryInterface.call($(this), 'toggle');
  226. });
  227. /**
  228. * jQuery API
  229. * ====================================================
  230. */
  231. $.fn[NAME] = ControlSidebar._jQueryInterface;
  232. $.fn[NAME].Constructor = ControlSidebar;
  233. $.fn[NAME].noConflict = function () {
  234. $.fn[NAME] = JQUERY_NO_CONFLICT;
  235. return ControlSidebar._jQueryInterface;
  236. };
  237. return ControlSidebar;
  238. }(jQuery);
  239. /**
  240. * --------------------------------------------
  241. * AdminLTE Layout.js
  242. * License MIT
  243. * --------------------------------------------
  244. */
  245. var Layout = function ($) {
  246. /**
  247. * Constants
  248. * ====================================================
  249. */
  250. var NAME = 'Layout';
  251. var DATA_KEY = 'lte.layout';
  252. var JQUERY_NO_CONFLICT = $.fn[NAME];
  253. var Selector = {
  254. HEADER: '.main-header',
  255. MAIN_SIDEBAR: '.main-sidebar',
  256. SIDEBAR: '.main-sidebar .sidebar',
  257. CONTENT: '.content-wrapper',
  258. BRAND: '.brand-link',
  259. CONTENT_HEADER: '.content-header',
  260. WRAPPER: '.wrapper',
  261. CONTROL_SIDEBAR: '.control-sidebar',
  262. LAYOUT_FIXED: '.layout-fixed',
  263. FOOTER: '.main-footer'
  264. };
  265. var ClassName = {
  266. HOLD: 'hold-transition',
  267. SIDEBAR: 'main-sidebar',
  268. CONTENT_FIXED: 'content-fixed',
  269. SIDEBAR_FOCUSED: 'sidebar-focused',
  270. LAYOUT_FIXED: 'layout-fixed',
  271. NAVBAR_FIXED: 'layout-navbar-fixed',
  272. FOOTER_FIXED: 'layout-footer-fixed'
  273. };
  274. var Default = {
  275. scrollbarTheme: 'os-theme-light',
  276. scrollbarAutoHide: 'l'
  277. };
  278. /**
  279. * Class Definition
  280. * ====================================================
  281. */
  282. var Layout =
  283. /*#__PURE__*/
  284. function () {
  285. function Layout(element, config) {
  286. this._config = config;
  287. this._element = element;
  288. this._init();
  289. } // Public
  290. var _proto = Layout.prototype;
  291. _proto.fixLayoutHeight = function fixLayoutHeight() {
  292. var heights = {
  293. window: $(window).height(),
  294. header: $(Selector.HEADER).length !== 0 ? $(Selector.HEADER).outerHeight() : 0,
  295. footer: $(Selector.FOOTER).length !== 0 ? $(Selector.FOOTER).outerHeight() : 0,
  296. sidebar: $(Selector.SIDEBAR).length !== 0 ? $(Selector.SIDEBAR).height() : 0
  297. };
  298. var max = this._max(heights);
  299. $(Selector.CONTENT).css('min-height', max - heights.footer);
  300. if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
  301. if (typeof $.fn.overlayScrollbars !== 'undefined') {
  302. $(Selector.SIDEBAR).overlayScrollbars({
  303. className: this._config.scrollbarTheme,
  304. sizeAutoCapable: true,
  305. scrollbars: {
  306. autoHide: this._config.scrollbarAutoHide,
  307. clickScrolling: true
  308. }
  309. });
  310. }
  311. }
  312. } // Private
  313. ;
  314. _proto._init = function _init() {
  315. var _this = this;
  316. // Activate layout height watcher
  317. this.fixLayoutHeight();
  318. $(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview collapsed.lte.pushmenu expanded.lte.pushmenu', function () {
  319. _this.fixLayoutHeight();
  320. });
  321. $(window).resize(function () {
  322. _this.fixLayoutHeight();
  323. });
  324. $('body, html').css('height', 'auto');
  325. $('body.hold-transition').removeClass('hold-transition');
  326. };
  327. _proto._max = function _max(numbers) {
  328. // Calculate the maximum number in a list
  329. var max = 0;
  330. Object.keys(numbers).forEach(function (key) {
  331. if (numbers[key] > max) {
  332. max = numbers[key];
  333. }
  334. });
  335. return max;
  336. } // Static
  337. ;
  338. Layout._jQueryInterface = function _jQueryInterface(config) {
  339. return this.each(function () {
  340. var data = $(this).data(DATA_KEY);
  341. var _config = $.extend({}, Default, $(this).data());
  342. if (!data) {
  343. data = new Layout($(this), _config);
  344. $(this).data(DATA_KEY, data);
  345. }
  346. if (config === 'init') {
  347. data[config]();
  348. }
  349. });
  350. };
  351. return Layout;
  352. }();
  353. /**
  354. * Data API
  355. * ====================================================
  356. */
  357. $(window).on('load', function () {
  358. Layout._jQueryInterface.call($('body'));
  359. });
  360. $(Selector.SIDEBAR + ' a').on('focusin', function () {
  361. $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED);
  362. });
  363. $(Selector.SIDEBAR + ' a').on('focusout', function () {
  364. $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED);
  365. });
  366. /**
  367. * jQuery API
  368. * ====================================================
  369. */
  370. $.fn[NAME] = Layout._jQueryInterface;
  371. $.fn[NAME].Constructor = Layout;
  372. $.fn[NAME].noConflict = function () {
  373. $.fn[NAME] = JQUERY_NO_CONFLICT;
  374. return Layout._jQueryInterface;
  375. };
  376. return Layout;
  377. }(jQuery);
  378. /**
  379. * --------------------------------------------
  380. * AdminLTE PushMenu.js
  381. * License MIT
  382. * --------------------------------------------
  383. */
  384. var PushMenu = function ($) {
  385. /**
  386. * Constants
  387. * ====================================================
  388. */
  389. var NAME = 'PushMenu';
  390. var DATA_KEY = 'lte.pushmenu';
  391. var EVENT_KEY = "." + DATA_KEY;
  392. var JQUERY_NO_CONFLICT = $.fn[NAME];
  393. var Event = {
  394. COLLAPSED: "collapsed" + EVENT_KEY,
  395. SHOWN: "shown" + EVENT_KEY
  396. };
  397. var Default = {
  398. autoCollapseSize: false,
  399. screenCollapseSize: 768,
  400. enableRemember: false,
  401. noTransitionAfterReload: true
  402. };
  403. var Selector = {
  404. TOGGLE_BUTTON: '[data-widget="pushmenu"]',
  405. SIDEBAR_MINI: '.sidebar-mini',
  406. SIDEBAR_COLLAPSED: '.sidebar-collapse',
  407. BODY: 'body',
  408. OVERLAY: '#sidebar-overlay',
  409. WRAPPER: '.wrapper'
  410. };
  411. var ClassName = {
  412. SIDEBAR_OPEN: 'sidebar-open',
  413. COLLAPSED: 'sidebar-collapse',
  414. OPEN: 'sidebar-open',
  415. SIDEBAR_MINI: 'sidebar-mini'
  416. };
  417. /**
  418. * Class Definition
  419. * ====================================================
  420. */
  421. var PushMenu =
  422. /*#__PURE__*/
  423. function () {
  424. function PushMenu(element, options) {
  425. this._element = element;
  426. this._options = $.extend({}, Default, options);
  427. this._init();
  428. if (!$(Selector.OVERLAY).length) {
  429. this._addOverlay();
  430. }
  431. } // Public
  432. var _proto = PushMenu.prototype;
  433. _proto.show = function show() {
  434. $(Selector.BODY).addClass(ClassName.OPEN).removeClass(ClassName.COLLAPSED);
  435. if (this._options.enableRemember) {
  436. localStorage.setItem("remember" + EVENT_KEY, ClassName.OPEN);
  437. }
  438. var shownEvent = $.Event(Event.SHOWN);
  439. $(this._element).trigger(shownEvent);
  440. };
  441. _proto.collapse = function collapse() {
  442. $(Selector.BODY).removeClass(ClassName.OPEN).addClass(ClassName.COLLAPSED);
  443. if (this._options.enableRemember) {
  444. localStorage.setItem("remember" + EVENT_KEY, ClassName.COLLAPSED);
  445. }
  446. var collapsedEvent = $.Event(Event.COLLAPSED);
  447. $(this._element).trigger(collapsedEvent);
  448. };
  449. _proto.isShown = function isShown() {
  450. if ($(window).width() >= this._options.screenCollapseSize) {
  451. return !$(Selector.BODY).hasClass(ClassName.COLLAPSED);
  452. } else {
  453. return $(Selector.BODY).hasClass(ClassName.OPEN);
  454. }
  455. };
  456. _proto.toggle = function toggle() {
  457. if (this.isShown()) {
  458. this.collapse();
  459. } else {
  460. this.show();
  461. }
  462. };
  463. _proto.autoCollapse = function autoCollapse() {
  464. if (this._options.autoCollapseSize) {
  465. if ($(window).width() <= this._options.autoCollapseSize) {
  466. if (this.isShown()) {
  467. this.toggle();
  468. }
  469. } else {
  470. if (!this.isShown()) {
  471. this.toggle();
  472. }
  473. }
  474. }
  475. };
  476. _proto.remember = function remember() {
  477. if (this._options.enableRemember) {
  478. var toggleState = localStorage.getItem("remember" + EVENT_KEY);
  479. if (toggleState == ClassName.COLLAPSED) {
  480. if (this._options.noTransitionAfterReload) {
  481. $("body").addClass('hold-transition').addClass(ClassName.COLLAPSED).delay(50).queue(function () {
  482. $(this).removeClass('hold-transition');
  483. $(this).dequeue();
  484. });
  485. } else {
  486. $("body").addClass(ClassName.COLLAPSED);
  487. }
  488. } else {
  489. if (this._options.noTransitionAfterReload) {
  490. $("body").addClass('hold-transition').removeClass(ClassName.COLLAPSED).delay(50).queue(function () {
  491. $(this).removeClass('hold-transition');
  492. $(this).dequeue();
  493. });
  494. } else {
  495. $("body").removeClass(ClassName.COLLAPSED);
  496. }
  497. }
  498. }
  499. } // Private
  500. ;
  501. _proto._init = function _init() {
  502. var _this = this;
  503. this.remember();
  504. this.autoCollapse();
  505. $(window).resize(function () {
  506. _this.autoCollapse();
  507. });
  508. };
  509. _proto._addOverlay = function _addOverlay() {
  510. var _this2 = this;
  511. var overlay = $('<div />', {
  512. id: 'sidebar-overlay'
  513. });
  514. overlay.on('click', function () {
  515. _this2.collapse();
  516. });
  517. $(Selector.WRAPPER).append(overlay);
  518. } // Static
  519. ;
  520. PushMenu._jQueryInterface = function _jQueryInterface(operation) {
  521. return this.each(function () {
  522. var data = $(this).data(DATA_KEY);
  523. var _options = $.extend({}, Default, $(this).data());
  524. if (!data) {
  525. data = new PushMenu(this, _options);
  526. $(this).data(DATA_KEY, data);
  527. }
  528. if (operation === 'toggle') {
  529. data[operation]();
  530. }
  531. });
  532. };
  533. return PushMenu;
  534. }();
  535. /**
  536. * Data API
  537. * ====================================================
  538. */
  539. $(document).on('click', Selector.TOGGLE_BUTTON, function (event) {
  540. event.preventDefault();
  541. var button = event.currentTarget;
  542. if ($(button).data('widget') !== 'pushmenu') {
  543. button = $(button).closest(Selector.TOGGLE_BUTTON);
  544. }
  545. PushMenu._jQueryInterface.call($(button), 'toggle');
  546. });
  547. $(window).on('load', function () {
  548. PushMenu._jQueryInterface.call($(Selector.TOGGLE_BUTTON));
  549. });
  550. /**
  551. * jQuery API
  552. * ====================================================
  553. */
  554. $.fn[NAME] = PushMenu._jQueryInterface;
  555. $.fn[NAME].Constructor = PushMenu;
  556. $.fn[NAME].noConflict = function () {
  557. $.fn[NAME] = JQUERY_NO_CONFLICT;
  558. return PushMenu._jQueryInterface;
  559. };
  560. return PushMenu;
  561. }(jQuery);
  562. /**
  563. * --------------------------------------------
  564. * AdminLTE Treeview.js
  565. * License MIT
  566. * --------------------------------------------
  567. */
  568. var Treeview = function ($) {
  569. /**
  570. * Constants
  571. * ====================================================
  572. */
  573. var NAME = 'Treeview';
  574. var DATA_KEY = 'lte.treeview';
  575. var EVENT_KEY = "." + DATA_KEY;
  576. var JQUERY_NO_CONFLICT = $.fn[NAME];
  577. var Event = {
  578. SELECTED: "selected" + EVENT_KEY,
  579. EXPANDED: "expanded" + EVENT_KEY,
  580. COLLAPSED: "collapsed" + EVENT_KEY,
  581. LOAD_DATA_API: "load" + EVENT_KEY
  582. };
  583. var Selector = {
  584. LI: '.nav-item',
  585. LINK: '.nav-link',
  586. TREEVIEW_MENU: '.nav-treeview',
  587. OPEN: '.menu-open',
  588. DATA_WIDGET: '[data-widget="treeview"]'
  589. };
  590. var ClassName = {
  591. LI: 'nav-item',
  592. LINK: 'nav-link',
  593. TREEVIEW_MENU: 'nav-treeview',
  594. OPEN: 'menu-open'
  595. };
  596. var Default = {
  597. trigger: Selector.DATA_WIDGET + " " + Selector.LINK,
  598. animationSpeed: 300,
  599. accordion: true
  600. };
  601. /**
  602. * Class Definition
  603. * ====================================================
  604. */
  605. var Treeview =
  606. /*#__PURE__*/
  607. function () {
  608. function Treeview(element, config) {
  609. this._config = config;
  610. this._element = element;
  611. } // Public
  612. var _proto = Treeview.prototype;
  613. _proto.init = function init() {
  614. this._setupListeners();
  615. };
  616. _proto.expand = function expand(treeviewMenu, parentLi) {
  617. var _this = this;
  618. var expandedEvent = $.Event(Event.EXPANDED);
  619. if (this._config.accordion) {
  620. var openMenuLi = parentLi.siblings(Selector.OPEN).first();
  621. var openTreeview = openMenuLi.find(Selector.TREEVIEW_MENU).first();
  622. this.collapse(openTreeview, openMenuLi);
  623. }
  624. treeviewMenu.stop().slideDown(this._config.animationSpeed, function () {
  625. parentLi.addClass(ClassName.OPEN);
  626. $(_this._element).trigger(expandedEvent);
  627. });
  628. };
  629. _proto.collapse = function collapse(treeviewMenu, parentLi) {
  630. var _this2 = this;
  631. var collapsedEvent = $.Event(Event.COLLAPSED);
  632. treeviewMenu.stop().slideUp(this._config.animationSpeed, function () {
  633. parentLi.removeClass(ClassName.OPEN);
  634. $(_this2._element).trigger(collapsedEvent);
  635. treeviewMenu.find(Selector.OPEN + " > " + Selector.TREEVIEW_MENU).slideUp();
  636. treeviewMenu.find(Selector.OPEN).removeClass(ClassName.OPEN);
  637. });
  638. };
  639. _proto.toggle = function toggle(event) {
  640. var $relativeTarget = $(event.currentTarget);
  641. var treeviewMenu = $relativeTarget.parent().find(Selector.TREEVIEW_MENU);
  642. if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) {
  643. treeviewMenu = $relativeTarget.parent().parent().find(Selector.TREEVIEW_MENU);
  644. if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) {
  645. return;
  646. }
  647. }
  648. event.preventDefault();
  649. var parentLi = $relativeTarget.parents(Selector.LI).first();
  650. var isOpen = parentLi.hasClass(ClassName.OPEN);
  651. if (isOpen) {
  652. this.collapse($(treeviewMenu), parentLi);
  653. } else {
  654. this.expand($(treeviewMenu), parentLi);
  655. }
  656. } // Private
  657. ;
  658. _proto._setupListeners = function _setupListeners() {
  659. var _this3 = this;
  660. $(document).on('click', this._config.trigger, function (event) {
  661. _this3.toggle(event);
  662. });
  663. } // Static
  664. ;
  665. Treeview._jQueryInterface = function _jQueryInterface(config) {
  666. return this.each(function () {
  667. var data = $(this).data(DATA_KEY);
  668. var _config = $.extend({}, Default, $(this).data());
  669. if (!data) {
  670. data = new Treeview($(this), _config);
  671. $(this).data(DATA_KEY, data);
  672. }
  673. if (config === 'init') {
  674. data[config]();
  675. }
  676. });
  677. };
  678. return Treeview;
  679. }();
  680. /**
  681. * Data API
  682. * ====================================================
  683. */
  684. $(window).on(Event.LOAD_DATA_API, function () {
  685. $(Selector.DATA_WIDGET).each(function () {
  686. Treeview._jQueryInterface.call($(this), 'init');
  687. });
  688. });
  689. /**
  690. * jQuery API
  691. * ====================================================
  692. */
  693. $.fn[NAME] = Treeview._jQueryInterface;
  694. $.fn[NAME].Constructor = Treeview;
  695. $.fn[NAME].noConflict = function () {
  696. $.fn[NAME] = JQUERY_NO_CONFLICT;
  697. return Treeview._jQueryInterface;
  698. };
  699. return Treeview;
  700. }(jQuery);
  701. /**
  702. * --------------------------------------------
  703. * AdminLTE DirectChat.js
  704. * License MIT
  705. * --------------------------------------------
  706. */
  707. var DirectChat = function ($) {
  708. /**
  709. * Constants
  710. * ====================================================
  711. */
  712. var NAME = 'DirectChat';
  713. var DATA_KEY = 'lte.directchat';
  714. var JQUERY_NO_CONFLICT = $.fn[NAME];
  715. var Event = {
  716. TOGGLED: "toggled{EVENT_KEY}"
  717. };
  718. var Selector = {
  719. DATA_TOGGLE: '[data-widget="chat-pane-toggle"]',
  720. DIRECT_CHAT: '.direct-chat'
  721. };
  722. var ClassName = {
  723. DIRECT_CHAT_OPEN: 'direct-chat-contacts-open'
  724. };
  725. /**
  726. * Class Definition
  727. * ====================================================
  728. */
  729. var DirectChat =
  730. /*#__PURE__*/
  731. function () {
  732. function DirectChat(element, config) {
  733. this._element = element;
  734. }
  735. var _proto = DirectChat.prototype;
  736. _proto.toggle = function toggle() {
  737. $(this._element).parents(Selector.DIRECT_CHAT).first().toggleClass(ClassName.DIRECT_CHAT_OPEN);
  738. var toggledEvent = $.Event(Event.TOGGLED);
  739. $(this._element).trigger(toggledEvent);
  740. } // Static
  741. ;
  742. DirectChat._jQueryInterface = function _jQueryInterface(config) {
  743. return this.each(function () {
  744. var data = $(this).data(DATA_KEY);
  745. if (!data) {
  746. data = new DirectChat($(this));
  747. $(this).data(DATA_KEY, data);
  748. }
  749. data[config]();
  750. });
  751. };
  752. return DirectChat;
  753. }();
  754. /**
  755. *
  756. * Data Api implementation
  757. * ====================================================
  758. */
  759. $(document).on('click', Selector.DATA_TOGGLE, function (event) {
  760. if (event) event.preventDefault();
  761. DirectChat._jQueryInterface.call($(this), 'toggle');
  762. });
  763. /**
  764. * jQuery API
  765. * ====================================================
  766. */
  767. $.fn[NAME] = DirectChat._jQueryInterface;
  768. $.fn[NAME].Constructor = DirectChat;
  769. $.fn[NAME].noConflict = function () {
  770. $.fn[NAME] = JQUERY_NO_CONFLICT;
  771. return DirectChat._jQueryInterface;
  772. };
  773. return DirectChat;
  774. }(jQuery);
  775. /**
  776. * --------------------------------------------
  777. * AdminLTE TodoList.js
  778. * License MIT
  779. * --------------------------------------------
  780. */
  781. var TodoList = function ($) {
  782. /**
  783. * Constants
  784. * ====================================================
  785. */
  786. var NAME = 'TodoList';
  787. var DATA_KEY = 'lte.todolist';
  788. var JQUERY_NO_CONFLICT = $.fn[NAME];
  789. var Selector = {
  790. DATA_TOGGLE: '[data-widget="todo-list"]'
  791. };
  792. var ClassName = {
  793. TODO_LIST_DONE: 'done'
  794. };
  795. var Default = {
  796. onCheck: function onCheck(item) {
  797. return item;
  798. },
  799. onUnCheck: function onUnCheck(item) {
  800. return item;
  801. }
  802. };
  803. /**
  804. * Class Definition
  805. * ====================================================
  806. */
  807. var TodoList =
  808. /*#__PURE__*/
  809. function () {
  810. function TodoList(element, config) {
  811. this._config = config;
  812. this._element = element;
  813. this._init();
  814. } // Public
  815. var _proto = TodoList.prototype;
  816. _proto.toggle = function toggle(item) {
  817. item.parents('li').toggleClass(ClassName.TODO_LIST_DONE);
  818. if (!$(item).prop('checked')) {
  819. this.unCheck($(item));
  820. return;
  821. }
  822. this.check(item);
  823. };
  824. _proto.check = function check(item) {
  825. this._config.onCheck.call(item);
  826. };
  827. _proto.unCheck = function unCheck(item) {
  828. this._config.onUnCheck.call(item);
  829. } // Private
  830. ;
  831. _proto._init = function _init() {
  832. var that = this;
  833. $(Selector.DATA_TOGGLE).find('input:checkbox:checked').parents('li').toggleClass(ClassName.TODO_LIST_DONE);
  834. $(Selector.DATA_TOGGLE).on('change', 'input:checkbox', function (event) {
  835. that.toggle($(event.target));
  836. });
  837. } // Static
  838. ;
  839. TodoList._jQueryInterface = function _jQueryInterface(config) {
  840. return this.each(function () {
  841. var data = $(this).data(DATA_KEY);
  842. var _config = $.extend({}, Default, $(this).data());
  843. if (!data) {
  844. data = new TodoList($(this), _config);
  845. $(this).data(DATA_KEY, data);
  846. }
  847. if (config === 'init') {
  848. data[config]();
  849. }
  850. });
  851. };
  852. return TodoList;
  853. }();
  854. /**
  855. * Data API
  856. * ====================================================
  857. */
  858. $(window).on('load', function () {
  859. TodoList._jQueryInterface.call($(Selector.DATA_TOGGLE));
  860. });
  861. /**
  862. * jQuery API
  863. * ====================================================
  864. */
  865. $.fn[NAME] = TodoList._jQueryInterface;
  866. $.fn[NAME].Constructor = TodoList;
  867. $.fn[NAME].noConflict = function () {
  868. $.fn[NAME] = JQUERY_NO_CONFLICT;
  869. return TodoList._jQueryInterface;
  870. };
  871. return TodoList;
  872. }(jQuery);
  873. /**
  874. * --------------------------------------------
  875. * AdminLTE CardWidget.js
  876. * License MIT
  877. * --------------------------------------------
  878. */
  879. var CardWidget = function ($) {
  880. /**
  881. * Constants
  882. * ====================================================
  883. */
  884. var NAME = 'CardWidget';
  885. var DATA_KEY = 'lte.cardwidget';
  886. var EVENT_KEY = "." + DATA_KEY;
  887. var JQUERY_NO_CONFLICT = $.fn[NAME];
  888. var Event = {
  889. EXPANDED: "expanded" + EVENT_KEY,
  890. COLLAPSED: "collapsed" + EVENT_KEY,
  891. MAXIMIZED: "maximized" + EVENT_KEY,
  892. MINIMIZED: "minimized" + EVENT_KEY,
  893. REMOVED: "removed" + EVENT_KEY
  894. };
  895. var ClassName = {
  896. CARD: 'card',
  897. COLLAPSED: 'collapsed-card',
  898. WAS_COLLAPSED: 'was-collapsed',
  899. MAXIMIZED: 'maximized-card'
  900. };
  901. var Selector = {
  902. DATA_REMOVE: '[data-card-widget="remove"]',
  903. DATA_COLLAPSE: '[data-card-widget="collapse"]',
  904. DATA_MAXIMIZE: '[data-card-widget="maximize"]',
  905. CARD: "." + ClassName.CARD,
  906. CARD_HEADER: '.card-header',
  907. CARD_BODY: '.card-body',
  908. CARD_FOOTER: '.card-footer',
  909. COLLAPSED: "." + ClassName.COLLAPSED
  910. };
  911. var Default = {
  912. animationSpeed: 'normal',
  913. collapseTrigger: Selector.DATA_COLLAPSE,
  914. removeTrigger: Selector.DATA_REMOVE,
  915. maximizeTrigger: Selector.DATA_MAXIMIZE,
  916. collapseIcon: 'fa-minus',
  917. expandIcon: 'fa-plus',
  918. maximizeIcon: 'fa-expand',
  919. minimizeIcon: 'fa-compress'
  920. };
  921. var CardWidget =
  922. /*#__PURE__*/
  923. function () {
  924. function CardWidget(element, settings) {
  925. this._element = element;
  926. this._parent = element.parents(Selector.CARD).first();
  927. if (element.hasClass(ClassName.CARD)) {
  928. this._parent = element;
  929. }
  930. this._settings = $.extend({}, Default, settings);
  931. }
  932. var _proto = CardWidget.prototype;
  933. _proto.collapse = function collapse() {
  934. var _this = this;
  935. this._parent.children(Selector.CARD_BODY + ", " + Selector.CARD_FOOTER).slideUp(this._settings.animationSpeed, function () {
  936. _this._parent.addClass(ClassName.COLLAPSED);
  937. });
  938. this._parent.find(this._settings.collapseTrigger + ' .' + this._settings.collapseIcon).addClass(this._settings.expandIcon).removeClass(this._settings.collapseIcon);
  939. var collapsed = $.Event(Event.COLLAPSED);
  940. this._element.trigger(collapsed, this._parent);
  941. };
  942. _proto.expand = function expand() {
  943. var _this2 = this;
  944. this._parent.children(Selector.CARD_BODY + ", " + Selector.CARD_FOOTER).slideDown(this._settings.animationSpeed, function () {
  945. _this2._parent.removeClass(ClassName.COLLAPSED);
  946. });
  947. this._parent.find(this._settings.collapseTrigger + ' .' + this._settings.expandIcon).addClass(this._settings.collapseIcon).removeClass(this._settings.expandIcon);
  948. var expanded = $.Event(Event.EXPANDED);
  949. this._element.trigger(expanded, this._parent);
  950. };
  951. _proto.remove = function remove() {
  952. this._parent.slideUp();
  953. var removed = $.Event(Event.REMOVED);
  954. this._element.trigger(removed, this._parent);
  955. };
  956. _proto.toggle = function toggle() {
  957. if (this._parent.hasClass(ClassName.COLLAPSED)) {
  958. this.expand();
  959. return;
  960. }
  961. this.collapse();
  962. };
  963. _proto.maximize = function maximize() {
  964. this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.maximizeIcon).addClass(this._settings.minimizeIcon).removeClass(this._settings.maximizeIcon);
  965. this._parent.css({
  966. 'height': this._parent.height(),
  967. 'width': this._parent.width(),
  968. 'transition': 'all .15s'
  969. }).delay(150).queue(function () {
  970. $(this).addClass(ClassName.MAXIMIZED);
  971. $('html').addClass(ClassName.MAXIMIZED);
  972. if ($(this).hasClass(ClassName.COLLAPSED)) {
  973. $(this).addClass(ClassName.WAS_COLLAPSED);
  974. }
  975. $(this).dequeue();
  976. });
  977. var maximized = $.Event(Event.MAXIMIZED);
  978. this._element.trigger(maximized, this._parent);
  979. };
  980. _proto.minimize = function minimize() {
  981. this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.minimizeIcon).addClass(this._settings.maximizeIcon).removeClass(this._settings.minimizeIcon);
  982. this._parent.css('cssText', 'height:' + this._parent[0].style.height + ' !important;' + 'width:' + this._parent[0].style.width + ' !important; transition: all .15s;').delay(10).queue(function () {
  983. $(this).removeClass(ClassName.MAXIMIZED);
  984. $('html').removeClass(ClassName.MAXIMIZED);
  985. $(this).css({
  986. 'height': 'inherit',
  987. 'width': 'inherit'
  988. });
  989. if ($(this).hasClass(ClassName.WAS_COLLAPSED)) {
  990. $(this).removeClass(ClassName.WAS_COLLAPSED);
  991. }
  992. $(this).dequeue();
  993. });
  994. var MINIMIZED = $.Event(Event.MINIMIZED);
  995. this._element.trigger(MINIMIZED, this._parent);
  996. };
  997. _proto.toggleMaximize = function toggleMaximize() {
  998. if (this._parent.hasClass(ClassName.MAXIMIZED)) {
  999. this.minimize();
  1000. return;
  1001. }
  1002. this.maximize();
  1003. } // Private
  1004. ;
  1005. _proto._init = function _init(card) {
  1006. var _this3 = this;
  1007. this._parent = card;
  1008. $(this).find(this._settings.collapseTrigger).click(function () {
  1009. _this3.toggle();
  1010. });
  1011. $(this).find(this._settings.maximizeTrigger).click(function () {
  1012. _this3.toggleMaximize();
  1013. });
  1014. $(this).find(this._settings.removeTrigger).click(function () {
  1015. _this3.remove();
  1016. });
  1017. } // Static
  1018. ;
  1019. CardWidget._jQueryInterface = function _jQueryInterface(config) {
  1020. var data = $(this).data(DATA_KEY);
  1021. if (!data) {
  1022. data = new CardWidget($(this), data);
  1023. $(this).data(DATA_KEY, typeof config === 'string' ? data : config);
  1024. }
  1025. if (typeof config === 'string' && config.match(/collapse|expand|remove|toggle|maximize|minimize|toggleMaximize/)) {
  1026. data[config]();
  1027. } else if (typeof config === 'object') {
  1028. data._init($(this));
  1029. }
  1030. };
  1031. return CardWidget;
  1032. }();
  1033. /**
  1034. * Data API
  1035. * ====================================================
  1036. */
  1037. $(document).on('click', Selector.DATA_COLLAPSE, function (event) {
  1038. if (event) {
  1039. event.preventDefault();
  1040. }
  1041. CardWidget._jQueryInterface.call($(this), 'toggle');
  1042. });
  1043. $(document).on('click', Selector.DATA_REMOVE, function (event) {
  1044. if (event) {
  1045. event.preventDefault();
  1046. }
  1047. CardWidget._jQueryInterface.call($(this), 'remove');
  1048. });
  1049. $(document).on('click', Selector.DATA_MAXIMIZE, function (event) {
  1050. if (event) {
  1051. event.preventDefault();
  1052. }
  1053. CardWidget._jQueryInterface.call($(this), 'toggleMaximize');
  1054. });
  1055. /**
  1056. * jQuery API
  1057. * ====================================================
  1058. */
  1059. $.fn[NAME] = CardWidget._jQueryInterface;
  1060. $.fn[NAME].Constructor = CardWidget;
  1061. $.fn[NAME].noConflict = function () {
  1062. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1063. return CardWidget._jQueryInterface;
  1064. };
  1065. return CardWidget;
  1066. }(jQuery);
  1067. /**
  1068. * --------------------------------------------
  1069. * AdminLTE CardRefresh.js
  1070. * License MIT
  1071. * --------------------------------------------
  1072. */
  1073. var CardRefresh = function ($) {
  1074. /**
  1075. * Constants
  1076. * ====================================================
  1077. */
  1078. var NAME = 'CardRefresh';
  1079. var DATA_KEY = 'lte.cardrefresh';
  1080. var EVENT_KEY = "." + DATA_KEY;
  1081. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1082. var Event = {
  1083. LOADED: "loaded" + EVENT_KEY,
  1084. OVERLAY_ADDED: "overlay.added" + EVENT_KEY,
  1085. OVERLAY_REMOVED: "overlay.removed" + EVENT_KEY
  1086. };
  1087. var ClassName = {
  1088. CARD: 'card'
  1089. };
  1090. var Selector = {
  1091. CARD: "." + ClassName.CARD,
  1092. DATA_REFRESH: '[data-card-widget="card-refresh"]'
  1093. };
  1094. var Default = {
  1095. source: '',
  1096. sourceSelector: '',
  1097. params: {},
  1098. trigger: Selector.DATA_REFRESH,
  1099. content: '.card-body',
  1100. loadInContent: true,
  1101. loadOnInit: true,
  1102. responseType: '',
  1103. overlayTemplate: '<div class="overlay"><i class="fas fa-2x fa-sync-alt fa-spin"></i></div>',
  1104. onLoadStart: function onLoadStart() {},
  1105. onLoadDone: function onLoadDone(response) {
  1106. return response;
  1107. }
  1108. };
  1109. var CardRefresh =
  1110. /*#__PURE__*/
  1111. function () {
  1112. function CardRefresh(element, settings) {
  1113. this._element = element;
  1114. this._parent = element.parents(Selector.CARD).first();
  1115. this._settings = $.extend({}, Default, settings);
  1116. this._overlay = $(this._settings.overlayTemplate);
  1117. if (element.hasClass(ClassName.CARD)) {
  1118. this._parent = element;
  1119. }
  1120. if (this._settings.source === '') {
  1121. throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.');
  1122. }
  1123. this._init();
  1124. if (this._settings.loadOnInit) {
  1125. this.load();
  1126. }
  1127. }
  1128. var _proto = CardRefresh.prototype;
  1129. _proto.load = function load() {
  1130. this._addOverlay();
  1131. this._settings.onLoadStart.call($(this));
  1132. $.get(this._settings.source, this._settings.params, function (response) {
  1133. if (this._settings.loadInContent) {
  1134. if (this._settings.sourceSelector != '') {
  1135. response = $(response).find(this._settings.sourceSelector).html();
  1136. }
  1137. this._parent.find(this._settings.content).html(response);
  1138. }
  1139. this._settings.onLoadDone.call($(this), response);
  1140. this._removeOverlay();
  1141. }.bind(this), this._settings.responseType !== '' && this._settings.responseType);
  1142. var loadedEvent = $.Event(Event.LOADED);
  1143. $(this._element).trigger(loadedEvent);
  1144. };
  1145. _proto._addOverlay = function _addOverlay() {
  1146. this._parent.append(this._overlay);
  1147. var overlayAddedEvent = $.Event(Event.OVERLAY_ADDED);
  1148. $(this._element).trigger(overlayAddedEvent);
  1149. };
  1150. _proto._removeOverlay = function _removeOverlay() {
  1151. this._parent.find(this._overlay).remove();
  1152. var overlayRemovedEvent = $.Event(Event.OVERLAY_REMOVED);
  1153. $(this._element).trigger(overlayRemovedEvent);
  1154. };
  1155. // Private
  1156. _proto._init = function _init(card) {
  1157. var _this = this;
  1158. $(this).find(this._settings.trigger).on('click', function () {
  1159. _this.load();
  1160. });
  1161. } // Static
  1162. ;
  1163. CardRefresh._jQueryInterface = function _jQueryInterface(config) {
  1164. var data = $(this).data(DATA_KEY);
  1165. var options = $(this).data();
  1166. if (!data) {
  1167. data = new CardRefresh($(this), options);
  1168. $(this).data(DATA_KEY, typeof config === 'string' ? data : config);
  1169. }
  1170. if (typeof config === 'string' && config.match(/load/)) {
  1171. data[config]();
  1172. } else if (typeof config === 'object') {
  1173. data._init($(this));
  1174. }
  1175. };
  1176. return CardRefresh;
  1177. }();
  1178. /**
  1179. * Data API
  1180. * ====================================================
  1181. */
  1182. $(document).on('click', Selector.DATA_REFRESH, function (event) {
  1183. if (event) {
  1184. event.preventDefault();
  1185. }
  1186. CardRefresh._jQueryInterface.call($(this), 'load');
  1187. });
  1188. /**
  1189. * jQuery API
  1190. * ====================================================
  1191. */
  1192. $.fn[NAME] = CardRefresh._jQueryInterface;
  1193. $.fn[NAME].Constructor = CardRefresh;
  1194. $.fn[NAME].noConflict = function () {
  1195. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1196. return CardRefresh._jQueryInterface;
  1197. };
  1198. return CardRefresh;
  1199. }(jQuery);
  1200. /**
  1201. * --------------------------------------------
  1202. * AdminLTE Dropdown.js
  1203. * License MIT
  1204. * --------------------------------------------
  1205. */
  1206. var Dropdown = function ($) {
  1207. /**
  1208. * Constants
  1209. * ====================================================
  1210. */
  1211. var NAME = 'Dropdown';
  1212. var DATA_KEY = 'lte.dropdown';
  1213. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1214. var Selector = {
  1215. DROPDOWN_MENU: 'ul.dropdown-menu',
  1216. DROPDOWN_TOGGLE: '[data-toggle="dropdown"]'
  1217. };
  1218. var Default = {};
  1219. /**
  1220. * Class Definition
  1221. * ====================================================
  1222. */
  1223. var Dropdown =
  1224. /*#__PURE__*/
  1225. function () {
  1226. function Dropdown(element, config) {
  1227. this._config = config;
  1228. this._element = element;
  1229. } // Public
  1230. var _proto = Dropdown.prototype;
  1231. _proto.toggleSubmenu = function toggleSubmenu() {
  1232. this._element.siblings().show().toggleClass("show");
  1233. if (!this._element.next().hasClass('show')) {
  1234. this._element.parents('.dropdown-menu').first().find('.show').removeClass("show").hide();
  1235. }
  1236. this._element.parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function (e) {
  1237. $('.dropdown-submenu .show').removeClass("show").hide();
  1238. });
  1239. } // Static
  1240. ;
  1241. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  1242. return this.each(function () {
  1243. var data = $(this).data(DATA_KEY);
  1244. var _config = $.extend({}, Default, $(this).data());
  1245. if (!data) {
  1246. data = new Dropdown($(this), _config);
  1247. $(this).data(DATA_KEY, data);
  1248. }
  1249. if (config === 'toggleSubmenu') {
  1250. data[config]();
  1251. }
  1252. });
  1253. };
  1254. return Dropdown;
  1255. }();
  1256. /**
  1257. * Data API
  1258. * ====================================================
  1259. */
  1260. $(Selector.DROPDOWN_MENU + ' ' + Selector.DROPDOWN_TOGGLE).on("click", function (event) {
  1261. event.preventDefault();
  1262. event.stopPropagation();
  1263. Dropdown._jQueryInterface.call($(this), 'toggleSubmenu');
  1264. }); // $(Selector.SIDEBAR + ' a').on('focusin', () => {
  1265. // $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED);
  1266. // })
  1267. // $(Selector.SIDEBAR + ' a').on('focusout', () => {
  1268. // $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED);
  1269. // })
  1270. /**
  1271. * jQuery API
  1272. * ====================================================
  1273. */
  1274. $.fn[NAME] = Dropdown._jQueryInterface;
  1275. $.fn[NAME].Constructor = Dropdown;
  1276. $.fn[NAME].noConflict = function () {
  1277. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1278. return Dropdown._jQueryInterface;
  1279. };
  1280. return Dropdown;
  1281. }(jQuery);
  1282. /**
  1283. * --------------------------------------------
  1284. * AdminLTE Toasts.js
  1285. * License MIT
  1286. * --------------------------------------------
  1287. */
  1288. var Toasts = function ($) {
  1289. /**
  1290. * Constants
  1291. * ====================================================
  1292. */
  1293. var NAME = 'Toasts';
  1294. var DATA_KEY = 'lte.toasts';
  1295. var EVENT_KEY = "." + DATA_KEY;
  1296. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1297. var Event = {
  1298. INIT: "init" + EVENT_KEY,
  1299. CREATED: "created" + EVENT_KEY,
  1300. REMOVED: "removed" + EVENT_KEY
  1301. };
  1302. var Selector = {
  1303. BODY: 'toast-body',
  1304. CONTAINER_TOP_RIGHT: '#toastsContainerTopRight',
  1305. CONTAINER_TOP_LEFT: '#toastsContainerTopLeft',
  1306. CONTAINER_BOTTOM_RIGHT: '#toastsContainerBottomRight',
  1307. CONTAINER_BOTTOM_LEFT: '#toastsContainerBottomLeft'
  1308. };
  1309. var ClassName = {
  1310. TOP_RIGHT: 'toasts-top-right',
  1311. TOP_LEFT: 'toasts-top-left',
  1312. BOTTOM_RIGHT: 'toasts-bottom-right',
  1313. BOTTOM_LEFT: 'toasts-bottom-left',
  1314. FADE: 'fade'
  1315. };
  1316. var Position = {
  1317. TOP_RIGHT: 'topRight',
  1318. TOP_LEFT: 'topLeft',
  1319. BOTTOM_RIGHT: 'bottomRight',
  1320. BOTTOM_LEFT: 'bottomLeft'
  1321. };
  1322. var Default = {
  1323. position: Position.TOP_RIGHT,
  1324. fixed: true,
  1325. autohide: false,
  1326. autoremove: true,
  1327. delay: 1000,
  1328. fade: true,
  1329. icon: null,
  1330. image: null,
  1331. imageAlt: null,
  1332. imageHeight: '25px',
  1333. title: null,
  1334. subtitle: null,
  1335. close: true,
  1336. body: null,
  1337. class: null
  1338. };
  1339. /**
  1340. * Class Definition
  1341. * ====================================================
  1342. */
  1343. var Toasts =
  1344. /*#__PURE__*/
  1345. function () {
  1346. function Toasts(element, config) {
  1347. this._config = config;
  1348. this._prepareContainer();
  1349. var initEvent = $.Event(Event.INIT);
  1350. $('body').trigger(initEvent);
  1351. } // Public
  1352. var _proto = Toasts.prototype;
  1353. _proto.create = function create() {
  1354. var toast = $('<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"/>');
  1355. toast.data('autohide', this._config.autohide);
  1356. toast.data('animation', this._config.fade);
  1357. if (this._config.class) {
  1358. toast.addClass(this._config.class);
  1359. }
  1360. if (this._config.delay && this._config.delay != 500) {
  1361. toast.data('delay', this._config.delay);
  1362. }
  1363. var toast_header = $('<div class="toast-header">');
  1364. if (this._config.image != null) {
  1365. var toast_image = $('<img />').addClass('rounded mr-2').attr('src', this._config.image).attr('alt', this._config.imageAlt);
  1366. if (this._config.imageHeight != null) {
  1367. toast_image.height(this._config.imageHeight).width('auto');
  1368. }
  1369. toast_header.append(toast_image);
  1370. }
  1371. if (this._config.icon != null) {
  1372. toast_header.append($('<i />').addClass('mr-2').addClass(this._config.icon));
  1373. }
  1374. if (this._config.title != null) {
  1375. toast_header.append($('<strong />').addClass('mr-auto').html(this._config.title));
  1376. }
  1377. if (this._config.subtitle != null) {
  1378. toast_header.append($('<small />').html(this._config.subtitle));
  1379. }
  1380. if (this._config.close == true) {
  1381. var toast_close = $('<button data-dismiss="toast" />').attr('type', 'button').addClass('ml-2 mb-1 close').attr('aria-label', 'Close').append('<span aria-hidden="true">&times;</span>');
  1382. if (this._config.title == null) {
  1383. toast_close.toggleClass('ml-2 ml-auto');
  1384. }
  1385. toast_header.append(toast_close);
  1386. }
  1387. toast.append(toast_header);
  1388. if (this._config.body != null) {
  1389. toast.append($('<div class="toast-body" />').html(this._config.body));
  1390. }
  1391. $(this._getContainerId()).prepend(toast);
  1392. var createdEvent = $.Event(Event.CREATED);
  1393. $('body').trigger(createdEvent);
  1394. toast.toast('show');
  1395. if (this._config.autoremove) {
  1396. toast.on('hidden.bs.toast', function () {
  1397. $(this).delay(200).remove();
  1398. var removedEvent = $.Event(Event.REMOVED);
  1399. $('body').trigger(removedEvent);
  1400. });
  1401. }
  1402. } // Static
  1403. ;
  1404. _proto._getContainerId = function _getContainerId() {
  1405. if (this._config.position == Position.TOP_RIGHT) {
  1406. return Selector.CONTAINER_TOP_RIGHT;
  1407. } else if (this._config.position == Position.TOP_LEFT) {
  1408. return Selector.CONTAINER_TOP_LEFT;
  1409. } else if (this._config.position == Position.BOTTOM_RIGHT) {
  1410. return Selector.CONTAINER_BOTTOM_RIGHT;
  1411. } else if (this._config.position == Position.BOTTOM_LEFT) {
  1412. return Selector.CONTAINER_BOTTOM_LEFT;
  1413. }
  1414. };
  1415. _proto._prepareContainer = function _prepareContainer() {
  1416. if ($(this._getContainerId()).length === 0) {
  1417. var container = $('<div />').attr('id', this._getContainerId().replace('#', ''));
  1418. if (this._config.position == Position.TOP_RIGHT) {
  1419. container.addClass(ClassName.TOP_RIGHT);
  1420. } else if (this._config.position == Position.TOP_LEFT) {
  1421. container.addClass(ClassName.TOP_LEFT);
  1422. } else if (this._config.position == Position.BOTTOM_RIGHT) {
  1423. container.addClass(ClassName.BOTTOM_RIGHT);
  1424. } else if (this._config.position == Position.BOTTOM_LEFT) {
  1425. container.addClass(ClassName.BOTTOM_LEFT);
  1426. }
  1427. $('body').append(container);
  1428. }
  1429. if (this._config.fixed) {
  1430. $(this._getContainerId()).addClass('fixed');
  1431. } else {
  1432. $(this._getContainerId()).removeClass('fixed');
  1433. }
  1434. } // Static
  1435. ;
  1436. Toasts._jQueryInterface = function _jQueryInterface(option, config) {
  1437. return this.each(function () {
  1438. var _config = $.extend({}, Default, config);
  1439. var toast = new Toasts($(this), _config);
  1440. if (option === 'create') {
  1441. toast[option]();
  1442. }
  1443. });
  1444. };
  1445. return Toasts;
  1446. }();
  1447. /**
  1448. * jQuery API
  1449. * ====================================================
  1450. */
  1451. $.fn[NAME] = Toasts._jQueryInterface;
  1452. $.fn[NAME].Constructor = Toasts;
  1453. $.fn[NAME].noConflict = function () {
  1454. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1455. return Toasts._jQueryInterface;
  1456. };
  1457. return Toasts;
  1458. }(jQuery);
  1459. exports.CardRefresh = CardRefresh;
  1460. exports.CardWidget = CardWidget;
  1461. exports.ControlSidebar = ControlSidebar;
  1462. exports.DirectChat = DirectChat;
  1463. exports.Dropdown = Dropdown;
  1464. exports.Layout = Layout;
  1465. exports.PushMenu = PushMenu;
  1466. exports.Toasts = Toasts;
  1467. exports.TodoList = TodoList;
  1468. exports.Treeview = Treeview;
  1469. Object.defineProperty(exports, '__esModule', { value: true });
  1470. }));
  1471. //# sourceMappingURL=adminlte.js.map