sweetalert2 11.26.11 → 11.26.13
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 +127 -71
- package/dist/sweetalert2.all.min.js +2 -2
- package/dist/sweetalert2.esm.all.js +127 -71
- package/dist/sweetalert2.esm.all.min.js +2 -2
- package/dist/sweetalert2.esm.js +127 -71
- package/dist/sweetalert2.esm.min.js +2 -2
- package/dist/sweetalert2.js +127 -71
- package/dist/sweetalert2.min.js +2 -2
- package/package.json +1 -1
- package/src/SweetAlert.js +1 -1
- package/src/popup-click-handler.js +1 -1
- package/src/staticMethods/timer.js +1 -1
- package/src/utils/EventEmitter.js +4 -2
- package/src/utils/dom/domUtils.js +2 -2
- package/src/utils/dom/inputUtils.js +1 -1
- package/src/utils/dom/renderers/renderInput.js +80 -50
- package/src/utils/draggable.js +10 -1
- package/src/utils/iosFix.js +8 -3
- package/src/utils/openPopup.js +25 -8
package/src/utils/openPopup.js
CHANGED
|
@@ -16,10 +16,14 @@ export const openPopup = (params) => {
|
|
|
16
16
|
const container = dom.getContainer()
|
|
17
17
|
const popup = dom.getPopup()
|
|
18
18
|
|
|
19
|
+
if (!container || !popup) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
if (typeof params.willOpen === 'function') {
|
|
20
24
|
params.willOpen(popup)
|
|
21
25
|
}
|
|
22
|
-
globalState.eventEmitter
|
|
26
|
+
globalState.eventEmitter?.emit('willOpen', popup)
|
|
23
27
|
|
|
24
28
|
const bodyStyles = window.getComputedStyle(document.body)
|
|
25
29
|
const initialBodyOverflow = bodyStyles.overflowY
|
|
@@ -31,7 +35,12 @@ export const openPopup = (params) => {
|
|
|
31
35
|
}, SHOW_CLASS_TIMEOUT)
|
|
32
36
|
|
|
33
37
|
if (dom.isModal()) {
|
|
34
|
-
|
|
38
|
+
// Using ternary instead of ?? operator for Webpack 4 compatibility
|
|
39
|
+
fixScrollContainer(
|
|
40
|
+
container,
|
|
41
|
+
params.scrollbarPadding !== undefined ? params.scrollbarPadding : false,
|
|
42
|
+
initialBodyOverflow
|
|
43
|
+
)
|
|
35
44
|
setAriaHidden()
|
|
36
45
|
}
|
|
37
46
|
|
|
@@ -40,20 +49,24 @@ export const openPopup = (params) => {
|
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
if (typeof params.didOpen === 'function') {
|
|
43
|
-
|
|
52
|
+
const didOpen = params.didOpen
|
|
53
|
+
setTimeout(() => didOpen(popup))
|
|
44
54
|
}
|
|
45
|
-
globalState.eventEmitter
|
|
55
|
+
globalState.eventEmitter?.emit('didOpen', popup)
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
/**
|
|
49
|
-
* @param {
|
|
59
|
+
* @param {Event} event
|
|
50
60
|
*/
|
|
51
61
|
const swalOpenAnimationFinished = (event) => {
|
|
52
62
|
const popup = dom.getPopup()
|
|
53
|
-
if (event.target !== popup) {
|
|
63
|
+
if (!popup || event.target !== popup) {
|
|
54
64
|
return
|
|
55
65
|
}
|
|
56
66
|
const container = dom.getContainer()
|
|
67
|
+
if (!container) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
57
70
|
popup.removeEventListener('animationend', swalOpenAnimationFinished)
|
|
58
71
|
popup.removeEventListener('transitionend', swalOpenAnimationFinished)
|
|
59
72
|
container.style.overflowY = 'auto'
|
|
@@ -100,14 +113,18 @@ const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) =>
|
|
|
100
113
|
* @param {SweetAlertOptions} params
|
|
101
114
|
*/
|
|
102
115
|
const addClasses = (container, popup, params) => {
|
|
103
|
-
|
|
116
|
+
if (params.showClass?.backdrop) {
|
|
117
|
+
dom.addClass(container, params.showClass.backdrop)
|
|
118
|
+
}
|
|
104
119
|
if (params.animation) {
|
|
105
120
|
// this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059
|
|
106
121
|
popup.style.setProperty('opacity', '0', 'important')
|
|
107
122
|
dom.show(popup, 'grid')
|
|
108
123
|
setTimeout(() => {
|
|
109
124
|
// Animate popup right after showing it
|
|
110
|
-
|
|
125
|
+
if (params.showClass?.popup) {
|
|
126
|
+
dom.addClass(popup, params.showClass.popup)
|
|
127
|
+
}
|
|
111
128
|
// and remove the opacity workaround
|
|
112
129
|
popup.style.removeProperty('opacity')
|
|
113
130
|
}, SHOW_CLASS_TIMEOUT) // 10ms in order to fix #2062
|