react-confirm-alert 2.5.1 → 2.7.0
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 +3 -1
- package/index.d.ts +2 -0
- package/lib/index.js +17 -6
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -35,8 +35,10 @@ const options = {
|
|
|
35
35
|
closeOnEscape: true,
|
|
36
36
|
closeOnClickOutside: true,
|
|
37
37
|
willUnmount: () => {},
|
|
38
|
+
afterClose: () => {}
|
|
38
39
|
onClickOutside: () => {},
|
|
39
|
-
onKeypressEscape: () => {}
|
|
40
|
+
onKeypressEscape: () => {},
|
|
41
|
+
overlayClassName: "overlay-custom-class-name"
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
confirmAlert(options);
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare module 'react-confirm-alert' {
|
|
|
5
5
|
buttons?: Array<{
|
|
6
6
|
label: string
|
|
7
7
|
onClick: () => void
|
|
8
|
+
className?: string
|
|
8
9
|
}>
|
|
9
10
|
childrenElement?: () => React.ReactNode
|
|
10
11
|
customUI?: (customUiOptions: {
|
|
@@ -17,6 +18,7 @@ declare module 'react-confirm-alert' {
|
|
|
17
18
|
willUnmount?: () => void
|
|
18
19
|
onClickOutside?: () => void
|
|
19
20
|
onKeypressEscape?: () => void
|
|
21
|
+
overlayClassName?: string
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export function confirmAlert(options: ReactConfirmAlertProps): void
|
package/lib/index.js
CHANGED
|
@@ -58,9 +58,11 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
58
58
|
_this.close();
|
|
59
59
|
}
|
|
60
60
|
}, _this.close = function () {
|
|
61
|
+
var afterClose = _this.props.afterClose;
|
|
62
|
+
|
|
61
63
|
removeBodyClass();
|
|
62
64
|
removeElementReconfirm();
|
|
63
|
-
removeSVGBlurReconfirm();
|
|
65
|
+
removeSVGBlurReconfirm(afterClose);
|
|
64
66
|
}, _this.keyboardClose = function (event) {
|
|
65
67
|
var _this$props2 = _this.props,
|
|
66
68
|
closeOnEscape = _this$props2.closeOnEscape,
|
|
@@ -105,13 +107,14 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
105
107
|
message = _props.message,
|
|
106
108
|
buttons = _props.buttons,
|
|
107
109
|
childrenElement = _props.childrenElement,
|
|
108
|
-
customUI = _props.customUI
|
|
110
|
+
customUI = _props.customUI,
|
|
111
|
+
overlayClassName = _props.overlayClassName;
|
|
109
112
|
|
|
110
113
|
|
|
111
114
|
return _react2.default.createElement(
|
|
112
115
|
'div',
|
|
113
116
|
{
|
|
114
|
-
className: 'react-confirm-alert-overlay',
|
|
117
|
+
className: 'react-confirm-alert-overlay ' + overlayClassName,
|
|
115
118
|
ref: function ref(dom) {
|
|
116
119
|
return _this2.overlay = dom;
|
|
117
120
|
},
|
|
@@ -159,8 +162,10 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
159
162
|
closeOnClickOutside: _propTypes2.default.bool,
|
|
160
163
|
closeOnEscape: _propTypes2.default.bool,
|
|
161
164
|
willUnmount: _propTypes2.default.func,
|
|
165
|
+
afterClose: _propTypes2.default.func,
|
|
162
166
|
onClickOutside: _propTypes2.default.func,
|
|
163
|
-
onKeypressEscape: _propTypes2.default.func
|
|
167
|
+
onKeypressEscape: _propTypes2.default.func,
|
|
168
|
+
overlayClassName: _propTypes2.default.string
|
|
164
169
|
}, _class.defaultProps = {
|
|
165
170
|
buttons: [{
|
|
166
171
|
label: 'Cancel',
|
|
@@ -183,6 +188,9 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
183
188
|
willUnmount: function willUnmount() {
|
|
184
189
|
return null;
|
|
185
190
|
},
|
|
191
|
+
afterClose: function afterClose() {
|
|
192
|
+
return null;
|
|
193
|
+
},
|
|
186
194
|
onClickOutside: function onClickOutside() {
|
|
187
195
|
return null;
|
|
188
196
|
},
|
|
@@ -213,10 +221,13 @@ function createSVGBlurReconfirm() {
|
|
|
213
221
|
document.body.appendChild(svgElem);
|
|
214
222
|
}
|
|
215
223
|
|
|
216
|
-
function removeSVGBlurReconfirm() {
|
|
224
|
+
function removeSVGBlurReconfirm(afterClose) {
|
|
217
225
|
var svg = document.getElementById('react-confirm-alert-firm-svg');
|
|
218
|
-
|
|
226
|
+
if (svg) {
|
|
227
|
+
svg.parentNode.removeChild(svg);
|
|
228
|
+
}
|
|
219
229
|
document.body.children[0].classList.remove('react-confirm-alert-blur');
|
|
230
|
+
afterClose();
|
|
220
231
|
}
|
|
221
232
|
|
|
222
233
|
function createElementReconfirm(properties) {
|