some small js option fixes

pull/2437/head
REJack 2019-11-17 11:53:47 +01:00
parent f5286d6229
commit e24c4d01ff
No known key found for this signature in database
GPG Key ID: 9F3976CC630CC888
11 changed files with 42 additions and 30 deletions

View File

@ -118,10 +118,10 @@ const CardRefresh = (($) => {
static _jQueryInterface(config) {
let data = $(this).data(DATA_KEY)
let options = $(this).data()
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new CardRefresh($(this), options)
data = new CardRefresh($(this), _options)
$(this).data(DATA_KEY, typeof config === 'string' ? data: config)
}

View File

@ -188,9 +188,10 @@ const CardWidget = (($) => {
static _jQueryInterface(config) {
let data = $(this).data(DATA_KEY)
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new CardWidget($(this), data)
data = new CardWidget($(this), _options)
$(this).data(DATA_KEY, typeof config === 'string' ? data: config)
}

View File

@ -246,9 +246,10 @@ const ControlSidebar = (($) => {
static _jQueryInterface(operation) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new ControlSidebar(this, $(this).data())
data = new ControlSidebar(this, _options)
$(this).data(DATA_KEY, data)
}

View File

@ -147,11 +147,11 @@ const Layout = (($) => {
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _config = $.extend({}, Default, $(this).data())
let data = $(this).data(DATA_KEY)
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new Layout($(this), _config)
data = new Layout($(this), _options)
$(this).data(DATA_KEY, data)
}

View File

@ -201,8 +201,8 @@ const Toasts = (($) => {
static _jQueryInterface(option, config) {
return this.each(function () {
const _config = $.extend({}, Default, config)
var toast = new Toasts($(this), _config)
const _options = $.extend({}, Default, config)
var toast = new Toasts($(this), _options)
if (option === 'create') {
toast[option]()

View File

@ -80,11 +80,11 @@ const TodoList = (($) => {
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _config = $.extend({}, Default, $(this).data())
let data = $(this).data(DATA_KEY)
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new TodoList($(this), _config)
data = new TodoList($(this), _options)
$(this).data(DATA_KEY, data)
}

View File

@ -141,11 +141,11 @@ const Treeview = (($) => {
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _config = $.extend({}, Default, $(this).data())
let data = $(this).data(DATA_KEY)
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new Treeview($(this), _config)
data = new Treeview($(this), _options)
$(this).data(DATA_KEY, data)
}

34
dist/js/adminlte.js vendored
View File

@ -52,6 +52,11 @@
FOOTER_LG_FIXED: 'layout-lg-footer-fixed',
FOOTER_XL_FIXED: 'layout-xl-footer-fixed'
};
var Default = {
controlsidebarSlide: true,
scrollbarTheme: 'os-theme-light',
scrollbarAutoHide: 'l'
};
/**
* Class Definition
* ====================================================
@ -230,8 +235,10 @@
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _options = $.extend({}, Default, $(this).data());
if (!data) {
data = new ControlSidebar(this, $(this).data());
data = new ControlSidebar(this, _options);
$(this).data(DATA_KEY, data);
}
@ -409,10 +416,10 @@
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = $.extend({}, Default, $(this).data());
var _options = $.extend({}, Default, $(this).data());
if (!data) {
data = new Layout($(this), _config);
data = new Layout($(this), _options);
$(this).data(DATA_KEY, data);
}
@ -819,10 +826,10 @@
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = $.extend({}, Default, $(this).data());
var _options = $.extend({}, Default, $(this).data());
if (!data) {
data = new Treeview($(this), _config);
data = new Treeview($(this), _options);
$(this).data(DATA_KEY, data);
}
@ -1028,10 +1035,10 @@
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = $.extend({}, Default, $(this).data());
var _options = $.extend({}, Default, $(this).data());
if (!data) {
data = new TodoList($(this), _config);
data = new TodoList($(this), _options);
$(this).data(DATA_KEY, data);
}
@ -1253,8 +1260,10 @@
CardWidget._jQueryInterface = function _jQueryInterface(config) {
var data = $(this).data(DATA_KEY);
var _options = $.extend({}, Default, $(this).data());
if (!data) {
data = new CardWidget($(this), data);
data = new CardWidget($(this), _options);
$(this).data(DATA_KEY, typeof config === 'string' ? data : config);
}
@ -1427,10 +1436,11 @@
CardRefresh._jQueryInterface = function _jQueryInterface(config) {
var data = $(this).data(DATA_KEY);
var options = $(this).data();
var _options = $.extend({}, Default, $(this).data());
if (!data) {
data = new CardRefresh($(this), options);
data = new CardRefresh($(this), _options);
$(this).data(DATA_KEY, typeof config === 'string' ? data : config);
}
@ -1757,9 +1767,9 @@
Toasts._jQueryInterface = function _jQueryInterface(option, config) {
return this.each(function () {
var _config = $.extend({}, Default, config);
var _options = $.extend({}, Default, config);
var toast = new Toasts($(this), _config);
var toast = new Toasts($(this), _options);
if (option === 'create') {
toast[option]();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long