@rytass/bpm-core-react 0.17.8 → 0.18.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +8 -0
  3. package/dist/chunks/{FormBuilderView-ClLnQ1e_.js → FormBuilderView-BVKY1j_0.js} +504 -452
  4. package/dist/chunks/FormBuilderView-BVKY1j_0.js.map +1 -0
  5. package/dist/chunks/FormBuilderView-SrGltzFT.cjs +3 -0
  6. package/dist/chunks/FormBuilderView-SrGltzFT.cjs.map +1 -0
  7. package/dist/chunks/approver-filled-form-Dm3Iw7iw.cjs +2 -0
  8. package/dist/chunks/approver-filled-form-Dm3Iw7iw.cjs.map +1 -0
  9. package/dist/chunks/{approver-filled-form-DuQGPtNB.js → approver-filled-form-ZEwpmsHJ.js} +21 -8
  10. package/dist/chunks/approver-filled-form-ZEwpmsHJ.js.map +1 -0
  11. package/dist/chunks/{compose-jnvnnVfN.js → compose-B1GlrZW9.js} +3 -3
  12. package/dist/chunks/{compose-jnvnnVfN.js.map → compose-B1GlrZW9.js.map} +1 -1
  13. package/dist/chunks/{compose-Cock_B2Q.cjs → compose-DZk-SfHT.cjs} +2 -2
  14. package/dist/chunks/{compose-Cock_B2Q.cjs.map → compose-DZk-SfHT.cjs.map} +1 -1
  15. package/dist/chunks/{designer-B8Gvew_k.js → designer-BCLrjb4H.js} +886 -851
  16. package/dist/chunks/designer-BCLrjb4H.js.map +1 -0
  17. package/dist/chunks/designer-BYYxEN9L.cjs +65 -0
  18. package/dist/chunks/designer-BYYxEN9L.cjs.map +1 -0
  19. package/dist/chunks/{detail-D6X61pkg.js → detail-4F39ggBn.js} +883 -827
  20. package/dist/chunks/detail-4F39ggBn.js.map +1 -0
  21. package/dist/chunks/detail-BkMtA_0K.cjs +2 -0
  22. package/dist/chunks/detail-BkMtA_0K.cjs.map +1 -0
  23. package/dist/chunks/{orgs-Lg7tXv2u.js → orgs-8hje_l2n.js} +9 -4
  24. package/dist/chunks/orgs-8hje_l2n.js.map +1 -0
  25. package/dist/chunks/{orgs-C8usknWb.cjs → orgs-BeeDDWL1.cjs} +2 -2
  26. package/dist/chunks/orgs-BeeDDWL1.cjs.map +1 -0
  27. package/dist/chunks/users-O2L_M3BK.cjs +2 -0
  28. package/dist/chunks/users-O2L_M3BK.cjs.map +1 -0
  29. package/dist/chunks/{users-DRbuDYF1.js → users-Pl6hY5Y5.js} +160 -93
  30. package/dist/chunks/users-Pl6hY5Y5.js.map +1 -0
  31. package/dist/pages/admin/orgs/index.cjs +1 -1
  32. package/dist/pages/admin/orgs/index.js +1 -1
  33. package/dist/pages/admin/users/index.cjs +1 -1
  34. package/dist/pages/admin/users/index.js +1 -1
  35. package/dist/pages/instances/detail/index.cjs +1 -1
  36. package/dist/pages/instances/detail/index.js +1 -1
  37. package/dist/pages/templates/compose/index.cjs +1 -1
  38. package/dist/pages/templates/compose/index.js +1 -1
  39. package/dist/pages/templates/designer/index.cjs +1 -1
  40. package/dist/pages/templates/designer/index.js +1 -1
  41. package/dist/views/admin/index.cjs +1 -1
  42. package/dist/views/admin/index.js +2 -2
  43. package/dist/views/admin/orgs/index.cjs +1 -1
  44. package/dist/views/admin/orgs/index.js +1 -1
  45. package/dist/views/admin/users/index.cjs +1 -1
  46. package/dist/views/admin/users/index.js +1 -1
  47. package/dist/views/forms/builder/index.cjs +1 -1
  48. package/dist/views/forms/builder/index.js +1 -1
  49. package/dist/views/inbox/index.cjs +1 -1
  50. package/dist/views/inbox/index.cjs.map +1 -1
  51. package/dist/views/inbox/index.js +159 -78
  52. package/dist/views/inbox/index.js.map +1 -1
  53. package/dist/views/instances/detail/index.cjs +1 -1
  54. package/dist/views/instances/detail/index.js +1 -1
  55. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +9 -1
  56. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +9 -1
  57. package/dist/views/instances/detail/use-resubmit-comment-draft.d.cts +18 -0
  58. package/dist/views/instances/detail/use-resubmit-comment-draft.d.ts +18 -0
  59. package/dist/views/instances/new/index.cjs +1 -1
  60. package/dist/views/instances/new/index.cjs.map +1 -1
  61. package/dist/views/instances/new/index.js +15 -11
  62. package/dist/views/instances/new/index.js.map +1 -1
  63. package/dist/views/templates/compose/index.cjs +1 -1
  64. package/dist/views/templates/compose/index.js +1 -1
  65. package/dist/views/templates/designer/index.cjs +1 -1
  66. package/dist/views/templates/designer/index.js +1 -1
  67. package/package.json +3 -3
  68. package/dist/chunks/FormBuilderView-CUOyS07f.cjs +0 -3
  69. package/dist/chunks/FormBuilderView-CUOyS07f.cjs.map +0 -1
  70. package/dist/chunks/FormBuilderView-ClLnQ1e_.js.map +0 -1
  71. package/dist/chunks/approver-filled-form-D1DmqDVP.cjs +0 -2
  72. package/dist/chunks/approver-filled-form-D1DmqDVP.cjs.map +0 -1
  73. package/dist/chunks/approver-filled-form-DuQGPtNB.js.map +0 -1
  74. package/dist/chunks/designer-B8Gvew_k.js.map +0 -1
  75. package/dist/chunks/designer-CAEFV1ve.cjs +0 -65
  76. package/dist/chunks/designer-CAEFV1ve.cjs.map +0 -1
  77. package/dist/chunks/detail-COh5sjAt.cjs +0 -2
  78. package/dist/chunks/detail-COh5sjAt.cjs.map +0 -1
  79. package/dist/chunks/detail-D6X61pkg.js.map +0 -1
  80. package/dist/chunks/orgs-C8usknWb.cjs.map +0 -1
  81. package/dist/chunks/orgs-Lg7tXv2u.js.map +0 -1
  82. package/dist/chunks/users-DRbuDYF1.js.map +0 -1
  83. package/dist/chunks/users-DVQicZIo.cjs +0 -2
  84. package/dist/chunks/users-DVQicZIo.cjs.map +0 -1
@@ -7,13 +7,13 @@ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
7
7
  import { FormFieldLayout as ce } from "@mezzanine-ui/core/form";
8
8
  import { AlignLeftIcon as le, CalendarIcon as y, CheckedIcon as ue, CheckedOutlineIcon as de, CurrencyDollarIcon as b, DotDragVerticalIcon as fe, DotGridIcon as x, FileAttachmentIcon as S, FileIcon as C, ListIcon as pe, PlusIcon as me, TrashIcon as he, UserIcon as w } from "@mezzanine-ui/icons";
9
9
  import { buildConditionExpression as T, buildFormRendererValues as ge, clampOptionalNumber as _e, createFieldDefinition as ve, createTableColumnDefinition as ye, formatDatePickerValue as be, formatDateTimePickerValue as xe, isDateFieldDefinition as Se, isFormDataSourceDescriptorCompatible as Ce, isNumberFieldDefinition as we, isSelectFieldDefinition as Te, lintFormSchema as Ee, listFormDataSources as De, parseConditionRule as Oe, parseOptionalNumberInput as ke, readCompatibleFormDataSourceBindingFields as Ae, readCompatibleFormDataSourceDescriptors as je, readCompatibleFormTableColumnBindingFields as Me, readConditionOperatorOption as Ne, readConditionOperatorOptions as Pe, readDatePickerValue as Fe, readDefaultConditionOperator as Ie, readDefaultConditionValue as Le, readFieldOptionAsSelectOption as Re, readFormDataSourceBinding as E, readFormDataSourceBindingValue as ze, readFormDataSourceBindingValueKind as Be, readFormDataSourceFieldDependencyKeys as Ve, readFormSchemaLintMessage as He, readFormTableRowBounds as Ue, readSelectOption as D, renameFormDataSourceFieldBindings as We, renameFormTableColumnBindings as Ge, upsertFormDataSourceFieldBinding as Ke } from "@rytass/bpm-core-client/form";
10
- import { FORM_TABLE_MAX_ROWS as qe, isFormDataSourceFieldDefinition as O, isFormOptionFieldDefinition as Je, isFormStaticOptionFieldDefinition as Ye, isMemberFieldDefinition as Xe, isTableColumnFieldType as Ze, isTableFieldDefinition as k, readFormFieldSelectionMode as Qe } from "@rytass/bpm-core-shared/form";
11
- import { DragDropContext as $e, Draggable as et, Droppable as tt } from "@hello-pangea/dnd";
12
- import A from "next/dynamic";
13
- import { json as nt } from "@codemirror/lang-json";
14
- import { EditorView as j } from "@codemirror/view";
10
+ import { FORM_TABLE_MAX_ROWS as qe, TEXT_FIELD_PATTERN_ERROR_MESSAGE_MAX_LENGTH as Je, TEXT_FIELD_PATTERN_MAX_LENGTH as O, compileTextFieldPattern as Ye, hasRepeatedTextFieldPatternGroup as Xe, isFormDataSourceFieldDefinition as k, isFormOptionFieldDefinition as Ze, isFormStaticOptionFieldDefinition as Qe, isMemberFieldDefinition as $e, isTableColumnFieldType as et, isTableFieldDefinition as A, readFormFieldSelectionMode as tt } from "@rytass/bpm-core-shared/form";
11
+ import { DragDropContext as nt, Draggable as rt, Droppable as it } from "@hello-pangea/dnd";
12
+ import j from "next/dynamic";
13
+ import { json as M } from "@codemirror/lang-json";
14
+ import { EditorView as N } from "@codemirror/view";
15
15
  //#region src/views/forms/builder/json-code-editor.tsx
16
- var rt = {
16
+ var P = {
17
17
  alignItems: "center",
18
18
  border: "1px solid var(--mzn-color-border-neutral)",
19
19
  borderRadius: 4,
@@ -22,10 +22,10 @@ var rt = {
22
22
  minHeight: 160,
23
23
  padding: 12,
24
24
  width: "100%"
25
- }, M = [
26
- nt(),
27
- j.lineWrapping,
28
- j.theme({
25
+ }, F = [
26
+ M(),
27
+ N.lineWrapping,
28
+ N.theme({
29
29
  "&": {
30
30
  border: "1px solid var(--mzn-color-border-neutral)",
31
31
  borderRadius: "4px",
@@ -41,15 +41,15 @@ var rt = {
41
41
  ".cm-gutters": { borderRight: "1px solid var(--mzn-color-border-neutral)" },
42
42
  ".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace" }
43
43
  })
44
- ], N = A(() => import("@uiw/react-codemirror"), {
44
+ ], I = j(() => import("@uiw/react-codemirror"), {
45
45
  loading: () => /* @__PURE__ */ _("div", {
46
- style: rt,
46
+ style: P,
47
47
  children: "載入 JSON 編輯器"
48
48
  }),
49
49
  ssr: !1
50
50
  });
51
- function it({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i, value: a }) {
52
- return /* @__PURE__ */ _(N, {
51
+ function at({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i, value: a }) {
52
+ return /* @__PURE__ */ _(I, {
53
53
  "aria-label": n,
54
54
  basicSetup: {
55
55
  autocompletion: !0,
@@ -63,7 +63,7 @@ function it({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i,
63
63
  syntaxHighlighting: !0
64
64
  },
65
65
  editable: !e,
66
- extensions: [...M],
66
+ extensions: [...F],
67
67
  height: t,
68
68
  indentWithTab: !1,
69
69
  onChange: r,
@@ -76,7 +76,7 @@ function it({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i,
76
76
  }
77
77
  //#endregion
78
78
  //#region src/views/forms/builder/FormBuilderView.tsx
79
- var at = [
79
+ var ot = [
80
80
  {
81
81
  description: "單行文字、姓名、編號",
82
82
  icon: le,
@@ -161,66 +161,66 @@ var at = [
161
161
  label: "表格",
162
162
  type: "table"
163
163
  }
164
- ], P = at.filter((e) => Ze(e.type)).map((e) => ({
164
+ ], L = ot.filter((e) => et(e.type)).map((e) => ({
165
165
  id: e.type,
166
166
  name: e.label
167
- })), ot = {
167
+ })), st = {
168
168
  alignItems: "start",
169
169
  display: "flex",
170
170
  flexWrap: "wrap",
171
171
  gap: 16
172
- }, st = {
172
+ }, ct = {
173
173
  flex: "0.55 1 300px",
174
174
  minWidth: 0
175
- }, ct = {
175
+ }, lt = {
176
176
  flex: "1.45 1 720px",
177
177
  minWidth: 620,
178
178
  paddingBottom: 260
179
- }, lt = 240, ut = {
179
+ }, ut = 240, dt = {
180
180
  BOOLEAN: "開關",
181
181
  NUMBER: "數字",
182
182
  STRING: "文字或選單",
183
183
  STRING_ARRAY: "多選"
184
- }, dt = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings missing required parameter: (.+)$/u, ft = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings unknown parameter: (.+)$/u, F = {
184
+ }, ft = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings missing required parameter: (.+)$/u, pt = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings unknown parameter: (.+)$/u, R = {
185
185
  display: "grid",
186
186
  gap: 12
187
- }, pt = {
187
+ }, mt = {
188
188
  display: "flex",
189
189
  flexWrap: "wrap",
190
190
  gap: 6
191
- }, mt = {
191
+ }, ht = {
192
192
  flex: "0 0 auto",
193
193
  whiteSpace: "nowrap"
194
- }, ht = {
194
+ }, gt = {
195
195
  display: "grid",
196
196
  gap: 8
197
- }, gt = {
197
+ }, _t = {
198
198
  alignItems: "center",
199
199
  cursor: "grab",
200
200
  display: "flex",
201
201
  gap: 12,
202
202
  touchAction: "none"
203
- }, _t = {
203
+ }, vt = {
204
204
  display: "grid",
205
205
  flex: "1 1 auto",
206
206
  gap: 2,
207
207
  minWidth: 0
208
- }, vt = {
208
+ }, yt = {
209
209
  alignItems: "center",
210
210
  display: "flex",
211
211
  flex: "0 0 auto",
212
212
  gap: 4
213
- }, yt = {
213
+ }, bt = {
214
214
  alignItems: "center",
215
215
  display: "flex",
216
216
  gap: 6
217
- }, bt = {
217
+ }, xt = {
218
218
  cursor: "pointer",
219
219
  userSelect: "none"
220
- }, xt = { filter: "drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))" }, St = {
220
+ }, St = { filter: "drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))" }, Ct = {
221
221
  backgroundColor: "color-mix(in srgb, var(--mzn-color-primary) 8%, var(--mzn-color-bg-surface))",
222
222
  boxShadow: "inset 0 0 0 1px var(--mzn-color-border-primary)"
223
- }, Ct = {
223
+ }, wt = {
224
224
  alignItems: "center",
225
225
  border: "1px dashed var(--mzn-color-border-neutral)",
226
226
  borderRadius: 6,
@@ -229,135 +229,135 @@ var at = [
229
229
  minHeight: 240,
230
230
  padding: 32,
231
231
  textAlign: "center"
232
- }, wt = {
232
+ }, Tt = {
233
233
  display: "flex",
234
234
  gap: 8,
235
235
  justifyContent: "center"
236
- }, Tt = {
236
+ }, Et = {
237
237
  display: "grid",
238
238
  gap: 14
239
- }, Et = {
239
+ }, Dt = {
240
240
  display: "grid",
241
241
  columnGap: 16,
242
242
  gridTemplateColumns: "repeat(auto-fit, minmax(280px, 360px))",
243
243
  justifyContent: "start",
244
244
  maxWidth: 736,
245
245
  rowGap: 8
246
- }, Dt = { gridColumn: "1 / -1" }, Ot = {
246
+ }, Ot = { gridColumn: "1 / -1" }, kt = {
247
247
  alignItems: "center",
248
248
  display: "flex",
249
249
  gap: 8,
250
250
  gridColumn: "1 / -1",
251
251
  justifyContent: "flex-end"
252
- }, kt = { gridColumn: "1 / -1" }, At = {
252
+ }, At = { gridColumn: "1 / -1" }, jt = {
253
253
  alignItems: "start",
254
254
  display: "block",
255
255
  width: "100%"
256
- }, jt = {
257
- ...At,
258
- gridColumn: "1 / -1"
259
256
  }, Mt = {
257
+ ...jt,
258
+ gridColumn: "1 / -1"
259
+ }, Nt = {
260
260
  minWidth: 0,
261
261
  width: "100%"
262
- }, Nt = {
262
+ }, Pt = {
263
263
  minWidth: "100%",
264
264
  width: "100%"
265
- }, Pt = {
265
+ }, Ft = {
266
266
  display: "grid",
267
267
  gap: 14
268
- }, Ft = {
268
+ }, It = {
269
269
  alignItems: "start",
270
270
  display: "block",
271
271
  width: "100%"
272
- }, It = {
272
+ }, Lt = {
273
273
  minWidth: 0,
274
274
  width: "100%"
275
- }, Lt = { gridColumn: "2 / -1" }, Rt = {
275
+ }, Rt = { gridColumn: "2 / -1" }, zt = {
276
276
  display: "grid",
277
277
  gap: 10,
278
278
  width: "100%"
279
- }, zt = {
279
+ }, Bt = {
280
280
  display: "grid",
281
281
  gap: 8,
282
282
  gridTemplateColumns: "repeat(auto-fit, minmax(160px, 1fr))"
283
- }, Bt = { display: "inline-flex" }, Vt = {
283
+ }, Vt = { display: "inline-flex" }, Ht = {
284
284
  display: "grid",
285
285
  gap: 16
286
- }, Ht = {
286
+ }, Ut = {
287
287
  display: "grid",
288
288
  gap: 8
289
- }, Ut = {
289
+ }, Wt = {
290
290
  display: "flex",
291
291
  justifyContent: "flex-end"
292
- }, Wt = {
292
+ }, Gt = {
293
293
  color: "var(--mzn-color-text-error)",
294
294
  fontSize: "0.72em",
295
295
  lineHeight: 0,
296
296
  marginLeft: 2,
297
297
  verticalAlign: "super"
298
- }, Gt = {
298
+ }, Kt = {
299
299
  display: "grid",
300
300
  gap: 10,
301
301
  gridColumn: "1 / -1"
302
- }, Kt = {
302
+ }, qt = {
303
303
  display: "grid",
304
304
  gap: 2
305
- }, qt = {
305
+ }, Jt = {
306
306
  display: "grid",
307
307
  gap: 8
308
- }, Jt = {
308
+ }, Yt = {
309
309
  display: "flex",
310
310
  justifyContent: "flex-start"
311
- }, Yt = {
311
+ }, Xt = {
312
312
  display: "flex",
313
313
  flexWrap: "wrap",
314
314
  gap: 4
315
- }, Xt = {
315
+ }, Zt = {
316
316
  backgroundColor: "var(--mzn-color-bg-surface-secondary)",
317
317
  borderRadius: 6,
318
318
  display: "grid",
319
319
  gap: 4,
320
320
  padding: 10
321
- }, Zt = {
322
- ...Et,
321
+ }, Qt = {
322
+ ...Dt,
323
323
  gridTemplateColumns: "minmax(280px, 520px)",
324
324
  padding: "4px 0 8px"
325
- }, Qt = {
325
+ }, $t = {
326
326
  display: "grid",
327
327
  gap: 8,
328
328
  gridColumn: "1 / -1"
329
- }, $t = {
329
+ }, en = {
330
330
  alignItems: "center",
331
331
  display: "flex",
332
332
  gap: 12,
333
333
  justifyContent: "space-between"
334
- }, en = {
334
+ }, tn = {
335
335
  alignItems: "baseline",
336
336
  display: "flex",
337
337
  gap: 2
338
- }, tn = {
338
+ }, nn = {
339
339
  display: "grid",
340
340
  gap: 4
341
341
  };
342
- function nn(e) {
342
+ function rn(e) {
343
343
  e && (e.style.width = "100%");
344
344
  }
345
- var rn = {
345
+ var an = {
346
346
  fields: [],
347
347
  schemaVersion: 1
348
- }, an = {
348
+ }, on = {
349
349
  layout: [],
350
350
  schemaVersion: 1
351
- }, I = "__STATIC_OPTIONS__", on = "__CONSTANT__", sn = "__ROW_FIELD__:", cn = "__UNBOUND__", ln = [{
352
- id: I,
351
+ }, sn = "__STATIC_OPTIONS__", cn = "__CONSTANT__", ln = "__ROW_FIELD__:", un = "__UNBOUND__", dn = [{
352
+ id: sn,
353
353
  name: "靜態選項"
354
- }], un = [{
354
+ }], fn = [{
355
355
  id: "single",
356
356
  name: "單選"
357
357
  }, {
358
358
  id: "multiple",
359
359
  name: "複選"
360
- }], dn = [
360
+ }], pn = [
361
361
  {
362
362
  id: "unset",
363
363
  name: "不預設"
@@ -370,13 +370,13 @@ var rn = {
370
370
  id: "false",
371
371
  name: "否"
372
372
  }
373
- ], fn = [{
373
+ ], mn = [{
374
374
  id: "true",
375
375
  name: "是"
376
376
  }, {
377
377
  id: "false",
378
378
  name: "否"
379
- }], pn = [
379
+ }], hn = [
380
380
  {
381
381
  label: "顯示",
382
382
  name: "fieldVisibleWhen",
@@ -396,36 +396,36 @@ var rn = {
396
396
  target: "readonlyWhen"
397
397
  }
398
398
  ];
399
- function mn({ onChange: le, value: y }) {
400
- let ue = y?.schema ?? rn, de = y?.uiSchema ?? an, [b, x] = i(ue), [S, C] = i(de), [pe, w] = i(B(ue)), [Ye, A] = i(B(de)), [nt, j] = i({}), [rt, M] = i(null), [N, mn] = i("design"), [L, R] = i(null), [z, V] = i([]), [Fn, In] = i(null), [Ln, Rn] = i("loading"), [zn, H] = i(null), [Bn, Vn] = i(!1), [U, W] = i(null), [Hn, G] = i(null);
399
+ function gn({ onChange: le, value: y }) {
400
+ let ue = y?.schema ?? an, de = y?.uiSchema ?? on, [b, x] = i(ue), [S, C] = i(de), [pe, w] = i(V(ue)), [Je, O] = i(V(de)), [Ye, Xe] = i({}), [Qe, j] = i(null), [M, N] = i("design"), [P, F] = i(null), [I, gn] = i([]), [z, B] = i(null), [En, H] = i("loading"), [Hn, U] = i(null), [Un, Wn] = i(!1), [W, G] = i(null), [Gn, K] = i(null);
401
401
  n(() => {
402
402
  let e = !0;
403
403
  return De().then((t) => {
404
- e && (V(t), In(null), Rn("ready"));
404
+ e && (gn(t), B(null), H("ready"));
405
405
  }).catch((t) => {
406
- e && (V([]), In("目前無法載入 DataSource Catalog,請稍後重試。"), Rn("unavailable"));
406
+ e && (gn([]), B("目前無法載入 DataSource Catalog,請稍後重試。"), H("unavailable"));
407
407
  }), () => {
408
408
  e = !1;
409
409
  };
410
410
  }, []), n(() => {
411
- b.fields.some((e) => e.fieldKey === L) || R(b.fields[0]?.fieldKey ?? null);
412
- }, [b.fields, L]), n(() => {
413
- j((e) => ge(b.fields, e));
411
+ b.fields.some((e) => e.fieldKey === P) || F(b.fields[0]?.fieldKey ?? null);
412
+ }, [b.fields, P]), n(() => {
413
+ Xe((e) => ge(b.fields, e));
414
414
  }, [b.fields]), n(() => {
415
- N !== "advanced" && (w(B(b)), A(B(S)));
415
+ M !== "advanced" && (w(V(b)), O(V(S)));
416
416
  }, [
417
- N,
417
+ M,
418
418
  b,
419
419
  S
420
420
  ]);
421
- let K = r(() => b.fields.find((e) => e.fieldKey === L) ?? b.fields[0] ?? null, [b.fields, L]);
421
+ let q = r(() => b.fields.find((e) => e.fieldKey === P) ?? b.fields[0] ?? null, [b.fields, P]);
422
422
  n(() => {
423
423
  le?.({
424
424
  schema: b,
425
425
  uiSchema: S
426
426
  });
427
427
  }, [b, S]);
428
- function Un(e) {
428
+ function Kn(e) {
429
429
  let t = b.fields.length + 1, n = ve(e, t);
430
430
  x({
431
431
  ...b,
@@ -436,21 +436,21 @@ function mn({ onChange: le, value: y }) {
436
436
  fieldKey: n.fieldKey,
437
437
  width: e === "textarea" || e === "file_upload" || e === "table" ? "FULL" : "HALF"
438
438
  }]
439
- }), R(n.fieldKey), mn("design"), M(null);
439
+ }), F(n.fieldKey), N("design"), j(null);
440
440
  }
441
- function Wn(e) {
441
+ function qn(e) {
442
442
  let t = e;
443
- t === "advanced" && N !== "advanced" && (w(B(b)), A(B(S))), mn(t);
443
+ t === "advanced" && M !== "advanced" && (w(V(b)), O(V(S))), N(t);
444
444
  }
445
- function Gn(e) {
446
- let t = b.fields.flatMap((t) => k(t) ? t.columns.flatMap((n) => O(n) && Ve(n).includes(e) ? [`${t.fieldKey}.${n.fieldKey}`] : []) : O(t) && Ve(t).includes(e) ? [t.fieldKey] : []);
447
- t.length > 0 ? W({
445
+ function Jn(e) {
446
+ let t = b.fields.flatMap((t) => A(t) ? t.columns.flatMap((n) => k(n) && Ve(n).includes(e) ? [`${t.fieldKey}.${n.fieldKey}`] : []) : k(t) && Ve(t).includes(e) ? [t.fieldKey] : []);
447
+ t.length > 0 ? G({
448
448
  affectedFieldKeys: t,
449
449
  fieldKey: e,
450
450
  kind: "remove-field"
451
- }) : Kn(e);
451
+ }) : Yn(e);
452
452
  }
453
- function Kn(e) {
453
+ function Yn(e) {
454
454
  let t = b.fields.filter((t) => t.fieldKey !== e);
455
455
  x({
456
456
  ...b,
@@ -458,27 +458,27 @@ function mn({ onChange: le, value: y }) {
458
458
  }), C({
459
459
  ...S,
460
460
  layout: S.layout.filter((t) => t.fieldKey !== e)
461
- }), R(L === e ? t[0]?.fieldKey ?? null : L), M(null), H(null);
461
+ }), F(P === e ? t[0]?.fieldKey ?? null : P), j(null), U(null);
462
462
  }
463
- function qn(e) {
463
+ function Xn(e) {
464
464
  let t = e.destination;
465
465
  t && e.source.index !== t.index && (x((n) => ({
466
466
  ...n,
467
- fields: Pn(n.fields, e.source.index, t.index)
467
+ fields: Vn(n.fields, e.source.index, t.index)
468
468
  })), C((n) => ({
469
469
  ...n,
470
- layout: Pn(n.layout, e.source.index, t.index)
471
- })), M(null));
470
+ layout: Vn(n.layout, e.source.index, t.index)
471
+ })), j(null));
472
472
  }
473
- function q(e) {
474
- J((t) => ({
473
+ function J(e) {
474
+ Y((t) => ({
475
475
  ...t,
476
476
  ...e
477
477
  }));
478
478
  }
479
- function J(e) {
480
- if (!K) return;
481
- let t = K.fieldKey, n = e(K), r = n.fieldKey, i = {
479
+ function Y(e) {
480
+ if (!q) return;
481
+ let t = q.fieldKey, n = e(q), r = n.fieldKey, i = {
482
482
  ...b,
483
483
  fields: b.fields.map((e) => e.fieldKey === t ? n : e)
484
484
  }, a = t === r ? i : We(i, t, r);
@@ -488,20 +488,20 @@ function mn({ onChange: le, value: y }) {
488
488
  ...e,
489
489
  fieldKey: r
490
490
  } : e)
491
- }), R(r), M(null), H(null);
491
+ }), F(r), j(null), U(null);
492
492
  }
493
- function Jn(e) {
494
- J(() => e);
493
+ function Zn(e) {
494
+ Y(() => e);
495
495
  }
496
- function Y(e, t) {
496
+ function X(e, t) {
497
497
  x((n) => ({
498
498
  ...n,
499
- fields: n.fields.map((n) => n.fieldKey === e && k(n) ? t(n) : n)
500
- })), M(null), H(null);
499
+ fields: n.fields.map((n) => n.fieldKey === e && A(n) ? t(n) : n)
500
+ })), j(null), U(null);
501
501
  }
502
- function X(e, t, n) {
502
+ function Z(e, t, n) {
503
503
  let r = e.columns[t]?.fieldKey;
504
- Y(e.fieldKey, (e) => {
504
+ X(e.fieldKey, (e) => {
505
505
  let i = {
506
506
  ...e,
507
507
  columns: e.columns.map((e, r) => r === t ? n : e)
@@ -509,27 +509,27 @@ function mn({ onChange: le, value: y }) {
509
509
  return typeof r == "string" && r !== n.fieldKey ? Ge(i, r, n.fieldKey) : i;
510
510
  });
511
511
  }
512
- function Yn(e) {
512
+ function Qn(e) {
513
513
  let t = ye(e.columns, "text");
514
- Y(e.fieldKey, (e) => ({
514
+ X(e.fieldKey, (e) => ({
515
515
  ...e,
516
516
  columns: [...e.columns, t]
517
- })), G(e.columns.length);
517
+ })), K(e.columns.length);
518
518
  }
519
- function Xn(e, t) {
520
- Y(e, (e) => ({
519
+ function $n(e, t) {
520
+ X(e, (e) => ({
521
521
  ...e,
522
522
  columns: e.columns.filter((e, n) => n !== t)
523
- })), G((e) => e === null || e < t ? e : e === t ? null : e - 1);
523
+ })), K((e) => e === null || e < t ? e : e === t ? null : e - 1);
524
524
  }
525
- function Zn(e, t, n) {
526
- Y(e.fieldKey, (e) => ({
525
+ function er(e, t, n) {
526
+ X(e.fieldKey, (e) => ({
527
527
  ...e,
528
- columns: Pn(e.columns, t, n)
529
- })), G((e) => e === null ? e : e === t ? n : e > t && e <= n ? e - 1 : e < t && e >= n ? e + 1 : e);
528
+ columns: Vn(e.columns, t, n)
529
+ })), K((e) => e === null ? e : e === t ? n : e > t && e <= n ? e - 1 : e < t && e >= n ? e + 1 : e);
530
530
  }
531
- function Qn(e, t, n) {
532
- if (e.type !== "select" && e.type !== "autocomplete" || Qe(e) === t) return;
531
+ function tr(e, t, n) {
532
+ if (e.type !== "select" && e.type !== "autocomplete" || tt(e) === t) return;
533
533
  let r = e.defaultValue, i = t === "multiple" ? typeof r == "string" ? [r] : r : Array.isArray(r) ? r[0] : r;
534
534
  n(e, {
535
535
  ...e,
@@ -537,18 +537,18 @@ function mn({ onChange: le, value: y }) {
537
537
  mode: t
538
538
  }, "選擇模式變更可能轉換或捨棄既有預設值。");
539
539
  }
540
- function $n(e, t, n = "此變更會替換目前選項來源;既有 options、dynamic reference 或 bindings 可能失效。") {
541
- JSON.stringify(e) !== JSON.stringify(t) && W({
540
+ function nr(e, t, n = "此變更會替換目前選項來源;既有 options、dynamic reference 或 bindings 可能失效。") {
541
+ JSON.stringify(e) !== JSON.stringify(t) && G({
542
542
  fieldKey: e.fieldKey,
543
543
  impact: n,
544
544
  kind: "replace-field",
545
545
  nextField: t
546
546
  });
547
547
  }
548
- function er(e, t, n) {
548
+ function rr(e, t, n) {
549
549
  if (!t) return;
550
- if (t === I) {
551
- if (!O(e)) return;
550
+ if (t === sn) {
551
+ if (!k(e)) return;
552
552
  let { dataSource: t, defaultValue: r, ...i } = e;
553
553
  n({
554
554
  ...i,
@@ -556,9 +556,9 @@ function mn({ onChange: le, value: y }) {
556
556
  });
557
557
  return;
558
558
  }
559
- let r = z.find((e) => gn(e) === t);
559
+ let r = I.find((e) => vn(e) === t);
560
560
  if (!r) return;
561
- if (O(e)) {
561
+ if (k(e)) {
562
562
  let t = new Set(r.parameters.map((e) => e.key)), i = e.dataSource.bindings.filter((e) => t.has(e.parameter));
563
563
  n({
564
564
  ...e,
@@ -580,84 +580,84 @@ function mn({ onChange: le, value: y }) {
580
580
  }
581
581
  });
582
582
  }
583
- function tr() {
584
- U && (nr(U), W(null));
583
+ function ir() {
584
+ W && (ar(W), G(null));
585
585
  }
586
- function nr(e) {
587
- e.kind === "remove-field" ? Kn(e.fieldKey) : e.kind === "remove-column" ? Xn(e.fieldKey, e.columnIndex) : e.kind === "replace-column" ? (Y(e.fieldKey, (t) => ({
586
+ function ar(e) {
587
+ e.kind === "remove-field" ? Yn(e.fieldKey) : e.kind === "remove-column" ? $n(e.fieldKey, e.columnIndex) : e.kind === "replace-column" ? (X(e.fieldKey, (t) => ({
588
588
  ...t,
589
589
  columns: t.columns.map((t) => t.fieldKey === e.columnKey ? e.nextColumn : t)
590
- })), G(e.columnIndex)) : (x({
590
+ })), K(e.columnIndex)) : (x({
591
591
  ...b,
592
592
  fields: b.fields.map((t) => t.fieldKey === e.fieldKey ? e.nextField : t)
593
- }), M(null), H(null));
593
+ }), j(null), U(null));
594
594
  }
595
- async function rr() {
596
- Vn(!0);
595
+ async function or() {
596
+ Wn(!0);
597
597
  try {
598
598
  let e = await Ee(b, S);
599
- H(e.errors.map(ir));
599
+ U(e.errors.map(sr));
600
600
  } catch {
601
- H(["目前無法完成 DataSource schema 驗證。"]);
601
+ U(["目前無法完成 DataSource schema 驗證。"]);
602
602
  } finally {
603
- Vn(!1);
603
+ Wn(!1);
604
604
  }
605
605
  }
606
- function ir(e) {
607
- let t = dt.exec(e);
608
- if (t?.[1] && t[3]) return `${ar(t[1], t[2])}尚未指定必要參數「${or(t[1], t[2], t[3])}」的來源`;
609
- let n = ft.exec(e);
610
- return n?.[1] && n[3] ? `${ar(n[1], n[2])}綁定了來源沒有的參數「${n[3]}」` : He(e);
606
+ function sr(e) {
607
+ let t = ft.exec(e);
608
+ if (t?.[1] && t[3]) return `${cr(t[1], t[2])}尚未指定必要參數「${lr(t[1], t[2], t[3])}」的來源`;
609
+ let n = pt.exec(e);
610
+ return n?.[1] && n[3] ? `${cr(n[1], n[2])}綁定了來源沒有的參數「${n[3]}」` : He(e);
611
611
  }
612
- function ar(e, t) {
612
+ function cr(e, t) {
613
613
  let n = b.fields[Number(e)];
614
614
  if (!n) return "";
615
- let r = n.label || n.fieldKey, i = sr(n, t);
615
+ let r = n.label || n.fieldKey, i = ur(n, t);
616
616
  return i ? `「${r}」表格的「${i.label || i.fieldKey}」欄` : `「${r}」欄位`;
617
617
  }
618
- function or(e, t, n) {
618
+ function lr(e, t, n) {
619
619
  let r = b.fields[Number(e)];
620
620
  if (!r) return n;
621
- let i = sr(r, t) ?? r, a = O(i) ? i.dataSource : null;
622
- return (a ? z.find((e) => e.key === a.key && e.version === a.version) : void 0)?.parameters.find((e) => e.key === n)?.label || n;
621
+ let i = ur(r, t) ?? r, a = k(i) ? i.dataSource : null;
622
+ return (a ? I.find((e) => e.key === a.key && e.version === a.version) : void 0)?.parameters.find((e) => e.key === n)?.label || n;
623
623
  }
624
- function sr(e, t) {
625
- return typeof t == "string" && k(e) ? e.columns[Number(t)] : void 0;
624
+ function ur(e, t) {
625
+ return typeof t == "string" && A(e) ? e.columns[Number(t)] : void 0;
626
626
  }
627
- function cr(e) {
628
- j(e);
627
+ function dr(e) {
628
+ Xe(e);
629
629
  }
630
- function lr(e, t) {
630
+ function fr(e, t) {
631
631
  x((n) => ({
632
632
  ...n,
633
633
  fields: n.fields.map((n) => n.fieldKey === e ? {
634
634
  ...n,
635
635
  required: t
636
636
  } : n)
637
- })), M(null);
637
+ })), j(null);
638
638
  }
639
- function ur(e) {
639
+ function pr(e) {
640
640
  w(e);
641
641
  try {
642
- x(JSON.parse(e)), M(null);
642
+ x(JSON.parse(e)), j(null);
643
643
  } catch {
644
- M("Form Schema JSON 格式不正確");
644
+ j("Form Schema JSON 格式不正確");
645
645
  }
646
646
  }
647
- function dr(e) {
648
- A(e);
647
+ function mr(e) {
648
+ O(e);
649
649
  try {
650
- C(JSON.parse(e)), M(null);
650
+ C(JSON.parse(e)), j(null);
651
651
  } catch {
652
- M("UI Schema JSON 格式不正確");
652
+ j("UI Schema JSON 格式不正確");
653
653
  }
654
654
  }
655
655
  return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(g, { children: /* @__PURE__ */ _(ne, { children: /* @__PURE__ */ _(te, { children: /* @__PURE__ */ v("div", {
656
- style: Vt,
656
+ style: Ht,
657
657
  children: [
658
658
  /* @__PURE__ */ v(re, {
659
- activeKey: N,
660
- onChange: Wn,
659
+ activeKey: M,
660
+ onChange: qn,
661
661
  size: "sub",
662
662
  children: [
663
663
  /* @__PURE__ */ _(ie, { children: "設計" }, "design"),
@@ -665,95 +665,95 @@ function mn({ onChange: le, value: y }) {
665
665
  /* @__PURE__ */ _(ie, { children: "進階" }, "advanced")
666
666
  ]
667
667
  }),
668
- N === "design" ? fr() : null,
669
- N === "preview" ? Qr() : null,
670
- N === "advanced" ? $r() : null
668
+ M === "design" ? hr() : null,
669
+ M === "preview" ? ni() : null,
670
+ M === "advanced" ? ri() : null
671
671
  ]
672
- }) }) }) }), U ? /* @__PURE__ */ _(ee, {
672
+ }) }) }) }), W ? /* @__PURE__ */ _(ee, {
673
673
  cancelText: "返回",
674
674
  confirmText: "確認變更",
675
675
  modalType: "standard",
676
- onCancel: () => W(null),
677
- onClose: () => W(null),
678
- onConfirm: tr,
676
+ onCancel: () => G(null),
677
+ onClose: () => G(null),
678
+ onConfirm: ir,
679
679
  open: !0,
680
680
  showModalFooter: !0,
681
681
  showModalHeader: !0,
682
- title: Sn(U),
683
- children: U.kind === "remove-field" ? /* @__PURE__ */ v("div", {
684
- style: Ht,
682
+ title: wn(W),
683
+ children: W.kind === "remove-field" ? /* @__PURE__ */ v("div", {
684
+ style: Ut,
685
685
  children: [/* @__PURE__ */ _(h, {
686
686
  variant: "body",
687
687
  children: "此欄位仍被下列 DataSource binding 使用;移除後請重新設定這些欄位。"
688
688
  }), /* @__PURE__ */ _(h, {
689
689
  color: "text-warning",
690
690
  variant: "body",
691
- children: U.affectedFieldKeys.join("、")
691
+ children: W.affectedFieldKeys.join("、")
692
692
  })]
693
- }) : U.kind === "remove-column" ? /* @__PURE__ */ v(h, {
693
+ }) : W.kind === "remove-column" ? /* @__PURE__ */ v(h, {
694
694
  variant: "body",
695
695
  children: [
696
696
  "移除欄「",
697
- U.columnKey,
697
+ W.columnKey,
698
698
  "」後,既有案件仍保留原本的表單版本,但新版本的這一欄資料將不再被填寫。"
699
699
  ]
700
700
  }) : /* @__PURE__ */ _(h, {
701
701
  variant: "body",
702
- children: U.impact
702
+ children: W.impact
703
703
  })
704
704
  }) : null] });
705
- function fr() {
705
+ function hr() {
706
706
  return /* @__PURE__ */ v("div", {
707
- style: F,
707
+ style: R,
708
708
  children: [/* @__PURE__ */ v("div", {
709
- style: ht,
709
+ style: gt,
710
710
  children: [/* @__PURE__ */ _(h, {
711
711
  component: "h2",
712
712
  variant: "label-primary",
713
713
  children: "新增欄位"
714
714
  }), /* @__PURE__ */ _("div", {
715
- style: pt,
716
- children: at.map((e) => /* @__PURE__ */ _(c, {
715
+ style: mt,
716
+ children: ot.map((e) => /* @__PURE__ */ _(c, {
717
717
  icon: e.icon,
718
718
  iconType: "leading",
719
- onClick: () => Un(e.type),
719
+ onClick: () => Kn(e.type),
720
720
  size: "sub",
721
- style: mt,
721
+ style: ht,
722
722
  type: "button",
723
723
  variant: "base-secondary",
724
724
  children: e.label
725
725
  }, e.type))
726
726
  })]
727
727
  }), /* @__PURE__ */ v("div", {
728
- style: ot,
728
+ style: st,
729
729
  children: [/* @__PURE__ */ v("div", {
730
730
  style: {
731
- ...F,
732
- ...st
731
+ ...R,
732
+ ...ct
733
733
  },
734
734
  children: [/* @__PURE__ */ _(h, {
735
735
  component: "h2",
736
736
  variant: "label-primary",
737
737
  children: "表單畫布"
738
- }), b.fields.length > 0 ? /* @__PURE__ */ _($e, {
739
- onDragEnd: qn,
740
- children: /* @__PURE__ */ _(tt, {
738
+ }), b.fields.length > 0 ? /* @__PURE__ */ _(nt, {
739
+ onDragEnd: Xn,
740
+ children: /* @__PURE__ */ _(it, {
741
741
  droppableId: "form-builder-fields",
742
742
  children: (e) => /* @__PURE__ */ v("div", {
743
743
  ...e.droppableProps,
744
744
  ref: e.innerRef,
745
- style: F,
746
- children: [b.fields.map((e, t) => /* @__PURE__ */ _(et, {
745
+ style: R,
746
+ children: [b.fields.map((e, t) => /* @__PURE__ */ _(rt, {
747
747
  draggableId: e.fieldKey,
748
748
  index: t,
749
- children: (t, n) => Xr(e, t, n.isDragging)
749
+ children: (t, n) => ei(e, t, n.isDragging)
750
750
  }, e.fieldKey)), e.placeholder]
751
751
  })
752
752
  })
753
753
  }) : /* @__PURE__ */ v("div", {
754
- style: Ct,
754
+ style: wt,
755
755
  children: [/* @__PURE__ */ v("div", {
756
- style: F,
756
+ style: R,
757
757
  children: [/* @__PURE__ */ _(h, {
758
758
  component: "h3",
759
759
  variant: "h3",
@@ -764,13 +764,13 @@ function mn({ onChange: le, value: y }) {
764
764
  children: "從上方新增第一個欄位,或直接建立常用文字欄位開始設計。"
765
765
  })]
766
766
  }), /* @__PURE__ */ v("div", {
767
- style: wt,
767
+ style: Tt,
768
768
  children: [/* @__PURE__ */ _(c, {
769
- onClick: () => Un("text"),
769
+ onClick: () => Kn("text"),
770
770
  variant: "base-primary",
771
771
  children: "新增文字欄位"
772
772
  }), /* @__PURE__ */ _(c, {
773
- onClick: () => Un("textarea"),
773
+ onClick: () => Kn("textarea"),
774
774
  variant: "base-secondary",
775
775
  children: "新增長文字"
776
776
  })]
@@ -778,14 +778,14 @@ function mn({ onChange: le, value: y }) {
778
778
  })]
779
779
  }), /* @__PURE__ */ v("div", {
780
780
  style: {
781
- ...F,
782
- ...ct
781
+ ...R,
782
+ ...lt
783
783
  },
784
784
  children: [/* @__PURE__ */ _(h, {
785
785
  component: "h2",
786
786
  variant: "label-primary",
787
787
  children: "欄位設定"
788
- }), K ? pr(K) : /* @__PURE__ */ _(h, {
788
+ }), q ? gr(q) : /* @__PURE__ */ _(h, {
789
789
  color: "text-neutral",
790
790
  variant: "body",
791
791
  children: "請先新增或選取欄位。"
@@ -794,110 +794,110 @@ function mn({ onChange: le, value: y }) {
794
794
  })]
795
795
  });
796
796
  }
797
- function pr(e) {
797
+ function gr(e) {
798
798
  return /* @__PURE__ */ v("div", {
799
- style: Tt,
799
+ style: Et,
800
800
  children: [
801
- mr(e),
802
- k(e) ? vr(e) : null,
803
- hr(e)
801
+ _r(e),
802
+ A(e) ? xr(e) : null,
803
+ vr(e)
804
804
  ]
805
805
  });
806
806
  }
807
- function mr(e) {
807
+ function _r(e) {
808
808
  return /* @__PURE__ */ v("div", {
809
- style: Et,
809
+ style: Dt,
810
810
  children: [
811
811
  /* @__PURE__ */ _("div", {
812
- style: Ot,
812
+ style: kt,
813
813
  children: /* @__PURE__ */ _(o, {
814
814
  size: "main",
815
- text: hn(e.type),
815
+ text: _n(e.type),
816
816
  variant: "text-info"
817
817
  })
818
818
  }),
819
819
  $("標題", "fieldLabel", /* @__PURE__ */ _(f, {
820
- onChange: (e) => q({ label: e.target.value }),
820
+ onChange: (e) => J({ label: e.target.value }),
821
821
  placeholder: "例如:申請金額",
822
822
  value: e.label,
823
823
  variant: "base"
824
824
  })),
825
825
  $("欄位 Key", "fieldKey", /* @__PURE__ */ _(f, {
826
- onChange: (e) => q({ fieldKey: e.target.value }),
826
+ onChange: (e) => J({ fieldKey: e.target.value }),
827
827
  placeholder: "例如:amount",
828
828
  value: e.fieldKey,
829
829
  variant: "base"
830
830
  })),
831
- k(e) ? null : $("提示文字", "fieldPlaceholder", /* @__PURE__ */ _(f, {
832
- onChange: (e) => q({ placeholder: e.target.value || void 0 }),
831
+ A(e) ? null : $("提示文字", "fieldPlaceholder", /* @__PURE__ */ _(f, {
832
+ onChange: (e) => J({ placeholder: e.target.value || void 0 }),
833
833
  placeholder: "例如:請輸入申請金額",
834
834
  value: e.placeholder ?? "",
835
835
  variant: "base"
836
836
  })),
837
- gr(e, Jn, $n),
838
- On(e) ? $("以連結顯示", "fieldDisplayAsLink", /* @__PURE__ */ _(m, {
837
+ yr(e, Zn, nr),
838
+ Fn(e) ? $("以連結顯示", "fieldDisplayAsLink", /* @__PURE__ */ _(m, {
839
839
  checked: e.displayAs === "link",
840
- onChange: (e) => J((t) => e.target.checked ? On(t) ? {
840
+ onChange: (e) => Y((t) => e.target.checked ? Fn(t) ? {
841
841
  ...t,
842
842
  displayAs: "link"
843
- } : t : Tn(t, "displayAs"))
843
+ } : t : Mn(t, "displayAs"))
844
844
  })) : null,
845
845
  $("只存不顯示(系統整合用)", "fieldHidden", /* @__PURE__ */ _(m, {
846
846
  checked: e.hidden === !0,
847
- onChange: (e) => J((t) => e.target.checked ? {
847
+ onChange: (e) => Y((t) => e.target.checked ? {
848
848
  ...t,
849
849
  hidden: !0,
850
850
  required: !1
851
- } : Tn(t, "hidden"))
851
+ } : Mn(t, "hidden"))
852
852
  })),
853
853
  e.hidden === !0 ? /* @__PURE__ */ _(h, {
854
854
  color: "text-neutral",
855
- style: kt,
855
+ style: At,
856
856
  variant: "body",
857
857
  children: "填寫、唯讀與重送畫面都不會顯示這個欄位,值仍會存下來; 透過 API 仍然讀得到這個值,不是權限控管。"
858
858
  }) : null
859
859
  ]
860
860
  });
861
861
  }
862
- function hr(e) {
862
+ function vr(e) {
863
863
  return /* @__PURE__ */ _(a, {
864
- defaultExpanded: En(e),
864
+ defaultExpanded: Nn(e),
865
865
  size: "sub",
866
866
  title: "進階設定",
867
867
  children: /* @__PURE__ */ v("div", {
868
- style: Et,
868
+ style: Dt,
869
869
  children: [
870
870
  /* @__PURE__ */ _(h, {
871
871
  component: "h3",
872
- style: Dt,
872
+ style: Ot,
873
873
  variant: "label-primary",
874
874
  children: "條件規則"
875
875
  }),
876
876
  /* @__PURE__ */ _(h, {
877
877
  color: "text-neutral",
878
- style: kt,
878
+ style: At,
879
879
  variant: "body",
880
880
  children: "只有需要根據其他欄位改變顯示、必填或唯讀狀態時才需要設定。"
881
881
  }),
882
- Wr(e)
882
+ qr(e)
883
883
  ]
884
884
  })
885
885
  });
886
886
  }
887
- function gr(e, t, n, r) {
888
- return On(e) ? wr(e, t) : we(e) ? Tr(e, t) : Se(e) ? Er(e, t) : Je(e) ? Dr(e, t, n, r) : e.type === "boolean" ? Vr(e, t) : e.type === "file_upload" ? Ur(e, t) : Xe(e) ? Hr(e, t) : k(e) ? _r(e) : null;
887
+ function yr(e, t, n, r) {
888
+ return Fn(e) ? Dr(e, t) : we(e) ? Or(e, t) : Se(e) ? kr(e, t) : Ze(e) ? Ar(e, t, n, r) : e.type === "boolean" ? Wr(e, t) : e.type === "file_upload" ? Kr(e, t) : $e(e) ? Gr(e, t) : A(e) ? br(e) : null;
889
889
  }
890
- function _r(e) {
890
+ function br(e) {
891
891
  let t = Ue(e);
892
892
  return /* @__PURE__ */ v(g, { children: [
893
- $("最少列數", "fieldMinRows", Q(e.minRows, (t) => Y(e.fieldKey, (e) => ({
893
+ $("最少列數", "fieldMinRows", Q(e.minRows, (t) => X(e.fieldKey, (e) => ({
894
894
  ...e,
895
895
  minRows: t
896
896
  })), "例如:1", {
897
897
  max: t.maxRows,
898
898
  min: 0
899
899
  })),
900
- $("最多列數", "fieldMaxRows", Q(e.maxRows, (t) => Y(e.fieldKey, (e) => ({
900
+ $("最多列數", "fieldMaxRows", Q(e.maxRows, (t) => X(e.fieldKey, (e) => ({
901
901
  ...e,
902
902
  maxRows: t
903
903
  })), `未設定即為 ${qe}`, {
@@ -905,7 +905,7 @@ function mn({ onChange: le, value: y }) {
905
905
  min: Math.max(t.minRows, 1)
906
906
  })),
907
907
  $("新增列按鈕文字", "fieldAddRowLabel", /* @__PURE__ */ _(f, {
908
- onChange: (t) => Y(e.fieldKey, (e) => ({
908
+ onChange: (t) => X(e.fieldKey, (e) => ({
909
909
  ...e,
910
910
  addRowLabel: t.target.value || void 0
911
911
  })),
@@ -915,11 +915,11 @@ function mn({ onChange: le, value: y }) {
915
915
  }))
916
916
  ] });
917
917
  }
918
- function vr(e) {
918
+ function xr(e) {
919
919
  return /* @__PURE__ */ v("div", {
920
- style: Qt,
920
+ style: $t,
921
921
  children: [/* @__PURE__ */ v("div", {
922
- style: $t,
922
+ style: en,
923
923
  children: [/* @__PURE__ */ v(h, {
924
924
  component: "h3",
925
925
  variant: "label-primary",
@@ -931,16 +931,16 @@ function mn({ onChange: le, value: y }) {
931
931
  }), /* @__PURE__ */ _(c, {
932
932
  icon: me,
933
933
  iconType: "leading",
934
- onClick: () => Yn(e),
934
+ onClick: () => Qn(e),
935
935
  size: "sub",
936
936
  type: "button",
937
937
  variant: "base-secondary",
938
938
  children: "新增欄"
939
939
  })]
940
- }), yr(e)]
940
+ }), Sr(e)]
941
941
  });
942
942
  }
943
- function yr(e) {
943
+ function Sr(e) {
944
944
  let t = e.columns.map((t, n) => ({
945
945
  fieldKey: t.fieldKey,
946
946
  index: n,
@@ -952,8 +952,8 @@ function mn({ onChange: le, value: y }) {
952
952
  key: "label",
953
953
  render: (t) => /* @__PURE__ */ _(f, {
954
954
  fullWidth: !0,
955
- onChange: (n) => X(e, t.index, {
956
- ...Cr(e, t.index),
955
+ onChange: (n) => Z(e, t.index, {
956
+ ...Er(e, t.index),
957
957
  label: n.target.value
958
958
  }),
959
959
  placeholder: "例如:數量",
@@ -968,21 +968,21 @@ function mn({ onChange: le, value: y }) {
968
968
  render: (t) => /* @__PURE__ */ _(p, {
969
969
  fullWidth: !0,
970
970
  clearable: !1,
971
- menuMaxHeight: lt,
972
- onChange: (n) => xr(e, t.index, n?.id),
973
- options: [...P],
971
+ menuMaxHeight: ut,
972
+ onChange: (n) => wr(e, t.index, n?.id),
973
+ options: [...L],
974
974
  size: "sub",
975
- value: D(P, t.type)
975
+ value: D(L, t.type)
976
976
  }),
977
977
  title: "型別"
978
978
  },
979
979
  {
980
980
  key: "required",
981
981
  render: (t) => /* @__PURE__ */ _(m, {
982
- checked: Cr(e, t.index).required === !0,
982
+ checked: Er(e, t.index).required === !0,
983
983
  inputProps: { "aria-label": `${t.label || t.fieldKey} 必填` },
984
- onChange: (n) => X(e, t.index, {
985
- ...Cr(e, t.index),
984
+ onChange: (n) => Z(e, t.index, {
985
+ ...Er(e, t.index),
986
986
  required: n.target.checked
987
987
  }),
988
988
  size: "sub"
@@ -995,7 +995,7 @@ function mn({ onChange: le, value: y }) {
995
995
  icon: he,
996
996
  iconType: "leading",
997
997
  name: "移除此欄",
998
- onClick: () => W({
998
+ onClick: () => G({
999
999
  columnIndex: t.index,
1000
1000
  columnKey: t.fieldKey,
1001
1001
  fieldKey: e.fieldKey,
@@ -1004,19 +1004,19 @@ function mn({ onChange: le, value: y }) {
1004
1004
  variant: "destructive-ghost"
1005
1005
  }],
1006
1006
  width: 104
1007
- }, i = Hn === null ? void 0 : t[Hn]?.key;
1007
+ }, i = Gn === null ? void 0 : t[Gn]?.key;
1008
1008
  return /* @__PURE__ */ _(ae, {
1009
1009
  actions: r,
1010
1010
  columns: n,
1011
1011
  dataSource: t,
1012
1012
  draggable: {
1013
1013
  enabled: !0,
1014
- onDragEnd: (t, n) => Zn(e, n.fromIndex, n.toIndex)
1014
+ onDragEnd: (t, n) => er(e, n.fromIndex, n.toIndex)
1015
1015
  },
1016
1016
  expandable: {
1017
1017
  expandedRowKeys: i ? [i] : [],
1018
- expandedRowRender: (t) => br(e, t.index),
1019
- onExpand: (e, t) => G(e ? t.index : null)
1018
+ expandedRowRender: (t) => Cr(e, t.index),
1019
+ onExpand: (e, t) => K(e ? t.index : null)
1020
1020
  },
1021
1021
  fullWidth: !0,
1022
1022
  rowHeightPreset: "roomy",
@@ -1024,13 +1024,13 @@ function mn({ onChange: le, value: y }) {
1024
1024
  size: "sub"
1025
1025
  });
1026
1026
  }
1027
- function br(e, t) {
1027
+ function Cr(e, t) {
1028
1028
  let n = e.columns[t];
1029
1029
  return n ? /* @__PURE__ */ v("div", {
1030
- style: Zt,
1030
+ style: Qt,
1031
1031
  children: [
1032
1032
  $("欄位 Key", "columnFieldKey", /* @__PURE__ */ _(f, {
1033
- onChange: (r) => X(e, t, {
1033
+ onChange: (r) => Z(e, t, {
1034
1034
  ...n,
1035
1035
  fieldKey: r.target.value
1036
1036
  }),
@@ -1039,7 +1039,7 @@ function mn({ onChange: le, value: y }) {
1039
1039
  variant: "base"
1040
1040
  })),
1041
1041
  $("提示文字", "columnPlaceholder", /* @__PURE__ */ _(f, {
1042
- onChange: (r) => X(e, t, {
1042
+ onChange: (r) => Z(e, t, {
1043
1043
  ...n,
1044
1044
  placeholder: r.target.value || void 0
1045
1045
  }),
@@ -1047,38 +1047,38 @@ function mn({ onChange: le, value: y }) {
1047
1047
  value: n.placeholder ?? "",
1048
1048
  variant: "base"
1049
1049
  })),
1050
- gr(n, (n) => {
1051
- Ze(n.type) && X(e, t, n);
1050
+ yr(n, (n) => {
1051
+ et(n.type) && Z(e, t, n);
1052
1052
  }, (n, r) => {
1053
- Ze(r.type) && X(e, t, r);
1053
+ et(r.type) && Z(e, t, r);
1054
1054
  }, e.columns)
1055
1055
  ]
1056
1056
  }) : null;
1057
1057
  }
1058
- function xr(e, t, n) {
1059
- let r = e.columns[t], i = P.find((e) => e.id === n)?.id;
1058
+ function wr(e, t, n) {
1059
+ let r = e.columns[t], i = L.find((e) => e.id === n)?.id;
1060
1060
  if (!r || !i || r.type === i) return;
1061
- let a = wn(r, i), o = Cn(r);
1062
- o.length === 0 ? (X(e, t, a), G(t)) : W({
1061
+ let a = jn(r, i), o = Tn(r);
1062
+ o.length === 0 ? (Z(e, t, a), K(t)) : G({
1063
1063
  columnIndex: t,
1064
1064
  columnKey: r.fieldKey,
1065
1065
  fieldKey: e.fieldKey,
1066
- impact: `「${r.label || r.fieldKey}」改為${Sr(i)}後,這一欄的${o.join("、")}會被捨棄。`,
1066
+ impact: `「${r.label || r.fieldKey}」改為${Tr(i)}後,這一欄的${o.join("、")}會被捨棄。`,
1067
1067
  kind: "replace-column",
1068
1068
  nextColumn: a
1069
1069
  });
1070
1070
  }
1071
- function Sr(e) {
1072
- return P.find((t) => t.id === e)?.name ?? e;
1071
+ function Tr(e) {
1072
+ return L.find((t) => t.id === e)?.name ?? e;
1073
1073
  }
1074
- function Cr(e, t) {
1074
+ function Er(e, t) {
1075
1075
  let n = e.columns[t];
1076
1076
  if (!n) throw Error(`Table ${e.fieldKey} has no column at index ${t}.`);
1077
1077
  return n;
1078
1078
  }
1079
- function wr(e, t) {
1079
+ function Dr(e, t) {
1080
1080
  return /* @__PURE__ */ v(g, { children: [
1081
- $("預設值", "fieldDefaultValue", e.type === "textarea" ? qr({
1081
+ $("預設值", "fieldDefaultValue", e.type === "textarea" ? Zr({
1082
1082
  name: "fieldDefaultValue",
1083
1083
  onChange: (n) => t({
1084
1084
  ...e,
@@ -1086,14 +1086,14 @@ function mn({ onChange: le, value: y }) {
1086
1086
  }),
1087
1087
  placeholder: "輸入此欄位的預設文字",
1088
1088
  rows: 3,
1089
- value: kn(e.defaultValue)
1089
+ value: In(e.defaultValue)
1090
1090
  }) : /* @__PURE__ */ _(f, {
1091
1091
  onChange: (n) => t({
1092
1092
  ...e,
1093
1093
  defaultValue: n.target.value || void 0
1094
1094
  }),
1095
1095
  placeholder: "輸入此欄位的預設文字",
1096
- value: kn(e.defaultValue),
1096
+ value: In(e.defaultValue),
1097
1097
  variant: "base"
1098
1098
  })),
1099
1099
  $("最小長度", "fieldMinLength", Q(e.minLength, (n) => t({
@@ -1103,10 +1103,22 @@ function mn({ onChange: le, value: y }) {
1103
1103
  $("最大長度", "fieldMaxLength", Q(e.maxLength, (n) => t({
1104
1104
  ...e,
1105
1105
  maxLength: n
1106
- }), "例如:100", { min: 1 }))
1106
+ }), "例如:100", { min: 1 })),
1107
+ $("格式(正規表示式)", "fieldPattern", /* @__PURE__ */ _(f, {
1108
+ onChange: (n) => t(Dn(e, n.target.value)),
1109
+ placeholder: "例如:[0-9]{8}",
1110
+ value: e.pattern ?? "",
1111
+ variant: "base"
1112
+ }), !1, kn(e.pattern)),
1113
+ e.pattern ? $("格式錯誤訊息", "fieldPatternErrorMessage", /* @__PURE__ */ _(f, {
1114
+ onChange: (n) => t(On(e, n.target.value)),
1115
+ placeholder: "例如:統一編號為 8 位數字。",
1116
+ value: e.patternErrorMessage ?? "",
1117
+ variant: "base"
1118
+ }), !1, An(e.patternErrorMessage)) : null
1107
1119
  ] });
1108
1120
  }
1109
- function Tr(e, t) {
1121
+ function Or(e, t) {
1110
1122
  return /* @__PURE__ */ v(g, { children: [
1111
1123
  $("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (n) => t({
1112
1124
  ...e,
@@ -1125,32 +1137,32 @@ function mn({ onChange: le, value: y }) {
1125
1137
  }), "例如:999999"))
1126
1138
  ] });
1127
1139
  }
1128
- function Er(e, t) {
1129
- return $("預設值", "fieldDefaultValue", Jr(e, kn(e.defaultValue), (n) => t({
1140
+ function kr(e, t) {
1141
+ return $("預設值", "fieldDefaultValue", Qr(e, In(e.defaultValue), (n) => t({
1130
1142
  ...e,
1131
1143
  defaultValue: n
1132
1144
  })));
1133
1145
  }
1134
- function Dr(e, t, n, r) {
1135
- let i = je(e.type, z), a = {
1146
+ function Ar(e, t, n, r) {
1147
+ let i = je(e.type, I), a = {
1136
1148
  commit: (e) => t(e),
1137
1149
  rowColumns: r
1138
- }, o = O(e) ? gn(e.dataSource) : I, s = O(e) ? z.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version) : null, c = s ? i.some((e) => e.key === s.key && e.version === s.version) : !1, l = [
1139
- ...ln,
1140
- ...i.map(vn),
1141
- ...O(e) && !c ? [{
1150
+ }, o = k(e) ? vn(e.dataSource) : sn, s = k(e) ? I.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version) : null, c = s ? i.some((e) => e.key === s.key && e.version === s.version) : !1, l = [
1151
+ ...dn,
1152
+ ...i.map(bn),
1153
+ ...k(e) && !c ? [{
1142
1154
  id: o,
1143
1155
  name: `${e.dataSource.key} v${e.dataSource.version}(目前不可用或不支援)`
1144
1156
  }] : []
1145
- ], u = Qe(e);
1157
+ ], u = tt(e);
1146
1158
  return /* @__PURE__ */ v(g, { children: [
1147
1159
  e.type === "select" || e.type === "autocomplete" ? $("選擇模式", "fieldSelectionMode", /* @__PURE__ */ _(p, {
1148
1160
  clearable: !1,
1149
1161
  onChange: (t) => {
1150
- (t?.id === "single" || t?.id === "multiple") && Qn(e, t.id, n);
1162
+ (t?.id === "single" || t?.id === "multiple") && tr(e, t.id, n);
1151
1163
  },
1152
- options: [...un],
1153
- value: D(un, u)
1164
+ options: [...fn],
1165
+ value: D(fn, u)
1154
1166
  })) : $("選擇模式", "fieldSelectionMode", /* @__PURE__ */ _(h, {
1155
1167
  color: "text-neutral",
1156
1168
  variant: "body",
@@ -1158,29 +1170,29 @@ function mn({ onChange: le, value: y }) {
1158
1170
  })),
1159
1171
  $("選項來源", "fieldOptionSource", /* @__PURE__ */ _(p, {
1160
1172
  clearable: !1,
1161
- disabled: Ln === "loading" && !O(e),
1162
- onChange: (n) => er(e, n?.id, t),
1173
+ disabled: En === "loading" && !k(e),
1174
+ onChange: (n) => rr(e, n?.id, t),
1163
1175
  options: l,
1164
1176
  placeholder: "選擇選項來源",
1165
1177
  value: D(l, o)
1166
1178
  })),
1167
- O(e) ? Or(e, i, a) : Br(e, t)
1179
+ k(e) ? jr(e, i, a) : Ur(e, t)
1168
1180
  ] });
1169
1181
  }
1170
- function Or(e, t, n) {
1171
- let r = z.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version), i = r && !Ce(r, e.type);
1182
+ function jr(e, t, n) {
1183
+ let r = I.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version), i = r && !Ce(r, e.type);
1172
1184
  return /* @__PURE__ */ v("div", {
1173
- style: Gt,
1185
+ style: Kt,
1174
1186
  children: [
1175
- Ln === "loading" ? /* @__PURE__ */ _(h, {
1187
+ En === "loading" ? /* @__PURE__ */ _(h, {
1176
1188
  color: "text-neutral",
1177
1189
  variant: "body",
1178
1190
  children: "正在載入可用的選項來源…"
1179
1191
  }) : null,
1180
- Fn ? /* @__PURE__ */ _(h, {
1192
+ z ? /* @__PURE__ */ _(h, {
1181
1193
  color: "text-error",
1182
1194
  variant: "body",
1183
- children: Fn
1195
+ children: z
1184
1196
  }) : null,
1185
1197
  r ? null : /* @__PURE__ */ _(h, {
1186
1198
  color: "text-warning",
@@ -1192,28 +1204,28 @@ function mn({ onChange: le, value: y }) {
1192
1204
  variant: "body",
1193
1205
  children: "這個來源不支援目前的控制項,請改選其他來源。"
1194
1206
  }) : null,
1195
- r ? kr(r) : null,
1196
- r && r.parameters.length > 0 ? Ar(e, r, n) : null,
1197
- t.length === 0 && !Fn ? /* @__PURE__ */ _(h, {
1207
+ r ? Mr(r) : null,
1208
+ r && r.parameters.length > 0 ? Nr(e, r, n) : null,
1209
+ t.length === 0 && !z ? /* @__PURE__ */ _(h, {
1198
1210
  color: "text-warning",
1199
1211
  variant: "body",
1200
1212
  children: "沒有支援目前控制項的已註冊來源。"
1201
1213
  }) : null,
1202
1214
  /* @__PURE__ */ _("div", {
1203
- style: Jt,
1215
+ style: Yt,
1204
1216
  children: /* @__PURE__ */ _(c, {
1205
- disabled: Bn,
1206
- loading: Bn,
1207
- onClick: () => void rr(),
1217
+ disabled: Un,
1218
+ loading: Un,
1219
+ onClick: () => void or(),
1208
1220
  size: "sub",
1209
1221
  type: "button",
1210
1222
  variant: "base-secondary",
1211
1223
  children: "檢查全部動態選項設定"
1212
1224
  })
1213
1225
  }),
1214
- zn ? /* @__PURE__ */ _("div", {
1215
- style: Kt,
1216
- children: zn.length > 0 ? zn.map((e) => /* @__PURE__ */ _(h, {
1226
+ Hn ? /* @__PURE__ */ _("div", {
1227
+ style: qt,
1228
+ children: Hn.length > 0 ? Hn.map((e) => /* @__PURE__ */ _(h, {
1217
1229
  color: "text-error",
1218
1230
  variant: "caption",
1219
1231
  children: e
@@ -1226,17 +1238,17 @@ function mn({ onChange: le, value: y }) {
1226
1238
  ]
1227
1239
  });
1228
1240
  }
1229
- function kr(e) {
1241
+ function Mr(e) {
1230
1242
  return /* @__PURE__ */ v("div", {
1231
- style: Xt,
1243
+ style: Zt,
1232
1244
  children: [
1233
1245
  e.description ? /* @__PURE__ */ _(h, {
1234
1246
  variant: "body",
1235
1247
  children: e.description
1236
1248
  }) : null,
1237
1249
  /* @__PURE__ */ _("div", {
1238
- style: Yt,
1239
- children: _n(e).map((e) => /* @__PURE__ */ _(oe, {
1250
+ style: Xt,
1251
+ children: yn(e).map((e) => /* @__PURE__ */ _(oe, {
1240
1252
  label: e,
1241
1253
  readOnly: !0,
1242
1254
  size: "minor"
@@ -1255,14 +1267,14 @@ function mn({ onChange: le, value: y }) {
1255
1267
  ]
1256
1268
  });
1257
1269
  }
1258
- function Ar(e, t, n) {
1270
+ function Nr(e, t, n) {
1259
1271
  let r = t.parameters.map((e, t) => ({
1260
1272
  key: e.key,
1261
1273
  index: t,
1262
1274
  parameter: e
1263
1275
  }));
1264
1276
  return /* @__PURE__ */ v("div", {
1265
- style: qt,
1277
+ style: Jt,
1266
1278
  children: [/* @__PURE__ */ _(h, {
1267
1279
  color: "text-neutral",
1268
1280
  variant: "label-secondary",
@@ -1272,7 +1284,7 @@ function mn({ onChange: le, value: y }) {
1272
1284
  {
1273
1285
  key: "parameter",
1274
1286
  render: (e) => /* @__PURE__ */ v("div", {
1275
- style: en,
1287
+ style: tn,
1276
1288
  children: [/* @__PURE__ */ _(h, {
1277
1289
  variant: "input",
1278
1290
  children: e.parameter.label ?? e.parameter.key
@@ -1288,13 +1300,13 @@ function mn({ onChange: le, value: y }) {
1288
1300
  {
1289
1301
  key: "binding",
1290
1302
  width: 268,
1291
- render: (t) => Mr(e, t.parameter, n),
1303
+ render: (t) => Fr(e, t.parameter, n),
1292
1304
  title: "值從哪裡來"
1293
1305
  },
1294
1306
  {
1295
1307
  key: "constant",
1296
1308
  width: 140,
1297
- render: (t) => Be(E(e, t.parameter.key)) === "CONSTANT" ? Ir(e, t.parameter.key, t.parameter.type, E(e, t.parameter.key), n) : /* @__PURE__ */ _(h, {
1309
+ render: (t) => Be(E(e, t.parameter.key)) === "CONSTANT" ? zr(e, t.parameter.key, t.parameter.type, E(e, t.parameter.key), n) : /* @__PURE__ */ _(h, {
1298
1310
  color: "text-neutral",
1299
1311
  variant: "caption",
1300
1312
  children: "—"
@@ -1306,7 +1318,7 @@ function mn({ onChange: le, value: y }) {
1306
1318
  render: (t) => /* @__PURE__ */ _(h, {
1307
1319
  color: "text-neutral",
1308
1320
  variant: "caption",
1309
- children: Pr(E(e, t.parameter.key), t.parameter, n, jr(e, t.parameter, n))
1321
+ children: Lr(E(e, t.parameter.key), t.parameter, n, Pr(e, t.parameter, n))
1310
1322
  }),
1311
1323
  title: "填寫時的行為"
1312
1324
  }
@@ -1318,28 +1330,28 @@ function mn({ onChange: le, value: y }) {
1318
1330
  })]
1319
1331
  });
1320
1332
  }
1321
- function jr(e, t, n) {
1333
+ function Pr(e, t, n) {
1322
1334
  return Ae(t.type, b.fields, e.fieldKey).length + (n.rowColumns ? Me(t.type, n.rowColumns, e.fieldKey).length : 0);
1323
1335
  }
1324
- function Mr(e, t, n) {
1325
- let r = yn(E(e, t.key)), i = n.rowColumns ? Me(t.type, n.rowColumns, e.fieldKey).map((e) => ({
1326
- id: `${sn}${e.id}`,
1336
+ function Fr(e, t, n) {
1337
+ let r = xn(E(e, t.key)), i = n.rowColumns ? Me(t.type, n.rowColumns, e.fieldKey).map((e) => ({
1338
+ id: `${ln}${e.id}`,
1327
1339
  name: `同列:${e.name}`
1328
1340
  })) : [], a = [
1329
1341
  ...t.required ? [] : [{
1330
- id: cn,
1342
+ id: un,
1331
1343
  name: "未綁定"
1332
1344
  }],
1333
1345
  ...i,
1334
1346
  ...Ae(t.type, b.fields, e.fieldKey),
1335
1347
  ...t.type === "STRING_ARRAY" ? [] : [{
1336
- id: on,
1348
+ id: cn,
1337
1349
  name: "固定常數"
1338
1350
  }]
1339
1351
  ];
1340
1352
  return /* @__PURE__ */ _("div", {
1341
1353
  "data-data-source-parameter": t.key,
1342
- style: tn,
1354
+ style: nn,
1343
1355
  children: /* @__PURE__ */ _(p, {
1344
1356
  clearable: !1,
1345
1357
  fullWidth: !0,
@@ -1347,7 +1359,7 @@ function mn({ onChange: le, value: y }) {
1347
1359
  "aria-label": `${t.label ?? t.key} 的值來源`,
1348
1360
  title: D(a, r)?.name ?? ""
1349
1361
  },
1350
- onChange: (r) => Rr(e, t.key, t.type, r?.id, n),
1362
+ onChange: (r) => Vr(e, t.key, t.type, r?.id, n),
1351
1363
  options: a,
1352
1364
  placeholder: "選擇欄位或常數",
1353
1365
  size: "sub",
@@ -1355,14 +1367,14 @@ function mn({ onChange: le, value: y }) {
1355
1367
  })
1356
1368
  });
1357
1369
  }
1358
- function Nr(e) {
1359
- return ut[e];
1370
+ function Ir(e) {
1371
+ return dt[e];
1360
1372
  }
1361
- function Pr(e, t, n, r) {
1373
+ function Lr(e, t, n, r) {
1362
1374
  let i = Be(e);
1363
- return i === "CONSTANT" ? "固定值,不隨填寫變動" : i === "FIELD" ? `隨欄位「${Fr(e, n)}」變動` : i === "ROW_FIELD" ? `隨同列「${Fr(e, n)}」變動` : t.required ? r > 0 ? "尚未設定,選項無法載入" : `沒有相容的${Nr(t.type)}欄位,請改用固定值` : "未設定,不做這層篩選";
1375
+ return i === "CONSTANT" ? "固定值,不隨填寫變動" : i === "FIELD" ? `隨欄位「${Rr(e, n)}」變動` : i === "ROW_FIELD" ? `隨同列「${Rr(e, n)}」變動` : t.required ? r > 0 ? "尚未設定,選項無法載入" : `沒有相容的${Ir(t.type)}欄位,請改用固定值` : "未設定,不做這層篩選";
1364
1376
  }
1365
- function Fr(e, t) {
1377
+ function Rr(e, t) {
1366
1378
  let n = e?.from;
1367
1379
  if (n?.kind === "FIELD") {
1368
1380
  let e = b.fields.find((e) => e.fieldKey === n.fieldKey);
@@ -1374,13 +1386,13 @@ function mn({ onChange: le, value: y }) {
1374
1386
  }
1375
1387
  return "";
1376
1388
  }
1377
- function Ir(e, t, n, r, i) {
1389
+ function zr(e, t, n, r, i) {
1378
1390
  return /* @__PURE__ */ _("div", {
1379
1391
  "data-data-source-constant": t,
1380
- children: Lr(e, t, n, r, i)
1392
+ children: Br(e, t, n, r, i)
1381
1393
  });
1382
1394
  }
1383
- function Lr(e, t, n, r, i) {
1395
+ function Br(e, t, n, r, i) {
1384
1396
  let a = ze(e, t);
1385
1397
  if (n === "BOOLEAN") {
1386
1398
  let n = [{
@@ -1393,7 +1405,7 @@ function mn({ onChange: le, value: y }) {
1393
1405
  return /* @__PURE__ */ _(p, {
1394
1406
  clearable: !1,
1395
1407
  fullWidth: !0,
1396
- onChange: (n) => zr(e, t, n?.id === "true", i),
1408
+ onChange: (n) => Hr(e, t, n?.id === "true", i),
1397
1409
  options: n,
1398
1410
  size: "sub",
1399
1411
  value: D(n, a === !0 ? "true" : "false")
@@ -1404,16 +1416,16 @@ function mn({ onChange: le, value: y }) {
1404
1416
  variant: "caption",
1405
1417
  children: "這個條件要收多個值,請綁定一個複選欄位;不接受固定值。"
1406
1418
  }) : /* @__PURE__ */ _(f, {
1407
- onChange: (r) => zr(e, t, n === "NUMBER" ? ke(r.target.value) ?? 0 : r.target.value, i),
1419
+ onChange: (r) => Hr(e, t, n === "NUMBER" ? ke(r.target.value) ?? 0 : r.target.value, i),
1408
1420
  placeholder: n === "NUMBER" ? "輸入數字" : "輸入固定值",
1409
- value: bn(r, n),
1421
+ value: Sn(r, n),
1410
1422
  variant: "base"
1411
1423
  });
1412
1424
  }
1413
- function Rr(e, t, n, r, i) {
1414
- i.commit(Ke(e, t, xn(t, n, r)));
1425
+ function Vr(e, t, n, r, i) {
1426
+ i.commit(Ke(e, t, Cn(t, n, r)));
1415
1427
  }
1416
- function zr(e, t, n, r) {
1428
+ function Hr(e, t, n, r) {
1417
1429
  r.commit(Ke(e, t, {
1418
1430
  from: {
1419
1431
  kind: "CONSTANT",
@@ -1422,8 +1434,8 @@ function mn({ onChange: le, value: y }) {
1422
1434
  parameter: t
1423
1435
  }));
1424
1436
  }
1425
- function Br(e, t) {
1426
- let n = Qe(e), r = Array.isArray(e.defaultValue) ? e.defaultValue : [], i = e.options.map(Re), a = i.filter((e) => r.includes(e.id));
1437
+ function Ur(e, t) {
1438
+ let n = tt(e), r = Array.isArray(e.defaultValue) ? e.defaultValue : [], i = e.options.map(Re), a = i.filter((e) => r.includes(e.id));
1427
1439
  return /* @__PURE__ */ v(g, { children: [$("預設值", "fieldDefaultValue", n === "multiple" ? /* @__PURE__ */ _(p, {
1428
1440
  clearable: !0,
1429
1441
  mode: "multiple",
@@ -1443,9 +1455,9 @@ function mn({ onChange: le, value: y }) {
1443
1455
  options: i,
1444
1456
  placeholder: "選擇預設選項",
1445
1457
  value: typeof e.defaultValue == "string" ? D(i, e.defaultValue) : null
1446
- })), $("選項", "fieldOptions", Yr(e, t), !0)] });
1458
+ })), $("選項", "fieldOptions", $r(e, t), !0)] });
1447
1459
  }
1448
- function Vr(e, t) {
1460
+ function Wr(e, t) {
1449
1461
  let n = typeof e.defaultValue == "boolean" ? String(e.defaultValue) : "unset";
1450
1462
  return $("預設值", "fieldDefaultValue", /* @__PURE__ */ _(p, {
1451
1463
  clearable: !1,
@@ -1453,12 +1465,12 @@ function mn({ onChange: le, value: y }) {
1453
1465
  ...e,
1454
1466
  defaultValue: n?.id === "true" || n?.id !== "false" && void 0
1455
1467
  }),
1456
- options: [...dn],
1468
+ options: [...pn],
1457
1469
  placeholder: "選擇預設狀態",
1458
- value: D(dn, n)
1470
+ value: D(pn, n)
1459
1471
  }));
1460
1472
  }
1461
- function Hr(e, t) {
1473
+ function Gr(e, t) {
1462
1474
  return $("可複選", "fieldMemberMultiple", /* @__PURE__ */ _(m, {
1463
1475
  checked: e.multiple === !0,
1464
1476
  label: e.multiple === !0 ? "可選多位" : "只能選一位",
@@ -1470,38 +1482,38 @@ function mn({ onChange: le, value: y }) {
1470
1482
  size: "sub"
1471
1483
  }));
1472
1484
  }
1473
- function Ur(e, t) {
1485
+ function Kr(e, t) {
1474
1486
  return /* @__PURE__ */ v(g, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (n) => t({
1475
1487
  ...e,
1476
1488
  maxFiles: n
1477
- }), "例如:1", { min: 1 })), $("MIME", "fieldAcceptedMimeTypes", qr({
1489
+ }), "例如:1", { min: 1 })), $("MIME", "fieldAcceptedMimeTypes", Zr({
1478
1490
  name: "fieldAcceptedMimeTypes",
1479
1491
  onChange: (n) => t({
1480
1492
  ...e,
1481
- acceptedMimeTypes: An(n)
1493
+ acceptedMimeTypes: Ln(n)
1482
1494
  }),
1483
1495
  placeholder: "每行一個 MIME type,例如:application/pdf",
1484
1496
  rows: 3,
1485
- value: jn(e.acceptedMimeTypes)
1497
+ value: Rn(e.acceptedMimeTypes)
1486
1498
  }), !1)] });
1487
1499
  }
1488
- function Wr(e) {
1489
- let t = b.fields.filter((t) => t.fieldKey !== e.fieldKey && !Xe(t));
1490
- return t.length ? /* @__PURE__ */ _(g, { children: pn.map((n) => Gr(e, n, t)) }) : /* @__PURE__ */ _(h, {
1500
+ function qr(e) {
1501
+ let t = b.fields.filter((t) => t.fieldKey !== e.fieldKey && !$e(t));
1502
+ return t.length ? /* @__PURE__ */ _(g, { children: hn.map((n) => Jr(e, n, t)) }) : /* @__PURE__ */ _(h, {
1491
1503
  color: "text-neutral",
1492
- style: kt,
1504
+ style: At,
1493
1505
  variant: "body",
1494
1506
  children: "目前沒有其他欄位可作為條件來源。新增更多欄位後即可設定條件規則。"
1495
1507
  });
1496
1508
  }
1497
- function Gr(e, t, n) {
1498
- let r = e[t.target], i = r ? Oe(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(Dn), c = Pe(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Ie(o), u = i?.value ?? Le(o), d = !!r, f = d && (!i || !a);
1509
+ function Jr(e, t, n) {
1510
+ let r = e[t.target], i = r ? Oe(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(Pn), c = Pe(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Ie(o), u = i?.value ?? Le(o), d = !!r, f = d && (!i || !a);
1499
1511
  return $(t.label, t.name, /* @__PURE__ */ v("div", {
1500
- style: Rt,
1512
+ style: zt,
1501
1513
  children: [/* @__PURE__ */ _(m, {
1502
1514
  checked: d,
1503
1515
  label: d ? "已啟用" : "不啟用",
1504
- onChange: (e) => Z(t.target, e.target.checked ? T(o, Ie(o), Le(o)) : void 0),
1516
+ onChange: (e) => Yr(t.target, e.target.checked ? T(o, Ie(o), Le(o)) : void 0),
1505
1517
  size: "sub",
1506
1518
  supportingText: t.supportingText
1507
1519
  }), d ? f ? /* @__PURE__ */ _(h, {
@@ -1509,13 +1521,13 @@ function mn({ onChange: le, value: y }) {
1509
1521
  variant: "body",
1510
1522
  children: "這個規則不是目前 UI 支援的格式。重新選擇條件後會取代既有規則。"
1511
1523
  }) : /* @__PURE__ */ v("div", {
1512
- style: zt,
1524
+ style: Bt,
1513
1525
  children: [
1514
1526
  /* @__PURE__ */ _(p, {
1515
1527
  clearable: !1,
1516
1528
  onChange: (e) => {
1517
1529
  let r = n.find((t) => t.fieldKey === e?.id) ?? o;
1518
- Z(t.target, T(r, Ie(r), Le(r)));
1530
+ Yr(t.target, T(r, Ie(r), Le(r)));
1519
1531
  },
1520
1532
  options: s,
1521
1533
  placeholder: "選擇欄位",
@@ -1523,26 +1535,26 @@ function mn({ onChange: le, value: y }) {
1523
1535
  }),
1524
1536
  /* @__PURE__ */ _(p, {
1525
1537
  clearable: !1,
1526
- onChange: (e) => Z(t.target, T(o, Ne(e?.id) ?? l, u)),
1538
+ onChange: (e) => Yr(t.target, T(o, Ne(e?.id) ?? l, u)),
1527
1539
  options: [...c],
1528
1540
  placeholder: "判斷方式",
1529
1541
  value: D(c, l)
1530
1542
  }),
1531
- Kr(o, u, (e) => Z(t.target, T(o, l, e)))
1543
+ Xr(o, u, (e) => Yr(t.target, T(o, l, e)))
1532
1544
  ]
1533
1545
  }) : null]
1534
1546
  }), !0);
1535
1547
  }
1536
- function Z(e, t) {
1537
- q({ [e]: t });
1548
+ function Yr(e, t) {
1549
+ J({ [e]: t });
1538
1550
  }
1539
- function Kr(e, t, n) {
1551
+ function Xr(e, t, n) {
1540
1552
  if (e.type === "boolean") return /* @__PURE__ */ _(p, {
1541
1553
  clearable: !1,
1542
1554
  onChange: (e) => n(e?.id ?? "true"),
1543
- options: [...fn],
1555
+ options: [...mn],
1544
1556
  placeholder: "比較值",
1545
- value: D(fn, t === "false" ? "false" : "true")
1557
+ value: D(mn, t === "false" ? "false" : "true")
1546
1558
  });
1547
1559
  if (Te(e)) {
1548
1560
  let r = e.options.map(Re);
@@ -1554,22 +1566,22 @@ function mn({ onChange: le, value: y }) {
1554
1566
  value: D(r, t)
1555
1567
  });
1556
1568
  }
1557
- return we(e) ? Q(ke(t), (e) => n(String(e ?? 0)), "比較值") : Se(e) ? Jr(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ _(f, {
1569
+ return we(e) ? Q(ke(t), (e) => n(String(e ?? 0)), "比較值") : Se(e) ? Qr(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ _(f, {
1558
1570
  onChange: (e) => n(e.target.value),
1559
1571
  placeholder: "比較值",
1560
1572
  value: t,
1561
1573
  variant: "base"
1562
1574
  });
1563
1575
  }
1564
- function qr({ name: e, onChange: t, placeholder: n, rows: r, value: i }) {
1576
+ function Zr({ name: e, onChange: t, placeholder: n, rows: r, value: i }) {
1565
1577
  return /* @__PURE__ */ _(se, {
1566
1578
  "aria-label": e,
1567
1579
  onChange: (e) => t(e.target.value),
1568
1580
  placeholder: n,
1569
- ref: nn,
1581
+ ref: rn,
1570
1582
  resize: "vertical",
1571
1583
  rows: r,
1572
- style: Nt,
1584
+ style: Pt,
1573
1585
  value: i
1574
1586
  });
1575
1587
  }
@@ -1585,7 +1597,7 @@ function mn({ onChange: le, value: y }) {
1585
1597
  variant: "measure"
1586
1598
  });
1587
1599
  }
1588
- function Jr(e, t, n) {
1600
+ function Qr(e, t, n) {
1589
1601
  return e.type === "datetime" ? /* @__PURE__ */ _(u, {
1590
1602
  formatDate: "YYYY-MM-DD",
1591
1603
  formatTime: "HH:mm",
@@ -1601,7 +1613,7 @@ function mn({ onChange: le, value: y }) {
1601
1613
  value: Fe(t)
1602
1614
  });
1603
1615
  }
1604
- function Yr(e, t) {
1616
+ function $r(e, t) {
1605
1617
  let n = e.options.map((t, n) => ({
1606
1618
  index: n,
1607
1619
  key: `${e.fieldKey}-${n}`,
@@ -1609,7 +1621,7 @@ function mn({ onChange: le, value: y }) {
1609
1621
  value: t.value
1610
1622
  }));
1611
1623
  return /* @__PURE__ */ v("div", {
1612
- style: Ht,
1624
+ style: Ut,
1613
1625
  children: [/* @__PURE__ */ _(ae, {
1614
1626
  actions: {
1615
1627
  render: (n) => [{
@@ -1630,7 +1642,7 @@ function mn({ onChange: le, value: y }) {
1630
1642
  render: (n) => /* @__PURE__ */ _(f, {
1631
1643
  onChange: (r) => t({
1632
1644
  ...e,
1633
- options: Mn(e.options, n.index, { label: r.target.value })
1645
+ options: zn(e.options, n.index, { label: r.target.value })
1634
1646
  }),
1635
1647
  placeholder: "例如:主管",
1636
1648
  size: "sub",
@@ -1643,7 +1655,7 @@ function mn({ onChange: le, value: y }) {
1643
1655
  render: (n) => /* @__PURE__ */ _(f, {
1644
1656
  onChange: (r) => t({
1645
1657
  ...e,
1646
- options: Mn(e.options, n.index, { value: r.target.value })
1658
+ options: zn(e.options, n.index, { value: r.target.value })
1647
1659
  }),
1648
1660
  placeholder: "例如:manager",
1649
1661
  size: "sub",
@@ -1656,13 +1668,13 @@ function mn({ onChange: le, value: y }) {
1656
1668
  showHeader: !0,
1657
1669
  size: "sub"
1658
1670
  }), /* @__PURE__ */ _("div", {
1659
- style: Ut,
1671
+ style: Wt,
1660
1672
  children: /* @__PURE__ */ _(c, {
1661
1673
  icon: me,
1662
1674
  iconType: "leading",
1663
1675
  onClick: () => t({
1664
1676
  ...e,
1665
- options: [...e.options, Nn(e.options)]
1677
+ options: [...e.options, Bn(e.options)]
1666
1678
  }),
1667
1679
  variant: "base-secondary",
1668
1680
  children: "新增選項"
@@ -1670,48 +1682,52 @@ function mn({ onChange: le, value: y }) {
1670
1682
  })]
1671
1683
  });
1672
1684
  }
1673
- function Xr(e, t, n) {
1685
+ function ei(e, t, n) {
1674
1686
  return /* @__PURE__ */ _("div", {
1675
1687
  ...t.draggableProps,
1676
1688
  "data-form-builder-field-key": e.fieldKey,
1677
1689
  ref: t.innerRef,
1678
1690
  style: {
1679
- ...bt,
1680
- ...n ? xt : null,
1691
+ ...xt,
1692
+ ...n ? St : null,
1681
1693
  ...t.draggableProps.style
1682
1694
  },
1683
1695
  children: /* @__PURE__ */ _(s, {
1684
- style: e.fieldKey === K?.fieldKey ? St : void 0,
1685
- children: Zr(e, t, n)
1696
+ style: e.fieldKey === q?.fieldKey ? Ct : void 0,
1697
+ children: ti(e, t, n)
1686
1698
  })
1687
1699
  });
1688
1700
  }
1689
- function $(t, n, r, i = !1) {
1701
+ function $(t, n, r, i = !1, a) {
1690
1702
  return /* @__PURE__ */ _("div", {
1691
- style: i ? jt : At,
1703
+ style: i ? Mt : jt,
1692
1704
  children: /* @__PURE__ */ _("div", {
1693
- style: Mt,
1705
+ style: Nt,
1694
1706
  children: /* @__PURE__ */ _(e, {
1695
1707
  label: t,
1696
1708
  layout: i ? ce.VERTICAL : ce.STRETCH,
1697
1709
  name: n,
1710
+ ...a ? {
1711
+ hintText: a.text,
1712
+ severity: a.severity
1713
+ } : {},
1698
1714
  children: r
1699
1715
  })
1700
1716
  })
1701
1717
  });
1702
1718
  }
1703
- function Zr(e, t, n) {
1719
+ function ti(e, t, n) {
1704
1720
  return /* @__PURE__ */ v("div", {
1705
1721
  ...t.dragHandleProps ?? {},
1706
1722
  "aria-label": "選取或拖曳排序欄位",
1707
- onClick: () => R(e.fieldKey),
1708
- style: gt,
1723
+ onClick: () => F(e.fieldKey),
1724
+ style: _t,
1709
1725
  title: "點擊選取,拖曳排序",
1710
1726
  children: [
1711
1727
  /* @__PURE__ */ _("span", {
1712
1728
  "aria-label": "拖曳排序",
1713
1729
  role: "img",
1714
- style: Bt,
1730
+ style: Vt,
1715
1731
  title: "拖曳排序",
1716
1732
  children: /* @__PURE__ */ _(d, {
1717
1733
  icon: fe,
@@ -1719,14 +1735,14 @@ function mn({ onChange: le, value: y }) {
1719
1735
  })
1720
1736
  }),
1721
1737
  /* @__PURE__ */ v("div", {
1722
- style: _t,
1738
+ style: vt,
1723
1739
  children: [/* @__PURE__ */ v(h, {
1724
1740
  component: "span",
1725
1741
  ellipsis: !0,
1726
1742
  variant: "label-primary",
1727
1743
  children: [e.label, e.required ? /* @__PURE__ */ _("sup", {
1728
1744
  "aria-label": "必填",
1729
- style: Wt,
1745
+ style: Gt,
1730
1746
  children: "*"
1731
1747
  }) : null]
1732
1748
  }), /* @__PURE__ */ v(h, {
@@ -1735,7 +1751,7 @@ function mn({ onChange: le, value: y }) {
1735
1751
  ellipsis: !0,
1736
1752
  variant: "caption",
1737
1753
  children: [
1738
- hn(e.type),
1754
+ _n(e.type),
1739
1755
  " ·",
1740
1756
  e.required ? " 必填" : " 選填",
1741
1757
  " ·",
@@ -1746,20 +1762,20 @@ function mn({ onChange: le, value: y }) {
1746
1762
  }),
1747
1763
  /* @__PURE__ */ v("div", {
1748
1764
  onClick: (e) => e.stopPropagation(),
1749
- style: vt,
1765
+ style: yt,
1750
1766
  children: [/* @__PURE__ */ _("div", {
1751
- style: yt,
1767
+ style: bt,
1752
1768
  children: /* @__PURE__ */ _(m, {
1753
1769
  checked: !!e.required,
1754
1770
  disabled: n || e.hidden === !0,
1755
1771
  label: "必填",
1756
- onChange: (t) => lr(e.fieldKey, t.target.checked)
1772
+ onChange: (t) => fr(e.fieldKey, t.target.checked)
1757
1773
  })
1758
1774
  }), /* @__PURE__ */ _(c, {
1759
1775
  disabled: n,
1760
1776
  icon: he,
1761
1777
  iconType: "icon-only",
1762
- onClick: () => Gn(e.fieldKey),
1778
+ onClick: () => Jn(e.fieldKey),
1763
1779
  variant: "destructive-ghost",
1764
1780
  children: "移除欄位"
1765
1781
  })]
@@ -1767,61 +1783,61 @@ function mn({ onChange: le, value: y }) {
1767
1783
  ]
1768
1784
  });
1769
1785
  }
1770
- function Qr() {
1786
+ function ni() {
1771
1787
  return /* @__PURE__ */ v("div", {
1772
- style: F,
1788
+ style: R,
1773
1789
  children: [/* @__PURE__ */ _(h, {
1774
1790
  component: "h2",
1775
1791
  variant: "h3",
1776
1792
  children: "填寫預覽"
1777
1793
  }), /* @__PURE__ */ _(t, {
1778
1794
  dataSourceContext: { kind: "preview" },
1779
- onChange: cr,
1795
+ onChange: dr,
1780
1796
  schema: b,
1781
1797
  uiSchema: S,
1782
- value: nt
1798
+ value: Ye
1783
1799
  })]
1784
1800
  });
1785
1801
  }
1786
- function $r() {
1802
+ function ri() {
1787
1803
  return /* @__PURE__ */ v("div", {
1788
- style: F,
1804
+ style: R,
1789
1805
  children: [/* @__PURE__ */ _(h, {
1790
1806
  component: "h2",
1791
1807
  variant: "h3",
1792
1808
  children: "Schema"
1793
1809
  }), /* @__PURE__ */ v("div", {
1794
- style: Pt,
1810
+ style: Ft,
1795
1811
  children: [
1796
- ei("Form Schema", "schemaJson", /* @__PURE__ */ _(it, {
1812
+ ii("Form Schema", "schemaJson", /* @__PURE__ */ _(at, {
1797
1813
  height: "360px",
1798
1814
  name: "schemaJson",
1799
- onChange: ur,
1815
+ onChange: pr,
1800
1816
  placeholder: "輸入 Form Schema JSON",
1801
1817
  value: pe
1802
1818
  })),
1803
- ei("UI Schema", "uiSchemaJson", /* @__PURE__ */ _(it, {
1819
+ ii("UI Schema", "uiSchemaJson", /* @__PURE__ */ _(at, {
1804
1820
  height: "240px",
1805
1821
  name: "uiSchemaJson",
1806
- onChange: dr,
1822
+ onChange: mr,
1807
1823
  placeholder: "輸入 UI Schema JSON",
1808
- value: Ye
1824
+ value: Je
1809
1825
  })),
1810
- rt ? /* @__PURE__ */ _(h, {
1826
+ Qe ? /* @__PURE__ */ _(h, {
1811
1827
  color: "text-error",
1812
- style: Lt,
1828
+ style: Rt,
1813
1829
  variant: "body",
1814
- children: rt
1830
+ children: Qe
1815
1831
  }) : null
1816
1832
  ]
1817
1833
  })]
1818
1834
  });
1819
1835
  }
1820
- function ei(t, n, r) {
1836
+ function ii(t, n, r) {
1821
1837
  return /* @__PURE__ */ _("div", {
1822
- style: Ft,
1838
+ style: It,
1823
1839
  children: /* @__PURE__ */ _("div", {
1824
- style: It,
1840
+ style: Lt,
1825
1841
  children: /* @__PURE__ */ _(e, {
1826
1842
  label: t,
1827
1843
  name: n,
@@ -1831,29 +1847,29 @@ function mn({ onChange: le, value: y }) {
1831
1847
  });
1832
1848
  }
1833
1849
  }
1834
- function hn(e) {
1835
- return at.find((t) => t.type === e)?.label ?? e;
1850
+ function _n(e) {
1851
+ return ot.find((t) => t.type === e)?.label ?? e;
1836
1852
  }
1837
- function gn(e) {
1853
+ function vn(e) {
1838
1854
  return `${e.key}@${e.version}`;
1839
1855
  }
1840
- function _n(e) {
1856
+ function yn(e) {
1841
1857
  return [
1842
1858
  e.supportsSearch ? `可輸入關鍵字搜尋${e.minimumSearchLength > 1 ? `(至少 ${e.minimumSearchLength} 字)` : ""}` : "不支援搜尋",
1843
1859
  e.paginationMode === "CURSOR" ? `捲動載入更多(每次 ${e.pageSize} 筆)` : `一次載入完整清單(最多 ${e.maximumResultCount} 筆)`,
1844
1860
  e.revalidationPolicy === "ALWAYS" ? "退回重送時一律重新確認" : "值與條件未變時沿用上次結果"
1845
1861
  ];
1846
1862
  }
1847
- function vn(e) {
1863
+ function bn(e) {
1848
1864
  return {
1849
- id: gn(e),
1865
+ id: vn(e),
1850
1866
  name: e.label
1851
1867
  };
1852
1868
  }
1853
- function yn(e) {
1854
- return e ? e.from.kind === "FIELD" ? e.from.fieldKey : e.from.kind === "ROW_FIELD" ? `${sn}${e.from.columnKey}` : on : cn;
1869
+ function xn(e) {
1870
+ return e ? e.from.kind === "FIELD" ? e.from.fieldKey : e.from.kind === "ROW_FIELD" ? `${ln}${e.from.columnKey}` : cn : un;
1855
1871
  }
1856
- function L(e) {
1872
+ function z(e) {
1857
1873
  switch (e) {
1858
1874
  case "BOOLEAN": return !1;
1859
1875
  case "NUMBER": return 0;
@@ -1862,18 +1878,18 @@ function L(e) {
1862
1878
  default: return "";
1863
1879
  }
1864
1880
  }
1865
- function bn(e, t) {
1881
+ function Sn(e, t) {
1866
1882
  let n = e?.from.kind === "CONSTANT" ? e.from.value : "";
1867
1883
  return t === "NUMBER" ? typeof n == "number" ? String(n) : "" : typeof n == "string" ? n : "";
1868
1884
  }
1869
- function xn(e, t, n) {
1870
- return !n || n === cn ? null : n === on ? {
1885
+ function Cn(e, t, n) {
1886
+ return !n || n === un ? null : n === cn ? {
1871
1887
  from: {
1872
1888
  kind: "CONSTANT",
1873
- value: L(t)
1889
+ value: z(t)
1874
1890
  },
1875
1891
  parameter: e
1876
- } : n.startsWith(sn) ? {
1892
+ } : n.startsWith(ln) ? {
1877
1893
  from: {
1878
1894
  columnKey: n.slice(14),
1879
1895
  kind: "ROW_FIELD"
@@ -1887,24 +1903,60 @@ function xn(e, t, n) {
1887
1903
  parameter: e
1888
1904
  };
1889
1905
  }
1890
- function Sn(e) {
1906
+ function wn(e) {
1891
1907
  return e.kind === "remove-field" ? "確認移除 dependency 欄位" : e.kind === "remove-column" ? "確認移除表格欄" : e.kind === "replace-column" ? "確認變更欄型別" : "確認變更選擇模式";
1892
1908
  }
1893
- var R = [{
1909
+ var B = [{
1894
1910
  label: "選項 A",
1895
1911
  value: "option_a"
1896
1912
  }, {
1897
1913
  label: "選項 B",
1898
1914
  value: "option_b"
1899
1915
  }];
1900
- function Cn(e) {
1916
+ function Tn(e) {
1901
1917
  let t = [];
1902
- return e.defaultValue !== void 0 && t.push("預設值"), e.type === "text" && (typeof e.minLength == "number" || typeof e.maxLength == "number") && t.push("長度限制"), (e.type === "number" || e.type === "money") && (typeof e.minimum == "number" || typeof e.maximum == "number") && t.push("數值範圍"), O(e) ? t.push("選項來源設定") : Ye(e) && !z(e.options) && t.push(`${e.options.length} 個選項`), (e.type === "select" || e.type === "autocomplete") && e.mode === "multiple" && t.push("選擇模式"), t;
1918
+ return e.defaultValue !== void 0 && t.push("預設值"), e.type === "text" && (typeof e.minLength == "number" || typeof e.maxLength == "number") && t.push("長度限制"), e.type === "text" && e.pattern && t.push("格式"), (e.type === "number" || e.type === "money") && (typeof e.minimum == "number" || typeof e.maximum == "number") && t.push("數值範圍"), k(e) ? t.push("選項來源設定") : Qe(e) && !En(e.options) && t.push(`${e.options.length} 個選項`), (e.type === "select" || e.type === "autocomplete") && e.mode === "multiple" && t.push("選擇模式"), t;
1903
1919
  }
1904
- function z(e) {
1905
- return e.length === R.length && e.every((e, t) => e.label === R[t]?.label && e.value === R[t]?.value);
1920
+ function En(e) {
1921
+ return e.length === B.length && e.every((e, t) => e.label === B[t]?.label && e.value === B[t]?.value);
1906
1922
  }
1907
- function wn(e, t) {
1923
+ function Dn(e, t) {
1924
+ return t ? {
1925
+ ...e,
1926
+ pattern: t
1927
+ } : Object.fromEntries(Object.entries(e).filter(([e]) => e !== "pattern" && e !== "patternErrorMessage"));
1928
+ }
1929
+ function On(e, t) {
1930
+ return t ? {
1931
+ ...e,
1932
+ patternErrorMessage: t
1933
+ } : Object.fromEntries(Object.entries(e).filter(([e]) => e !== "patternErrorMessage"));
1934
+ }
1935
+ function kn(e) {
1936
+ return e && !e.trim() ? {
1937
+ severity: "error",
1938
+ text: "格式不能只有空白,儲存時會被拒絕。"
1939
+ } : e && e.length > O ? {
1940
+ severity: "error",
1941
+ text: `格式最多 ${O} 個字元,儲存時會被拒絕。`
1942
+ } : e && !Ye(e) ? {
1943
+ severity: "error",
1944
+ text: "這不是有效的正規表示式,儲存時會被拒絕。格式以 u 模式檢查,多餘的跳脫(例如在方括號 [ ] 外寫 \\-)也算錯誤。"
1945
+ } : e && Xe(e) ? {
1946
+ severity: "error",
1947
+ text: "格式裡的括號群組後面不能接重複次數(例如 (ab)+、(\\w|\\d)*、(ab){2}),填寫的內容可能讓系統卡住,儲存時會被拒絕。請把重複的部分直接寫出來,或改用 [ ] 字元集合加次數。"
1948
+ } : {
1949
+ severity: "info",
1950
+ text: "填寫的內容要整段符合格式才能送出;留空表示不檢查格式。"
1951
+ };
1952
+ }
1953
+ function An(e) {
1954
+ return e && e.length > Je ? {
1955
+ severity: "error",
1956
+ text: `錯誤訊息最多 ${Je} 個字元,儲存時會被拒絕。`
1957
+ } : void 0;
1958
+ }
1959
+ function jn(e, t) {
1908
1960
  let n = {
1909
1961
  fieldKey: e.fieldKey,
1910
1962
  label: e.label,
@@ -1915,59 +1967,59 @@ function wn(e, t) {
1915
1967
  return t === "select" || t === "autocomplete" ? {
1916
1968
  ...n,
1917
1969
  mode: "single",
1918
- options: [...R],
1970
+ options: [...B],
1919
1971
  type: t
1920
1972
  } : {
1921
1973
  ...n,
1922
1974
  type: t
1923
1975
  };
1924
1976
  }
1925
- function Tn(e, t) {
1977
+ function Mn(e, t) {
1926
1978
  return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
1927
1979
  }
1928
- function En(e) {
1980
+ function Nn(e) {
1929
1981
  return !!(e.visibleWhen || e.requiredWhen || e.readonlyWhen);
1930
1982
  }
1931
- function Dn(e) {
1983
+ function Pn(e) {
1932
1984
  return {
1933
1985
  id: e.fieldKey,
1934
1986
  name: e.label
1935
1987
  };
1936
1988
  }
1937
- function On(e) {
1989
+ function Fn(e) {
1938
1990
  return e.type === "text" || e.type === "textarea";
1939
1991
  }
1940
- function kn(e) {
1992
+ function In(e) {
1941
1993
  return typeof e == "string" ? e : "";
1942
1994
  }
1943
- function An(e) {
1995
+ function Ln(e) {
1944
1996
  let t = e.split(/[\n,]/u).map((e) => e.trim()).filter(Boolean);
1945
1997
  return t.length ? t : void 0;
1946
1998
  }
1947
- function jn(e) {
1999
+ function Rn(e) {
1948
2000
  return e?.join("\n") ?? "";
1949
2001
  }
1950
- function B(e) {
2002
+ function V(e) {
1951
2003
  return JSON.stringify(e, null, 2);
1952
2004
  }
1953
- function Mn(e, t, n) {
2005
+ function zn(e, t, n) {
1954
2006
  return e.map((e, r) => r === t ? {
1955
2007
  ...e,
1956
2008
  ...n
1957
2009
  } : e);
1958
2010
  }
1959
- function Nn(e) {
2011
+ function Bn(e) {
1960
2012
  let t = e.length + 1;
1961
2013
  return {
1962
2014
  label: `選項 ${t}`,
1963
- value: V(e, t)
2015
+ value: H(e, t)
1964
2016
  };
1965
2017
  }
1966
- function V(e, t) {
2018
+ function H(e, t) {
1967
2019
  let n = `option_${t}`;
1968
- return e.some((e) => e.value === n) ? V(e, t + 1) : n;
2020
+ return e.some((e) => e.value === n) ? H(e, t + 1) : n;
1969
2021
  }
1970
- function Pn(e, t, n) {
2022
+ function Vn(e, t, n) {
1971
2023
  let r = e[t];
1972
2024
  if (!r || t === n) return [...e];
1973
2025
  let i = e.filter((e, n) => n !== t);
@@ -1978,6 +2030,6 @@ function Pn(e, t, n) {
1978
2030
  ];
1979
2031
  }
1980
2032
  //#endregion
1981
- export { mn as t };
2033
+ export { gn as t };
1982
2034
 
1983
- //# sourceMappingURL=FormBuilderView-ClLnQ1e_.js.map
2035
+ //# sourceMappingURL=FormBuilderView-BVKY1j_0.js.map