@panneau/modal-form 4.0.49 → 4.0.50
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 +6 -10
- package/dist/index.js +140 -96
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, ForwardedRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { FormProps } from '@panneau/form';
|
|
4
|
+
import { DialogProps } from '@panneau/modal-dialog';
|
|
4
5
|
|
|
5
|
-
interface
|
|
6
|
-
id: string | number;
|
|
7
|
-
title?: ReactNode | null;
|
|
6
|
+
interface FormModalProps extends Omit<FormProps, 'id' | 'title'>, Pick<DialogProps, 'id' | 'title' | 'size'> {
|
|
8
7
|
name?: string | null;
|
|
9
|
-
fields?: Field[] | null;
|
|
10
|
-
action?: string | null;
|
|
11
8
|
type?: string;
|
|
12
|
-
onComplete?: ((value: unknown) => void) | null;
|
|
13
9
|
onCancel?: (() => void) | null;
|
|
14
10
|
onClosed?: (() => void) | null;
|
|
15
|
-
submitButtonLabel?: ReactNode | null;
|
|
16
11
|
withoutCloseOnComplete?: boolean;
|
|
17
12
|
className?: string | null;
|
|
18
13
|
children?: ReactNode | null;
|
|
19
14
|
formRef?: ForwardedRef<HTMLFormElement> | null;
|
|
20
15
|
}
|
|
21
|
-
declare function
|
|
16
|
+
declare function FormModal({ id, title, name, fields, type, size, onComplete, onCancel, onClosed, withoutCloseOnComplete, className, children, formRef: customFormRef, submitButtonLabel, cancelButtonLabel, withCancelButton, withoutSubmitButton, ...props }: FormModalProps): react_jsx_runtime.JSX.Element;
|
|
22
17
|
|
|
23
|
-
export {
|
|
18
|
+
export { FormModal as default };
|
|
19
|
+
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(51);
|
|
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;
|
|
@@ -28,16 +32,19 @@ function ModalForm(t0) {
|
|
|
28
32
|
title: t1,
|
|
29
33
|
name: t2,
|
|
30
34
|
fields: t3,
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
type: t4,
|
|
36
|
+
size: 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,56 +74,63 @@ 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
90
|
const name = t2 === undefined ? null : t2;
|
|
78
91
|
const fields = t3 === undefined ? null : t3;
|
|
79
|
-
const
|
|
80
|
-
const
|
|
92
|
+
const type = t4 === undefined ? "normal" : t4;
|
|
93
|
+
const size = t5 === undefined ? "lg" : 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] === Symbol.for("react.memo_cache_sentinel")) {
|
|
109
|
+
t17 = () => {
|
|
93
110
|
setOpened(false);
|
|
94
111
|
};
|
|
95
|
-
$[
|
|
112
|
+
$[19] = t17;
|
|
96
113
|
} else {
|
|
97
|
-
|
|
114
|
+
t17 = $[19];
|
|
98
115
|
}
|
|
99
|
-
const requestClose =
|
|
100
|
-
let
|
|
101
|
-
if ($[
|
|
102
|
-
|
|
116
|
+
const requestClose = t17;
|
|
117
|
+
let t18;
|
|
118
|
+
if ($[20] !== onCancel) {
|
|
119
|
+
t18 = () => {
|
|
103
120
|
setOpened(false);
|
|
104
121
|
if (onCancel !== null) {
|
|
105
122
|
onCancel();
|
|
106
123
|
}
|
|
107
124
|
};
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
125
|
+
$[20] = onCancel;
|
|
126
|
+
$[21] = t18;
|
|
110
127
|
} else {
|
|
111
|
-
|
|
128
|
+
t18 = $[21];
|
|
112
129
|
}
|
|
113
|
-
const onFormCancel =
|
|
114
|
-
let
|
|
115
|
-
if ($[
|
|
116
|
-
|
|
130
|
+
const onFormCancel = t18;
|
|
131
|
+
let t19;
|
|
132
|
+
if ($[22] !== onComplete || $[23] !== withoutCloseOnComplete) {
|
|
133
|
+
t19 = value => {
|
|
117
134
|
if (!withoutCloseOnComplete) {
|
|
118
135
|
setOpened(false);
|
|
119
136
|
}
|
|
@@ -121,16 +138,28 @@ function ModalForm(t0) {
|
|
|
121
138
|
onComplete(value);
|
|
122
139
|
}
|
|
123
140
|
};
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
141
|
+
$[22] = onComplete;
|
|
142
|
+
$[23] = withoutCloseOnComplete;
|
|
143
|
+
$[24] = t19;
|
|
127
144
|
} else {
|
|
128
|
-
|
|
145
|
+
t19 = $[24];
|
|
129
146
|
}
|
|
130
|
-
const onFormComplete =
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
147
|
+
const onFormComplete = t19;
|
|
148
|
+
let t20;
|
|
149
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
150
|
+
t20 = () => {
|
|
151
|
+
if (formRef.current !== null) {
|
|
152
|
+
formRef.current.submit();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
$[25] = t20;
|
|
156
|
+
} else {
|
|
157
|
+
t20 = $[25];
|
|
158
|
+
}
|
|
159
|
+
const onClickSubmit = t20;
|
|
160
|
+
let t21;
|
|
161
|
+
if ($[26] !== name || $[27] !== title) {
|
|
162
|
+
t21 = title || (name !== null ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
134
163
|
id: "smqUAV",
|
|
135
164
|
values: {
|
|
136
165
|
name
|
|
@@ -138,61 +167,76 @@ function ModalForm(t0) {
|
|
|
138
167
|
}) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
139
168
|
id: "T/NPHK"
|
|
140
169
|
}));
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
170
|
+
$[26] = name;
|
|
171
|
+
$[27] = title;
|
|
172
|
+
$[28] = t21;
|
|
144
173
|
} else {
|
|
145
|
-
|
|
174
|
+
t21 = $[28];
|
|
146
175
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
176
|
+
const t22 = !withoutSubmitButton;
|
|
177
|
+
let t23;
|
|
178
|
+
if ($[29] !== customFormRef) {
|
|
179
|
+
t23 = mergeRefs(formRef, customFormRef);
|
|
180
|
+
$[29] = customFormRef;
|
|
181
|
+
$[30] = t23;
|
|
182
|
+
} else {
|
|
183
|
+
t23 = $[30];
|
|
184
|
+
}
|
|
185
|
+
let t24;
|
|
186
|
+
if ($[31] !== fields || $[32] !== onFormCancel || $[33] !== onFormComplete || $[34] !== props || $[35] !== t23 || $[36] !== type) {
|
|
187
|
+
t24 = /*#__PURE__*/jsx(Form, {
|
|
188
|
+
withoutActions: true,
|
|
150
189
|
...props,
|
|
151
|
-
ref:
|
|
190
|
+
ref: t23,
|
|
152
191
|
fields: fields,
|
|
153
|
-
action: action,
|
|
154
192
|
type: type,
|
|
155
|
-
buttonSize: "md",
|
|
156
193
|
onComplete: onFormComplete,
|
|
157
|
-
onCancel: onFormCancel
|
|
158
|
-
submitButtonLabel: submitButtonLabel
|
|
194
|
+
onCancel: onFormCancel
|
|
159
195
|
});
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[32] = type;
|
|
168
|
-
$[33] = t18;
|
|
196
|
+
$[31] = fields;
|
|
197
|
+
$[32] = onFormCancel;
|
|
198
|
+
$[33] = onFormComplete;
|
|
199
|
+
$[34] = props;
|
|
200
|
+
$[35] = t23;
|
|
201
|
+
$[36] = type;
|
|
202
|
+
$[37] = t24;
|
|
169
203
|
} else {
|
|
170
|
-
|
|
204
|
+
t24 = $[37];
|
|
171
205
|
}
|
|
172
|
-
let
|
|
173
|
-
if ($[
|
|
174
|
-
|
|
206
|
+
let t25;
|
|
207
|
+
if ($[38] !== cancelButtonLabel || $[39] !== children || $[40] !== className || $[41] !== id || $[42] !== onClosed || $[43] !== opened || $[44] !== size || $[45] !== submitButtonLabel || $[46] !== t21 || $[47] !== t22 || $[48] !== t24 || $[49] !== withCancelButton) {
|
|
208
|
+
t25 = /*#__PURE__*/jsxs(Dialog, {
|
|
175
209
|
id: id,
|
|
176
|
-
title:
|
|
177
|
-
size:
|
|
210
|
+
title: t21,
|
|
211
|
+
size: size,
|
|
178
212
|
visible: opened,
|
|
213
|
+
withCancelButton: withCancelButton,
|
|
214
|
+
withSubmitButton: t22,
|
|
179
215
|
requestClose: requestClose,
|
|
180
216
|
onClosed: onClosed,
|
|
217
|
+
onClickSubmit: onClickSubmit,
|
|
181
218
|
className: className,
|
|
182
|
-
|
|
219
|
+
submitButtonLabel: submitButtonLabel,
|
|
220
|
+
cancelButtonLabel: cancelButtonLabel,
|
|
221
|
+
children: [children, t24]
|
|
183
222
|
});
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
223
|
+
$[38] = cancelButtonLabel;
|
|
224
|
+
$[39] = children;
|
|
225
|
+
$[40] = className;
|
|
226
|
+
$[41] = id;
|
|
227
|
+
$[42] = onClosed;
|
|
228
|
+
$[43] = opened;
|
|
229
|
+
$[44] = size;
|
|
230
|
+
$[45] = submitButtonLabel;
|
|
231
|
+
$[46] = t21;
|
|
232
|
+
$[47] = t22;
|
|
233
|
+
$[48] = t24;
|
|
234
|
+
$[49] = withCancelButton;
|
|
235
|
+
$[50] = t25;
|
|
192
236
|
} else {
|
|
193
|
-
|
|
237
|
+
t25 = $[50];
|
|
194
238
|
}
|
|
195
|
-
return
|
|
239
|
+
return t25;
|
|
196
240
|
}
|
|
197
241
|
|
|
198
|
-
export {
|
|
242
|
+
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.50",
|
|
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": "c5d4004686dae5529035f8eac83571739e24340d"
|
|
68
68
|
}
|