sweetalert2 11.3.3 → 11.3.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 +5 -7
- package/dist/sweetalert2.all.js +50 -33
- package/dist/sweetalert2.all.min.js +1 -1
- package/dist/sweetalert2.js +50 -33
- package/dist/sweetalert2.min.js +1 -1
- package/package.json +8 -7
- package/src/SweetAlert.js +1 -1
- package/src/buttons-handlers.js +2 -2
- package/src/instanceMethods/_destroy.js +1 -1
- package/src/utils/dom/animationEndEvent.js +2 -3
- package/src/utils/dom/getters.js +4 -4
- package/src/utils/dom/renderers/renderIcon.js +2 -2
- package/src/utils/getTemplateParams.js +7 -4
- package/src/utils/iosFix.js +17 -5
- package/src/utils/openPopup.js +1 -1
- package/src/utils/utils.js +9 -8
package/src/utils/iosFix.js
CHANGED
|
@@ -12,13 +12,19 @@ export const iOSfix = () => {
|
|
|
12
12
|
document.body.style.top = `${offset * -1}px`
|
|
13
13
|
dom.addClass(document.body, swalClasses.iosfix)
|
|
14
14
|
lockBodyScroll()
|
|
15
|
-
addBottomPaddingForTallPopups()
|
|
15
|
+
addBottomPaddingForTallPopups()
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* https://github.com/sweetalert2/sweetalert2/issues/1948
|
|
21
|
+
*/
|
|
19
22
|
const addBottomPaddingForTallPopups = () => {
|
|
20
|
-
const
|
|
21
|
-
|
|
23
|
+
const ua = navigator.userAgent
|
|
24
|
+
const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i)
|
|
25
|
+
const webkit = !!ua.match(/WebKit/i)
|
|
26
|
+
const iOSSafari = iOS && webkit && !ua.match(/CriOS/i)
|
|
27
|
+
if (iOSSafari) {
|
|
22
28
|
const bottomPanelHeight = 44
|
|
23
29
|
if (dom.getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) {
|
|
24
30
|
dom.getContainer().style.paddingBottom = `${bottomPanelHeight}px`
|
|
@@ -43,7 +49,7 @@ const lockBodyScroll = () => { // #1246
|
|
|
43
49
|
const shouldPreventTouchMove = (event) => {
|
|
44
50
|
const target = event.target
|
|
45
51
|
const container = dom.getContainer()
|
|
46
|
-
if (
|
|
52
|
+
if (isStylus(event) || isZoom(event)) {
|
|
47
53
|
return false
|
|
48
54
|
}
|
|
49
55
|
if (target === container) {
|
|
@@ -63,7 +69,13 @@ const shouldPreventTouchMove = (event) => {
|
|
|
63
69
|
return false
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
/**
|
|
73
|
+
* https://github.com/sweetalert2/sweetalert2/issues/1786
|
|
74
|
+
*
|
|
75
|
+
* @param {*} event
|
|
76
|
+
* @returns {boolean}
|
|
77
|
+
*/
|
|
78
|
+
const isStylus = (event) => {
|
|
67
79
|
return event.touches && event.touches.length && event.touches[0].touchType === 'stylus'
|
|
68
80
|
}
|
|
69
81
|
|
package/src/utils/openPopup.js
CHANGED
|
@@ -79,7 +79,7 @@ const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) =>
|
|
|
79
79
|
|
|
80
80
|
const addClasses = (container, popup, params) => {
|
|
81
81
|
dom.addClass(container, params.showClass.backdrop)
|
|
82
|
-
//
|
|
82
|
+
// this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059
|
|
83
83
|
popup.style.setProperty('opacity', '0', 'important')
|
|
84
84
|
dom.show(popup, 'grid')
|
|
85
85
|
setTimeout(() => {
|
package/src/utils/utils.js
CHANGED
|
@@ -16,27 +16,28 @@ export const uniqueArray = (arr) => {
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Capitalize the first letter of a string
|
|
19
|
-
* @param str
|
|
19
|
+
* @param {string} str
|
|
20
|
+
* @returns {string}
|
|
20
21
|
*/
|
|
21
22
|
export const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
25
|
+
* @param {NodeList | HTMLCollection | NamedNodeMap} nodeList
|
|
26
|
+
* @returns {array}
|
|
26
27
|
*/
|
|
27
28
|
export const toArray = (nodeList) => Array.prototype.slice.call(nodeList)
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @param message
|
|
31
|
+
* Standardize console warnings
|
|
32
|
+
* @param {string | array} message
|
|
32
33
|
*/
|
|
33
34
|
export const warn = (message) => {
|
|
34
35
|
console.warn(`${consolePrefix} ${typeof message === 'object' ? message.join(' ') : message}`)
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @param message
|
|
39
|
+
* Standardize console errors
|
|
40
|
+
* @param {string} message
|
|
40
41
|
*/
|
|
41
42
|
export const error = (message) => {
|
|
42
43
|
console.error(`${consolePrefix} ${message}`)
|
|
@@ -51,7 +52,7 @@ const previousWarnOnceMessages = []
|
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* Show a console warning, but only if it hasn't already been shown
|
|
54
|
-
* @param message
|
|
55
|
+
* @param {string} message
|
|
55
56
|
*/
|
|
56
57
|
export const warnOnce = (message) => {
|
|
57
58
|
if (!previousWarnOnceMessages.includes(message)) {
|