@trungkhai/dynamic-form 0.1.0

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