@panneau/modal-form 4.0.40-alpha.3 → 4.0.45

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, ForwardedRef } from 'react';
3
3
  import { Field } from '@panneau/core';
4
4
 
5
5
  interface ModalFormProps {
@@ -16,7 +16,8 @@ interface ModalFormProps {
16
16
  withoutCloseOnComplete?: boolean;
17
17
  className?: string | null;
18
18
  children?: ReactNode | null;
19
+ formRef?: ForwardedRef<HTMLFormElement> | null;
19
20
  }
20
- declare function ModalForm({ id, title, name, fields, action, type, onComplete, onCancel, onClosed, submitButtonLabel, withoutCloseOnComplete, className, children, ...props }: ModalFormProps): react_jsx_runtime.JSX.Element;
21
+ declare function ModalForm({ id, title, name, fields, action, type, onComplete, onCancel, onClosed, submitButtonLabel, withoutCloseOnComplete, className, children, formRef, ...props }: ModalFormProps): react_jsx_runtime.JSX.Element;
21
22
 
22
23
  export { ModalForm as default };
package/dist/index.js CHANGED
@@ -6,13 +6,14 @@ import Dialog from '@panneau/modal-dialog';
6
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
7
 
8
8
  function ModalForm(t0) {
9
- const $ = c(40);
9
+ const $ = c(42);
10
10
  let id;
11
11
  let props;
12
12
  let t1;
13
13
  let t10;
14
14
  let t11;
15
15
  let t12;
16
+ let t13;
16
17
  let t2;
17
18
  let t3;
18
19
  let t4;
@@ -36,6 +37,7 @@ function ModalForm(t0) {
36
37
  withoutCloseOnComplete: t10,
37
38
  className: t11,
38
39
  children: t12,
40
+ formRef: t13,
39
41
  ...props
40
42
  } = t0);
41
43
  $[0] = t0;
@@ -45,14 +47,15 @@ function ModalForm(t0) {
45
47
  $[4] = t10;
46
48
  $[5] = t11;
47
49
  $[6] = t12;
48
- $[7] = t2;
49
- $[8] = t3;
50
- $[9] = t4;
51
- $[10] = t5;
52
- $[11] = t6;
53
- $[12] = t7;
54
- $[13] = t8;
55
- $[14] = t9;
50
+ $[7] = t13;
51
+ $[8] = t2;
52
+ $[9] = t3;
53
+ $[10] = t4;
54
+ $[11] = t5;
55
+ $[12] = t6;
56
+ $[13] = t7;
57
+ $[14] = t8;
58
+ $[15] = t9;
56
59
  } else {
57
60
  id = $[1];
58
61
  props = $[2];
@@ -60,14 +63,15 @@ function ModalForm(t0) {
60
63
  t10 = $[4];
61
64
  t11 = $[5];
62
65
  t12 = $[6];
63
- t2 = $[7];
64
- t3 = $[8];
65
- t4 = $[9];
66
- t5 = $[10];
67
- t6 = $[11];
68
- t7 = $[12];
69
- t8 = $[13];
70
- t9 = $[14];
66
+ t13 = $[7];
67
+ t2 = $[8];
68
+ t3 = $[9];
69
+ t4 = $[10];
70
+ t5 = $[11];
71
+ t6 = $[12];
72
+ t7 = $[13];
73
+ t8 = $[14];
74
+ t9 = $[15];
71
75
  }
72
76
  const title = t1 === undefined ? null : t1;
73
77
  const name = t2 === undefined ? null : t2;
@@ -81,34 +85,35 @@ function ModalForm(t0) {
81
85
  const withoutCloseOnComplete = t10 === undefined ? false : t10;
82
86
  const className = t11 === undefined ? null : t11;
83
87
  const children = t12 === undefined ? null : t12;
88
+ const formRef = t13 === undefined ? null : t13;
84
89
  const [opened, setOpened] = useState(true);
85
- let t13;
86
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
87
- t13 = () => {
90
+ let t14;
91
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
92
+ t14 = () => {
88
93
  setOpened(false);
89
94
  };
90
- $[15] = t13;
95
+ $[16] = t14;
91
96
  } else {
92
- t13 = $[15];
97
+ t14 = $[16];
93
98
  }
94
- const requestClose = t13;
95
- let t14;
96
- if ($[16] !== onCancel) {
97
- t14 = () => {
99
+ const requestClose = t14;
100
+ let t15;
101
+ if ($[17] !== onCancel) {
102
+ t15 = () => {
98
103
  setOpened(false);
99
104
  if (onCancel !== null) {
100
105
  onCancel();
101
106
  }
102
107
  };
103
- $[16] = onCancel;
104
- $[17] = t14;
108
+ $[17] = onCancel;
109
+ $[18] = t15;
105
110
  } else {
106
- t14 = $[17];
111
+ t15 = $[18];
107
112
  }
108
- const onFormCancel = t14;
109
- let t15;
110
- if ($[18] !== onComplete || $[19] !== withoutCloseOnComplete) {
111
- t15 = value => {
113
+ const onFormCancel = t15;
114
+ let t16;
115
+ if ($[19] !== onComplete || $[20] !== withoutCloseOnComplete) {
116
+ t16 = value => {
112
117
  if (!withoutCloseOnComplete) {
113
118
  setOpened(false);
114
119
  }
@@ -116,16 +121,16 @@ function ModalForm(t0) {
116
121
  onComplete(value);
117
122
  }
118
123
  };
119
- $[18] = onComplete;
120
- $[19] = withoutCloseOnComplete;
121
- $[20] = t15;
124
+ $[19] = onComplete;
125
+ $[20] = withoutCloseOnComplete;
126
+ $[21] = t16;
122
127
  } else {
123
- t15 = $[20];
128
+ t16 = $[21];
124
129
  }
125
- const onFormComplete = t15;
126
- let t16;
127
- if ($[21] !== name || $[22] !== title) {
128
- t16 = title || (name !== null ? /*#__PURE__*/jsx(FormattedMessage, {
130
+ const onFormComplete = t16;
131
+ let t17;
132
+ if ($[22] !== name || $[23] !== title) {
133
+ t17 = title || (name !== null ? /*#__PURE__*/jsx(FormattedMessage, {
129
134
  id: "smqUAV",
130
135
  values: {
131
136
  name
@@ -133,16 +138,17 @@ function ModalForm(t0) {
133
138
  }) : /*#__PURE__*/jsx(FormattedMessage, {
134
139
  id: "T/NPHK"
135
140
  }));
136
- $[21] = name;
137
- $[22] = title;
138
- $[23] = t16;
141
+ $[22] = name;
142
+ $[23] = title;
143
+ $[24] = t17;
139
144
  } else {
140
- t16 = $[23];
145
+ t17 = $[24];
141
146
  }
142
- let t17;
143
- if ($[24] !== action || $[25] !== fields || $[26] !== onFormCancel || $[27] !== onFormComplete || $[28] !== props || $[29] !== submitButtonLabel || $[30] !== type) {
144
- t17 = /*#__PURE__*/jsx(Form, {
147
+ let t18;
148
+ if ($[25] !== action || $[26] !== fields || $[27] !== formRef || $[28] !== onFormCancel || $[29] !== onFormComplete || $[30] !== props || $[31] !== submitButtonLabel || $[32] !== type) {
149
+ t18 = /*#__PURE__*/jsx(Form, {
145
150
  ...props,
151
+ ref: formRef,
146
152
  fields: fields,
147
153
  action: action,
148
154
  type: type,
@@ -151,41 +157,42 @@ function ModalForm(t0) {
151
157
  onCancel: onFormCancel,
152
158
  submitButtonLabel: submitButtonLabel
153
159
  });
154
- $[24] = action;
155
- $[25] = fields;
156
- $[26] = onFormCancel;
157
- $[27] = onFormComplete;
158
- $[28] = props;
159
- $[29] = submitButtonLabel;
160
- $[30] = type;
161
- $[31] = t17;
160
+ $[25] = action;
161
+ $[26] = fields;
162
+ $[27] = formRef;
163
+ $[28] = onFormCancel;
164
+ $[29] = onFormComplete;
165
+ $[30] = props;
166
+ $[31] = submitButtonLabel;
167
+ $[32] = type;
168
+ $[33] = t18;
162
169
  } else {
163
- t17 = $[31];
170
+ t18 = $[33];
164
171
  }
165
- let t18;
166
- if ($[32] !== children || $[33] !== className || $[34] !== id || $[35] !== onClosed || $[36] !== opened || $[37] !== t16 || $[38] !== t17) {
167
- t18 = /*#__PURE__*/jsxs(Dialog, {
172
+ let t19;
173
+ if ($[34] !== children || $[35] !== className || $[36] !== id || $[37] !== onClosed || $[38] !== opened || $[39] !== t17 || $[40] !== t18) {
174
+ t19 = /*#__PURE__*/jsxs(Dialog, {
168
175
  id: id,
169
- title: t16,
176
+ title: t17,
170
177
  size: "lg",
171
178
  visible: opened,
172
179
  requestClose: requestClose,
173
180
  onClosed: onClosed,
174
181
  className: className,
175
- children: [children, t17]
182
+ children: [children, t18]
176
183
  });
177
- $[32] = children;
178
- $[33] = className;
179
- $[34] = id;
180
- $[35] = onClosed;
181
- $[36] = opened;
182
- $[37] = t16;
183
- $[38] = t17;
184
- $[39] = t18;
184
+ $[34] = children;
185
+ $[35] = className;
186
+ $[36] = id;
187
+ $[37] = onClosed;
188
+ $[38] = opened;
189
+ $[39] = t17;
190
+ $[40] = t18;
191
+ $[41] = t19;
185
192
  } else {
186
- t18 = $[39];
193
+ t19 = $[41];
187
194
  }
188
- return t18;
195
+ return t19;
189
196
  }
190
197
 
191
198
  export { ModalForm as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/modal-form",
3
- "version": "4.0.40-alpha.3",
3
+ "version": "4.0.45",
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.40-alpha.3",
56
- "@panneau/form": "^4.0.40-alpha.3",
57
- "@panneau/intl": "^4.0.40-alpha.3",
58
- "@panneau/modal-dialog": "^4.0.40-alpha.3",
59
- "@panneau/themes": "^4.0.40-alpha.3",
55
+ "@panneau/core": "^4.0.41",
56
+ "@panneau/form": "^4.0.45",
57
+ "@panneau/intl": "^4.0.45",
58
+ "@panneau/modal-dialog": "^4.0.41",
59
+ "@panneau/themes": "^4.0.41",
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": "1735964a2702ae0480b642225286e4184f36680d"
67
+ "gitHead": "33c9c717de67f2a018289e91ea16daa2d5925cd2"
68
68
  }