@rytass/bpm-core-react 0.21.3 → 0.21.4

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunks/{FormBuilderView-Bq4TXdxF.cjs → FormBuilderView-Bok4Y59D.cjs} +2 -2
  3. package/dist/chunks/{FormBuilderView-Bq4TXdxF.cjs.map → FormBuilderView-Bok4Y59D.cjs.map} +1 -1
  4. package/dist/chunks/{FormBuilderView-DNsFwZgk.js → FormBuilderView-DbfbLZCI.js} +2 -2
  5. package/dist/chunks/{FormBuilderView-DNsFwZgk.js.map → FormBuilderView-DbfbLZCI.js.map} +1 -1
  6. package/dist/chunks/{FormRendererView-BF8Ge0Zk.js → FormRendererView-CAyPXhPq.js} +312 -307
  7. package/dist/chunks/FormRendererView-CAyPXhPq.js.map +1 -0
  8. package/dist/chunks/FormRendererView-iLlHFIUR.cjs +6 -0
  9. package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +1 -0
  10. package/dist/chunks/{compose-NHbyjV73.cjs → compose-DP1N4twA.cjs} +2 -2
  11. package/dist/chunks/{compose-NHbyjV73.cjs.map → compose-DP1N4twA.cjs.map} +1 -1
  12. package/dist/chunks/{compose-C_Y38ENa.js → compose-U1zs3Yof.js} +4 -4
  13. package/dist/chunks/{compose-C_Y38ENa.js.map → compose-U1zs3Yof.js.map} +1 -1
  14. package/dist/chunks/{designer-oDGvHWBJ.cjs → designer-CWL-dCQ_.cjs} +2 -2
  15. package/dist/chunks/{designer-oDGvHWBJ.cjs.map → designer-CWL-dCQ_.cjs.map} +1 -1
  16. package/dist/chunks/{designer-BRYIpeTC.js → designer-DPG7R_WP.js} +3 -3
  17. package/dist/chunks/{designer-BRYIpeTC.js.map → designer-DPG7R_WP.js.map} +1 -1
  18. package/dist/chunks/{detail-BLhZp1mO.cjs → detail-BUfsSal0.cjs} +2 -2
  19. package/dist/chunks/{detail-BLhZp1mO.cjs.map → detail-BUfsSal0.cjs.map} +1 -1
  20. package/dist/chunks/{detail-CkRgfU7l.js → detail-CHZDNNM6.js} +2 -2
  21. package/dist/chunks/{detail-CkRgfU7l.js.map → detail-CHZDNNM6.js.map} +1 -1
  22. package/dist/pages/instances/detail/index.cjs +1 -1
  23. package/dist/pages/instances/detail/index.js +1 -1
  24. package/dist/pages/templates/compose/index.cjs +1 -1
  25. package/dist/pages/templates/compose/index.js +1 -1
  26. package/dist/pages/templates/designer/index.cjs +1 -1
  27. package/dist/pages/templates/designer/index.js +1 -1
  28. package/dist/views/forms/builder/index.cjs +1 -1
  29. package/dist/views/forms/builder/index.js +1 -1
  30. package/dist/views/forms/renderer/index.cjs +1 -1
  31. package/dist/views/forms/renderer/index.js +1 -1
  32. package/dist/views/instances/detail/index.cjs +1 -1
  33. package/dist/views/instances/detail/index.js +1 -1
  34. package/dist/views/instances/new/index.cjs +1 -1
  35. package/dist/views/instances/new/index.js +1 -1
  36. package/dist/views/templates/compose/index.cjs +1 -1
  37. package/dist/views/templates/compose/index.js +1 -1
  38. package/dist/views/templates/designer/index.cjs +1 -1
  39. package/dist/views/templates/designer/index.js +1 -1
  40. package/package.json +3 -3
  41. package/dist/chunks/FormRendererView-BF8Ge0Zk.js.map +0 -1
  42. package/dist/chunks/FormRendererView-ZIfSRWPi.cjs +0 -6
  43. package/dist/chunks/FormRendererView-ZIfSRWPi.cjs.map +0 -1
@@ -5,9 +5,10 @@ import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState a
5
5
  import { AutoComplete as s, Button as c, CheckboxGroup as l, DatePicker as u, DateTimePicker as d, Input as f, RadioGroup as p, Select as m, Table as h, Textarea as g, Toggle as _, Typography as v, Upload as y } from "@mezzanine-ui/react";
6
6
  import { resolveMembers as b, searchMembers as x } from "@rytass/bpm-core-client";
7
7
  import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
- import { buildFormRendererValues as w, clampOptionalNumber as T, createFormTableRow as E, formatDatePickerValue as D, formatDateTimePickerValue as O, isFormRendererFieldReadonly as k, isFormRendererFieldRequired as A, mergeFormDataSourceOptions as j, parseOptionalNumberInput as M, previewFormFieldOptions as ee, previewResolveFormFieldOptions as te, readDatePickerValue as ne, readFieldOptionAsSelectOption as N, readFormDataSourceErrorCode as re, readFormDataSourceErrorMessage as ie, readFormDataSourceSelectedValues as ae, readFormDataSourceValueSignature as P, readFormFieldOptions as oe, readFormTableCellPath as se, readFormTableRowBounds as ce, readFormTableRows as le, readMissingFormDataSourceDependencies as ue, readMissingFormDataSourceOptionValues as de, readSelectOption as fe, readSelectedFormDataSourceOptions as pe, readVisibleFormRendererFields as F, resolveFormFieldOptions as me } from "@rytass/bpm-core-client/form";
9
- import { PlusIcon as I, TrashIcon as L } from "@mezzanine-ui/icons";
10
- import { isFormDataSourceFieldDefinition as he, isFormStaticOptionFieldDefinition as R, isFormTableCellValue as ge, isTableFieldDefinition as _e, readFormFieldSelectionMode as z, readFormMemberIds as B } from "@rytass/bpm-core-shared/form";
8
+ import { FormFieldDensity as w, FormFieldLayout as T } from "@mezzanine-ui/core/form";
9
+ import { buildFormRendererValues as E, clampOptionalNumber as D, createFormTableRow as O, formatDatePickerValue as k, formatDateTimePickerValue as A, isFormRendererFieldReadonly as j, isFormRendererFieldRequired as M, mergeFormDataSourceOptions as N, parseOptionalNumberInput as ee, previewFormFieldOptions as te, previewResolveFormFieldOptions as ne, readDatePickerValue as P, readFieldOptionAsSelectOption as F, readFormDataSourceErrorCode as re, readFormDataSourceErrorMessage as ie, readFormDataSourceSelectedValues as ae, readFormDataSourceValueSignature as I, readFormFieldOptions as oe, readFormTableCellPath as se, readFormTableRowBounds as ce, readFormTableRows as L, readMissingFormDataSourceDependencies as le, readMissingFormDataSourceOptionValues as R, readSelectOption as z, readSelectedFormDataSourceOptions as ue, readVisibleFormRendererFields as B, resolveFormFieldOptions as de } from "@rytass/bpm-core-client/form";
10
+ import { PlusIcon as V, TrashIcon as fe } from "@mezzanine-ui/icons";
11
+ import { isFormDataSourceFieldDefinition as pe, isFormStaticOptionFieldDefinition as me, isFormTableCellValue as he, isTableFieldDefinition as H, readFormFieldSelectionMode as ge, readFormMemberIds as _e } from "@rytass/bpm-core-shared/form";
11
12
  import { resolveOrgUnitOptions as ve, searchOrgUnitOptions as ye } from "@rytass/bpm-core-client/organization";
12
13
  // src/views/forms/renderer/form-data-source-field.ts
13
14
  var be = {
@@ -29,10 +30,10 @@ function Te(e, t) {
29
30
  let n = t.fieldPath?.indexOf(".") ?? -1;
30
31
  return t.fieldPath && n > 0 ? t.fieldPath.slice(0, n) : null;
31
32
  }
32
- function V(e, t) {
33
+ function Ee(e, t) {
33
34
  return t === null ? e : Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
34
35
  }
35
- function Ee(e, t) {
36
+ function De(e, t) {
36
37
  let n = e.from;
37
38
  switch (n.kind) {
38
39
  case "FIELD": return {
@@ -46,13 +47,13 @@ function Ee(e, t) {
46
47
  };
47
48
  case "EXPRESSION": return {
48
49
  expression: n.expression,
49
- form: V(t.formData, t.ownFormKey),
50
- row: t.rowValues ? V(t.rowValues, t.ownRowKey) : null
50
+ form: Ee(t.formData, t.ownFormKey),
51
+ row: t.rowValues ? Ee(t.rowValues, t.ownRowKey) : null
51
52
  };
52
- default: return De(n);
53
+ default: return U(n);
53
54
  }
54
55
  }
55
- function De(e) {
56
+ function U(e) {
56
57
  return { unsupported: !0 };
57
58
  }
58
59
  function Oe(e) {
@@ -61,17 +62,17 @@ function Oe(e) {
61
62
  function ke(e) {
62
63
  return Array.isArray(e) ? e.map(ke) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => [e, ke(t)])) : e;
63
64
  }
64
- function H(e) {
65
- let t = he(e.field) ? e.field : null, s = e.fieldPath ?? t?.fieldKey ?? "", c = t ? e.optionSnapshots?.[e.snapshotKey ?? t.fieldKey] : void 0, l = t ? JSON.stringify({
65
+ function W(e) {
66
+ let t = pe(e.field) ? e.field : null, s = e.fieldPath ?? t?.fieldKey ?? "", c = t ? e.optionSnapshots?.[e.snapshotKey ?? t.fieldKey] : void 0, l = t ? JSON.stringify({
66
67
  dataSource: t.dataSource,
67
68
  fieldKey: t.fieldKey,
68
69
  type: t.type
69
- }) : "", u = JSON.stringify(c ?? null), d = i(() => c?.options ?? [], [u]), f = JSON.stringify(e.formData), p = JSON.stringify(e.initialFormData ?? {}), m = JSON.stringify(e.schema), h = JSON.stringify(e.uiSchema), g = e.context?.kind, _ = e.context?.kind === "runtime" ? e.context.instanceId : void 0, v = e.context?.kind === "runtime" ? e.context.templateId : void 0, y = JSON.stringify(e.row?.values ?? null), b = JSON.stringify(e.row?.initialValues ?? null), x = t ? e.row ? e.row.values[t.fieldKey] : e.formData[t.fieldKey] : void 0, S = P(x), C = i(() => ae(x), [S]), T = C.length > 0, E = t ? JSON.stringify(t.dataSource.bindings.map((n) => Ee(n, {
70
+ }) : "", u = JSON.stringify(c ?? null), d = i(() => c?.options ?? [], [u]), f = JSON.stringify(e.formData), p = JSON.stringify(e.initialFormData ?? {}), m = JSON.stringify(e.schema), h = JSON.stringify(e.uiSchema), g = e.context?.kind, _ = e.context?.kind === "runtime" ? e.context.instanceId : void 0, v = e.context?.kind === "runtime" ? e.context.templateId : void 0, y = JSON.stringify(e.row?.values ?? null), b = JSON.stringify(e.row?.initialValues ?? null), x = t ? e.row ? e.row.values[t.fieldKey] : e.formData[t.fieldKey] : void 0, S = I(x), C = i(() => ae(x), [S]), w = C.length > 0, T = t ? JSON.stringify(t.dataSource.bindings.map((n) => De(n, {
70
71
  formData: e.formData,
71
72
  ownFormKey: Te(t.fieldKey, e),
72
73
  ownRowKey: e.row ? t.fieldKey : null,
73
74
  rowValues: e.row?.values
74
- }))) : "", D = t ? JSON.stringify(e.initialFormData !== void 0 || e.initialValue !== void 0 ? x ?? null : null) : "", O = t ? `${E}\u0000${D}` : "", k = Ae(E, t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION") ? Ce : 0), A = k !== E, M = i(() => {
75
+ }))) : "", D = t ? JSON.stringify(e.initialFormData !== void 0 || e.initialValue !== void 0 ? x ?? null : null) : "", O = t ? `${T}\u0000${D}` : "", k = Ae(T, t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION") ? Ce : 0), A = k !== T, j = i(() => {
75
76
  if (g === "preview") return { kind: "preview" };
76
77
  if (g === "runtime" && !e.readonly) return {
77
78
  instanceId: _,
@@ -83,62 +84,62 @@ function H(e) {
83
84
  g,
84
85
  v,
85
86
  e.readonly
86
- ]), ne = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && P(e.initialValue) !== S : !1, N = t ? e.initialFormData !== void 0 && t.dataSource.bindings.some((n) => {
87
- if (n.from.kind === "FIELD") return P(e.initialFormData?.[n.from.fieldKey]) !== P(e.formData[n.from.fieldKey]);
88
- if (n.from.kind === "ROW_FIELD" && e.row?.initialValues) return P(e.row.initialValues[n.from.columnKey]) !== P(e.row.values[n.from.columnKey]);
87
+ ]), M = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && I(e.initialValue) !== S : !1, ee = t ? e.initialFormData !== void 0 && t.dataSource.bindings.some((n) => {
88
+ if (n.from.kind === "FIELD") return I(e.initialFormData?.[n.from.fieldKey]) !== I(e.formData[n.from.fieldKey]);
89
+ if (n.from.kind === "ROW_FIELD" && e.row?.initialValues) return I(e.row.initialValues[n.from.columnKey]) !== I(e.row.values[n.from.columnKey]);
89
90
  if (n.from.kind === "EXPRESSION") {
90
- if (!M) return !1;
91
+ if (!j) return !1;
91
92
  let r = {
92
93
  ownFormKey: Te(t.fieldKey, e),
93
94
  ownRowKey: e.row ? t.fieldKey : null
94
95
  };
95
- return Oe(Ee(n, {
96
+ return Oe(De(n, {
96
97
  ...r,
97
- formData: w(e.schema.fields, e.initialFormData ?? {}),
98
+ formData: E(e.schema.fields, e.initialFormData ?? {}),
98
99
  rowValues: e.row?.initialValues ?? e.row?.values
99
- })) !== Oe(Ee(n, {
100
+ })) !== Oe(De(n, {
100
101
  ...r,
101
- formData: w(e.schema.fields, e.formData),
102
+ formData: E(e.schema.fields, e.formData),
102
103
  rowValues: e.row?.values
103
104
  }));
104
105
  }
105
106
  return !1;
106
- }) : !1, se = !!t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION"), [ce, le] = o(() => ({
107
+ }) : !1, P = !!t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION"), [F, se] = o(() => ({
107
108
  bindings: k,
108
109
  value: S
109
110
  }));
110
- ce.value !== S && le({
111
+ F.value !== S && se({
111
112
  bindings: k,
112
113
  value: S
113
114
  });
114
- let de = !!(se && M && T && ce.value === S && ce.bindings !== k), fe = !!((c || T) && (ne || N || de)), F = !!(t && M && fe && T), I = Pe({
115
+ let ce = !!(P && j && w && F.value === S && F.bindings !== k), L = !!((c || w) && (M || ee || ce)), R = !!(t && j && L && w), z = Pe({
115
116
  hasSnapshot: !!c,
116
- hasValue: T,
117
- isStale: fe,
117
+ hasValue: w,
118
+ isStale: L,
118
119
  readonly: e.readonly
119
- }), L = !!(t && M && t.type !== "autocomplete"), R = Fe(fe, L && t !== null && ue(t, e.formData, e.row?.values).length > 0), ge = a(I);
120
- ge.current = I;
121
- let [_e, z] = o([]), [B, ve] = o(""), [ye, xe] = o(null), [V, De] = o(null), [ke, H] = o(() => t ? L ? R : I : "IDLE"), [je, U] = o(null), [Me, W] = o(!1), G = a(0), K = a(0), q = a(0), J = a(null), Be = a(null), Y = a(!1), Ve = a({
120
+ }), B = !!(t && j && t.type !== "autocomplete"), V = Fe(L, B && t !== null && le(t, e.formData, e.row?.values).length > 0), fe = a(z);
121
+ fe.current = z;
122
+ let [me, he] = o([]), [H, ge] = o(""), [_e, ve] = o(null), [ye, xe] = o(null), [Ee, U] = o(() => t ? B ? V : z : "IDLE"), [ke, W] = o(null), [je, G] = o(!1), Me = a(0), K = a(0), q = a(0), Be = a(null), Ve = a(null), J = a(!1), He = a({
122
123
  cursor: null,
123
124
  searchText: ""
124
- }), X = i(() => ze(e.formData), [f]), Z = i(() => e.row ? ze(e.row.values) : void 0, [y]), He = i(() => j(d, _e), [_e, d]), Ue = V && V.signature === O && V.valueSignature === S ? V : null, We = F && !Ue, Ge = !!(de && Ue && Ue.unresolvedValues.length > 0), Ke = Ne({
125
- options: He,
126
- resolution: Ue,
127
- resolvePending: We,
125
+ }), Y = i(() => ze(e.formData), [f]), X = i(() => e.row ? ze(e.row.values) : void 0, [y]), Ue = i(() => N(d, me), [me, d]), We = ye && ye.signature === O && ye.valueSignature === S ? ye : null, Ge = R && !We, Ke = !!(ce && We && We.unresolvedValues.length > 0), qe = Ne({
126
+ options: Ue,
127
+ resolution: We,
128
+ resolvePending: Ge,
128
129
  value: x
129
- }), Q = n((n, r) => {
130
- if (!t || !M) return;
130
+ }), Z = n((n, r) => {
131
+ if (!t || !j) return;
131
132
  let i = K.current + 1;
132
- K.current = i, Y.current = !0, Ve.current = {
133
+ K.current = i, J.current = !0, He.current = {
133
134
  cursor: r,
134
135
  searchText: n
135
- }, J.current?.abort();
136
+ }, Be.current?.abort();
136
137
  let a = new AbortController();
137
- J.current = a, H(R), W(r !== null), U(null), (M.kind === "preview" ? ee({
138
+ Be.current = a, U(V), G(r !== null), W(null), (j.kind === "preview" ? te({
138
139
  cursor: r,
139
140
  fieldKey: s,
140
- formData: X,
141
- rowValues: Z,
141
+ formData: Y,
142
+ rowValues: X,
142
143
  schema: e.schema,
143
144
  searchText: n,
144
145
  signal: a.signal,
@@ -146,84 +147,84 @@ function H(e) {
146
147
  }) : oe({
147
148
  cursor: r,
148
149
  fieldKey: s,
149
- formData: X,
150
- instanceId: M.instanceId ?? null,
151
- rowValues: Z,
150
+ formData: Y,
151
+ instanceId: j.instanceId ?? null,
152
+ rowValues: X,
152
153
  searchText: n,
153
154
  signal: a.signal,
154
- templateId: M.templateId ?? null
155
+ templateId: j.templateId ?? null
155
156
  })).then((e) => {
156
- Re(a, K, i) || (W(!1), z((t) => {
157
- let n = pe(x, t);
158
- return j(n, r ? t : [], e.options);
159
- }), xe(e.nextCursor), U(null), G.current = r ? G.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && G.current < Se && qe.current(n, e.nextCursor), H(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
157
+ Re(a, K, i) || (G(!1), he((t) => {
158
+ let n = ue(x, t);
159
+ return N(n, r ? t : [], e.options);
160
+ }), ve(e.nextCursor), W(null), Me.current = r ? Me.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && Me.current < Se && Q.current(n, e.nextCursor), U(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
160
161
  }).catch((e) => {
161
162
  if (Re(a, K, i)) return;
162
- r === null && (Y.current = !1), W(!1);
163
+ r === null && (J.current = !1), G(!1);
163
164
  let t = ie(e) ?? "選項來源暫時無法使用。", n = re(e);
164
- U(t), H(Ie(!!(n && we.includes(n)), T));
165
+ W(t), U(Ie(!!(n && we.includes(n)), w));
165
166
  });
166
167
  }, [
167
168
  S,
168
169
  l,
169
- M,
170
- T,
171
- R,
170
+ j,
171
+ w,
172
+ V,
172
173
  s,
174
+ Y,
173
175
  X,
174
- Z,
175
176
  m,
176
177
  h
177
- ]), qe = a(Q);
178
- qe.current = Q;
178
+ ]), Q = a(Z);
179
+ Q.current = Z;
179
180
  let Je = n(() => {
180
- if (!t || !M || C.length === 0) return;
181
+ if (!t || !j || C.length === 0) return;
181
182
  let n = O, r = S, i = q.current + 1;
182
- q.current = i, Be.current?.abort();
183
+ q.current = i, Ve.current?.abort();
183
184
  let a = new AbortController();
184
- Be.current = a, U(null), (M.kind === "preview" ? te({
185
+ Ve.current = a, W(null), (j.kind === "preview" ? ne({
185
186
  fieldKey: s,
186
- formData: X,
187
- rowValues: Z,
187
+ formData: Y,
188
+ rowValues: X,
188
189
  schema: e.schema,
189
190
  signal: a.signal,
190
191
  uiSchema: e.uiSchema,
191
192
  values: C
192
- }) : me({
193
+ }) : de({
193
194
  fieldKey: s,
194
- formData: X,
195
- instanceId: M.instanceId ?? null,
196
- rowValues: Z,
195
+ formData: Y,
196
+ instanceId: j.instanceId ?? null,
197
+ rowValues: X,
197
198
  signal: a.signal,
198
- templateId: M.templateId ?? null,
199
+ templateId: j.templateId ?? null,
199
200
  values: C
200
201
  })).then((e) => {
201
- Re(a, q, i) || (e.waitingForFieldKeys.length ? H("WAITING_FOR_DEPENDENCIES") : (z((t) => j(t, e.options)), De({
202
+ Re(a, q, i) || (e.waitingForFieldKeys.length ? U("WAITING_FOR_DEPENDENCIES") : (he((t) => N(t, e.options)), xe({
202
203
  signature: n,
203
204
  unresolvedValues: e.unresolvedValues,
204
205
  valueSignature: r
205
- }), H("VALID")));
206
+ }), U("VALID")));
206
207
  }).catch((e) => {
207
- Re(a, q, i) || (H("UNAVAILABLE"), U(ie(e) ?? "選項來源暫時無法使用。"));
208
+ Re(a, q, i) || (U("UNAVAILABLE"), W(ie(e) ?? "選項來源暫時無法使用。"));
208
209
  });
209
210
  }, [
210
211
  S,
211
212
  O,
212
213
  l,
213
- M,
214
+ j,
214
215
  s,
216
+ Y,
215
217
  X,
216
- Z,
217
218
  m,
218
219
  C,
219
220
  h
220
221
  ]), Ye = a(Je);
221
222
  Ye.current = Je, r(() => {
222
- K.current += 1, Y.current = !1, J.current?.abort(), W(!1), z((e) => pe(x, e)), xe((e) => e === null ? e : null), ve((e) => e && ""), U((e) => e && null), t ? L ? qe.current("", null) : H(ge.current) : H("IDLE");
223
+ K.current += 1, J.current = !1, Be.current?.abort(), G(!1), he((e) => ue(x, e)), ve((e) => e === null ? e : null), ge((e) => e && ""), W((e) => e && null), t ? B ? Q.current("", null) : U(fe.current) : U("IDLE");
223
224
  }, [
224
- L,
225
+ B,
225
226
  l,
226
- M,
227
+ j,
227
228
  k,
228
229
  D,
229
230
  p,
@@ -231,67 +232,67 @@ function H(e) {
231
232
  e.readonly,
232
233
  u
233
234
  ]), r(() => {
234
- t && !L && H(I);
235
+ t && !B && U(z);
235
236
  }, [
236
- L,
237
+ B,
237
238
  l,
238
- I
239
+ z
239
240
  ]), r(() => {
240
- F && !A && Ye.current();
241
+ R && !A && Ye.current();
241
242
  }, [
242
- M,
243
- F,
243
+ j,
244
+ R,
244
245
  A,
245
246
  k,
246
247
  D
247
248
  ]), r(() => () => {
248
- J.current?.abort(), Be.current?.abort();
249
+ Be.current?.abort(), Ve.current?.abort();
249
250
  }, []);
250
251
  let Xe = n((e) => {
251
- ve(e), z((e) => pe(x, e)), xe(null), Q(e, null);
252
- }, [Q]), Ze = n(() => {
253
- L || !M || e.readonly || Y.current && B === "" || Xe("");
252
+ ge(e), he((e) => ue(x, e)), ve(null), Z(e, null);
253
+ }, [Z]), Ze = n(() => {
254
+ B || !j || e.readonly || J.current && H === "" || Xe("");
254
255
  }, [
255
- L,
256
- M,
256
+ B,
257
+ j,
257
258
  e.readonly,
258
259
  Xe,
259
- B
260
+ H
260
261
  ]), Qe = a({
261
- cursor: ye,
262
- searchText: B
262
+ cursor: _e,
263
+ searchText: H
263
264
  });
264
265
  Qe.current = {
265
- cursor: ye,
266
- searchText: B
266
+ cursor: _e,
267
+ searchText: H
267
268
  };
268
269
  let $e = n(() => {
269
270
  let { cursor: e, searchText: t } = Qe.current;
270
- e && qe.current(t, e);
271
+ e && Q.current(t, e);
271
272
  }, []), et = n(() => {
272
- M && (Q(Ve.current.searchText, Ve.current.cursor), F && Ye.current());
273
+ j && (Z(He.current.searchText, He.current.cursor), R && Ye.current());
273
274
  }, [
274
- M,
275
- Q,
276
- F
275
+ j,
276
+ Z,
277
+ R
277
278
  ]);
278
279
  return t ? {
279
- canRetry: !!M,
280
- error: je,
281
- hasValue: T,
282
- hasNextPage: !!ye,
283
- loadingNextPage: Me,
284
- invalidValues: Ke,
280
+ canRetry: !!j,
281
+ error: ke,
282
+ hasValue: w,
283
+ hasNextPage: !!_e,
284
+ loadingNextPage: je,
285
+ invalidValues: qe,
285
286
  onOpen: Ze,
286
287
  onReachBottom: $e,
287
288
  onSearch: Xe,
288
- options: He,
289
+ options: Ue,
289
290
  retry: et,
290
- selectionExpired: Ge,
291
- status: A && M && (L || T) ? L ? R : "STALE" : Le({
292
- invalidValues: Ke,
293
- resolvePending: We,
294
- status: ke
291
+ selectionExpired: Ke,
292
+ status: A && j && (B || w) ? B ? V : "STALE" : Le({
293
+ invalidValues: qe,
294
+ resolvePending: Ge,
295
+ status: Ee
295
296
  })
296
297
  } : be;
297
298
  }
@@ -317,15 +318,15 @@ function je(e) {
317
318
  default: return e.error;
318
319
  }
319
320
  }
320
- function U(e) {
321
+ function G(e) {
321
322
  return e.hasValue && e.status !== "VALID";
322
323
  }
323
324
  function Me(e) {
324
- let t = e.filter(U);
325
+ let t = e.filter(G);
325
326
  return t.length === 0 ? null : t.some((e) => e.status === "INVALID" && e.selectionExpired === !0) ? ie("FORM_DATA_SOURCE_VALUE_NOT_RESOLVED") : t.every((e) => e.status === "LOADING" || e.status === "STALE") ? "選項驗證中,請稍候再送出。" : "請先完成動態選項驗證。";
326
327
  }
327
328
  function Ne(e) {
328
- return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? xe : de(e.value, e.options);
329
+ return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? xe : R(e.value, e.options);
329
330
  }
330
331
  function Pe(e) {
331
332
  return e.isStale ? "STALE" : e.hasSnapshot ? "VALID" : e.readonly && e.hasValue ? "UNAVAILABLE" : "IDLE";
@@ -349,26 +350,26 @@ function ze(e) {
349
350
  }, {});
350
351
  }
351
352
  // src/views/forms/renderer/form-value-readers.ts
352
- function W(e) {
353
+ function K(e) {
353
354
  return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
354
355
  }
355
356
  // src/views/forms/renderer/file-upload-field.tsx
356
- function G(e) {
357
+ function q(e) {
357
358
  return e.some((e) => e.pendingCount > 0) ? "附件仍在上傳中,請稍候再送出。" : e.some((e) => e.failedCount > 0) ? "有附件上傳失敗,請重試或移除後再送出。" : null;
358
359
  }
359
- function K() {
360
+ function Be() {
360
361
  let [e, t] = o({}), r = n((e, n) => t((t) => ({
361
362
  ...t,
362
363
  [e]: n
363
364
  })), []);
364
365
  return {
365
- blockMessage: G(Object.values(e)),
366
+ blockMessage: q(Object.values(e)),
366
367
  onFileUploadStateChange: r
367
368
  };
368
369
  }
369
- var q = "無法讀取檔名的附件", J = "此處無法上傳附件";
370
- function Be({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onStateChange: l, onUploadAttachment: u, readonly: d, value: f }) {
371
- let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b = W(f), x = b.join("\n"), C = i(() => new Map((e ?? []).map((e) => [e.id, e])), [e]), w = i(() => {
370
+ var Ve = "無法讀取檔名的附件", J = "此處無法上傳附件";
371
+ function He({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onStateChange: l, onUploadAttachment: u, readonly: d, value: f }) {
372
+ let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b = K(f), x = b.join("\n"), C = i(() => new Map((e ?? []).map((e) => [e.id, e])), [e]), w = i(() => {
372
373
  let e = new Map(_.map((e, t) => [e, t]));
373
374
  return [...b.map((e) => h.get(e) ?? Y(e, C.get(e))), ...p].sort((t, n) => (e.get(t.id) ?? -1) - (e.get(n.id) ?? -1));
374
375
  }, [
@@ -398,7 +399,7 @@ function Be({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
398
399
  let t = e.filter((e) => e.status === "done"), n = t.map((e) => e.id), r = new Set(b), i = t.filter((e) => e.file !== void 0 && !r.has(e.id));
399
400
  T.current = e, v(e.map((e) => e.id)), m(e.filter((e) => e.status !== "done")), i.length > 0 && g((e) => new Map([...e, ...i.map((e) => [e.id, e])])), n.join("\n") !== x && s(n.length ? n : void 0);
400
401
  }
401
- async function ee(e) {
402
+ async function N(e) {
402
403
  if (!u) throw Error(J);
403
404
  return {
404
405
  file: e,
@@ -407,19 +408,19 @@ function Be({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
407
408
  status: "done"
408
409
  };
409
410
  }
410
- async function te(e, t) {
411
- let n = await ee(t).catch((n) => ({
412
- errorMessage: X(n),
411
+ async function ee(e, t) {
412
+ let n = await N(t).catch((n) => ({
413
+ errorMessage: Ue(n),
413
414
  file: t,
414
415
  id: e,
415
416
  status: "error"
416
417
  }));
417
418
  D.current(T.current.map((t) => t.id === e ? n : t));
418
419
  }
419
- function ne(e, t) {
420
- h.has(e) ? Z(t) : c?.(e);
420
+ function te(e, t) {
421
+ h.has(e) ? We(t) : c?.(e);
421
422
  }
422
- let N = !!u && !d, re = [...!d && !u ? [{
423
+ let ne = !!u && !d, P = [...!d && !u ? [{
423
424
  label: J,
424
425
  type: "info"
425
426
  }] : [], ...p.filter((e) => e.status === "error").map((e) => ({
@@ -428,19 +429,19 @@ function Be({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
428
429
  }))];
429
430
  return /* @__PURE__ */ S(y, {
430
431
  accept: t.acceptedMimeTypes?.join(","),
431
- disabled: !N,
432
+ disabled: !ne,
432
433
  files: w,
433
- ...re.length > 0 ? { hints: re } : {},
434
+ ...P.length > 0 ? { hints: P } : {},
434
435
  maxFiles: t.maxFiles,
435
436
  mode: "button-list",
436
437
  ...(t.maxFiles ?? 1) > 1 ? { multiple: !0 } : {},
437
438
  onChange: O,
438
- onDownload: ne,
439
+ onDownload: te,
439
440
  onReload: (e, t) => {
440
- te(e, t);
441
+ ee(e, t);
441
442
  },
442
- onUpload: async (e) => Promise.all(e.map(async (e) => ee(e).catch((t) => ({
443
- errorMessage: X(t),
443
+ onUpload: async (e) => Promise.all(e.map(async (e) => N(e).catch((t) => ({
444
+ errorMessage: Ue(t),
444
445
  file: e,
445
446
  id: `failed-${e.name}-${e.lastModified}-${Math.random()}`,
446
447
  status: "error"
@@ -450,7 +451,7 @@ function Be({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
450
451
  }
451
452
  function Y(e, t) {
452
453
  return t ? {
453
- file: Ve(t),
454
+ file: X(t),
454
455
  id: e,
455
456
  progress: 100,
456
457
  status: "done"
@@ -458,48 +459,48 @@ function Y(e, t) {
458
459
  id: e,
459
460
  progress: 100,
460
461
  status: "done",
461
- url: q
462
+ url: Ve
462
463
  };
463
464
  }
464
- function Ve(e) {
465
+ function X(e) {
465
466
  let t = new File([], e.filename), n = Number(e.sizeBytes);
466
467
  return Number.isFinite(n) && n >= 0 && Object.defineProperty(t, "size", { value: n }), t;
467
468
  }
468
- function X(e) {
469
+ function Ue(e) {
469
470
  return e instanceof Error && e.message ? `上傳失敗:${e.message}` : "上傳失敗,請重試。";
470
471
  }
471
- function Z(e) {
472
+ function We(e) {
472
473
  let t = URL.createObjectURL(e), n = document.createElement("a");
473
474
  n.href = t, n.download = e.name, n.style.display = "none", document.body.appendChild(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 3e4);
474
475
  }
475
476
  // src/views/forms/renderer/form-field-link.ts
476
- var He = /\s/u;
477
- function Ue(e) {
477
+ var Ge = /\s/u;
478
+ function Ke(e) {
478
479
  return [...e].some((e) => {
479
480
  let t = e.codePointAt(0) ?? 0;
480
- return t <= 32 || t >= 127 && t <= 160 || He.test(e);
481
+ return t <= 32 || t >= 127 && t <= 160 || Ge.test(e);
481
482
  });
482
483
  }
483
- var We = /^https?:\/\//iu;
484
- function Ge(e) {
485
- return typeof e != "string" || !e || e.includes("\\") || Ue(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Q(e) ? {
484
+ var qe = /^https?:\/\//iu;
485
+ function Z(e) {
486
+ return typeof e != "string" || !e || e.includes("\\") || Ke(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Je(e) ? {
486
487
  external: !1,
487
488
  href: e
488
- } : null : We.test(e) && qe(e) ? {
489
+ } : null : qe.test(e) && Ye(e) ? {
489
490
  external: !0,
490
491
  href: e
491
492
  } : null;
492
493
  }
493
- var Ke = "http://placeholder.invalid";
494
- function Q(e) {
494
+ var Q = "http://placeholder.invalid";
495
+ function Je(e) {
495
496
  try {
496
- let t = new URL(e, Ke);
497
- return t.origin === Ke && !t.pathname.startsWith("//");
497
+ let t = new URL(e, Q);
498
+ return t.origin === Q && !t.pathname.startsWith("//");
498
499
  } catch {
499
500
  return !1;
500
501
  }
501
502
  }
502
- function qe(e) {
503
+ function Ye(e) {
503
504
  try {
504
505
  let t = new URL(e);
505
506
  return (t.protocol === "http:" || t.protocol === "https:") && !!t.hostname && !t.username && !t.password;
@@ -507,7 +508,7 @@ function qe(e) {
507
508
  return !1;
508
509
  }
509
510
  }
510
- async function Je(e, t, n = {}) {
511
+ async function Xe(e, t, n = {}) {
511
512
  let r = n.maxPerIdRequests ?? 20, i = Math.max(1, n.concurrency ?? 4);
512
513
  try {
513
514
  return {
@@ -522,17 +523,17 @@ async function Je(e, t, n = {}) {
522
523
  skippedIds: []
523
524
  };
524
525
  }
525
- let a = e.slice(0, r), o = await Xe(a, i, (e) => t([e]));
526
+ let a = e.slice(0, r), o = await Qe(a, i, (e) => t([e]));
526
527
  return {
527
528
  failedIds: a.filter((e, t) => o[t].status === "rejected"),
528
529
  profiles: o.flatMap((e) => e.status === "fulfilled" ? e.value : []),
529
530
  skippedIds: e.slice(r)
530
531
  };
531
532
  }
532
- function Ye(e, t) {
533
+ function Ze(e, t) {
533
534
  return e.filter((e) => !t.has(e));
534
535
  }
535
- async function Xe(e, t, n) {
536
+ async function Qe(e, t, n) {
536
537
  let r = [], i = 0;
537
538
  async function a() {
538
539
  for (; i < e.length;) {
@@ -549,43 +550,43 @@ async function Xe(e, t, n) {
549
550
  return await Promise.all(Array.from({ length: Math.min(t, e.length) }, a)), r;
550
551
  }
551
552
  // src/views/forms/renderer/member-field-options.ts
552
- var Ze = "未知會員";
553
- function Qe(e) {
553
+ var $e = "未知會員";
554
+ function et(e) {
554
555
  return {
555
556
  id: e.memberId,
556
557
  name: t(e.name, e.email)
557
558
  };
558
559
  }
559
- function $e(e) {
560
+ function tt(e) {
560
561
  return {
561
562
  id: e,
562
- name: Ze,
563
+ name: $e,
563
564
  unresolved: !0
564
565
  };
565
566
  }
566
- function et(e, t) {
567
+ function nt(e, t) {
567
568
  let n = new Map(t.filter((e) => !e.unresolved).map((e) => [e.id, e])), r = new Set(e.map((e) => e.id)), i = t.filter((e, n) => !r.has(e.id) && t.findIndex((t) => t.id === e.id) === n), a = e.map((e) => (e.unresolved ? n.get(e.id) : void 0) ?? e);
568
569
  return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
569
570
  }
570
- function tt(e, t) {
571
+ function rt(e, t) {
571
572
  let n = new Set(t.filter((e) => !e.unresolved).map((e) => e.id));
572
- return B(e).filter((e) => !n.has(e));
573
+ return _e(e).filter((e) => !n.has(e));
573
574
  }
574
- function nt(e, t) {
575
- return B(e).map((e) => t.find((t) => t.id === e) ?? $e(e));
575
+ function it(e, t) {
576
+ return _e(e).map((e) => t.find((t) => t.id === e) ?? tt(e));
576
577
  }
577
- function rt(e, t) {
578
+ function at(e, t) {
578
579
  if (e.length !== 0) return t ? e.map((e) => e.id) : e[0]?.id;
579
580
  }
580
581
  // src/views/forms/renderer/member-field.tsx
581
- function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, size: l, value: u }) {
582
- let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y = tt(u, d).join("\n");
582
+ function ot({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, size: l, value: u }) {
583
+ let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y = rt(u, d).join("\n");
583
584
  r(() => {
584
- let e = Ye(y ? y.split("\n") : [], v.current), t = !1;
585
- return e.length === 0 ? () => void 0 : (Je(e, b).then(({ profiles: n, skippedIds: r }) => {
585
+ let e = Ze(y ? y.split("\n") : [], v.current), t = !1;
586
+ return e.length === 0 ? () => void 0 : (Xe(e, b).then(({ profiles: n, skippedIds: r }) => {
586
587
  if (t) return;
587
- let i = n.map(Qe), a = e.filter((e) => !i.some((t) => t.id === e)).map($e);
588
- a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) => et(e, [...i, ...a]));
588
+ let i = n.map(et), a = e.filter((e) => !i.some((t) => t.id === e)).map(tt);
589
+ a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) => nt(e, [...i, ...a]));
589
590
  }), () => {
590
591
  t = !0;
591
592
  });
@@ -594,15 +595,15 @@ function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
594
595
  let t = _.current + 1;
595
596
  _.current = t, g(!0);
596
597
  try {
597
- let n = (await x(e)).map(Qe);
598
- _.current === t && (m(n), f((e) => et(e, n)));
598
+ let n = (await x(e)).map(et);
599
+ _.current === t && (m(n), f((e) => nt(e, n)));
599
600
  } catch {
600
601
  _.current === t && m([]);
601
602
  } finally {
602
603
  _.current === t && g(!1);
603
604
  }
604
605
  }
605
- let w = nt(u, d), T = [...et(w, p)], E = {
606
+ let w = it(u, d), T = [...nt(w, p)], E = {
606
607
  asyncData: !0,
607
608
  clearSearchText: !0,
608
609
  disabled: c,
@@ -631,72 +632,72 @@ function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
631
632
  return e ? /* @__PURE__ */ S(s, {
632
633
  ...E,
633
634
  mode: "multiple",
634
- onChange: (e) => n(rt(e, !0)),
635
+ onChange: (e) => n(at(e, !0)),
635
636
  value: [...w]
636
637
  }) : /* @__PURE__ */ S(s, {
637
638
  ...E,
638
639
  mode: "single",
639
- onChange: (e) => n(rt(e ? [e] : [], !1)),
640
+ onChange: (e) => n(at(e ? [e] : [], !1)),
640
641
  value: w[0] ?? null
641
642
  });
642
643
  }
643
644
  // src/views/forms/renderer/org-unit-field-options.ts
644
- var at = "未知組織", ot = "(已刪除)";
645
- function st(e) {
645
+ var st = "未知組織", ct = "(已刪除)";
646
+ function lt(e) {
646
647
  return {
647
648
  id: e.id,
648
- name: e.deleted ? `${e.name}${ot}` : e.name
649
+ name: e.deleted ? `${e.name}${ct}` : e.name
649
650
  };
650
651
  }
651
- function ct(e) {
652
+ function ut(e) {
652
653
  return {
653
654
  id: e,
654
655
  name: e,
655
656
  unresolved: !0
656
657
  };
657
658
  }
658
- function lt(e) {
659
+ function dt(e) {
659
660
  return {
660
661
  id: e,
661
- name: at,
662
+ name: st,
662
663
  unresolved: !0
663
664
  };
664
665
  }
665
- function ut(e) {
666
+ function ft(e) {
666
667
  return typeof e == "string" && e.trim() ? e : null;
667
668
  }
668
669
  function $(e) {
669
670
  return e.toLowerCase();
670
671
  }
671
- function dt(e, t) {
672
+ function pt(e, t) {
672
673
  return $(e) === $(t);
673
674
  }
674
- function ft(e, t) {
675
- let n = ut(e);
676
- return n === null ? null : t.find((e) => dt(e.id, n)) ?? ct(n);
675
+ function mt(e, t) {
676
+ let n = ft(e);
677
+ return n === null ? null : t.find((e) => pt(e.id, n)) ?? ut(n);
677
678
  }
678
- function pt(e, t) {
679
- let n = ut(e);
680
- return n !== null && !t.some((e) => dt(e.id, n)) ? n : null;
679
+ function ht(e, t) {
680
+ let n = ft(e);
681
+ return n !== null && !t.some((e) => pt(e.id, n)) ? n : null;
681
682
  }
682
- function mt(e, t) {
683
- let n = new Map(t.filter((e) => !e.unresolved).map((e) => [$(e.id), e])), r = new Set(e.map((e) => $(e.id))), i = t.filter((e, n) => !r.has($(e.id)) && t.findIndex((t) => dt(t.id, e.id)) === n), a = e.map((e) => (e.unresolved ? n.get($(e.id)) : void 0) ?? e);
683
+ function gt(e, t) {
684
+ let n = new Map(t.filter((e) => !e.unresolved).map((e) => [$(e.id), e])), r = new Set(e.map((e) => $(e.id))), i = t.filter((e, n) => !r.has($(e.id)) && t.findIndex((t) => pt(t.id, e.id)) === n), a = e.map((e) => (e.unresolved ? n.get($(e.id)) : void 0) ?? e);
684
685
  return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
685
686
  }
686
- function ht(e) {
687
+ function _t(e) {
687
688
  return e ? e.id : void 0;
688
689
  }
689
690
  // src/views/forms/renderer/org-unit-field.tsx
690
- var gt = "搜尋組織失敗,請稍後再試。";
691
- function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value: l }) {
692
- let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b = pt(l, u);
691
+ var vt = "搜尋組織失敗,請稍後再試。";
692
+ function yt({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value: l }) {
693
+ let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b = ht(l, u);
693
694
  r(() => {
694
695
  let e = !1;
695
696
  return b === null ? () => void 0 : (ve([b]).then((e) => {
696
- let t = e.map(st);
697
- return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t, lt(b)];
698
- }).catch(() => [lt(b)]).then((t) => {
699
- e || d((e) => mt(e, t));
697
+ let t = e.map(lt);
698
+ return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t, dt(b)];
699
+ }).catch(() => [dt(b)]).then((t) => {
700
+ e || d((e) => gt(e, t));
700
701
  }), () => {
701
702
  e = !0;
702
703
  });
@@ -705,15 +706,15 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
705
706
  let t = y.current + 1;
706
707
  y.current = t, h(!0);
707
708
  try {
708
- let n = (await ye(e)).map(st);
709
- y.current === t && (p(n), _(!1), d((e) => mt(e, n)));
709
+ let n = (await ye(e)).map(lt);
710
+ y.current === t && (p(n), _(!1), d((e) => gt(e, n)));
710
711
  } catch {
711
712
  y.current === t && (p([]), _(!0));
712
713
  } finally {
713
714
  y.current === t && h(!1);
714
715
  }
715
716
  }
716
- let w = ft(l, u), T = [...mt(w ? [w] : [], f)];
717
+ let w = mt(l, u), T = [...gt(w ? [w] : [], f)];
717
718
  return /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S(s, {
718
719
  asyncData: !0,
719
720
  clearSearchText: !0,
@@ -731,7 +732,7 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
731
732
  loadingText: "搜尋組織中...",
732
733
  menuMaxHeight: 320,
733
734
  mode: "single",
734
- onChange: (e) => t(ht(e ?? null)),
735
+ onChange: (e) => t(_t(e ?? null)),
735
736
  onSearch: x,
736
737
  onVisibilityChange: (e) => {
737
738
  e && (p([]), x(""));
@@ -745,29 +746,29 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
745
746
  }), g ? /* @__PURE__ */ S(v, {
746
747
  color: "text-error",
747
748
  variant: "caption",
748
- children: gt
749
+ children: vt
749
750
  }) : null] });
750
751
  }
751
752
  // src/views/forms/renderer/FormRendererView.tsx
752
- var vt = {
753
+ var bt = {
753
754
  alignItems: "start",
754
755
  display: "grid",
755
756
  gap: 12,
756
757
  gridTemplateColumns: "repeat(12, minmax(0, 1fr))"
757
- }, yt = { gridColumn: "1 / -1" }, bt = {
758
+ }, xt = { gridColumn: "1 / -1" }, St = {
758
759
  alignItems: "start",
759
760
  display: "grid",
760
761
  gap: 8,
761
762
  minWidth: 0
762
- }, xt = {
763
+ }, Ct = {
763
764
  minWidth: "100%",
764
765
  width: "100%"
765
766
  };
766
- function St(e) {
767
+ function wt(e) {
767
768
  e && (e.style.width = "100%");
768
769
  }
769
- function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n, emptyText: s = "尚未建立欄位。", errors: c = {}, fieldAccess: l, fieldLabelMarkers: u, maxWidth: d, onChange: f, onDataSourceStateChange: p, onDownloadAttachment: m, onFileUploadStateChange: h, onUploadAttachment: g, optionSnapshots: _, readonly: y = !1, schema: b, singleColumn: x = !1, uiSchema: C, value: T }) {
770
- let E = i(() => ({
770
+ function Tt({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n, emptyText: s = "尚未建立欄位。", errors: c = {}, fieldAccess: l, fieldLabelMarkers: u, maxWidth: d, onChange: f, onDataSourceStateChange: p, onDownloadAttachment: m, onFileUploadStateChange: h, onUploadAttachment: g, optionSnapshots: _, readonly: y = !1, schema: b, singleColumn: x = !1, uiSchema: C, value: w }) {
771
+ let T = i(() => ({
771
772
  attachments: e,
772
773
  onDownloadAttachment: m,
773
774
  onStateChange: h,
@@ -777,11 +778,11 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
777
778
  m,
778
779
  h,
779
780
  g
780
- ]), [D, O] = o(() => w(b.fields, T ?? {})), k = i(() => w(b.fields, T ?? D), [
781
+ ]), [D, O] = o(() => E(b.fields, w ?? {})), k = i(() => E(b.fields, w ?? D), [
781
782
  D,
782
783
  b.fields,
783
- T
784
- ]), A = a(k), j = i(() => F(b, C, k).filter((e) => wt(l, e.fieldKey)?.visible !== !1), [
784
+ w
785
+ ]), A = a(k), j = i(() => B(b, C, k).filter((e) => Et(l, e.fieldKey)?.visible !== !1), [
785
786
  l,
786
787
  b,
787
788
  C,
@@ -790,21 +791,21 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
790
791
  r(() => {
791
792
  A.current = k;
792
793
  }, [k]), r(() => {
793
- O((e) => w(b.fields, T ?? e));
794
- }, [b.fields, T]);
794
+ O((e) => E(b.fields, w ?? e));
795
+ }, [b.fields, w]);
795
796
  function M(e, t) {
796
797
  let n = {
797
798
  ...A.current,
798
799
  [e]: t
799
800
  };
800
- A.current = n, T || O(n), f?.(n);
801
+ A.current = n, w || O(n), f?.(n);
801
802
  }
802
803
  return j.length ? /* @__PURE__ */ S("div", {
803
804
  style: {
804
- ...vt,
805
+ ...bt,
805
806
  ...x ? { width: "100%" } : {}
806
807
  },
807
- children: j.map((e) => /* @__PURE__ */ S(Et, {
808
+ children: j.map((e) => /* @__PURE__ */ S(Ot, {
808
809
  dataSourceContext: t,
809
810
  dataSourceInitialValues: n,
810
811
  field: e,
@@ -813,38 +814,38 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
813
814
  fields: b.fields,
814
815
  labelMarker: u !== void 0 && Object.prototype.hasOwnProperty.call(u, e.fieldKey) ? u[e.fieldKey] : void 0,
815
816
  onChange: M,
816
- fileUpload: E,
817
+ fileUpload: T,
817
818
  onDataSourceStateChange: p,
818
819
  optionSnapshots: _,
819
- readonly: Tt(wt(l, e.fieldKey), y),
820
+ readonly: Dt(Et(l, e.fieldKey), y),
820
821
  schema: b,
821
822
  style: {
822
- ...bt,
823
- gridColumn: `span ${x ? 12 : Wt(e, C)}`,
824
- ...x && !_e(e) ? { maxWidth: d } : {}
823
+ ...St,
824
+ gridColumn: `span ${x ? 12 : qt(e, C)}`,
825
+ ...x && !H(e) ? { maxWidth: d } : {}
825
826
  },
826
827
  value: k[e.fieldKey],
827
828
  values: k,
828
829
  uiSchema: C
829
830
  }, e.fieldKey))
830
831
  }) : /* @__PURE__ */ S("div", {
831
- style: vt,
832
+ style: bt,
832
833
  children: /* @__PURE__ */ S(v, {
833
834
  color: "text-neutral",
834
- style: yt,
835
+ style: xt,
835
836
  variant: "body",
836
837
  children: b.fields.length > 0 ? "目前條件下沒有可填寫欄位。" : s
837
838
  })
838
839
  });
839
840
  }
840
- function wt(e, t) {
841
+ function Et(e, t) {
841
842
  return e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
842
843
  }
843
- function Tt(e, t) {
844
+ function Dt(e, t) {
844
845
  return e === void 0 ? t : !e.editable;
845
846
  }
846
- function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors: a, field: o, fields: s, fileUpload: l, labelMarker: u, onChange: d, onDataSourceStateChange: f, optionSnapshots: p, readonly: m, schema: h, style: g, value: _, values: y, uiSchema: b }) {
847
- let x = A(o, s, y), w = m || k(o, s, y), T = H({
847
+ function Ot({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors: a, field: o, fields: s, fileUpload: l, labelMarker: u, onChange: d, onDataSourceStateChange: f, optionSnapshots: p, readonly: m, schema: h, style: g, value: _, values: y, uiSchema: b }) {
848
+ let x = M(o, s, y), w = m || j(o, s, y), T = W({
848
849
  context: t,
849
850
  field: o,
850
851
  formData: y,
@@ -861,7 +862,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
861
862
  status: T.status
862
863
  });
863
864
  return r(() => {
864
- he(o) && f?.(o.fieldKey, {
865
+ pe(o) && f?.(o.fieldKey, {
865
866
  hasValue: T.hasValue,
866
867
  invalidValues: T.invalidValues,
867
868
  selectionExpired: T.selectionExpired === !0,
@@ -878,9 +879,10 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
878
879
  /* @__PURE__ */ S(e, {
879
880
  label: o.label,
880
881
  ...u ? { labelOptionalMarker: u } : {},
882
+ ...H(o) ? It : {},
881
883
  name: o.fieldKey,
882
884
  required: x,
883
- children: _e(o) ? /* @__PURE__ */ S(Ft, {
885
+ children: H(o) ? /* @__PURE__ */ S(Rt, {
884
886
  dataSourceContext: t,
885
887
  dataSourceInitialValues: n,
886
888
  errors: a,
@@ -893,7 +895,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
893
895
  uiSchema: b,
894
896
  value: _,
895
897
  values: y
896
- }) : Vt(o, _, w, d, l, t, T)
898
+ }) : Wt(o, _, w, d, l, t, T)
897
899
  }),
898
900
  i ? /* @__PURE__ */ S(v, {
899
901
  color: "text-error",
@@ -901,7 +903,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
901
903
  children: i
902
904
  }) : null,
903
905
  E ? /* @__PURE__ */ C("div", {
904
- style: At,
906
+ style: Mt,
905
907
  children: [/* @__PURE__ */ S(v, {
906
908
  color: T.status === "INVALID" || T.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
907
909
  variant: "caption",
@@ -917,43 +919,46 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
917
919
  ]
918
920
  });
919
921
  }
920
- var Dt = "(另開新分頁)", Ot = "另開新分頁", kt = {
922
+ var kt = "(另開新分頁)", At = "另開新分頁", jt = {
921
923
  color: "inherit",
922
924
  textDecoration: "underline",
923
925
  wordBreak: "break-all"
924
- }, At = {
926
+ }, Mt = {
925
927
  alignItems: "center",
926
928
  display: "flex",
927
929
  gap: 8
928
- }, jt = {
930
+ }, Nt = {
929
931
  display: "grid",
930
932
  gap: 8,
931
933
  minWidth: 0,
932
934
  width: "100%"
933
- }, Mt = {
935
+ }, Pt = {
934
936
  display: "flex",
935
937
  justifyContent: "flex-start"
936
- }, Nt = 160, Pt = {
938
+ }, Ft = 160, It = {
939
+ density: w.BASE,
940
+ layout: T.STRETCH
941
+ }, Lt = {
937
942
  display: "grid",
938
943
  gap: 4,
939
944
  minWidth: 0
940
945
  };
941
- function Ft({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
942
- let _ = le(m), v = ce(i), y = a(0), [b, x] = o(() => _.map(() => Rt(y)));
946
+ function Rt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
947
+ let _ = L(m), v = ce(i), y = a(0), [b, x] = o(() => _.map(() => Vt(y)));
943
948
  r(() => {
944
- b.length !== _.length && x(_.map(() => Rt(y)));
949
+ b.length !== _.length && x(_.map(() => Vt(y)));
945
950
  }, [b.length, _.length]);
946
951
  function w(e) {
947
952
  s(i.fieldKey, e);
948
953
  }
949
954
  function T() {
950
- x([...b, Rt(y)]), w([..._, E(i.columns)]);
955
+ x([...b, Vt(y)]), w([..._, O(i.columns)]);
951
956
  }
952
- function D(e) {
957
+ function E(e) {
953
958
  x(b.filter((t, n) => n !== e)), w(_.filter((t, n) => n !== e));
954
959
  }
955
- function O(e, t, n) {
956
- w(_.map((r, i) => i === e ? zt(r, t, n) : r));
960
+ function D(e, t, n) {
961
+ w(_.map((r, i) => i === e ? Ht(r, t, n) : r));
957
962
  }
958
963
  let k = _.map((e, t) => ({
959
964
  ...e,
@@ -961,16 +966,16 @@ function Ft({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
961
966
  key: b[t] ?? `row-${t}`
962
967
  })), A = i.columns.map((r) => ({
963
968
  key: r.fieldKey,
964
- minWidth: Nt,
965
- render: (a) => /* @__PURE__ */ S(It, {
969
+ minWidth: Ft,
970
+ render: (a) => /* @__PURE__ */ S(zt, {
966
971
  column: r,
967
972
  dataSourceContext: e,
968
973
  error: n[se(i.fieldKey, a.index, r.fieldKey)] ?? null,
969
974
  fieldPath: `${i.fieldKey}.${r.fieldKey}`,
970
975
  formData: g,
971
976
  initialFormData: t,
972
- initialRowValues: Lt(t?.[i.fieldKey], a.index),
973
- onChange: (e) => O(a.index, r.fieldKey, e),
977
+ initialRowValues: Bt(t?.[i.fieldKey], a.index),
978
+ onChange: (e) => D(a.index, r.fieldKey, e),
974
979
  onDataSourceStateChange: l,
975
980
  optionSnapshots: u,
976
981
  path: se(i.fieldKey, a.index, r.fieldKey),
@@ -983,17 +988,17 @@ function Ft({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
983
988
  })), j = d ? void 0 : {
984
989
  render: (e) => [{
985
990
  disabled: () => _.length <= v.minRows,
986
- icon: L,
991
+ icon: fe,
987
992
  iconType: "icon-only",
988
993
  name: "刪除此列",
989
- onClick: () => D(e.index),
994
+ onClick: () => E(e.index),
990
995
  variant: "destructive-ghost"
991
996
  }],
992
997
  fixed: "end",
993
998
  width: 56
994
999
  };
995
1000
  return /* @__PURE__ */ C("div", {
996
- style: jt,
1001
+ style: Nt,
997
1002
  children: [/* @__PURE__ */ S(h, {
998
1003
  ...j ? { actions: j } : {},
999
1004
  columns: A,
@@ -1002,10 +1007,10 @@ function Ft({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
1002
1007
  showHeader: !0,
1003
1008
  size: "sub"
1004
1009
  }), d ? null : /* @__PURE__ */ S("div", {
1005
- style: Mt,
1010
+ style: Pt,
1006
1011
  children: /* @__PURE__ */ S(c, {
1007
1012
  disabled: _.length >= v.maxRows,
1008
- icon: I,
1013
+ icon: V,
1009
1014
  iconType: "leading",
1010
1015
  onClick: T,
1011
1016
  size: "sub",
@@ -1016,14 +1021,14 @@ function Ft({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
1016
1021
  })]
1017
1022
  });
1018
1023
  }
1019
- function It({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData: a, initialFormData: o, initialRowValues: s, onChange: l, onDataSourceStateChange: u, optionSnapshots: d, path: f, readonly: p, rowValues: m, schema: h, uiSchema: g }) {
1020
- let _ = Bt(m, e.fieldKey), y = H({
1024
+ function zt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData: a, initialFormData: o, initialRowValues: s, onChange: l, onDataSourceStateChange: u, optionSnapshots: d, path: f, readonly: p, rowValues: m, schema: h, uiSchema: g }) {
1025
+ let _ = Ut(m, e.fieldKey), y = W({
1021
1026
  context: t,
1022
1027
  field: e,
1023
1028
  fieldPath: i,
1024
1029
  formData: a,
1025
1030
  initialFormData: o,
1026
- initialValue: s ? Bt(s, e.fieldKey) : void 0,
1031
+ initialValue: s ? Ut(s, e.fieldKey) : void 0,
1027
1032
  optionSnapshots: d,
1028
1033
  readonly: p,
1029
1034
  row: {
@@ -1040,7 +1045,7 @@ function It({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
1040
1045
  status: y.status
1041
1046
  });
1042
1047
  return r(() => {
1043
- if (he(e)) return u?.(f, {
1048
+ if (pe(e)) return u?.(f, {
1044
1049
  hasValue: y.hasValue,
1045
1050
  invalidValues: y.invalidValues,
1046
1051
  selectionExpired: y.selectionExpired === !0,
@@ -1058,16 +1063,16 @@ function It({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
1058
1063
  x
1059
1064
  ]), /* @__PURE__ */ C("div", {
1060
1065
  "data-form-field-key": f,
1061
- style: Pt,
1066
+ style: Lt,
1062
1067
  children: [
1063
- Vt(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
1068
+ Wt(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
1064
1069
  n ? /* @__PURE__ */ S(v, {
1065
1070
  color: "text-error",
1066
1071
  variant: "caption",
1067
1072
  children: n
1068
1073
  }) : null,
1069
1074
  b ? /* @__PURE__ */ C("div", {
1070
- style: At,
1075
+ style: Mt,
1071
1076
  children: [/* @__PURE__ */ S(v, {
1072
1077
  color: y.status === "INVALID" || y.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
1073
1078
  variant: "caption",
@@ -1083,38 +1088,38 @@ function It({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
1083
1088
  ]
1084
1089
  });
1085
1090
  }
1086
- function Lt(e, t) {
1087
- return le(e)[t];
1091
+ function Bt(e, t) {
1092
+ return L(e)[t];
1088
1093
  }
1089
- function Rt(e) {
1094
+ function Vt(e) {
1090
1095
  return e.current += 1, `table-row-${e.current}`;
1091
1096
  }
1092
- function zt(e, t, n) {
1093
- return n === void 0 || !ge(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
1097
+ function Ht(e, t, n) {
1098
+ return n === void 0 || !he(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
1094
1099
  ...e,
1095
1100
  [t]: n
1096
1101
  };
1097
1102
  }
1098
- function Bt(e, t) {
1103
+ function Ut(e, t) {
1099
1104
  if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
1100
1105
  }
1101
- function Vt(e, t, n, r, i, a, o, s = "main") {
1102
- return he(e) ? Ut(e, t, n, r, a, o, s) : Ht(e, t, n, r, i, s);
1106
+ function Wt(e, t, n, r, i, a, o, s = "main") {
1107
+ return pe(e) ? Kt(e, t, n, r, a, o, s) : Gt(e, t, n, r, i, s);
1103
1108
  }
1104
- function Ht(e, t, n, r, i, a = "main") {
1105
- let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? Ge(t) : null;
1109
+ function Gt(e, t, n, r, i, a = "main") {
1110
+ let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? Z(t) : null;
1106
1111
  if (o) return /* @__PURE__ */ S(v, {
1107
1112
  color: "text-brand",
1108
1113
  component: "span",
1109
1114
  variant: "body",
1110
1115
  children: /* @__PURE__ */ S("a", {
1111
1116
  href: o.href,
1112
- style: kt,
1117
+ style: jt,
1113
1118
  ...o.external ? {
1114
- "aria-label": `${o.href}${Dt}`,
1119
+ "aria-label": `${o.href}${kt}`,
1115
1120
  rel: "noopener noreferrer",
1116
1121
  target: "_blank",
1117
- title: Ot
1122
+ title: At
1118
1123
  } : {},
1119
1124
  children: o.href
1120
1125
  })
@@ -1123,10 +1128,10 @@ function Ht(e, t, n, r, i, a = "main") {
1123
1128
  onChange: (t) => r(e.fieldKey, t.target.value),
1124
1129
  placeholder: e.placeholder ?? "請輸入多行文字",
1125
1130
  readOnly: n,
1126
- ref: St,
1131
+ ref: wt,
1127
1132
  rows: 3,
1128
- style: xt,
1129
- value: Gt(t)
1133
+ style: Ct,
1134
+ value: Jt(t)
1130
1135
  });
1131
1136
  if (e.type === "boolean") return /* @__PURE__ */ S(_, {
1132
1137
  checked: t === !0,
@@ -1135,8 +1140,8 @@ function Ht(e, t, n, r, i, a = "main") {
1135
1140
  onChange: (t) => r(e.fieldKey, t.target.checked),
1136
1141
  size: a
1137
1142
  });
1138
- if (R(e) && e.type === "checkbox") {
1139
- let i = e.options.map(N);
1143
+ if (me(e) && e.type === "checkbox") {
1144
+ let i = e.options.map(F);
1140
1145
  return /* @__PURE__ */ S(m, {
1141
1146
  menuMaxHeight: 320,
1142
1147
  mode: "multiple",
@@ -1145,11 +1150,11 @@ function Ht(e, t, n, r, i, a = "main") {
1145
1150
  placeholder: e.placeholder ?? "請選擇一或多個選項",
1146
1151
  readOnly: n,
1147
1152
  size: a,
1148
- value: i.filter((e) => W(t).includes(e.id))
1153
+ value: i.filter((e) => K(t).includes(e.id))
1149
1154
  });
1150
1155
  }
1151
- if (R(e)) {
1152
- let i = e.options.map(N);
1156
+ if (me(e)) {
1157
+ let i = e.options.map(F);
1153
1158
  return /* @__PURE__ */ S(m, {
1154
1159
  menuMaxHeight: 320,
1155
1160
  onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
@@ -1157,10 +1162,10 @@ function Ht(e, t, n, r, i, a = "main") {
1157
1162
  placeholder: e.placeholder ?? "請選擇",
1158
1163
  readOnly: n,
1159
1164
  size: a,
1160
- value: fe(i, Gt(t))
1165
+ value: z(i, Jt(t))
1161
1166
  });
1162
1167
  }
1163
- return e.type === "member" ? /* @__PURE__ */ S(it, {
1168
+ return e.type === "member" ? /* @__PURE__ */ S(ot, {
1164
1169
  multiple: e.multiple === !0,
1165
1170
  name: e.fieldKey,
1166
1171
  onChange: (t) => r(e.fieldKey, t),
@@ -1168,14 +1173,14 @@ function Ht(e, t, n, r, i, a = "main") {
1168
1173
  readonly: n,
1169
1174
  size: a,
1170
1175
  value: t
1171
- }) : e.type === "org_unit" ? /* @__PURE__ */ S(_t, {
1176
+ }) : e.type === "org_unit" ? /* @__PURE__ */ S(yt, {
1172
1177
  name: e.fieldKey,
1173
1178
  onChange: (t) => r(e.fieldKey, t),
1174
- placeholder: e.placeholder ?? qt(e.type),
1179
+ placeholder: e.placeholder ?? Xt(e.type),
1175
1180
  readonly: n,
1176
1181
  size: a,
1177
1182
  value: t
1178
- }) : e.type === "file_upload" ? /* @__PURE__ */ S(Be, {
1183
+ }) : e.type === "file_upload" ? /* @__PURE__ */ S(He, {
1179
1184
  attachments: i?.attachments,
1180
1185
  field: e,
1181
1186
  onChange: (t) => r(e.fieldKey, t),
@@ -1187,47 +1192,47 @@ function Ht(e, t, n, r, i, a = "main") {
1187
1192
  }) : e.type === "date" ? /* @__PURE__ */ S(u, {
1188
1193
  format: "YYYY-MM-DD",
1189
1194
  fullWidth: !0,
1190
- onChange: (t) => r(e.fieldKey, D(t)),
1191
- placeholder: e.placeholder ?? qt(e.type),
1195
+ onChange: (t) => r(e.fieldKey, k(t)),
1196
+ placeholder: e.placeholder ?? Xt(e.type),
1192
1197
  readOnly: n,
1193
- value: ne(t)
1198
+ value: P(t)
1194
1199
  }) : e.type === "datetime" ? /* @__PURE__ */ S(d, {
1195
1200
  formatDate: "YYYY-MM-DD",
1196
1201
  formatTime: "HH:mm",
1197
1202
  fullWidth: !0,
1198
1203
  hideSecond: !0,
1199
- onChange: (t) => r(e.fieldKey, O(t)),
1204
+ onChange: (t) => r(e.fieldKey, A(t)),
1200
1205
  placeholderLeft: "選擇日期",
1201
1206
  placeholderRight: "選擇時間",
1202
1207
  readOnly: n,
1203
- value: ne(t)
1208
+ value: P(t)
1204
1209
  }) : e.type === "number" || e.type === "money" ? /* @__PURE__ */ S(f, {
1205
1210
  fullWidth: !0,
1206
1211
  max: e.maximum,
1207
1212
  min: e.minimum,
1208
1213
  size: a,
1209
- onChange: (t) => r(e.fieldKey, T(M(t.target.value), {
1214
+ onChange: (t) => r(e.fieldKey, D(ee(t.target.value), {
1210
1215
  max: e.maximum,
1211
1216
  min: e.minimum
1212
1217
  })),
1213
- placeholder: e.placeholder ?? qt(e.type),
1218
+ placeholder: e.placeholder ?? Xt(e.type),
1214
1219
  ...n ? { readonly: !0 } : {},
1215
1220
  showSpinner: !0,
1216
- value: Kt(t),
1221
+ value: Yt(t),
1217
1222
  variant: "measure"
1218
1223
  }) : /* @__PURE__ */ S(f, {
1219
1224
  fullWidth: !0,
1220
1225
  onChange: (t) => r(e.fieldKey, t.target.value),
1221
- placeholder: e.placeholder ?? qt(e.type),
1226
+ placeholder: e.placeholder ?? Xt(e.type),
1222
1227
  ...n ? { readonly: !0 } : {},
1223
1228
  size: a,
1224
- value: Gt(t),
1229
+ value: Jt(t),
1225
1230
  variant: "base"
1226
1231
  });
1227
1232
  }
1228
- function Ut(e, t, n, r, i, a, o = "main") {
1229
- let c = a.options.map(N), u = pe(t, a.options).map(N), d = a.status === "LOADING", f = d && !a.loadingNextPage, h = a.status === "WAITING_FOR_DEPENDENCIES", g = !!i && !n, _ = n || h, v = n;
1230
- return e.type === "autocomplete" ? z(e) === "multiple" ? /* @__PURE__ */ S(s, {
1233
+ function Kt(e, t, n, r, i, a, o = "main") {
1234
+ let c = a.options.map(F), u = ue(t, a.options).map(F), d = a.status === "LOADING", f = d && !a.loadingNextPage, h = a.status === "WAITING_FOR_DEPENDENCIES", g = !!i && !n, _ = n || h, v = n;
1235
+ return e.type === "autocomplete" ? ge(e) === "multiple" ? /* @__PURE__ */ S(s, {
1231
1236
  asyncData: g,
1232
1237
  clearSearchText: !0,
1233
1238
  disabled: v,
@@ -1274,7 +1279,7 @@ function Ut(e, t, n, r, i, a, o = "main") {
1274
1279
  name: e.fieldKey,
1275
1280
  onChange: (t) => r(e.fieldKey, t.target.value || void 0),
1276
1281
  options: c,
1277
- value: Gt(t)
1282
+ value: Jt(t)
1278
1283
  }) : e.type === "checkbox" ? /* @__PURE__ */ S(l, {
1279
1284
  disabled: _,
1280
1285
  name: e.fieldKey,
@@ -1283,8 +1288,8 @@ function Ut(e, t, n, r, i, a, o = "main") {
1283
1288
  label: e.name,
1284
1289
  value: e.id
1285
1290
  })),
1286
- value: [...W(t)]
1287
- }) : z(e) === "multiple" ? /* @__PURE__ */ S(m, {
1291
+ value: [...K(t)]
1292
+ }) : ge(e) === "multiple" ? /* @__PURE__ */ S(m, {
1288
1293
  disabled: _,
1289
1294
  loading: d,
1290
1295
  menuMaxHeight: 320,
@@ -1309,20 +1314,20 @@ function Ut(e, t, n, r, i, a, o = "main") {
1309
1314
  value: u[0] ?? null
1310
1315
  });
1311
1316
  }
1312
- function Wt(e, t) {
1317
+ function qt(e, t) {
1313
1318
  return {
1314
1319
  FULL: 12,
1315
1320
  HALF: 6,
1316
1321
  THIRD: 4
1317
1322
  }[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
1318
1323
  }
1319
- function Gt(e) {
1324
+ function Jt(e) {
1320
1325
  return typeof e == "string" ? e : "";
1321
1326
  }
1322
- function Kt(e) {
1327
+ function Yt(e) {
1323
1328
  return typeof e == "number" ? String(e) : "";
1324
1329
  }
1325
- function qt(e) {
1330
+ function Xt(e) {
1326
1331
  return {
1327
1332
  boolean: "",
1328
1333
  autocomplete: "請輸入或選擇",
@@ -1341,6 +1346,6 @@ function qt(e) {
1341
1346
  textarea: "請輸入多行文字"
1342
1347
  }[e];
1343
1348
  }
1344
- export { G as a, je as c, Je as i, Me as l, st as n, K as o, Ye as r, U as s, Ct as t, H as u };
1349
+ export { q as a, je as c, Xe as i, Me as l, lt as n, Be as o, Ze as r, G as s, Tt as t, W as u };
1345
1350
 
1346
- //# sourceMappingURL=FormRendererView-BF8Ge0Zk.js.map
1351
+ //# sourceMappingURL=FormRendererView-CAyPXhPq.js.map