sweetalert2 11.4.4 → 11.4.7
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/CHANGELOG.md +21 -0
- package/README.md +8 -12
- package/dist/sweetalert2.all.js +180 -180
- package/dist/sweetalert2.all.min.js +1 -1
- package/dist/sweetalert2.js +180 -180
- package/dist/sweetalert2.min.js +1 -1
- package/package.json +10 -10
- package/src/SweetAlert.js +1 -1
- package/src/instanceMethods/close.js +2 -4
- package/src/keydown-handler.js +4 -1
- package/sweetalert2.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [11.4.7](https://github.com/sweetalert2/sweetalert2/compare/v11.4.6...v11.4.7) (2022-03-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 'removeEventListener' of undefined ([#2421](https://github.com/sweetalert2/sweetalert2/issues/2421)) ([4f44984](https://github.com/sweetalert2/sweetalert2/commit/4f44984eb0f900cf8b2401a18511a55bd2eaaf42))
|
|
7
|
+
|
|
8
|
+
## [11.4.6](https://github.com/sweetalert2/sweetalert2/compare/v11.4.5...v11.4.6) (2022-03-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **types:** customClass can be also a string ([27e9282](https://github.com/sweetalert2/sweetalert2/commit/27e9282b743babab7631938c2394482c24d4755f)), closes [#2411](https://github.com/sweetalert2/sweetalert2/issues/2411)
|
|
14
|
+
|
|
15
|
+
## [11.4.5](https://github.com/sweetalert2/sweetalert2/compare/v11.4.4...v11.4.5) (2022-03-17)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* rm cspell, it takes too long to install ([c39de26](https://github.com/sweetalert2/sweetalert2/commit/c39de260c70c7faf5b450d4c03fd7ea16cdb24db))
|
|
21
|
+
|
|
1
22
|
## [11.4.4](https://github.com/sweetalert2/sweetalert2/compare/v11.4.3...v11.4.4) (2022-02-21)
|
|
2
23
|
|
|
3
24
|
|
package/README.md
CHANGED
|
@@ -30,25 +30,21 @@ For all questions related to sponsorship please contact me via email limon.monte
|
|
|
30
30
|
NSFW Sponsors
|
|
31
31
|
-------------
|
|
32
32
|
|
|
33
|
-
[<img src="https://sweetalert2.github.io/images/plus.png" width="80">](SPONSORS.md#sponsors) | [<img src="https://sweetalert2.github.io/images/sponsors/
|
|
34
|
-
|
|
35
|
-
[Become a NSFW sponsor](SPONSORS.md#sponsors) | [
|
|
33
|
+
[<img src="https://sweetalert2.github.io/images/plus.png" width="80">](SPONSORS.md#sponsors) | [<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/) | [<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/)
|
|
34
|
+
-|-|-|-|-|-|-
|
|
35
|
+
[Become a NSFW sponsor](SPONSORS.md#sponsors) | [Sex Vibrators](https://www.sexvibrators.in/) | [Viva Awa](https://www.viva-awa.com/) | [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/)
|
|
36
36
|
|
|
37
|
-
[<img src="https://sweetalert2.github.io/images/sponsors/
|
|
37
|
+
[<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/) |
|
|
38
38
|
-|-|-|-|-|-
|
|
39
|
-
[
|
|
40
|
-
|
|
41
|
-
[<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/) |
|
|
42
|
-
-|-|-|-|-
|
|
43
|
-
[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/)
|
|
39
|
+
[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/)
|
|
44
40
|
|
|
45
41
|
[<img src="https://sweetalert2.github.io/images/sponsors/vsdoll.png" width="80">](https://vsdoll.com/) | [<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) | [<img src="https://sweetalert2.github.io/images/sponsors/fresh-materials.png" width="80">](https://www.thefreshmaterials.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
46
42
|
-|-|-|-
|
|
47
43
|
[VSDoll](https://vsdoll.com/) | [SexAngelbaby](https://sexangelbaby.com/) | [The Adult Toy Finder](https://theadulttoyfinder.com/?utm_source=sweetalert2&utm_medium=logo) | [Fresh Materials](https://www.thefreshmaterials.com/?utm_source=sweetalert2&utm_medium=logo)
|
|
48
44
|
|
|
49
|
-
[<img src="https://sweetalert2.github.io/images/sponsors/
|
|
50
|
-
|
|
51
|
-
[
|
|
45
|
+
[<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/)
|
|
46
|
+
-|-|-|-
|
|
47
|
+
[My Sex Toy Guide](https://www.mysextoyguide.com/?utm_source=sweetalert2&utm_medium=logo) | [Best Blowjob Machines](https://www.bestblowjobmachines.com/?utm_source=sweetalert2&utm_medium=logo) | [STC](https://sextoycollective.com/?utm_source=sweetalert2&utm_medium=logo) | [DoctorClimax](https://doctorclimax.com/)
|
|
52
48
|
|
|
53
49
|
Support and Donations
|
|
54
50
|
---------------------
|
package/dist/sweetalert2.all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sweetalert2 v11.4.
|
|
2
|
+
* sweetalert2 v11.4.7
|
|
3
3
|
* Released under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -2261,6 +2261,183 @@
|
|
|
2261
2261
|
swalPromiseReject: new WeakMap()
|
|
2262
2262
|
};
|
|
2263
2263
|
|
|
2264
|
+
/*
|
|
2265
|
+
* Global function to determine if SweetAlert2 popup is shown
|
|
2266
|
+
*/
|
|
2267
|
+
|
|
2268
|
+
const isVisible$1 = () => {
|
|
2269
|
+
return isVisible(getPopup());
|
|
2270
|
+
};
|
|
2271
|
+
/*
|
|
2272
|
+
* Global function to click 'Confirm' button
|
|
2273
|
+
*/
|
|
2274
|
+
|
|
2275
|
+
const clickConfirm = () => getConfirmButton() && getConfirmButton().click();
|
|
2276
|
+
/*
|
|
2277
|
+
* Global function to click 'Deny' button
|
|
2278
|
+
*/
|
|
2279
|
+
|
|
2280
|
+
const clickDeny = () => getDenyButton() && getDenyButton().click();
|
|
2281
|
+
/*
|
|
2282
|
+
* Global function to click 'Cancel' button
|
|
2283
|
+
*/
|
|
2284
|
+
|
|
2285
|
+
const clickCancel = () => getCancelButton() && getCancelButton().click();
|
|
2286
|
+
|
|
2287
|
+
const removeKeydownHandler = globalState => {
|
|
2288
|
+
if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
|
|
2289
|
+
globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
|
|
2290
|
+
capture: globalState.keydownListenerCapture
|
|
2291
|
+
});
|
|
2292
|
+
globalState.keydownHandlerAdded = false;
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2295
|
+
const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
|
|
2296
|
+
removeKeydownHandler(globalState);
|
|
2297
|
+
|
|
2298
|
+
if (!innerParams.toast) {
|
|
2299
|
+
globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith);
|
|
2300
|
+
|
|
2301
|
+
globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();
|
|
2302
|
+
globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
|
|
2303
|
+
globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {
|
|
2304
|
+
capture: globalState.keydownListenerCapture
|
|
2305
|
+
});
|
|
2306
|
+
globalState.keydownHandlerAdded = true;
|
|
2307
|
+
}
|
|
2308
|
+
}; // Focus handling
|
|
2309
|
+
|
|
2310
|
+
const setFocus = (innerParams, index, increment) => {
|
|
2311
|
+
const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match
|
|
2312
|
+
|
|
2313
|
+
if (focusableElements.length) {
|
|
2314
|
+
index = index + increment; // rollover to first item
|
|
2315
|
+
|
|
2316
|
+
if (index === focusableElements.length) {
|
|
2317
|
+
index = 0; // go to last item
|
|
2318
|
+
} else if (index === -1) {
|
|
2319
|
+
index = focusableElements.length - 1;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
return focusableElements[index].focus();
|
|
2323
|
+
} // no visible focusable elements, focus the popup
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
getPopup().focus();
|
|
2327
|
+
};
|
|
2328
|
+
const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];
|
|
2329
|
+
const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];
|
|
2330
|
+
|
|
2331
|
+
const keydownHandler = (instance, e, dismissWith) => {
|
|
2332
|
+
const innerParams = privateProps.innerParams.get(instance);
|
|
2333
|
+
|
|
2334
|
+
if (!innerParams) {
|
|
2335
|
+
return; // This instance has already been destroyed
|
|
2336
|
+
} // Ignore keydown during IME composition
|
|
2337
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition
|
|
2338
|
+
// https://github.com/sweetalert2/sweetalert2/issues/720
|
|
2339
|
+
// https://github.com/sweetalert2/sweetalert2/issues/2406
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
if (e.isComposing || e.keyCode === 229) {
|
|
2343
|
+
return;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
if (innerParams.stopKeydownPropagation) {
|
|
2347
|
+
e.stopPropagation();
|
|
2348
|
+
} // ENTER
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
if (e.key === 'Enter') {
|
|
2352
|
+
handleEnter(instance, e, innerParams);
|
|
2353
|
+
} // TAB
|
|
2354
|
+
else if (e.key === 'Tab') {
|
|
2355
|
+
handleTab(e, innerParams);
|
|
2356
|
+
} // ARROWS - switch focus between buttons
|
|
2357
|
+
else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {
|
|
2358
|
+
handleArrows(e.key);
|
|
2359
|
+
} // ESC
|
|
2360
|
+
else if (e.key === 'Escape') {
|
|
2361
|
+
handleEsc(e, innerParams, dismissWith);
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
|
|
2365
|
+
const handleEnter = (instance, e, innerParams) => {
|
|
2366
|
+
// https://github.com/sweetalert2/sweetalert2/issues/2386
|
|
2367
|
+
if (!callIfFunction(innerParams.allowEnterKey)) {
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {
|
|
2372
|
+
if (['textarea', 'file'].includes(innerParams.input)) {
|
|
2373
|
+
return; // do not submit
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
clickConfirm();
|
|
2377
|
+
e.preventDefault();
|
|
2378
|
+
}
|
|
2379
|
+
};
|
|
2380
|
+
|
|
2381
|
+
const handleTab = (e, innerParams) => {
|
|
2382
|
+
const targetElement = e.target;
|
|
2383
|
+
const focusableElements = getFocusableElements();
|
|
2384
|
+
let btnIndex = -1;
|
|
2385
|
+
|
|
2386
|
+
for (let i = 0; i < focusableElements.length; i++) {
|
|
2387
|
+
if (targetElement === focusableElements[i]) {
|
|
2388
|
+
btnIndex = i;
|
|
2389
|
+
break;
|
|
2390
|
+
}
|
|
2391
|
+
} // Cycle to the next button
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
if (!e.shiftKey) {
|
|
2395
|
+
setFocus(innerParams, btnIndex, 1);
|
|
2396
|
+
} // Cycle to the prev button
|
|
2397
|
+
else {
|
|
2398
|
+
setFocus(innerParams, btnIndex, -1);
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
e.stopPropagation();
|
|
2402
|
+
e.preventDefault();
|
|
2403
|
+
};
|
|
2404
|
+
|
|
2405
|
+
const handleArrows = key => {
|
|
2406
|
+
const confirmButton = getConfirmButton();
|
|
2407
|
+
const denyButton = getDenyButton();
|
|
2408
|
+
const cancelButton = getCancelButton();
|
|
2409
|
+
|
|
2410
|
+
if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';
|
|
2415
|
+
let buttonToFocus = document.activeElement;
|
|
2416
|
+
|
|
2417
|
+
for (let i = 0; i < getActions().children.length; i++) {
|
|
2418
|
+
buttonToFocus = buttonToFocus[sibling];
|
|
2419
|
+
|
|
2420
|
+
if (!buttonToFocus) {
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) {
|
|
2425
|
+
break;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
if (buttonToFocus instanceof HTMLButtonElement) {
|
|
2430
|
+
buttonToFocus.focus();
|
|
2431
|
+
}
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2434
|
+
const handleEsc = (e, innerParams, dismissWith) => {
|
|
2435
|
+
if (callIfFunction(innerParams.allowEscapeKey)) {
|
|
2436
|
+
e.preventDefault();
|
|
2437
|
+
dismissWith(DismissReason.esc);
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
|
|
2264
2441
|
/*
|
|
2265
2442
|
* Instance method to close sweetAlert
|
|
2266
2443
|
*/
|
|
@@ -2270,10 +2447,7 @@
|
|
|
2270
2447
|
triggerDidCloseAndDispose(instance, didClose);
|
|
2271
2448
|
} else {
|
|
2272
2449
|
restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));
|
|
2273
|
-
|
|
2274
|
-
capture: globalState.keydownListenerCapture
|
|
2275
|
-
});
|
|
2276
|
-
globalState.keydownHandlerAdded = false;
|
|
2450
|
+
removeKeydownHandler(globalState);
|
|
2277
2451
|
}
|
|
2278
2452
|
|
|
2279
2453
|
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088
|
|
@@ -2825,180 +2999,6 @@
|
|
|
2825
2999
|
};
|
|
2826
3000
|
};
|
|
2827
3001
|
|
|
2828
|
-
/*
|
|
2829
|
-
* Global function to determine if SweetAlert2 popup is shown
|
|
2830
|
-
*/
|
|
2831
|
-
|
|
2832
|
-
const isVisible$1 = () => {
|
|
2833
|
-
return isVisible(getPopup());
|
|
2834
|
-
};
|
|
2835
|
-
/*
|
|
2836
|
-
* Global function to click 'Confirm' button
|
|
2837
|
-
*/
|
|
2838
|
-
|
|
2839
|
-
const clickConfirm = () => getConfirmButton() && getConfirmButton().click();
|
|
2840
|
-
/*
|
|
2841
|
-
* Global function to click 'Deny' button
|
|
2842
|
-
*/
|
|
2843
|
-
|
|
2844
|
-
const clickDeny = () => getDenyButton() && getDenyButton().click();
|
|
2845
|
-
/*
|
|
2846
|
-
* Global function to click 'Cancel' button
|
|
2847
|
-
*/
|
|
2848
|
-
|
|
2849
|
-
const clickCancel = () => getCancelButton() && getCancelButton().click();
|
|
2850
|
-
|
|
2851
|
-
const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
|
|
2852
|
-
if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
|
|
2853
|
-
globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
|
|
2854
|
-
capture: globalState.keydownListenerCapture
|
|
2855
|
-
});
|
|
2856
|
-
globalState.keydownHandlerAdded = false;
|
|
2857
|
-
}
|
|
2858
|
-
|
|
2859
|
-
if (!innerParams.toast) {
|
|
2860
|
-
globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith);
|
|
2861
|
-
|
|
2862
|
-
globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();
|
|
2863
|
-
globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
|
|
2864
|
-
globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {
|
|
2865
|
-
capture: globalState.keydownListenerCapture
|
|
2866
|
-
});
|
|
2867
|
-
globalState.keydownHandlerAdded = true;
|
|
2868
|
-
}
|
|
2869
|
-
}; // Focus handling
|
|
2870
|
-
|
|
2871
|
-
const setFocus = (innerParams, index, increment) => {
|
|
2872
|
-
const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match
|
|
2873
|
-
|
|
2874
|
-
if (focusableElements.length) {
|
|
2875
|
-
index = index + increment; // rollover to first item
|
|
2876
|
-
|
|
2877
|
-
if (index === focusableElements.length) {
|
|
2878
|
-
index = 0; // go to last item
|
|
2879
|
-
} else if (index === -1) {
|
|
2880
|
-
index = focusableElements.length - 1;
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
|
-
return focusableElements[index].focus();
|
|
2884
|
-
} // no visible focusable elements, focus the popup
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
getPopup().focus();
|
|
2888
|
-
};
|
|
2889
|
-
const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];
|
|
2890
|
-
const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];
|
|
2891
|
-
|
|
2892
|
-
const keydownHandler = (instance, e, dismissWith) => {
|
|
2893
|
-
const innerParams = privateProps.innerParams.get(instance);
|
|
2894
|
-
|
|
2895
|
-
if (!innerParams) {
|
|
2896
|
-
return; // This instance has already been destroyed
|
|
2897
|
-
} // Ignore keydown during IME composition
|
|
2898
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition
|
|
2899
|
-
// https://github.com/sweetalert2/sweetalert2/issues/720
|
|
2900
|
-
// https://github.com/sweetalert2/sweetalert2/issues/2406
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
if (e.isComposing || e.keyCode === 229) {
|
|
2904
|
-
return;
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
if (innerParams.stopKeydownPropagation) {
|
|
2908
|
-
e.stopPropagation();
|
|
2909
|
-
} // ENTER
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
if (e.key === 'Enter') {
|
|
2913
|
-
handleEnter(instance, e, innerParams);
|
|
2914
|
-
} // TAB
|
|
2915
|
-
else if (e.key === 'Tab') {
|
|
2916
|
-
handleTab(e, innerParams);
|
|
2917
|
-
} // ARROWS - switch focus between buttons
|
|
2918
|
-
else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {
|
|
2919
|
-
handleArrows(e.key);
|
|
2920
|
-
} // ESC
|
|
2921
|
-
else if (e.key === 'Escape') {
|
|
2922
|
-
handleEsc(e, innerParams, dismissWith);
|
|
2923
|
-
}
|
|
2924
|
-
};
|
|
2925
|
-
|
|
2926
|
-
const handleEnter = (instance, e, innerParams) => {
|
|
2927
|
-
// https://github.com/sweetalert2/sweetalert2/issues/2386
|
|
2928
|
-
if (!callIfFunction(innerParams.allowEnterKey)) {
|
|
2929
|
-
return;
|
|
2930
|
-
}
|
|
2931
|
-
|
|
2932
|
-
if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {
|
|
2933
|
-
if (['textarea', 'file'].includes(innerParams.input)) {
|
|
2934
|
-
return; // do not submit
|
|
2935
|
-
}
|
|
2936
|
-
|
|
2937
|
-
clickConfirm();
|
|
2938
|
-
e.preventDefault();
|
|
2939
|
-
}
|
|
2940
|
-
};
|
|
2941
|
-
|
|
2942
|
-
const handleTab = (e, innerParams) => {
|
|
2943
|
-
const targetElement = e.target;
|
|
2944
|
-
const focusableElements = getFocusableElements();
|
|
2945
|
-
let btnIndex = -1;
|
|
2946
|
-
|
|
2947
|
-
for (let i = 0; i < focusableElements.length; i++) {
|
|
2948
|
-
if (targetElement === focusableElements[i]) {
|
|
2949
|
-
btnIndex = i;
|
|
2950
|
-
break;
|
|
2951
|
-
}
|
|
2952
|
-
} // Cycle to the next button
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
if (!e.shiftKey) {
|
|
2956
|
-
setFocus(innerParams, btnIndex, 1);
|
|
2957
|
-
} // Cycle to the prev button
|
|
2958
|
-
else {
|
|
2959
|
-
setFocus(innerParams, btnIndex, -1);
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
|
-
e.stopPropagation();
|
|
2963
|
-
e.preventDefault();
|
|
2964
|
-
};
|
|
2965
|
-
|
|
2966
|
-
const handleArrows = key => {
|
|
2967
|
-
const confirmButton = getConfirmButton();
|
|
2968
|
-
const denyButton = getDenyButton();
|
|
2969
|
-
const cancelButton = getCancelButton();
|
|
2970
|
-
|
|
2971
|
-
if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {
|
|
2972
|
-
return;
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
|
-
const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';
|
|
2976
|
-
let buttonToFocus = document.activeElement;
|
|
2977
|
-
|
|
2978
|
-
for (let i = 0; i < getActions().children.length; i++) {
|
|
2979
|
-
buttonToFocus = buttonToFocus[sibling];
|
|
2980
|
-
|
|
2981
|
-
if (!buttonToFocus) {
|
|
2982
|
-
return;
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) {
|
|
2986
|
-
break;
|
|
2987
|
-
}
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
|
-
if (buttonToFocus instanceof HTMLButtonElement) {
|
|
2991
|
-
buttonToFocus.focus();
|
|
2992
|
-
}
|
|
2993
|
-
};
|
|
2994
|
-
|
|
2995
|
-
const handleEsc = (e, innerParams, dismissWith) => {
|
|
2996
|
-
if (callIfFunction(innerParams.allowEscapeKey)) {
|
|
2997
|
-
e.preventDefault();
|
|
2998
|
-
dismissWith(DismissReason.esc);
|
|
2999
|
-
}
|
|
3000
|
-
};
|
|
3001
|
-
|
|
3002
3002
|
const isJqueryElement = elem => typeof elem === 'object' && elem.jquery;
|
|
3003
3003
|
|
|
3004
3004
|
const isElement = elem => elem instanceof Element || isJqueryElement(elem);
|
|
@@ -3401,7 +3401,7 @@
|
|
|
3401
3401
|
};
|
|
3402
3402
|
});
|
|
3403
3403
|
SweetAlert.DismissReason = DismissReason;
|
|
3404
|
-
SweetAlert.version = '11.4.
|
|
3404
|
+
SweetAlert.version = '11.4.7';
|
|
3405
3405
|
|
|
3406
3406
|
const Swal = SweetAlert; // @ts-ignore
|
|
3407
3407
|
|