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