diff --git a/build/config/postcss.config.js b/build/config/postcss.config.js index 1b960e94f..273ee9413 100644 --- a/build/config/postcss.config.js +++ b/build/config/postcss.config.js @@ -1,6 +1,6 @@ 'use strict' -module.exports = (ctx) => ({ +module.exports = () => ({ map: { inline: false, annotation: true, diff --git a/build/config/rollup.config.js b/build/config/rollup.config.js index 913926032..66d19c095 100644 --- a/build/config/rollup.config.js +++ b/build/config/rollup.config.js @@ -1,6 +1,8 @@ +'use strict' + const { babel } = require('@rollup/plugin-babel') -const pkg = require('../../package') +const pkg = require('../../package') const year = new Date().getFullYear() const banner = `/*! * AdminLTE v${pkg.version} (${pkg.homepage}) diff --git a/build/js/CardRefresh.js b/build/js/CardRefresh.js index cacc7b161..03532a975 100644 --- a/build/js/CardRefresh.js +++ b/build/js/CardRefresh.js @@ -5,30 +5,30 @@ * -------------------------------------------- */ -const CardRefresh = (($) => { +const CardRefresh = ($ => { /** * Constants * ==================================================== */ - const NAME = 'CardRefresh' - const DATA_KEY = 'lte.cardrefresh' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'CardRefresh' + const DATA_KEY = 'lte.cardrefresh' + const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] const Event = { LOADED: `loaded${EVENT_KEY}`, OVERLAY_ADDED: `overlay.added${EVENT_KEY}`, - OVERLAY_REMOVED: `overlay.removed${EVENT_KEY}`, + OVERLAY_REMOVED: `overlay.removed${EVENT_KEY}` } const ClassName = { - CARD: 'card', + CARD: 'card' } const Selector = { CARD: `.${ClassName.CARD}`, - DATA_REFRESH: '[data-card-widget="card-refresh"]', + DATA_REFRESH: '[data-card-widget="card-refresh"]' } const Default = { @@ -41,16 +41,16 @@ const CardRefresh = (($) => { loadOnInit: true, responseType: '', overlayTemplate: '
', - onLoadStart: function () { + onLoadStart() { }, - onLoadDone: function (response) { - return response; + onLoadDone(response) { + return response } } class CardRefresh { constructor(element, settings) { - this._element = element + this._element = element this._parent = element.parents(Selector.CARD).first() this._settings = $.extend({}, Default, settings) this._overlay = $(this._settings.overlayTemplate) @@ -60,7 +60,7 @@ const CardRefresh = (($) => { } if (this._settings.source === '') { - throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.'); + throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.') } } @@ -68,9 +68,9 @@ const CardRefresh = (($) => { this._addOverlay() this._settings.onLoadStart.call($(this)) - $.get(this._settings.source, this._settings.params, function (response) { + $.get(this._settings.source, this._settings.params, response => { if (this._settings.loadInContent) { - if (this._settings.sourceSelector != '') { + if (this._settings.sourceSelector !== '') { response = $(response).find(this._settings.sourceSelector).html() } @@ -78,8 +78,8 @@ const CardRefresh = (($) => { } this._settings.onLoadDone.call($(this), response) - this._removeOverlay(); - }.bind(this), this._settings.responseType !== '' && this._settings.responseType) + this._removeOverlay() + }, this._settings.responseType !== '' && this._settings.responseType) const loadedEvent = $.Event(Event.LOADED) $(this._element).trigger(loadedEvent) @@ -90,19 +90,18 @@ const CardRefresh = (($) => { const overlayAddedEvent = $.Event(Event.OVERLAY_ADDED) $(this._element).trigger(overlayAddedEvent) - }; + } _removeOverlay() { this._parent.find(this._overlay).remove() const overlayRemovedEvent = $.Event(Event.OVERLAY_REMOVED) $(this._element).trigger(overlayRemovedEvent) - }; - + } // Private - _init(card) { + _init() { $(this).find(this._settings.trigger).on('click', () => { this.load() }) @@ -120,7 +119,7 @@ const CardRefresh = (($) => { if (!data) { data = new CardRefresh($(this), _options) - $(this).data(DATA_KEY, typeof config === 'string' ? data: config) + $(this).data(DATA_KEY, typeof config === 'string' ? data : config) } if (typeof config === 'string' && config.match(/load/)) { @@ -144,8 +143,8 @@ const CardRefresh = (($) => { CardRefresh._jQueryInterface.call($(this), 'load') }) - $(document).ready(function () { - $(Selector.DATA_REFRESH).each(function() { + $(document).ready(() => { + $(Selector.DATA_REFRESH).each(function () { CardRefresh._jQueryInterface.call($(this)) }) }) @@ -157,7 +156,7 @@ const CardRefresh = (($) => { $.fn[NAME] = CardRefresh._jQueryInterface $.fn[NAME].Constructor = CardRefresh - $.fn[NAME].noConflict = function () { + $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT return CardRefresh._jQueryInterface } diff --git a/build/js/CardWidget.js b/build/js/CardWidget.js index 3bd0403bb..3358b89ab 100644 --- a/build/js/CardWidget.js +++ b/build/js/CardWidget.js @@ -5,15 +5,15 @@ * -------------------------------------------- */ -const CardWidget = (($) => { +const CardWidget = ($ => { /** * Constants * ==================================================== */ - const NAME = 'CardWidget' - const DATA_KEY = 'lte.cardwidget' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'CardWidget' + const DATA_KEY = 'lte.cardwidget' + const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] const Event = { @@ -30,7 +30,7 @@ const CardWidget = (($) => { COLLAPSING: 'collapsing-card', EXPANDING: 'expanding-card', WAS_COLLAPSED: 'was-collapsed', - MAXIMIZED: 'maximized-card', + MAXIMIZED: 'maximized-card' } const Selector = { @@ -40,8 +40,7 @@ const CardWidget = (($) => { CARD: `.${ClassName.CARD}`, CARD_HEADER: '.card-header', CARD_BODY: '.card-body', - CARD_FOOTER: '.card-footer', - COLLAPSED: `.${ClassName.COLLAPSED}`, + CARD_FOOTER: '.card-footer' } const Default = { @@ -52,12 +51,12 @@ const CardWidget = (($) => { collapseIcon: 'fa-minus', expandIcon: 'fa-plus', maximizeIcon: 'fa-expand', - minimizeIcon: 'fa-compress', + minimizeIcon: 'fa-compress' } class CardWidget { constructor(element, settings) { - this._element = element + this._element = element this._parent = element.parents(Selector.CARD).first() if (element.hasClass(ClassName.CARD)) { @@ -113,21 +112,22 @@ const CardWidget = (($) => { this.collapse() } - + maximize() { this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.maximizeIcon) .addClass(this._settings.minimizeIcon) .removeClass(this._settings.maximizeIcon) this._parent.css({ - 'height': this._parent.height(), - 'width': this._parent.width(), - 'transition': 'all .15s' - }).delay(150).queue(function(){ + height: this._parent.height(), + width: this._parent.width(), + transition: 'all .15s' + }).delay(150).queue(function () { $(this).addClass(ClassName.MAXIMIZED) $('html').addClass(ClassName.MAXIMIZED) if ($(this).hasClass(ClassName.COLLAPSED)) { $(this).addClass(ClassName.WAS_COLLAPSED) } + $(this).dequeue() }) @@ -142,16 +142,17 @@ const CardWidget = (($) => { .removeClass(this._settings.minimizeIcon) 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(){ + ).delay(10).queue(function () { $(this).removeClass(ClassName.MAXIMIZED) $('html').removeClass(ClassName.MAXIMIZED) $(this).css({ - 'height': 'inherit', - 'width': 'inherit' + height: 'inherit', + width: 'inherit' }) if ($(this).hasClass(ClassName.WAS_COLLAPSED)) { $(this).removeClass(ClassName.WAS_COLLAPSED) } + $(this).dequeue() }) @@ -195,7 +196,7 @@ const CardWidget = (($) => { if (!data) { data = new CardWidget($(this), _options) - $(this).data(DATA_KEY, typeof config === 'string' ? data: config) + $(this).data(DATA_KEY, typeof config === 'string' ? data : config) } if (typeof config === 'string' && config.match(/collapse|expand|remove|toggle|maximize|minimize|toggleMaximize/)) { @@ -242,7 +243,7 @@ const CardWidget = (($) => { $.fn[NAME] = CardWidget._jQueryInterface $.fn[NAME].Constructor = CardWidget - $.fn[NAME].noConflict = function () { + $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT return CardWidget._jQueryInterface } diff --git a/build/js/ControlSidebar.js b/build/js/ControlSidebar.js index a33088586..39a17dbf0 100644 --- a/build/js/ControlSidebar.js +++ b/build/js/ControlSidebar.js @@ -5,30 +5,28 @@ * -------------------------------------------- */ -const ControlSidebar = (($) => { +const ControlSidebar = ($ => { /** * Constants * ==================================================== */ - const NAME = 'ControlSidebar' - const DATA_KEY = 'lte.controlsidebar' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'ControlSidebar' + const DATA_KEY = 'lte.controlsidebar' + const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] - const DATA_API_KEY = '.data-api' const Event = { COLLAPSED: `collapsed${EVENT_KEY}`, - EXPANDED: `expanded${EVENT_KEY}`, + EXPANDED: `expanded${EVENT_KEY}` } const Selector = { CONTROL_SIDEBAR: '.control-sidebar', CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content', DATA_TOGGLE: '[data-widget="control-sidebar"]', - CONTENT: '.content-wrapper', HEADER: '.main-header', - FOOTER: '.main-footer', + FOOTER: '.main-footer' } const ClassName = { @@ -45,13 +43,13 @@ const ControlSidebar = (($) => { FOOTER_SM_FIXED: 'layout-sm-footer-fixed', FOOTER_MD_FIXED: 'layout-md-footer-fixed', FOOTER_LG_FIXED: 'layout-lg-footer-fixed', - FOOTER_XL_FIXED: 'layout-xl-footer-fixed', + FOOTER_XL_FIXED: 'layout-xl-footer-fixed' } const Default = { controlsidebarSlide: true, - scrollbarTheme : 'os-theme-light', - scrollbarAutoHide: 'l', + scrollbarTheme: 'os-theme-light', + scrollbarAutoHide: 'l' } /** @@ -62,7 +60,7 @@ const ControlSidebar = (($) => { class ControlSidebar { constructor(element, config) { this._element = element - this._config = config + this._config = config this._init() } @@ -73,7 +71,7 @@ const ControlSidebar = (($) => { // Show the control sidebar if (this._config.controlsidebarSlide) { $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE) - $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function(){ + $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () { $(Selector.CONTROL_SIDEBAR).hide() $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE) $(this).dequeue() @@ -90,8 +88,8 @@ const ControlSidebar = (($) => { // Collapse the control sidebar if (this._config.controlsidebarSlide) { $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE) - $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function(){ - $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function(){ + $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function () { + $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () { $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE) $(this).dequeue() }) @@ -130,7 +128,7 @@ const ControlSidebar = (($) => { $(window).scroll(() => { if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)) { - this._fixScrollHeight() + this._fixScrollHeight() } }) } @@ -140,65 +138,64 @@ const ControlSidebar = (($) => { scroll: $(document).height(), window: $(window).height(), header: $(Selector.HEADER).outerHeight(), - footer: $(Selector.FOOTER).outerHeight(), + footer: $(Selector.FOOTER).outerHeight() } const positions = { bottom: Math.abs((heights.window + $(window).scrollTop()) - heights.scroll), - top: $(window).scrollTop(), + top: $(window).scrollTop() } - let navbarFixed = false; - let footerFixed = false; + let navbarFixed = false + let footerFixed = false if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { 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) + $('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) ) { - if ($(Selector.HEADER).css("position") === "fixed") { - navbarFixed = true; + if ($(Selector.HEADER).css('position') === 'fixed') { + navbarFixed = true } } + 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) + $('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) ) { - if ($(Selector.FOOTER).css("position") === "fixed") { - footerFixed = true; + if ($(Selector.FOOTER).css('position') === 'fixed') { + footerFixed = true } } if (positions.top === 0 && positions.bottom === 0) { - $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer); - $(Selector.CONTROL_SIDEBAR).css('top', heights.header); + $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer) + $(Selector.CONTROL_SIDEBAR).css('top', heights.header) $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header + heights.footer)) } else if (positions.bottom <= heights.footer) { - if (footerFixed === false) { - $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer - positions.bottom); + if (footerFixed === false) { + $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer - positions.bottom) $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.footer - positions.bottom)) } else { - $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer); + $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer) } } else if (positions.top <= heights.header) { if (navbarFixed === false) { - $(Selector.CONTROL_SIDEBAR).css('top', heights.header - positions.top); + $(Selector.CONTROL_SIDEBAR).css('top', heights.header - positions.top) $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header - positions.top)) } else { - $(Selector.CONTROL_SIDEBAR).css('top', heights.header); + $(Selector.CONTROL_SIDEBAR).css('top', heights.header) } + } else if (navbarFixed === false) { + $(Selector.CONTROL_SIDEBAR).css('top', 0) + $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window) } else { - if (navbarFixed === false) { - $(Selector.CONTROL_SIDEBAR).css('top', 0); - $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window) - } else { - $(Selector.CONTROL_SIDEBAR).css('top', heights.header); - } + $(Selector.CONTROL_SIDEBAR).css('top', heights.header) } } } @@ -207,40 +204,39 @@ const ControlSidebar = (($) => { const heights = { window: $(window).height(), header: $(Selector.HEADER).outerHeight(), - footer: $(Selector.FOOTER).outerHeight(), + footer: $(Selector.FOOTER).outerHeight() } if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { - let sidebarHeight = heights.window - heights.header; + let sidebarHeight = heights.window - heights.header 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) + $('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) ) { - if ($(Selector.FOOTER).css("position") === "fixed") { - sidebarHeight = heights.window - heights.header - heights.footer; + if ($(Selector.FOOTER).css('position') === 'fixed') { + sidebarHeight = heights.window - heights.header - heights.footer } } $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', sidebarHeight) - + if (typeof $.fn.overlayScrollbars !== 'undefined') { $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).overlayScrollbars({ - className : this._config.scrollbarTheme, - sizeAutoCapable : true, - scrollbars : { - autoHide: this._config.scrollbarAutoHide, - clickScrolling : true + className: this._config.scrollbarTheme, + sizeAutoCapable: true, + scrollbars: { + autoHide: this._config.scrollbarAutoHide, + clickScrolling: true } }) } } } - // Static static _jQueryInterface(operation) { @@ -280,7 +276,7 @@ const ControlSidebar = (($) => { $.fn[NAME] = ControlSidebar._jQueryInterface $.fn[NAME].Constructor = ControlSidebar - $.fn[NAME].noConflict = function () { + $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT return ControlSidebar._jQueryInterface } @@ -289,4 +285,4 @@ const ControlSidebar = (($) => { })(jQuery) export default ControlSidebar - + diff --git a/build/js/DirectChat.js b/build/js/DirectChat.js index c211bc710..79633b0d3 100644 --- a/build/js/DirectChat.js +++ b/build/js/DirectChat.js @@ -5,30 +5,28 @@ * -------------------------------------------- */ -const DirectChat = (($) => { +const DirectChat = ($ => { /** * Constants * ==================================================== */ - const NAME = 'DirectChat' - const DATA_KEY = 'lte.directchat' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'DirectChat' + const DATA_KEY = 'lte.directchat' const JQUERY_NO_CONFLICT = $.fn[NAME] - const DATA_API_KEY = '.data-api' const Event = { - TOGGLED: `toggled{EVENT_KEY}` + TOGGLED: 'toggled{EVENT_KEY}' } const Selector = { DATA_TOGGLE: '[data-widget="chat-pane-toggle"]', DIRECT_CHAT: '.direct-chat' - }; + } const ClassName = { DIRECT_CHAT_OPEN: 'direct-chat-contacts-open' - }; + } /** * Class Definition @@ -36,12 +34,12 @@ const DirectChat = (($) => { */ class DirectChat { - constructor(element, config) { + constructor(element) { this._element = element } toggle() { - $(this._element).parents(Selector.DIRECT_CHAT).first().toggleClass(ClassName.DIRECT_CHAT_OPEN); + $(this._element).parents(Selector.DIRECT_CHAT).first().toggleClass(ClassName.DIRECT_CHAT_OPEN) const toggledEvent = $.Event(Event.TOGGLED) $(this._element).trigger(toggledEvent) @@ -51,7 +49,7 @@ const DirectChat = (($) => { static _jQueryInterface(config) { return this.each(function () { - let data = $(this).data(DATA_KEY) + let data = $(this).data(DATA_KEY) if (!data) { data = new DirectChat($(this)) @@ -70,9 +68,12 @@ const DirectChat = (($) => { */ $(document).on('click', Selector.DATA_TOGGLE, function (event) { - if (event) event.preventDefault(); - DirectChat._jQueryInterface.call($(this), 'toggle'); - }); + if (event) { + event.preventDefault() + } + + DirectChat._jQueryInterface.call($(this), 'toggle') + }) /** * jQuery API @@ -81,7 +82,7 @@ const DirectChat = (($) => { $.fn[NAME] = DirectChat._jQueryInterface $.fn[NAME].Constructor = DirectChat - $.fn[NAME].noConflict = function () { + $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT return DirectChat._jQueryInterface } diff --git a/build/js/Dropdown.js b/build/js/Dropdown.js index a28c927e2..dd579deb9 100644 --- a/build/js/Dropdown.js +++ b/build/js/Dropdown.js @@ -5,33 +5,30 @@ * -------------------------------------------- */ -const Dropdown = (($) => { +const Dropdown = ($ => { /** * Constants * ==================================================== */ - const NAME = 'Dropdown' - const DATA_KEY = 'lte.dropdown' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'Dropdown' + const DATA_KEY = 'lte.dropdown' const JQUERY_NO_CONFLICT = $.fn[NAME] const Selector = { NAVBAR: '.navbar', DROPDOWN_MENU: '.dropdown-menu', DROPDOWN_MENU_ACTIVE: '.dropdown-menu.show', - DROPDOWN_TOGGLE: '[data-toggle="dropdown"]', + DROPDOWN_TOGGLE: '[data-toggle="dropdown"]' } const ClassName = { - DROPDOWN_HOVER: 'dropdown-hover', DROPDOWN_RIGHT: 'dropdown-menu-right' } const Default = { } - /** * Class Definition * ==================================================== @@ -39,26 +36,26 @@ const Dropdown = (($) => { class Dropdown { constructor(element, config) { - this._config = config + this._config = config this._element = element } // Public toggleSubmenu() { - this._element.siblings().show().toggleClass("show") + this._element.siblings().show().toggleClass('show') - if (! this._element.next().hasClass('show')) { - this._element.parents('.dropdown-menu').first().find('.show').removeClass("show").hide() + if (!this._element.next().hasClass('show')) { + this._element.parents('.dropdown-menu').first().find('.show').removeClass('show').hide() } - this._element.parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) { - $('.dropdown-submenu .show').removeClass("show").hide() + this._element.parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', () => { + $('.dropdown-submenu .show').removeClass('show').hide() }) } fixPosition() { - let elm = $(Selector.DROPDOWN_MENU_ACTIVE) + const elm = $(Selector.DROPDOWN_MENU_ACTIVE) if (elm.length !== 0) { if (elm.hasClass(ClassName.DROPDOWN_RIGHT)) { @@ -69,28 +66,26 @@ const Dropdown = (($) => { elm.css('right', 'inherit') } - let offset = elm.offset() - let width = elm.width() - let windowWidth = $(window).width() - let visiblePart = windowWidth - offset.left + const offset = elm.offset() + const width = elm.width() + const windowWidth = $(window).width() + const visiblePart = windowWidth - offset.left if (offset.left < 0) { elm.css('left', 'inherit') elm.css('right', (offset.left - 5)) - } else { - if (visiblePart < width) { - elm.css('left', 'inherit') - elm.css('right', 0) - } + } else if (visiblePart < width) { + elm.css('left', 'inherit') + elm.css('right', 0) } - } + } } // Static static _jQueryInterface(config) { return this.each(function () { - let data = $(this).data(DATA_KEY) + let data = $(this).data(DATA_KEY) const _config = $.extend({}, Default, $(this).data()) if (!data) { @@ -98,7 +93,7 @@ const Dropdown = (($) => { $(this).data(DATA_KEY, data) } - if (config === 'toggleSubmenu' || config == 'fixPosition') { + if (config === 'toggleSubmenu' || config === 'fixPosition') { data[config]() } }) @@ -110,20 +105,20 @@ const Dropdown = (($) => { * ==================================================== */ - $(Selector.DROPDOWN_MENU + ' ' + Selector.DROPDOWN_TOGGLE).on("click", function(event) { + $(Selector.DROPDOWN_MENU + ' ' + Selector.DROPDOWN_TOGGLE).on('click', function (event) { event.preventDefault() event.stopPropagation() Dropdown._jQueryInterface.call($(this), 'toggleSubmenu') - }); + }) - $(Selector.NAVBAR + ' ' + Selector.DROPDOWN_TOGGLE).on("click", function(event) { + $(Selector.NAVBAR + ' ' + Selector.DROPDOWN_TOGGLE).on('click', event => { event.preventDefault() - setTimeout(function() { + setTimeout(function () { Dropdown._jQueryInterface.call($(this), 'fixPosition') }, 1) - }); + }) /** * jQuery API diff --git a/build/js/Layout.js b/build/js/Layout.js index 510d47594..83fc64a29 100644 --- a/build/js/Layout.js +++ b/build/js/Layout.js @@ -5,58 +5,41 @@ * -------------------------------------------- */ -const Layout = (($) => { +const Layout = ($ => { /** * Constants * ==================================================== */ - const NAME = 'Layout' - const DATA_KEY = 'lte.layout' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'Layout' + const DATA_KEY = 'lte.layout' const JQUERY_NO_CONFLICT = $.fn[NAME] - const Event = { - SIDEBAR: 'sidebar' - } - const Selector = { - HEADER : '.main-header', - MAIN_SIDEBAR : '.main-sidebar', - SIDEBAR : '.main-sidebar .sidebar', - CONTENT : '.content-wrapper', - BRAND : '.brand-link', - CONTENT_HEADER : '.content-header', - WRAPPER : '.wrapper', - CONTROL_SIDEBAR: '.control-sidebar', + HEADER: '.main-header', + MAIN_SIDEBAR: '.main-sidebar', + SIDEBAR: '.main-sidebar .sidebar', + CONTENT: '.content-wrapper', CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content', CONTROL_SIDEBAR_BTN: '[data-widget="control-sidebar"]', - LAYOUT_FIXED : '.layout-fixed', - FOOTER : '.main-footer', - PUSHMENU_BTN : '[data-widget="pushmenu"]', - LOGIN_BOX : '.login-box', - REGISTER_BOX : '.register-box' + FOOTER: '.main-footer', + PUSHMENU_BTN: '[data-widget="pushmenu"]', + LOGIN_BOX: '.login-box', + REGISTER_BOX: '.register-box' } const ClassName = { - HOLD : 'hold-transition', - SIDEBAR : 'main-sidebar', - CONTENT_FIXED : 'content-fixed', SIDEBAR_FOCUSED: 'sidebar-focused', - LAYOUT_FIXED : 'layout-fixed', - NAVBAR_FIXED : 'layout-navbar-fixed', - FOOTER_FIXED : 'layout-footer-fixed', - LOGIN_PAGE : 'login-page', - REGISTER_PAGE : 'register-page', + LAYOUT_FIXED: 'layout-fixed', CONTROL_SIDEBAR_SLIDE_OPEN: 'control-sidebar-slide-open', - CONTROL_SIDEBAR_OPEN: 'control-sidebar-open', + CONTROL_SIDEBAR_OPEN: 'control-sidebar-open' } const Default = { - scrollbarTheme : 'os-theme-light', + scrollbarTheme: 'os-theme-light', scrollbarAutoHide: 'l', panelAutoHeight: true, - loginRegisterAutoHeight: true, + loginRegisterAutoHeight: true } /** @@ -66,7 +49,7 @@ const Layout = (($) => { class Layout { constructor(element, config) { - this._config = config + this._config = config this._element = element this._init() @@ -75,10 +58,10 @@ const Layout = (($) => { // Public fixLayoutHeight(extra = null) { - let control_sidebar = 0 + let controlSidebar = 0 - if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || extra == 'control_sidebar') { - control_sidebar = $(Selector.CONTROL_SIDEBAR_CONTENT).height() + if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || extra === 'controlSidebar') { + controlSidebar = $(Selector.CONTROL_SIDEBAR_CONTENT).height() } const heights = { @@ -86,26 +69,27 @@ const Layout = (($) => { header: $(Selector.HEADER).length !== 0 ? $(Selector.HEADER).outerHeight() : 0, footer: $(Selector.FOOTER).length !== 0 ? $(Selector.FOOTER).outerHeight() : 0, sidebar: $(Selector.SIDEBAR).length !== 0 ? $(Selector.SIDEBAR).height() : 0, - control_sidebar: control_sidebar, + controlSidebar } const max = this._max(heights) let offset = this._config.panelAutoHeight if (offset === true) { - offset = 0; + offset = 0 } if (offset !== false) { - if (max == heights.control_sidebar) { + if (max === heights.controlSidebar) { $(Selector.CONTENT).css('min-height', (max + offset)) - } else if (max == heights.window) { + } else if (max === heights.window) { $(Selector.CONTENT).css('min-height', (max + offset) - heights.header - heights.footer) } else { $(Selector.CONTENT).css('min-height', (max + offset) - heights.header) } + if (this._isFooterFixed()) { - $(Selector.CONTENT).css('min-height', parseFloat($(Selector.CONTENT).css('min-height')) + heights.footer); + $(Selector.CONTENT).css('min-height', parseFloat($(Selector.CONTENT).css('min-height')) + heights.footer) } } @@ -116,11 +100,11 @@ const Layout = (($) => { if (typeof $.fn.overlayScrollbars !== 'undefined') { $(Selector.SIDEBAR).overlayScrollbars({ - className : this._config.scrollbarTheme, - sizeAutoCapable : true, - scrollbars : { - autoHide: this._config.scrollbarAutoHide, - clickScrolling : true + className: this._config.scrollbarTheme, + sizeAutoCapable: true, + scrollbars: { + autoHide: this._config.scrollbarAutoHide, + clickScrolling: true } }) } @@ -131,10 +115,10 @@ const Layout = (($) => { if ($(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).length === 0) { $('body, html').css('height', 'auto') } else if ($(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).length !== 0) { - let box_height = $(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).height() + const boxHeight = $(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).height() - if ($('body').css('min-height') !== box_height) { - $('body').css('min-height', box_height) + if ($('body').css('min-height') !== boxHeight) { + $('body').css('min-height', boxHeight) } } } @@ -148,7 +132,7 @@ const Layout = (($) => { if (this._config.loginRegisterAutoHeight === true) { this.fixLoginRegisterHeight() } else if (Number.isInteger(this._config.loginRegisterAutoHeight)) { - setInterval(this.fixLoginRegisterHeight, this._config.loginRegisterAutoHeight); + setInterval(this.fixLoginRegisterHeight, this._config.loginRegisterAutoHeight) } $(Selector.SIDEBAR) @@ -166,7 +150,7 @@ const Layout = (($) => { this.fixLayoutHeight() }) .on('expanded.lte.controlsidebar', () => { - this.fixLayoutHeight('control_sidebar') + this.fixLayoutHeight('controlSidebar') }) $(window).resize(() => { @@ -175,15 +159,14 @@ const Layout = (($) => { setTimeout(() => { $('body.hold-transition').removeClass('hold-transition') - - }, 50); + }, 50) } _max(numbers) { // Calculate the maximum number in a list let max = 0 - Object.keys(numbers).forEach((key) => { + Object.keys(numbers).forEach(key => { if (numbers[key] > max) { max = numbers[key] } @@ -193,7 +176,7 @@ const Layout = (($) => { } _isFooterFixed() { - return $('.main-footer').css('position') === 'fixed'; + return $('.main-footer').css('position') === 'fixed' } // Static @@ -209,7 +192,7 @@ const Layout = (($) => { } if (config === 'init' || config === '') { - data['_init']() + data._init() } else if (config === 'fixLayoutHeight' || config === 'fixLoginRegisterHeight') { data[config]() } @@ -227,11 +210,11 @@ const Layout = (($) => { }) $(Selector.SIDEBAR + ' a').on('focusin', () => { - $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED); + $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED) }) $(Selector.SIDEBAR + ' a').on('focusout', () => { - $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED); + $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED) }) /** diff --git a/build/js/PushMenu.js b/build/js/PushMenu.js index 5a73360a5..886e7a70f 100644 --- a/build/js/PushMenu.js +++ b/build/js/PushMenu.js @@ -5,15 +5,15 @@ * -------------------------------------------- */ -const PushMenu = (($) => { +const PushMenu = ($ => { /** * Constants * ==================================================== */ - const NAME = 'PushMenu' - const DATA_KEY = 'lte.pushmenu' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'PushMenu' + const DATA_KEY = 'lte.pushmenu' + const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] const Event = { @@ -29,8 +29,6 @@ const PushMenu = (($) => { const Selector = { TOGGLE_BUTTON: '[data-widget="pushmenu"]', - SIDEBAR_MINI: '.sidebar-mini', - SIDEBAR_COLLAPSED: '.sidebar-collapse', BODY: 'body', OVERLAY: '#sidebar-overlay', WRAPPER: '.wrapper' @@ -52,7 +50,7 @@ const PushMenu = (($) => { this._element = element this._options = $.extend({}, Default, options) - if (!$(Selector.OVERLAY).length) { + if ($(Selector.OVERLAY).length === 0) { this._addOverlay() } @@ -70,7 +68,7 @@ const PushMenu = (($) => { $(Selector.BODY).removeClass(ClassName.COLLAPSED).removeClass(ClassName.CLOSED) - if(this._options.enableRemember) { + if (this._options.enableRemember) { localStorage.setItem(`remember${EVENT_KEY}`, ClassName.OPEN) } @@ -87,7 +85,7 @@ const PushMenu = (($) => { $(Selector.BODY).addClass(ClassName.COLLAPSED) - if(this._options.enableRemember) { + if (this._options.enableRemember) { localStorage.setItem(`remember${EVENT_KEY}`, ClassName.COLLAPSED) } @@ -96,10 +94,10 @@ const PushMenu = (($) => { } toggle() { - if (!$(Selector.BODY).hasClass(ClassName.COLLAPSED)) { - this.collapse() - } else { + if ($(Selector.BODY).hasClass(ClassName.COLLAPSED)) { this.expand() + } else { + this.collapse() } } @@ -109,10 +107,10 @@ const PushMenu = (($) => { if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { this.collapse() } - } else if (resize == true) { + } else if (resize === true) { if ($(Selector.BODY).hasClass(ClassName.OPEN)) { $(Selector.BODY).removeClass(ClassName.OPEN) - } else if($(Selector.BODY).hasClass(ClassName.CLOSED)) { + } else if ($(Selector.BODY).hasClass(ClassName.CLOSED)) { this.expand() } } @@ -120,26 +118,24 @@ const PushMenu = (($) => { } remember() { - if(this._options.enableRemember) { - let toggleState = localStorage.getItem(`remember${EVENT_KEY}`) - if (toggleState == ClassName.COLLAPSED){ + if (this._options.enableRemember) { + const toggleState = localStorage.getItem(`remember${EVENT_KEY}`) + if (toggleState === ClassName.COLLAPSED) { if (this._options.noTransitionAfterReload) { - $("body").addClass('hold-transition').addClass(ClassName.COLLAPSED).delay(50).queue(function() { - $(this).removeClass('hold-transition') - $(this).dequeue() - }) - } else { - $("body").addClass(ClassName.COLLAPSED) - } - } else { - if (this._options.noTransitionAfterReload) { - $("body").addClass('hold-transition').removeClass(ClassName.COLLAPSED).delay(50).queue(function() { + $('body').addClass('hold-transition').addClass(ClassName.COLLAPSED).delay(50).queue(function () { $(this).removeClass('hold-transition') $(this).dequeue() }) } else { - $("body").removeClass(ClassName.COLLAPSED) + $('body').addClass(ClassName.COLLAPSED) } + } else if (this._options.noTransitionAfterReload) { + $('body').addClass('hold-transition').removeClass(ClassName.COLLAPSED).delay(50).queue(function () { + $(this).removeClass('hold-transition') + $(this).dequeue() + }) + } else { + $('body').removeClass(ClassName.COLLAPSED) } } } @@ -191,7 +187,7 @@ const PushMenu = (($) => { * ==================================================== */ - $(document).on('click', Selector.TOGGLE_BUTTON, (event) => { + $(document).on('click', Selector.TOGGLE_BUTTON, event => { event.preventDefault() let button = event.currentTarget @@ -214,7 +210,7 @@ const PushMenu = (($) => { $.fn[NAME] = PushMenu._jQueryInterface $.fn[NAME].Constructor = PushMenu - $.fn[NAME].noConflict = function () { + $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT return PushMenu._jQueryInterface } diff --git a/build/js/SiteSearch.js b/build/js/SiteSearch.js index b3ed9e5ad..a1dbbae8a 100644 --- a/build/js/SiteSearch.js +++ b/build/js/SiteSearch.js @@ -5,24 +5,21 @@ * -------------------------------------------- */ -const SiteSearch = (($) => { +const SiteSearch = ($ => { /** * Constants * ==================================================== */ - const NAME = 'SiteSearch' - const DATA_KEY = 'lte.site-search' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'SiteSearch' + const DATA_KEY = 'lte.site-search' const JQUERY_NO_CONFLICT = $.fn[NAME] - const Event = {} - const Selector = { - TOGGLE_BUTTON : '[data-widget="site-search"]', - SEARCH_BLOCK : '.site-search-block', + TOGGLE_BUTTON: '[data-widget="site-search"]', + SEARCH_BLOCK: '.site-search-block', SEARCH_BACKDROP: '.site-search-backdrop', - SEARCH_INPUT : '.site-search-block .form-control' + SEARCH_INPUT: '.site-search-block .form-control' } const ClassName = { @@ -39,7 +36,6 @@ const SiteSearch = (($) => { */ class SiteSearch { - constructor(_element, _options) { this.element = _element this.options = $.extend({}, Default, _options) @@ -80,7 +76,7 @@ const SiteSearch = (($) => { } if (!/toggle|close/.test(options)) { - throw Error(`Undefined method ${options}`) + throw new Error(`Undefined method ${options}`) } data[options]() @@ -92,7 +88,7 @@ const SiteSearch = (($) => { * Data API * ==================================================== */ - $(document).on('click', Selector.TOGGLE_BUTTON, (event) => { + $(document).on('click', Selector.TOGGLE_BUTTON, event => { event.preventDefault() let button = $(event.currentTarget) @@ -104,7 +100,7 @@ const SiteSearch = (($) => { SiteSearch._jQueryInterface.call(button, 'toggle') }) - $(document).on('click', Selector.SEARCH_BACKDROP, (event) => { + $(document).on('click', Selector.SEARCH_BACKDROP, event => { const backdrop = $(event.currentTarget) SiteSearch._jQueryInterface.call(backdrop, 'close') }) @@ -116,7 +112,7 @@ const SiteSearch = (($) => { $.fn[NAME] = SiteSearch._jQueryInterface $.fn[NAME].Constructor = SiteSearch - $.fn[NAME].noConflict = function () { + $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT return SiteSearch._jQueryInterface } diff --git a/build/js/Toasts.js b/build/js/Toasts.js index a4cfc2570..c9d9b1ee2 100644 --- a/build/js/Toasts.js +++ b/build/js/Toasts.js @@ -5,51 +5,42 @@ * -------------------------------------------- */ -const Toasts = (($) => { +const Toasts = ($ => { /** * Constants * ==================================================== */ - const NAME = 'Toasts' - const DATA_KEY = 'lte.toasts' - const EVENT_KEY = `.${DATA_KEY}` + const NAME = 'Toasts' + const DATA_KEY = 'lte.toasts' + const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] const Event = { INIT: `init${EVENT_KEY}`, CREATED: `created${EVENT_KEY}`, - REMOVED: `removed${EVENT_KEY}`, + REMOVED: `removed${EVENT_KEY}` } const Selector = { - BODY: 'toast-body', CONTAINER_TOP_RIGHT: '#toastsContainerTopRight', CONTAINER_TOP_LEFT: '#toastsContainerTopLeft', CONTAINER_BOTTOM_RIGHT: '#toastsContainerBottomRight', - CONTAINER_BOTTOM_LEFT: '#toastsContainerBottomLeft', + CONTAINER_BOTTOM_LEFT: '#toastsContainerBottomLeft' } const ClassName = { TOP_RIGHT: 'toasts-top-right', TOP_LEFT: 'toasts-top-left', BOTTOM_RIGHT: 'toasts-bottom-right', - BOTTOM_LEFT: 'toasts-bottom-left', - FADE: 'fade', + BOTTOM_LEFT: 'toasts-bottom-left' } const Position = { TOP_RIGHT: 'topRight', TOP_LEFT: 'topLeft', BOTTOM_RIGHT: 'bottomRight', - BOTTOM_LEFT: 'bottomLeft', - } - - const Id = { - CONTAINER_TOP_RIGHT: 'toastsContainerTopRight', - CONTAINER_TOP_LEFT: 'toastsContainerTopLeft', - CONTAINER_BOTTOM_RIGHT: 'toastsContainerBottomRight', - CONTAINER_BOTTOM_LEFT: 'toastsContainerBottomLeft', + BOTTOM_LEFT: 'bottomLeft' } const Default = { @@ -67,7 +58,7 @@ const Toasts = (($) => { subtitle: null, close: true, body: null, - class: null, + class: null } /** @@ -76,9 +67,9 @@ const Toasts = (($) => { */ class Toasts { constructor(element, config) { - this._config = config + this._config = config - this._prepareContainer(); + this._prepareContainer() const initEvent = $.Event(Event.INIT) $('body').trigger(initEvent) @@ -87,11 +78,11 @@ const Toasts = (($) => { // Public create() { - var toast = $('') + const toast = $('') toast.data('autohide', this._config.autohide) toast.data('animation', this._config.fade) - + if (this._config.class) { toast.addClass(this._config.class) } @@ -100,41 +91,41 @@ const Toasts = (($) => { toast.data('delay', this._config.delay) } - var toast_header = $('