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);
|
||||
}
|
||||
|
||||
.bootstrap-dialog .bootstrap-dialog-title {
|
||||
color: #fff;
|
||||
.bootstrap-dialog:not(.type-light) .bootstrap-dialog-title {
|
||||
color: var(--bs-light);
|
||||
}
|
||||
.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:not(.type-light) .modal-header .btn-close {
|
||||
filter: invert(1);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
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.prototype = {
|
||||
constructor: BootstrapDialogModal,
|
||||
|
@ -132,12 +118,6 @@
|
|||
BootstrapDialog.SIZE_LARGE = 'size-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.BUTTONS_ORDER_CANCEL_OK = 'btns-order-cancel-ok';
|
||||
BootstrapDialog.BUTTONS_ORDER_OK_CANCEL = 'btns-order-ok-cancel';
|
||||
|
@ -435,25 +415,6 @@
|
|||
if (this.getSize() === BootstrapDialog.SIZE_EXTRA_LARGE) {
|
||||
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;
|
||||
|
@ -585,13 +546,6 @@
|
|||
|
||||
return null;
|
||||
},
|
||||
getButtonSize: function () {
|
||||
if (typeof BootstrapDialog.BUTTON_SIZES[this.getSize()] !== 'undefined') {
|
||||
return BootstrapDialog.BUTTON_SIZES[this.getSize()];
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
updateButtons: function () {
|
||||
if (this.isRealized()) {
|
||||
if (this.getButtons().length === 0) {
|
||||
|
@ -1172,7 +1126,8 @@
|
|||
btnOKClass: null,
|
||||
btnOKHotkey: null,
|
||||
btnsOrder: BootstrapDialog.defaultOptions.btnsOrder,
|
||||
callback: null
|
||||
callback: null,
|
||||
confirmed: null
|
||||
};
|
||||
if (typeof arguments[0] === 'object' && arguments[0].constructor === {}.constructor) {
|
||||
confirmOptions = $.extend(true, defaultConfirmOptions, arguments[0]);
|
||||
|
@ -1188,12 +1143,18 @@
|
|||
|
||||
var dialog = new BootstrapDialog(confirmOptions);
|
||||
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 = [{
|
||||
label: confirmOptions.btnCancelLabel,
|
||||
cssClass: confirmOptions.btnCancelClass,
|
||||
hotkey: confirmOptions.btnCancelHotkey,
|
||||
action: function (dialog) {
|
||||
dialog.setData('confirmed', false);
|
||||
if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1205,6 +1166,7 @@
|
|||
cssClass: confirmOptions.btnOKClass,
|
||||
hotkey: confirmOptions.btnOKHotkey,
|
||||
action: function (dialog) {
|
||||
dialog.setData('confirmed', true);
|
||||
if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) === false) {
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue