@panneau/modal-confirm 4.0.39 → 4.0.40-alpha.3
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/index.d.ts +2 -2
- package/dist/index.js +156 -50
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface ConfirmModalProps {
|
|
|
5
5
|
id: string | number;
|
|
6
6
|
title?: ReactNode | null;
|
|
7
7
|
onConfirm?: (() => void) | null;
|
|
8
|
-
|
|
8
|
+
onClosed?: (() => void) | null;
|
|
9
9
|
confirmButton?: {
|
|
10
10
|
label?: string;
|
|
11
11
|
} | null;
|
|
@@ -15,6 +15,6 @@ interface ConfirmModalProps {
|
|
|
15
15
|
className?: string | null;
|
|
16
16
|
children?: ReactNode | null;
|
|
17
17
|
}
|
|
18
|
-
declare function ConfirmModal({ id, title, onConfirm,
|
|
18
|
+
declare function ConfirmModal({ id, title, onConfirm, onClosed, confirmButton, cancelButton, className, children, }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
|
|
19
19
|
|
|
20
20
|
export { ConfirmModal as default };
|
package/dist/index.js
CHANGED
|
@@ -1,57 +1,163 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { FormattedMessage } from 'react-intl';
|
|
3
4
|
import Dialog from '@panneau/modal-dialog';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
function ConfirmModal(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onConfirm
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
7
|
+
function ConfirmModal(t0) {
|
|
8
|
+
const $ = c(24);
|
|
9
|
+
const {
|
|
10
|
+
id,
|
|
11
|
+
title: t1,
|
|
12
|
+
onConfirm: t2,
|
|
13
|
+
onClosed: t3,
|
|
14
|
+
confirmButton: t4,
|
|
15
|
+
cancelButton: t5,
|
|
16
|
+
className: t6,
|
|
17
|
+
children: t7
|
|
18
|
+
} = t0;
|
|
19
|
+
const title = t1 === undefined ? null : t1;
|
|
20
|
+
const onConfirm = t2 === undefined ? null : t2;
|
|
21
|
+
const onClosed = t3 === undefined ? null : t3;
|
|
22
|
+
const confirmButton = t4 === undefined ? null : t4;
|
|
23
|
+
const cancelButton = t5 === undefined ? null : t5;
|
|
24
|
+
const className = t6 === undefined ? null : t6;
|
|
25
|
+
const children = t7 === undefined ? null : t7;
|
|
26
|
+
const [opened, setOpened] = useState(true);
|
|
27
|
+
const [confirmed, setConfirmed] = useState(false);
|
|
28
|
+
let t8;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t8 = () => {
|
|
31
|
+
setOpened(false);
|
|
32
|
+
};
|
|
33
|
+
$[0] = t8;
|
|
34
|
+
} else {
|
|
35
|
+
t8 = $[0];
|
|
36
|
+
}
|
|
37
|
+
const requestClose = t8;
|
|
38
|
+
let t9;
|
|
39
|
+
if ($[1] !== confirmed || $[2] !== onClosed || $[3] !== onConfirm) {
|
|
40
|
+
t9 = () => {
|
|
41
|
+
if (confirmed && onConfirm !== null) {
|
|
42
|
+
onConfirm();
|
|
43
|
+
} else {
|
|
44
|
+
if (!confirmed && onClosed !== null) {
|
|
45
|
+
onClosed();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
$[1] = confirmed;
|
|
50
|
+
$[2] = onClosed;
|
|
51
|
+
$[3] = onConfirm;
|
|
52
|
+
$[4] = t9;
|
|
53
|
+
} else {
|
|
54
|
+
t9 = $[4];
|
|
55
|
+
}
|
|
56
|
+
const onModalClosed = t9;
|
|
57
|
+
let t10;
|
|
58
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
59
|
+
t10 = () => {
|
|
60
|
+
setConfirmed(false);
|
|
61
|
+
setOpened(false);
|
|
62
|
+
};
|
|
63
|
+
$[5] = t10;
|
|
64
|
+
} else {
|
|
65
|
+
t10 = $[5];
|
|
66
|
+
}
|
|
67
|
+
const onClickCancel = t10;
|
|
68
|
+
let t11;
|
|
69
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t11 = () => {
|
|
71
|
+
setConfirmed(true);
|
|
72
|
+
setOpened(false);
|
|
73
|
+
};
|
|
74
|
+
$[6] = t11;
|
|
75
|
+
} else {
|
|
76
|
+
t11 = $[6];
|
|
77
|
+
}
|
|
78
|
+
const onClickConfirm = t11;
|
|
79
|
+
let t12;
|
|
80
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
81
|
+
t12 = /*#__PURE__*/jsx(FormattedMessage, {
|
|
82
|
+
id: "yhU8J6"
|
|
83
|
+
});
|
|
84
|
+
$[7] = t12;
|
|
85
|
+
} else {
|
|
86
|
+
t12 = $[7];
|
|
87
|
+
}
|
|
88
|
+
let t13;
|
|
89
|
+
if ($[8] !== cancelButton) {
|
|
90
|
+
t13 = {
|
|
91
|
+
id: "no",
|
|
92
|
+
name: "no",
|
|
93
|
+
label: t12,
|
|
94
|
+
theme: "secondary",
|
|
95
|
+
onClick: onClickCancel,
|
|
96
|
+
...cancelButton
|
|
97
|
+
};
|
|
98
|
+
$[8] = cancelButton;
|
|
99
|
+
$[9] = t13;
|
|
100
|
+
} else {
|
|
101
|
+
t13 = $[9];
|
|
102
|
+
}
|
|
103
|
+
let t14;
|
|
104
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
105
|
+
t14 = /*#__PURE__*/jsx(FormattedMessage, {
|
|
106
|
+
id: "3ebjtX"
|
|
107
|
+
});
|
|
108
|
+
$[10] = t14;
|
|
109
|
+
} else {
|
|
110
|
+
t14 = $[10];
|
|
111
|
+
}
|
|
112
|
+
let t15;
|
|
113
|
+
if ($[11] !== confirmButton) {
|
|
114
|
+
t15 = {
|
|
115
|
+
id: "yes",
|
|
116
|
+
name: "yes",
|
|
117
|
+
label: t14,
|
|
118
|
+
theme: "primary",
|
|
119
|
+
onClick: onClickConfirm,
|
|
120
|
+
...confirmButton
|
|
121
|
+
};
|
|
122
|
+
$[11] = confirmButton;
|
|
123
|
+
$[12] = t15;
|
|
124
|
+
} else {
|
|
125
|
+
t15 = $[12];
|
|
126
|
+
}
|
|
127
|
+
let t16;
|
|
128
|
+
if ($[13] !== t13 || $[14] !== t15) {
|
|
129
|
+
t16 = [t13, t15];
|
|
130
|
+
$[13] = t13;
|
|
131
|
+
$[14] = t15;
|
|
132
|
+
$[15] = t16;
|
|
133
|
+
} else {
|
|
134
|
+
t16 = $[15];
|
|
135
|
+
}
|
|
136
|
+
let t17;
|
|
137
|
+
if ($[16] !== children || $[17] !== className || $[18] !== id || $[19] !== onModalClosed || $[20] !== opened || $[21] !== t16 || $[22] !== title) {
|
|
138
|
+
t17 = /*#__PURE__*/jsx(Dialog, {
|
|
139
|
+
id: id,
|
|
140
|
+
title: title,
|
|
141
|
+
size: "lg",
|
|
142
|
+
visible: opened,
|
|
143
|
+
requestClose: requestClose,
|
|
144
|
+
onClosed: onModalClosed,
|
|
145
|
+
className: className,
|
|
146
|
+
buttons: t16,
|
|
147
|
+
children: children
|
|
148
|
+
});
|
|
149
|
+
$[16] = children;
|
|
150
|
+
$[17] = className;
|
|
151
|
+
$[18] = id;
|
|
152
|
+
$[19] = onModalClosed;
|
|
153
|
+
$[20] = opened;
|
|
154
|
+
$[21] = t16;
|
|
155
|
+
$[22] = title;
|
|
156
|
+
$[23] = t17;
|
|
157
|
+
} else {
|
|
158
|
+
t17 = $[23];
|
|
159
|
+
}
|
|
160
|
+
return t17;
|
|
55
161
|
}
|
|
56
162
|
|
|
57
163
|
export { ConfirmModal as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/modal-confirm",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.40-alpha.3",
|
|
4
4
|
"description": "Confirm modal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.28.6",
|
|
55
|
-
"@panneau/core": "^4.0.
|
|
56
|
-
"@panneau/intl": "^4.0.
|
|
57
|
-
"@panneau/modal-dialog": "^4.0.
|
|
58
|
-
"@panneau/themes": "^4.0.
|
|
55
|
+
"@panneau/core": "^4.0.40-alpha.3",
|
|
56
|
+
"@panneau/intl": "^4.0.40-alpha.3",
|
|
57
|
+
"@panneau/modal-dialog": "^4.0.40-alpha.3",
|
|
58
|
+
"@panneau/themes": "^4.0.40-alpha.3",
|
|
59
59
|
"classnames": "^2.5.1",
|
|
60
60
|
"lodash": "^4.17.21",
|
|
61
61
|
"react-intl": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "1735964a2702ae0480b642225286e4184f36680d"
|
|
67
67
|
}
|