mirror of https://github.com/ColorlibHQ/AdminLTE
Comply to the ESLint rules.
parent
5ba59f1454
commit
27ff009494
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = (ctx) => ({
|
||||
module.exports = () => ({
|
||||
map: {
|
||||
inline: false,
|
||||
annotation: true,
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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: '<div class="overlay"><i class="fas fa-2x fa-sync-alt fa-spin"></i></div>',
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 = $('<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"/>')
|
||||
const toast = $('<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"/>')
|
||||
|
||||
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 = $('<div class="toast-header">')
|
||||
const toastHeader = $('<div class="toast-header">')
|
||||
|
||||
if (this._config.image != null) {
|
||||
var toast_image = $('<img />').addClass('rounded mr-2').attr('src', this._config.image).attr('alt', this._config.imageAlt)
|
||||
|
||||
const toastImage = $('<img />').addClass('rounded mr-2').attr('src', this._config.image).attr('alt', this._config.imageAlt)
|
||||
|
||||
if (this._config.imageHeight != null) {
|
||||
toast_image.height(this._config.imageHeight).width('auto')
|
||||
toastImage.height(this._config.imageHeight).width('auto')
|
||||
}
|
||||
|
||||
toast_header.append(toast_image)
|
||||
toastHeader.append(toastImage)
|
||||
}
|
||||
|
||||
if (this._config.icon != null) {
|
||||
toast_header.append($('<i />').addClass('mr-2').addClass(this._config.icon))
|
||||
toastHeader.append($('<i />').addClass('mr-2').addClass(this._config.icon))
|
||||
}
|
||||
|
||||
if (this._config.title != null) {
|
||||
toast_header.append($('<strong />').addClass('mr-auto').html(this._config.title))
|
||||
toastHeader.append($('<strong />').addClass('mr-auto').html(this._config.title))
|
||||
}
|
||||
|
||||
if (this._config.subtitle != null) {
|
||||
toast_header.append($('<small />').html(this._config.subtitle))
|
||||
toastHeader.append($('<small />').html(this._config.subtitle))
|
||||
}
|
||||
|
||||
if (this._config.close == true) {
|
||||
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">×</span>')
|
||||
|
||||
const toastClose = $('<button data-dismiss="toast" />').attr('type', 'button').addClass('ml-2 mb-1 close').attr('aria-label', 'Close').append('<span aria-hidden="true">×</span>')
|
||||
|
||||
if (this._config.title == null) {
|
||||
toast_close.toggleClass('ml-2 ml-auto')
|
||||
toastClose.toggleClass('ml-2 ml-auto')
|
||||
}
|
||||
|
||||
toast_header.append(toast_close)
|
||||
|
||||
toastHeader.append(toastClose)
|
||||
}
|
||||
|
||||
toast.append(toast_header)
|
||||
toast.append(toastHeader)
|
||||
|
||||
if (this._config.body != null) {
|
||||
toast.append($('<div class="toast-body" />').html(this._config.body))
|
||||
|
@ -147,36 +138,39 @@ const Toasts = (($) => {
|
|||
|
||||
toast.toast('show')
|
||||
|
||||
|
||||
if (this._config.autoremove) {
|
||||
toast.on('hidden.bs.toast', function () {
|
||||
$(this).delay(200).remove();
|
||||
$(this).delay(200).remove()
|
||||
|
||||
const removedEvent = $.Event(Event.REMOVED)
|
||||
$('body').trigger(removedEvent)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
_getContainerId() {
|
||||
if (this._config.position == Position.TOP_RIGHT) {
|
||||
return Selector.CONTAINER_TOP_RIGHT;
|
||||
} else if (this._config.position == Position.TOP_LEFT) {
|
||||
return Selector.CONTAINER_TOP_LEFT;
|
||||
} else if (this._config.position == Position.BOTTOM_RIGHT) {
|
||||
return Selector.CONTAINER_BOTTOM_RIGHT;
|
||||
} else if (this._config.position == Position.BOTTOM_LEFT) {
|
||||
return Selector.CONTAINER_BOTTOM_LEFT;
|
||||
return Selector.CONTAINER_TOP_RIGHT
|
||||
}
|
||||
|
||||
if (this._config.position == Position.TOP_LEFT) {
|
||||
return Selector.CONTAINER_TOP_LEFT
|
||||
}
|
||||
|
||||
if (this._config.position == Position.BOTTOM_RIGHT) {
|
||||
return Selector.CONTAINER_BOTTOM_RIGHT
|
||||
}
|
||||
|
||||
if (this._config.position == Position.BOTTOM_LEFT) {
|
||||
return Selector.CONTAINER_BOTTOM_LEFT
|
||||
}
|
||||
}
|
||||
|
||||
_prepareContainer() {
|
||||
if ($(this._getContainerId()).length === 0) {
|
||||
var container = $('<div />').attr('id', this._getContainerId().replace('#', ''))
|
||||
const container = $('<div />').attr('id', this._getContainerId().replace('#', ''))
|
||||
if (this._config.position == Position.TOP_RIGHT) {
|
||||
container.addClass(ClassName.TOP_RIGHT)
|
||||
} else if (this._config.position == Position.TOP_LEFT) {
|
||||
|
@ -202,7 +196,7 @@ const Toasts = (($) => {
|
|||
static _jQueryInterface(option, config) {
|
||||
return this.each(function () {
|
||||
const _options = $.extend({}, Default, config)
|
||||
var toast = new Toasts($(this), _options)
|
||||
const toast = new Toasts($(this), _options)
|
||||
|
||||
if (option === 'create') {
|
||||
toast[option]()
|
||||
|
@ -218,7 +212,7 @@ const Toasts = (($) => {
|
|||
|
||||
$.fn[NAME] = Toasts._jQueryInterface
|
||||
$.fn[NAME].Constructor = Toasts
|
||||
$.fn[NAME].noConflict = function () {
|
||||
$.fn[NAME].noConflict = function () {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
||||
return Toasts._jQueryInterface
|
||||
}
|
||||
|
|
|
@ -5,15 +5,14 @@
|
|||
* --------------------------------------------
|
||||
*/
|
||||
|
||||
const TodoList = (($) => {
|
||||
const TodoList = ($ => {
|
||||
/**
|
||||
* Constants
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
const NAME = 'TodoList'
|
||||
const DATA_KEY = 'lte.todolist'
|
||||
const EVENT_KEY = `.${DATA_KEY}`
|
||||
const NAME = 'TodoList'
|
||||
const DATA_KEY = 'lte.todolist'
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
|
||||
const Selector = {
|
||||
|
@ -25,11 +24,11 @@ const TodoList = (($) => {
|
|||
}
|
||||
|
||||
const Default = {
|
||||
onCheck: function (item) {
|
||||
return item;
|
||||
onCheck(item) {
|
||||
return item
|
||||
},
|
||||
onUnCheck: function (item) {
|
||||
return item;
|
||||
onUnCheck(item) {
|
||||
return item
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +39,7 @@ const TodoList = (($) => {
|
|||
|
||||
class TodoList {
|
||||
constructor(element, config) {
|
||||
this._config = config
|
||||
this._config = config
|
||||
this._element = element
|
||||
|
||||
this._init()
|
||||
|
@ -49,29 +48,29 @@ const TodoList = (($) => {
|
|||
// Public
|
||||
|
||||
toggle(item) {
|
||||
item.parents('li').toggleClass(ClassName.TODO_LIST_DONE);
|
||||
if (! $(item).prop('checked')) {
|
||||
this.unCheck($(item));
|
||||
return;
|
||||
item.parents('li').toggleClass(ClassName.TODO_LIST_DONE)
|
||||
if (!$(item).prop('checked')) {
|
||||
this.unCheck($(item))
|
||||
return
|
||||
}
|
||||
|
||||
this.check(item);
|
||||
this.check(item)
|
||||
}
|
||||
|
||||
check (item) {
|
||||
this._config.onCheck.call(item);
|
||||
check(item) {
|
||||
this._config.onCheck.call(item)
|
||||
}
|
||||
|
||||
unCheck (item) {
|
||||
this._config.onUnCheck.call(item);
|
||||
unCheck(item) {
|
||||
this._config.onUnCheck.call(item)
|
||||
}
|
||||
|
||||
// Private
|
||||
|
||||
_init() {
|
||||
var that = this
|
||||
const that = this
|
||||
$(Selector.DATA_TOGGLE).find('input:checkbox:checked').parents('li').toggleClass(ClassName.TODO_LIST_DONE)
|
||||
$(Selector.DATA_TOGGLE).on('change', 'input:checkbox', (event) => {
|
||||
$(Selector.DATA_TOGGLE).on('change', 'input:checkbox', event => {
|
||||
that.toggle($(event.target))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,45 +5,41 @@
|
|||
* --------------------------------------------
|
||||
*/
|
||||
|
||||
const Treeview = (($) => {
|
||||
const Treeview = ($ => {
|
||||
/**
|
||||
* Constants
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
const NAME = 'Treeview'
|
||||
const DATA_KEY = 'lte.treeview'
|
||||
const EVENT_KEY = `.${DATA_KEY}`
|
||||
const NAME = 'Treeview'
|
||||
const DATA_KEY = 'lte.treeview'
|
||||
const EVENT_KEY = `.${DATA_KEY}`
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
|
||||
const Event = {
|
||||
SELECTED : `selected${EVENT_KEY}`,
|
||||
EXPANDED : `expanded${EVENT_KEY}`,
|
||||
COLLAPSED : `collapsed${EVENT_KEY}`,
|
||||
EXPANDED: `expanded${EVENT_KEY}`,
|
||||
COLLAPSED: `collapsed${EVENT_KEY}`,
|
||||
LOAD_DATA_API: `load${EVENT_KEY}`
|
||||
}
|
||||
|
||||
const Selector = {
|
||||
LI : '.nav-item',
|
||||
LINK : '.nav-link',
|
||||
LI: '.nav-item',
|
||||
LINK: '.nav-link',
|
||||
TREEVIEW_MENU: '.nav-treeview',
|
||||
OPEN : '.menu-open',
|
||||
DATA_WIDGET : '[data-widget="treeview"]'
|
||||
OPEN: '.menu-open',
|
||||
DATA_WIDGET: '[data-widget="treeview"]'
|
||||
}
|
||||
|
||||
const ClassName = {
|
||||
LI : 'nav-item',
|
||||
LINK : 'nav-link',
|
||||
TREEVIEW_MENU : 'nav-treeview',
|
||||
OPEN : 'menu-open',
|
||||
OPEN: 'menu-open',
|
||||
SIDEBAR_COLLAPSED: 'sidebar-collapse'
|
||||
}
|
||||
|
||||
const Default = {
|
||||
trigger : `${Selector.DATA_WIDGET} ${Selector.LINK}`,
|
||||
animationSpeed : 300,
|
||||
accordion : true,
|
||||
expandSidebar : false,
|
||||
trigger: `${Selector.DATA_WIDGET} ${Selector.LINK}`,
|
||||
animationSpeed: 300,
|
||||
accordion: true,
|
||||
expandSidebar: false,
|
||||
sidebarButtonSelector: '[data-widget="pushmenu"]'
|
||||
}
|
||||
|
||||
|
@ -53,7 +49,7 @@ const Treeview = (($) => {
|
|||
*/
|
||||
class Treeview {
|
||||
constructor(element, config) {
|
||||
this._config = config
|
||||
this._config = config
|
||||
this._element = element
|
||||
}
|
||||
|
||||
|
@ -67,7 +63,7 @@ const Treeview = (($) => {
|
|||
const expandedEvent = $.Event(Event.EXPANDED)
|
||||
|
||||
if (this._config.accordion) {
|
||||
const openMenuLi = parentLi.siblings(Selector.OPEN).first()
|
||||
const openMenuLi = parentLi.siblings(Selector.OPEN).first()
|
||||
const openTreeview = openMenuLi.find(Selector.TREEVIEW_MENU).first()
|
||||
this.collapse(openTreeview, openMenuLi)
|
||||
}
|
||||
|
@ -94,14 +90,12 @@ const Treeview = (($) => {
|
|||
}
|
||||
|
||||
toggle(event) {
|
||||
|
||||
const $relativeTarget = $(event.currentTarget)
|
||||
const $parent = $relativeTarget.parent()
|
||||
|
||||
let treeviewMenu = $parent.find('> ' + Selector.TREEVIEW_MENU)
|
||||
|
||||
if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) {
|
||||
|
||||
if (!$parent.is(Selector.LI)) {
|
||||
treeviewMenu = $parent.parent().find('> ' + Selector.TREEVIEW_MENU)
|
||||
}
|
||||
|
@ -110,11 +104,11 @@ const Treeview = (($) => {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
event.preventDefault()
|
||||
|
||||
const parentLi = $relativeTarget.parents(Selector.LI).first()
|
||||
const isOpen = parentLi.hasClass(ClassName.OPEN)
|
||||
const isOpen = parentLi.hasClass(ClassName.OPEN)
|
||||
|
||||
if (isOpen) {
|
||||
this.collapse($(treeviewMenu), parentLi)
|
||||
|
@ -126,7 +120,7 @@ const Treeview = (($) => {
|
|||
// Private
|
||||
|
||||
_setupListeners() {
|
||||
$(document).on('click', this._config.trigger, (event) => {
|
||||
$(document).on('click', this._config.trigger, event => {
|
||||
this.toggle(event)
|
||||
})
|
||||
}
|
||||
|
@ -174,7 +168,7 @@ const Treeview = (($) => {
|
|||
|
||||
$.fn[NAME] = Treeview._jQueryInterface
|
||||
$.fn[NAME].Constructor = Treeview
|
||||
$.fn[NAME].noConflict = function () {
|
||||
$.fn[NAME].noConflict = function () {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
||||
return Treeview._jQueryInterface
|
||||
}
|
||||
|
|
|
@ -1,45 +1,47 @@
|
|||
'use strict'
|
||||
|
||||
const Plugins = [
|
||||
// AdminLTE Dist
|
||||
{
|
||||
from: 'dist/css/',
|
||||
to : 'docs/assets/css/'
|
||||
to: 'docs/assets/css/'
|
||||
},
|
||||
{
|
||||
from: 'dist/js/',
|
||||
to : 'docs/assets/js/'
|
||||
to: 'docs/assets/js/'
|
||||
},
|
||||
// jQuery
|
||||
{
|
||||
from: 'node_modules/jquery/dist/',
|
||||
to : 'docs/assets/plugins/jquery/'
|
||||
to: 'docs/assets/plugins/jquery/'
|
||||
},
|
||||
// Popper
|
||||
{
|
||||
from: 'node_modules/popper.js/dist/',
|
||||
to : 'docs/assets/plugins/popper/'
|
||||
to: 'docs/assets/plugins/popper/'
|
||||
},
|
||||
// Bootstrap
|
||||
{
|
||||
from: 'node_modules/bootstrap/dist/js/',
|
||||
to : 'docs/assets/plugins/bootstrap/js/'
|
||||
to: 'docs/assets/plugins/bootstrap/js/'
|
||||
},
|
||||
// Font Awesome
|
||||
{
|
||||
from: 'node_modules/@fortawesome/fontawesome-free/css/',
|
||||
to : 'docs/assets/plugins/fontawesome-free/css/'
|
||||
to: 'docs/assets/plugins/fontawesome-free/css/'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@fortawesome/fontawesome-free/webfonts/',
|
||||
to : 'docs/assets/plugins/fontawesome-free/webfonts/'
|
||||
to: 'docs/assets/plugins/fontawesome-free/webfonts/'
|
||||
},
|
||||
// overlayScrollbars
|
||||
{
|
||||
from: 'node_modules/overlayscrollbars/js/',
|
||||
to : 'docs/assets/plugins/overlayScrollbars/js/'
|
||||
to: 'docs/assets/plugins/overlayScrollbars/js/'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/overlayscrollbars/css/',
|
||||
to : 'docs/assets/plugins/overlayScrollbars/css/'
|
||||
to: 'docs/assets/plugins/overlayScrollbars/css/'
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const Plugins = require('./DocsPlugins')
|
||||
const fse = require('fs-extra')
|
||||
const fse = require('fs-extra')
|
||||
|
||||
class Publish {
|
||||
constructor() {
|
||||
|
@ -12,7 +14,7 @@ class Publish {
|
|||
|
||||
getArguments() {
|
||||
if (process.argv.length > 2) {
|
||||
let arg = process.argv[2]
|
||||
const arg = process.argv[2]
|
||||
switch (arg) {
|
||||
case '-v':
|
||||
case '--verbose':
|
||||
|
@ -26,15 +28,15 @@ class Publish {
|
|||
|
||||
run() {
|
||||
// Publish files
|
||||
Plugins.forEach((module) => {
|
||||
Plugins.forEach(module => {
|
||||
try {
|
||||
fse.copySync(module.from, module.to)
|
||||
|
||||
if (this.options.verbose) {
|
||||
console.log(`Copied ${module.from} to ${module.to}`)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Error: ${err}`)
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,102 +1,104 @@
|
|||
'use strict'
|
||||
|
||||
const Plugins = [
|
||||
// jQuery
|
||||
{
|
||||
from: 'node_modules/jquery/dist',
|
||||
to : 'plugins/jquery'
|
||||
to: 'plugins/jquery'
|
||||
},
|
||||
// Popper
|
||||
{
|
||||
from: 'node_modules/popper.js/dist',
|
||||
to : 'plugins/popper'
|
||||
to: 'plugins/popper'
|
||||
},
|
||||
// Bootstrap
|
||||
{
|
||||
from: 'node_modules/bootstrap/dist/js',
|
||||
to : 'plugins/bootstrap/js'
|
||||
to: 'plugins/bootstrap/js'
|
||||
},
|
||||
// Font Awesome
|
||||
{
|
||||
from: 'node_modules/@fortawesome/fontawesome-free/css',
|
||||
to : 'plugins/fontawesome-free/css'
|
||||
to: 'plugins/fontawesome-free/css'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@fortawesome/fontawesome-free/webfonts',
|
||||
to : 'plugins/fontawesome-free/webfonts'
|
||||
to: 'plugins/fontawesome-free/webfonts'
|
||||
},
|
||||
// overlayScrollbars
|
||||
{
|
||||
from: 'node_modules/overlayscrollbars/js',
|
||||
to : 'plugins/overlayScrollbars/js'
|
||||
to: 'plugins/overlayScrollbars/js'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/overlayscrollbars/css',
|
||||
to : 'plugins/overlayScrollbars/css'
|
||||
to: 'plugins/overlayScrollbars/css'
|
||||
},
|
||||
// Chart.js
|
||||
{
|
||||
from: 'node_modules/chart.js/dist/',
|
||||
to : 'plugins/chart.js'
|
||||
to: 'plugins/chart.js'
|
||||
},
|
||||
// jQuery UI
|
||||
{
|
||||
from: 'node_modules/jquery-ui-dist/',
|
||||
to : 'plugins/jquery-ui'
|
||||
to: 'plugins/jquery-ui'
|
||||
},
|
||||
// Flot
|
||||
{
|
||||
from: 'node_modules/flot/dist/es5/',
|
||||
to : 'plugins/flot'
|
||||
to: 'plugins/flot'
|
||||
},
|
||||
// Summernote
|
||||
{
|
||||
from: 'node_modules/summernote/dist/',
|
||||
to : 'plugins/summernote'
|
||||
to: 'plugins/summernote'
|
||||
},
|
||||
// Bootstrap Slider
|
||||
{
|
||||
from: 'node_modules/bootstrap-slider/dist/',
|
||||
to : 'plugins/bootstrap-slider'
|
||||
to: 'plugins/bootstrap-slider'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/bootstrap-slider/dist/css',
|
||||
to : 'plugins/bootstrap-slider/css'
|
||||
to: 'plugins/bootstrap-slider/css'
|
||||
},
|
||||
// Bootstrap Colorpicker
|
||||
{
|
||||
from: 'node_modules/bootstrap-colorpicker/dist/js',
|
||||
to : 'plugins/bootstrap-colorpicker/js'
|
||||
to: 'plugins/bootstrap-colorpicker/js'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/bootstrap-colorpicker/dist/css',
|
||||
to : 'plugins/bootstrap-colorpicker/css'
|
||||
to: 'plugins/bootstrap-colorpicker/css'
|
||||
},
|
||||
// Tempusdominus Bootstrap 4
|
||||
{
|
||||
from: 'node_modules/tempusdominus-bootstrap-4/build/js',
|
||||
to : 'plugins/tempusdominus-bootstrap-4/js'
|
||||
to: 'plugins/tempusdominus-bootstrap-4/js'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/tempusdominus-bootstrap-4/build/css',
|
||||
to : 'plugins/tempusdominus-bootstrap-4/css'
|
||||
to: 'plugins/tempusdominus-bootstrap-4/css'
|
||||
},
|
||||
// Moment
|
||||
{
|
||||
from: 'node_modules/moment/min',
|
||||
to : 'plugins/moment'
|
||||
to: 'plugins/moment'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/moment/locale',
|
||||
to : 'plugins/moment/locale'
|
||||
to: 'plugins/moment/locale'
|
||||
},
|
||||
// FastClick
|
||||
{
|
||||
from: 'node_modules/fastclick/lib',
|
||||
to : 'plugins/fastclick'
|
||||
to: 'plugins/fastclick'
|
||||
},
|
||||
// Date Range Picker
|
||||
{
|
||||
from: 'node_modules/daterangepicker/',
|
||||
to : 'plugins/daterangepicker'
|
||||
to: 'plugins/daterangepicker'
|
||||
},
|
||||
// DataTables
|
||||
{
|
||||
|
@ -255,96 +257,96 @@ const Plugins = [
|
|||
// Fullcalendar
|
||||
{
|
||||
from: 'node_modules/@fullcalendar/core/',
|
||||
to : 'plugins/fullcalendar'
|
||||
to: 'plugins/fullcalendar'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@fullcalendar/bootstrap/',
|
||||
to : 'plugins/fullcalendar-bootstrap'
|
||||
to: 'plugins/fullcalendar-bootstrap'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@fullcalendar/daygrid/',
|
||||
to : 'plugins/fullcalendar-daygrid'
|
||||
to: 'plugins/fullcalendar-daygrid'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@fullcalendar/timegrid/',
|
||||
to : 'plugins/fullcalendar-timegrid'
|
||||
to: 'plugins/fullcalendar-timegrid'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@fullcalendar/interaction/',
|
||||
to : 'plugins/fullcalendar-interaction'
|
||||
to: 'plugins/fullcalendar-interaction'
|
||||
},
|
||||
// icheck bootstrap
|
||||
{
|
||||
from: 'node_modules/icheck-bootstrap/',
|
||||
to : 'plugins/icheck-bootstrap'
|
||||
to: 'plugins/icheck-bootstrap'
|
||||
},
|
||||
// inputmask
|
||||
{
|
||||
from: 'node_modules/inputmask/dist/',
|
||||
to : 'plugins/inputmask'
|
||||
to: 'plugins/inputmask'
|
||||
},
|
||||
// ion-rangeslider
|
||||
{
|
||||
from: 'node_modules/ion-rangeslider/',
|
||||
to : 'plugins/ion-rangeslider'
|
||||
to: 'plugins/ion-rangeslider'
|
||||
},
|
||||
// JQVMap (jqvmap-novulnerability)
|
||||
{
|
||||
from: 'node_modules/jqvmap-novulnerability/dist/',
|
||||
to : 'plugins/jqvmap'
|
||||
to: 'plugins/jqvmap'
|
||||
},
|
||||
// jQuery Mapael
|
||||
{
|
||||
from: 'node_modules/jquery-mapael/js/',
|
||||
to : 'plugins/jquery-mapael'
|
||||
to: 'plugins/jquery-mapael'
|
||||
},
|
||||
// Raphael
|
||||
{
|
||||
from: 'node_modules/raphael/',
|
||||
to : 'plugins/raphael'
|
||||
to: 'plugins/raphael'
|
||||
},
|
||||
// jQuery Mousewheel
|
||||
{
|
||||
from: 'node_modules/jquery-mousewheel/',
|
||||
to : 'plugins/jquery-mousewheel'
|
||||
to: 'plugins/jquery-mousewheel'
|
||||
},
|
||||
// jQuery Knob
|
||||
{
|
||||
from: 'node_modules/jquery-knob-chif/dist/',
|
||||
to : 'plugins/jquery-knob'
|
||||
to: 'plugins/jquery-knob'
|
||||
},
|
||||
// pace-progress
|
||||
{
|
||||
from: 'node_modules/@lgaitan/pace-progress/dist/',
|
||||
to : 'plugins/pace-progress'
|
||||
to: 'plugins/pace-progress'
|
||||
},
|
||||
// Select2
|
||||
{
|
||||
from: 'node_modules/select2/dist/',
|
||||
to : 'plugins/select2'
|
||||
to: 'plugins/select2'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@ttskch/select2-bootstrap4-theme/dist/',
|
||||
to : 'plugins/select2-bootstrap4-theme'
|
||||
to: 'plugins/select2-bootstrap4-theme'
|
||||
},
|
||||
// Sparklines
|
||||
{
|
||||
from: 'node_modules/sparklines/source/',
|
||||
to : 'plugins/sparklines'
|
||||
to: 'plugins/sparklines'
|
||||
},
|
||||
// SweetAlert2
|
||||
{
|
||||
from: 'node_modules/sweetalert2/dist/',
|
||||
to : 'plugins/sweetalert2'
|
||||
to: 'plugins/sweetalert2'
|
||||
},
|
||||
{
|
||||
from: 'node_modules/@sweetalert2/theme-bootstrap-4/',
|
||||
to : 'plugins/sweetalert2-theme-bootstrap-4'
|
||||
to: 'plugins/sweetalert2-theme-bootstrap-4'
|
||||
},
|
||||
// Toastr
|
||||
{
|
||||
from: 'node_modules/toastr/build/',
|
||||
to : 'plugins/toastr'
|
||||
to: 'plugins/toastr'
|
||||
},
|
||||
// jsGrid
|
||||
{
|
||||
|
@ -387,13 +389,13 @@ const Plugins = [
|
|||
// jQuery Validate
|
||||
{
|
||||
from: 'node_modules/jquery-validation/dist/',
|
||||
to : 'plugins/jquery-validation'
|
||||
to: 'plugins/jquery-validation'
|
||||
},
|
||||
// bs-custom-file-input
|
||||
{
|
||||
from: 'node_modules/bs-custom-file-input/dist/',
|
||||
to : 'plugins/bs-custom-file-input'
|
||||
},
|
||||
to: 'plugins/bs-custom-file-input'
|
||||
}
|
||||
]
|
||||
|
||||
module.exports = Plugins
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const Plugins = require('./Plugins')
|
||||
const fse = require('fs-extra')
|
||||
const fse = require('fs-extra')
|
||||
|
||||
class Publish {
|
||||
constructor() {
|
||||
|
@ -12,7 +14,7 @@ class Publish {
|
|||
|
||||
getArguments() {
|
||||
if (process.argv.length > 2) {
|
||||
let arg = process.argv[2]
|
||||
const arg = process.argv[2]
|
||||
switch (arg) {
|
||||
case '-v':
|
||||
case '--verbose':
|
||||
|
@ -26,7 +28,7 @@ class Publish {
|
|||
|
||||
run() {
|
||||
// Publish files
|
||||
Plugins.forEach((module) => {
|
||||
Plugins.forEach(module => {
|
||||
try {
|
||||
if (fse.existsSync(module.from)) {
|
||||
fse.copySync(module.from, module.to)
|
||||
|
@ -37,8 +39,8 @@ class Publish {
|
|||
if (this.options.verbose) {
|
||||
console.log(`Copied ${module.from} to ${module.to}`)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Error: ${err}`)
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
* You should not use this file in production.
|
||||
* This file is for demo purposes only.
|
||||
*/
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
(function ($) {
|
||||
'use strict'
|
||||
|
||||
var $sidebar = $('.control-sidebar')
|
||||
var $sidebar = $('.control-sidebar')
|
||||
var $container = $('<div />', {
|
||||
class: 'p-3 control-sidebar-content'
|
||||
})
|
||||
|
@ -29,14 +32,14 @@
|
|||
'navbar-cyan',
|
||||
'navbar-dark',
|
||||
'navbar-gray-dark',
|
||||
'navbar-gray',
|
||||
'navbar-gray'
|
||||
]
|
||||
|
||||
var navbar_light_skins = [
|
||||
'navbar-light',
|
||||
'navbar-warning',
|
||||
'navbar-white',
|
||||
'navbar-orange',
|
||||
'navbar-orange'
|
||||
]
|
||||
|
||||
$container.append(
|
||||
|
@ -44,10 +47,10 @@
|
|||
)
|
||||
|
||||
var $no_border_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.main-header').hasClass('border-bottom-0'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.main-header').addClass('border-bottom-0')
|
||||
|
@ -55,14 +58,14 @@
|
|||
$('.main-header').removeClass('border-bottom-0')
|
||||
}
|
||||
})
|
||||
var $no_border_container = $('<div />', {'class': 'mb-1'}).append($no_border_checkbox).append('<span>No Navbar border</span>')
|
||||
var $no_border_container = $('<div />', { class: 'mb-1' }).append($no_border_checkbox).append('<span>No Navbar border</span>')
|
||||
$container.append($no_border_container)
|
||||
|
||||
var $text_sm_body_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('body').hasClass('text-sm'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('body').addClass('text-sm')
|
||||
|
@ -70,14 +73,14 @@
|
|||
$('body').removeClass('text-sm')
|
||||
}
|
||||
})
|
||||
var $text_sm_body_container = $('<div />', {'class': 'mb-1'}).append($text_sm_body_checkbox).append('<span>Body small text</span>')
|
||||
var $text_sm_body_container = $('<div />', { class: 'mb-1' }).append($text_sm_body_checkbox).append('<span>Body small text</span>')
|
||||
$container.append($text_sm_body_container)
|
||||
|
||||
var $text_sm_header_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.main-header').hasClass('text-sm'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.main-header').addClass('text-sm')
|
||||
|
@ -85,14 +88,14 @@
|
|||
$('.main-header').removeClass('text-sm')
|
||||
}
|
||||
})
|
||||
var $text_sm_header_container = $('<div />', {'class': 'mb-1'}).append($text_sm_header_checkbox).append('<span>Navbar small text</span>')
|
||||
var $text_sm_header_container = $('<div />', { class: 'mb-1' }).append($text_sm_header_checkbox).append('<span>Navbar small text</span>')
|
||||
$container.append($text_sm_header_container)
|
||||
|
||||
var $text_sm_sidebar_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.nav-sidebar').hasClass('text-sm'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nav-sidebar').addClass('text-sm')
|
||||
|
@ -100,14 +103,14 @@
|
|||
$('.nav-sidebar').removeClass('text-sm')
|
||||
}
|
||||
})
|
||||
var $text_sm_sidebar_container = $('<div />', {'class': 'mb-1'}).append($text_sm_sidebar_checkbox).append('<span>Sidebar nav small text</span>')
|
||||
var $text_sm_sidebar_container = $('<div />', { class: 'mb-1' }).append($text_sm_sidebar_checkbox).append('<span>Sidebar nav small text</span>')
|
||||
$container.append($text_sm_sidebar_container)
|
||||
|
||||
var $text_sm_footer_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.main-footer').hasClass('text-sm'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.main-footer').addClass('text-sm')
|
||||
|
@ -115,14 +118,14 @@
|
|||
$('.main-footer').removeClass('text-sm')
|
||||
}
|
||||
})
|
||||
var $text_sm_footer_container = $('<div />', {'class': 'mb-1'}).append($text_sm_footer_checkbox).append('<span>Footer small text</span>')
|
||||
var $text_sm_footer_container = $('<div />', { class: 'mb-1' }).append($text_sm_footer_checkbox).append('<span>Footer small text</span>')
|
||||
$container.append($text_sm_footer_container)
|
||||
|
||||
var $flat_sidebar_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.nav-sidebar').hasClass('nav-flat'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nav-sidebar').addClass('nav-flat')
|
||||
|
@ -130,14 +133,14 @@
|
|||
$('.nav-sidebar').removeClass('nav-flat')
|
||||
}
|
||||
})
|
||||
var $flat_sidebar_container = $('<div />', {'class': 'mb-1'}).append($flat_sidebar_checkbox).append('<span>Sidebar nav flat style</span>')
|
||||
var $flat_sidebar_container = $('<div />', { class: 'mb-1' }).append($flat_sidebar_checkbox).append('<span>Sidebar nav flat style</span>')
|
||||
$container.append($flat_sidebar_container)
|
||||
|
||||
var $legacy_sidebar_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.nav-sidebar').hasClass('nav-legacy'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nav-sidebar').addClass('nav-legacy')
|
||||
|
@ -145,14 +148,14 @@
|
|||
$('.nav-sidebar').removeClass('nav-legacy')
|
||||
}
|
||||
})
|
||||
var $legacy_sidebar_container = $('<div />', {'class': 'mb-1'}).append($legacy_sidebar_checkbox).append('<span>Sidebar nav legacy style</span>')
|
||||
var $legacy_sidebar_container = $('<div />', { class: 'mb-1' }).append($legacy_sidebar_checkbox).append('<span>Sidebar nav legacy style</span>')
|
||||
$container.append($legacy_sidebar_container)
|
||||
|
||||
var $compact_sidebar_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.nav-sidebar').hasClass('nav-compact'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nav-sidebar').addClass('nav-compact')
|
||||
|
@ -160,14 +163,14 @@
|
|||
$('.nav-sidebar').removeClass('nav-compact')
|
||||
}
|
||||
})
|
||||
var $compact_sidebar_container = $('<div />', {'class': 'mb-1'}).append($compact_sidebar_checkbox).append('<span>Sidebar nav compact</span>')
|
||||
var $compact_sidebar_container = $('<div />', { class: 'mb-1' }).append($compact_sidebar_checkbox).append('<span>Sidebar nav compact</span>')
|
||||
$container.append($compact_sidebar_container)
|
||||
|
||||
var $child_indent_sidebar_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.nav-sidebar').hasClass('nav-child-indent'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nav-sidebar').addClass('nav-child-indent')
|
||||
|
@ -175,14 +178,14 @@
|
|||
$('.nav-sidebar').removeClass('nav-child-indent')
|
||||
}
|
||||
})
|
||||
var $child_indent_sidebar_container = $('<div />', {'class': 'mb-1'}).append($child_indent_sidebar_checkbox).append('<span>Sidebar nav child indent</span>')
|
||||
var $child_indent_sidebar_container = $('<div />', { class: 'mb-1' }).append($child_indent_sidebar_checkbox).append('<span>Sidebar nav child indent</span>')
|
||||
$container.append($child_indent_sidebar_container)
|
||||
|
||||
var $no_expand_sidebar_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.main-sidebar').hasClass('sidebar-no-expand'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.main-sidebar').addClass('sidebar-no-expand')
|
||||
|
@ -190,14 +193,14 @@
|
|||
$('.main-sidebar').removeClass('sidebar-no-expand')
|
||||
}
|
||||
})
|
||||
var $no_expand_sidebar_container = $('<div />', {'class': 'mb-1'}).append($no_expand_sidebar_checkbox).append('<span>Main Sidebar disable hover/focus auto expand</span>')
|
||||
var $no_expand_sidebar_container = $('<div />', { class: 'mb-1' }).append($no_expand_sidebar_checkbox).append('<span>Main Sidebar disable hover/focus auto expand</span>')
|
||||
$container.append($no_expand_sidebar_container)
|
||||
|
||||
var $text_sm_brand_checkbox = $('<input />', {
|
||||
type : 'checkbox',
|
||||
value : 1,
|
||||
type: 'checkbox',
|
||||
value: 1,
|
||||
checked: $('.brand-link').hasClass('text-sm'),
|
||||
'class': 'mr-1'
|
||||
class: 'mr-1'
|
||||
}).on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.brand-link').addClass('text-sm')
|
||||
|
@ -205,20 +208,20 @@
|
|||
$('.brand-link').removeClass('text-sm')
|
||||
}
|
||||
})
|
||||
var $text_sm_brand_container = $('<div />', {'class': 'mb-4'}).append($text_sm_brand_checkbox).append('<span>Brand small text</span>')
|
||||
var $text_sm_brand_container = $('<div />', { class: 'mb-4' }).append($text_sm_brand_checkbox).append('<span>Brand small text</span>')
|
||||
$container.append($text_sm_brand_container)
|
||||
|
||||
$container.append('<h6>Navbar Variants</h6>')
|
||||
|
||||
var $navbar_variants = $('<div />', {
|
||||
'class': 'd-flex'
|
||||
var $navbar_variants = $('<div />', {
|
||||
class: 'd-flex'
|
||||
})
|
||||
var navbar_all_colors = navbar_dark_skins.concat(navbar_light_skins)
|
||||
var $navbar_variants_colors = createSkinBlock(navbar_all_colors, function (e) {
|
||||
var navbar_all_colors = navbar_dark_skins.concat(navbar_light_skins)
|
||||
var $navbar_variants_colors = createSkinBlock(navbar_all_colors, function () {
|
||||
var color = $(this).data('color')
|
||||
var $main_header = $('.main-header')
|
||||
$main_header.removeClass('navbar-dark').removeClass('navbar-light')
|
||||
navbar_all_colors.map(function (color) {
|
||||
navbar_all_colors.forEach(function (color) {
|
||||
$main_header.removeClass(color)
|
||||
})
|
||||
|
||||
|
@ -310,14 +313,14 @@
|
|||
|
||||
$container.append('<h6>Accent Color Variants</h6>')
|
||||
var $accent_variants = $('<div />', {
|
||||
'class': 'd-flex'
|
||||
class: 'd-flex'
|
||||
})
|
||||
$container.append($accent_variants)
|
||||
$container.append(createSkinBlock(accent_colors, function () {
|
||||
var color = $(this).data('color')
|
||||
var color = $(this).data('color')
|
||||
var accent_class = color
|
||||
var $body = $('body')
|
||||
accent_colors.map(function (skin) {
|
||||
var $body = $('body')
|
||||
accent_colors.forEach(function (skin) {
|
||||
$body.removeClass(skin)
|
||||
})
|
||||
|
||||
|
@ -326,14 +329,14 @@
|
|||
|
||||
$container.append('<h6>Dark Sidebar Variants</h6>')
|
||||
var $sidebar_variants_dark = $('<div />', {
|
||||
'class': 'd-flex'
|
||||
class: 'd-flex'
|
||||
})
|
||||
$container.append($sidebar_variants_dark)
|
||||
$container.append(createSkinBlock(sidebar_colors, function () {
|
||||
var color = $(this).data('color')
|
||||
var color = $(this).data('color')
|
||||
var sidebar_class = 'sidebar-dark-' + color.replace('bg-', '')
|
||||
var $sidebar = $('.main-sidebar')
|
||||
sidebar_skins.map(function (skin) {
|
||||
var $sidebar = $('.main-sidebar')
|
||||
sidebar_skins.forEach(function (skin) {
|
||||
$sidebar.removeClass(skin)
|
||||
})
|
||||
|
||||
|
@ -342,14 +345,14 @@
|
|||
|
||||
$container.append('<h6>Light Sidebar Variants</h6>')
|
||||
var $sidebar_variants_light = $('<div />', {
|
||||
'class': 'd-flex'
|
||||
class: 'd-flex'
|
||||
})
|
||||
$container.append($sidebar_variants_light)
|
||||
$container.append(createSkinBlock(sidebar_colors, function () {
|
||||
var color = $(this).data('color')
|
||||
var color = $(this).data('color')
|
||||
var sidebar_class = 'sidebar-light-' + color.replace('bg-', '')
|
||||
var $sidebar = $('.main-sidebar')
|
||||
sidebar_skins.map(function (skin) {
|
||||
var $sidebar = $('.main-sidebar')
|
||||
sidebar_skins.forEach(function (skin) {
|
||||
$sidebar.removeClass(skin)
|
||||
})
|
||||
|
||||
|
@ -359,21 +362,21 @@
|
|||
var logo_skins = navbar_all_colors
|
||||
$container.append('<h6>Brand Logo Variants</h6>')
|
||||
var $logo_variants = $('<div />', {
|
||||
'class': 'd-flex'
|
||||
class: 'd-flex'
|
||||
})
|
||||
$container.append($logo_variants)
|
||||
var $clear_btn = $('<a />', {
|
||||
href: 'javascript:void(0)'
|
||||
}).text('clear').on('click', function () {
|
||||
var $logo = $('.brand-link')
|
||||
logo_skins.map(function (skin) {
|
||||
logo_skins.forEach(function (skin) {
|
||||
$logo.removeClass(skin)
|
||||
})
|
||||
})
|
||||
$container.append(createSkinBlock(logo_skins, function () {
|
||||
var color = $(this).data('color')
|
||||
var $logo = $('.brand-link')
|
||||
logo_skins.map(function (skin) {
|
||||
logo_skins.forEach(function (skin) {
|
||||
$logo.removeClass(skin)
|
||||
})
|
||||
$logo.addClass(color)
|
||||
|
@ -381,12 +384,12 @@
|
|||
|
||||
function createSkinBlock(colors, callback) {
|
||||
var $block = $('<div />', {
|
||||
'class': 'd-flex flex-wrap mb-3'
|
||||
class: 'd-flex flex-wrap mb-3'
|
||||
})
|
||||
|
||||
colors.map(function (color) {
|
||||
colors.forEach(function (color) {
|
||||
var $color = $('<div />', {
|
||||
'class': (typeof color === 'object' ? color.join(' ') : color).replace('navbar-', 'bg-').replace('accent-', 'bg-') + ' elevation-2'
|
||||
class: (typeof color === 'object' ? color.join(' ') : color).replace('navbar-', 'bg-').replace('accent-', 'bg-') + ' elevation-2'
|
||||
})
|
||||
|
||||
$block.append($color)
|
||||
|
@ -394,13 +397,13 @@
|
|||
$color.data('color', color)
|
||||
|
||||
$color.css({
|
||||
width : '40px',
|
||||
height : '20px',
|
||||
width: '40px',
|
||||
height: '20px',
|
||||
borderRadius: '25px',
|
||||
marginRight : 10,
|
||||
marginRight: 10,
|
||||
marginBottom: 10,
|
||||
opacity : 0.8,
|
||||
cursor : 'pointer'
|
||||
opacity: 0.8,
|
||||
cursor: 'pointer'
|
||||
})
|
||||
|
||||
$color.hover(function () {
|
||||
|
@ -417,10 +420,10 @@
|
|||
return $block
|
||||
}
|
||||
|
||||
$('.product-image-thumb').on('click', function() {
|
||||
const image_element = $(this).find('img');
|
||||
$('.product-image-thumb').on('click', function () {
|
||||
var image_element = $(this).find('img')
|
||||
$('.product-image').prop('src', $(image_element).attr('src'))
|
||||
$('.product-image-thumb.active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
$('.product-image-thumb.active').removeClass('active')
|
||||
$(this).addClass('active')
|
||||
})
|
||||
})(jQuery)
|
||||
|
|
|
@ -5,44 +5,46 @@
|
|||
* This is a demo file used only for the main dashboard (index.html)
|
||||
**/
|
||||
|
||||
$(function () {
|
||||
/* global moment:false, Chart:false, Sparkline:false */
|
||||
|
||||
$(function () {
|
||||
'use strict'
|
||||
|
||||
// Make the dashboard widgets sortable Using jquery UI
|
||||
$('.connectedSortable').sortable({
|
||||
placeholder : 'sort-highlight',
|
||||
connectWith : '.connectedSortable',
|
||||
handle : '.card-header, .nav-tabs',
|
||||
placeholder: 'sort-highlight',
|
||||
connectWith: '.connectedSortable',
|
||||
handle: '.card-header, .nav-tabs',
|
||||
forcePlaceholderSize: true,
|
||||
zIndex : 999999
|
||||
zIndex: 999999
|
||||
})
|
||||
$('.connectedSortable .card-header, .connectedSortable .nav-tabs-custom').css('cursor', 'move')
|
||||
|
||||
// jQuery UI sortable for the todo list
|
||||
$('.todo-list').sortable({
|
||||
placeholder : 'sort-highlight',
|
||||
handle : '.handle',
|
||||
placeholder: 'sort-highlight',
|
||||
handle: '.handle',
|
||||
forcePlaceholderSize: true,
|
||||
zIndex : 999999
|
||||
zIndex: 999999
|
||||
})
|
||||
|
||||
// bootstrap WYSIHTML5 - text editor
|
||||
$('.textarea').summernote()
|
||||
|
||||
$('.daterange').daterangepicker({
|
||||
ranges : {
|
||||
'Today' : [moment(), moment()],
|
||||
'Yesterday' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
|
||||
ranges: {
|
||||
Today: [moment(), moment()],
|
||||
Yesterday: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month' : [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
startDate: moment().subtract(29, 'days'),
|
||||
endDate : moment()
|
||||
endDate: moment()
|
||||
}, function (start, end) {
|
||||
window.alert('You chose: ' + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
|
||||
// eslint-disable-next-line no-alert
|
||||
alert('You chose: ' + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
|
||||
})
|
||||
|
||||
/* jQueryKnob */
|
||||
|
@ -50,52 +52,53 @@ $(function () {
|
|||
|
||||
// jvectormap data
|
||||
var visitorsData = {
|
||||
'US': 398, //USA
|
||||
'SA': 400, //Saudi Arabia
|
||||
'CA': 1000, //Canada
|
||||
'DE': 500, //Germany
|
||||
'FR': 760, //France
|
||||
'CN': 300, //China
|
||||
'AU': 700, //Australia
|
||||
'BR': 600, //Brazil
|
||||
'IN': 800, //India
|
||||
'GB': 320, //Great Britain
|
||||
'RU': 3000 //Russia
|
||||
US: 398, // USA
|
||||
SA: 400, // Saudi Arabia
|
||||
CA: 1000, // Canada
|
||||
DE: 500, // Germany
|
||||
FR: 760, // France
|
||||
CN: 300, // China
|
||||
AU: 700, // Australia
|
||||
BR: 600, // Brazil
|
||||
IN: 800, // India
|
||||
GB: 320, // Great Britain
|
||||
RU: 3000 // Russia
|
||||
}
|
||||
// World map by jvectormap
|
||||
$('#world-map').vectorMap({
|
||||
map : 'usa_en',
|
||||
backgroundColor : 'transparent',
|
||||
regionStyle : {
|
||||
map: 'usa_en',
|
||||
backgroundColor: 'transparent',
|
||||
regionStyle: {
|
||||
initial: {
|
||||
fill : 'rgba(255, 255, 255, 0.7)',
|
||||
'fill-opacity' : 1,
|
||||
stroke : 'rgba(0,0,0,.2)',
|
||||
'stroke-width' : 1,
|
||||
fill: 'rgba(255, 255, 255, 0.7)',
|
||||
'fill-opacity': 1,
|
||||
stroke: 'rgba(0,0,0,.2)',
|
||||
'stroke-width': 1,
|
||||
'stroke-opacity': 1
|
||||
}
|
||||
},
|
||||
series : {
|
||||
series: {
|
||||
regions: [{
|
||||
values : visitorsData,
|
||||
scale : ['#ffffff', '#0154ad'],
|
||||
values: visitorsData,
|
||||
scale: ['#ffffff', '#0154ad'],
|
||||
normalizeFunction: 'polynomial'
|
||||
}]
|
||||
},
|
||||
onRegionLabelShow: function (e, el, code) {
|
||||
if (typeof visitorsData[code] != 'undefined')
|
||||
if (typeof visitorsData[code] !== 'undefined') {
|
||||
el.html(el.html() + ': ' + visitorsData[code] + ' new visitors')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Sparkline charts
|
||||
var sparkline1 = new Sparkline($("#sparkline-1")[0], {width: 80, height: 50, lineColor: '#92c1dc', endColor: '#ebf4f9'});
|
||||
var sparkline2 = new Sparkline($("#sparkline-2")[0], {width: 80, height: 50, lineColor: '#92c1dc', endColor: '#ebf4f9'});
|
||||
var sparkline3 = new Sparkline($("#sparkline-3")[0], {width: 80, height: 50, lineColor: '#92c1dc', endColor: '#ebf4f9'});
|
||||
var sparkline1 = new Sparkline($('#sparkline-1')[0], { width: 80, height: 50, lineColor: '#92c1dc', endColor: '#ebf4f9' })
|
||||
var sparkline2 = new Sparkline($('#sparkline-2')[0], { width: 80, height: 50, lineColor: '#92c1dc', endColor: '#ebf4f9' })
|
||||
var sparkline3 = new Sparkline($('#sparkline-3')[0], { width: 80, height: 50, lineColor: '#92c1dc', endColor: '#ebf4f9' })
|
||||
|
||||
sparkline1.draw([1000, 1200, 920, 927, 931, 1027, 819, 930, 1021]);
|
||||
sparkline2.draw([515, 519, 520, 522, 652, 810, 370, 627, 319, 630, 921]);
|
||||
sparkline3.draw([15, 19, 20, 22, 33, 27, 31, 27, 19, 30, 21]);
|
||||
sparkline1.draw([1000, 1200, 920, 927, 931, 1027, 819, 930, 1021])
|
||||
sparkline2.draw([515, 519, 520, 522, 652, 810, 370, 627, 319, 630, 921])
|
||||
sparkline3.draw([15, 19, 20, 22, 33, 27, 31, 27, 19, 30, 21])
|
||||
|
||||
// The Calender
|
||||
$('#calendar').datetimepicker({
|
||||
|
@ -110,77 +113,77 @@ $(function () {
|
|||
|
||||
/* Chart.js Charts */
|
||||
// Sales chart
|
||||
var salesChartCanvas = document.getElementById('revenue-chart-canvas').getContext('2d');
|
||||
//$('#revenue-chart').get(0).getContext('2d');
|
||||
var salesChartCanvas = document.getElementById('revenue-chart-canvas').getContext('2d')
|
||||
// $('#revenue-chart').get(0).getContext('2d');
|
||||
|
||||
var salesChartData = {
|
||||
labels : ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
datasets: [
|
||||
{
|
||||
label : 'Digital Goods',
|
||||
backgroundColor : 'rgba(60,141,188,0.9)',
|
||||
borderColor : 'rgba(60,141,188,0.8)',
|
||||
pointRadius : false,
|
||||
pointColor : '#3b8bba',
|
||||
pointStrokeColor : 'rgba(60,141,188,1)',
|
||||
pointHighlightFill : '#fff',
|
||||
label: 'Digital Goods',
|
||||
backgroundColor: 'rgba(60,141,188,0.9)',
|
||||
borderColor: 'rgba(60,141,188,0.8)',
|
||||
pointRadius: false,
|
||||
pointColor: '#3b8bba',
|
||||
pointStrokeColor: 'rgba(60,141,188,1)',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(60,141,188,1)',
|
||||
data : [28, 48, 40, 19, 86, 27, 90]
|
||||
data: [28, 48, 40, 19, 86, 27, 90]
|
||||
},
|
||||
{
|
||||
label : 'Electronics',
|
||||
backgroundColor : 'rgba(210, 214, 222, 1)',
|
||||
borderColor : 'rgba(210, 214, 222, 1)',
|
||||
pointRadius : false,
|
||||
pointColor : 'rgba(210, 214, 222, 1)',
|
||||
pointStrokeColor : '#c1c7d1',
|
||||
pointHighlightFill : '#fff',
|
||||
label: 'Electronics',
|
||||
backgroundColor: 'rgba(210, 214, 222, 1)',
|
||||
borderColor: 'rgba(210, 214, 222, 1)',
|
||||
pointRadius: false,
|
||||
pointColor: 'rgba(210, 214, 222, 1)',
|
||||
pointStrokeColor: '#c1c7d1',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(220,220,220,1)',
|
||||
data : [65, 59, 80, 81, 56, 55, 40]
|
||||
},
|
||||
data: [65, 59, 80, 81, 56, 55, 40]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
var salesChartOptions = {
|
||||
maintainAspectRatio : false,
|
||||
responsive : true,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines : {
|
||||
display : false,
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}],
|
||||
yAxes: [{
|
||||
gridLines : {
|
||||
display : false,
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
// This will get the first returned node in the jQuery collection.
|
||||
var salesChart = new Chart(salesChartCanvas, {
|
||||
type: 'line',
|
||||
data: salesChartData,
|
||||
options: salesChartOptions
|
||||
}
|
||||
)
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var salesChart = new Chart(salesChartCanvas, {
|
||||
type: 'line',
|
||||
data: salesChartData,
|
||||
options: salesChartOptions
|
||||
})
|
||||
|
||||
// Donut Chart
|
||||
var pieChartCanvas = $('#sales-chart-canvas').get(0).getContext('2d')
|
||||
var pieData = {
|
||||
var pieData = {
|
||||
labels: [
|
||||
'Instore Sales',
|
||||
'Download Sales',
|
||||
'Mail-Order Sales',
|
||||
'Instore Sales',
|
||||
'Download Sales',
|
||||
'Mail-Order Sales'
|
||||
],
|
||||
datasets: [
|
||||
{
|
||||
data: [30,12,20],
|
||||
backgroundColor : ['#f56954', '#00a65a', '#f39c12'],
|
||||
data: [30, 12, 20],
|
||||
backgroundColor: ['#f56954', '#00a65a', '#f39c12']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -188,77 +191,77 @@ $(function () {
|
|||
legend: {
|
||||
display: false
|
||||
},
|
||||
maintainAspectRatio : false,
|
||||
responsive : true,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true
|
||||
}
|
||||
//Create pie or douhnut chart
|
||||
// Create pie or douhnut chart
|
||||
// You can switch between pie and douhnut using the method below.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var pieChart = new Chart(pieChartCanvas, {
|
||||
type: 'doughnut',
|
||||
data: pieData,
|
||||
options: pieOptions
|
||||
});
|
||||
options: pieOptions
|
||||
})
|
||||
|
||||
// Sales graph chart
|
||||
var salesGraphChartCanvas = $('#line-chart').get(0).getContext('2d');
|
||||
//$('#revenue-chart').get(0).getContext('2d');
|
||||
var salesGraphChartCanvas = $('#line-chart').get(0).getContext('2d')
|
||||
// $('#revenue-chart').get(0).getContext('2d');
|
||||
|
||||
var salesGraphChartData = {
|
||||
labels : ['2011 Q1', '2011 Q2', '2011 Q3', '2011 Q4', '2012 Q1', '2012 Q2', '2012 Q3', '2012 Q4', '2013 Q1', '2013 Q2'],
|
||||
labels: ['2011 Q1', '2011 Q2', '2011 Q3', '2011 Q4', '2012 Q1', '2012 Q2', '2012 Q3', '2012 Q4', '2013 Q1', '2013 Q2'],
|
||||
datasets: [
|
||||
{
|
||||
label : 'Digital Goods',
|
||||
fill : false,
|
||||
borderWidth : 2,
|
||||
lineTension : 0,
|
||||
spanGaps : true,
|
||||
borderColor : '#efefef',
|
||||
pointRadius : 3,
|
||||
pointHoverRadius : 7,
|
||||
pointColor : '#efefef',
|
||||
label: 'Digital Goods',
|
||||
fill: false,
|
||||
borderWidth: 2,
|
||||
lineTension: 0,
|
||||
spanGaps: true,
|
||||
borderColor: '#efefef',
|
||||
pointRadius: 3,
|
||||
pointHoverRadius: 7,
|
||||
pointColor: '#efefef',
|
||||
pointBackgroundColor: '#efefef',
|
||||
data : [2666, 2778, 4912, 3767, 6810, 5670, 4820, 15073, 10687, 8432]
|
||||
data: [2666, 2778, 4912, 3767, 6810, 5670, 4820, 15073, 10687, 8432]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
var salesGraphChartOptions = {
|
||||
maintainAspectRatio : false,
|
||||
responsive : true,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display: false,
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
ticks : {
|
||||
fontColor: '#efefef',
|
||||
ticks: {
|
||||
fontColor: '#efefef'
|
||||
},
|
||||
gridLines : {
|
||||
display : false,
|
||||
gridLines: {
|
||||
display: false,
|
||||
color: '#efefef',
|
||||
drawBorder: false,
|
||||
drawBorder: false
|
||||
}
|
||||
}],
|
||||
yAxes: [{
|
||||
ticks : {
|
||||
ticks: {
|
||||
stepSize: 5000,
|
||||
fontColor: '#efefef',
|
||||
fontColor: '#efefef'
|
||||
},
|
||||
gridLines : {
|
||||
display : true,
|
||||
gridLines: {
|
||||
display: true,
|
||||
color: '#efefef',
|
||||
drawBorder: false,
|
||||
drawBorder: false
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
// This will get the first returned node in the jQuery collection.
|
||||
var salesGraphChart = new Chart(salesGraphChartCanvas, {
|
||||
type: 'line',
|
||||
data: salesGraphChartData,
|
||||
options: salesGraphChartOptions
|
||||
}
|
||||
)
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var salesGraphChart = new Chart(salesGraphChartCanvas, {
|
||||
type: 'line',
|
||||
data: salesGraphChartData,
|
||||
options: salesGraphChartOptions
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
$(function () {
|
||||
/* global Chart:false */
|
||||
|
||||
$(function () {
|
||||
'use strict'
|
||||
|
||||
/* ChartJS
|
||||
|
@ -8,108 +9,110 @@ $(function () {
|
|||
*/
|
||||
|
||||
//-----------------------
|
||||
//- MONTHLY SALES CHART -
|
||||
// - MONTHLY SALES CHART -
|
||||
//-----------------------
|
||||
|
||||
// Get context with jQuery - using jQuery's .get() method.
|
||||
var salesChartCanvas = $('#salesChart').get(0).getContext('2d')
|
||||
|
||||
var salesChartData = {
|
||||
labels : ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
datasets: [
|
||||
{
|
||||
label : 'Digital Goods',
|
||||
backgroundColor : 'rgba(60,141,188,0.9)',
|
||||
borderColor : 'rgba(60,141,188,0.8)',
|
||||
pointRadius : false,
|
||||
pointColor : '#3b8bba',
|
||||
pointStrokeColor : 'rgba(60,141,188,1)',
|
||||
pointHighlightFill : '#fff',
|
||||
label: 'Digital Goods',
|
||||
backgroundColor: 'rgba(60,141,188,0.9)',
|
||||
borderColor: 'rgba(60,141,188,0.8)',
|
||||
pointRadius: false,
|
||||
pointColor: '#3b8bba',
|
||||
pointStrokeColor: 'rgba(60,141,188,1)',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(60,141,188,1)',
|
||||
data : [28, 48, 40, 19, 86, 27, 90]
|
||||
data: [28, 48, 40, 19, 86, 27, 90]
|
||||
},
|
||||
{
|
||||
label : 'Electronics',
|
||||
backgroundColor : 'rgba(210, 214, 222, 1)',
|
||||
borderColor : 'rgba(210, 214, 222, 1)',
|
||||
pointRadius : false,
|
||||
pointColor : 'rgba(210, 214, 222, 1)',
|
||||
pointStrokeColor : '#c1c7d1',
|
||||
pointHighlightFill : '#fff',
|
||||
label: 'Electronics',
|
||||
backgroundColor: 'rgba(210, 214, 222, 1)',
|
||||
borderColor: 'rgba(210, 214, 222, 1)',
|
||||
pointRadius: false,
|
||||
pointColor: 'rgba(210, 214, 222, 1)',
|
||||
pointStrokeColor: '#c1c7d1',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(220,220,220,1)',
|
||||
data : [65, 59, 80, 81, 56, 55, 40]
|
||||
},
|
||||
data: [65, 59, 80, 81, 56, 55, 40]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
var salesChartOptions = {
|
||||
maintainAspectRatio : false,
|
||||
responsive : true,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines : {
|
||||
display : false,
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}],
|
||||
yAxes: [{
|
||||
gridLines : {
|
||||
display : false,
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
// This will get the first returned node in the jQuery collection.
|
||||
var salesChart = new Chart(salesChartCanvas, {
|
||||
type: 'line',
|
||||
data: salesChartData,
|
||||
options: salesChartOptions
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var salesChart = new Chart(salesChartCanvas, {
|
||||
type: 'line',
|
||||
data: salesChartData,
|
||||
options: salesChartOptions
|
||||
}
|
||||
)
|
||||
|
||||
//---------------------------
|
||||
//- END MONTHLY SALES CHART -
|
||||
// - END MONTHLY SALES CHART -
|
||||
//---------------------------
|
||||
|
||||
//-------------
|
||||
//- PIE CHART -
|
||||
// - PIE CHART -
|
||||
//-------------
|
||||
// Get context with jQuery - using jQuery's .get() method.
|
||||
var pieChartCanvas = $('#pieChart').get(0).getContext('2d')
|
||||
var pieData = {
|
||||
labels: [
|
||||
'Chrome',
|
||||
'IE',
|
||||
'FireFox',
|
||||
'Safari',
|
||||
'Opera',
|
||||
'Navigator',
|
||||
],
|
||||
datasets: [
|
||||
{
|
||||
data: [700,500,400,600,300,100],
|
||||
backgroundColor : ['#f56954', '#00a65a', '#f39c12', '#00c0ef', '#3c8dbc', '#d2d6de'],
|
||||
}
|
||||
]
|
||||
}
|
||||
var pieOptions = {
|
||||
legend: {
|
||||
display: false
|
||||
var pieChartCanvas = $('#pieChart').get(0).getContext('2d')
|
||||
var pieData = {
|
||||
labels: [
|
||||
'Chrome',
|
||||
'IE',
|
||||
'FireFox',
|
||||
'Safari',
|
||||
'Opera',
|
||||
'Navigator'
|
||||
],
|
||||
datasets: [
|
||||
{
|
||||
data: [700, 500, 400, 600, 300, 100],
|
||||
backgroundColor: ['#f56954', '#00a65a', '#f39c12', '#00c0ef', '#3c8dbc', '#d2d6de']
|
||||
}
|
||||
]
|
||||
}
|
||||
var pieOptions = {
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
//Create pie or douhnut chart
|
||||
// You can switch between pie and douhnut using the method below.
|
||||
var pieChart = new Chart(pieChartCanvas, {
|
||||
type: 'doughnut',
|
||||
data: pieData,
|
||||
options: pieOptions
|
||||
})
|
||||
}
|
||||
// Create pie or douhnut chart
|
||||
// You can switch between pie and douhnut using the method below.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var pieChart = new Chart(pieChartCanvas, {
|
||||
type: 'doughnut',
|
||||
data: pieData,
|
||||
options: pieOptions
|
||||
})
|
||||
|
||||
//-----------------
|
||||
//- END PIE CHART -
|
||||
// - END PIE CHART -
|
||||
//-----------------
|
||||
|
||||
/* jVector Maps
|
||||
|
@ -117,15 +120,14 @@ $(function () {
|
|||
* Create a world map with markers
|
||||
*/
|
||||
$('#world-map-markers').mapael({
|
||||
map: {
|
||||
name : "usa_states",
|
||||
zoom: {
|
||||
enabled: true,
|
||||
maxLevel: 10
|
||||
},
|
||||
},
|
||||
map: {
|
||||
name: 'usa_states',
|
||||
zoom: {
|
||||
enabled: true,
|
||||
maxLevel: 10
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
|
||||
// $('#world-map-markers').vectorMap({
|
||||
// map : 'world_en',
|
||||
|
@ -263,5 +265,4 @@ $(function () {
|
|||
// }
|
||||
// ]
|
||||
// })
|
||||
|
||||
})
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global Chart:false */
|
||||
|
||||
$(function () {
|
||||
'use strict'
|
||||
|
||||
|
@ -6,133 +8,136 @@ $(function () {
|
|||
fontStyle: 'bold'
|
||||
}
|
||||
|
||||
var mode = 'index'
|
||||
var mode = 'index'
|
||||
var intersect = true
|
||||
|
||||
var $salesChart = $('#sales-chart')
|
||||
var salesChart = new Chart($salesChart, {
|
||||
type : 'bar',
|
||||
data : {
|
||||
labels : ['JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var salesChart = new Chart($salesChart, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ['JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
|
||||
datasets: [
|
||||
{
|
||||
backgroundColor: '#007bff',
|
||||
borderColor : '#007bff',
|
||||
data : [1000, 2000, 3000, 2500, 2700, 2500, 3000]
|
||||
borderColor: '#007bff',
|
||||
data: [1000, 2000, 3000, 2500, 2700, 2500, 3000]
|
||||
},
|
||||
{
|
||||
backgroundColor: '#ced4da',
|
||||
borderColor : '#ced4da',
|
||||
data : [700, 1700, 2700, 2000, 1800, 1500, 2000]
|
||||
borderColor: '#ced4da',
|
||||
data: [700, 1700, 2700, 2000, 1800, 1500, 2000]
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
tooltips : {
|
||||
mode : mode,
|
||||
tooltips: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
hover : {
|
||||
mode : mode,
|
||||
hover: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
legend : {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales : {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
// display: false,
|
||||
gridLines: {
|
||||
display : true,
|
||||
lineWidth : '4px',
|
||||
color : 'rgba(0, 0, 0, .2)',
|
||||
display: true,
|
||||
lineWidth: '4px',
|
||||
color: 'rgba(0, 0, 0, .2)',
|
||||
zeroLineColor: 'transparent'
|
||||
},
|
||||
ticks : $.extend({
|
||||
ticks: $.extend({
|
||||
beginAtZero: true,
|
||||
|
||||
// Include a dollar sign in the ticks
|
||||
callback: function (value, index, values) {
|
||||
callback: function (value) {
|
||||
if (value >= 1000) {
|
||||
value /= 1000
|
||||
value += 'k'
|
||||
}
|
||||
|
||||
return '$' + value
|
||||
}
|
||||
}, ticksStyle)
|
||||
}],
|
||||
xAxes: [{
|
||||
display : true,
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
ticks : ticksStyle
|
||||
ticks: ticksStyle
|
||||
}]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var $visitorsChart = $('#visitors-chart')
|
||||
var visitorsChart = new Chart($visitorsChart, {
|
||||
data : {
|
||||
labels : ['18th', '20th', '22nd', '24th', '26th', '28th', '30th'],
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var visitorsChart = new Chart($visitorsChart, {
|
||||
data: {
|
||||
labels: ['18th', '20th', '22nd', '24th', '26th', '28th', '30th'],
|
||||
datasets: [{
|
||||
type : 'line',
|
||||
data : [100, 120, 170, 167, 180, 177, 160],
|
||||
backgroundColor : 'transparent',
|
||||
borderColor : '#007bff',
|
||||
pointBorderColor : '#007bff',
|
||||
type: 'line',
|
||||
data: [100, 120, 170, 167, 180, 177, 160],
|
||||
backgroundColor: 'transparent',
|
||||
borderColor: '#007bff',
|
||||
pointBorderColor: '#007bff',
|
||||
pointBackgroundColor: '#007bff',
|
||||
fill : false
|
||||
fill: false
|
||||
// pointHoverBackgroundColor: '#007bff',
|
||||
// pointHoverBorderColor : '#007bff'
|
||||
},
|
||||
{
|
||||
type : 'line',
|
||||
data : [60, 80, 70, 67, 80, 77, 100],
|
||||
backgroundColor : 'tansparent',
|
||||
borderColor : '#ced4da',
|
||||
pointBorderColor : '#ced4da',
|
||||
pointBackgroundColor: '#ced4da',
|
||||
fill : false
|
||||
// pointHoverBackgroundColor: '#ced4da',
|
||||
// pointHoverBorderColor : '#ced4da'
|
||||
}]
|
||||
{
|
||||
type: 'line',
|
||||
data: [60, 80, 70, 67, 80, 77, 100],
|
||||
backgroundColor: 'tansparent',
|
||||
borderColor: '#ced4da',
|
||||
pointBorderColor: '#ced4da',
|
||||
pointBackgroundColor: '#ced4da',
|
||||
fill: false
|
||||
// pointHoverBackgroundColor: '#ced4da',
|
||||
// pointHoverBorderColor : '#ced4da'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
tooltips : {
|
||||
mode : mode,
|
||||
tooltips: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
hover : {
|
||||
mode : mode,
|
||||
hover: {
|
||||
mode: mode,
|
||||
intersect: intersect
|
||||
},
|
||||
legend : {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales : {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
// display: false,
|
||||
gridLines: {
|
||||
display : true,
|
||||
lineWidth : '4px',
|
||||
color : 'rgba(0, 0, 0, .2)',
|
||||
display: true,
|
||||
lineWidth: '4px',
|
||||
color: 'rgba(0, 0, 0, .2)',
|
||||
zeroLineColor: 'transparent'
|
||||
},
|
||||
ticks : $.extend({
|
||||
beginAtZero : true,
|
||||
ticks: $.extend({
|
||||
beginAtZero: true,
|
||||
suggestedMax: 200
|
||||
}, ticksStyle)
|
||||
}],
|
||||
xAxes: [{
|
||||
display : true,
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
ticks : ticksStyle
|
||||
ticks: ticksStyle
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1188,7 +1188,7 @@
|
|||
|
||||
<script>
|
||||
$(function() {
|
||||
const Toast = Swal.mixin({
|
||||
var Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
|
|
Loading…
Reference in New Issue