@panneau/modal-form 4.0.49 → 4.0.52
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 +7 -17
- package/dist/index.js +151 -110
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ForwardedRef } from 'react';
|
|
3
|
+
import { FormProps } from '@panneau/form';
|
|
4
|
+
import { DialogModalProps } from '@panneau/modal-dialog';
|
|
4
5
|
|
|
5
|
-
interface
|
|
6
|
-
id: string | number;
|
|
7
|
-
title?: ReactNode | null;
|
|
8
|
-
name?: string | null;
|
|
9
|
-
fields?: Field[] | null;
|
|
10
|
-
action?: string | null;
|
|
11
|
-
type?: string;
|
|
12
|
-
onComplete?: ((value: unknown) => void) | null;
|
|
13
|
-
onCancel?: (() => void) | null;
|
|
14
|
-
onClosed?: (() => void) | null;
|
|
15
|
-
submitButtonLabel?: ReactNode | null;
|
|
6
|
+
interface FormModalProps extends Omit<FormProps, 'id' | 'title'>, DialogModalProps {
|
|
16
7
|
withoutCloseOnComplete?: boolean;
|
|
17
|
-
className?: string | null;
|
|
18
|
-
children?: ReactNode | null;
|
|
19
8
|
formRef?: ForwardedRef<HTMLFormElement> | null;
|
|
20
9
|
}
|
|
21
|
-
declare function
|
|
10
|
+
declare function FormModal({ id, title, fields, size, visible, requestClose: customRequestClose, onComplete, onCancel, onClosed, withoutCloseOnComplete, className, children, formRef: customFormRef, submitButtonLabel, cancelButtonLabel, withCancelButton, withoutSubmitButton, ...props }: FormModalProps): react_jsx_runtime.JSX.Element;
|
|
22
11
|
|
|
23
|
-
export {
|
|
12
|
+
export { FormModal as default };
|
|
13
|
+
export type { FormModalProps };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useState, useRef } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { mergeRefs } from '@panneau/core/utils';
|
|
4
5
|
import Form from '@panneau/form';
|
|
5
6
|
import Dialog from '@panneau/modal-dialog';
|
|
6
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
|
-
function
|
|
9
|
-
const $ = c(
|
|
9
|
+
function FormModal(t0) {
|
|
10
|
+
const $ = c(53);
|
|
10
11
|
let id;
|
|
11
12
|
let props;
|
|
12
13
|
let t1;
|
|
@@ -14,6 +15,9 @@ function ModalForm(t0) {
|
|
|
14
15
|
let t11;
|
|
15
16
|
let t12;
|
|
16
17
|
let t13;
|
|
18
|
+
let t14;
|
|
19
|
+
let t15;
|
|
20
|
+
let t16;
|
|
17
21
|
let t2;
|
|
18
22
|
let t3;
|
|
19
23
|
let t4;
|
|
@@ -26,18 +30,21 @@ function ModalForm(t0) {
|
|
|
26
30
|
({
|
|
27
31
|
id,
|
|
28
32
|
title: t1,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
fields: t2,
|
|
34
|
+
size: t3,
|
|
35
|
+
visible: t4,
|
|
36
|
+
requestClose: t5,
|
|
33
37
|
onComplete: t6,
|
|
34
38
|
onCancel: t7,
|
|
35
39
|
onClosed: t8,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
withoutCloseOnComplete: t9,
|
|
41
|
+
className: t10,
|
|
42
|
+
children: t11,
|
|
43
|
+
formRef: t12,
|
|
44
|
+
submitButtonLabel: t13,
|
|
45
|
+
cancelButtonLabel: t14,
|
|
46
|
+
withCancelButton: t15,
|
|
47
|
+
withoutSubmitButton: t16,
|
|
41
48
|
...props
|
|
42
49
|
} = t0);
|
|
43
50
|
$[0] = t0;
|
|
@@ -48,14 +55,17 @@ function ModalForm(t0) {
|
|
|
48
55
|
$[5] = t11;
|
|
49
56
|
$[6] = t12;
|
|
50
57
|
$[7] = t13;
|
|
51
|
-
$[8] =
|
|
52
|
-
$[9] =
|
|
53
|
-
$[10] =
|
|
54
|
-
$[11] =
|
|
55
|
-
$[12] =
|
|
56
|
-
$[13] =
|
|
57
|
-
$[14] =
|
|
58
|
-
$[15] =
|
|
58
|
+
$[8] = t14;
|
|
59
|
+
$[9] = t15;
|
|
60
|
+
$[10] = t16;
|
|
61
|
+
$[11] = t2;
|
|
62
|
+
$[12] = t3;
|
|
63
|
+
$[13] = t4;
|
|
64
|
+
$[14] = t5;
|
|
65
|
+
$[15] = t6;
|
|
66
|
+
$[16] = t7;
|
|
67
|
+
$[17] = t8;
|
|
68
|
+
$[18] = t9;
|
|
59
69
|
} else {
|
|
60
70
|
id = $[1];
|
|
61
71
|
props = $[2];
|
|
@@ -64,135 +74,166 @@ function ModalForm(t0) {
|
|
|
64
74
|
t11 = $[5];
|
|
65
75
|
t12 = $[6];
|
|
66
76
|
t13 = $[7];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
t14 = $[8];
|
|
78
|
+
t15 = $[9];
|
|
79
|
+
t16 = $[10];
|
|
80
|
+
t2 = $[11];
|
|
81
|
+
t3 = $[12];
|
|
82
|
+
t4 = $[13];
|
|
83
|
+
t5 = $[14];
|
|
84
|
+
t6 = $[15];
|
|
85
|
+
t7 = $[16];
|
|
86
|
+
t8 = $[17];
|
|
87
|
+
t9 = $[18];
|
|
75
88
|
}
|
|
76
89
|
const title = t1 === undefined ? null : t1;
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
90
|
+
const fields = t2 === undefined ? null : t2;
|
|
91
|
+
const size = t3 === undefined ? "lg" : t3;
|
|
92
|
+
const visible = t4 === undefined ? null : t4;
|
|
93
|
+
const customRequestClose = t5 === undefined ? null : t5;
|
|
81
94
|
const onComplete = t6 === undefined ? null : t6;
|
|
82
95
|
const onCancel = t7 === undefined ? null : t7;
|
|
83
96
|
const onClosed = t8 === undefined ? null : t8;
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
97
|
+
const withoutCloseOnComplete = t9 === undefined ? false : t9;
|
|
98
|
+
const className = t10 === undefined ? null : t10;
|
|
99
|
+
const children = t11 === undefined ? null : t11;
|
|
100
|
+
const customFormRef = t12 === undefined ? null : t12;
|
|
101
|
+
const submitButtonLabel = t13 === undefined ? null : t13;
|
|
102
|
+
const cancelButtonLabel = t14 === undefined ? null : t14;
|
|
103
|
+
const withCancelButton = t15 === undefined ? true : t15;
|
|
104
|
+
const withoutSubmitButton = t16 === undefined ? false : t16;
|
|
89
105
|
const [opened, setOpened] = useState(true);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
const formRef = useRef(null);
|
|
107
|
+
let t17;
|
|
108
|
+
if ($[19] !== customRequestClose) {
|
|
109
|
+
t17 = customRequestClose ?? (() => {
|
|
93
110
|
setOpened(false);
|
|
94
|
-
};
|
|
95
|
-
$[
|
|
111
|
+
});
|
|
112
|
+
$[19] = customRequestClose;
|
|
113
|
+
$[20] = t17;
|
|
96
114
|
} else {
|
|
97
|
-
|
|
115
|
+
t17 = $[20];
|
|
98
116
|
}
|
|
99
|
-
const requestClose =
|
|
100
|
-
let
|
|
101
|
-
if ($[
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
const requestClose = t17;
|
|
118
|
+
let t18;
|
|
119
|
+
if ($[21] !== onCancel || $[22] !== requestClose) {
|
|
120
|
+
t18 = () => {
|
|
121
|
+
requestClose();
|
|
104
122
|
if (onCancel !== null) {
|
|
105
123
|
onCancel();
|
|
106
124
|
}
|
|
107
125
|
};
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
126
|
+
$[21] = onCancel;
|
|
127
|
+
$[22] = requestClose;
|
|
128
|
+
$[23] = t18;
|
|
110
129
|
} else {
|
|
111
|
-
|
|
130
|
+
t18 = $[23];
|
|
112
131
|
}
|
|
113
|
-
const onFormCancel =
|
|
114
|
-
let
|
|
115
|
-
if ($[
|
|
116
|
-
|
|
132
|
+
const onFormCancel = t18;
|
|
133
|
+
let t19;
|
|
134
|
+
if ($[24] !== onComplete || $[25] !== requestClose || $[26] !== withoutCloseOnComplete) {
|
|
135
|
+
t19 = value => {
|
|
117
136
|
if (!withoutCloseOnComplete) {
|
|
118
|
-
|
|
137
|
+
requestClose();
|
|
119
138
|
}
|
|
120
139
|
if (onComplete !== null) {
|
|
121
140
|
onComplete(value);
|
|
122
141
|
}
|
|
123
142
|
};
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
143
|
+
$[24] = onComplete;
|
|
144
|
+
$[25] = requestClose;
|
|
145
|
+
$[26] = withoutCloseOnComplete;
|
|
146
|
+
$[27] = t19;
|
|
127
147
|
} else {
|
|
128
|
-
|
|
148
|
+
t19 = $[27];
|
|
129
149
|
}
|
|
130
|
-
const onFormComplete =
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
name
|
|
150
|
+
const onFormComplete = t19;
|
|
151
|
+
let t20;
|
|
152
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
153
|
+
t20 = () => {
|
|
154
|
+
if (formRef.current !== null) {
|
|
155
|
+
formRef.current.requestSubmit();
|
|
137
156
|
}
|
|
138
|
-
}
|
|
157
|
+
};
|
|
158
|
+
$[28] = t20;
|
|
159
|
+
} else {
|
|
160
|
+
t20 = $[28];
|
|
161
|
+
}
|
|
162
|
+
const onClickSubmit = t20;
|
|
163
|
+
let t21;
|
|
164
|
+
if ($[29] !== title) {
|
|
165
|
+
t21 = title || /*#__PURE__*/jsx(FormattedMessage, {
|
|
139
166
|
id: "T/NPHK"
|
|
140
|
-
})
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[24] = t17;
|
|
167
|
+
});
|
|
168
|
+
$[29] = title;
|
|
169
|
+
$[30] = t21;
|
|
144
170
|
} else {
|
|
145
|
-
|
|
171
|
+
t21 = $[30];
|
|
146
172
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
173
|
+
const t22 = visible ?? opened;
|
|
174
|
+
const t23 = !withoutSubmitButton;
|
|
175
|
+
let t24;
|
|
176
|
+
if ($[31] !== customFormRef) {
|
|
177
|
+
t24 = mergeRefs(formRef, customFormRef);
|
|
178
|
+
$[31] = customFormRef;
|
|
179
|
+
$[32] = t24;
|
|
180
|
+
} else {
|
|
181
|
+
t24 = $[32];
|
|
182
|
+
}
|
|
183
|
+
let t25;
|
|
184
|
+
if ($[33] !== fields || $[34] !== onFormCancel || $[35] !== onFormComplete || $[36] !== props || $[37] !== t24) {
|
|
185
|
+
t25 = /*#__PURE__*/jsx(Form, {
|
|
186
|
+
withoutActions: true,
|
|
150
187
|
...props,
|
|
151
|
-
ref:
|
|
188
|
+
ref: t24,
|
|
152
189
|
fields: fields,
|
|
153
|
-
action: action,
|
|
154
|
-
type: type,
|
|
155
|
-
buttonSize: "md",
|
|
156
190
|
onComplete: onFormComplete,
|
|
157
|
-
onCancel: onFormCancel
|
|
158
|
-
submitButtonLabel: submitButtonLabel
|
|
191
|
+
onCancel: onFormCancel
|
|
159
192
|
});
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[31] = submitButtonLabel;
|
|
167
|
-
$[32] = type;
|
|
168
|
-
$[33] = t18;
|
|
193
|
+
$[33] = fields;
|
|
194
|
+
$[34] = onFormCancel;
|
|
195
|
+
$[35] = onFormComplete;
|
|
196
|
+
$[36] = props;
|
|
197
|
+
$[37] = t24;
|
|
198
|
+
$[38] = t25;
|
|
169
199
|
} else {
|
|
170
|
-
|
|
200
|
+
t25 = $[38];
|
|
171
201
|
}
|
|
172
|
-
let
|
|
173
|
-
if ($[
|
|
174
|
-
|
|
202
|
+
let t26;
|
|
203
|
+
if ($[39] !== cancelButtonLabel || $[40] !== children || $[41] !== className || $[42] !== id || $[43] !== onClosed || $[44] !== requestClose || $[45] !== size || $[46] !== submitButtonLabel || $[47] !== t21 || $[48] !== t22 || $[49] !== t23 || $[50] !== t25 || $[51] !== withCancelButton) {
|
|
204
|
+
t26 = /*#__PURE__*/jsxs(Dialog, {
|
|
175
205
|
id: id,
|
|
176
|
-
title:
|
|
177
|
-
size:
|
|
178
|
-
visible:
|
|
206
|
+
title: t21,
|
|
207
|
+
size: size,
|
|
208
|
+
visible: t22,
|
|
209
|
+
withCancelButton: withCancelButton,
|
|
210
|
+
withSubmitButton: t23,
|
|
179
211
|
requestClose: requestClose,
|
|
180
212
|
onClosed: onClosed,
|
|
213
|
+
onClickSubmit: onClickSubmit,
|
|
181
214
|
className: className,
|
|
182
|
-
|
|
215
|
+
submitButtonLabel: submitButtonLabel,
|
|
216
|
+
cancelButtonLabel: cancelButtonLabel,
|
|
217
|
+
children: [children, t25]
|
|
183
218
|
});
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
219
|
+
$[39] = cancelButtonLabel;
|
|
220
|
+
$[40] = children;
|
|
221
|
+
$[41] = className;
|
|
222
|
+
$[42] = id;
|
|
223
|
+
$[43] = onClosed;
|
|
224
|
+
$[44] = requestClose;
|
|
225
|
+
$[45] = size;
|
|
226
|
+
$[46] = submitButtonLabel;
|
|
227
|
+
$[47] = t21;
|
|
228
|
+
$[48] = t22;
|
|
229
|
+
$[49] = t23;
|
|
230
|
+
$[50] = t25;
|
|
231
|
+
$[51] = withCancelButton;
|
|
232
|
+
$[52] = t26;
|
|
192
233
|
} else {
|
|
193
|
-
|
|
234
|
+
t26 = $[52];
|
|
194
235
|
}
|
|
195
|
-
return
|
|
236
|
+
return t26;
|
|
196
237
|
}
|
|
197
238
|
|
|
198
|
-
export {
|
|
239
|
+
export { FormModal as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/modal-form",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.52",
|
|
4
4
|
"description": "Resource form modal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.28.6",
|
|
55
|
-
"@panneau/core": "^4.0.
|
|
56
|
-
"@panneau/form": "^4.0.
|
|
57
|
-
"@panneau/intl": "^4.0.
|
|
58
|
-
"@panneau/modal-dialog": "^4.0.
|
|
59
|
-
"@panneau/themes": "^4.0.
|
|
55
|
+
"@panneau/core": "^4.0.50",
|
|
56
|
+
"@panneau/form": "^4.0.50",
|
|
57
|
+
"@panneau/intl": "^4.0.50",
|
|
58
|
+
"@panneau/modal-dialog": "^4.0.50",
|
|
59
|
+
"@panneau/themes": "^4.0.50",
|
|
60
60
|
"classnames": "^2.5.1",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
62
62
|
"react-intl": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0"
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "280155c90cf1dfc39e0c36c76ef8bc2fea627041"
|
|
68
68
|
}
|