Update Bootstrap5 dialog lib
This commit is contained in:
parent
fe0ed9035f
commit
8815decc02
4 changed files with 15 additions and 76 deletions
|
@ -37,32 +37,9 @@
|
||||||
background-color: var(--bs-dark);
|
background-color: var(--bs-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-dialog .bootstrap-dialog-title {
|
.bootstrap-dialog:not(.type-light) .bootstrap-dialog-title {
|
||||||
color: #fff;
|
color: var(--bs-light);
|
||||||
}
|
}
|
||||||
.bootstrap-dialog.type-light .bootstrap-dialog-title {
|
.bootstrap-dialog:not(.type-light) .modal-header .btn-close {
|
||||||
color: #333;
|
filter: invert(1);
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-dark .bootstrap-dialog-close-button {
|
|
||||||
background-color: var(--bs-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bootstrap-dialog.size-large .bootstrap-dialog-title {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-large .bootstrap-dialog-message {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bootstrap-dialog.size-extra-large .bootstrap-dialog-title {
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-extra-large .bootstrap-dialog-close-button {
|
|
||||||
font-size: 34px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-extra-large .bootstrap-dialog-message {
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
.bootstrap-dialog .bootstrap-dialog-button-icon{margin-right:.5rem}.bootstrap-dialog.type-primary .modal-header{background-color:var(--bs-primary)}.bootstrap-dialog.type-secondary .modal-header{background-color:var(--bs-secondary)}.bootstrap-dialog.type-success .modal-header{background-color:var(--bs-success)}.bootstrap-dialog.type-danger .modal-header{background-color:var(--bs-danger)}.bootstrap-dialog.type-warning .modal-header{background-color:var(--bs-warning)}.bootstrap-dialog.type-info .modal-header{background-color:var(--bs-info)}.bootstrap-dialog.type-light .modal-header{background-color:var(--bs-light)}.bootstrap-dialog.type-dark .modal-header{background-color:var(--bs-dark)}.bootstrap-dialog .bootstrap-dialog-title{color:#fff}.bootstrap-dialog.type-light .bootstrap-dialog-title{color:#333}.bootstrap-dialog.type-dark .bootstrap-dialog-close-button{background-color:var(--bs-light)}.bootstrap-dialog.size-large .bootstrap-dialog-title{font-size:24px}.bootstrap-dialog.size-large .bootstrap-dialog-close-button{font-size:30px}.bootstrap-dialog.size-large .bootstrap-dialog-message{font-size:18px}.bootstrap-dialog.size-extra-large .bootstrap-dialog-title{font-size:28px}.bootstrap-dialog.size-extra-large .bootstrap-dialog-close-button{font-size:34px}.bootstrap-dialog.size-extra-large .bootstrap-dialog-message{font-size:22px}
|
.bootstrap-dialog .bootstrap-dialog-button-icon{margin-right:.5rem}.bootstrap-dialog.type-primary .modal-header{background-color:var(--bs-primary)}.bootstrap-dialog.type-secondary .modal-header{background-color:var(--bs-secondary)}.bootstrap-dialog.type-success .modal-header{background-color:var(--bs-success)}.bootstrap-dialog.type-danger .modal-header{background-color:var(--bs-danger)}.bootstrap-dialog.type-warning .modal-header{background-color:var(--bs-warning)}.bootstrap-dialog.type-info .modal-header{background-color:var(--bs-info)}.bootstrap-dialog.type-light .modal-header{background-color:var(--bs-light)}.bootstrap-dialog.type-dark .modal-header{background-color:var(--bs-dark)}.bootstrap-dialog:not(.type-light) .bootstrap-dialog-title{color:var(--bs-light)}.bootstrap-dialog:not(.type-light) .modal-header .btn-close{filter:invert(1)}
|
|
@ -41,20 +41,6 @@
|
||||||
var BootstrapDialogModal = function (element, options) {
|
var BootstrapDialogModal = function (element, options) {
|
||||||
new $.fn.modal.Constructor(element, options);
|
new $.fn.modal.Constructor(element, options);
|
||||||
};
|
};
|
||||||
BootstrapDialogModal.getModalVersion = function () {
|
|
||||||
var version = null;
|
|
||||||
if (typeof $.fn.modal.Constructor.VERSION === 'undefined') {
|
|
||||||
version = 'v3.1';
|
|
||||||
} else if (/3\.2\.\d+/.test($.fn.modal.Constructor.VERSION)) {
|
|
||||||
version = 'v3.2';
|
|
||||||
} else if (/3\.3\.[1,2]/.test($.fn.modal.Constructor.VERSION)) {
|
|
||||||
version = 'v3.3'; // v3.3.1, v3.3.2
|
|
||||||
} else {
|
|
||||||
version = 'v3.3.4';
|
|
||||||
}
|
|
||||||
|
|
||||||
return version;
|
|
||||||
};
|
|
||||||
BootstrapDialogModal.ORIGINAL_BODY_PADDING = parseInt(($('body').css('padding-right') || 0), 10);
|
BootstrapDialogModal.ORIGINAL_BODY_PADDING = parseInt(($('body').css('padding-right') || 0), 10);
|
||||||
BootstrapDialogModal.prototype = {
|
BootstrapDialogModal.prototype = {
|
||||||
constructor: BootstrapDialogModal,
|
constructor: BootstrapDialogModal,
|
||||||
|
@ -132,12 +118,6 @@
|
||||||
BootstrapDialog.SIZE_LARGE = 'size-large';
|
BootstrapDialog.SIZE_LARGE = 'size-large';
|
||||||
BootstrapDialog.SIZE_EXTRA_LARGE = 'size-extra-large';
|
BootstrapDialog.SIZE_EXTRA_LARGE = 'size-extra-large';
|
||||||
|
|
||||||
BootstrapDialog.BUTTON_SIZES = {};
|
|
||||||
BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_SMALL] = 'btn-sm';
|
|
||||||
BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_DEFAULT] = '';
|
|
||||||
BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_LARGE] = 'btn-lg';
|
|
||||||
BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_EXTRA_LARGE] = 'btn-lg';
|
|
||||||
|
|
||||||
BootstrapDialog.ICON_SPINNER = 'spinner-border spinner-border-sm';
|
BootstrapDialog.ICON_SPINNER = 'spinner-border spinner-border-sm';
|
||||||
BootstrapDialog.BUTTONS_ORDER_CANCEL_OK = 'btns-order-cancel-ok';
|
BootstrapDialog.BUTTONS_ORDER_CANCEL_OK = 'btns-order-cancel-ok';
|
||||||
BootstrapDialog.BUTTONS_ORDER_OK_CANCEL = 'btns-order-ok-cancel';
|
BootstrapDialog.BUTTONS_ORDER_OK_CANCEL = 'btns-order-ok-cancel';
|
||||||
|
@ -435,25 +415,6 @@
|
||||||
if (this.getSize() === BootstrapDialog.SIZE_EXTRA_LARGE) {
|
if (this.getSize() === BootstrapDialog.SIZE_EXTRA_LARGE) {
|
||||||
this.getModalDialog().addClass('modal-xl');
|
this.getModalDialog().addClass('modal-xl');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button size
|
|
||||||
$.each(this.options.buttons, function (index, button) {
|
|
||||||
var $button = dialog.getButton(button.id);
|
|
||||||
var buttonSizes = ['btn-lg', 'btn-sm'];
|
|
||||||
var sizeClassSpecified = false;
|
|
||||||
if (typeof button['cssClass'] === 'string') {
|
|
||||||
var btnClasses = button['cssClass'].split(' ');
|
|
||||||
$.each(btnClasses, function (index, btnClass) {
|
|
||||||
if ($.inArray(btnClass, buttonSizes) !== -1) {
|
|
||||||
sizeClassSpecified = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!sizeClassSpecified) {
|
|
||||||
$button.removeClass(buttonSizes.join(' '));
|
|
||||||
$button.addClass(dialog.getButtonSize());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -585,13 +546,6 @@
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
getButtonSize: function () {
|
|
||||||
if (typeof BootstrapDialog.BUTTON_SIZES[this.getSize()] !== 'undefined') {
|
|
||||||
return BootstrapDialog.BUTTON_SIZES[this.getSize()];
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
},
|
|
||||||
updateButtons: function () {
|
updateButtons: function () {
|
||||||
if (this.isRealized()) {
|
if (this.isRealized()) {
|
||||||
if (this.getButtons().length === 0) {
|
if (this.getButtons().length === 0) {
|
||||||
|
@ -1172,7 +1126,8 @@
|
||||||
btnOKClass: null,
|
btnOKClass: null,
|
||||||
btnOKHotkey: null,
|
btnOKHotkey: null,
|
||||||
btnsOrder: BootstrapDialog.defaultOptions.btnsOrder,
|
btnsOrder: BootstrapDialog.defaultOptions.btnsOrder,
|
||||||
callback: null
|
callback: null,
|
||||||
|
confirmed: null
|
||||||
};
|
};
|
||||||
if (typeof arguments[0] === 'object' && arguments[0].constructor === {}.constructor) {
|
if (typeof arguments[0] === 'object' && arguments[0].constructor === {}.constructor) {
|
||||||
confirmOptions = $.extend(true, defaultConfirmOptions, arguments[0]);
|
confirmOptions = $.extend(true, defaultConfirmOptions, arguments[0]);
|
||||||
|
@ -1188,12 +1143,18 @@
|
||||||
|
|
||||||
var dialog = new BootstrapDialog(confirmOptions);
|
var dialog = new BootstrapDialog(confirmOptions);
|
||||||
dialog.setData('callback', confirmOptions.callback);
|
dialog.setData('callback', confirmOptions.callback);
|
||||||
|
dialog.onHide(function(dialog) {
|
||||||
|
if (dialog.getData('confirmed') == null && typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, null) === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var buttons = [{
|
var buttons = [{
|
||||||
label: confirmOptions.btnCancelLabel,
|
label: confirmOptions.btnCancelLabel,
|
||||||
cssClass: confirmOptions.btnCancelClass,
|
cssClass: confirmOptions.btnCancelClass,
|
||||||
hotkey: confirmOptions.btnCancelHotkey,
|
hotkey: confirmOptions.btnCancelHotkey,
|
||||||
action: function (dialog) {
|
action: function (dialog) {
|
||||||
|
dialog.setData('confirmed', false);
|
||||||
if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) === false) {
|
if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1205,6 +1166,7 @@
|
||||||
cssClass: confirmOptions.btnOKClass,
|
cssClass: confirmOptions.btnOKClass,
|
||||||
hotkey: confirmOptions.btnOKHotkey,
|
hotkey: confirmOptions.btnOKHotkey,
|
||||||
action: function (dialog) {
|
action: function (dialog) {
|
||||||
|
dialog.setData('confirmed', true);
|
||||||
if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) === false) {
|
if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue