sweetalert2 11.4.14 → 11.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sweetalert2.all.js +384 -63
- package/dist/sweetalert2.all.min.js +1 -1
- package/dist/sweetalert2.js +384 -63
- package/dist/sweetalert2.min.js +1 -1
- package/package.json +3 -3
- package/src/SweetAlert.js +27 -7
- package/src/globalState.js +8 -2
- package/src/instanceMethods/_destroy.js +12 -6
- package/src/keydown-handler.js +47 -4
- package/src/staticMethods/showLoading.js +2 -2
- package/src/types.js +35 -0
- package/src/utils/dom/animationEndEvent.js +3 -0
- package/src/utils/dom/domUtils.js +44 -3
- package/src/utils/dom/getters.js +68 -1
- package/src/utils/dom/init.js +37 -2
- package/src/utils/dom/measureScrollbar.js +6 -2
- package/src/utils/dom/parseHtmlToContainer.js +4 -0
- package/src/utils/dom/renderers/render.js +4 -0
- package/src/utils/dom/renderers/renderActions.js +20 -0
- package/src/utils/dom/renderers/renderCloseButton.js +4 -0
- package/src/utils/dom/renderers/renderContainer.js +32 -16
- package/src/utils/dom/renderers/renderContent.js +4 -0
- package/src/utils/dom/renderers/renderFooter.js +4 -0
- package/src/utils/dom/renderers/renderIcon.js +1 -5
- package/src/utils/dom/renderers/renderImage.js +0 -5
- package/src/utils/dom/renderers/renderInput.js +0 -2
- package/src/utils/dom/renderers/renderPopup.js +0 -5
- package/src/utils/dom/renderers/renderProgressSteps.js +0 -5
- package/src/utils/dom/renderers/renderTitle.js +4 -0
- package/src/utils/utils.js +1 -1
package/dist/sweetalert2.all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sweetalert2 v11.4.
|
|
2
|
+
* sweetalert2 v11.4.15
|
|
3
3
|
* Released under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
35
35
|
/**
|
|
36
|
-
* @param {NodeList | HTMLCollection | NamedNodeMap} nodeList
|
|
36
|
+
* @param {NodeList | HTMLCollection | NamedNodeMap | DOMTokenList} nodeList
|
|
37
37
|
* @returns {array}
|
|
38
38
|
*/
|
|
39
39
|
|
|
@@ -268,33 +268,110 @@
|
|
|
268
268
|
*/
|
|
269
269
|
|
|
270
270
|
const getContainer = () => document.body.querySelector(".".concat(swalClasses.container));
|
|
271
|
+
/**
|
|
272
|
+
* @param {string} selectorString
|
|
273
|
+
* @returns {HTMLElement | null}
|
|
274
|
+
*/
|
|
275
|
+
|
|
271
276
|
const elementBySelector = selectorString => {
|
|
272
277
|
const container = getContainer();
|
|
273
278
|
return container ? container.querySelector(selectorString) : null;
|
|
274
279
|
};
|
|
280
|
+
/**
|
|
281
|
+
* @param {string} className
|
|
282
|
+
* @returns {HTMLElement | null}
|
|
283
|
+
*/
|
|
275
284
|
|
|
276
285
|
const elementByClass = className => {
|
|
277
286
|
return elementBySelector(".".concat(className));
|
|
278
287
|
};
|
|
288
|
+
/**
|
|
289
|
+
* @returns {HTMLElement | null}
|
|
290
|
+
*/
|
|
291
|
+
|
|
279
292
|
|
|
280
293
|
const getPopup = () => elementByClass(swalClasses.popup);
|
|
294
|
+
/**
|
|
295
|
+
* @returns {HTMLElement | null}
|
|
296
|
+
*/
|
|
297
|
+
|
|
281
298
|
const getIcon = () => elementByClass(swalClasses.icon);
|
|
299
|
+
/**
|
|
300
|
+
* @returns {HTMLElement | null}
|
|
301
|
+
*/
|
|
302
|
+
|
|
282
303
|
const getTitle = () => elementByClass(swalClasses.title);
|
|
304
|
+
/**
|
|
305
|
+
* @returns {HTMLElement | null}
|
|
306
|
+
*/
|
|
307
|
+
|
|
283
308
|
const getHtmlContainer = () => elementByClass(swalClasses['html-container']);
|
|
309
|
+
/**
|
|
310
|
+
* @returns {HTMLElement | null}
|
|
311
|
+
*/
|
|
312
|
+
|
|
284
313
|
const getImage = () => elementByClass(swalClasses.image);
|
|
314
|
+
/**
|
|
315
|
+
* @returns {HTMLElement | null}
|
|
316
|
+
*/
|
|
317
|
+
|
|
285
318
|
const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);
|
|
319
|
+
/**
|
|
320
|
+
* @returns {HTMLElement | null}
|
|
321
|
+
*/
|
|
322
|
+
|
|
286
323
|
const getValidationMessage = () => elementByClass(swalClasses['validation-message']);
|
|
324
|
+
/**
|
|
325
|
+
* @returns {HTMLElement | null}
|
|
326
|
+
*/
|
|
327
|
+
|
|
287
328
|
const getConfirmButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.confirm));
|
|
329
|
+
/**
|
|
330
|
+
* @returns {HTMLElement | null}
|
|
331
|
+
*/
|
|
332
|
+
|
|
288
333
|
const getDenyButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.deny));
|
|
334
|
+
/**
|
|
335
|
+
* @returns {HTMLElement | null}
|
|
336
|
+
*/
|
|
337
|
+
|
|
289
338
|
const getInputLabel = () => elementByClass(swalClasses['input-label']);
|
|
339
|
+
/**
|
|
340
|
+
* @returns {HTMLElement | null}
|
|
341
|
+
*/
|
|
342
|
+
|
|
290
343
|
const getLoader = () => elementBySelector(".".concat(swalClasses.loader));
|
|
344
|
+
/**
|
|
345
|
+
* @returns {HTMLElement | null}
|
|
346
|
+
*/
|
|
347
|
+
|
|
291
348
|
const getCancelButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.cancel));
|
|
349
|
+
/**
|
|
350
|
+
* @returns {HTMLElement | null}
|
|
351
|
+
*/
|
|
352
|
+
|
|
292
353
|
const getActions = () => elementByClass(swalClasses.actions);
|
|
354
|
+
/**
|
|
355
|
+
* @returns {HTMLElement | null}
|
|
356
|
+
*/
|
|
357
|
+
|
|
293
358
|
const getFooter = () => elementByClass(swalClasses.footer);
|
|
359
|
+
/**
|
|
360
|
+
* @returns {HTMLElement | null}
|
|
361
|
+
*/
|
|
362
|
+
|
|
294
363
|
const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);
|
|
364
|
+
/**
|
|
365
|
+
* @returns {HTMLElement | null}
|
|
366
|
+
*/
|
|
367
|
+
|
|
295
368
|
const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js
|
|
296
369
|
|
|
297
370
|
const focusable = "\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex=\"0\"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n";
|
|
371
|
+
/**
|
|
372
|
+
* @returns {HTMLElement[]}
|
|
373
|
+
*/
|
|
374
|
+
|
|
298
375
|
const getFocusableElements = () => {
|
|
299
376
|
const focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex
|
|
300
377
|
.sort((a, b) => {
|
|
@@ -312,12 +389,24 @@
|
|
|
312
389
|
const otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1');
|
|
313
390
|
return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el));
|
|
314
391
|
};
|
|
392
|
+
/**
|
|
393
|
+
* @returns {boolean}
|
|
394
|
+
*/
|
|
395
|
+
|
|
315
396
|
const isModal = () => {
|
|
316
397
|
return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);
|
|
317
398
|
};
|
|
399
|
+
/**
|
|
400
|
+
* @returns {boolean}
|
|
401
|
+
*/
|
|
402
|
+
|
|
318
403
|
const isToast = () => {
|
|
319
404
|
return getPopup() && hasClass(getPopup(), swalClasses.toast);
|
|
320
405
|
};
|
|
406
|
+
/**
|
|
407
|
+
* @returns {boolean}
|
|
408
|
+
*/
|
|
409
|
+
|
|
321
410
|
const isLoading = () => {
|
|
322
411
|
return getPopup().hasAttribute('data-loading');
|
|
323
412
|
};
|
|
@@ -368,6 +457,10 @@
|
|
|
368
457
|
|
|
369
458
|
return true;
|
|
370
459
|
};
|
|
460
|
+
/**
|
|
461
|
+
* @param {HTMLElement} elem
|
|
462
|
+
* @param {SweetAlertOptions} params
|
|
463
|
+
*/
|
|
371
464
|
|
|
372
465
|
const removeCustomClasses = (elem, params) => {
|
|
373
466
|
toArray(elem.classList).forEach(className => {
|
|
@@ -376,6 +469,12 @@
|
|
|
376
469
|
}
|
|
377
470
|
});
|
|
378
471
|
};
|
|
472
|
+
/**
|
|
473
|
+
* @param {HTMLElement} elem
|
|
474
|
+
* @param {SweetAlertOptions} params
|
|
475
|
+
* @param {string} className
|
|
476
|
+
*/
|
|
477
|
+
|
|
379
478
|
|
|
380
479
|
const applyCustomClass = (elem, params, className) => {
|
|
381
480
|
removeCustomClasses(elem, params);
|
|
@@ -523,20 +622,55 @@
|
|
|
523
622
|
const hide = elem => {
|
|
524
623
|
elem.style.display = 'none';
|
|
525
624
|
};
|
|
625
|
+
/**
|
|
626
|
+
* @param {HTMLElement} parent
|
|
627
|
+
* @param {string} selector
|
|
628
|
+
* @param {string} property
|
|
629
|
+
* @param {string} value
|
|
630
|
+
*/
|
|
631
|
+
|
|
526
632
|
const setStyle = (parent, selector, property, value) => {
|
|
633
|
+
/** @type {HTMLElement} */
|
|
527
634
|
const el = parent.querySelector(selector);
|
|
528
635
|
|
|
529
636
|
if (el) {
|
|
530
637
|
el.style[property] = value;
|
|
531
638
|
}
|
|
532
639
|
};
|
|
533
|
-
|
|
640
|
+
/**
|
|
641
|
+
* @param {HTMLElement} elem
|
|
642
|
+
* @param {any} condition
|
|
643
|
+
* @param {string} display
|
|
644
|
+
*/
|
|
645
|
+
|
|
646
|
+
const toggle = function (elem, condition) {
|
|
647
|
+
let display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex';
|
|
534
648
|
condition ? show(elem, display) : hide(elem);
|
|
535
|
-
};
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* borrowed from jquery $(elem).is(':visible') implementation
|
|
652
|
+
*
|
|
653
|
+
* @param {HTMLElement} elem
|
|
654
|
+
* @returns {boolean}
|
|
655
|
+
*/
|
|
536
656
|
|
|
537
657
|
const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));
|
|
658
|
+
/**
|
|
659
|
+
* @returns {boolean}
|
|
660
|
+
*/
|
|
661
|
+
|
|
538
662
|
const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton());
|
|
539
|
-
|
|
663
|
+
/**
|
|
664
|
+
* @returns {boolean}
|
|
665
|
+
*/
|
|
666
|
+
|
|
667
|
+
const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight);
|
|
668
|
+
/**
|
|
669
|
+
* borrowed from https://stackoverflow.com/a/46352119
|
|
670
|
+
*
|
|
671
|
+
* @param {HTMLElement} elem
|
|
672
|
+
* @returns {boolean}
|
|
673
|
+
*/
|
|
540
674
|
|
|
541
675
|
const hasCssAnimation = elem => {
|
|
542
676
|
const style = window.getComputedStyle(elem);
|
|
@@ -544,6 +678,11 @@
|
|
|
544
678
|
const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
|
|
545
679
|
return animDuration > 0 || transDuration > 0;
|
|
546
680
|
};
|
|
681
|
+
/**
|
|
682
|
+
* @param {number} timer
|
|
683
|
+
* @param {boolean} reset
|
|
684
|
+
*/
|
|
685
|
+
|
|
547
686
|
const animateTimerProgressBar = function (timer) {
|
|
548
687
|
let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
549
688
|
const timerProgressBar = getTimerProgressBar();
|
|
@@ -580,16 +719,24 @@
|
|
|
580
719
|
|
|
581
720
|
const RESTORE_FOCUS_TIMEOUT = 100;
|
|
582
721
|
|
|
722
|
+
/** @type {GlobalState} */
|
|
723
|
+
|
|
583
724
|
const globalState = {};
|
|
584
725
|
|
|
585
726
|
const focusPreviousActiveElement = () => {
|
|
586
|
-
if (globalState.previousActiveElement
|
|
727
|
+
if (globalState.previousActiveElement instanceof HTMLElement) {
|
|
587
728
|
globalState.previousActiveElement.focus();
|
|
588
729
|
globalState.previousActiveElement = null;
|
|
589
730
|
} else if (document.body) {
|
|
590
731
|
document.body.focus();
|
|
591
732
|
}
|
|
592
|
-
};
|
|
733
|
+
};
|
|
734
|
+
/**
|
|
735
|
+
* Restore previous active (focused) element
|
|
736
|
+
*
|
|
737
|
+
* @param {boolean} returnFocus
|
|
738
|
+
* @returns {Promise}
|
|
739
|
+
*/
|
|
593
740
|
|
|
594
741
|
|
|
595
742
|
const restoreActiveElement = returnFocus => {
|
|
@@ -610,6 +757,9 @@
|
|
|
610
757
|
};
|
|
611
758
|
|
|
612
759
|
const sweetHTML = "\n <div aria-labelledby=\"".concat(swalClasses.title, "\" aria-describedby=\"").concat(swalClasses['html-container'], "\" class=\"").concat(swalClasses.popup, "\" tabindex=\"-1\">\n <button type=\"button\" class=\"").concat(swalClasses.close, "\"></button>\n <ul class=\"").concat(swalClasses['progress-steps'], "\"></ul>\n <div class=\"").concat(swalClasses.icon, "\"></div>\n <img class=\"").concat(swalClasses.image, "\" />\n <h2 class=\"").concat(swalClasses.title, "\" id=\"").concat(swalClasses.title, "\"></h2>\n <div class=\"").concat(swalClasses['html-container'], "\" id=\"").concat(swalClasses['html-container'], "\"></div>\n <input class=\"").concat(swalClasses.input, "\" />\n <input type=\"file\" class=\"").concat(swalClasses.file, "\" />\n <div class=\"").concat(swalClasses.range, "\">\n <input type=\"range\" />\n <output></output>\n </div>\n <select class=\"").concat(swalClasses.select, "\"></select>\n <div class=\"").concat(swalClasses.radio, "\"></div>\n <label for=\"").concat(swalClasses.checkbox, "\" class=\"").concat(swalClasses.checkbox, "\">\n <input type=\"checkbox\" />\n <span class=\"").concat(swalClasses.label, "\"></span>\n </label>\n <textarea class=\"").concat(swalClasses.textarea, "\"></textarea>\n <div class=\"").concat(swalClasses['validation-message'], "\" id=\"").concat(swalClasses['validation-message'], "\"></div>\n <div class=\"").concat(swalClasses.actions, "\">\n <div class=\"").concat(swalClasses.loader, "\"></div>\n <button type=\"button\" class=\"").concat(swalClasses.confirm, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.deny, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.cancel, "\"></button>\n </div>\n <div class=\"").concat(swalClasses.footer, "\"></div>\n <div class=\"").concat(swalClasses['timer-progress-bar-container'], "\">\n <div class=\"").concat(swalClasses['timer-progress-bar'], "\"></div>\n </div>\n </div>\n").replace(/(^|\n)\s*/g, '');
|
|
760
|
+
/**
|
|
761
|
+
* @returns {boolean}
|
|
762
|
+
*/
|
|
613
763
|
|
|
614
764
|
const resetOldContainer = () => {
|
|
615
765
|
const oldContainer = getContainer();
|
|
@@ -631,9 +781,15 @@
|
|
|
631
781
|
const popup = getPopup();
|
|
632
782
|
const input = getDirectChildByClass(popup, swalClasses.input);
|
|
633
783
|
const file = getDirectChildByClass(popup, swalClasses.file);
|
|
784
|
+
/** @type {HTMLInputElement} */
|
|
785
|
+
|
|
634
786
|
const range = popup.querySelector(".".concat(swalClasses.range, " input"));
|
|
787
|
+
/** @type {HTMLOutputElement} */
|
|
788
|
+
|
|
635
789
|
const rangeOutput = popup.querySelector(".".concat(swalClasses.range, " output"));
|
|
636
790
|
const select = getDirectChildByClass(popup, swalClasses.select);
|
|
791
|
+
/** @type {HTMLInputElement} */
|
|
792
|
+
|
|
637
793
|
const checkbox = popup.querySelector(".".concat(swalClasses.checkbox, " input"));
|
|
638
794
|
const textarea = getDirectChildByClass(popup, swalClasses.textarea);
|
|
639
795
|
input.oninput = resetValidationMessage;
|
|
@@ -649,11 +805,20 @@
|
|
|
649
805
|
|
|
650
806
|
range.onchange = () => {
|
|
651
807
|
resetValidationMessage();
|
|
652
|
-
|
|
808
|
+
rangeOutput.value = range.value;
|
|
653
809
|
};
|
|
654
810
|
};
|
|
811
|
+
/**
|
|
812
|
+
* @param {string | HTMLElement} target
|
|
813
|
+
* @returns {HTMLElement}
|
|
814
|
+
*/
|
|
815
|
+
|
|
655
816
|
|
|
656
817
|
const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target;
|
|
818
|
+
/**
|
|
819
|
+
* @param {SweetAlertOptions} params
|
|
820
|
+
*/
|
|
821
|
+
|
|
657
822
|
|
|
658
823
|
const setupAccessibility = params => {
|
|
659
824
|
const popup = getPopup();
|
|
@@ -664,14 +829,20 @@
|
|
|
664
829
|
popup.setAttribute('aria-modal', 'true');
|
|
665
830
|
}
|
|
666
831
|
};
|
|
832
|
+
/**
|
|
833
|
+
* @param {HTMLElement} targetElement
|
|
834
|
+
*/
|
|
835
|
+
|
|
667
836
|
|
|
668
837
|
const setupRTL = targetElement => {
|
|
669
838
|
if (window.getComputedStyle(targetElement).direction === 'rtl') {
|
|
670
839
|
addClass(getContainer(), swalClasses.rtl);
|
|
671
840
|
}
|
|
672
841
|
};
|
|
673
|
-
|
|
842
|
+
/**
|
|
674
843
|
* Add modal + backdrop + no-war message for Russians to DOM
|
|
844
|
+
*
|
|
845
|
+
* @param {SweetAlertOptions} params
|
|
675
846
|
*/
|
|
676
847
|
|
|
677
848
|
|
|
@@ -700,6 +871,11 @@
|
|
|
700
871
|
addInputChangeListeners();
|
|
701
872
|
noWarMessageForRussians(container, params);
|
|
702
873
|
};
|
|
874
|
+
/**
|
|
875
|
+
* @param {HTMLElement} container
|
|
876
|
+
* @param {SweetAlertOptions} params
|
|
877
|
+
* @returns
|
|
878
|
+
*/
|
|
703
879
|
|
|
704
880
|
const noWarMessageForRussians = (container, params) => {
|
|
705
881
|
if (params.toast) {
|
|
@@ -730,6 +906,15 @@
|
|
|
730
906
|
}, {
|
|
731
907
|
text: 'ФИНСКИЙ ДРУГ РОССИИ <br> говорит ПО-РУССКИ о спецоперации',
|
|
732
908
|
youtubeId: 'hkCYb6edUrQ'
|
|
909
|
+
}, {
|
|
910
|
+
text: 'ЮРИЙ ПОДОЛЯКА честно <br> о генералах РУССКОЙ АРМИИ',
|
|
911
|
+
youtubeId: 'w4-_8BJKfpk'
|
|
912
|
+
}, {
|
|
913
|
+
text: 'Полковник ФСБ СТРЕЛКОВ <br> об успехах РОССИИ в спецоперации',
|
|
914
|
+
youtubeId: 'saK5UTKroDA'
|
|
915
|
+
}, {
|
|
916
|
+
text: 'СКОБЕЕВА и ПЕРВЫЙ КАНАЛ <br> о контрнаступлении ВСУ на КРЫМ',
|
|
917
|
+
youtubeId: 'rnnUCSKZ-SM'
|
|
733
918
|
}]); // The message will only be shown to Russian users visiting Russian sites
|
|
734
919
|
|
|
735
920
|
if (navigator.language === 'ru' && location.host.match(/\.(ru|su|xn--p1ai)$/)) {
|
|
@@ -772,6 +957,11 @@
|
|
|
772
957
|
setInnerHtml(target, param.toString());
|
|
773
958
|
}
|
|
774
959
|
};
|
|
960
|
+
/**
|
|
961
|
+
* @param {HTMLElement} target
|
|
962
|
+
* @param {HTMLElement} elem
|
|
963
|
+
*/
|
|
964
|
+
|
|
775
965
|
|
|
776
966
|
const handleJqueryElem = (target, elem) => {
|
|
777
967
|
target.textContent = '';
|
|
@@ -785,6 +975,10 @@
|
|
|
785
975
|
}
|
|
786
976
|
};
|
|
787
977
|
|
|
978
|
+
/**
|
|
979
|
+
* @returns {'webkitAnimationEnd' | 'animationend' | false}
|
|
980
|
+
*/
|
|
981
|
+
|
|
788
982
|
const animationEndEvent = (() => {
|
|
789
983
|
// Prevent run in Node env
|
|
790
984
|
|
|
@@ -810,7 +1004,12 @@
|
|
|
810
1004
|
return false;
|
|
811
1005
|
})();
|
|
812
1006
|
|
|
813
|
-
|
|
1007
|
+
/**
|
|
1008
|
+
* Measure scrollbar width for padding body during modal show/hide
|
|
1009
|
+
* https://github.com/twbs/bootstrap/blob/master/js/src/modal.js
|
|
1010
|
+
*
|
|
1011
|
+
* @returns {number}
|
|
1012
|
+
*/
|
|
814
1013
|
|
|
815
1014
|
const measureScrollbar = () => {
|
|
816
1015
|
const scrollDiv = document.createElement('div');
|
|
@@ -821,6 +1020,11 @@
|
|
|
821
1020
|
return scrollbarWidth;
|
|
822
1021
|
};
|
|
823
1022
|
|
|
1023
|
+
/**
|
|
1024
|
+
* @param {SweetAlert2} instance
|
|
1025
|
+
* @param {SweetAlertOptions} params
|
|
1026
|
+
*/
|
|
1027
|
+
|
|
824
1028
|
const renderActions = (instance, params) => {
|
|
825
1029
|
const actions = getActions();
|
|
826
1030
|
const loader = getLoader(); // Actions (buttons) wrapper
|
|
@@ -839,6 +1043,11 @@
|
|
|
839
1043
|
setInnerHtml(loader, params.loaderHtml);
|
|
840
1044
|
applyCustomClass(loader, params, 'loader');
|
|
841
1045
|
};
|
|
1046
|
+
/**
|
|
1047
|
+
* @param {HTMLElement} actions
|
|
1048
|
+
* @param {HTMLElement} loader
|
|
1049
|
+
* @param {SweetAlertOptions} params
|
|
1050
|
+
*/
|
|
842
1051
|
|
|
843
1052
|
function renderButtons(actions, loader, params) {
|
|
844
1053
|
const confirmButton = getConfirmButton();
|
|
@@ -861,6 +1070,13 @@
|
|
|
861
1070
|
}
|
|
862
1071
|
}
|
|
863
1072
|
}
|
|
1073
|
+
/**
|
|
1074
|
+
* @param {HTMLElement} confirmButton
|
|
1075
|
+
* @param {HTMLElement} denyButton
|
|
1076
|
+
* @param {HTMLElement} cancelButton
|
|
1077
|
+
* @param {SweetAlertOptions} params
|
|
1078
|
+
*/
|
|
1079
|
+
|
|
864
1080
|
|
|
865
1081
|
function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {
|
|
866
1082
|
if (!params.buttonsStyling) {
|
|
@@ -884,6 +1100,12 @@
|
|
|
884
1100
|
addClass(cancelButton, swalClasses['default-outline']);
|
|
885
1101
|
}
|
|
886
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* @param {HTMLElement} button
|
|
1105
|
+
* @param {'confirm' | 'deny' | 'cancel'} buttonType
|
|
1106
|
+
* @param {SweetAlertOptions} params
|
|
1107
|
+
*/
|
|
1108
|
+
|
|
887
1109
|
|
|
888
1110
|
function renderButton(button, buttonType, params) {
|
|
889
1111
|
toggle(button, params["show".concat(capitalizeFirstLetter(buttonType), "Button")], 'inline-block');
|
|
@@ -897,6 +1119,29 @@
|
|
|
897
1119
|
addClass(button, params["".concat(buttonType, "ButtonClass")]);
|
|
898
1120
|
}
|
|
899
1121
|
|
|
1122
|
+
/**
|
|
1123
|
+
* @param {SweetAlert2} instance
|
|
1124
|
+
* @param {SweetAlertOptions} params
|
|
1125
|
+
*/
|
|
1126
|
+
|
|
1127
|
+
const renderContainer = (instance, params) => {
|
|
1128
|
+
const container = getContainer();
|
|
1129
|
+
|
|
1130
|
+
if (!container) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
handleBackdropParam(container, params.backdrop);
|
|
1135
|
+
handlePositionParam(container, params.position);
|
|
1136
|
+
handleGrowParam(container, params.grow); // Custom class
|
|
1137
|
+
|
|
1138
|
+
applyCustomClass(container, params, 'container');
|
|
1139
|
+
};
|
|
1140
|
+
/**
|
|
1141
|
+
* @param {HTMLElement} container
|
|
1142
|
+
* @param {SweetAlertOptions['backdrop']} backdrop
|
|
1143
|
+
*/
|
|
1144
|
+
|
|
900
1145
|
function handleBackdropParam(container, backdrop) {
|
|
901
1146
|
if (typeof backdrop === 'string') {
|
|
902
1147
|
container.style.background = backdrop;
|
|
@@ -904,6 +1149,11 @@
|
|
|
904
1149
|
addClass([document.documentElement, document.body], swalClasses['no-backdrop']);
|
|
905
1150
|
}
|
|
906
1151
|
}
|
|
1152
|
+
/**
|
|
1153
|
+
* @param {HTMLElement} container
|
|
1154
|
+
* @param {SweetAlertOptions['position']} position
|
|
1155
|
+
*/
|
|
1156
|
+
|
|
907
1157
|
|
|
908
1158
|
function handlePositionParam(container, position) {
|
|
909
1159
|
if (position in swalClasses) {
|
|
@@ -913,6 +1163,11 @@
|
|
|
913
1163
|
addClass(container, swalClasses.center);
|
|
914
1164
|
}
|
|
915
1165
|
}
|
|
1166
|
+
/**
|
|
1167
|
+
* @param {HTMLElement} container
|
|
1168
|
+
* @param {SweetAlertOptions['grow']} grow
|
|
1169
|
+
*/
|
|
1170
|
+
|
|
916
1171
|
|
|
917
1172
|
function handleGrowParam(container, grow) {
|
|
918
1173
|
if (grow && typeof grow === 'string') {
|
|
@@ -924,20 +1179,6 @@
|
|
|
924
1179
|
}
|
|
925
1180
|
}
|
|
926
1181
|
|
|
927
|
-
const renderContainer = (instance, params) => {
|
|
928
|
-
const container = getContainer();
|
|
929
|
-
|
|
930
|
-
if (!container) {
|
|
931
|
-
return;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
handleBackdropParam(container, params.backdrop);
|
|
935
|
-
handlePositionParam(container, params.position);
|
|
936
|
-
handleGrowParam(container, params.grow); // Custom class
|
|
937
|
-
|
|
938
|
-
applyCustomClass(container, params, 'container');
|
|
939
|
-
};
|
|
940
|
-
|
|
941
1182
|
/**
|
|
942
1183
|
* This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
|
|
943
1184
|
* For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
|
|
@@ -1242,6 +1483,11 @@
|
|
|
1242
1483
|
return textarea;
|
|
1243
1484
|
};
|
|
1244
1485
|
|
|
1486
|
+
/**
|
|
1487
|
+
* @param {SweetAlert2} instance
|
|
1488
|
+
* @param {SweetAlertOptions} params
|
|
1489
|
+
*/
|
|
1490
|
+
|
|
1245
1491
|
const renderContent = (instance, params) => {
|
|
1246
1492
|
const htmlContainer = getHtmlContainer();
|
|
1247
1493
|
applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML
|
|
@@ -1261,6 +1507,11 @@
|
|
|
1261
1507
|
renderInput(instance, params);
|
|
1262
1508
|
};
|
|
1263
1509
|
|
|
1510
|
+
/**
|
|
1511
|
+
* @param {SweetAlert2} instance
|
|
1512
|
+
* @param {SweetAlertOptions} params
|
|
1513
|
+
*/
|
|
1514
|
+
|
|
1264
1515
|
const renderFooter = (instance, params) => {
|
|
1265
1516
|
const footer = getFooter();
|
|
1266
1517
|
toggle(footer, params.footer);
|
|
@@ -1273,6 +1524,11 @@
|
|
|
1273
1524
|
applyCustomClass(footer, params, 'footer');
|
|
1274
1525
|
};
|
|
1275
1526
|
|
|
1527
|
+
/**
|
|
1528
|
+
* @param {SweetAlert2} instance
|
|
1529
|
+
* @param {SweetAlertOptions} params
|
|
1530
|
+
*/
|
|
1531
|
+
|
|
1276
1532
|
const renderCloseButton = (instance, params) => {
|
|
1277
1533
|
const closeButton = getCloseButton();
|
|
1278
1534
|
setInnerHtml(closeButton, params.closeButtonHtml); // Custom class
|
|
@@ -1282,11 +1538,6 @@
|
|
|
1282
1538
|
closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);
|
|
1283
1539
|
};
|
|
1284
1540
|
|
|
1285
|
-
/**
|
|
1286
|
-
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1287
|
-
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1288
|
-
*/
|
|
1289
|
-
|
|
1290
1541
|
/**
|
|
1291
1542
|
* @param {SweetAlert2} instance
|
|
1292
1543
|
* @param {SweetAlertOptions} params
|
|
@@ -1344,6 +1595,8 @@
|
|
|
1344
1595
|
const adjustSuccessIconBackgroundColor = () => {
|
|
1345
1596
|
const popup = getPopup();
|
|
1346
1597
|
const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');
|
|
1598
|
+
/** @type {NodeListOf<HTMLElement>} */
|
|
1599
|
+
|
|
1347
1600
|
const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
|
|
1348
1601
|
|
|
1349
1602
|
for (let i = 0; i < successIconParts.length; i++) {
|
|
@@ -1403,11 +1656,6 @@
|
|
|
1403
1656
|
|
|
1404
1657
|
const iconContent = content => "<div class=\"".concat(swalClasses['icon-content'], "\">").concat(content, "</div>");
|
|
1405
1658
|
|
|
1406
|
-
/**
|
|
1407
|
-
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1408
|
-
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1409
|
-
*/
|
|
1410
|
-
|
|
1411
1659
|
/**
|
|
1412
1660
|
* @param {SweetAlert2} instance
|
|
1413
1661
|
* @param {SweetAlertOptions} params
|
|
@@ -1432,11 +1680,6 @@
|
|
|
1432
1680
|
applyCustomClass(image, params, 'image');
|
|
1433
1681
|
};
|
|
1434
1682
|
|
|
1435
|
-
/**
|
|
1436
|
-
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1437
|
-
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1438
|
-
*/
|
|
1439
|
-
|
|
1440
1683
|
/**
|
|
1441
1684
|
* @param {SweetAlert2} instance
|
|
1442
1685
|
* @param {SweetAlertOptions} params
|
|
@@ -1498,6 +1741,11 @@
|
|
|
1498
1741
|
return lineEl;
|
|
1499
1742
|
};
|
|
1500
1743
|
|
|
1744
|
+
/**
|
|
1745
|
+
* @param {SweetAlert2} instance
|
|
1746
|
+
* @param {SweetAlertOptions} params
|
|
1747
|
+
*/
|
|
1748
|
+
|
|
1501
1749
|
const renderTitle = (instance, params) => {
|
|
1502
1750
|
const title = getTitle();
|
|
1503
1751
|
toggle(title, params.title || params.titleText, 'block');
|
|
@@ -1514,11 +1762,6 @@
|
|
|
1514
1762
|
applyCustomClass(title, params, 'title');
|
|
1515
1763
|
};
|
|
1516
1764
|
|
|
1517
|
-
/**
|
|
1518
|
-
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1519
|
-
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1520
|
-
*/
|
|
1521
|
-
|
|
1522
1765
|
/**
|
|
1523
1766
|
* @param {SweetAlert2} instance
|
|
1524
1767
|
* @param {SweetAlertOptions} params
|
|
@@ -1582,6 +1825,11 @@
|
|
|
1582
1825
|
}
|
|
1583
1826
|
};
|
|
1584
1827
|
|
|
1828
|
+
/**
|
|
1829
|
+
* @param {SweetAlert2} instance
|
|
1830
|
+
* @param {SweetAlertOptions} params
|
|
1831
|
+
*/
|
|
1832
|
+
|
|
1585
1833
|
const render = (instance, params) => {
|
|
1586
1834
|
renderPopup(instance, params);
|
|
1587
1835
|
renderContainer(instance, params);
|
|
@@ -2200,8 +2448,8 @@
|
|
|
2200
2448
|
}
|
|
2201
2449
|
|
|
2202
2450
|
show(loader);
|
|
2203
|
-
popup.setAttribute('data-loading', true);
|
|
2204
|
-
popup.setAttribute('aria-busy', true);
|
|
2451
|
+
popup.setAttribute('data-loading', 'true');
|
|
2452
|
+
popup.setAttribute('aria-busy', 'true');
|
|
2205
2453
|
popup.focus();
|
|
2206
2454
|
};
|
|
2207
2455
|
|
|
@@ -2491,6 +2739,10 @@
|
|
|
2491
2739
|
|
|
2492
2740
|
const clickCancel = () => getCancelButton() && getCancelButton().click();
|
|
2493
2741
|
|
|
2742
|
+
/**
|
|
2743
|
+
* @param {GlobalState} globalState
|
|
2744
|
+
*/
|
|
2745
|
+
|
|
2494
2746
|
const removeKeydownHandler = globalState => {
|
|
2495
2747
|
if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
|
|
2496
2748
|
globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
|
|
@@ -2499,6 +2751,13 @@
|
|
|
2499
2751
|
globalState.keydownHandlerAdded = false;
|
|
2500
2752
|
}
|
|
2501
2753
|
};
|
|
2754
|
+
/**
|
|
2755
|
+
* @param {SweetAlert2} instance
|
|
2756
|
+
* @param {GlobalState} globalState
|
|
2757
|
+
* @param {SweetAlertOptions} innerParams
|
|
2758
|
+
* @param {*} dismissWith
|
|
2759
|
+
*/
|
|
2760
|
+
|
|
2502
2761
|
const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
|
|
2503
2762
|
removeKeydownHandler(globalState);
|
|
2504
2763
|
|
|
@@ -2512,7 +2771,12 @@
|
|
|
2512
2771
|
});
|
|
2513
2772
|
globalState.keydownHandlerAdded = true;
|
|
2514
2773
|
}
|
|
2515
|
-
};
|
|
2774
|
+
};
|
|
2775
|
+
/**
|
|
2776
|
+
* @param {SweetAlertOptions} innerParams
|
|
2777
|
+
* @param {number} index
|
|
2778
|
+
* @param {number} increment
|
|
2779
|
+
*/
|
|
2516
2780
|
|
|
2517
2781
|
const setFocus = (innerParams, index, increment) => {
|
|
2518
2782
|
const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match
|
|
@@ -2534,6 +2798,11 @@
|
|
|
2534
2798
|
};
|
|
2535
2799
|
const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];
|
|
2536
2800
|
const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];
|
|
2801
|
+
/**
|
|
2802
|
+
* @param {SweetAlert2} instance
|
|
2803
|
+
* @param {KeyboardEvent} e
|
|
2804
|
+
* @param {function} dismissWith
|
|
2805
|
+
*/
|
|
2537
2806
|
|
|
2538
2807
|
const keydownHandler = (instance, e, dismissWith) => {
|
|
2539
2808
|
const innerParams = privateProps.innerParams.get(instance);
|
|
@@ -2568,6 +2837,12 @@
|
|
|
2568
2837
|
handleEsc(e, innerParams, dismissWith);
|
|
2569
2838
|
}
|
|
2570
2839
|
};
|
|
2840
|
+
/**
|
|
2841
|
+
* @param {SweetAlert2} instance
|
|
2842
|
+
* @param {KeyboardEvent} e
|
|
2843
|
+
* @param {SweetAlertOptions} innerParams
|
|
2844
|
+
*/
|
|
2845
|
+
|
|
2571
2846
|
|
|
2572
2847
|
const handleEnter = (instance, e, innerParams) => {
|
|
2573
2848
|
// https://github.com/sweetalert2/sweetalert2/issues/2386
|
|
@@ -2575,7 +2850,7 @@
|
|
|
2575
2850
|
return;
|
|
2576
2851
|
}
|
|
2577
2852
|
|
|
2578
|
-
if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {
|
|
2853
|
+
if (e.target && instance.getInput() && e.target instanceof HTMLElement && e.target.outerHTML === instance.getInput().outerHTML) {
|
|
2579
2854
|
if (['textarea', 'file'].includes(innerParams.input)) {
|
|
2580
2855
|
return; // do not submit
|
|
2581
2856
|
}
|
|
@@ -2584,6 +2859,11 @@
|
|
|
2584
2859
|
e.preventDefault();
|
|
2585
2860
|
}
|
|
2586
2861
|
};
|
|
2862
|
+
/**
|
|
2863
|
+
* @param {KeyboardEvent} e
|
|
2864
|
+
* @param {SweetAlertOptions} innerParams
|
|
2865
|
+
*/
|
|
2866
|
+
|
|
2587
2867
|
|
|
2588
2868
|
const handleTab = (e, innerParams) => {
|
|
2589
2869
|
const targetElement = e.target;
|
|
@@ -2608,13 +2888,17 @@
|
|
|
2608
2888
|
e.stopPropagation();
|
|
2609
2889
|
e.preventDefault();
|
|
2610
2890
|
};
|
|
2891
|
+
/**
|
|
2892
|
+
* @param {string} key
|
|
2893
|
+
*/
|
|
2894
|
+
|
|
2611
2895
|
|
|
2612
2896
|
const handleArrows = key => {
|
|
2613
2897
|
const confirmButton = getConfirmButton();
|
|
2614
2898
|
const denyButton = getDenyButton();
|
|
2615
2899
|
const cancelButton = getCancelButton();
|
|
2616
2900
|
|
|
2617
|
-
if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {
|
|
2901
|
+
if (document.activeElement instanceof HTMLElement && ![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {
|
|
2618
2902
|
return;
|
|
2619
2903
|
}
|
|
2620
2904
|
|
|
@@ -2628,7 +2912,7 @@
|
|
|
2628
2912
|
return;
|
|
2629
2913
|
}
|
|
2630
2914
|
|
|
2631
|
-
if (
|
|
2915
|
+
if (buttonToFocus instanceof HTMLButtonElement && isVisible(buttonToFocus)) {
|
|
2632
2916
|
break;
|
|
2633
2917
|
}
|
|
2634
2918
|
}
|
|
@@ -2637,6 +2921,12 @@
|
|
|
2637
2921
|
buttonToFocus.focus();
|
|
2638
2922
|
}
|
|
2639
2923
|
};
|
|
2924
|
+
/**
|
|
2925
|
+
* @param {KeyboardEvent} e
|
|
2926
|
+
* @param {SweetAlertOptions} innerParams
|
|
2927
|
+
* @param {function} dismissWith
|
|
2928
|
+
*/
|
|
2929
|
+
|
|
2640
2930
|
|
|
2641
2931
|
const handleEsc = (e, innerParams, dismissWith) => {
|
|
2642
2932
|
if (callIfFunction(innerParams.allowEscapeKey)) {
|
|
@@ -2926,12 +3216,6 @@
|
|
|
2926
3216
|
if (domCache.popup && globalState.swalCloseEventFinishedCallback) {
|
|
2927
3217
|
globalState.swalCloseEventFinishedCallback();
|
|
2928
3218
|
delete globalState.swalCloseEventFinishedCallback;
|
|
2929
|
-
} // Check if there is a swal disposal defer timer
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
if (globalState.deferDisposalTimer) {
|
|
2933
|
-
clearTimeout(globalState.deferDisposalTimer);
|
|
2934
|
-
delete globalState.deferDisposalTimer;
|
|
2935
3219
|
}
|
|
2936
3220
|
|
|
2937
3221
|
if (typeof innerParams.didDestroy === 'function') {
|
|
@@ -2940,9 +3224,13 @@
|
|
|
2940
3224
|
|
|
2941
3225
|
disposeSwal(this);
|
|
2942
3226
|
}
|
|
3227
|
+
/**
|
|
3228
|
+
* @param {SweetAlert2} instance
|
|
3229
|
+
*/
|
|
2943
3230
|
|
|
2944
3231
|
const disposeSwal = instance => {
|
|
2945
3232
|
disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569)
|
|
3233
|
+
// @ts-ignore
|
|
2946
3234
|
|
|
2947
3235
|
delete instance.params; // Unset globalState props so GC will dispose globalState (#1569)
|
|
2948
3236
|
|
|
@@ -2951,9 +3239,14 @@
|
|
|
2951
3239
|
|
|
2952
3240
|
delete globalState.currentInstance;
|
|
2953
3241
|
};
|
|
3242
|
+
/**
|
|
3243
|
+
* @param {SweetAlert2} instance
|
|
3244
|
+
*/
|
|
3245
|
+
|
|
2954
3246
|
|
|
2955
3247
|
const disposeWeakMaps = instance => {
|
|
2956
3248
|
// If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335
|
|
3249
|
+
// @ts-ignore
|
|
2957
3250
|
if (instance.isAwaitingPromise()) {
|
|
2958
3251
|
unsetWeakMaps(privateProps, instance);
|
|
2959
3252
|
privateProps.awaitingPromise.set(instance, true);
|
|
@@ -2962,6 +3255,11 @@
|
|
|
2962
3255
|
unsetWeakMaps(privateProps, instance);
|
|
2963
3256
|
}
|
|
2964
3257
|
};
|
|
3258
|
+
/**
|
|
3259
|
+
* @param {object} obj
|
|
3260
|
+
* @param {SweetAlert2} instance
|
|
3261
|
+
*/
|
|
3262
|
+
|
|
2965
3263
|
|
|
2966
3264
|
const unsetWeakMaps = (obj, instance) => {
|
|
2967
3265
|
for (const i in obj) {
|
|
@@ -3425,7 +3723,7 @@
|
|
|
3425
3723
|
}
|
|
3426
3724
|
}); // @ts-ignore
|
|
3427
3725
|
|
|
3428
|
-
const promise =
|
|
3726
|
+
const promise = currentInstance._main(currentInstance.params);
|
|
3429
3727
|
|
|
3430
3728
|
privateProps.promise.set(this, promise);
|
|
3431
3729
|
}
|
|
@@ -3435,6 +3733,7 @@
|
|
|
3435
3733
|
showWarningsForParams(Object.assign({}, mixinParams, userParams));
|
|
3436
3734
|
|
|
3437
3735
|
if (globalState.currentInstance) {
|
|
3736
|
+
// @ts-ignore
|
|
3438
3737
|
globalState.currentInstance._destroy();
|
|
3439
3738
|
|
|
3440
3739
|
if (isModal()) {
|
|
@@ -3442,7 +3741,7 @@
|
|
|
3442
3741
|
}
|
|
3443
3742
|
}
|
|
3444
3743
|
|
|
3445
|
-
globalState.currentInstance =
|
|
3744
|
+
globalState.currentInstance = currentInstance;
|
|
3446
3745
|
const innerParams = prepareParams(userParams, mixinParams);
|
|
3447
3746
|
setParameters(innerParams);
|
|
3448
3747
|
Object.freeze(innerParams); // clear the previous timer
|
|
@@ -3454,10 +3753,10 @@
|
|
|
3454
3753
|
|
|
3455
3754
|
|
|
3456
3755
|
clearTimeout(globalState.restoreFocusTimeout);
|
|
3457
|
-
const domCache = populateDomCache(
|
|
3458
|
-
render(
|
|
3459
|
-
privateProps.innerParams.set(
|
|
3460
|
-
return swalPromise(
|
|
3756
|
+
const domCache = populateDomCache(currentInstance);
|
|
3757
|
+
render(currentInstance, innerParams);
|
|
3758
|
+
privateProps.innerParams.set(currentInstance, innerParams);
|
|
3759
|
+
return swalPromise(currentInstance, domCache, innerParams);
|
|
3461
3760
|
} // `catch` cannot be the name of a module export, so we define our thenable methods here instead
|
|
3462
3761
|
|
|
3463
3762
|
|
|
@@ -3515,6 +3814,11 @@
|
|
|
3515
3814
|
params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);
|
|
3516
3815
|
return params;
|
|
3517
3816
|
};
|
|
3817
|
+
/**
|
|
3818
|
+
* @param {SweetAlert2} instance
|
|
3819
|
+
* @returns {DomCache}
|
|
3820
|
+
*/
|
|
3821
|
+
|
|
3518
3822
|
|
|
3519
3823
|
const populateDomCache = instance => {
|
|
3520
3824
|
const domCache = {
|
|
@@ -3532,6 +3836,12 @@
|
|
|
3532
3836
|
privateProps.domCache.set(instance, domCache);
|
|
3533
3837
|
return domCache;
|
|
3534
3838
|
};
|
|
3839
|
+
/**
|
|
3840
|
+
* @param {GlobalState} globalState
|
|
3841
|
+
* @param {SweetAlertOptions} innerParams
|
|
3842
|
+
* @param {function} dismissWith
|
|
3843
|
+
*/
|
|
3844
|
+
|
|
3535
3845
|
|
|
3536
3846
|
const setupTimer = (globalState$$1, innerParams, dismissWith) => {
|
|
3537
3847
|
const timerProgressBar = getTimerProgressBar();
|
|
@@ -3555,6 +3865,11 @@
|
|
|
3555
3865
|
}
|
|
3556
3866
|
}
|
|
3557
3867
|
};
|
|
3868
|
+
/**
|
|
3869
|
+
* @param {DomCache} domCache
|
|
3870
|
+
* @param {SweetAlertOptions} innerParams
|
|
3871
|
+
*/
|
|
3872
|
+
|
|
3558
3873
|
|
|
3559
3874
|
const initFocus = (domCache, innerParams) => {
|
|
3560
3875
|
if (innerParams.toast) {
|
|
@@ -3569,6 +3884,12 @@
|
|
|
3569
3884
|
setFocus(innerParams, -1, 1);
|
|
3570
3885
|
}
|
|
3571
3886
|
};
|
|
3887
|
+
/**
|
|
3888
|
+
* @param {DomCache} domCache
|
|
3889
|
+
* @param {SweetAlertOptions} innerParams
|
|
3890
|
+
* @returns {boolean}
|
|
3891
|
+
*/
|
|
3892
|
+
|
|
3572
3893
|
|
|
3573
3894
|
const focusButton = (domCache, innerParams) => {
|
|
3574
3895
|
if (innerParams.focusDeny && isVisible(domCache.denyButton)) {
|
|
@@ -3608,7 +3929,7 @@
|
|
|
3608
3929
|
};
|
|
3609
3930
|
});
|
|
3610
3931
|
SweetAlert.DismissReason = DismissReason;
|
|
3611
|
-
SweetAlert.version = '11.4.
|
|
3932
|
+
SweetAlert.version = '11.4.15';
|
|
3612
3933
|
|
|
3613
3934
|
const Swal = SweetAlert; // @ts-ignore
|
|
3614
3935
|
|