sweetalert2 11.7.4 → 11.7.6
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 +13 -10
- package/dist/sweetalert2.all.js +803 -758
- package/dist/sweetalert2.all.min.js +2 -2
- package/dist/sweetalert2.js +803 -758
- package/dist/sweetalert2.min.js +2 -2
- package/package.json +2 -2
- package/src/SweetAlert.js +31 -10
- package/src/buttons-handlers.js +12 -13
- package/src/instanceMethods/_destroy.js +24 -6
- package/src/instanceMethods/close.js +12 -19
- package/src/instanceMethods/enable-disable-elements.js +13 -1
- package/src/instanceMethods/getInput.js +4 -5
- package/src/keydown-handler.js +3 -3
- package/src/privateProps.js +0 -1
- package/src/staticMethods/mixin.js +3 -2
- package/src/types.js +2 -2
- package/src/utils/dom/inputUtils.js +4 -4
- package/src/utils/dom/renderers/render.js +1 -1
- package/src/utils/dom/renderers/renderActions.js +1 -1
- package/src/utils/dom/renderers/renderCloseButton.js +1 -1
- package/src/utils/dom/renderers/renderContainer.js +1 -1
- package/src/utils/dom/renderers/renderContent.js +1 -1
- package/src/utils/dom/renderers/renderFooter.js +1 -1
- package/src/utils/dom/renderers/renderIcon.js +1 -1
- package/src/utils/dom/renderers/renderImage.js +1 -1
- package/src/utils/dom/renderers/renderInput.js +1 -1
- package/src/utils/dom/renderers/renderPopup.js +1 -1
- package/src/utils/dom/renderers/renderProgressSteps.js +1 -1
- package/src/utils/dom/renderers/renderTitle.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import privateProps from '../privateProps.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {SweetAlert} instance
|
|
5
5
|
* @param {string[]} buttons
|
|
6
6
|
* @param {boolean} disabled
|
|
7
7
|
*/
|
|
@@ -31,18 +31,30 @@ function setInputDisabled(input, disabled) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Enable all the buttons
|
|
36
|
+
*/
|
|
34
37
|
export function enableButtons() {
|
|
35
38
|
setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false)
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Disable all the buttons
|
|
43
|
+
*/
|
|
38
44
|
export function disableButtons() {
|
|
39
45
|
setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true)
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Enable the input field
|
|
50
|
+
*/
|
|
42
51
|
export function enableInput() {
|
|
43
52
|
setInputDisabled(this.getInput(), false)
|
|
44
53
|
}
|
|
45
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Disable the input field
|
|
57
|
+
*/
|
|
46
58
|
export function disableInput() {
|
|
47
59
|
setInputDisabled(this.getInput(), true)
|
|
48
60
|
}
|
|
@@ -4,12 +4,11 @@ import * as dom from '../utils/dom/index.js'
|
|
|
4
4
|
/**
|
|
5
5
|
* Gets the input DOM node, this method works with input parameter.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
8
|
-
* @returns {HTMLElement | null}
|
|
7
|
+
* @returns {HTMLInputElement | null}
|
|
9
8
|
*/
|
|
10
|
-
export function getInput(
|
|
11
|
-
const innerParams = privateProps.innerParams.get(
|
|
12
|
-
const domCache = privateProps.domCache.get(
|
|
9
|
+
export function getInput() {
|
|
10
|
+
const innerParams = privateProps.innerParams.get(this)
|
|
11
|
+
const domCache = privateProps.domCache.get(this)
|
|
13
12
|
if (!domCache) {
|
|
14
13
|
return null
|
|
15
14
|
}
|
package/src/keydown-handler.js
CHANGED
|
@@ -17,7 +17,7 @@ export const removeKeydownHandler = (globalState) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {SweetAlert} instance
|
|
21
21
|
* @param {GlobalState} globalState
|
|
22
22
|
* @param {SweetAlertOptions} innerParams
|
|
23
23
|
* @param {*} dismissWith
|
|
@@ -66,7 +66,7 @@ const arrowKeysNextButton = ['ArrowRight', 'ArrowDown']
|
|
|
66
66
|
const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* @param {
|
|
69
|
+
* @param {SweetAlert} instance
|
|
70
70
|
* @param {KeyboardEvent} event
|
|
71
71
|
* @param {Function} dismissWith
|
|
72
72
|
*/
|
|
@@ -111,7 +111,7 @@ const keydownHandler = (instance, event, dismissWith) => {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
* @param {
|
|
114
|
+
* @param {SweetAlert} instance
|
|
115
115
|
* @param {KeyboardEvent} event
|
|
116
116
|
* @param {SweetAlertOptions} innerParams
|
|
117
117
|
*/
|
package/src/privateProps.js
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* const {value: firstName} = await TextPrompt('What is your first name?')
|
|
15
15
|
* const {value: lastName} = await TextPrompt('What is your last name?')
|
|
16
16
|
*
|
|
17
|
-
* @param mixinParams
|
|
17
|
+
* @param {SweetAlertOptions} mixinParams
|
|
18
|
+
* @returns {SweetAlert}
|
|
18
19
|
*/
|
|
19
20
|
export function mixin(mixinParams) {
|
|
20
21
|
class MixinSwal extends this {
|
|
@@ -22,6 +23,6 @@ export function mixin(mixinParams) {
|
|
|
22
23
|
return super._main(params, Object.assign({}, mixinParams, priorityMixinParams))
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
// @ts-ignore
|
|
26
27
|
return MixinSwal
|
|
27
28
|
}
|
package/src/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import('
|
|
2
|
+
* @typedef { import('./SweetAlert').SweetAlert } SweetAlert
|
|
3
3
|
* @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
|
|
4
4
|
* @typedef { import('sweetalert2').SweetAlertIcon } SweetAlertIcon
|
|
5
5
|
* @typedef { import('sweetalert2').SweetAlertInput } SweetAlertInput
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @typedef GlobalState
|
|
15
|
-
* @property {
|
|
15
|
+
* @property {SweetAlert} [currentInstance]
|
|
16
16
|
* @property {Element} [previousActiveElement]
|
|
17
17
|
* @property {Timer} [timeout]
|
|
18
18
|
* @property {NodeJS.Timeout} [restoreFocusTimeout]
|
|
@@ -9,7 +9,7 @@ import * as dom from './index.js'
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {SweetAlert} instance
|
|
13
13
|
* @param {SweetAlertOptions} params
|
|
14
14
|
*/
|
|
15
15
|
export const handleInputOptionsAndValue = (instance, params) => {
|
|
@@ -25,7 +25,7 @@ export const handleInputOptionsAndValue = (instance, params) => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @param {
|
|
28
|
+
* @param {SweetAlert} instance
|
|
29
29
|
* @param {SweetAlertOptions} innerParams
|
|
30
30
|
* @returns {string | number | File | FileList | null}
|
|
31
31
|
*/
|
|
@@ -66,7 +66,7 @@ const getFileValue = (input) =>
|
|
|
66
66
|
input.files.length ? (input.getAttribute('multiple') !== null ? input.files : input.files[0]) : null
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* @param {
|
|
69
|
+
* @param {SweetAlert} instance
|
|
70
70
|
* @param {SweetAlertOptions} params
|
|
71
71
|
*/
|
|
72
72
|
const handleInputOptions = (instance, params) => {
|
|
@@ -91,7 +91,7 @@ const handleInputOptions = (instance, params) => {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* @param {
|
|
94
|
+
* @param {SweetAlert} instance
|
|
95
95
|
* @param {SweetAlertOptions} params
|
|
96
96
|
*/
|
|
97
97
|
const handleInputValue = (instance, params) => {
|
|
@@ -11,7 +11,7 @@ import { renderProgressSteps } from './renderProgressSteps.js'
|
|
|
11
11
|
import { renderTitle } from './renderTitle.js'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @param {
|
|
14
|
+
* @param {SweetAlert} instance
|
|
15
15
|
* @param {SweetAlertOptions} params
|
|
16
16
|
*/
|
|
17
17
|
export const render = (instance, params) => {
|
|
@@ -3,7 +3,7 @@ import * as dom from '../../dom/index.js'
|
|
|
3
3
|
import { capitalizeFirstLetter } from '../../utils.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {SweetAlert} instance
|
|
7
7
|
* @param {SweetAlertOptions} params
|
|
8
8
|
*/
|
|
9
9
|
export const renderActions = (instance, params) => {
|
|
@@ -13,7 +13,7 @@ import { error, isPromise, warn } from '../../utils.js'
|
|
|
13
13
|
const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* @param {
|
|
16
|
+
* @param {SweetAlert} instance
|
|
17
17
|
* @param {SweetAlertOptions} params
|
|
18
18
|
*/
|
|
19
19
|
export const renderInput = (instance, params) => {
|