sweetalert2 11.4.11 → 11.4.14
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 +10 -10
- package/dist/sweetalert2.all.js +200 -59
- package/dist/sweetalert2.all.min.js +1 -1
- package/dist/sweetalert2.js +200 -59
- package/dist/sweetalert2.min.js +1 -1
- package/package.json +4 -4
- package/src/SweetAlert.js +1 -1
- package/src/scss/_animations.scss +13 -13
- package/src/scss/_toasts-animations.scss +16 -16
- package/src/scss/_toasts.scss +24 -23
- package/src/utils/dom/domUtils.js +9 -9
- package/src/utils/dom/renderers/renderIcon.js +24 -0
- package/src/utils/dom/renderers/renderImage.js +9 -0
- package/src/utils/dom/renderers/renderInput.js +94 -32
- package/src/utils/dom/renderers/renderPopup.js +13 -0
- package/src/utils/dom/renderers/renderProgressSteps.js +32 -15
- package/src/variables.scss +46 -50
- package/sweetalert2.d.ts +1 -0
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ Sponsors
|
|
|
19
19
|
|
|
20
20
|
For all questions related to sponsorship please contact me via email limon.monte@protonmail.com
|
|
21
21
|
|
|
22
|
-
[<img src="https://sweetalert2.github.io/images/plus.png" width="80">](SPONSORS.md#sponsors) | [<img src="https://sweetalert2.github.io/images/sponsors/bestforandroid.png" width="80">](https://bestforandroid.com/) | [<img src="https://avatars2.githubusercontent.com/u/28631236?s=80&v=4" width="80">](https://flowcrypt.com/?utm_source=sweetalert2&utm_medium=logo) | [<img src="https://sweetalert2.github.io/images/sponsors/mybitcoinslots.png" width="80">](https://www.mybitcoinslots.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
23
|
-
|
|
24
|
-
[Become a sponsor](SPONSORS.md#sponsors) | [Best For Android](https://bestforandroid.com/) | [FlowCrypt](https://flowcrypt.com/?utm_source=sweetalert2&utm_medium=logo) | [My Bitcoin slots](https://www.mybitcoinslots.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
22
|
+
[<img src="https://sweetalert2.github.io/images/plus.png" width="80">](SPONSORS.md#sponsors) | [<img src="https://sweetalert2.github.io/images/sponsors/evguru.png" width="80">](https://www.evguru.com.my/) | [<img src="https://sweetalert2.github.io/images/sponsors/bestforandroid.png" width="80">](https://bestforandroid.com/) | [<img src="https://avatars2.githubusercontent.com/u/28631236?s=80&v=4" width="80">](https://flowcrypt.com/?utm_source=sweetalert2&utm_medium=logo) | [<img src="https://sweetalert2.github.io/images/sponsors/mybitcoinslots.png" width="80">](https://www.mybitcoinslots.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
23
|
+
-|-|-|-|-
|
|
24
|
+
[Become a sponsor](SPONSORS.md#sponsors) | [EvGuru EV Chargers](https://www.evguru.com.my/) | [Best For Android](https://bestforandroid.com/) | [FlowCrypt](https://flowcrypt.com/?utm_source=sweetalert2&utm_medium=logo) | [My Bitcoin slots](https://www.mybitcoinslots.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
25
25
|
|
|
26
26
|
[<img src="https://sweetalert2.github.io/images/sponsors/vegega.jpeg" width="80">](https://www.vegega.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/phatoil.png" width="80">](https://phatoil.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/celltrackingapps.png" width="80">](https://celltrackingapps.com/)
|
|
27
27
|
-|-|-
|
|
@@ -34,21 +34,21 @@ For all questions related to sponsorship please contact me via email limon.monte
|
|
|
34
34
|
NSFW Sponsors
|
|
35
35
|
-------------
|
|
36
36
|
|
|
37
|
-
[<img src="https://sweetalert2.github.io/images/plus.png" width="80">](SPONSORS.md#sponsors) | [<img src="https://sweetalert2.github.io/images/sponsors/
|
|
37
|
+
[<img src="https://sweetalert2.github.io/images/plus.png" width="80">](SPONSORS.md#sponsors) | [<img src="https://sweetalert2.github.io/images/sponsors/sexysexdoll.png" width="80">](https://www.sexysexdoll.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/dollnight.jpeg" width="80">](https://www.dollnight.com/cheap-sex-doll) | [<img src="https://sweetalert2.github.io/images/sponsors/sexvibrator.png" width="80">](https://www.sexvibrators.in/) | [<img src="https://sweetalert2.github.io/images/sponsors/viva-awa.png" width="80">](https://www.viva-awa.com/)
|
|
38
38
|
-|-|-|-|-
|
|
39
|
-
[Become a NSFW sponsor](SPONSORS.md#sponsors) | [Cheap Sex Doll](https://www.dollnight.com/cheap-sex-doll)
|
|
39
|
+
[Become a NSFW sponsor](SPONSORS.md#sponsors) | [Sexy Sex Doll](https://www.sexysexdoll.com/) | [Cheap Sex Doll](https://www.dollnight.com/cheap-sex-doll) | [Sex Vibrators](https://www.sexvibrators.in/) | [Viva Awa](https://www.viva-awa.com/)
|
|
40
40
|
|
|
41
|
-
[<img src="https://sweetalert2.github.io/images/sponsors/bestrealdoll.jpeg" width="80">](https://www.bestrealdoll.com/collections/us-warehouse) | [<img src="https://sweetalert2.github.io/images/sponsors/sexdolltech.jpeg" width="80">](https://www.sexdolltech.com/product-category/us-warehouse/) | [<img src="https://sweetalert2.github.io/images/sponsors/rosewives.png" width="80">](https://rosewives.com/)
|
|
42
|
-
|
|
43
|
-
[BestRealDoll](https://www.bestrealdoll.com/collections/us-warehouse) | [SexDollTech](https://www.sexdolltech.com/product-category/us-warehouse/) | [Rose Wives](https://rosewives.com/)
|
|
41
|
+
[<img src="https://sweetalert2.github.io/images/sponsors/sensualdolls.png" width="80">](https://www.sensualdolls.com) | [<img src="https://sweetalert2.github.io/images/sponsors/bestrealdoll.jpeg" width="80">](https://www.bestrealdoll.com/collections/us-warehouse) | [<img src="https://sweetalert2.github.io/images/sponsors/sexdolltech.jpeg" width="80">](https://www.sexdolltech.com/product-category/us-warehouse/) | [<img src="https://sweetalert2.github.io/images/sponsors/rosewives.png" width="80">](https://rosewives.com/)
|
|
42
|
+
-|-|-|-
|
|
43
|
+
[Sensual Dolls](https://www.sensualdolls.com) | [BestRealDoll](https://www.bestrealdoll.com/collections/us-warehouse) | [SexDollTech](https://www.sexdolltech.com/product-category/us-warehouse/) | [Rose Wives](https://rosewives.com/)
|
|
44
44
|
|
|
45
45
|
[<img src="https://sweetalert2.github.io/images/sponsors/hydoll.png" width="80">](https://www.hydoll.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/sexdollsoff.png" width="80">](https://www.sexdollsoff.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/realsexdoll.png" width="80">](https://realsexdoll.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/yourdoll.jpg" width="80">](https://www.yourdoll.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/annies-dollhouse.png" width="80">](https://anniesdollhouse.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/sexdollcenter.png" width="80">](https://sexdollcenter.vip/) |
|
|
46
46
|
-|-|-|-|-|-
|
|
47
47
|
[hydoll](https://www.hydoll.com/) | [SexDollsOff](https://www.sexdollsoff.com/) | [RealSexDoll](https://realsexdoll.com/) | [Your Doll](https://www.yourdoll.com/) | [Annie's Dollhouse](https://anniesdollhouse.com/) | [Sex Doll Center](https://sexdollcenter.vip/)
|
|
48
48
|
|
|
49
|
-
[<img src="https://sweetalert2.github.io/images/sponsors/vsdoll.png" width="80">](https://vsdoll.com/
|
|
49
|
+
[<img src="https://sweetalert2.github.io/images/sponsors/vsdoll.png" width="80">](https://vsdoll.com/homepage/) | [<img src="https://sweetalert2.github.io/images/sponsors/sexangelbaby.png" width="80">](https://sexangelbaby.com/) | [<img src="https://sweetalert2.github.io/images/sponsors/theadulttoyfinder.png" width="80">](https://theadulttoyfinder.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
50
50
|
-|-|-
|
|
51
|
-
[VSDoll](https://vsdoll.com/
|
|
51
|
+
[VSDoll](https://vsdoll.com/homepage/) | [SexAngelbaby](https://sexangelbaby.com/) | [The Adult Toy Finder](https://theadulttoyfinder.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
52
52
|
|
|
53
53
|
[<img src="https://sweetalert2.github.io/images/sponsors/my-sex-toy-guide.jpg" width="80">](https://www.mysextoyguide.com/?utm_source=sweetalert2&utm_medium=logo) | [<img src="https://sweetalert2.github.io/images/sponsors/best-blowjob-machines.jpg" width="80">](https://www.bestblowjobmachines.com/?utm_source=sweetalert2&utm_medium=logo) | [<img src="https://sweetalert2.github.io/images/sponsors/sextoycollective.jpg" width="80">](https://sextoycollective.com/?utm_source=sweetalert2&utm_medium=logo) | [<img src="https://sweetalert2.github.io/images/sponsors/doctorclimax.png" width="80">](https://doctorclimax.com/)
|
|
54
54
|
-|-|-|-
|
package/dist/sweetalert2.all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sweetalert2 v11.4.
|
|
2
|
+
* sweetalert2 v11.4.14
|
|
3
3
|
* Released under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -390,20 +390,20 @@
|
|
|
390
390
|
};
|
|
391
391
|
/**
|
|
392
392
|
* @param {HTMLElement} popup
|
|
393
|
-
* @param {
|
|
393
|
+
* @param {import('./renderers/renderInput').InputClass} inputClass
|
|
394
394
|
* @returns {HTMLInputElement | null}
|
|
395
395
|
*/
|
|
396
396
|
|
|
397
|
-
const getInput = (popup,
|
|
398
|
-
if (!
|
|
397
|
+
const getInput = (popup, inputClass) => {
|
|
398
|
+
if (!inputClass) {
|
|
399
399
|
return null;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
switch (
|
|
402
|
+
switch (inputClass) {
|
|
403
403
|
case 'select':
|
|
404
404
|
case 'textarea':
|
|
405
405
|
case 'file':
|
|
406
|
-
return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses[
|
|
406
|
+
return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses[inputClass]));
|
|
407
407
|
|
|
408
408
|
case 'checkbox':
|
|
409
409
|
return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.checkbox, " input"));
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
/**
|
|
422
|
-
* @param {HTMLInputElement} input
|
|
422
|
+
* @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input
|
|
423
423
|
*/
|
|
424
424
|
|
|
425
425
|
const focusInput = input => {
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
};
|
|
435
435
|
/**
|
|
436
436
|
* @param {HTMLElement | HTMLElement[] | null} target
|
|
437
|
-
* @param {string | string[]} classList
|
|
437
|
+
* @param {string | string[] | readonly string[]} classList
|
|
438
438
|
* @param {boolean} condition
|
|
439
439
|
*/
|
|
440
440
|
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
};
|
|
460
460
|
/**
|
|
461
461
|
* @param {HTMLElement | HTMLElement[] | null} target
|
|
462
|
-
* @param {string | string[]} classList
|
|
462
|
+
* @param {string | string[] | readonly string[]} classList
|
|
463
463
|
*/
|
|
464
464
|
|
|
465
465
|
const addClass = (target, classList) => {
|
|
@@ -467,7 +467,7 @@
|
|
|
467
467
|
};
|
|
468
468
|
/**
|
|
469
469
|
* @param {HTMLElement | HTMLElement[] | null} target
|
|
470
|
-
* @param {string | string[]} classList
|
|
470
|
+
* @param {string | string[] | readonly string[]} classList
|
|
471
471
|
*/
|
|
472
472
|
|
|
473
473
|
const removeClass = (target, classList) => {
|
|
@@ -955,22 +955,24 @@
|
|
|
955
955
|
};
|
|
956
956
|
|
|
957
957
|
/// <reference path="../../../../sweetalert2.d.ts"/>
|
|
958
|
-
|
|
958
|
+
/** @type {InputClass[]} */
|
|
959
|
+
|
|
960
|
+
const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
|
|
959
961
|
/**
|
|
960
|
-
* @
|
|
962
|
+
* @param {SweetAlert2} instance
|
|
963
|
+
* @param {SweetAlertOptions} params
|
|
961
964
|
*/
|
|
962
965
|
|
|
963
966
|
const renderInput = (instance, params) => {
|
|
964
967
|
const popup = getPopup();
|
|
965
968
|
const innerParams = privateProps.innerParams.get(instance);
|
|
966
969
|
const rerender = !innerParams || params.input !== innerParams.input;
|
|
967
|
-
|
|
968
|
-
const
|
|
969
|
-
const inputContainer = getDirectChildByClass(popup, inputClass); // set attributes
|
|
970
|
+
inputClasses.forEach(inputClass => {
|
|
971
|
+
const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); // set attributes
|
|
970
972
|
|
|
971
|
-
setAttributes(
|
|
973
|
+
setAttributes(inputClass, params.inputAttributes); // set class
|
|
972
974
|
|
|
973
|
-
inputContainer.className = inputClass;
|
|
975
|
+
inputContainer.className = swalClasses[inputClass];
|
|
974
976
|
|
|
975
977
|
if (rerender) {
|
|
976
978
|
hide(inputContainer);
|
|
@@ -986,6 +988,9 @@
|
|
|
986
988
|
setCustomClass(params);
|
|
987
989
|
}
|
|
988
990
|
};
|
|
991
|
+
/**
|
|
992
|
+
* @param {SweetAlertOptions} params
|
|
993
|
+
*/
|
|
989
994
|
|
|
990
995
|
const showInput = params => {
|
|
991
996
|
if (!renderInputType[params.input]) {
|
|
@@ -994,12 +999,16 @@
|
|
|
994
999
|
|
|
995
1000
|
const inputContainer = getInputContainer(params.input);
|
|
996
1001
|
const input = renderInputType[params.input](inputContainer, params);
|
|
997
|
-
show(
|
|
1002
|
+
show(inputContainer); // input autofocus
|
|
998
1003
|
|
|
999
1004
|
setTimeout(() => {
|
|
1000
1005
|
focusInput(input);
|
|
1001
1006
|
});
|
|
1002
1007
|
};
|
|
1008
|
+
/**
|
|
1009
|
+
* @param {HTMLInputElement} input
|
|
1010
|
+
*/
|
|
1011
|
+
|
|
1003
1012
|
|
|
1004
1013
|
const removeAttributes = input => {
|
|
1005
1014
|
for (let i = 0; i < input.attributes.length; i++) {
|
|
@@ -1010,9 +1019,14 @@
|
|
|
1010
1019
|
}
|
|
1011
1020
|
}
|
|
1012
1021
|
};
|
|
1022
|
+
/**
|
|
1023
|
+
* @param {InputClass} inputClass
|
|
1024
|
+
* @param {SweetAlertOptions['inputAttributes']} inputAttributes
|
|
1025
|
+
*/
|
|
1013
1026
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1027
|
+
|
|
1028
|
+
const setAttributes = (inputClass, inputAttributes) => {
|
|
1029
|
+
const input = getInput(getPopup(), inputClass);
|
|
1016
1030
|
|
|
1017
1031
|
if (!input) {
|
|
1018
1032
|
return;
|
|
@@ -1024,20 +1038,35 @@
|
|
|
1024
1038
|
input.setAttribute(attr, inputAttributes[attr]);
|
|
1025
1039
|
}
|
|
1026
1040
|
};
|
|
1041
|
+
/**
|
|
1042
|
+
* @param {SweetAlertOptions} params
|
|
1043
|
+
*/
|
|
1044
|
+
|
|
1027
1045
|
|
|
1028
1046
|
const setCustomClass = params => {
|
|
1029
1047
|
const inputContainer = getInputContainer(params.input);
|
|
1030
1048
|
|
|
1031
|
-
if (params.customClass) {
|
|
1049
|
+
if (typeof params.customClass === 'object') {
|
|
1032
1050
|
addClass(inputContainer, params.customClass.input);
|
|
1033
1051
|
}
|
|
1034
1052
|
};
|
|
1053
|
+
/**
|
|
1054
|
+
* @param {HTMLInputElement | HTMLTextAreaElement} input
|
|
1055
|
+
* @param {SweetAlertOptions} params
|
|
1056
|
+
*/
|
|
1057
|
+
|
|
1035
1058
|
|
|
1036
1059
|
const setInputPlaceholder = (input, params) => {
|
|
1037
1060
|
if (!input.placeholder || params.inputPlaceholder) {
|
|
1038
1061
|
input.placeholder = params.inputPlaceholder;
|
|
1039
1062
|
}
|
|
1040
1063
|
};
|
|
1064
|
+
/**
|
|
1065
|
+
* @param {Input} input
|
|
1066
|
+
* @param {Input} prependTo
|
|
1067
|
+
* @param {SweetAlertOptions} params
|
|
1068
|
+
*/
|
|
1069
|
+
|
|
1041
1070
|
|
|
1042
1071
|
const setInputLabel = (input, prependTo, params) => {
|
|
1043
1072
|
if (params.inputLabel) {
|
|
@@ -1046,60 +1075,88 @@
|
|
|
1046
1075
|
const labelClass = swalClasses['input-label'];
|
|
1047
1076
|
label.setAttribute('for', input.id);
|
|
1048
1077
|
label.className = labelClass;
|
|
1049
|
-
|
|
1078
|
+
|
|
1079
|
+
if (typeof params.customClass === 'object') {
|
|
1080
|
+
addClass(label, params.customClass.inputLabel);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1050
1083
|
label.innerText = params.inputLabel;
|
|
1051
1084
|
prependTo.insertAdjacentElement('beforebegin', label);
|
|
1052
1085
|
}
|
|
1053
1086
|
};
|
|
1087
|
+
/**
|
|
1088
|
+
* @param {SweetAlertOptions['input']} inputType
|
|
1089
|
+
* @returns {HTMLElement}
|
|
1090
|
+
*/
|
|
1091
|
+
|
|
1054
1092
|
|
|
1055
1093
|
const getInputContainer = inputType => {
|
|
1056
|
-
|
|
1057
|
-
return getDirectChildByClass(getPopup(), inputClass);
|
|
1094
|
+
return getDirectChildByClass(getPopup(), swalClasses[inputType] || swalClasses.input);
|
|
1058
1095
|
};
|
|
1059
|
-
|
|
1060
|
-
const renderInputType = {};
|
|
1061
1096
|
/**
|
|
1062
|
-
* @param {HTMLInputElement | HTMLTextAreaElement} input
|
|
1063
|
-
* @param {SweetAlertOptions}
|
|
1097
|
+
* @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input
|
|
1098
|
+
* @param {SweetAlertOptions['inputValue']} inputValue
|
|
1064
1099
|
*/
|
|
1065
1100
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1101
|
+
|
|
1102
|
+
const checkAndSetInputValue = (input, inputValue) => {
|
|
1103
|
+
if (['string', 'number'].includes(typeof inputValue)) {
|
|
1104
|
+
input.value = "".concat(inputValue);
|
|
1105
|
+
} else if (!isPromise(inputValue)) {
|
|
1106
|
+
warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(typeof inputValue, "\""));
|
|
1071
1107
|
}
|
|
1072
1108
|
};
|
|
1109
|
+
/** @type Record<string, (input: Input | HTMLElement, params: SweetAlertOptions) => Input> */
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
const renderInputType = {};
|
|
1073
1113
|
/**
|
|
1074
1114
|
* @param {HTMLInputElement} input
|
|
1075
1115
|
* @param {SweetAlertOptions} params
|
|
1076
|
-
* @returns
|
|
1116
|
+
* @returns {HTMLInputElement}
|
|
1077
1117
|
*/
|
|
1078
1118
|
|
|
1079
|
-
|
|
1080
1119
|
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => {
|
|
1081
|
-
checkAndSetInputValue(input, params);
|
|
1120
|
+
checkAndSetInputValue(input, params.inputValue);
|
|
1082
1121
|
setInputLabel(input, input, params);
|
|
1083
1122
|
setInputPlaceholder(input, params);
|
|
1084
1123
|
input.type = params.input;
|
|
1085
1124
|
return input;
|
|
1086
1125
|
};
|
|
1126
|
+
/**
|
|
1127
|
+
* @param {HTMLInputElement} input
|
|
1128
|
+
* @param {SweetAlertOptions} params
|
|
1129
|
+
* @returns {HTMLInputElement}
|
|
1130
|
+
*/
|
|
1131
|
+
|
|
1087
1132
|
|
|
1088
1133
|
renderInputType.file = (input, params) => {
|
|
1089
1134
|
setInputLabel(input, input, params);
|
|
1090
1135
|
setInputPlaceholder(input, params);
|
|
1091
1136
|
return input;
|
|
1092
1137
|
};
|
|
1138
|
+
/**
|
|
1139
|
+
* @param {HTMLInputElement} range
|
|
1140
|
+
* @param {SweetAlertOptions} params
|
|
1141
|
+
* @returns {HTMLInputElement}
|
|
1142
|
+
*/
|
|
1143
|
+
|
|
1093
1144
|
|
|
1094
1145
|
renderInputType.range = (range, params) => {
|
|
1095
1146
|
const rangeInput = range.querySelector('input');
|
|
1096
1147
|
const rangeOutput = range.querySelector('output');
|
|
1097
|
-
rangeInput
|
|
1148
|
+
checkAndSetInputValue(rangeInput, params.inputValue);
|
|
1098
1149
|
rangeInput.type = params.input;
|
|
1099
|
-
rangeOutput
|
|
1150
|
+
checkAndSetInputValue(rangeOutput, params.inputValue);
|
|
1100
1151
|
setInputLabel(rangeInput, range, params);
|
|
1101
1152
|
return range;
|
|
1102
1153
|
};
|
|
1154
|
+
/**
|
|
1155
|
+
* @param {HTMLSelectElement} select
|
|
1156
|
+
* @param {SweetAlertOptions} params
|
|
1157
|
+
* @returns {HTMLSelectElement}
|
|
1158
|
+
*/
|
|
1159
|
+
|
|
1103
1160
|
|
|
1104
1161
|
renderInputType.select = (select, params) => {
|
|
1105
1162
|
select.textContent = '';
|
|
@@ -1116,33 +1173,47 @@
|
|
|
1116
1173
|
setInputLabel(select, select, params);
|
|
1117
1174
|
return select;
|
|
1118
1175
|
};
|
|
1176
|
+
/**
|
|
1177
|
+
* @param {HTMLInputElement} radio
|
|
1178
|
+
* @returns {HTMLInputElement}
|
|
1179
|
+
*/
|
|
1180
|
+
|
|
1119
1181
|
|
|
1120
1182
|
renderInputType.radio = radio => {
|
|
1121
1183
|
radio.textContent = '';
|
|
1122
1184
|
return radio;
|
|
1123
1185
|
};
|
|
1186
|
+
/**
|
|
1187
|
+
* @param {HTMLLabelElement} checkboxContainer
|
|
1188
|
+
* @param {SweetAlertOptions} params
|
|
1189
|
+
* @returns {HTMLInputElement}
|
|
1190
|
+
*/
|
|
1191
|
+
|
|
1124
1192
|
|
|
1125
1193
|
renderInputType.checkbox = (checkboxContainer, params) => {
|
|
1126
|
-
/** @type {HTMLInputElement} */
|
|
1127
1194
|
const checkbox = getInput(getPopup(), 'checkbox');
|
|
1128
1195
|
checkbox.value = '1';
|
|
1129
1196
|
checkbox.id = swalClasses.checkbox;
|
|
1130
1197
|
checkbox.checked = Boolean(params.inputValue);
|
|
1131
1198
|
const label = checkboxContainer.querySelector('span');
|
|
1132
1199
|
setInnerHtml(label, params.inputPlaceholder);
|
|
1133
|
-
return
|
|
1200
|
+
return checkbox;
|
|
1134
1201
|
};
|
|
1135
1202
|
/**
|
|
1136
1203
|
* @param {HTMLTextAreaElement} textarea
|
|
1137
1204
|
* @param {SweetAlertOptions} params
|
|
1138
|
-
* @returns
|
|
1205
|
+
* @returns {HTMLTextAreaElement}
|
|
1139
1206
|
*/
|
|
1140
1207
|
|
|
1141
1208
|
|
|
1142
1209
|
renderInputType.textarea = (textarea, params) => {
|
|
1143
|
-
checkAndSetInputValue(textarea, params);
|
|
1210
|
+
checkAndSetInputValue(textarea, params.inputValue);
|
|
1144
1211
|
setInputPlaceholder(textarea, params);
|
|
1145
1212
|
setInputLabel(textarea, textarea, params);
|
|
1213
|
+
/**
|
|
1214
|
+
* @param {HTMLElement} el
|
|
1215
|
+
* @returns {number}
|
|
1216
|
+
*/
|
|
1146
1217
|
|
|
1147
1218
|
const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291
|
|
1148
1219
|
|
|
@@ -1211,6 +1282,16 @@
|
|
|
1211
1282
|
closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);
|
|
1212
1283
|
};
|
|
1213
1284
|
|
|
1285
|
+
/**
|
|
1286
|
+
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1287
|
+
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1288
|
+
*/
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* @param {SweetAlert2} instance
|
|
1292
|
+
* @param {SweetAlertOptions} params
|
|
1293
|
+
*/
|
|
1294
|
+
|
|
1214
1295
|
const renderIcon = (instance, params) => {
|
|
1215
1296
|
const innerParams = privateProps.innerParams.get(instance);
|
|
1216
1297
|
const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon
|
|
@@ -1238,6 +1319,10 @@
|
|
|
1238
1319
|
|
|
1239
1320
|
addClass(icon, params.showClass.icon);
|
|
1240
1321
|
};
|
|
1322
|
+
/**
|
|
1323
|
+
* @param {HTMLElement} icon
|
|
1324
|
+
* @param {SweetAlertOptions} params
|
|
1325
|
+
*/
|
|
1241
1326
|
|
|
1242
1327
|
const applyStyles = (icon, params) => {
|
|
1243
1328
|
for (const iconType in iconTypes) {
|
|
@@ -1268,6 +1353,10 @@
|
|
|
1268
1353
|
|
|
1269
1354
|
const successIconHtml = "\n <div class=\"swal2-success-circular-line-left\"></div>\n <span class=\"swal2-success-line-tip\"></span> <span class=\"swal2-success-line-long\"></span>\n <div class=\"swal2-success-ring\"></div> <div class=\"swal2-success-fix\"></div>\n <div class=\"swal2-success-circular-line-right\"></div>\n";
|
|
1270
1355
|
const errorIconHtml = "\n <span class=\"swal2-x-mark\">\n <span class=\"swal2-x-mark-line-left\"></span>\n <span class=\"swal2-x-mark-line-right\"></span>\n </span>\n";
|
|
1356
|
+
/**
|
|
1357
|
+
* @param {HTMLElement} icon
|
|
1358
|
+
* @param {SweetAlertOptions} params
|
|
1359
|
+
*/
|
|
1271
1360
|
|
|
1272
1361
|
const setContent = (icon, params) => {
|
|
1273
1362
|
icon.textContent = '';
|
|
@@ -1287,6 +1376,11 @@
|
|
|
1287
1376
|
setInnerHtml(icon, iconContent(defaultIconHtml[params.icon]));
|
|
1288
1377
|
}
|
|
1289
1378
|
};
|
|
1379
|
+
/**
|
|
1380
|
+
* @param {HTMLElement} icon
|
|
1381
|
+
* @param {SweetAlertOptions} params
|
|
1382
|
+
*/
|
|
1383
|
+
|
|
1290
1384
|
|
|
1291
1385
|
const setColor = (icon, params) => {
|
|
1292
1386
|
if (!params.iconColor) {
|
|
@@ -1302,9 +1396,23 @@
|
|
|
1302
1396
|
|
|
1303
1397
|
setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor);
|
|
1304
1398
|
};
|
|
1399
|
+
/**
|
|
1400
|
+
* @param {string} content
|
|
1401
|
+
*/
|
|
1402
|
+
|
|
1305
1403
|
|
|
1306
1404
|
const iconContent = content => "<div class=\"".concat(swalClasses['icon-content'], "\">").concat(content, "</div>");
|
|
1307
1405
|
|
|
1406
|
+
/**
|
|
1407
|
+
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1408
|
+
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1409
|
+
*/
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* @param {SweetAlert2} instance
|
|
1413
|
+
* @param {SweetAlertOptions} params
|
|
1414
|
+
*/
|
|
1415
|
+
|
|
1308
1416
|
const renderImage = (instance, params) => {
|
|
1309
1417
|
const image = getImage();
|
|
1310
1418
|
|
|
@@ -1324,23 +1432,15 @@
|
|
|
1324
1432
|
applyCustomClass(image, params, 'image');
|
|
1325
1433
|
};
|
|
1326
1434
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
return stepEl;
|
|
1332
|
-
};
|
|
1333
|
-
|
|
1334
|
-
const createLineElement = params => {
|
|
1335
|
-
const lineEl = document.createElement('li');
|
|
1336
|
-
addClass(lineEl, swalClasses['progress-step-line']);
|
|
1337
|
-
|
|
1338
|
-
if (params.progressStepsDistance) {
|
|
1339
|
-
lineEl.style.width = params.progressStepsDistance;
|
|
1340
|
-
}
|
|
1435
|
+
/**
|
|
1436
|
+
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1437
|
+
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1438
|
+
*/
|
|
1341
1439
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1440
|
+
/**
|
|
1441
|
+
* @param {SweetAlert2} instance
|
|
1442
|
+
* @param {SweetAlertOptions} params
|
|
1443
|
+
*/
|
|
1344
1444
|
|
|
1345
1445
|
const renderProgressSteps = (instance, params) => {
|
|
1346
1446
|
const progressStepsContainer = getProgressSteps();
|
|
@@ -1370,6 +1470,33 @@
|
|
|
1370
1470
|
}
|
|
1371
1471
|
});
|
|
1372
1472
|
};
|
|
1473
|
+
/**
|
|
1474
|
+
* @param {string} step
|
|
1475
|
+
* @returns {HTMLLIElement}
|
|
1476
|
+
*/
|
|
1477
|
+
|
|
1478
|
+
const createStepElement = step => {
|
|
1479
|
+
const stepEl = document.createElement('li');
|
|
1480
|
+
addClass(stepEl, swalClasses['progress-step']);
|
|
1481
|
+
setInnerHtml(stepEl, step);
|
|
1482
|
+
return stepEl;
|
|
1483
|
+
};
|
|
1484
|
+
/**
|
|
1485
|
+
* @param {SweetAlertOptions} params
|
|
1486
|
+
* @returns {HTMLLIElement}
|
|
1487
|
+
*/
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
const createLineElement = params => {
|
|
1491
|
+
const lineEl = document.createElement('li');
|
|
1492
|
+
addClass(lineEl, swalClasses['progress-step-line']);
|
|
1493
|
+
|
|
1494
|
+
if (params.progressStepsDistance) {
|
|
1495
|
+
applyNumericalStyle(lineEl, 'width', params.progressStepsDistance);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
return lineEl;
|
|
1499
|
+
};
|
|
1373
1500
|
|
|
1374
1501
|
const renderTitle = (instance, params) => {
|
|
1375
1502
|
const title = getTitle();
|
|
@@ -1387,6 +1514,16 @@
|
|
|
1387
1514
|
applyCustomClass(title, params, 'title');
|
|
1388
1515
|
};
|
|
1389
1516
|
|
|
1517
|
+
/**
|
|
1518
|
+
* @typedef { import('sweetalert2') } SweetAlert2
|
|
1519
|
+
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
1520
|
+
*/
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* @param {SweetAlert2} instance
|
|
1524
|
+
* @param {SweetAlertOptions} params
|
|
1525
|
+
*/
|
|
1526
|
+
|
|
1390
1527
|
const renderPopup = (instance, params) => {
|
|
1391
1528
|
const container = getContainer();
|
|
1392
1529
|
const popup = getPopup(); // Width
|
|
@@ -1416,6 +1553,10 @@
|
|
|
1416
1553
|
|
|
1417
1554
|
addClasses(popup, params);
|
|
1418
1555
|
};
|
|
1556
|
+
/**
|
|
1557
|
+
* @param {HTMLElement} popup
|
|
1558
|
+
* @param {SweetAlertOptions} params
|
|
1559
|
+
*/
|
|
1419
1560
|
|
|
1420
1561
|
const addClasses = (popup, params) => {
|
|
1421
1562
|
// Default Class + showClass when updating Swal.update({})
|
|
@@ -3467,7 +3608,7 @@
|
|
|
3467
3608
|
};
|
|
3468
3609
|
});
|
|
3469
3610
|
SweetAlert.DismissReason = DismissReason;
|
|
3470
|
-
SweetAlert.version = '11.4.
|
|
3611
|
+
SweetAlert.version = '11.4.14';
|
|
3471
3612
|
|
|
3472
3613
|
const Swal = SweetAlert; // @ts-ignore
|
|
3473
3614
|
|