@trungkhai/dynamic-form 0.1.1 → 0.1.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.cjs.js +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.es.js +742 -677
- package/package.json +5 -3
package/dist/index.es.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { jsx as f, jsxs as
|
|
2
|
-
import { Select as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import
|
|
5
|
-
import { FileImageOutlined as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as f, jsxs as Be, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { Select as Fe, Form as U, Upload as ke, Button as Ee, DatePicker as Ge, Checkbox as Ie, Radio as We, InputNumber as Ke, Input as ve, Row as $e, Col as ze, App as He, Flex as ie, Spin as ae } from "antd";
|
|
3
|
+
import { createContext as Ye, useContext as Re, memo as C, useState as P, useMemo as R, useEffect as V, useCallback as T, useRef as B, forwardRef as Ne, useImperativeHandle as Je } from "react";
|
|
4
|
+
import Z from "dayjs";
|
|
5
|
+
import { FileImageOutlined as Qe, UploadOutlined as Xe } from "@ant-design/icons";
|
|
6
|
+
const oe = Ye(
|
|
7
7
|
null
|
|
8
8
|
);
|
|
9
|
-
function
|
|
10
|
-
const e =
|
|
9
|
+
function M() {
|
|
10
|
+
const e = Re(oe);
|
|
11
11
|
if (!e)
|
|
12
12
|
throw new Error(
|
|
13
13
|
"useDynamicFormContext must be used within DynamicFormProvider"
|
|
14
14
|
);
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function en() {
|
|
18
|
+
return Re(oe);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
for (const
|
|
22
|
-
if (typeof
|
|
20
|
+
function Ze(e, t = []) {
|
|
21
|
+
for (const r of t) {
|
|
22
|
+
if (typeof r == "function")
|
|
23
23
|
continue;
|
|
24
|
-
const { match:
|
|
25
|
-
if (typeof
|
|
26
|
-
if (
|
|
24
|
+
const { match: i, render: a } = r;
|
|
25
|
+
if (typeof i == "string") {
|
|
26
|
+
if (i === e.field?.type?.code || i === e.code)
|
|
27
27
|
return a;
|
|
28
|
-
} else if (
|
|
28
|
+
} else if (i(e))
|
|
29
29
|
return a;
|
|
30
30
|
}
|
|
31
31
|
const n = e.field?.type?.code;
|
|
32
|
-
for (const
|
|
32
|
+
for (const r of t)
|
|
33
33
|
;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
35
|
+
function et(e, t = [], n = {}) {
|
|
36
|
+
return Ze(e, t) ?? n[e.code] ?? n[e.field?.type?.code ?? ""];
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const n = t.option_config?.label_attr,
|
|
40
|
-
let
|
|
38
|
+
function tt(e, t) {
|
|
39
|
+
const n = t.option_config?.label_attr, r = t.option_config?.value_attr || "value";
|
|
40
|
+
let i;
|
|
41
41
|
if (n?.length) {
|
|
42
42
|
const a = n.join(" - ");
|
|
43
|
-
e[a] !== void 0 ?
|
|
43
|
+
e[a] !== void 0 ? i = String(e[a]) : i = n.map((s) => e[s]).filter((s) => s != null && s !== "").join(" - ");
|
|
44
44
|
} else
|
|
45
|
-
|
|
45
|
+
i = String(e[r] ?? "");
|
|
46
46
|
return {
|
|
47
|
-
label:
|
|
48
|
-
value: e[
|
|
47
|
+
label: i,
|
|
48
|
+
value: e[r]
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return t.option_config && t.is_option_api ? e?.map((n) =>
|
|
51
|
+
function nt(e, t) {
|
|
52
|
+
return t.option_config && t.is_option_api ? e?.map((n) => tt(n, t)) : t.metas?.map((n) => ({
|
|
53
53
|
label: n.label,
|
|
54
54
|
value: n.value
|
|
55
55
|
}));
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function se(e, t) {
|
|
58
58
|
let n;
|
|
59
|
-
return (...
|
|
60
|
-
n && clearTimeout(n), n = setTimeout(() => e(...
|
|
59
|
+
return (...r) => {
|
|
60
|
+
n && clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const rt = ({
|
|
64
64
|
onSearchKeyword: e,
|
|
65
65
|
searchDebounceMs: t = 500,
|
|
66
66
|
...n
|
|
67
67
|
}) => {
|
|
68
|
-
const [
|
|
69
|
-
() =>
|
|
68
|
+
const [r, i] = P(""), a = R(
|
|
69
|
+
() => se((o) => e?.(o), t),
|
|
70
70
|
[e, t]
|
|
71
71
|
);
|
|
72
72
|
return /* @__PURE__ */ f(
|
|
73
|
-
|
|
73
|
+
Fe,
|
|
74
74
|
{
|
|
75
75
|
allowClear: !0,
|
|
76
76
|
showSearch: !0,
|
|
77
|
-
searchValue:
|
|
77
|
+
searchValue: r,
|
|
78
78
|
onSearch: (o) => {
|
|
79
|
-
|
|
79
|
+
i(o), a(o);
|
|
80
80
|
},
|
|
81
81
|
filterOption: !1,
|
|
82
82
|
...n
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
|
-
},
|
|
85
|
+
}, it = C(rt), at = ({
|
|
86
86
|
fieldName: e,
|
|
87
87
|
formInstance: t,
|
|
88
88
|
...n
|
|
89
89
|
}) => {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
if (
|
|
90
|
+
const r = U.useWatch(e, t);
|
|
91
|
+
return V(() => {
|
|
92
|
+
if (r?.fileList?.length && r.fileList.some(
|
|
93
93
|
(s) => !s.type?.startsWith("image/")
|
|
94
94
|
)) {
|
|
95
|
-
const s =
|
|
95
|
+
const s = r.fileList.filter(
|
|
96
96
|
(o) => o.type?.startsWith("image/")
|
|
97
97
|
);
|
|
98
98
|
t.setFieldValue(
|
|
@@ -103,107 +103,107 @@ const et = ({
|
|
|
103
103
|
} : null
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
|
-
}, [e, t,
|
|
106
|
+
}, [e, t, r]), /* @__PURE__ */ f(ke, { listType: "picture-card", accept: "image/*", ...n, children: /* @__PURE__ */ f(
|
|
107
107
|
"button",
|
|
108
108
|
{
|
|
109
109
|
style: { border: 0, background: "none", cursor: "pointer" },
|
|
110
110
|
type: "button",
|
|
111
|
-
children: /* @__PURE__ */ f(
|
|
111
|
+
children: /* @__PURE__ */ f(Qe, {})
|
|
112
112
|
}
|
|
113
113
|
) });
|
|
114
|
-
},
|
|
114
|
+
}, ot = C(at), st = ({
|
|
115
115
|
fieldName: e,
|
|
116
116
|
formInstance: t,
|
|
117
117
|
...n
|
|
118
118
|
}) => {
|
|
119
|
-
const
|
|
120
|
-
return /* @__PURE__ */ f(
|
|
121
|
-
},
|
|
119
|
+
const r = U.useWatch(e, t);
|
|
120
|
+
return /* @__PURE__ */ f(ke, { fileList: r?.fileList, ...n, children: /* @__PURE__ */ f(Ee, { icon: /* @__PURE__ */ f(Xe, {}) }) });
|
|
121
|
+
}, lt = C(st), ct = ({
|
|
122
122
|
formInstance: e,
|
|
123
123
|
uploadUrl: t,
|
|
124
124
|
setFieldState: n
|
|
125
125
|
}) => {
|
|
126
|
-
const { client:
|
|
127
|
-
if (
|
|
128
|
-
const l = t ??
|
|
126
|
+
const { client: r, upload: i, i18n: a, renderers: s } = M(), { messages: o } = a, d = T(() => {
|
|
127
|
+
if (i.upload) return i.upload;
|
|
128
|
+
const l = t ?? i.uploadUrl;
|
|
129
129
|
if (l)
|
|
130
|
-
return async ({ file:
|
|
131
|
-
const
|
|
132
|
-
file:
|
|
130
|
+
return async ({ file: p, signal: h, onProgress: u, fieldCode: v, fieldGroup: _, metadata: w }) => {
|
|
131
|
+
const b = i.getPayload ? i.getPayload({
|
|
132
|
+
file: p,
|
|
133
133
|
fieldCode: v,
|
|
134
134
|
fieldGroup: _,
|
|
135
135
|
uploadUrl: l,
|
|
136
|
-
signal:
|
|
137
|
-
onProgress:
|
|
136
|
+
signal: h,
|
|
137
|
+
onProgress: u,
|
|
138
138
|
metadata: w
|
|
139
139
|
}) : (() => {
|
|
140
140
|
const g = new FormData();
|
|
141
|
-
return g.append("file",
|
|
142
|
-
g.append(
|
|
141
|
+
return g.append("file", p), w && Object.entries(w).forEach(([k, D]) => {
|
|
142
|
+
g.append(k, String(D));
|
|
143
143
|
}), g;
|
|
144
|
-
})(),
|
|
144
|
+
})(), A = (await r.request({
|
|
145
145
|
method: "POST",
|
|
146
146
|
url: l,
|
|
147
|
-
data:
|
|
148
|
-
headers:
|
|
149
|
-
signal:
|
|
147
|
+
data: b,
|
|
148
|
+
headers: b instanceof FormData ? { "Content-Type": "multipart/form-data" } : void 0,
|
|
149
|
+
signal: h,
|
|
150
150
|
onUploadProgress: (g) => {
|
|
151
|
-
|
|
151
|
+
u?.(
|
|
152
152
|
Math.round(g.loaded * 100 / (g.total || 1))
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
})).data;
|
|
156
156
|
return {
|
|
157
|
-
uid:
|
|
158
|
-
...
|
|
159
|
-
path: String(
|
|
157
|
+
uid: p.uid,
|
|
158
|
+
...A,
|
|
159
|
+
path: String(A.path ?? "")
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
|
-
}, [
|
|
163
|
-
(l,
|
|
164
|
-
const { file:
|
|
165
|
-
return
|
|
166
|
-
file:
|
|
162
|
+
}, [r, i, t]), c = T(
|
|
163
|
+
(l, p) => (h) => {
|
|
164
|
+
const { file: u, onProgress: v, onError: _, onSuccess: w } = h, b = new AbortController(), S = d();
|
|
165
|
+
return S ? (S({
|
|
166
|
+
file: u,
|
|
167
167
|
fieldCode: l,
|
|
168
|
-
fieldGroup:
|
|
169
|
-
uploadUrl: t ??
|
|
170
|
-
signal:
|
|
171
|
-
onProgress: (
|
|
168
|
+
fieldGroup: p,
|
|
169
|
+
uploadUrl: t ?? i.uploadUrl,
|
|
170
|
+
signal: b.signal,
|
|
171
|
+
onProgress: (A) => v?.({ percent: A })
|
|
172
172
|
}).then(
|
|
173
|
-
(
|
|
174
|
-
...
|
|
175
|
-
uid:
|
|
176
|
-
path:
|
|
177
|
-
upload_date:
|
|
173
|
+
(A) => w?.({
|
|
174
|
+
...A,
|
|
175
|
+
uid: A.uid ?? u.uid,
|
|
176
|
+
path: A.path,
|
|
177
|
+
upload_date: Z().format("YYYY-MM-DD HH:mm:ss")
|
|
178
178
|
})
|
|
179
|
-
).catch((
|
|
179
|
+
).catch((A) => _?.(A)), { abort: () => b.abort() }) : (_?.(new Error(o.uploadError ?? "Upload not configured")), { abort() {
|
|
180
180
|
} });
|
|
181
181
|
},
|
|
182
|
-
[o.uploadError,
|
|
183
|
-
),
|
|
184
|
-
(l,
|
|
185
|
-
const
|
|
186
|
-
return
|
|
182
|
+
[o.uploadError, d, i.uploadUrl, t]
|
|
183
|
+
), y = T(
|
|
184
|
+
(l, p) => async (h) => {
|
|
185
|
+
const u = h.response?.path;
|
|
186
|
+
return u ? i.remove({ path: u, fieldCode: l, fieldGroup: p }) : !0;
|
|
187
187
|
},
|
|
188
|
-
[
|
|
189
|
-
),
|
|
188
|
+
[i]
|
|
189
|
+
), m = T(
|
|
190
190
|
(l, {
|
|
191
|
-
state:
|
|
192
|
-
options:
|
|
193
|
-
optionsLoading:
|
|
191
|
+
state: p,
|
|
192
|
+
options: h,
|
|
193
|
+
optionsLoading: u,
|
|
194
194
|
optionsError: v,
|
|
195
195
|
onSearchKeyword: _,
|
|
196
196
|
readOnly: w = !1
|
|
197
197
|
}) => {
|
|
198
|
-
const { additional_config:
|
|
198
|
+
const { additional_config: b, field: S } = l, A = S?.type?.code, g = w || l.is_readonly || p?.disabled, k = et(
|
|
199
199
|
l,
|
|
200
200
|
s.fields
|
|
201
201
|
);
|
|
202
|
-
if (
|
|
203
|
-
return
|
|
204
|
-
state:
|
|
205
|
-
options:
|
|
206
|
-
optionsLoading:
|
|
202
|
+
if (k)
|
|
203
|
+
return k(l, {
|
|
204
|
+
state: p,
|
|
205
|
+
options: h,
|
|
206
|
+
optionsLoading: u,
|
|
207
207
|
optionsError: v,
|
|
208
208
|
onSearchKeyword: _,
|
|
209
209
|
readOnly: w,
|
|
@@ -211,18 +211,18 @@ const et = ({
|
|
|
211
211
|
disabled: !!g,
|
|
212
212
|
setFieldState: n
|
|
213
213
|
});
|
|
214
|
-
const
|
|
215
|
-
switch (
|
|
214
|
+
const D = nt(h, l);
|
|
215
|
+
switch (A) {
|
|
216
216
|
case "text":
|
|
217
|
-
return
|
|
218
|
-
|
|
217
|
+
return b?.text?.textarea ? /* @__PURE__ */ f(
|
|
218
|
+
ve.TextArea,
|
|
219
219
|
{
|
|
220
220
|
disabled: g,
|
|
221
221
|
placeholder: o.inputPlaceholder(l.label),
|
|
222
|
-
rows:
|
|
222
|
+
rows: b?.text?.rows
|
|
223
223
|
}
|
|
224
224
|
) : /* @__PURE__ */ f(
|
|
225
|
-
|
|
225
|
+
ve,
|
|
226
226
|
{
|
|
227
227
|
disabled: g,
|
|
228
228
|
placeholder: o.inputPlaceholder(l.label)
|
|
@@ -230,74 +230,74 @@ const et = ({
|
|
|
230
230
|
);
|
|
231
231
|
case "number":
|
|
232
232
|
return /* @__PURE__ */ f(
|
|
233
|
-
|
|
233
|
+
Ke,
|
|
234
234
|
{
|
|
235
235
|
style: { width: "100%" },
|
|
236
236
|
disabled: g,
|
|
237
237
|
placeholder: o.inputPlaceholder(l.label),
|
|
238
|
-
min:
|
|
239
|
-
max:
|
|
238
|
+
min: b?.number?.min,
|
|
239
|
+
max: b?.number?.max
|
|
240
240
|
}
|
|
241
241
|
);
|
|
242
242
|
case "select": {
|
|
243
|
-
const
|
|
243
|
+
const j = {
|
|
244
244
|
disabled: g,
|
|
245
|
-
options:
|
|
245
|
+
options: D,
|
|
246
246
|
placeholder: o.selectPlaceholder(l.label),
|
|
247
247
|
allowClear: !0,
|
|
248
|
-
loading:
|
|
249
|
-
mode:
|
|
250
|
-
notFoundContent: v ? o.optionError :
|
|
248
|
+
loading: u,
|
|
249
|
+
mode: b?.select?.multiple ? "multiple" : void 0,
|
|
250
|
+
notFoundContent: v ? o.optionError : u ? o.optionLoading : void 0
|
|
251
251
|
};
|
|
252
252
|
return _ ? /* @__PURE__ */ f(
|
|
253
|
-
|
|
253
|
+
it,
|
|
254
254
|
{
|
|
255
|
-
...
|
|
255
|
+
...j,
|
|
256
256
|
onSearchKeyword: _,
|
|
257
|
-
searchDebounceMs:
|
|
257
|
+
searchDebounceMs: b?.select?.searchDebounceMs ?? 500
|
|
258
258
|
}
|
|
259
|
-
) : /* @__PURE__ */ f(
|
|
259
|
+
) : /* @__PURE__ */ f(Fe, { ...j, showSearch: !0, optionFilterProp: "label" });
|
|
260
260
|
}
|
|
261
261
|
case "radio":
|
|
262
|
-
return /* @__PURE__ */ f(
|
|
262
|
+
return /* @__PURE__ */ f(We.Group, { disabled: g, options: D });
|
|
263
263
|
case "checkbox":
|
|
264
|
-
return /* @__PURE__ */ f(
|
|
264
|
+
return /* @__PURE__ */ f(Ie.Group, { disabled: g, options: D });
|
|
265
265
|
case "datetime":
|
|
266
266
|
return /* @__PURE__ */ f(
|
|
267
|
-
|
|
267
|
+
Ge,
|
|
268
268
|
{
|
|
269
269
|
style: { width: "100%" },
|
|
270
270
|
disabled: g,
|
|
271
|
-
showTime:
|
|
272
|
-
format:
|
|
271
|
+
showTime: b?.datetime?.showTime,
|
|
272
|
+
format: b?.datetime?.format
|
|
273
273
|
}
|
|
274
274
|
);
|
|
275
275
|
case "file":
|
|
276
276
|
return /* @__PURE__ */ f(
|
|
277
|
-
|
|
277
|
+
lt,
|
|
278
278
|
{
|
|
279
279
|
disabled: g,
|
|
280
280
|
fieldName: l.code,
|
|
281
281
|
formInstance: e,
|
|
282
|
-
multiple:
|
|
283
|
-
maxCount:
|
|
284
|
-
accept:
|
|
282
|
+
multiple: b?.file?.multiple || !1,
|
|
283
|
+
maxCount: b?.file?.max,
|
|
284
|
+
accept: b?.file?.accept,
|
|
285
285
|
customRequest: c(l.code, l),
|
|
286
|
-
onRemove:
|
|
286
|
+
onRemove: y(l.code, l)
|
|
287
287
|
}
|
|
288
288
|
);
|
|
289
289
|
case "image":
|
|
290
290
|
return /* @__PURE__ */ f(
|
|
291
|
-
|
|
291
|
+
ot,
|
|
292
292
|
{
|
|
293
293
|
disabled: g,
|
|
294
294
|
fieldName: l.code,
|
|
295
295
|
formInstance: e,
|
|
296
|
-
multiple:
|
|
297
|
-
maxCount:
|
|
298
|
-
accept:
|
|
296
|
+
multiple: b?.image?.multiple || !1,
|
|
297
|
+
maxCount: b?.image?.max,
|
|
298
|
+
accept: b?.image?.accept ?? "image/*",
|
|
299
299
|
customRequest: c(l.code, l),
|
|
300
|
-
onRemove:
|
|
300
|
+
onRemove: y(l.code, l)
|
|
301
301
|
}
|
|
302
302
|
);
|
|
303
303
|
default:
|
|
@@ -306,19 +306,19 @@ const et = ({
|
|
|
306
306
|
},
|
|
307
307
|
[
|
|
308
308
|
c,
|
|
309
|
-
|
|
309
|
+
y,
|
|
310
310
|
e,
|
|
311
311
|
o,
|
|
312
312
|
s.fields,
|
|
313
313
|
n
|
|
314
314
|
]
|
|
315
315
|
);
|
|
316
|
-
return R(() => ({ getDynamicField:
|
|
316
|
+
return R(() => ({ getDynamicField: m }), [m]);
|
|
317
317
|
};
|
|
318
|
-
function
|
|
318
|
+
function le(e) {
|
|
319
319
|
return JSON.stringify(e);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function dt(e, t) {
|
|
322
322
|
const n = e.get(t);
|
|
323
323
|
if (n) {
|
|
324
324
|
if (Date.now() > n.expiresAt) {
|
|
@@ -328,59 +328,59 @@ function st(e, t) {
|
|
|
328
328
|
return n.data;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
e.set(t, { data: n, expiresAt: Date.now() +
|
|
331
|
+
function ut(e, t, n, r) {
|
|
332
|
+
e.set(t, { data: n, expiresAt: Date.now() + r });
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
334
|
+
async function re(e, t, n, r, i) {
|
|
335
335
|
const a = e[t];
|
|
336
336
|
if (e.cache.enabled) {
|
|
337
|
-
const c =
|
|
337
|
+
const c = dt(a, n);
|
|
338
338
|
if (c !== void 0) return c;
|
|
339
339
|
}
|
|
340
|
-
const s = new AbortController(), o =
|
|
341
|
-
return e.cache.enabled &&
|
|
340
|
+
const s = new AbortController(), o = i ? AbortSignal.any([i, s.signal]) : s.signal, d = await r(o);
|
|
341
|
+
return e.cache.enabled && ut(a, n, d, e.cache.ttlMs), d;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
return t.split(".").reduce((n,
|
|
343
|
+
function I(e, t) {
|
|
344
|
+
return t.split(".").reduce((n, r) => {
|
|
345
345
|
if (n && typeof n == "object")
|
|
346
|
-
return n[
|
|
346
|
+
return n[r];
|
|
347
347
|
}, e);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function ft(e, t) {
|
|
350
350
|
if (typeof e != "string") return e;
|
|
351
351
|
const n = e.match(/^\{\{(.+?)\}\}$/);
|
|
352
352
|
if (!n) return e;
|
|
353
|
-
const
|
|
354
|
-
return
|
|
353
|
+
const r = n[1].trim(), i = I(t, r);
|
|
354
|
+
return i !== void 0 ? i : e;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function mt(e, t) {
|
|
357
357
|
const n = {};
|
|
358
|
-
for (const
|
|
359
|
-
n[
|
|
360
|
-
e[
|
|
358
|
+
for (const r in e)
|
|
359
|
+
n[r] = ft(
|
|
360
|
+
e[r],
|
|
361
361
|
t
|
|
362
362
|
);
|
|
363
363
|
return n;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function tn(e, t) {
|
|
366
366
|
const n = { ...e };
|
|
367
|
-
return t.forEach((
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
switch (
|
|
367
|
+
return t.forEach((r) => {
|
|
368
|
+
const i = e[r.code];
|
|
369
|
+
if (i == null) return;
|
|
370
|
+
switch (r.field?.type?.code) {
|
|
371
371
|
case "datetime": {
|
|
372
|
-
const s =
|
|
373
|
-
s.isValid() && (n[
|
|
372
|
+
const s = Z(i);
|
|
373
|
+
s.isValid() && (n[r.code] = s);
|
|
374
374
|
break;
|
|
375
375
|
}
|
|
376
376
|
case "file":
|
|
377
377
|
case "image": {
|
|
378
|
-
if (Array.isArray(
|
|
379
|
-
const s =
|
|
378
|
+
if (Array.isArray(i) && i.length > 0) {
|
|
379
|
+
const s = i.map((o, d) => {
|
|
380
380
|
const c = o;
|
|
381
381
|
return {
|
|
382
|
-
uid: String(c.uid ?? c.path ??
|
|
383
|
-
name: c.name ?? `file-${
|
|
382
|
+
uid: String(c.uid ?? c.path ?? d),
|
|
383
|
+
name: c.name ?? `file-${d}`,
|
|
384
384
|
status: "done",
|
|
385
385
|
percent: 100,
|
|
386
386
|
type: c.type,
|
|
@@ -388,151 +388,149 @@ function Xt(e, t) {
|
|
|
388
388
|
response: o
|
|
389
389
|
};
|
|
390
390
|
});
|
|
391
|
-
n[
|
|
391
|
+
n[r.code] = { fileList: s };
|
|
392
392
|
}
|
|
393
393
|
break;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
}), n;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
const t = e.option_config?.api_options?.params || {}, n = e.option_config?.api_options?.data || {},
|
|
398
|
+
function pt(e) {
|
|
399
|
+
const t = e.option_config?.api_options?.params || {}, n = e.option_config?.api_options?.data || {}, r = (i) => Object.values(i).filter(
|
|
400
400
|
(a) => typeof a == "string" && a.startsWith("{{") && a.endsWith("}}")
|
|
401
401
|
).map((a) => a.slice(2, -2).trim());
|
|
402
|
-
return Array.from(/* @__PURE__ */ new Set([...
|
|
402
|
+
return Array.from(/* @__PURE__ */ new Set([...r(t), ...r(n)]));
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function q(e, t) {
|
|
405
405
|
const n = {};
|
|
406
|
-
for (const
|
|
407
|
-
const
|
|
408
|
-
if (typeof
|
|
409
|
-
const a =
|
|
410
|
-
n[
|
|
406
|
+
for (const r in e) {
|
|
407
|
+
const i = e[r];
|
|
408
|
+
if (typeof i == "string" && i.startsWith("{{") && i.endsWith("}}")) {
|
|
409
|
+
const a = i.slice(2, -2).trim();
|
|
410
|
+
n[r] = t?.[a];
|
|
411
411
|
} else
|
|
412
|
-
n[
|
|
412
|
+
n[r] = i;
|
|
413
413
|
}
|
|
414
414
|
return n;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
return e.replace(/\{\{\s*(\w+)\s*\}\}/g, (n,
|
|
418
|
-
const
|
|
419
|
-
return
|
|
416
|
+
function Q(e, t) {
|
|
417
|
+
return e.replace(/\{\{\s*(\w+)\s*\}\}/g, (n, r) => {
|
|
418
|
+
const i = t?.[r];
|
|
419
|
+
return i != null ? String(i) : "";
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function ht(e, t, n) {
|
|
423
|
+
const i = t.find((a) => a.code === e)?.additional_config?.on_field_change?.clear ?? [];
|
|
424
|
+
return i.length === 0 ? [] : i.filter(
|
|
425
|
+
(a) => n?.[a] !== void 0 && n?.[a] !== null
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
function yt(e, t) {
|
|
423
429
|
const n = R(
|
|
424
|
-
() =>
|
|
430
|
+
() => pt(e),
|
|
425
431
|
[e]
|
|
426
|
-
),
|
|
432
|
+
), r = U.useWatch(
|
|
427
433
|
n.length > 0 ? n : void 0,
|
|
428
434
|
t
|
|
429
435
|
);
|
|
430
436
|
return R(() => {
|
|
431
437
|
if (!n.length) return {};
|
|
432
|
-
const
|
|
438
|
+
const i = {};
|
|
433
439
|
return n.forEach((a, s) => {
|
|
434
|
-
Array.isArray(
|
|
435
|
-
}),
|
|
436
|
-
}, [n,
|
|
440
|
+
Array.isArray(r) ? i[a] = r[s] : i[a] = r;
|
|
441
|
+
}), i;
|
|
442
|
+
}, [n, r]);
|
|
437
443
|
}
|
|
438
|
-
function
|
|
444
|
+
function bt({
|
|
439
445
|
group: e,
|
|
440
446
|
formInstance: t,
|
|
441
447
|
searchKeyword: n = "",
|
|
442
|
-
searchDebounceMs:
|
|
448
|
+
searchDebounceMs: r = 500
|
|
443
449
|
}) {
|
|
444
|
-
const
|
|
445
|
-
() =>
|
|
446
|
-
[
|
|
450
|
+
const i = M(), a = yt(e, t), [s, o] = P(), [d, c] = P(!1), [y, m] = P(), l = B(null), [p, h] = P(n), u = e.additional_config?.select?.search_keyword ?? !1, v = R(
|
|
451
|
+
() => se((b) => h(b), r),
|
|
452
|
+
[r]
|
|
447
453
|
);
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}, [n,
|
|
454
|
+
V(() => {
|
|
455
|
+
u ? v(n) : h("");
|
|
456
|
+
}, [n, u, v]);
|
|
451
457
|
const _ = R(() => {
|
|
452
|
-
const
|
|
453
|
-
if (!(!
|
|
458
|
+
const b = e.option_config?.api_options?.params, S = e.option_config?.api_options?.data;
|
|
459
|
+
if (!(!b && !S))
|
|
454
460
|
return {
|
|
455
|
-
params:
|
|
456
|
-
data:
|
|
461
|
+
params: b ? q(b, a) : void 0,
|
|
462
|
+
data: S ? q(S, a) : void 0
|
|
457
463
|
};
|
|
458
|
-
}, [a, e]), w =
|
|
464
|
+
}, [a, e]), w = T(async () => {
|
|
459
465
|
if (!e.option_config || !e.is_option_api || !e.option_config.url)
|
|
460
466
|
return;
|
|
461
467
|
l.current?.abort();
|
|
462
|
-
const
|
|
463
|
-
l.current =
|
|
464
|
-
const
|
|
468
|
+
const b = new AbortController();
|
|
469
|
+
l.current = b;
|
|
470
|
+
const S = e.option_config.method?.toUpperCase() === "GET" || !e.option_config.method, A = u ? p : "", g = le([
|
|
465
471
|
e.code,
|
|
466
472
|
e.option_config.url,
|
|
467
473
|
e.option_config.method,
|
|
468
474
|
_,
|
|
469
|
-
|
|
475
|
+
A
|
|
470
476
|
]);
|
|
471
|
-
c(!0),
|
|
477
|
+
c(!0), m(void 0);
|
|
472
478
|
try {
|
|
473
|
-
const
|
|
474
|
-
|
|
479
|
+
const k = await re(
|
|
480
|
+
i,
|
|
475
481
|
"optionCache",
|
|
476
482
|
g,
|
|
477
|
-
async (
|
|
478
|
-
const
|
|
483
|
+
async (D) => {
|
|
484
|
+
const j = await i.client.request({
|
|
479
485
|
method: e.option_config?.method || "GET",
|
|
480
486
|
url: e.option_config?.url,
|
|
481
|
-
params:
|
|
482
|
-
data: !
|
|
483
|
-
signal:
|
|
487
|
+
params: S && u ? { ..._?.params, keywords: A } : _?.params,
|
|
488
|
+
data: !S && u ? { ..._?.data, keywords: A } : _?.data,
|
|
489
|
+
signal: D
|
|
484
490
|
});
|
|
485
|
-
return
|
|
491
|
+
return i.parsers.optionResponse(j.data, e);
|
|
486
492
|
},
|
|
487
|
-
|
|
493
|
+
b.signal
|
|
488
494
|
);
|
|
489
|
-
|
|
490
|
-
} catch (
|
|
491
|
-
|
|
495
|
+
b.signal.aborted || o(k);
|
|
496
|
+
} catch (k) {
|
|
497
|
+
b.signal.aborted || m(k);
|
|
492
498
|
} finally {
|
|
493
|
-
|
|
499
|
+
b.signal.aborted || c(!1);
|
|
494
500
|
}
|
|
495
|
-
}, [_,
|
|
496
|
-
return
|
|
501
|
+
}, [_, i, p, e, u]);
|
|
502
|
+
return V(() => (e.option_config && e.is_option_api && w(), () => l.current?.abort()), [w, e]), { options: s, isLoading: d, error: y, refetch: w };
|
|
497
503
|
}
|
|
498
|
-
const
|
|
504
|
+
const _t = ({
|
|
499
505
|
group: e,
|
|
500
506
|
formInstance: t,
|
|
501
507
|
fieldState: n,
|
|
502
|
-
setFieldState:
|
|
503
|
-
uploadUrl:
|
|
508
|
+
setFieldState: r,
|
|
509
|
+
uploadUrl: i,
|
|
504
510
|
readOnly: a = !1,
|
|
505
511
|
size: s = "middle",
|
|
506
512
|
...o
|
|
507
513
|
}) => {
|
|
508
|
-
const { getDynamicField:
|
|
514
|
+
const { getDynamicField: d } = ct({
|
|
509
515
|
formInstance: t,
|
|
510
|
-
uploadUrl:
|
|
511
|
-
setFieldState:
|
|
512
|
-
}), c =
|
|
516
|
+
uploadUrl: i,
|
|
517
|
+
setFieldState: r
|
|
518
|
+
}), c = U.useWatch(e.code, t), [y, m] = P(""), l = e.additional_config?.select?.search_keyword ?? !1, { options: p, isLoading: h, error: u } = bt({
|
|
513
519
|
group: e,
|
|
514
520
|
formInstance: t,
|
|
515
|
-
searchKeyword:
|
|
521
|
+
searchKeyword: y,
|
|
516
522
|
searchDebounceMs: e.additional_config?.select?.searchDebounceMs ?? 500
|
|
517
|
-
}), v =
|
|
518
|
-
|
|
523
|
+
}), v = T((w) => {
|
|
524
|
+
m(w);
|
|
519
525
|
}, []);
|
|
520
|
-
|
|
521
|
-
if (e.additional_config?.on_field_change?.clear?.length) {
|
|
522
|
-
const w = t.getFieldsValue(
|
|
523
|
-
e.additional_config.on_field_change.clear
|
|
524
|
-
), m = e.additional_config.on_field_change.clear.filter(
|
|
525
|
-
(A) => w?.[A]
|
|
526
|
-
);
|
|
527
|
-
m.length && t.resetFields(m);
|
|
528
|
-
}
|
|
526
|
+
V(() => {
|
|
529
527
|
e.additional_config?.on_field_empty?.disable?.length && e.additional_config.on_field_empty.disable.forEach((w) => {
|
|
530
|
-
|
|
528
|
+
r(w, { disabled: !c });
|
|
531
529
|
});
|
|
532
|
-
}, [c, t, e,
|
|
530
|
+
}, [c, t, e, r]);
|
|
533
531
|
const _ = s === "small" ? 4 : 12;
|
|
534
532
|
return /* @__PURE__ */ f(
|
|
535
|
-
|
|
533
|
+
U.Item,
|
|
536
534
|
{
|
|
537
535
|
label: e.label,
|
|
538
536
|
name: e.code,
|
|
@@ -540,44 +538,44 @@ const pt = ({
|
|
|
540
538
|
rules: [{ required: n?.required || !1 }],
|
|
541
539
|
style: { marginBottom: _, ...o.style },
|
|
542
540
|
...o,
|
|
543
|
-
children:
|
|
541
|
+
children: d(e, {
|
|
544
542
|
state: n,
|
|
545
|
-
options:
|
|
546
|
-
optionsLoading:
|
|
547
|
-
optionsError:
|
|
543
|
+
options: p,
|
|
544
|
+
optionsLoading: h,
|
|
545
|
+
optionsError: u,
|
|
548
546
|
onSearchKeyword: l ? v : void 0,
|
|
549
547
|
readOnly: a
|
|
550
548
|
})
|
|
551
549
|
}
|
|
552
550
|
);
|
|
553
551
|
};
|
|
554
|
-
function
|
|
552
|
+
function vt(e, t) {
|
|
555
553
|
return e.group.id === t.group.id && e.readOnly === t.readOnly && e.uploadUrl === t.uploadUrl && e.size === t.size && e.fieldState?.disabled === t.fieldState?.disabled && e.fieldState?.hidden === t.fieldState?.hidden && e.fieldState?.required === t.fieldState?.required;
|
|
556
554
|
}
|
|
557
|
-
const
|
|
558
|
-
function
|
|
555
|
+
const wt = C(_t, vt);
|
|
556
|
+
function gt({
|
|
559
557
|
fieldGroups: e,
|
|
560
558
|
fieldStates: t,
|
|
561
559
|
renderField: n,
|
|
562
|
-
gutter:
|
|
563
|
-
defaultColSpan:
|
|
560
|
+
gutter: r,
|
|
561
|
+
defaultColSpan: i
|
|
564
562
|
}) {
|
|
565
|
-
return /* @__PURE__ */ f(
|
|
566
|
-
const s = t[a.code]?.hidden ? 0 : Number(a.additional_config?.field_col_span) ||
|
|
567
|
-
return /* @__PURE__ */ f(
|
|
563
|
+
return /* @__PURE__ */ f($e, { gutter: r, children: e.map((a) => {
|
|
564
|
+
const s = t[a.code]?.hidden ? 0 : Number(a.additional_config?.field_col_span) || i;
|
|
565
|
+
return /* @__PURE__ */ f(ze, { xs: s, children: n(a) }, a.id);
|
|
568
566
|
}) });
|
|
569
567
|
}
|
|
570
|
-
function
|
|
568
|
+
function At(e) {
|
|
571
569
|
return R(() => {
|
|
572
|
-
const t = e?.form?.field_groups ?? [], n = /* @__PURE__ */ new Map(),
|
|
570
|
+
const t = e?.form?.field_groups ?? [], n = /* @__PURE__ */ new Map(), r = {};
|
|
573
571
|
t.forEach((a) => {
|
|
574
|
-
n.set(a.code, a), a.additional_config?.default !== void 0 && (
|
|
572
|
+
n.set(a.code, a), a.additional_config?.default !== void 0 && (r[a.code] = a.additional_config.default);
|
|
575
573
|
});
|
|
576
|
-
const
|
|
577
|
-
return { fieldGroups: t, fieldByCode: n, visibleFieldGroups:
|
|
574
|
+
const i = t.filter((a) => !a.is_hidden);
|
|
575
|
+
return { fieldGroups: t, fieldByCode: n, visibleFieldGroups: i, initialValues: r };
|
|
578
576
|
}, [e]);
|
|
579
577
|
}
|
|
580
|
-
function
|
|
578
|
+
function we(e) {
|
|
581
579
|
const t = {};
|
|
582
580
|
return e.forEach((n) => {
|
|
583
581
|
t[n.code] = {
|
|
@@ -587,43 +585,43 @@ function ve(e) {
|
|
|
587
585
|
};
|
|
588
586
|
}), t;
|
|
589
587
|
}
|
|
590
|
-
function
|
|
591
|
-
const [t, n] =
|
|
592
|
-
() =>
|
|
588
|
+
function St(e) {
|
|
589
|
+
const [t, n] = P(
|
|
590
|
+
() => we(e)
|
|
593
591
|
);
|
|
594
|
-
|
|
595
|
-
n(
|
|
592
|
+
V(() => {
|
|
593
|
+
n(we(e));
|
|
596
594
|
}, [e]);
|
|
597
|
-
const
|
|
595
|
+
const r = T((i, a) => {
|
|
598
596
|
n((s) => ({
|
|
599
597
|
...s,
|
|
600
|
-
[
|
|
598
|
+
[i]: { ...s[i], ...a }
|
|
601
599
|
}));
|
|
602
600
|
}, []);
|
|
603
|
-
return { fieldStates: t, setFieldStates: n, setFieldState:
|
|
601
|
+
return { fieldStates: t, setFieldStates: n, setFieldState: r };
|
|
604
602
|
}
|
|
605
|
-
function
|
|
603
|
+
function Ft({
|
|
606
604
|
formInstance: e,
|
|
607
605
|
fieldByCode: t,
|
|
608
606
|
relatedData: n,
|
|
609
|
-
transformers:
|
|
607
|
+
transformers: r
|
|
610
608
|
}) {
|
|
611
|
-
return { buildProcessedValues:
|
|
609
|
+
return { buildProcessedValues: T(async () => {
|
|
612
610
|
await e.validateFields();
|
|
613
611
|
const a = e.getFieldsValue(), s = {};
|
|
614
612
|
for (const c of Object.keys(a)) {
|
|
615
|
-
const
|
|
616
|
-
if (!
|
|
617
|
-
let
|
|
618
|
-
switch (
|
|
613
|
+
const y = t.get(c);
|
|
614
|
+
if (!y) continue;
|
|
615
|
+
let m;
|
|
616
|
+
switch (y.field?.type?.code) {
|
|
619
617
|
case "datetime":
|
|
620
|
-
|
|
621
|
-
|
|
618
|
+
m = a[c] ? Z(a[c]).format(
|
|
619
|
+
y.additional_config?.datetime?.format
|
|
622
620
|
) : null;
|
|
623
621
|
break;
|
|
624
622
|
case "image":
|
|
625
623
|
case "file":
|
|
626
|
-
a[c]?.fileList?.length && (
|
|
624
|
+
a[c]?.fileList?.length && (m = a[c].fileList.filter((l) => l.percent === 100).map((l) => ({
|
|
627
625
|
...l.response,
|
|
628
626
|
name: l.name,
|
|
629
627
|
type: l.type,
|
|
@@ -631,202 +629,214 @@ function wt({
|
|
|
631
629
|
})));
|
|
632
630
|
break;
|
|
633
631
|
default:
|
|
634
|
-
|
|
632
|
+
m = a[c];
|
|
635
633
|
}
|
|
636
|
-
|
|
634
|
+
r.transformFieldValue && (m = r.transformFieldValue(c, m, y)), s[c] = m;
|
|
637
635
|
}
|
|
638
636
|
let o = s;
|
|
639
|
-
return
|
|
637
|
+
return r.transformSubmitValues && (o = r.transformSubmitValues(
|
|
640
638
|
o,
|
|
641
639
|
Array.from(t.values()),
|
|
642
640
|
n
|
|
643
|
-
)), (
|
|
644
|
-
}, [t, e, n,
|
|
641
|
+
)), (r.parseRelatedDataTemplates ?? mt)(o, n ?? {});
|
|
642
|
+
}, [t, e, n, r]) };
|
|
645
643
|
}
|
|
646
|
-
const
|
|
644
|
+
const kt = Ne(
|
|
647
645
|
({
|
|
648
646
|
formConfig: e,
|
|
649
647
|
formInstance: t,
|
|
650
648
|
relatedData: n,
|
|
651
|
-
uploadUrl:
|
|
652
|
-
uploadResourceUrl:
|
|
649
|
+
uploadUrl: r,
|
|
650
|
+
uploadResourceUrl: i,
|
|
653
651
|
submitTrackingUrl: a,
|
|
654
652
|
onBeforeSubmit: s,
|
|
655
653
|
onSubmitSuccess: o,
|
|
656
|
-
onSubmitError:
|
|
654
|
+
onSubmitError: d,
|
|
657
655
|
isRedirectAfterCreate: c,
|
|
658
|
-
onRedirect:
|
|
659
|
-
size:
|
|
656
|
+
onRedirect: y,
|
|
657
|
+
size: m = "middle",
|
|
660
658
|
manualSubmit: l = !1,
|
|
661
|
-
onValuesChange:
|
|
662
|
-
readOnly:
|
|
663
|
-
submitDebounceMs:
|
|
659
|
+
onValuesChange: p,
|
|
660
|
+
readOnly: h = !1,
|
|
661
|
+
submitDebounceMs: u,
|
|
664
662
|
gutter: v = [8, 0],
|
|
665
663
|
defaultColSpan: _ = 12,
|
|
666
664
|
submitButtonLabel: w
|
|
667
|
-
},
|
|
668
|
-
const { message:
|
|
665
|
+
}, b) => {
|
|
666
|
+
const { message: S } = He.useApp(), A = M(), { i18n: g, client: k, parsers: D, redirectHandler: j, renderers: K, transformers: $ } = A, ce = r ?? i, de = u ?? A.submitDebounceMs, ue = w ?? g.messages.submit, { fieldGroups: L, fieldByCode: Oe, initialValues: z } = At(e), { fieldStates: H, setFieldState: fe } = St(L), { buildProcessedValues: Y } = Ft({
|
|
669
667
|
formInstance: t,
|
|
670
|
-
fieldByCode:
|
|
668
|
+
fieldByCode: Oe,
|
|
671
669
|
relatedData: n,
|
|
672
|
-
transformers:
|
|
673
|
-
}), N =
|
|
674
|
-
|
|
675
|
-
if (Object.keys(
|
|
676
|
-
const
|
|
677
|
-
t.setFieldsValue(
|
|
670
|
+
transformers: $
|
|
671
|
+
}), N = B(!1), [me, pe] = P(!1), [he, ye] = P(!1);
|
|
672
|
+
V(() => {
|
|
673
|
+
if (Object.keys(z).length > 0) {
|
|
674
|
+
const F = $.normalizeInitialValues ? $.normalizeInitialValues(z, L) : z;
|
|
675
|
+
t.setFieldsValue(F);
|
|
678
676
|
}
|
|
679
|
-
}, [
|
|
680
|
-
const
|
|
677
|
+
}, [L, t, z, $]);
|
|
678
|
+
const J = T(async () => {
|
|
681
679
|
if (!N.current) {
|
|
682
|
-
N.current = !0,
|
|
680
|
+
N.current = !0, pe(!0);
|
|
683
681
|
try {
|
|
684
|
-
let
|
|
682
|
+
let F = await Y();
|
|
685
683
|
try {
|
|
686
|
-
a && (
|
|
684
|
+
a && (ye(!0), await k.request({
|
|
687
685
|
method: "POST",
|
|
688
686
|
url: a,
|
|
689
|
-
data:
|
|
687
|
+
data: F
|
|
690
688
|
}));
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
} catch (
|
|
695
|
-
console.error(
|
|
689
|
+
const E = await s?.(F);
|
|
690
|
+
if (E === !1) return;
|
|
691
|
+
E && typeof E == "object" && (F = E);
|
|
692
|
+
} catch (E) {
|
|
693
|
+
console.error(E);
|
|
696
694
|
return;
|
|
697
695
|
} finally {
|
|
698
|
-
|
|
696
|
+
ye(!1);
|
|
699
697
|
}
|
|
700
|
-
const
|
|
698
|
+
const O = await k.request({
|
|
701
699
|
method: e.method,
|
|
702
700
|
url: e.action,
|
|
703
|
-
data:
|
|
701
|
+
data: F
|
|
704
702
|
});
|
|
705
703
|
t.resetFields(
|
|
706
|
-
|
|
704
|
+
L.filter((E) => !E.is_hidden).map((E) => E.code)
|
|
707
705
|
);
|
|
708
|
-
const
|
|
709
|
-
c &&
|
|
710
|
-
values:
|
|
711
|
-
response:
|
|
712
|
-
data:
|
|
706
|
+
const W = D.submitResponse(O.data);
|
|
707
|
+
c && W.redirectUrl && (y ?? j)(W.redirectUrl, "_blank"), o?.({
|
|
708
|
+
values: F,
|
|
709
|
+
response: O.data,
|
|
710
|
+
data: W.data ?? O.data
|
|
713
711
|
});
|
|
714
|
-
} catch (
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
),
|
|
712
|
+
} catch (F) {
|
|
713
|
+
const O = F;
|
|
714
|
+
S.error(
|
|
715
|
+
O?.response?.data?.message ?? g.messages.submitError
|
|
716
|
+
), d?.(F);
|
|
719
717
|
} finally {
|
|
720
|
-
N.current = !1,
|
|
718
|
+
N.current = !1, pe(!1);
|
|
721
719
|
}
|
|
722
720
|
}
|
|
723
721
|
}, [
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
722
|
+
Y,
|
|
723
|
+
k,
|
|
724
|
+
L,
|
|
727
725
|
e.action,
|
|
728
726
|
e.method,
|
|
729
727
|
t,
|
|
730
728
|
g.messages.submitError,
|
|
731
729
|
c,
|
|
732
|
-
|
|
730
|
+
S,
|
|
733
731
|
s,
|
|
734
|
-
|
|
735
|
-
|
|
732
|
+
y,
|
|
733
|
+
d,
|
|
736
734
|
o,
|
|
737
|
-
|
|
738
|
-
|
|
735
|
+
D,
|
|
736
|
+
j,
|
|
739
737
|
a
|
|
740
738
|
]);
|
|
741
|
-
|
|
742
|
-
|
|
739
|
+
Je(
|
|
740
|
+
b,
|
|
743
741
|
() => ({
|
|
744
|
-
submit:
|
|
745
|
-
getProcessedValues:
|
|
742
|
+
submit: J,
|
|
743
|
+
getProcessedValues: Y,
|
|
746
744
|
isSubmitting: () => N.current
|
|
747
745
|
}),
|
|
748
|
-
[
|
|
746
|
+
[Y, J]
|
|
749
747
|
);
|
|
750
|
-
const
|
|
751
|
-
() =>
|
|
752
|
-
|
|
753
|
-
},
|
|
754
|
-
[
|
|
755
|
-
),
|
|
756
|
-
(
|
|
757
|
-
|
|
748
|
+
const be = R(
|
|
749
|
+
() => se(() => {
|
|
750
|
+
J();
|
|
751
|
+
}, de),
|
|
752
|
+
[J, de]
|
|
753
|
+
), Ve = T(
|
|
754
|
+
(F, O) => {
|
|
755
|
+
Object.keys(F).forEach((W) => {
|
|
756
|
+
const E = ht(
|
|
757
|
+
W,
|
|
758
|
+
L,
|
|
759
|
+
t.getFieldsValue()
|
|
760
|
+
);
|
|
761
|
+
E.length > 0 && t.resetFields(E);
|
|
762
|
+
}), p?.(F, O);
|
|
763
|
+
},
|
|
764
|
+
[L, t, p]
|
|
765
|
+
), _e = T(
|
|
766
|
+
(F) => /* @__PURE__ */ f(
|
|
767
|
+
wt,
|
|
758
768
|
{
|
|
759
|
-
group:
|
|
769
|
+
group: F,
|
|
760
770
|
formInstance: t,
|
|
761
|
-
fieldState: H[
|
|
762
|
-
setFieldState:
|
|
763
|
-
uploadUrl:
|
|
764
|
-
readOnly:
|
|
765
|
-
size:
|
|
771
|
+
fieldState: H[F.code],
|
|
772
|
+
setFieldState: fe,
|
|
773
|
+
uploadUrl: ce,
|
|
774
|
+
readOnly: h,
|
|
775
|
+
size: m
|
|
766
776
|
},
|
|
767
|
-
|
|
777
|
+
F.id
|
|
768
778
|
),
|
|
769
779
|
[
|
|
770
780
|
H,
|
|
771
781
|
t,
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
782
|
+
h,
|
|
783
|
+
ce,
|
|
784
|
+
fe,
|
|
785
|
+
m
|
|
776
786
|
]
|
|
777
|
-
),
|
|
778
|
-
fieldGroups:
|
|
787
|
+
), qe = K.layout ? K.layout({
|
|
788
|
+
fieldGroups: L,
|
|
779
789
|
fieldStates: H,
|
|
780
|
-
renderField:
|
|
790
|
+
renderField: _e,
|
|
781
791
|
gutter: v,
|
|
782
792
|
defaultColSpan: _,
|
|
783
|
-
size:
|
|
793
|
+
size: m
|
|
784
794
|
}) : /* @__PURE__ */ f(
|
|
785
|
-
|
|
795
|
+
gt,
|
|
786
796
|
{
|
|
787
|
-
fieldGroups:
|
|
797
|
+
fieldGroups: L,
|
|
788
798
|
fieldStates: H,
|
|
789
|
-
renderField:
|
|
799
|
+
renderField: _e,
|
|
790
800
|
gutter: v,
|
|
791
801
|
defaultColSpan: _,
|
|
792
|
-
size:
|
|
802
|
+
size: m
|
|
793
803
|
}
|
|
794
|
-
),
|
|
795
|
-
onSubmit:
|
|
796
|
-
loading:
|
|
797
|
-
label:
|
|
798
|
-
}) : /* @__PURE__ */ f(
|
|
804
|
+
), Ue = !l && !h && (K.submitActions ? K.submitActions({
|
|
805
|
+
onSubmit: be,
|
|
806
|
+
loading: me || he,
|
|
807
|
+
label: ue
|
|
808
|
+
}) : /* @__PURE__ */ f(ie, { justify: "flex-end", children: /* @__PURE__ */ f(
|
|
799
809
|
Ee,
|
|
800
810
|
{
|
|
801
811
|
type: "primary",
|
|
802
|
-
onClick:
|
|
803
|
-
loading:
|
|
804
|
-
children:
|
|
812
|
+
onClick: be,
|
|
813
|
+
loading: me || he,
|
|
814
|
+
children: ue
|
|
805
815
|
}
|
|
806
816
|
) }));
|
|
807
|
-
return /* @__PURE__ */
|
|
808
|
-
|
|
817
|
+
return /* @__PURE__ */ Be(
|
|
818
|
+
U,
|
|
809
819
|
{
|
|
810
820
|
layout: "vertical",
|
|
811
821
|
form: t,
|
|
812
|
-
size:
|
|
813
|
-
onValuesChange:
|
|
822
|
+
size: m,
|
|
823
|
+
onValuesChange: Ve,
|
|
814
824
|
children: [
|
|
815
|
-
|
|
816
|
-
|
|
825
|
+
qe,
|
|
826
|
+
Ue
|
|
817
827
|
]
|
|
818
828
|
}
|
|
819
829
|
);
|
|
820
830
|
}
|
|
821
831
|
);
|
|
822
|
-
|
|
823
|
-
function
|
|
832
|
+
kt.displayName = "DynamicForm";
|
|
833
|
+
function De(e) {
|
|
824
834
|
if (!e) return;
|
|
825
835
|
const { mode: t } = e;
|
|
826
836
|
if (t === "api" && e.api?.url)
|
|
827
837
|
return e.api;
|
|
828
838
|
if (t === "api_ids" && e.api_ids?.url) {
|
|
829
|
-
const n = e.api_ids,
|
|
839
|
+
const n = e.api_ids, r = n.method?.toUpperCase() === "POST";
|
|
830
840
|
return {
|
|
831
841
|
url: n.url,
|
|
832
842
|
method: n.method,
|
|
@@ -834,8 +844,8 @@ function xe(e) {
|
|
|
834
844
|
mapping_attr: n.mapping_attr,
|
|
835
845
|
link: n.link,
|
|
836
846
|
result_type: n.result_type ?? "array",
|
|
837
|
-
params: n.params ?? (!
|
|
838
|
-
data: n.data ?? (
|
|
847
|
+
params: n.params ?? (!r && !n.data ? { ids: "{{value}}" } : void 0),
|
|
848
|
+
data: n.data ?? (r && !n.params ? { ids: "{{value}}" } : void 0)
|
|
839
849
|
};
|
|
840
850
|
}
|
|
841
851
|
if (t === "api_detail" && e.api_detail?.url) {
|
|
@@ -853,110 +863,110 @@ function xe(e) {
|
|
|
853
863
|
};
|
|
854
864
|
}
|
|
855
865
|
}
|
|
856
|
-
function
|
|
866
|
+
function ge(e) {
|
|
857
867
|
return {
|
|
858
868
|
value: e,
|
|
859
869
|
id: e
|
|
860
870
|
};
|
|
861
871
|
}
|
|
862
|
-
function
|
|
863
|
-
const n = t.method || "GET",
|
|
872
|
+
function Et(e, t) {
|
|
873
|
+
const n = t.method || "GET", r = n.toUpperCase() === "GET";
|
|
864
874
|
if (t.url_template)
|
|
865
|
-
return (Array.isArray(e) ? e.filter((
|
|
866
|
-
const c =
|
|
875
|
+
return (Array.isArray(e) ? e.filter((d) => d != null && d !== "") : e != null && e !== "" ? [e] : []).map((d) => {
|
|
876
|
+
const c = ge(d), y = Q(t.url, c), m = t.params ? q(t.params, c) : void 0, l = t.data ? q(t.data, c) : void 0;
|
|
867
877
|
return {
|
|
868
878
|
method: n,
|
|
869
|
-
url:
|
|
870
|
-
params:
|
|
871
|
-
data:
|
|
879
|
+
url: y,
|
|
880
|
+
params: r ? m : void 0,
|
|
881
|
+
data: r ? void 0 : l
|
|
872
882
|
};
|
|
873
883
|
});
|
|
874
|
-
const
|
|
884
|
+
const i = ge(e), a = t.params ? q(t.params, i) : void 0, s = t.data ? q(t.data, i) : void 0;
|
|
875
885
|
return [
|
|
876
886
|
{
|
|
877
887
|
method: n,
|
|
878
888
|
url: t.url,
|
|
879
|
-
params:
|
|
880
|
-
data:
|
|
889
|
+
params: r ? a : void 0,
|
|
890
|
+
data: r ? void 0 : s
|
|
881
891
|
}
|
|
882
892
|
];
|
|
883
893
|
}
|
|
884
894
|
function Pe(e, t) {
|
|
885
|
-
const n = t.data_path ?
|
|
895
|
+
const n = t.data_path ? I(e, t.data_path) : e;
|
|
886
896
|
return (t.result_type ?? (Array.isArray(n) ? "array" : "object")) === "array" ? Array.isArray(n) ? n : n != null ? [n] : [] : Array.isArray(n) ? n.length ? [n[0]] : [] : n && typeof n == "object" ? [n] : [];
|
|
887
897
|
}
|
|
888
|
-
function Me(e, t) {
|
|
889
|
-
return Pt(e, t.mapping_attr);
|
|
890
|
-
}
|
|
891
898
|
function Te(e, t) {
|
|
892
|
-
return Mt(t.
|
|
899
|
+
return Mt(e, t.mapping_attr);
|
|
893
900
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
901
|
+
function xe(e, t) {
|
|
902
|
+
return jt(t.link, e);
|
|
903
|
+
}
|
|
904
|
+
async function Rt(e, t, n, r) {
|
|
905
|
+
const i = Et(e, t);
|
|
906
|
+
if (!i.length) return [];
|
|
897
907
|
const a = await Promise.all(
|
|
898
|
-
|
|
908
|
+
i.map((o) => n({ ...o, signal: r }))
|
|
899
909
|
), s = [];
|
|
900
910
|
for (const o of a)
|
|
901
911
|
s.push(...Pe(o.data, t));
|
|
902
912
|
return s;
|
|
903
913
|
}
|
|
904
|
-
function
|
|
914
|
+
function G(e) {
|
|
905
915
|
return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
906
916
|
}
|
|
907
|
-
function
|
|
908
|
-
const n = e.option_config?.api_options?.params,
|
|
909
|
-
if (!n && !
|
|
910
|
-
const
|
|
917
|
+
function Dt(e, t) {
|
|
918
|
+
const n = e.option_config?.api_options?.params, r = e.option_config?.api_options?.data;
|
|
919
|
+
if (!n && !r) return;
|
|
920
|
+
const i = (a) => {
|
|
911
921
|
const s = {};
|
|
912
922
|
for (const o in a)
|
|
913
923
|
if (typeof a[o] == "string" && a[o].startsWith("{{") && a[o].endsWith("}}")) {
|
|
914
|
-
const
|
|
915
|
-
s[o] = t?.[
|
|
924
|
+
const d = a[o].slice(2, -2).trim();
|
|
925
|
+
s[o] = t?.[d];
|
|
916
926
|
} else
|
|
917
927
|
s[o] = a[o];
|
|
918
928
|
return s;
|
|
919
929
|
};
|
|
920
930
|
return {
|
|
921
|
-
params: n ?
|
|
922
|
-
data:
|
|
931
|
+
params: n ? i(n) : void 0,
|
|
932
|
+
data: r ? i(r) : void 0
|
|
923
933
|
};
|
|
924
934
|
}
|
|
925
|
-
function
|
|
926
|
-
const n = t.option_config?.label_attr,
|
|
935
|
+
function Pt(e, t) {
|
|
936
|
+
const n = t.option_config?.label_attr, r = t.option_config?.value_attr || "";
|
|
927
937
|
if (n?.length) {
|
|
928
|
-
const
|
|
929
|
-
return e[
|
|
938
|
+
const i = n.join(" - ");
|
|
939
|
+
return e[i] !== void 0 ? String(e[i]) : n.map((a) => e[a]).filter((a) => a != null && a !== "").join(" - ");
|
|
930
940
|
}
|
|
931
|
-
return String(e[
|
|
941
|
+
return String(e[r] ?? "");
|
|
932
942
|
}
|
|
933
|
-
function
|
|
943
|
+
function Tt(e, t) {
|
|
934
944
|
if (!t?.length) return null;
|
|
935
|
-
const
|
|
936
|
-
return
|
|
945
|
+
const r = (Array.isArray(e) ? e : [e]).map((i) => t.find((a) => String(a.value) === String(i))?.label).filter((i) => !!i);
|
|
946
|
+
return r.length ? r.join(", ") : null;
|
|
937
947
|
}
|
|
938
|
-
function
|
|
939
|
-
if (
|
|
940
|
-
const
|
|
948
|
+
function xt(e, t, n) {
|
|
949
|
+
if (G(e)) return null;
|
|
950
|
+
const r = t.option_config?.value_attr || "value", i = Array.isArray(e) ? e : [e];
|
|
941
951
|
if (t.is_option_api && n?.length) {
|
|
942
|
-
const s =
|
|
943
|
-
const
|
|
944
|
-
(c) => String(c[
|
|
952
|
+
const s = i.map((o) => {
|
|
953
|
+
const d = n.find(
|
|
954
|
+
(c) => String(c[r]) === String(o)
|
|
945
955
|
);
|
|
946
|
-
return
|
|
956
|
+
return d ? Pt(d, t) : String(o);
|
|
947
957
|
}).filter(Boolean);
|
|
948
958
|
return s.length ? s.join(", ") : null;
|
|
949
959
|
}
|
|
950
|
-
const a =
|
|
951
|
-
return a ||
|
|
960
|
+
const a = Tt(e, t.metas);
|
|
961
|
+
return a || i.map(String).join(", ");
|
|
952
962
|
}
|
|
953
|
-
function
|
|
954
|
-
if (
|
|
955
|
-
const n = t.additional_config?.datetime?.format,
|
|
956
|
-
return
|
|
963
|
+
function Lt(e, t) {
|
|
964
|
+
if (G(e)) return null;
|
|
965
|
+
const n = t.additional_config?.datetime?.format, r = Z(e);
|
|
966
|
+
return r.isValid() ? n ? r.format(n) : r.format("YYYY-MM-DD HH:mm:ss") : String(e);
|
|
957
967
|
}
|
|
958
|
-
function
|
|
959
|
-
if (
|
|
968
|
+
function Ct(e) {
|
|
969
|
+
if (G(e)) return null;
|
|
960
970
|
if (Array.isArray(e)) {
|
|
961
971
|
const t = e.map(
|
|
962
972
|
(n) => typeof n == "object" && n && "name" in n ? String(n.name) : String(n)
|
|
@@ -965,20 +975,20 @@ function xt(e) {
|
|
|
965
975
|
}
|
|
966
976
|
return String(e);
|
|
967
977
|
}
|
|
968
|
-
function
|
|
978
|
+
function Mt(e, t) {
|
|
969
979
|
return t?.length ? t.map((n) => {
|
|
970
|
-
const
|
|
971
|
-
return
|
|
980
|
+
const r = I(e, n) ?? e[n];
|
|
981
|
+
return r != null ? String(r) : "";
|
|
972
982
|
}).filter(Boolean).join(" - ") : JSON.stringify(e);
|
|
973
983
|
}
|
|
974
|
-
function
|
|
975
|
-
return e ? e.replace(/\{\{(.+?)\}\}/g, (n,
|
|
976
|
-
const
|
|
984
|
+
function jt(e, t) {
|
|
985
|
+
return e ? e.replace(/\{\{(.+?)\}\}/g, (n, r) => {
|
|
986
|
+
const i = r.trim(), a = I(t, i) ?? t[i];
|
|
977
987
|
return a != null ? String(a) : "";
|
|
978
988
|
}) : null;
|
|
979
989
|
}
|
|
980
|
-
function
|
|
981
|
-
if (
|
|
990
|
+
function Ae(e, t, n) {
|
|
991
|
+
if (G(e)) return null;
|
|
982
992
|
switch (t?.mode ?? "formatted") {
|
|
983
993
|
case "raw":
|
|
984
994
|
case "formatted":
|
|
@@ -986,265 +996,320 @@ function ge(e, t, n) {
|
|
|
986
996
|
case "api":
|
|
987
997
|
case "api_ids":
|
|
988
998
|
case "api_detail": {
|
|
989
|
-
const
|
|
990
|
-
if (!n || !
|
|
999
|
+
const i = De(t);
|
|
1000
|
+
if (!n || !i)
|
|
991
1001
|
return Array.isArray(e) ? e.map(String).join(", ") : String(e);
|
|
992
|
-
const a = Pe(n,
|
|
1002
|
+
const a = Pe(n, i);
|
|
993
1003
|
return a.length ? a.map((o) => {
|
|
994
|
-
const
|
|
995
|
-
return c ? `${
|
|
1004
|
+
const d = Te(o, i), c = xe(o, i);
|
|
1005
|
+
return c ? `${d} (${c})` : d;
|
|
996
1006
|
}).filter(Boolean).join(", ") || null : String(e);
|
|
997
1007
|
}
|
|
998
1008
|
default:
|
|
999
1009
|
return String(e);
|
|
1000
1010
|
}
|
|
1001
1011
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const
|
|
1004
|
-
if (
|
|
1005
|
-
return
|
|
1012
|
+
function Ot(e, t, n) {
|
|
1013
|
+
const r = e.additional_config?.view_value;
|
|
1014
|
+
if (r?.mode === "api" || r?.mode === "api_ids" || r?.mode === "api_detail")
|
|
1015
|
+
return Ae(
|
|
1006
1016
|
t,
|
|
1007
|
-
|
|
1017
|
+
r,
|
|
1008
1018
|
n.viewValueFetched
|
|
1009
1019
|
);
|
|
1010
1020
|
switch (e.field?.type?.code) {
|
|
1011
1021
|
case "text":
|
|
1012
1022
|
case "number":
|
|
1013
|
-
return
|
|
1023
|
+
return G(t) ? null : String(t);
|
|
1014
1024
|
case "datetime":
|
|
1015
|
-
return
|
|
1025
|
+
return Lt(t, e);
|
|
1016
1026
|
case "select":
|
|
1017
1027
|
case "radio":
|
|
1018
1028
|
case "checkbox":
|
|
1019
|
-
return
|
|
1029
|
+
return xt(t, e, n.optionList);
|
|
1020
1030
|
case "image":
|
|
1021
1031
|
case "file":
|
|
1022
|
-
return
|
|
1032
|
+
return Ct(t);
|
|
1023
1033
|
default:
|
|
1024
|
-
return
|
|
1034
|
+
return r ? Ae(
|
|
1025
1035
|
t,
|
|
1026
|
-
|
|
1036
|
+
r,
|
|
1027
1037
|
n.viewValueFetched
|
|
1028
|
-
) :
|
|
1038
|
+
) : G(t) ? null : String(t);
|
|
1029
1039
|
}
|
|
1030
1040
|
}
|
|
1031
|
-
const
|
|
1032
|
-
function
|
|
1033
|
-
const t =
|
|
1041
|
+
const X = /* @__PURE__ */ new Map(), Vt = 3e4;
|
|
1042
|
+
function qt(e) {
|
|
1043
|
+
const t = X.get(e);
|
|
1034
1044
|
if (t) {
|
|
1035
1045
|
if (Date.now() > t.expiresAt) {
|
|
1036
|
-
|
|
1046
|
+
X.delete(e);
|
|
1037
1047
|
return;
|
|
1038
1048
|
}
|
|
1039
1049
|
return t.error;
|
|
1040
1050
|
}
|
|
1041
1051
|
}
|
|
1042
1052
|
function Se(e, t) {
|
|
1043
|
-
|
|
1053
|
+
X.set(e, {
|
|
1044
1054
|
error: t,
|
|
1045
|
-
expiresAt: Date.now() +
|
|
1055
|
+
expiresAt: Date.now() + Vt
|
|
1046
1056
|
});
|
|
1047
1057
|
}
|
|
1048
|
-
function
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
const l =
|
|
1052
|
-
return
|
|
1058
|
+
function ee(e, t, n = !0) {
|
|
1059
|
+
const r = M(), [i, a] = P(), [s, o] = P(!1), [d, c] = P(), y = B(t), m = B(r);
|
|
1060
|
+
y.current = t, m.current = r;
|
|
1061
|
+
const l = le(e);
|
|
1062
|
+
return V(() => {
|
|
1053
1063
|
if (!n) {
|
|
1054
1064
|
a(void 0), c(void 0), o(!1);
|
|
1055
1065
|
return;
|
|
1056
1066
|
}
|
|
1057
|
-
const
|
|
1058
|
-
if (
|
|
1059
|
-
c(
|
|
1067
|
+
const h = qt(l);
|
|
1068
|
+
if (h !== void 0) {
|
|
1069
|
+
c(h), o(!1);
|
|
1060
1070
|
return;
|
|
1061
1071
|
}
|
|
1062
|
-
const
|
|
1072
|
+
const u = new AbortController();
|
|
1063
1073
|
return o(!0), c(void 0), (async () => {
|
|
1064
1074
|
try {
|
|
1065
|
-
const _ = await
|
|
1066
|
-
|
|
1075
|
+
const _ = await re(
|
|
1076
|
+
m.current,
|
|
1067
1077
|
"viewCache",
|
|
1068
1078
|
l,
|
|
1069
|
-
(w) =>
|
|
1070
|
-
|
|
1079
|
+
(w) => y.current(w),
|
|
1080
|
+
u.signal
|
|
1071
1081
|
);
|
|
1072
|
-
|
|
1082
|
+
u.signal.aborted || (a(_), c(void 0));
|
|
1073
1083
|
} catch (_) {
|
|
1074
|
-
|
|
1084
|
+
u.signal.aborted || (Se(l, _), c(_));
|
|
1075
1085
|
} finally {
|
|
1076
|
-
|
|
1086
|
+
u.signal.aborted || o(!1);
|
|
1077
1087
|
}
|
|
1078
|
-
})(), () =>
|
|
1079
|
-
}, [n, l]), { data:
|
|
1080
|
-
if (
|
|
1081
|
-
const
|
|
1088
|
+
})(), () => u.abort();
|
|
1089
|
+
}, [n, l]), { data: i, isLoading: s, error: d, refetch: async () => {
|
|
1090
|
+
if (X.delete(l), !n) return;
|
|
1091
|
+
const h = new AbortController();
|
|
1082
1092
|
o(!0), c(void 0);
|
|
1083
1093
|
try {
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1094
|
+
const u = await re(
|
|
1095
|
+
m.current,
|
|
1086
1096
|
"viewCache",
|
|
1087
1097
|
l,
|
|
1088
|
-
(v) =>
|
|
1089
|
-
|
|
1098
|
+
(v) => y.current(v),
|
|
1099
|
+
h.signal
|
|
1090
1100
|
);
|
|
1091
|
-
return a(
|
|
1092
|
-
} catch (
|
|
1093
|
-
throw Se(l,
|
|
1101
|
+
return a(u), u;
|
|
1102
|
+
} catch (u) {
|
|
1103
|
+
throw Se(l, u), c(u), u;
|
|
1094
1104
|
} finally {
|
|
1095
1105
|
o(!1);
|
|
1096
1106
|
}
|
|
1097
1107
|
} };
|
|
1098
1108
|
}
|
|
1099
|
-
const
|
|
1109
|
+
const Ut = ({ value: e, code: t, modeConfig: n }) => {
|
|
1110
|
+
const { client: r, renderers: i, i18n: a } = M(), s = R(
|
|
1111
|
+
() => (Array.isArray(e) ? e : [e]).filter(Boolean),
|
|
1112
|
+
[e]
|
|
1113
|
+
), {
|
|
1114
|
+
data: o,
|
|
1115
|
+
isLoading: d,
|
|
1116
|
+
error: c
|
|
1117
|
+
} = ee(
|
|
1118
|
+
["api_detail", t, s, n?.url, n?.method],
|
|
1119
|
+
async (l) => (await Promise.all(
|
|
1120
|
+
s.map(async (h) => {
|
|
1121
|
+
const u = Q(n?.url || "", { id: h });
|
|
1122
|
+
return (await r.request({
|
|
1123
|
+
method: n?.method,
|
|
1124
|
+
url: u,
|
|
1125
|
+
signal: l
|
|
1126
|
+
})).data;
|
|
1127
|
+
})
|
|
1128
|
+
)).filter(Boolean),
|
|
1129
|
+
!!(s.length && n?.url)
|
|
1130
|
+
), y = (l, p, h) => i.link ? i.link({ url: l, label: p, data: h }) : /* @__PURE__ */ f("a", { href: l, target: "_blank", rel: "noreferrer", children: p }), m = (l) => {
|
|
1131
|
+
const p = n?.mapping_attr?.map((h) => l?.[h]).join(" - ");
|
|
1132
|
+
if (n?.link) {
|
|
1133
|
+
const h = Q(n.link, l);
|
|
1134
|
+
return y(h, p, l);
|
|
1135
|
+
}
|
|
1136
|
+
return p;
|
|
1137
|
+
};
|
|
1138
|
+
return d ? /* @__PURE__ */ f(x, { children: i.viewLoading?.() ?? /* @__PURE__ */ f(ae, { size: "small" }) }) : c ? /* @__PURE__ */ f(x, { children: i.viewError?.(c) ?? a.messages.viewError }) : o?.length ? /* @__PURE__ */ f(x, { children: o.map((l, p) => /* @__PURE__ */ f("div", { children: m(l) }, p)) }) : /* @__PURE__ */ f(x, { children: i.viewEmpty?.() ?? a.messages.viewEmpty });
|
|
1139
|
+
}, Le = C(Ut), Bt = ({ value: e, code: t, modeConfig: n }) => {
|
|
1140
|
+
const { client: r, renderers: i, i18n: a } = M(), {
|
|
1141
|
+
data: s,
|
|
1142
|
+
isLoading: o,
|
|
1143
|
+
error: d
|
|
1144
|
+
} = ee(
|
|
1145
|
+
["api_ids", t, e, n?.url, n?.method],
|
|
1146
|
+
async (m) => {
|
|
1147
|
+
const l = n?.method || "GET", p = l.toUpperCase() === "POST", h = Array.isArray(e) ? e : [e], v = (await r.request({
|
|
1148
|
+
method: l,
|
|
1149
|
+
url: n?.url || "",
|
|
1150
|
+
data: p ? { ids: h } : void 0,
|
|
1151
|
+
params: p ? void 0 : { ids: h },
|
|
1152
|
+
signal: m
|
|
1153
|
+
})).data, _ = n?.data_path ? I(v, n.data_path) : v;
|
|
1154
|
+
return Array.isArray(_) ? _ : v;
|
|
1155
|
+
},
|
|
1156
|
+
!!(e && n?.url)
|
|
1157
|
+
), c = (m, l, p) => i.link ? i.link({ url: m, label: l, data: p }) : /* @__PURE__ */ f("a", { href: m, target: "_blank", rel: "noreferrer", children: l }), y = (m) => {
|
|
1158
|
+
const l = n?.mapping_attr?.map((p) => m?.[p]).join(" - ");
|
|
1159
|
+
if (n?.link) {
|
|
1160
|
+
const p = Q(n.link, m);
|
|
1161
|
+
return c(p, l, m);
|
|
1162
|
+
}
|
|
1163
|
+
return l;
|
|
1164
|
+
};
|
|
1165
|
+
return o ? /* @__PURE__ */ f(x, { children: i.viewLoading?.() ?? /* @__PURE__ */ f(ae, { size: "small" }) }) : d ? /* @__PURE__ */ f(x, { children: i.viewError?.(d) ?? a.messages.viewError }) : s ? Array.isArray(e) ? /* @__PURE__ */ f(ie, { vertical: !0, children: (Array.isArray(s) ? s : [s]).map((m, l) => /* @__PURE__ */ f("div", { children: y(m) }, m.id ?? l)) }) : y(
|
|
1166
|
+
Array.isArray(s) ? s[0] : s
|
|
1167
|
+
) : /* @__PURE__ */ f(x, { children: i.viewEmpty?.() ?? a.messages.viewEmpty });
|
|
1168
|
+
}, Ce = C(Bt), Gt = ({
|
|
1100
1169
|
value: e,
|
|
1101
1170
|
code: t,
|
|
1102
1171
|
modeConfig: n,
|
|
1103
|
-
viewConfig:
|
|
1172
|
+
viewConfig: r
|
|
1104
1173
|
}) => {
|
|
1105
|
-
const { client:
|
|
1106
|
-
() => n ?? (
|
|
1107
|
-
[n,
|
|
1108
|
-
),
|
|
1174
|
+
const { client: i, renderers: a, i18n: s } = M(), o = R(
|
|
1175
|
+
() => n ?? (r ? De(r) : void 0),
|
|
1176
|
+
[n, r]
|
|
1177
|
+
), d = R(
|
|
1109
1178
|
() => ["api_view", t, e, o?.url, o?.method, o?.data_path],
|
|
1110
1179
|
[t, e, o?.url, o?.method, o?.data_path]
|
|
1111
|
-
), c =
|
|
1112
|
-
async (
|
|
1180
|
+
), c = T(
|
|
1181
|
+
async (u) => o ? Rt(
|
|
1113
1182
|
e,
|
|
1114
1183
|
o,
|
|
1115
|
-
(v) =>
|
|
1184
|
+
(v) => i.request({ ...v, signal: u })
|
|
1116
1185
|
) : [],
|
|
1117
|
-
[
|
|
1118
|
-
), { data:
|
|
1186
|
+
[i, o, e]
|
|
1187
|
+
), { data: y, isLoading: m, error: l } = ee(d, c, !!(e && o?.url)), p = (u, v, _) => a.link ? a.link({ url: u, label: v, data: _ }) : /* @__PURE__ */ f("a", { href: u, target: "_blank", rel: "noreferrer", children: v }), h = (u, v) => {
|
|
1119
1188
|
if (!o) return null;
|
|
1120
|
-
const _ =
|
|
1121
|
-
return /* @__PURE__ */ f("div", { children:
|
|
1189
|
+
const _ = Te(u, o), w = xe(u, o), b = w ? p(w, _, u) : _;
|
|
1190
|
+
return /* @__PURE__ */ f("div", { children: b }, u.id ?? v);
|
|
1122
1191
|
};
|
|
1123
|
-
return
|
|
1124
|
-
},
|
|
1125
|
-
function
|
|
1192
|
+
return m ? /* @__PURE__ */ f(x, { children: a.viewLoading?.() ?? /* @__PURE__ */ f(ae, { size: "small" }) }) : l ? /* @__PURE__ */ f(x, { children: a.viewError?.(l) ?? s.messages.viewError }) : y?.length ? o?.result_type === "object" && y.length === 1 ? h(y[0], 0) : /* @__PURE__ */ f(ie, { vertical: !0, children: y.map(h) }) : /* @__PURE__ */ f(x, { children: a.viewEmpty?.() ?? s.messages.viewEmpty });
|
|
1193
|
+
}, Me = C(Gt);
|
|
1194
|
+
function It(e) {
|
|
1126
1195
|
return !!(e.option_config && e.is_option_api);
|
|
1127
1196
|
}
|
|
1128
|
-
function
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1131
|
-
function qt(e, t) {
|
|
1132
|
-
const n = V(), i = ae([
|
|
1197
|
+
function Wt(e, t) {
|
|
1198
|
+
const n = M(), r = le([
|
|
1133
1199
|
"viewModeOptions",
|
|
1134
1200
|
e.map((a) => a.code),
|
|
1135
1201
|
t
|
|
1136
|
-
]), { data:
|
|
1137
|
-
[
|
|
1202
|
+
]), { data: i } = ee(
|
|
1203
|
+
[r],
|
|
1138
1204
|
async (a) => {
|
|
1139
1205
|
const s = {};
|
|
1140
1206
|
return await Promise.all(
|
|
1141
1207
|
e.map(async (o) => {
|
|
1142
1208
|
if (!o.option_config?.url) return;
|
|
1143
|
-
const
|
|
1209
|
+
const d = Dt(o, t), c = o.option_config.method?.toUpperCase() === "GET" || !o.option_config.method, y = await n.client.request({
|
|
1144
1210
|
method: o.option_config.method || "GET",
|
|
1145
1211
|
url: o.option_config.url,
|
|
1146
|
-
params: c ?
|
|
1147
|
-
data: c ? void 0 :
|
|
1212
|
+
params: c ? d?.params : void 0,
|
|
1213
|
+
data: c ? void 0 : d?.data,
|
|
1148
1214
|
signal: a
|
|
1149
1215
|
});
|
|
1150
1216
|
s[o.code] = {
|
|
1151
|
-
optionList: n.parsers.optionResponse(
|
|
1217
|
+
optionList: n.parsers.optionResponse(y.data, o)
|
|
1152
1218
|
};
|
|
1153
1219
|
})
|
|
1154
1220
|
), s;
|
|
1155
1221
|
},
|
|
1156
1222
|
e.length > 0
|
|
1157
1223
|
);
|
|
1158
|
-
return
|
|
1224
|
+
return i ?? {};
|
|
1159
1225
|
}
|
|
1160
|
-
const
|
|
1226
|
+
const nn = ({
|
|
1161
1227
|
formConfig: e,
|
|
1162
1228
|
formValues: t
|
|
1163
1229
|
}) => {
|
|
1164
|
-
const n = e?.form?.field_groups ?? [],
|
|
1165
|
-
() => n.filter(
|
|
1230
|
+
const n = e?.form?.field_groups ?? [], r = R(
|
|
1231
|
+
() => n.filter(It),
|
|
1166
1232
|
[n]
|
|
1167
|
-
),
|
|
1233
|
+
), i = Wt(r, t);
|
|
1168
1234
|
return R(() => n.filter((s) => !s.is_hidden).map((s) => {
|
|
1169
|
-
const o = t?.[s.code],
|
|
1170
|
-
if (
|
|
1235
|
+
const o = t?.[s.code], d = s.additional_config?.view_value, c = d?.mode;
|
|
1236
|
+
if (c === "api" && d)
|
|
1237
|
+
return {
|
|
1238
|
+
key: s.code,
|
|
1239
|
+
label: s.label,
|
|
1240
|
+
rawValue: o,
|
|
1241
|
+
viewValue: /* @__PURE__ */ f(
|
|
1242
|
+
Me,
|
|
1243
|
+
{
|
|
1244
|
+
code: s.code,
|
|
1245
|
+
value: o,
|
|
1246
|
+
viewConfig: d
|
|
1247
|
+
}
|
|
1248
|
+
),
|
|
1249
|
+
field_group: s
|
|
1250
|
+
};
|
|
1251
|
+
if (c === "api_ids" && d?.api_ids)
|
|
1171
1252
|
return {
|
|
1172
1253
|
key: s.code,
|
|
1173
1254
|
label: s.label,
|
|
1174
1255
|
rawValue: o,
|
|
1175
1256
|
viewValue: /* @__PURE__ */ f(
|
|
1176
|
-
|
|
1257
|
+
Ce,
|
|
1177
1258
|
{
|
|
1178
1259
|
code: s.code,
|
|
1179
1260
|
value: o,
|
|
1180
|
-
|
|
1261
|
+
modeConfig: d.api_ids
|
|
1181
1262
|
}
|
|
1182
1263
|
),
|
|
1183
1264
|
field_group: s
|
|
1184
1265
|
};
|
|
1185
|
-
|
|
1266
|
+
if (c === "api_detail" && d?.api_detail)
|
|
1267
|
+
return {
|
|
1268
|
+
key: s.code,
|
|
1269
|
+
label: s.label,
|
|
1270
|
+
rawValue: o,
|
|
1271
|
+
viewValue: /* @__PURE__ */ f(
|
|
1272
|
+
Le,
|
|
1273
|
+
{
|
|
1274
|
+
code: s.code,
|
|
1275
|
+
value: o,
|
|
1276
|
+
modeConfig: d.api_detail
|
|
1277
|
+
}
|
|
1278
|
+
),
|
|
1279
|
+
field_group: s
|
|
1280
|
+
};
|
|
1281
|
+
const y = i[s.code] ?? {};
|
|
1186
1282
|
return {
|
|
1187
1283
|
key: s.code,
|
|
1188
1284
|
label: s.label,
|
|
1189
1285
|
rawValue: o,
|
|
1190
|
-
viewValue:
|
|
1286
|
+
viewValue: Ot(s, o, y),
|
|
1191
1287
|
field_group: s
|
|
1192
1288
|
};
|
|
1193
|
-
}), [
|
|
1194
|
-
},
|
|
1289
|
+
}), [i, n, t]);
|
|
1290
|
+
}, Kt = ({
|
|
1195
1291
|
code: e,
|
|
1196
1292
|
value: t,
|
|
1197
1293
|
fieldGroup: n
|
|
1198
1294
|
}) => {
|
|
1199
|
-
const
|
|
1200
|
-
switch (
|
|
1295
|
+
const r = n?.additional_config?.view_value;
|
|
1296
|
+
switch (r?.mode) {
|
|
1201
1297
|
case "raw":
|
|
1202
1298
|
return t;
|
|
1203
1299
|
case "api":
|
|
1204
|
-
|
|
1205
|
-
case "
|
|
1206
|
-
|
|
1300
|
+
return /* @__PURE__ */ f(Me, { code: e, value: t, viewConfig: r });
|
|
1301
|
+
case "api_ids": {
|
|
1302
|
+
const i = r?.api_ids;
|
|
1303
|
+
return /* @__PURE__ */ f(Ce, { code: e, value: t, modeConfig: i });
|
|
1304
|
+
}
|
|
1305
|
+
case "api_detail": {
|
|
1306
|
+
const i = r?.api_detail;
|
|
1307
|
+
return /* @__PURE__ */ f(Le, { code: e, value: t, modeConfig: i });
|
|
1308
|
+
}
|
|
1207
1309
|
default:
|
|
1208
1310
|
return t;
|
|
1209
1311
|
}
|
|
1210
|
-
},
|
|
1211
|
-
se,
|
|
1212
|
-
{
|
|
1213
|
-
code: t,
|
|
1214
|
-
value: e,
|
|
1215
|
-
viewConfig: n ? { mode: "api_ids", api_ids: n } : void 0
|
|
1216
|
-
}
|
|
1217
|
-
), tn = M(It), Bt = ({ value: e, code: t, modeConfig: n }) => {
|
|
1218
|
-
const { client: i, renderers: r, i18n: a } = V(), s = R(
|
|
1219
|
-
() => (Array.isArray(e) ? e : [e]).filter(Boolean),
|
|
1220
|
-
[e]
|
|
1221
|
-
), {
|
|
1222
|
-
data: o,
|
|
1223
|
-
isLoading: u,
|
|
1224
|
-
error: c
|
|
1225
|
-
} = oe(
|
|
1226
|
-
["api_detail", t, s, n?.url, n?.method],
|
|
1227
|
-
async (l) => (await Promise.all(
|
|
1228
|
-
s.map(async (p) => {
|
|
1229
|
-
const d = ne(n?.url || "", { id: p });
|
|
1230
|
-
return (await i.request({
|
|
1231
|
-
method: n?.method,
|
|
1232
|
-
url: d,
|
|
1233
|
-
signal: l
|
|
1234
|
-
})).data;
|
|
1235
|
-
})
|
|
1236
|
-
)).filter(Boolean),
|
|
1237
|
-
!!(s.length && n?.url)
|
|
1238
|
-
), h = (l, b, p) => r.link ? r.link({ url: l, label: b, data: p }) : /* @__PURE__ */ f("a", { href: l, target: "_blank", rel: "noreferrer", children: b }), y = (l) => {
|
|
1239
|
-
const b = n?.mapping_attr?.map((p) => l?.[p]).join(" - ");
|
|
1240
|
-
if (n?.link) {
|
|
1241
|
-
const p = ne(n.link, l);
|
|
1242
|
-
return h(p, b, l);
|
|
1243
|
-
}
|
|
1244
|
-
return b;
|
|
1245
|
-
};
|
|
1246
|
-
return u ? /* @__PURE__ */ f(L, { children: r.viewLoading?.() ?? /* @__PURE__ */ f(ke, { size: "small" }) }) : c ? /* @__PURE__ */ f(L, { children: r.viewError?.(c) ?? a.messages.viewError }) : o?.length ? /* @__PURE__ */ f(L, { children: o.map((l, b) => /* @__PURE__ */ f("div", { children: y(l) }, b)) }) : /* @__PURE__ */ f(L, { children: r.viewEmpty?.() ?? a.messages.viewEmpty });
|
|
1247
|
-
}, nn = M(Bt), Ce = {
|
|
1312
|
+
}, rn = C(Kt), je = {
|
|
1248
1313
|
submit: "Save",
|
|
1249
1314
|
submitError: "Failed to submit form",
|
|
1250
1315
|
inputPlaceholder: (e) => `Enter ${e}`,
|
|
@@ -1255,9 +1320,9 @@ const Zt = ({
|
|
|
1255
1320
|
viewLoading: "Loading...",
|
|
1256
1321
|
viewEmpty: "-",
|
|
1257
1322
|
viewError: "Failed to load"
|
|
1258
|
-
},
|
|
1259
|
-
messages:
|
|
1260
|
-
},
|
|
1323
|
+
}, an = {
|
|
1324
|
+
messages: je
|
|
1325
|
+
}, $t = (e) => {
|
|
1261
1326
|
if (Array.isArray(e)) return e;
|
|
1262
1327
|
if (e && typeof e == "object" && "items" in e && Array.isArray(e.items))
|
|
1263
1328
|
return e.items;
|
|
@@ -1266,104 +1331,104 @@ const Zt = ({
|
|
|
1266
1331
|
return Array.isArray(t.items) ? t.items : [];
|
|
1267
1332
|
}
|
|
1268
1333
|
return [];
|
|
1269
|
-
},
|
|
1334
|
+
}, zt = (e) => ({
|
|
1270
1335
|
redirectUrl: e?.redirect_after_create,
|
|
1271
1336
|
data: e
|
|
1272
|
-
}),
|
|
1273
|
-
optionResponse:
|
|
1274
|
-
submitResponse:
|
|
1275
|
-
viewResponse:
|
|
1276
|
-
},
|
|
1337
|
+
}), Ht = (e, t) => t?.dataPath ? I(e, t.dataPath) : e, te = {
|
|
1338
|
+
optionResponse: $t,
|
|
1339
|
+
submitResponse: zt,
|
|
1340
|
+
viewResponse: Ht
|
|
1341
|
+
}, Yt = (e, t = "_blank") => {
|
|
1277
1342
|
window.open(e, t);
|
|
1278
|
-
},
|
|
1343
|
+
}, ne = {
|
|
1279
1344
|
upload: async () => {
|
|
1280
1345
|
throw new Error("Upload adapter is not configured");
|
|
1281
1346
|
},
|
|
1282
1347
|
remove: async () => !1
|
|
1283
1348
|
};
|
|
1284
|
-
function
|
|
1349
|
+
function on({
|
|
1285
1350
|
children: e,
|
|
1286
1351
|
client: t,
|
|
1287
1352
|
upload: n,
|
|
1288
|
-
i18n:
|
|
1289
|
-
parsers:
|
|
1353
|
+
i18n: r,
|
|
1354
|
+
parsers: i,
|
|
1290
1355
|
renderers: a = {},
|
|
1291
1356
|
transformers: s = {},
|
|
1292
1357
|
cache: o,
|
|
1293
|
-
submitDebounceMs:
|
|
1358
|
+
submitDebounceMs: d = 200,
|
|
1294
1359
|
redirectHandler: c,
|
|
1295
1360
|
// legacy props
|
|
1296
|
-
requestClient:
|
|
1297
|
-
uploadAdapter:
|
|
1361
|
+
requestClient: y,
|
|
1362
|
+
uploadAdapter: m,
|
|
1298
1363
|
deleteUploadAdapter: l,
|
|
1299
|
-
messages:
|
|
1300
|
-
optionResponseParser:
|
|
1301
|
-
customFieldRenderers:
|
|
1364
|
+
messages: p,
|
|
1365
|
+
optionResponseParser: h,
|
|
1366
|
+
customFieldRenderers: u
|
|
1302
1367
|
}) {
|
|
1303
|
-
const v =
|
|
1304
|
-
const
|
|
1305
|
-
request:
|
|
1368
|
+
const v = B(/* @__PURE__ */ new Map()), _ = B(/* @__PURE__ */ new Map()), w = R(() => {
|
|
1369
|
+
const b = t ?? {
|
|
1370
|
+
request: y ?? (() => {
|
|
1306
1371
|
throw new Error("DynamicFormProvider requires client or requestClient");
|
|
1307
1372
|
})
|
|
1308
|
-
},
|
|
1309
|
-
match:
|
|
1310
|
-
render:
|
|
1311
|
-
})) : [],
|
|
1312
|
-
...
|
|
1313
|
-
...
|
|
1314
|
-
...
|
|
1373
|
+
}, S = u ? Object.entries(u).map(([k, D]) => ({
|
|
1374
|
+
match: k,
|
|
1375
|
+
render: D
|
|
1376
|
+
})) : [], A = {
|
|
1377
|
+
...je,
|
|
1378
|
+
...r?.messages,
|
|
1379
|
+
...p
|
|
1315
1380
|
}, g = {
|
|
1316
|
-
...
|
|
1381
|
+
...ne,
|
|
1317
1382
|
...n,
|
|
1318
|
-
upload: n?.upload ??
|
|
1319
|
-
remove: n?.remove ?? (l ? (
|
|
1383
|
+
upload: n?.upload ?? m ?? ne.upload,
|
|
1384
|
+
remove: n?.remove ?? (l ? (k) => l(k.path) : ne.remove)
|
|
1320
1385
|
};
|
|
1321
1386
|
return {
|
|
1322
|
-
client:
|
|
1387
|
+
client: b,
|
|
1323
1388
|
upload: g,
|
|
1324
|
-
i18n: { messages:
|
|
1389
|
+
i18n: { messages: A },
|
|
1325
1390
|
parsers: {
|
|
1326
|
-
optionResponse:
|
|
1327
|
-
submitResponse:
|
|
1328
|
-
viewResponse:
|
|
1391
|
+
optionResponse: i?.optionResponse ?? h ?? te.optionResponse,
|
|
1392
|
+
submitResponse: i?.submitResponse ?? te.submitResponse,
|
|
1393
|
+
viewResponse: i?.viewResponse ?? te.viewResponse
|
|
1329
1394
|
},
|
|
1330
1395
|
renderers: {
|
|
1331
1396
|
...a,
|
|
1332
|
-
fields: [...a.fields ?? [], ...
|
|
1397
|
+
fields: [...a.fields ?? [], ...S]
|
|
1333
1398
|
},
|
|
1334
1399
|
transformers: s,
|
|
1335
1400
|
cache: {
|
|
1336
1401
|
enabled: o?.enabled ?? !0,
|
|
1337
1402
|
ttlMs: o?.ttlMs ?? 6e4
|
|
1338
1403
|
},
|
|
1339
|
-
submitDebounceMs:
|
|
1340
|
-
redirectHandler: c ??
|
|
1404
|
+
submitDebounceMs: d,
|
|
1405
|
+
redirectHandler: c ?? Yt,
|
|
1341
1406
|
optionCache: v.current,
|
|
1342
1407
|
viewCache: _.current
|
|
1343
1408
|
};
|
|
1344
1409
|
}, [
|
|
1345
1410
|
t,
|
|
1346
|
-
h,
|
|
1347
|
-
n,
|
|
1348
1411
|
y,
|
|
1412
|
+
n,
|
|
1413
|
+
m,
|
|
1349
1414
|
l,
|
|
1350
|
-
|
|
1351
|
-
b,
|
|
1352
|
-
r?.optionResponse,
|
|
1353
|
-
r?.submitResponse,
|
|
1354
|
-
r?.viewResponse,
|
|
1415
|
+
r?.messages,
|
|
1355
1416
|
p,
|
|
1417
|
+
i?.optionResponse,
|
|
1418
|
+
i?.submitResponse,
|
|
1419
|
+
i?.viewResponse,
|
|
1420
|
+
h,
|
|
1356
1421
|
a,
|
|
1357
|
-
|
|
1422
|
+
u,
|
|
1358
1423
|
s,
|
|
1359
1424
|
o?.enabled,
|
|
1360
1425
|
o?.ttlMs,
|
|
1361
|
-
|
|
1426
|
+
d,
|
|
1362
1427
|
c
|
|
1363
1428
|
]);
|
|
1364
|
-
return /* @__PURE__ */ f(
|
|
1429
|
+
return /* @__PURE__ */ f(oe.Provider, { value: w, children: e });
|
|
1365
1430
|
}
|
|
1366
|
-
function
|
|
1431
|
+
function sn(e) {
|
|
1367
1432
|
return {
|
|
1368
1433
|
request: async (t) => ({ data: (await e({
|
|
1369
1434
|
method: t.method,
|
|
@@ -1377,55 +1442,55 @@ function on(e) {
|
|
|
1377
1442
|
};
|
|
1378
1443
|
}
|
|
1379
1444
|
export {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1445
|
+
Le as ApiDetailItem,
|
|
1446
|
+
Ce as ApiItem,
|
|
1447
|
+
Me as ApiViewItem,
|
|
1448
|
+
gt as DefaultLayout,
|
|
1449
|
+
kt as DynamicForm,
|
|
1450
|
+
on as DynamicFormProvider,
|
|
1451
|
+
wt as FormItem,
|
|
1452
|
+
rn as MetaItemValue,
|
|
1453
|
+
Et as buildApiViewRequests,
|
|
1454
|
+
le as buildCacheKey,
|
|
1455
|
+
re as cachedRequest,
|
|
1456
|
+
sn as createAxiosDynamicFormClient,
|
|
1457
|
+
se as debounce,
|
|
1458
|
+
an as defaultI18n,
|
|
1459
|
+
je as defaultMessages,
|
|
1460
|
+
$t as defaultOptionResponseParser,
|
|
1461
|
+
te as defaultParsers,
|
|
1462
|
+
Yt as defaultRedirectHandler,
|
|
1463
|
+
zt as defaultSubmitResponseParser,
|
|
1464
|
+
Ht as defaultViewResponseParser,
|
|
1465
|
+
pt as extractDependencyFields,
|
|
1401
1466
|
Pe as extractViewData,
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1467
|
+
Rt as fetchApiViewItems,
|
|
1468
|
+
Q as fillTemplate,
|
|
1469
|
+
I as getByPath,
|
|
1470
|
+
dt as getCached,
|
|
1471
|
+
Te as getMappedLabel,
|
|
1472
|
+
xe as getMappedLink,
|
|
1473
|
+
G as isEmptyValue,
|
|
1474
|
+
tt as mapOptionToSelectItem,
|
|
1475
|
+
nt as mapOptions,
|
|
1476
|
+
De as normalizeApiViewConfig,
|
|
1477
|
+
tn as normalizeMetaForForm,
|
|
1478
|
+
mt as parseFormValues,
|
|
1479
|
+
q as replaceTemplateInObject,
|
|
1480
|
+
Dt as resolveApiOptionMeta,
|
|
1481
|
+
Ze as resolveFieldRenderer,
|
|
1482
|
+
et as resolveFieldRendererFromMap,
|
|
1483
|
+
Ot as resolveFieldViewValue,
|
|
1484
|
+
Ae as resolveViewValueConfig,
|
|
1485
|
+
ut as setCache,
|
|
1486
|
+
ee as useCachedViewRequest,
|
|
1487
|
+
yt as useDependencyValues,
|
|
1488
|
+
ct as useDynamicField,
|
|
1489
|
+
M as useDynamicFormContext,
|
|
1490
|
+
en as useDynamicFormContextOptional,
|
|
1491
|
+
bt as useDynamicOptions,
|
|
1492
|
+
At as useFieldGroups,
|
|
1493
|
+
St as useFieldStates,
|
|
1494
|
+
Ft as useProcessedValues,
|
|
1495
|
+
nn as useViewMode
|
|
1431
1496
|
};
|