sweetalert2 11.12.2 → 11.12.4
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/README.md +0 -2
- package/dist/sweetalert2.all.js +114 -129
- package/dist/sweetalert2.all.min.js +2 -2
- package/dist/sweetalert2.js +114 -129
- package/dist/sweetalert2.min.js +2 -2
- package/package.json +2 -2
- package/src/SweetAlert.js +1 -1
- package/src/staticMethods/fire.js +1 -2
- package/src/staticMethods/showLoading.js +1 -1
- package/src/types.js +74 -0
- package/src/utils/classes.js +0 -71
- package/src/utils/dom/domUtils.js +29 -7
- package/src/utils/dom/renderers/renderInput.js +25 -7
- package/src/utils/dom/renderers/renderPopup.js +3 -1
- package/src/utils/getTemplateParams.js +32 -17
- package/sweetalert2.d.ts +3 -3
package/README.md
CHANGED
|
@@ -24,7 +24,6 @@ For all questions related to sponsorship please get in touch with me via email s
|
|
|
24
24
|
<tr>
|
|
25
25
|
<td align="center"><a href="https://roboflow.com/"><img src="https://sweetalert2.github.io/images/sponsors/roboflow.png" width="80"><br>Roboflow</a>
|
|
26
26
|
<td align="center"><a href="https://www.zezelife.com/"><img src="https://sweetalert2.github.io/images/sponsors/zezelife.png" width="80"><br>ZezeLife</a>
|
|
27
|
-
<td align="center"><a href="https://www.serpempire.com/"><img src="https://sweetalert2.github.io/images/sponsors/serpempire.png" width="80"><br>SERP Empire</a>
|
|
28
27
|
<td align="center"><a href="https://www.realspyapps.com/"><img src="https://sweetalert2.github.io/images/sponsors/realspyapps.jpeg" width="80"><br>Real Spy Apps</a>
|
|
29
28
|
</tr>
|
|
30
29
|
</table>
|
|
@@ -58,7 +57,6 @@ For all questions related to sponsorship please get in touch with me via email s
|
|
|
58
57
|
</table>
|
|
59
58
|
<table>
|
|
60
59
|
<tr>
|
|
61
|
-
<td align="center"><a href="https://www.bestblowjobmachines.com/"><img src="https://sweetalert2.github.io/images/sponsors/best-blowjob-machines.jpg" width="80"><br>Best Blowjob Machines</a></td>
|
|
62
60
|
<td align="center"><a href="https://nakedoll.com/"><img src="https://sweetalert2.github.io/images/sponsors/nakedoll.png" width="80"><br>NakeDoll</a></td>
|
|
63
61
|
<td align="center"><a href="https://www.onahole.com/"><img src="https://sweetalert2.github.io/images/sponsors/onahole.png" width="80"><br>hentai sex toys</a></td>
|
|
64
62
|
<td align="center"><a href="https://blowupdollshop.com/inflatable-sex-doll/"><img src="https://sweetalert2.github.io/images/sponsors/blowupdollshop.png" width="80"><br>Inflatable sex doll</a></td>
|
package/dist/sweetalert2.all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sweetalert2 v11.12.
|
|
2
|
+
* sweetalert2 v11.12.4
|
|
3
3
|
* Released under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
function _createForOfIteratorHelper(r, e) {
|
|
67
67
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
68
68
|
if (!t) {
|
|
69
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e
|
|
69
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
70
70
|
t && (r = t);
|
|
71
71
|
var n = 0,
|
|
72
72
|
F = function () {};
|
|
@@ -195,6 +195,12 @@
|
|
|
195
195
|
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););
|
|
196
196
|
return t;
|
|
197
197
|
}
|
|
198
|
+
function _superPropGet(t, e, r, o) {
|
|
199
|
+
var p = _get(_getPrototypeOf(t.prototype ), e, r);
|
|
200
|
+
return function (t) {
|
|
201
|
+
return p.apply(r, t);
|
|
202
|
+
} ;
|
|
203
|
+
}
|
|
198
204
|
function _toConsumableArray(r) {
|
|
199
205
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
200
206
|
}
|
|
@@ -202,7 +208,7 @@
|
|
|
202
208
|
if ("object" != typeof t || !t) return t;
|
|
203
209
|
var e = t[Symbol.toPrimitive];
|
|
204
210
|
if (void 0 !== e) {
|
|
205
|
-
var i = e.call(t, r
|
|
211
|
+
var i = e.call(t, r);
|
|
206
212
|
if ("object" != typeof i) return i;
|
|
207
213
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
208
214
|
}
|
|
@@ -267,77 +273,6 @@
|
|
|
267
273
|
var swalPrefix = 'swal2-';
|
|
268
274
|
|
|
269
275
|
/**
|
|
270
|
-
* @typedef
|
|
271
|
-
* { | 'container'
|
|
272
|
-
* | 'shown'
|
|
273
|
-
* | 'height-auto'
|
|
274
|
-
* | 'iosfix'
|
|
275
|
-
* | 'popup'
|
|
276
|
-
* | 'modal'
|
|
277
|
-
* | 'no-backdrop'
|
|
278
|
-
* | 'no-transition'
|
|
279
|
-
* | 'toast'
|
|
280
|
-
* | 'toast-shown'
|
|
281
|
-
* | 'show'
|
|
282
|
-
* | 'hide'
|
|
283
|
-
* | 'close'
|
|
284
|
-
* | 'title'
|
|
285
|
-
* | 'html-container'
|
|
286
|
-
* | 'actions'
|
|
287
|
-
* | 'confirm'
|
|
288
|
-
* | 'deny'
|
|
289
|
-
* | 'cancel'
|
|
290
|
-
* | 'default-outline'
|
|
291
|
-
* | 'footer'
|
|
292
|
-
* | 'icon'
|
|
293
|
-
* | 'icon-content'
|
|
294
|
-
* | 'image'
|
|
295
|
-
* | 'input'
|
|
296
|
-
* | 'file'
|
|
297
|
-
* | 'range'
|
|
298
|
-
* | 'select'
|
|
299
|
-
* | 'radio'
|
|
300
|
-
* | 'checkbox'
|
|
301
|
-
* | 'label'
|
|
302
|
-
* | 'textarea'
|
|
303
|
-
* | 'inputerror'
|
|
304
|
-
* | 'input-label'
|
|
305
|
-
* | 'validation-message'
|
|
306
|
-
* | 'progress-steps'
|
|
307
|
-
* | 'active-progress-step'
|
|
308
|
-
* | 'progress-step'
|
|
309
|
-
* | 'progress-step-line'
|
|
310
|
-
* | 'loader'
|
|
311
|
-
* | 'loading'
|
|
312
|
-
* | 'styled'
|
|
313
|
-
* | 'top'
|
|
314
|
-
* | 'top-start'
|
|
315
|
-
* | 'top-end'
|
|
316
|
-
* | 'top-left'
|
|
317
|
-
* | 'top-right'
|
|
318
|
-
* | 'center'
|
|
319
|
-
* | 'center-start'
|
|
320
|
-
* | 'center-end'
|
|
321
|
-
* | 'center-left'
|
|
322
|
-
* | 'center-right'
|
|
323
|
-
* | 'bottom'
|
|
324
|
-
* | 'bottom-start'
|
|
325
|
-
* | 'bottom-end'
|
|
326
|
-
* | 'bottom-left'
|
|
327
|
-
* | 'bottom-right'
|
|
328
|
-
* | 'grow-row'
|
|
329
|
-
* | 'grow-column'
|
|
330
|
-
* | 'grow-fullscreen'
|
|
331
|
-
* | 'rtl'
|
|
332
|
-
* | 'timer-progress-bar'
|
|
333
|
-
* | 'timer-progress-bar-container'
|
|
334
|
-
* | 'scrollbar-measure'
|
|
335
|
-
* | 'icon-success'
|
|
336
|
-
* | 'icon-warning'
|
|
337
|
-
* | 'icon-info'
|
|
338
|
-
* | 'icon-question'
|
|
339
|
-
* | 'icon-error'
|
|
340
|
-
* } SwalClass
|
|
341
276
|
* @typedef {Record<SwalClass, string>} SwalClasses
|
|
342
277
|
*/
|
|
343
278
|
|
|
@@ -678,17 +613,21 @@
|
|
|
678
613
|
var parser = new DOMParser();
|
|
679
614
|
var parsed = parser.parseFromString(html, "text/html");
|
|
680
615
|
var head = parsed.querySelector('head');
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
});
|
|
684
|
-
var body = parsed.querySelector('body');
|
|
685
|
-
body && Array.from(body.childNodes).forEach(function (child) {
|
|
686
|
-
if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {
|
|
687
|
-
elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507
|
|
688
|
-
} else {
|
|
616
|
+
if (head) {
|
|
617
|
+
Array.from(head.childNodes).forEach(function (child) {
|
|
689
618
|
elem.appendChild(child);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
var body = parsed.querySelector('body');
|
|
622
|
+
if (body) {
|
|
623
|
+
Array.from(body.childNodes).forEach(function (child) {
|
|
624
|
+
if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {
|
|
625
|
+
elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507
|
|
626
|
+
} else {
|
|
627
|
+
elem.appendChild(child);
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
}
|
|
692
631
|
}
|
|
693
632
|
};
|
|
694
633
|
|
|
@@ -798,10 +737,18 @@
|
|
|
798
737
|
classList.forEach(function (className) {
|
|
799
738
|
if (Array.isArray(target)) {
|
|
800
739
|
target.forEach(function (elem) {
|
|
801
|
-
|
|
740
|
+
if (condition) {
|
|
741
|
+
elem.classList.add(className);
|
|
742
|
+
} else {
|
|
743
|
+
elem.classList.remove(className);
|
|
744
|
+
}
|
|
802
745
|
});
|
|
803
746
|
} else {
|
|
804
|
-
|
|
747
|
+
if (condition) {
|
|
748
|
+
target.classList.add(className);
|
|
749
|
+
} else {
|
|
750
|
+
target.classList.remove(className);
|
|
751
|
+
}
|
|
805
752
|
}
|
|
806
753
|
});
|
|
807
754
|
};
|
|
@@ -861,14 +808,20 @@
|
|
|
861
808
|
*/
|
|
862
809
|
var show = function show(elem) {
|
|
863
810
|
var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';
|
|
864
|
-
|
|
811
|
+
if (!elem) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
elem.style.display = display;
|
|
865
815
|
};
|
|
866
816
|
|
|
867
817
|
/**
|
|
868
818
|
* @param {HTMLElement | null} elem
|
|
869
819
|
*/
|
|
870
820
|
var hide = function hide(elem) {
|
|
871
|
-
|
|
821
|
+
if (!elem) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
elem.style.display = 'none';
|
|
872
825
|
};
|
|
873
826
|
|
|
874
827
|
/**
|
|
@@ -909,7 +862,11 @@
|
|
|
909
862
|
*/
|
|
910
863
|
var toggle = function toggle(elem, condition) {
|
|
911
864
|
var display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex';
|
|
912
|
-
|
|
865
|
+
if (condition) {
|
|
866
|
+
show(elem, display);
|
|
867
|
+
} else {
|
|
868
|
+
hide(elem);
|
|
869
|
+
}
|
|
913
870
|
};
|
|
914
871
|
|
|
915
872
|
/**
|
|
@@ -1135,7 +1092,7 @@
|
|
|
1135
1092
|
var handleJqueryElem = function handleJqueryElem(target, elem) {
|
|
1136
1093
|
target.textContent = '';
|
|
1137
1094
|
if (0 in elem) {
|
|
1138
|
-
for (var i = 0;
|
|
1095
|
+
for (var i = 0; i in elem; i++) {
|
|
1139
1096
|
target.appendChild(elem[i].cloneNode(true));
|
|
1140
1097
|
}
|
|
1141
1098
|
} else {
|
|
@@ -1406,6 +1363,9 @@
|
|
|
1406
1363
|
return;
|
|
1407
1364
|
}
|
|
1408
1365
|
var inputContainer = getInputContainer(params.input);
|
|
1366
|
+
if (!inputContainer) {
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1409
1369
|
var input = renderInputType[params.input](inputContainer, params);
|
|
1410
1370
|
show(inputContainer);
|
|
1411
1371
|
|
|
@@ -1434,7 +1394,11 @@
|
|
|
1434
1394
|
* @param {SweetAlertOptions['inputAttributes']} inputAttributes
|
|
1435
1395
|
*/
|
|
1436
1396
|
var setAttributes = function setAttributes(inputClass, inputAttributes) {
|
|
1437
|
-
var
|
|
1397
|
+
var popup = getPopup();
|
|
1398
|
+
if (!popup) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
var input = getInput$1(popup, inputClass);
|
|
1438
1402
|
if (!input) {
|
|
1439
1403
|
return;
|
|
1440
1404
|
}
|
|
@@ -1448,9 +1412,12 @@
|
|
|
1448
1412
|
* @param {SweetAlertOptions} params
|
|
1449
1413
|
*/
|
|
1450
1414
|
var setCustomClass = function setCustomClass(params) {
|
|
1415
|
+
if (!params.input) {
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1451
1418
|
var inputContainer = getInputContainer(params.input);
|
|
1452
|
-
if (
|
|
1453
|
-
|
|
1419
|
+
if (inputContainer) {
|
|
1420
|
+
applyCustomClass(inputContainer, params, 'input');
|
|
1454
1421
|
}
|
|
1455
1422
|
};
|
|
1456
1423
|
|
|
@@ -1459,7 +1426,7 @@
|
|
|
1459
1426
|
* @param {SweetAlertOptions} params
|
|
1460
1427
|
*/
|
|
1461
1428
|
var setInputPlaceholder = function setInputPlaceholder(input, params) {
|
|
1462
|
-
if (!input.placeholder
|
|
1429
|
+
if (!input.placeholder && params.inputPlaceholder) {
|
|
1463
1430
|
input.placeholder = params.inputPlaceholder;
|
|
1464
1431
|
}
|
|
1465
1432
|
};
|
|
@@ -1484,11 +1451,15 @@
|
|
|
1484
1451
|
};
|
|
1485
1452
|
|
|
1486
1453
|
/**
|
|
1487
|
-
* @param {
|
|
1488
|
-
* @returns {HTMLElement}
|
|
1454
|
+
* @param {SweetAlertInput} inputType
|
|
1455
|
+
* @returns {HTMLElement | undefined}
|
|
1489
1456
|
*/
|
|
1490
1457
|
var getInputContainer = function getInputContainer(inputType) {
|
|
1491
|
-
|
|
1458
|
+
var popup = getPopup();
|
|
1459
|
+
if (!popup) {
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
return getDirectChildByClass(popup, swalClasses[( /** @type {SwalClass} */inputType)] || swalClasses.input);
|
|
1492
1463
|
};
|
|
1493
1464
|
|
|
1494
1465
|
/**
|
|
@@ -1511,7 +1482,8 @@
|
|
|
1511
1482
|
* @param {SweetAlertOptions} params
|
|
1512
1483
|
* @returns {HTMLInputElement}
|
|
1513
1484
|
*/
|
|
1514
|
-
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month =
|
|
1485
|
+
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = /** @type {(input: Input | HTMLElement, params: SweetAlertOptions) => Input} */
|
|
1486
|
+
function (input, params) {
|
|
1515
1487
|
checkAndSetInputValue(input, params.inputValue);
|
|
1516
1488
|
setInputLabel(input, input, params);
|
|
1517
1489
|
setInputPlaceholder(input, params);
|
|
@@ -1859,7 +1831,9 @@
|
|
|
1859
1831
|
applyNumericalStyle(container, 'width', params.width);
|
|
1860
1832
|
popup.style.width = '100%';
|
|
1861
1833
|
var loader = getLoader();
|
|
1862
|
-
|
|
1834
|
+
if (loader) {
|
|
1835
|
+
popup.insertBefore(loader, getIcon());
|
|
1836
|
+
}
|
|
1863
1837
|
} else {
|
|
1864
1838
|
applyNumericalStyle(popup, 'width', params.width);
|
|
1865
1839
|
}
|
|
@@ -2624,7 +2598,7 @@
|
|
|
2624
2598
|
var showLoading = function showLoading(buttonToReplace) {
|
|
2625
2599
|
var popup = getPopup();
|
|
2626
2600
|
if (!popup) {
|
|
2627
|
-
new Swal();
|
|
2601
|
+
new Swal();
|
|
2628
2602
|
}
|
|
2629
2603
|
popup = getPopup();
|
|
2630
2604
|
if (!popup) {
|
|
@@ -2739,9 +2713,9 @@
|
|
|
2739
2713
|
*/
|
|
2740
2714
|
var processInputOptions = function processInputOptions(inputOptions) {
|
|
2741
2715
|
if (params.input === 'select') {
|
|
2742
|
-
populateSelectOptions(popup,
|
|
2716
|
+
populateSelectOptions(popup, _formatInputOptions(inputOptions), params);
|
|
2743
2717
|
} else if (params.input === 'radio') {
|
|
2744
|
-
populateRadioOptions(popup,
|
|
2718
|
+
populateRadioOptions(popup, _formatInputOptions(inputOptions), params);
|
|
2745
2719
|
}
|
|
2746
2720
|
};
|
|
2747
2721
|
if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {
|
|
@@ -2868,7 +2842,7 @@
|
|
|
2868
2842
|
* @typedef {string[]} InputOptionFlattened
|
|
2869
2843
|
* @returns {InputOptionFlattened[]}
|
|
2870
2844
|
*/
|
|
2871
|
-
var
|
|
2845
|
+
var _formatInputOptions = function formatInputOptions(inputOptions) {
|
|
2872
2846
|
/** @type {InputOptionFlattened[]} */
|
|
2873
2847
|
var result = [];
|
|
2874
2848
|
if (inputOptions instanceof Map) {
|
|
@@ -2876,7 +2850,7 @@
|
|
|
2876
2850
|
var valueFormatted = value;
|
|
2877
2851
|
if (_typeof(valueFormatted) === 'object') {
|
|
2878
2852
|
// case of <optgroup>
|
|
2879
|
-
valueFormatted =
|
|
2853
|
+
valueFormatted = _formatInputOptions(valueFormatted);
|
|
2880
2854
|
}
|
|
2881
2855
|
result.push([key, valueFormatted]);
|
|
2882
2856
|
});
|
|
@@ -2885,7 +2859,7 @@
|
|
|
2885
2859
|
var valueFormatted = inputOptions[key];
|
|
2886
2860
|
if (_typeof(valueFormatted) === 'object') {
|
|
2887
2861
|
// case of <optgroup>
|
|
2888
|
-
valueFormatted =
|
|
2862
|
+
valueFormatted = _formatInputOptions(valueFormatted);
|
|
2889
2863
|
}
|
|
2890
2864
|
result.push([key, valueFormatted]);
|
|
2891
2865
|
});
|
|
@@ -3667,11 +3641,10 @@
|
|
|
3667
3641
|
* @returns {Promise<SweetAlertResult>}
|
|
3668
3642
|
*/
|
|
3669
3643
|
function fire() {
|
|
3670
|
-
var Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias
|
|
3671
3644
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3672
3645
|
args[_key] = arguments[_key];
|
|
3673
3646
|
}
|
|
3674
|
-
return _construct(
|
|
3647
|
+
return _construct(this, args);
|
|
3675
3648
|
}
|
|
3676
3649
|
|
|
3677
3650
|
/**
|
|
@@ -3703,7 +3676,7 @@
|
|
|
3703
3676
|
return _createClass(MixinSwal, [{
|
|
3704
3677
|
key: "_main",
|
|
3705
3678
|
value: function _main(params, priorityMixinParams) {
|
|
3706
|
-
return
|
|
3679
|
+
return _superPropGet(MixinSwal, "_main", this)([params, Object.assign({}, mixinParams, priorityMixinParams)]);
|
|
3707
3680
|
}
|
|
3708
3681
|
}]);
|
|
3709
3682
|
}(this); // @ts-ignore
|
|
@@ -3945,8 +3918,7 @@
|
|
|
3945
3918
|
* @returns {SweetAlertOptions}
|
|
3946
3919
|
*/
|
|
3947
3920
|
var getTemplateParams = function getTemplateParams(params) {
|
|
3948
|
-
/** @type {HTMLTemplateElement} */
|
|
3949
|
-
var template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template;
|
|
3921
|
+
var template = typeof params.template === 'string' ? ( /** @type {HTMLTemplateElement} */document.querySelector(params.template)) : params.template;
|
|
3950
3922
|
if (!template) {
|
|
3951
3923
|
return {};
|
|
3952
3924
|
}
|
|
@@ -3959,16 +3931,20 @@
|
|
|
3959
3931
|
|
|
3960
3932
|
/**
|
|
3961
3933
|
* @param {DocumentFragment} templateContent
|
|
3962
|
-
* @returns {
|
|
3934
|
+
* @returns {Record<string, any>}
|
|
3963
3935
|
*/
|
|
3964
3936
|
var getSwalParams = function getSwalParams(templateContent) {
|
|
3937
|
+
/** @type {Record<string, any>} */
|
|
3965
3938
|
var result = {};
|
|
3966
3939
|
/** @type {HTMLElement[]} */
|
|
3967
3940
|
var swalParams = Array.from(templateContent.querySelectorAll('swal-param'));
|
|
3968
3941
|
swalParams.forEach(function (param) {
|
|
3969
3942
|
showWarningsForAttributes(param, ['name', 'value']);
|
|
3970
|
-
var paramName = param.getAttribute('name');
|
|
3943
|
+
var paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
|
|
3971
3944
|
var value = param.getAttribute('value');
|
|
3945
|
+
if (!paramName || !value) {
|
|
3946
|
+
return;
|
|
3947
|
+
}
|
|
3972
3948
|
if (typeof defaultParams[paramName] === 'boolean') {
|
|
3973
3949
|
result[paramName] = value !== 'false';
|
|
3974
3950
|
} else if (_typeof(defaultParams[paramName]) === 'object') {
|
|
@@ -3982,15 +3958,19 @@
|
|
|
3982
3958
|
|
|
3983
3959
|
/**
|
|
3984
3960
|
* @param {DocumentFragment} templateContent
|
|
3985
|
-
* @returns {
|
|
3961
|
+
* @returns {Record<string, any>}
|
|
3986
3962
|
*/
|
|
3987
3963
|
var getSwalFunctionParams = function getSwalFunctionParams(templateContent) {
|
|
3964
|
+
/** @type {Record<string, any>} */
|
|
3988
3965
|
var result = {};
|
|
3989
3966
|
/** @type {HTMLElement[]} */
|
|
3990
3967
|
var swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param'));
|
|
3991
3968
|
swalFunctions.forEach(function (param) {
|
|
3992
|
-
var paramName = param.getAttribute('name');
|
|
3969
|
+
var paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
|
|
3993
3970
|
var value = param.getAttribute('value');
|
|
3971
|
+
if (!paramName || !value) {
|
|
3972
|
+
return;
|
|
3973
|
+
}
|
|
3994
3974
|
result[paramName] = new Function("return ".concat(value))();
|
|
3995
3975
|
});
|
|
3996
3976
|
return result;
|
|
@@ -3998,15 +3978,19 @@
|
|
|
3998
3978
|
|
|
3999
3979
|
/**
|
|
4000
3980
|
* @param {DocumentFragment} templateContent
|
|
4001
|
-
* @returns {
|
|
3981
|
+
* @returns {Record<string, any>}
|
|
4002
3982
|
*/
|
|
4003
3983
|
var getSwalButtons = function getSwalButtons(templateContent) {
|
|
3984
|
+
/** @type {Record<string, any>} */
|
|
4004
3985
|
var result = {};
|
|
4005
3986
|
/** @type {HTMLElement[]} */
|
|
4006
3987
|
var swalButtons = Array.from(templateContent.querySelectorAll('swal-button'));
|
|
4007
3988
|
swalButtons.forEach(function (button) {
|
|
4008
3989
|
showWarningsForAttributes(button, ['type', 'color', 'aria-label']);
|
|
4009
3990
|
var type = button.getAttribute('type');
|
|
3991
|
+
if (!type || !['confirm', 'cancel', 'deny'].includes(type)) {
|
|
3992
|
+
return;
|
|
3993
|
+
}
|
|
4010
3994
|
result["".concat(type, "ButtonText")] = button.innerHTML;
|
|
4011
3995
|
result["show".concat(capitalizeFirstLetter(type), "Button")] = true;
|
|
4012
3996
|
if (button.hasAttribute('color')) {
|
|
@@ -4047,17 +4031,15 @@
|
|
|
4047
4031
|
|
|
4048
4032
|
/**
|
|
4049
4033
|
* @param {DocumentFragment} templateContent
|
|
4050
|
-
* @returns {
|
|
4034
|
+
* @returns {Record<string, any>}
|
|
4051
4035
|
*/
|
|
4052
4036
|
var getSwalIcon = function getSwalIcon(templateContent) {
|
|
4053
4037
|
var result = {};
|
|
4054
|
-
/** @type {HTMLElement} */
|
|
4038
|
+
/** @type {HTMLElement | null} */
|
|
4055
4039
|
var icon = templateContent.querySelector('swal-icon');
|
|
4056
4040
|
if (icon) {
|
|
4057
4041
|
showWarningsForAttributes(icon, ['type', 'color']);
|
|
4058
4042
|
if (icon.hasAttribute('type')) {
|
|
4059
|
-
/** @type {SweetAlertIcon} */
|
|
4060
|
-
// @ts-ignore
|
|
4061
4043
|
result.icon = icon.getAttribute('type');
|
|
4062
4044
|
}
|
|
4063
4045
|
if (icon.hasAttribute('color')) {
|
|
@@ -4070,16 +4052,15 @@
|
|
|
4070
4052
|
|
|
4071
4053
|
/**
|
|
4072
4054
|
* @param {DocumentFragment} templateContent
|
|
4073
|
-
* @returns {
|
|
4055
|
+
* @returns {Record<string, any>}
|
|
4074
4056
|
*/
|
|
4075
4057
|
var getSwalInput = function getSwalInput(templateContent) {
|
|
4058
|
+
/** @type {Record<string, any>} */
|
|
4076
4059
|
var result = {};
|
|
4077
|
-
/** @type {HTMLElement} */
|
|
4060
|
+
/** @type {HTMLElement | null} */
|
|
4078
4061
|
var input = templateContent.querySelector('swal-input');
|
|
4079
4062
|
if (input) {
|
|
4080
4063
|
showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);
|
|
4081
|
-
/** @type {SweetAlertInput} */
|
|
4082
|
-
// @ts-ignore
|
|
4083
4064
|
result.input = input.getAttribute('type') || 'text';
|
|
4084
4065
|
if (input.hasAttribute('label')) {
|
|
4085
4066
|
result.inputLabel = input.getAttribute('label');
|
|
@@ -4098,6 +4079,9 @@
|
|
|
4098
4079
|
inputOptions.forEach(function (option) {
|
|
4099
4080
|
showWarningsForAttributes(option, ['value']);
|
|
4100
4081
|
var optionValue = option.getAttribute('value');
|
|
4082
|
+
if (!optionValue) {
|
|
4083
|
+
return;
|
|
4084
|
+
}
|
|
4101
4085
|
var optionName = option.innerHTML;
|
|
4102
4086
|
result.inputOptions[optionValue] = optionName;
|
|
4103
4087
|
});
|
|
@@ -4108,13 +4092,14 @@
|
|
|
4108
4092
|
/**
|
|
4109
4093
|
* @param {DocumentFragment} templateContent
|
|
4110
4094
|
* @param {string[]} paramNames
|
|
4111
|
-
* @returns {
|
|
4095
|
+
* @returns {Record<string, any>}
|
|
4112
4096
|
*/
|
|
4113
4097
|
var getSwalStringParams = function getSwalStringParams(templateContent, paramNames) {
|
|
4098
|
+
/** @type {Record<string, any>} */
|
|
4114
4099
|
var result = {};
|
|
4115
4100
|
for (var i in paramNames) {
|
|
4116
4101
|
var paramName = paramNames[i];
|
|
4117
|
-
/** @type {HTMLElement} */
|
|
4102
|
+
/** @type {HTMLElement | null} */
|
|
4118
4103
|
var tag = templateContent.querySelector(paramName);
|
|
4119
4104
|
if (tag) {
|
|
4120
4105
|
showWarningsForAttributes(tag, []);
|
|
@@ -4188,13 +4173,13 @@
|
|
|
4188
4173
|
/**
|
|
4189
4174
|
* @param {AnimationEvent} event
|
|
4190
4175
|
*/
|
|
4191
|
-
var
|
|
4176
|
+
var _swalOpenAnimationFinished = function swalOpenAnimationFinished(event) {
|
|
4192
4177
|
var popup = getPopup();
|
|
4193
4178
|
if (event.target !== popup || !animationEndEvent) {
|
|
4194
4179
|
return;
|
|
4195
4180
|
}
|
|
4196
4181
|
var container = getContainer();
|
|
4197
|
-
popup.removeEventListener(animationEndEvent,
|
|
4182
|
+
popup.removeEventListener(animationEndEvent, _swalOpenAnimationFinished);
|
|
4198
4183
|
container.style.overflowY = 'auto';
|
|
4199
4184
|
};
|
|
4200
4185
|
|
|
@@ -4205,7 +4190,7 @@
|
|
|
4205
4190
|
var setScrollingVisibility = function setScrollingVisibility(container, popup) {
|
|
4206
4191
|
if (animationEndEvent && hasCssAnimation(popup)) {
|
|
4207
4192
|
container.style.overflowY = 'hidden';
|
|
4208
|
-
popup.addEventListener(animationEndEvent,
|
|
4193
|
+
popup.addEventListener(animationEndEvent, _swalOpenAnimationFinished);
|
|
4209
4194
|
} else {
|
|
4210
4195
|
container.style.overflowY = 'auto';
|
|
4211
4196
|
}
|
|
@@ -4658,7 +4643,7 @@
|
|
|
4658
4643
|
};
|
|
4659
4644
|
});
|
|
4660
4645
|
SweetAlert.DismissReason = DismissReason;
|
|
4661
|
-
SweetAlert.version = '11.12.
|
|
4646
|
+
SweetAlert.version = '11.12.4';
|
|
4662
4647
|
|
|
4663
4648
|
var Swal = SweetAlert;
|
|
4664
4649
|
// @ts-ignore
|