@rytass/bpm-core-react 0.22.0 → 0.24.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 (166) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +1 -0
  3. package/dist/chunks/FormBuilderView-Bg9ftYz-.cjs +4 -0
  4. package/dist/chunks/FormBuilderView-Bg9ftYz-.cjs.map +1 -0
  5. package/dist/chunks/{FormBuilderView-DbfbLZCI.js → FormBuilderView-CBvdcg_t.js} +675 -614
  6. package/dist/chunks/FormBuilderView-CBvdcg_t.js.map +1 -0
  7. package/dist/chunks/FormRendererView-D-p6GDQB.cjs +6 -0
  8. package/dist/chunks/FormRendererView-D-p6GDQB.cjs.map +1 -0
  9. package/dist/chunks/FormRendererView-DHXmekC3.js +1319 -0
  10. package/dist/chunks/FormRendererView-DHXmekC3.js.map +1 -0
  11. package/dist/chunks/{approval-instance-list-page-Cv5I1YPX.cjs → approval-instance-list-page-BqkG9jiR.cjs} +2 -2
  12. package/dist/chunks/{approval-instance-list-page-Cv5I1YPX.cjs.map → approval-instance-list-page-BqkG9jiR.cjs.map} +1 -1
  13. package/dist/chunks/{approval-instance-list-page-BI5fIXc-.js → approval-instance-list-page-CsSpIN4C.js} +2 -2
  14. package/dist/chunks/{approval-instance-list-page-BI5fIXc-.js.map → approval-instance-list-page-CsSpIN4C.js.map} +1 -1
  15. package/dist/chunks/compose-B43jtdyL.cjs +2 -0
  16. package/dist/chunks/compose-B43jtdyL.cjs.map +1 -0
  17. package/dist/chunks/{compose-U1zs3Yof.js → compose-C7yS6bJm.js} +162 -148
  18. package/dist/chunks/compose-C7yS6bJm.js.map +1 -0
  19. package/dist/chunks/{dashboard-page-BoqNhjT_.js → dashboard-page-DBJCsPya.js} +2 -2
  20. package/dist/chunks/{dashboard-page-BoqNhjT_.js.map → dashboard-page-DBJCsPya.js.map} +1 -1
  21. package/dist/chunks/{dashboard-page-D7YJ3udk.cjs → dashboard-page-lqlLELKs.cjs} +2 -2
  22. package/dist/chunks/{dashboard-page-D7YJ3udk.cjs.map → dashboard-page-lqlLELKs.cjs.map} +1 -1
  23. package/dist/chunks/{designer-DPG7R_WP.js → designer-B9Ut4xze.js} +1786 -1463
  24. package/dist/chunks/designer-B9Ut4xze.js.map +1 -0
  25. package/dist/chunks/designer-eXw7R9ug.cjs +69 -0
  26. package/dist/chunks/designer-eXw7R9ug.cjs.map +1 -0
  27. package/dist/chunks/{detail-CHZDNNM6.js → detail-BB_uYaoM.js} +904 -896
  28. package/dist/chunks/detail-BB_uYaoM.js.map +1 -0
  29. package/dist/chunks/detail-DN8pEzUJ.cjs +5 -0
  30. package/dist/chunks/detail-DN8pEzUJ.cjs.map +1 -0
  31. package/dist/chunks/instance-error-message-BKt07-Bo.js +270 -0
  32. package/dist/chunks/instance-error-message-BKt07-Bo.js.map +1 -0
  33. package/dist/chunks/instance-error-message-BL_X7Af8.cjs +2 -0
  34. package/dist/chunks/instance-error-message-BL_X7Af8.cjs.map +1 -0
  35. package/dist/chunks/member-profile-resolution-CJlgVdTR.js +44 -0
  36. package/dist/chunks/member-profile-resolution-CJlgVdTR.js.map +1 -0
  37. package/dist/chunks/member-profile-resolution-DiH-P-Vh.cjs +2 -0
  38. package/dist/chunks/member-profile-resolution-DiH-P-Vh.cjs.map +1 -0
  39. package/dist/chunks/{providers-CQWekD7_.js → providers-D35lBOTd.js} +2 -2
  40. package/dist/chunks/{providers-CQWekD7_.js.map → providers-D35lBOTd.js.map} +1 -1
  41. package/dist/chunks/{providers-VUOh6i0i.cjs → providers-Dz4Wqxr6.cjs} +2 -2
  42. package/dist/chunks/{providers-VUOh6i0i.cjs.map → providers-Dz4Wqxr6.cjs.map} +1 -1
  43. package/dist/chunks/{routes-config-C1j_vFKo.cjs → routes-config-BWjZDAU3.cjs} +2 -2
  44. package/dist/chunks/{routes-config-C1j_vFKo.cjs.map → routes-config-BWjZDAU3.cjs.map} +1 -1
  45. package/dist/chunks/{routes-config-BcNaWJWJ.js → routes-config-DjEOE9eP.js} +3 -2
  46. package/dist/chunks/{routes-config-BcNaWJWJ.js.map → routes-config-DjEOE9eP.js.map} +1 -1
  47. package/dist/chunks/users-C_Dtw_sR.cjs +2 -0
  48. package/dist/chunks/users-C_Dtw_sR.cjs.map +1 -0
  49. package/dist/chunks/users-wgM3TqU3.js +513 -0
  50. package/dist/chunks/users-wgM3TqU3.js.map +1 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +4 -4
  53. package/dist/lib/routes-config.d.cts +2 -0
  54. package/dist/lib/routes-config.d.ts +2 -0
  55. package/dist/next/index.cjs +1 -1
  56. package/dist/next/index.js +2 -2
  57. package/dist/pages/admin/stuck-instances/index.cjs +2 -0
  58. package/dist/pages/admin/stuck-instances/index.cjs.map +1 -0
  59. package/dist/pages/admin/stuck-instances/index.d.cts +4 -0
  60. package/dist/pages/admin/stuck-instances/index.d.ts +4 -0
  61. package/dist/pages/admin/stuck-instances/index.js +13 -0
  62. package/dist/pages/admin/stuck-instances/index.js.map +1 -0
  63. package/dist/pages/admin/users/index.cjs +1 -1
  64. package/dist/pages/admin/users/index.js +1 -1
  65. package/dist/pages/instances/detail/index.cjs +1 -1
  66. package/dist/pages/instances/detail/index.js +1 -1
  67. package/dist/pages/templates/compose/index.cjs +1 -1
  68. package/dist/pages/templates/compose/index.js +1 -1
  69. package/dist/pages/templates/designer/index.cjs +1 -1
  70. package/dist/pages/templates/designer/index.js +1 -1
  71. package/dist/views/admin/index.cjs +1 -1
  72. package/dist/views/admin/index.d.cts +1 -0
  73. package/dist/views/admin/index.d.ts +1 -0
  74. package/dist/views/admin/index.js +3 -2
  75. package/dist/views/admin/stuck-instances/AdminStuckInstancesView.d.cts +10 -0
  76. package/dist/views/admin/stuck-instances/AdminStuckInstancesView.d.ts +10 -0
  77. package/dist/views/admin/stuck-instances/StuckInstanceCancelModal.d.cts +14 -0
  78. package/dist/views/admin/stuck-instances/StuckInstanceCancelModal.d.ts +14 -0
  79. package/dist/views/admin/stuck-instances/index.cjs +2 -0
  80. package/dist/views/admin/stuck-instances/index.cjs.map +1 -0
  81. package/dist/views/admin/stuck-instances/index.d.cts +2 -0
  82. package/dist/views/admin/stuck-instances/index.d.ts +2 -0
  83. package/dist/views/admin/stuck-instances/index.js +237 -0
  84. package/dist/views/admin/stuck-instances/index.js.map +1 -0
  85. package/dist/views/admin/users/index.cjs +1 -1
  86. package/dist/views/admin/users/index.js +1 -1
  87. package/dist/views/cc/index.cjs +1 -1
  88. package/dist/views/cc/index.js +1 -1
  89. package/dist/views/dashboard/index.cjs +1 -1
  90. package/dist/views/dashboard/index.js +1 -1
  91. package/dist/views/forms/builder/index.cjs +1 -1
  92. package/dist/views/forms/builder/index.js +1 -1
  93. package/dist/views/forms/renderer/FormRendererView.d.cts +26 -1
  94. package/dist/views/forms/renderer/FormRendererView.d.ts +26 -1
  95. package/dist/views/forms/renderer/index.cjs +1 -1
  96. package/dist/views/forms/renderer/index.js +1 -1
  97. package/dist/views/inbox/index.cjs +1 -1
  98. package/dist/views/inbox/index.js +1 -1
  99. package/dist/views/instances/approver-filled-form.d.cts +56 -20
  100. package/dist/views/instances/approver-filled-form.d.ts +56 -20
  101. package/dist/views/instances/detail/index.cjs +1 -1
  102. package/dist/views/instances/detail/index.js +1 -1
  103. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +7 -0
  104. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +7 -0
  105. package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +1 -1
  106. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +1 -1
  107. package/dist/views/instances/new/index.cjs +1 -1
  108. package/dist/views/instances/new/index.js +5 -5
  109. package/dist/views/instances/new/index.js.map +1 -1
  110. package/dist/views/search/index.cjs +1 -1
  111. package/dist/views/search/index.js +1 -1
  112. package/dist/views/sent/index.cjs +1 -1
  113. package/dist/views/sent/index.js +1 -1
  114. package/dist/views/templates/compose/index.cjs +1 -1
  115. package/dist/views/templates/compose/index.js +1 -1
  116. package/dist/views/templates/compose/steps/ComposeReviewStep.d.cts +3 -1
  117. package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +3 -1
  118. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.cts +4 -1
  119. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +4 -1
  120. package/dist/views/templates/compose/use-template-compose-wizard.d.cts +3 -1
  121. package/dist/views/templates/compose/use-template-compose-wizard.d.ts +3 -1
  122. package/dist/views/templates/designer/TemplateDesignerView.d.cts +10 -1
  123. package/dist/views/templates/designer/TemplateDesignerView.d.ts +10 -1
  124. package/dist/views/templates/designer/approver-resolver-model.d.cts +31 -0
  125. package/dist/views/templates/designer/approver-resolver-model.d.ts +31 -0
  126. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +3 -1
  127. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +3 -1
  128. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +3 -2
  129. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +3 -2
  130. package/dist/views/templates/designer/index.cjs +1 -1
  131. package/dist/views/templates/designer/index.js +1 -1
  132. package/dist/views/templates/designer/launch-mode.d.cts +19 -0
  133. package/dist/views/templates/designer/launch-mode.d.ts +19 -0
  134. package/dist/views/templates/designer/node-actor-resolver-options.d.cts +30 -3
  135. package/dist/views/templates/designer/node-actor-resolver-options.d.ts +30 -3
  136. package/dist/views/templates/designer/publish-default-value-check.d.cts +36 -0
  137. package/dist/views/templates/designer/publish-default-value-check.d.ts +36 -0
  138. package/dist/views/templates/index.cjs +1 -1
  139. package/dist/views/templates/index.js +1 -1
  140. package/dist/views/templates/versions/index.cjs +1 -1
  141. package/dist/views/templates/versions/index.js +1 -1
  142. package/package.json +23 -3
  143. package/dist/chunks/FormBuilderView-Bok4Y59D.cjs +0 -4
  144. package/dist/chunks/FormBuilderView-Bok4Y59D.cjs.map +0 -1
  145. package/dist/chunks/FormBuilderView-DbfbLZCI.js.map +0 -1
  146. package/dist/chunks/FormRendererView-CAyPXhPq.js +0 -1351
  147. package/dist/chunks/FormRendererView-CAyPXhPq.js.map +0 -1
  148. package/dist/chunks/FormRendererView-iLlHFIUR.cjs +0 -6
  149. package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +0 -1
  150. package/dist/chunks/compose-DP1N4twA.cjs +0 -2
  151. package/dist/chunks/compose-DP1N4twA.cjs.map +0 -1
  152. package/dist/chunks/compose-U1zs3Yof.js.map +0 -1
  153. package/dist/chunks/designer-CWL-dCQ_.cjs +0 -69
  154. package/dist/chunks/designer-CWL-dCQ_.cjs.map +0 -1
  155. package/dist/chunks/designer-DPG7R_WP.js.map +0 -1
  156. package/dist/chunks/detail-BUfsSal0.cjs +0 -5
  157. package/dist/chunks/detail-BUfsSal0.cjs.map +0 -1
  158. package/dist/chunks/detail-CHZDNNM6.js.map +0 -1
  159. package/dist/chunks/instance-error-message-BEM4O_Kj.js +0 -208
  160. package/dist/chunks/instance-error-message-BEM4O_Kj.js.map +0 -1
  161. package/dist/chunks/instance-error-message-BpCLCOjp.cjs +0 -2
  162. package/dist/chunks/instance-error-message-BpCLCOjp.cjs.map +0 -1
  163. package/dist/chunks/users-BBtiZ9QQ.js +0 -486
  164. package/dist/chunks/users-BBtiZ9QQ.js.map +0 -1
  165. package/dist/chunks/users-EqSzDhuj.cjs +0 -2
  166. package/dist/chunks/users-EqSzDhuj.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { t as e } from "./bpm-form-field-9B-Det0u.js";
3
- import { t } from "./FormRendererView-CAyPXhPq.js";
3
+ import { t } from "./FormRendererView-DHXmekC3.js";
4
4
  import { useEffect as n, useMemo as r, useState as i } from "react";
5
5
  import { Accordion as a, Badge as o, BaseCard as s, Button as c, DatePicker as l, DateTimePicker as u, Icon as d, InlineMessage as ee, Input as f, Modal as te, Section as ne, SectionGroup as re, Select as p, Tab as ie, TabItem as ae, Table as oe, Tag as se, Textarea as ce, 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";
@@ -8,15 +8,15 @@ import { listFilterableFieldIssues as le } from "@rytass/bpm-core-client/workflo
8
8
  import { readFilterableFieldPaths as ue } from "@rytass/bpm-core-shared";
9
9
  import { FormFieldLayout as de } from "@mezzanine-ui/core/form";
10
10
  import { parseFormBindingExpressionLintLine as fe, readFormBindingExpressionLintMessage as pe } from "@rytass/bpm-core-client/template";
11
- import { buildConditionExpression as me, buildFormRendererValues as he, clampOptionalNumber as ge, createFieldDefinition as _e, createTableColumnDefinition as ve, formatDatePickerValue as ye, formatDateTimePickerValue as be, isDateFieldDefinition as xe, isFormDataSourceDescriptorCompatible as Se, isNumberFieldDefinition as Ce, isSelectFieldDefinition as we, lintFormSchema as Te, listFormDataSources as Ee, parseConditionRule as De, parseOptionalNumberInput as Oe, readCompatibleFormDataSourceBindingFields as ke, readCompatibleFormDataSourceDescriptors as Ae, readCompatibleFormTableColumnBindingFields as je, readConditionOperatorOption as Me, readConditionOperatorOptions as Ne, readDatePickerValue as Pe, readDefaultConditionOperator as Fe, readDefaultConditionValue as Ie, readFieldOptionAsSelectOption as Le, readFormDataSourceBinding as y, readFormDataSourceBindingExpression as Re, readFormDataSourceBindingValue as ze, readFormDataSourceBindingValueKind as Be, readFormDataSourceFieldDependencyKeys as Ve, readFormSchemaLintMessage as He, readFormTableRowBounds as Ue, readSelectOption as b, renameFormDataSourceFieldBindings as We, renameFormTableColumnBindings as Ge, upsertFormDataSourceFieldBinding as Ke } from "@rytass/bpm-core-client/form";
12
- import { AlignLeftIcon as qe, CalendarIcon as Je, CheckedIcon as Ye, CheckedOutlineIcon as Xe, CurrencyDollarIcon as Ze, DotDragVerticalIcon as Qe, DotGridIcon as $e, FileAttachmentIcon as x, FileIcon as S, FolderIcon as C, ListIcon as w, PlusIcon as et, TrashIcon as tt, UserIcon as nt } from "@mezzanine-ui/icons";
13
- import { FORM_TABLE_MAX_ROWS as rt, TEXT_FIELD_PATTERN_ERROR_MESSAGE_MAX_LENGTH as T, TEXT_FIELD_PATTERN_MAX_LENGTH as it, compileTextFieldPattern as E, hasRepeatedTextFieldPatternGroup as at, isFormDataSourceFieldDefinition as D, isFormOptionFieldDefinition as ot, isFormStaticOptionFieldDefinition as st, isMemberFieldDefinition as ct, isOrgUnitFieldDefinition as lt, isTableColumnFieldType as ut, isTableFieldDefinition as O, readFormFieldSelectionMode as dt } from "@rytass/bpm-core-shared/form";
14
- import { DragDropContext as ft, Draggable as pt, Droppable as mt } from "@hello-pangea/dnd";
15
- import ht from "next/dynamic";
16
- import { json as k } from "@codemirror/lang-json";
17
- import { EditorView as A } from "@codemirror/view";
11
+ import { buildConditionExpression as y, buildFormRendererValues as me, clampOptionalNumber as he, createFieldDefinition as ge, createTableColumnDefinition as _e, formatDatePickerValue as ve, formatDateTimePickerValue as ye, isDateFieldDefinition as be, isFormDataSourceDescriptorCompatible as xe, isNumberFieldDefinition as Se, isSelectFieldDefinition as Ce, lintFormSchema as we, listFormDataSources as Te, parseConditionRule as Ee, parseOptionalNumberInput as De, readCompatibleFormDataSourceBindingFields as Oe, readCompatibleFormDataSourceDescriptors as ke, readCompatibleFormTableColumnBindingFields as Ae, readConditionOperatorOption as je, readConditionOperatorOptions as Me, readDatePickerValue as Ne, readDefaultConditionOperator as Pe, readDefaultConditionValue as Fe, readFieldOptionAsSelectOption as Ie, readFormDataSourceBinding as b, readFormDataSourceBindingExpression as Le, readFormDataSourceBindingValue as Re, readFormDataSourceBindingValueKind as ze, readFormDataSourceFieldDependencyKeys as Be, readFormSchemaLintMessage as Ve, readFormTableRowBounds as He, readSelectOption as x, renameFormDataSourceFieldBindings as Ue, renameFormTableColumnBindings as We, upsertFormDataSourceFieldBinding as Ge } from "@rytass/bpm-core-client/form";
12
+ import { AlignLeftIcon as S, CalendarIcon as Ke, CheckedIcon as qe, CheckedOutlineIcon as Je, CurrencyDollarIcon as C, DotDragVerticalIcon as Ye, DotGridIcon as Xe, FileAttachmentIcon as w, FileIcon as T, FolderIcon as E, ListIcon as D, PlusIcon as Ze, TrashIcon as Qe, UserIcon as $e } from "@mezzanine-ui/icons";
13
+ import { FORM_TABLE_MAX_ROWS as et, TEXT_FIELD_PATTERN_ERROR_MESSAGE_MAX_LENGTH as O, TEXT_FIELD_PATTERN_MAX_LENGTH as tt, compileTextFieldPattern as k, hasRepeatedTextFieldPatternGroup as nt, isFormDataSourceFieldDefinition as A, isFormOptionFieldDefinition as rt, isFormStaticOptionFieldDefinition as it, isMemberFieldDefinition as at, isOrgUnitFieldDefinition as ot, isTableColumnFieldType as st, isTableFieldDefinition as j, readFormFieldSelectionMode as ct } from "@rytass/bpm-core-shared/form";
14
+ import { DragDropContext as lt, Draggable as ut, Droppable as dt } from "@hello-pangea/dnd";
15
+ import ft from "next/dynamic";
16
+ import { json as M } from "@codemirror/lang-json";
17
+ import { EditorView as N } from "@codemirror/view";
18
18
  // src/views/forms/builder/json-code-editor.tsx
19
- var j = {
19
+ var pt = {
20
20
  alignItems: "center",
21
21
  border: "1px solid var(--mzn-color-border-neutral)",
22
22
  borderRadius: 4,
@@ -25,10 +25,10 @@ var j = {
25
25
  minHeight: 160,
26
26
  padding: 12,
27
27
  width: "100%"
28
- }, gt = [
29
- k(),
30
- A.lineWrapping,
31
- A.theme({
28
+ }, mt = [
29
+ M(),
30
+ N.lineWrapping,
31
+ N.theme({
32
32
  "&": {
33
33
  border: "1px solid var(--mzn-color-border-neutral)",
34
34
  borderRadius: "4px",
@@ -44,15 +44,15 @@ var j = {
44
44
  ".cm-gutters": { borderRight: "1px solid var(--mzn-color-border-neutral)" },
45
45
  ".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace" }
46
46
  })
47
- ], M = ht(() => import("@uiw/react-codemirror"), {
47
+ ], ht = ft(() => import("@uiw/react-codemirror"), {
48
48
  loading: () => /* @__PURE__ */ _("div", {
49
- style: j,
49
+ style: pt,
50
50
  children: "載入 JSON 編輯器"
51
51
  }),
52
52
  ssr: !1
53
53
  });
54
- function _t({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i, value: a }) {
55
- return /* @__PURE__ */ _(M, {
54
+ function gt({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i, value: a }) {
55
+ return /* @__PURE__ */ _(ht, {
56
56
  "aria-label": n,
57
57
  basicSetup: {
58
58
  autocompletion: !0,
@@ -66,7 +66,7 @@ function _t({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i,
66
66
  syntaxHighlighting: !0
67
67
  },
68
68
  editable: !e,
69
- extensions: [...gt],
69
+ extensions: [...mt],
70
70
  height: t,
71
71
  indentWithTab: !1,
72
72
  onChange: r,
@@ -78,157 +78,157 @@ function _t({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i,
78
78
  });
79
79
  }
80
80
  // src/views/forms/builder/FormBuilderView.tsx
81
- var vt = [
81
+ var P = "選項來源改為依賴其他欄位的值後,目前的預設值會被清除,之後由使用者在表單中自行選擇。", _t = [
82
82
  {
83
83
  description: "單行文字、姓名、編號",
84
- icon: qe,
84
+ icon: S,
85
85
  label: "文字",
86
86
  type: "text"
87
87
  },
88
88
  {
89
89
  description: "多行補充內容",
90
- icon: S,
90
+ icon: T,
91
91
  label: "長文字",
92
92
  type: "textarea"
93
93
  },
94
94
  {
95
95
  description: "金額、數量、分數",
96
- icon: Ze,
96
+ icon: C,
97
97
  label: "數字",
98
98
  type: "number"
99
99
  },
100
100
  {
101
101
  description: "金額與費用",
102
- icon: Ze,
102
+ icon: C,
103
103
  label: "金額",
104
104
  type: "money"
105
105
  },
106
106
  {
107
107
  description: "日期或到期日",
108
- icon: Je,
108
+ icon: Ke,
109
109
  label: "日期",
110
110
  type: "date"
111
111
  },
112
112
  {
113
113
  description: "日期與時間",
114
- icon: Je,
114
+ icon: Ke,
115
115
  label: "日期時間",
116
116
  type: "datetime"
117
117
  },
118
118
  {
119
119
  description: "是 / 否狀態",
120
- icon: Ye,
120
+ icon: qe,
121
121
  label: "開關",
122
122
  type: "boolean"
123
123
  },
124
124
  {
125
125
  description: "固定選項擇一",
126
- icon: w,
126
+ icon: D,
127
127
  label: "下拉選單",
128
128
  type: "select"
129
129
  },
130
130
  {
131
131
  description: "可搜尋的固定選項",
132
- icon: w,
132
+ icon: D,
133
133
  label: "自動完成",
134
134
  type: "autocomplete"
135
135
  },
136
136
  {
137
137
  description: "固定選項單選",
138
- icon: $e,
138
+ icon: Xe,
139
139
  label: "單選",
140
140
  type: "radio"
141
141
  },
142
142
  {
143
143
  description: "固定選項複選",
144
- icon: Xe,
144
+ icon: Je,
145
145
  label: "複選",
146
146
  type: "checkbox"
147
147
  },
148
148
  {
149
149
  description: "附件或佐證資料",
150
- icon: x,
150
+ icon: w,
151
151
  label: "附件",
152
152
  type: "file_upload"
153
153
  },
154
154
  {
155
155
  description: "從成員名單挑選一或多位人員",
156
- icon: nt,
156
+ icon: $e,
157
157
  label: "人員選擇",
158
158
  type: "member"
159
159
  },
160
160
  {
161
161
  description: "從組織圖挑選一個組織",
162
- icon: C,
162
+ icon: E,
163
163
  label: "組織選擇",
164
164
  type: "org_unit"
165
165
  },
166
166
  {
167
167
  description: "多列多欄明細",
168
- icon: $e,
168
+ icon: Xe,
169
169
  label: "表格",
170
170
  type: "table"
171
171
  }
172
- ], N = vt.filter((e) => ut(e.type)).map((e) => ({
172
+ ], F = _t.filter((e) => st(e.type)).map((e) => ({
173
173
  id: e.type,
174
174
  name: e.label
175
- })), yt = {
175
+ })), vt = {
176
176
  alignItems: "start",
177
177
  display: "flex",
178
178
  flexWrap: "wrap",
179
179
  gap: 16
180
- }, bt = {
180
+ }, yt = {
181
181
  flex: "0.55 1 300px",
182
182
  minWidth: 0
183
- }, xt = {
183
+ }, bt = {
184
184
  flex: "1.45 1 720px",
185
185
  minWidth: 620,
186
186
  paddingBottom: 260
187
- }, St = 240, Ct = {
187
+ }, xt = 240, St = {
188
188
  BOOLEAN: "開關",
189
189
  NUMBER: "數字",
190
190
  STRING: "文字或選單",
191
191
  STRING_ARRAY: "多選"
192
- }, wt = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings missing required parameter: (.+)$/u, Tt = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings unknown parameter: (.+)$/u, P = {
192
+ }, Ct = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings missing required parameter: (.+)$/u, wt = /^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings unknown parameter: (.+)$/u, I = {
193
193
  display: "grid",
194
194
  gap: 12
195
- }, Et = {
195
+ }, Tt = {
196
196
  display: "flex",
197
197
  flexWrap: "wrap",
198
198
  gap: 6
199
- }, Dt = {
199
+ }, Et = {
200
200
  flex: "0 0 auto",
201
201
  whiteSpace: "nowrap"
202
- }, Ot = {
202
+ }, Dt = {
203
203
  display: "grid",
204
204
  gap: 8
205
- }, kt = {
205
+ }, Ot = {
206
206
  alignItems: "center",
207
207
  cursor: "grab",
208
208
  display: "flex",
209
209
  gap: 12,
210
210
  touchAction: "none"
211
- }, At = {
211
+ }, kt = {
212
212
  display: "grid",
213
213
  flex: "1 1 auto",
214
214
  gap: 2,
215
215
  minWidth: 0
216
- }, jt = {
216
+ }, At = {
217
217
  alignItems: "center",
218
218
  display: "flex",
219
219
  flex: "0 0 auto",
220
220
  gap: 4
221
- }, Mt = {
221
+ }, jt = {
222
222
  alignItems: "center",
223
223
  display: "flex",
224
224
  gap: 6
225
- }, Nt = {
225
+ }, Mt = {
226
226
  cursor: "pointer",
227
227
  userSelect: "none"
228
- }, Pt = { filter: "drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))" }, Ft = {
228
+ }, Nt = { filter: "drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))" }, Pt = {
229
229
  backgroundColor: "color-mix(in srgb, var(--mzn-color-primary) 8%, var(--mzn-color-bg-surface))",
230
230
  boxShadow: "inset 0 0 0 1px var(--mzn-color-border-primary)"
231
- }, It = {
231
+ }, Ft = {
232
232
  alignItems: "center",
233
233
  border: "1px dashed var(--mzn-color-border-neutral)",
234
234
  borderRadius: 6,
@@ -237,135 +237,135 @@ var vt = [
237
237
  minHeight: 240,
238
238
  padding: 32,
239
239
  textAlign: "center"
240
- }, Lt = {
240
+ }, It = {
241
241
  display: "flex",
242
242
  gap: 8,
243
243
  justifyContent: "center"
244
- }, Rt = {
244
+ }, Lt = {
245
245
  display: "grid",
246
246
  gap: 14
247
- }, zt = {
247
+ }, Rt = {
248
248
  display: "grid",
249
249
  columnGap: 16,
250
250
  gridTemplateColumns: "repeat(auto-fit, minmax(280px, 360px))",
251
251
  justifyContent: "start",
252
252
  maxWidth: 736,
253
253
  rowGap: 8
254
- }, Bt = { gridColumn: "1 / -1" }, Vt = {
254
+ }, zt = { gridColumn: "1 / -1" }, Bt = {
255
255
  alignItems: "center",
256
256
  display: "flex",
257
257
  gap: 8,
258
258
  gridColumn: "1 / -1",
259
259
  justifyContent: "flex-end"
260
- }, F = { gridColumn: "1 / -1" }, Ht = {
260
+ }, L = { gridColumn: "1 / -1" }, Vt = {
261
261
  alignItems: "start",
262
262
  display: "block",
263
263
  width: "100%"
264
- }, Ut = {
265
- ...Ht,
264
+ }, Ht = {
265
+ ...Vt,
266
266
  gridColumn: "1 / -1"
267
- }, Wt = {
267
+ }, Ut = {
268
268
  minWidth: 0,
269
269
  width: "100%"
270
- }, Gt = {
270
+ }, Wt = {
271
271
  minWidth: "100%",
272
272
  width: "100%"
273
- }, Kt = {
273
+ }, Gt = {
274
274
  display: "grid",
275
275
  gap: 14
276
- }, qt = {
276
+ }, Kt = {
277
277
  alignItems: "start",
278
278
  display: "block",
279
279
  width: "100%"
280
- }, Jt = {
280
+ }, qt = {
281
281
  minWidth: 0,
282
282
  width: "100%"
283
- }, Yt = { gridColumn: "2 / -1" }, Xt = {
283
+ }, Jt = { gridColumn: "2 / -1" }, Yt = {
284
284
  display: "grid",
285
285
  gap: 10,
286
286
  width: "100%"
287
- }, Zt = {
287
+ }, Xt = {
288
288
  display: "grid",
289
289
  gap: 8,
290
290
  gridTemplateColumns: "repeat(auto-fit, minmax(160px, 1fr))"
291
- }, Qt = { display: "inline-flex" }, $t = {
291
+ }, Zt = { display: "inline-flex" }, Qt = {
292
292
  display: "grid",
293
293
  gap: 16
294
- }, en = {
294
+ }, $t = {
295
295
  display: "grid",
296
296
  gap: 8
297
- }, tn = {
297
+ }, en = {
298
298
  display: "flex",
299
299
  justifyContent: "flex-end"
300
- }, nn = {
300
+ }, tn = {
301
301
  color: "var(--mzn-color-text-error)",
302
302
  fontSize: "0.72em",
303
303
  lineHeight: 0,
304
304
  marginLeft: 2,
305
305
  verticalAlign: "super"
306
- }, rn = {
306
+ }, nn = {
307
307
  display: "grid",
308
308
  gap: 10,
309
309
  gridColumn: "1 / -1"
310
- }, an = {
310
+ }, rn = {
311
311
  display: "grid",
312
312
  gap: 2
313
- }, on = {
313
+ }, an = {
314
314
  display: "grid",
315
315
  gap: 8
316
- }, sn = {
316
+ }, on = {
317
317
  display: "flex",
318
318
  justifyContent: "flex-start"
319
- }, cn = {
319
+ }, sn = {
320
320
  display: "flex",
321
321
  flexWrap: "wrap",
322
322
  gap: 4
323
- }, ln = {
323
+ }, cn = {
324
324
  backgroundColor: "var(--mzn-color-bg-surface-secondary)",
325
325
  borderRadius: 6,
326
326
  display: "grid",
327
327
  gap: 4,
328
328
  padding: 10
329
- }, un = {
330
- ...zt,
329
+ }, ln = {
330
+ ...Rt,
331
331
  gridTemplateColumns: "minmax(280px, 520px)",
332
332
  padding: "4px 0 8px"
333
- }, dn = {
333
+ }, un = {
334
334
  display: "grid",
335
335
  gap: 8,
336
336
  gridColumn: "1 / -1"
337
- }, fn = {
337
+ }, dn = {
338
338
  alignItems: "center",
339
339
  display: "flex",
340
340
  gap: 12,
341
341
  justifyContent: "space-between"
342
- }, pn = {
342
+ }, fn = {
343
343
  alignItems: "baseline",
344
344
  display: "flex",
345
345
  gap: 2
346
- }, mn = {
346
+ }, pn = {
347
347
  display: "grid",
348
348
  gap: 4
349
349
  };
350
- function hn(e) {
350
+ function mn(e) {
351
351
  e && (e.style.width = "100%");
352
352
  }
353
- var gn = {
353
+ var hn = {
354
354
  fields: [],
355
355
  schemaVersion: 1
356
- }, _n = {
356
+ }, gn = {
357
357
  layout: [],
358
358
  schemaVersion: 1
359
- }, vn = "__STATIC_OPTIONS__", yn = "__CONSTANT__", bn = "__EXPRESSION__", I = "__UNSUPPORTED__", xn = "__ROW_FIELD__:", Sn = "__UNBOUND__", Cn = [{
360
- id: vn,
359
+ }, _n = "__STATIC_OPTIONS__", vn = "__CONSTANT__", yn = "__EXPRESSION__", R = "__UNSUPPORTED__", bn = "__ROW_FIELD__:", xn = "__UNBOUND__", Sn = [{
360
+ id: _n,
361
361
  name: "靜態選項"
362
- }], wn = [{
362
+ }], Cn = [{
363
363
  id: "single",
364
364
  name: "單選"
365
365
  }, {
366
366
  id: "multiple",
367
367
  name: "複選"
368
- }], Tn = [
368
+ }], wn = [
369
369
  {
370
370
  id: "unset",
371
371
  name: "不預設"
@@ -378,13 +378,13 @@ var gn = {
378
378
  id: "false",
379
379
  name: "否"
380
380
  }
381
- ], En = [{
381
+ ], Tn = [{
382
382
  id: "true",
383
383
  name: "是"
384
384
  }, {
385
385
  id: "false",
386
386
  name: "否"
387
- }], Dn = [
387
+ }], En = [
388
388
  {
389
389
  label: "顯示",
390
390
  name: "fieldVisibleWhen",
@@ -403,163 +403,163 @@ var gn = {
403
403
  supportingText: "符合條件時不允許修改這個欄位。",
404
404
  target: "readonlyWhen"
405
405
  }
406
- ], On = { whiteSpace: "pre-line" }, kn = "勾選後,此欄位的 key 與型別在之後的版本不能再改。HIDE/hidden 不是保密手段。";
407
- function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
408
- let Ze = Xe?.schema ?? gn, $e = Xe?.uiSchema ?? _n, [x, S] = i(Ze), [C, w] = i($e), [nt, T] = i(V(Ze)), [it, E] = i(V($e)), [at, st] = i({}), [ht, k] = i(null), [A, j] = i([]), [gt, M] = i(null);
406
+ ], Dn = { whiteSpace: "pre-line" }, On = "勾選後,此欄位的 key 與型別在之後的版本不能再改。HIDE/hidden 不是保密手段。";
407
+ function z({ formDefinitionId: S, onChange: Ke, templateId: qe, value: Je }) {
408
+ let C = Je?.schema ?? hn, Xe = Je?.uiSchema ?? gn, [w, T] = i(C), [E, D] = i(Xe), [$e, O] = i(U(C)), [tt, k] = i(U(Xe)), [nt, it] = i({}), [ft, M] = i(null), [N, pt] = i([]), [mt, ht] = i(null);
409
409
  n(() => {
410
- if (!Ye && !qe || ue(x).length === 0) return j([]), M(null), () => void 0;
410
+ if (!qe && !S || ue(w).length === 0) return pt([]), ht(null), () => void 0;
411
411
  let e = !1, t = setTimeout(() => {
412
412
  le({
413
- formDefinitionId: qe,
414
- schemaJson: V(x),
415
- templateId: Ye
413
+ formDefinitionId: S,
414
+ schemaJson: U(w),
415
+ templateId: qe
416
416
  }).then((t) => {
417
- e || (j(t), M(null));
417
+ e || (pt(t), ht(null));
418
418
  }).catch((t) => {
419
- e || (j([]), M(t instanceof Error ? t.message : "無法檢查可篩選欄位。"));
419
+ e || (pt([]), ht(t instanceof Error ? t.message : "無法檢查可篩選欄位。"));
420
420
  });
421
421
  }, 400);
422
422
  return () => {
423
423
  e = !0, clearTimeout(t);
424
424
  };
425
425
  }, [
426
- qe,
427
- x,
428
- Ye
426
+ S,
427
+ w,
428
+ qe
429
429
  ]);
430
- let L = r(() => new Map(A.map((e) => [e.path, e.message])), [A]), [R, Fn] = i("design"), [z, B] = i(null), [H, tr] = i([]), [nr, rr] = i(null), [ir, ar] = i("loading"), [or, U] = i(null), [sr, cr] = i(!1), [W, G] = i(null), [lr, K] = i(null);
430
+ let P = r(() => new Map(N.map((e) => [e.path, e.message])), [N]), [z, Pn] = i("design"), [B, V] = i(null), [H, nr] = i([]), [ir, ar] = i(null), [or, sr] = i("loading"), [cr, W] = i(null), [lr, ur] = i(!1), [G, K] = i(null), [dr, q] = i(null);
431
431
  n(() => {
432
432
  let e = !0;
433
- return Ee().then((t) => {
434
- e && (tr(t), rr(null), ar("ready"));
433
+ return Te().then((t) => {
434
+ e && (nr(t), ar(null), sr("ready"));
435
435
  }).catch((t) => {
436
- e && (tr([]), rr("目前無法載入 DataSource Catalog,請稍後重試。"), ar("unavailable"));
436
+ e && (nr([]), ar("目前無法載入 DataSource Catalog,請稍後重試。"), sr("unavailable"));
437
437
  }), () => {
438
438
  e = !1;
439
439
  };
440
440
  }, []), n(() => {
441
- x.fields.some((e) => e.fieldKey === z) || B(x.fields[0]?.fieldKey ?? null);
442
- }, [x.fields, z]), n(() => {
443
- st((e) => he(x.fields, e));
444
- }, [x.fields]), n(() => {
445
- R !== "advanced" && (T(V(x)), E(V(C)));
441
+ w.fields.some((e) => e.fieldKey === B) || V(w.fields[0]?.fieldKey ?? null);
442
+ }, [w.fields, B]), n(() => {
443
+ it((e) => me(w.fields, e));
444
+ }, [w.fields]), n(() => {
445
+ z !== "advanced" && (O(U(w)), k(U(E)));
446
446
  }, [
447
- R,
448
- x,
449
- C
447
+ z,
448
+ w,
449
+ E
450
450
  ]);
451
- let q = r(() => x.fields.find((e) => e.fieldKey === z) ?? x.fields[0] ?? null, [x.fields, z]);
451
+ let J = r(() => w.fields.find((e) => e.fieldKey === B) ?? w.fields[0] ?? null, [w.fields, B]);
452
452
  n(() => {
453
- Je?.({
454
- schema: x,
455
- uiSchema: C
453
+ Ke?.({
454
+ schema: w,
455
+ uiSchema: E
456
456
  });
457
- }, [x, C]);
458
- function ur(e) {
459
- let t = x.fields.length + 1, n = _e(e, t);
460
- S({
461
- ...x,
462
- fields: [...x.fields, n]
463
- }), w({
464
- ...C,
465
- layout: [...C.layout, {
457
+ }, [w, E]);
458
+ function fr(e) {
459
+ let t = w.fields.length + 1, n = ge(e, t);
460
+ T({
461
+ ...w,
462
+ fields: [...w.fields, n]
463
+ }), D({
464
+ ...E,
465
+ layout: [...E.layout, {
466
466
  fieldKey: n.fieldKey,
467
467
  width: e === "textarea" || e === "file_upload" || e === "table" ? "FULL" : "HALF"
468
468
  }]
469
- }), B(n.fieldKey), Fn("design"), k(null);
469
+ }), V(n.fieldKey), Pn("design"), M(null);
470
470
  }
471
- function dr(e) {
471
+ function pr(e) {
472
472
  let t = e;
473
- t === "advanced" && R !== "advanced" && (T(V(x)), E(V(C))), Fn(t);
473
+ t === "advanced" && z !== "advanced" && (O(U(w)), k(U(E))), Pn(t);
474
474
  }
475
- function fr(e) {
476
- let t = x.fields.flatMap((t) => O(t) ? t.columns.flatMap((n) => D(n) && Ve(n).includes(e) ? [`${t.fieldKey}.${n.fieldKey}`] : []) : D(t) && Ve(t).includes(e) ? [t.fieldKey] : []);
477
- t.length > 0 ? G({
475
+ function mr(e) {
476
+ let t = w.fields.flatMap((t) => j(t) ? t.columns.flatMap((n) => A(n) && Be(n).includes(e) ? [`${t.fieldKey}.${n.fieldKey}`] : []) : A(t) && Be(t).includes(e) ? [t.fieldKey] : []);
477
+ t.length > 0 ? K({
478
478
  affectedFieldKeys: t,
479
479
  fieldKey: e,
480
480
  kind: "remove-field"
481
- }) : pr(e);
481
+ }) : hr(e);
482
482
  }
483
- function pr(e) {
484
- let t = x.fields.filter((t) => t.fieldKey !== e);
485
- S({
486
- ...x,
483
+ function hr(e) {
484
+ let t = w.fields.filter((t) => t.fieldKey !== e);
485
+ T({
486
+ ...w,
487
487
  fields: t
488
- }), w({
489
- ...C,
490
- layout: C.layout.filter((t) => t.fieldKey !== e)
491
- }), B(z === e ? t[0]?.fieldKey ?? null : z), k(null), U(null);
488
+ }), D({
489
+ ...E,
490
+ layout: E.layout.filter((t) => t.fieldKey !== e)
491
+ }), V(B === e ? t[0]?.fieldKey ?? null : B), M(null), W(null);
492
492
  }
493
- function mr(e) {
493
+ function gr(e) {
494
494
  let t = e.destination;
495
- t && e.source.index !== t.index && (S((n) => ({
495
+ t && e.source.index !== t.index && (T((n) => ({
496
496
  ...n,
497
- fields: er(n.fields, e.source.index, t.index)
498
- })), w((n) => ({
497
+ fields: rr(n.fields, e.source.index, t.index)
498
+ })), D((n) => ({
499
499
  ...n,
500
- layout: er(n.layout, e.source.index, t.index)
501
- })), k(null));
500
+ layout: rr(n.layout, e.source.index, t.index)
501
+ })), M(null));
502
502
  }
503
- function hr(e) {
504
- J((t) => ({
503
+ function _r(e) {
504
+ Y((t) => ({
505
505
  ...t,
506
506
  ...e
507
507
  }));
508
508
  }
509
- function J(e) {
510
- if (!q) return;
511
- let t = q.fieldKey, n = e(q), r = n.fieldKey, i = {
512
- ...x,
513
- fields: x.fields.map((e) => e.fieldKey === t ? n : e)
514
- }, a = t === r ? i : We(i, t, r);
515
- S(a), w({
516
- ...C,
517
- layout: C.layout.map((e) => e.fieldKey === t ? {
509
+ function Y(e) {
510
+ if (!J) return;
511
+ let t = J.fieldKey, n = e(J), r = n.fieldKey, i = {
512
+ ...w,
513
+ fields: w.fields.map((e) => e.fieldKey === t ? n : e)
514
+ }, a = t === r ? i : Ue(i, t, r);
515
+ T(a), D({
516
+ ...E,
517
+ layout: E.layout.map((e) => e.fieldKey === t ? {
518
518
  ...e,
519
519
  fieldKey: r
520
520
  } : e)
521
- }), B(r), k(null), U(null);
521
+ }), V(r), M(null), W(null);
522
522
  }
523
- function gr(e) {
524
- J(() => e);
523
+ function vr(e) {
524
+ Y(() => e);
525
525
  }
526
- function Y(e, t) {
527
- S((n) => ({
526
+ function X(e, t) {
527
+ T((n) => ({
528
528
  ...n,
529
- fields: n.fields.map((n) => n.fieldKey === e && O(n) ? t(n) : n)
530
- })), k(null), U(null);
529
+ fields: n.fields.map((n) => n.fieldKey === e && j(n) ? t(n) : n)
530
+ })), M(null), W(null);
531
531
  }
532
- function X(e, t, n) {
532
+ function Z(e, t, n) {
533
533
  let r = e.columns[t]?.fieldKey;
534
- Y(e.fieldKey, (e) => {
534
+ X(e.fieldKey, (e) => {
535
535
  let i = {
536
536
  ...e,
537
537
  columns: e.columns.map((e, r) => r === t ? n : e)
538
538
  };
539
- return typeof r == "string" && r !== n.fieldKey ? Ge(i, r, n.fieldKey) : i;
539
+ return typeof r == "string" && r !== n.fieldKey ? We(i, r, n.fieldKey) : i;
540
540
  });
541
541
  }
542
- function _r(e) {
543
- let t = ve(e.columns, "text");
544
- Y(e.fieldKey, (e) => ({
542
+ function yr(e) {
543
+ let t = _e(e.columns, "text");
544
+ X(e.fieldKey, (e) => ({
545
545
  ...e,
546
546
  columns: [...e.columns, t]
547
- })), K(e.columns.length);
547
+ })), q(e.columns.length);
548
548
  }
549
- function vr(e, t) {
550
- Y(e, (e) => ({
549
+ function br(e, t) {
550
+ X(e, (e) => ({
551
551
  ...e,
552
552
  columns: e.columns.filter((e, n) => n !== t)
553
- })), K((e) => e === null || e < t ? e : e === t ? null : e - 1);
553
+ })), q((e) => e === null || e < t ? e : e === t ? null : e - 1);
554
554
  }
555
- function yr(e, t, n) {
556
- Y(e.fieldKey, (e) => ({
555
+ function xr(e, t, n) {
556
+ X(e.fieldKey, (e) => ({
557
557
  ...e,
558
- columns: er(e.columns, t, n)
559
- })), K((e) => e === null ? e : e === t ? n : e > t && e <= n ? e - 1 : e < t && e >= n ? e + 1 : e);
558
+ columns: rr(e.columns, t, n)
559
+ })), q((e) => e === null ? e : e === t ? n : e > t && e <= n ? e - 1 : e < t && e >= n ? e + 1 : e);
560
560
  }
561
- function br(e, t, n) {
562
- if (e.type !== "select" && e.type !== "autocomplete" || dt(e) === t) return;
561
+ function Sr(e, t, n) {
562
+ if (e.type !== "select" && e.type !== "autocomplete" || ct(e) === t) return;
563
563
  let r = e.defaultValue, i = t === "multiple" ? typeof r == "string" ? [r] : r : Array.isArray(r) ? r[0] : r;
564
564
  n(e, {
565
565
  ...e,
@@ -567,18 +567,18 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
567
567
  mode: t
568
568
  }, "選擇模式變更可能轉換或捨棄既有預設值。");
569
569
  }
570
- function xr(e, t, n = "此變更會替換目前選項來源;既有 options、dynamic reference 或 bindings 可能失效。") {
571
- JSON.stringify(e) !== JSON.stringify(t) && G({
570
+ function Cr(e, t, n = "此變更會替換目前選項來源;既有 options、dynamic reference 或 bindings 可能失效。") {
571
+ JSON.stringify(e) !== JSON.stringify(t) && K({
572
572
  fieldKey: e.fieldKey,
573
573
  impact: n,
574
574
  kind: "replace-field",
575
575
  nextField: t
576
576
  });
577
577
  }
578
- function Sr(e, t, n) {
578
+ function wr(e, t, n) {
579
579
  if (!t) return;
580
- if (t === vn) {
581
- if (!D(e)) return;
580
+ if (t === _n) {
581
+ if (!A(e)) return;
582
582
  let { dataSource: t, defaultValue: r, ...i } = e;
583
583
  n({
584
584
  ...i,
@@ -586,9 +586,9 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
586
586
  });
587
587
  return;
588
588
  }
589
- let r = H.find((e) => jn(e) === t);
589
+ let r = H.find((e) => An(e) === t);
590
590
  if (!r) return;
591
- if (D(e)) {
591
+ if (A(e)) {
592
592
  let t = new Set(r.parameters.map((e) => e.key)), i = e.dataSource.bindings.filter((e) => t.has(e.parameter));
593
593
  n({
594
594
  ...e,
@@ -600,9 +600,9 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
600
600
  });
601
601
  return;
602
602
  }
603
- let { options: i, defaultValue: a, ...o } = e;
603
+ let { options: i, ...a } = e;
604
604
  n({
605
- ...o,
605
+ ...a,
606
606
  dataSource: {
607
607
  bindings: [],
608
608
  key: r.key,
@@ -610,110 +610,110 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
610
610
  }
611
611
  });
612
612
  }
613
- function Cr() {
614
- W && (wr(W), G(null));
613
+ function Tr() {
614
+ G && (Er(G), K(null));
615
615
  }
616
- function wr(e) {
617
- e.kind === "remove-field" ? pr(e.fieldKey) : e.kind === "remove-column" ? vr(e.fieldKey, e.columnIndex) : e.kind === "replace-column" ? (Y(e.fieldKey, (t) => ({
616
+ function Er(e) {
617
+ e.kind === "remove-field" ? hr(e.fieldKey) : e.kind === "remove-column" ? br(e.fieldKey, e.columnIndex) : e.kind === "replace-column" ? (X(e.fieldKey, (t) => ({
618
618
  ...t,
619
619
  columns: t.columns.map((t) => t.fieldKey === e.columnKey ? e.nextColumn : t)
620
- })), K(e.columnIndex)) : (S({
621
- ...x,
622
- fields: x.fields.map((t) => t.fieldKey === e.fieldKey ? e.nextField : t)
623
- }), k(null), U(null));
620
+ })), q(e.columnIndex)) : (T({
621
+ ...w,
622
+ fields: w.fields.map((t) => t.fieldKey === e.fieldKey ? e.nextField : t)
623
+ }), M(null), W(null));
624
624
  }
625
- async function Tr() {
626
- cr(!0);
625
+ async function Dr() {
626
+ ur(!0);
627
627
  try {
628
- let e = await Te(x, C);
629
- U(e.errors.map(Er));
628
+ let e = await we(w, E);
629
+ W(e.errors.map(Or));
630
630
  } catch {
631
- U(["目前無法完成 DataSource schema 驗證。"]);
631
+ W(["目前無法完成 DataSource schema 驗證。"]);
632
632
  } finally {
633
- cr(!1);
633
+ ur(!1);
634
634
  }
635
635
  }
636
- function Er(e) {
637
- let t = wt.exec(e);
638
- if (t?.[1] && t[3]) return `${Dr(t[1], t[2])}尚未指定必要參數「${Or(t[1], t[2], t[3])}」的來源`;
636
+ function Or(e) {
637
+ let t = Ct.exec(e);
638
+ if (t?.[1] && t[3]) return `${kr(t[1], t[2])}尚未指定必要參數「${Ar(t[1], t[2], t[3])}」的來源`;
639
639
  let n = fe(e);
640
640
  if (n) {
641
- let e = String(n.fieldIndex), t = n.columnIndex === null ? void 0 : String(n.columnIndex), r = x.fields[n.fieldIndex], i = r ? Ar(r, t) : void 0, a = kr(e, t, String(n.bindingIndex)) ?? "";
641
+ let e = String(n.fieldIndex), t = n.columnIndex === null ? void 0 : String(n.columnIndex), r = w.fields[n.fieldIndex], i = r ? Mr(r, t) : void 0, a = jr(e, t, String(n.bindingIndex)) ?? "";
642
642
  return pe({
643
643
  code: n.code,
644
644
  columnLabel: i ? i.label || i.fieldKey : null,
645
645
  fieldLabel: r ? r.label || r.fieldKey : "",
646
- parameterLabel: Or(e, t, a),
646
+ parameterLabel: Ar(e, t, a),
647
647
  subject: n.subject
648
648
  });
649
649
  }
650
- let r = Tt.exec(e);
651
- return r?.[1] && r[3] ? `${Dr(r[1], r[2])}綁定了來源沒有的參數「${r[3]}」` : He(e);
650
+ let r = wt.exec(e);
651
+ return r?.[1] && r[3] ? `${kr(r[1], r[2])}綁定了來源沒有的參數「${r[3]}」` : Ve(e);
652
652
  }
653
- function Dr(e, t) {
654
- let n = x.fields[Number(e)];
653
+ function kr(e, t) {
654
+ let n = w.fields[Number(e)];
655
655
  if (!n) return "";
656
- let r = n.label || n.fieldKey, i = Ar(n, t);
656
+ let r = n.label || n.fieldKey, i = Mr(n, t);
657
657
  return i ? `「${r}」表格的「${i.label || i.fieldKey}」欄` : `「${r}」欄位`;
658
658
  }
659
- function Or(e, t, n) {
660
- let r = x.fields[Number(e)];
659
+ function Ar(e, t, n) {
660
+ let r = w.fields[Number(e)];
661
661
  if (!r) return n;
662
- let i = Ar(r, t) ?? r, a = D(i) ? i.dataSource : null;
662
+ let i = Mr(r, t) ?? r, a = A(i) ? i.dataSource : null;
663
663
  return (a ? H.find((e) => e.key === a.key && e.version === a.version) : void 0)?.parameters.find((e) => e.key === n)?.label || n;
664
664
  }
665
- function kr(e, t, n) {
666
- let r = x.fields[Number(e)], i = r ? Ar(r, t) ?? r : null;
667
- return i && D(i) ? i.dataSource.bindings[Number(n)]?.parameter ?? null : null;
665
+ function jr(e, t, n) {
666
+ let r = w.fields[Number(e)], i = r ? Mr(r, t) ?? r : null;
667
+ return i && A(i) ? i.dataSource.bindings[Number(n)]?.parameter ?? null : null;
668
668
  }
669
- function Ar(e, t) {
670
- return typeof t == "string" && O(e) ? e.columns[Number(t)] : void 0;
669
+ function Mr(e, t) {
670
+ return typeof t == "string" && j(e) ? e.columns[Number(t)] : void 0;
671
671
  }
672
- function jr(e) {
673
- st(e);
672
+ function Nr(e) {
673
+ it(e);
674
674
  }
675
- function Mr(e, t) {
676
- S((n) => ({
675
+ function Pr(e, t) {
676
+ T((n) => ({
677
677
  ...n,
678
678
  fields: n.fields.map((n) => n.fieldKey === e ? {
679
679
  ...n,
680
680
  required: t
681
681
  } : n)
682
- })), k(null);
682
+ })), M(null);
683
683
  }
684
- function Nr(e) {
685
- T(e);
684
+ function Fr(e) {
685
+ O(e);
686
686
  try {
687
- S(JSON.parse(e)), k(null);
687
+ T(JSON.parse(e)), M(null);
688
688
  } catch {
689
- k("Form Schema JSON 格式不正確");
689
+ M("Form Schema JSON 格式不正確");
690
690
  }
691
691
  }
692
- function Pr(e) {
693
- E(e);
692
+ function Ir(e) {
693
+ k(e);
694
694
  try {
695
- w(JSON.parse(e)), k(null);
695
+ D(JSON.parse(e)), M(null);
696
696
  } catch {
697
- k("UI Schema JSON 格式不正確");
697
+ M("UI Schema JSON 格式不正確");
698
698
  }
699
699
  }
700
700
  return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v(g, { children: [
701
- gt ? /* @__PURE__ */ _(ee, {
702
- content: gt,
701
+ mt ? /* @__PURE__ */ _(ee, {
702
+ content: mt,
703
703
  severity: "warning"
704
704
  }) : null,
705
- A.length > 0 ? /* @__PURE__ */ _(h, {
705
+ N.length > 0 ? /* @__PURE__ */ _(h, {
706
706
  color: "text-error",
707
- style: On,
707
+ style: Dn,
708
708
  variant: "body",
709
- children: A.map((e) => e.message).join("\n")
709
+ children: N.map((e) => e.message).join("\n")
710
710
  }) : null,
711
711
  /* @__PURE__ */ _(re, { children: /* @__PURE__ */ _(ne, { children: /* @__PURE__ */ v("div", {
712
- style: $t,
712
+ style: Qt,
713
713
  children: [
714
714
  /* @__PURE__ */ v(ie, {
715
- activeKey: R,
716
- onChange: dr,
715
+ activeKey: z,
716
+ onChange: pr,
717
717
  size: "sub",
718
718
  children: [
719
719
  /* @__PURE__ */ _(ae, { children: "設計" }, "design"),
@@ -721,96 +721,96 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
721
721
  /* @__PURE__ */ _(ae, { children: "進階" }, "advanced")
722
722
  ]
723
723
  }),
724
- R === "design" ? Fr() : null,
725
- R === "preview" ? Ci() : null,
726
- R === "advanced" ? wi() : null
724
+ z === "design" ? Lr() : null,
725
+ z === "preview" ? Di() : null,
726
+ z === "advanced" ? Oi() : null
727
727
  ]
728
728
  }) }) })
729
- ] }), W ? /* @__PURE__ */ _(te, {
729
+ ] }), G ? /* @__PURE__ */ _(te, {
730
730
  cancelText: "返回",
731
731
  confirmText: "確認變更",
732
732
  modalType: "standard",
733
- onCancel: () => G(null),
734
- onClose: () => G(null),
735
- onConfirm: Cr,
733
+ onCancel: () => K(null),
734
+ onClose: () => K(null),
735
+ onConfirm: Tr,
736
736
  open: !0,
737
737
  showModalFooter: !0,
738
738
  showModalHeader: !0,
739
- title: Rn(W),
740
- children: W.kind === "remove-field" ? /* @__PURE__ */ v("div", {
741
- style: en,
739
+ title: Ln(G),
740
+ children: G.kind === "remove-field" ? /* @__PURE__ */ v("div", {
741
+ style: $t,
742
742
  children: [/* @__PURE__ */ _(h, {
743
743
  variant: "body",
744
744
  children: "此欄位仍被下列 DataSource binding 使用;移除後請重新設定這些欄位。"
745
745
  }), /* @__PURE__ */ _(h, {
746
746
  color: "text-warning",
747
747
  variant: "body",
748
- children: W.affectedFieldKeys.join("、")
748
+ children: G.affectedFieldKeys.join("、")
749
749
  })]
750
- }) : W.kind === "remove-column" ? /* @__PURE__ */ v(h, {
750
+ }) : G.kind === "remove-column" ? /* @__PURE__ */ v(h, {
751
751
  variant: "body",
752
752
  children: [
753
753
  "移除欄「",
754
- W.columnKey,
754
+ G.columnKey,
755
755
  "」後,既有案件仍保留原本的表單版本,但新版本的這一欄資料將不再被填寫。"
756
756
  ]
757
757
  }) : /* @__PURE__ */ _(h, {
758
758
  variant: "body",
759
- children: W.impact
759
+ children: G.impact
760
760
  })
761
761
  }) : null] });
762
- function Fr() {
762
+ function Lr() {
763
763
  return /* @__PURE__ */ v("div", {
764
- style: P,
764
+ style: I,
765
765
  children: [/* @__PURE__ */ v("div", {
766
- style: Ot,
766
+ style: Dt,
767
767
  children: [/* @__PURE__ */ _(h, {
768
768
  component: "h2",
769
769
  variant: "label-primary",
770
770
  children: "新增欄位"
771
771
  }), /* @__PURE__ */ _("div", {
772
- style: Et,
773
- children: vt.map((e) => /* @__PURE__ */ _(c, {
772
+ style: Tt,
773
+ children: _t.map((e) => /* @__PURE__ */ _(c, {
774
774
  icon: e.icon,
775
775
  iconType: "leading",
776
- onClick: () => ur(e.type),
776
+ onClick: () => fr(e.type),
777
777
  size: "sub",
778
- style: Dt,
778
+ style: Et,
779
779
  type: "button",
780
780
  variant: "base-secondary",
781
781
  children: e.label
782
782
  }, e.type))
783
783
  })]
784
784
  }), /* @__PURE__ */ v("div", {
785
- style: yt,
785
+ style: vt,
786
786
  children: [/* @__PURE__ */ v("div", {
787
787
  style: {
788
- ...P,
789
- ...bt
788
+ ...I,
789
+ ...yt
790
790
  },
791
791
  children: [/* @__PURE__ */ _(h, {
792
792
  component: "h2",
793
793
  variant: "label-primary",
794
794
  children: "表單畫布"
795
- }), x.fields.length > 0 ? /* @__PURE__ */ _(ft, {
796
- onDragEnd: mr,
797
- children: /* @__PURE__ */ _(mt, {
795
+ }), w.fields.length > 0 ? /* @__PURE__ */ _(lt, {
796
+ onDragEnd: gr,
797
+ children: /* @__PURE__ */ _(dt, {
798
798
  droppableId: "form-builder-fields",
799
799
  children: (e) => /* @__PURE__ */ v("div", {
800
800
  ...e.droppableProps,
801
801
  ref: e.innerRef,
802
- style: P,
803
- children: [x.fields.map((e, t) => /* @__PURE__ */ _(pt, {
802
+ style: I,
803
+ children: [w.fields.map((e, t) => /* @__PURE__ */ _(ut, {
804
804
  draggableId: e.fieldKey,
805
805
  index: t,
806
- children: (t, n) => xi(e, t, n.isDragging)
806
+ children: (t, n) => Ti(e, t, n.isDragging)
807
807
  }, e.fieldKey)), e.placeholder]
808
808
  })
809
809
  })
810
810
  }) : /* @__PURE__ */ v("div", {
811
- style: It,
811
+ style: Ft,
812
812
  children: [/* @__PURE__ */ v("div", {
813
- style: P,
813
+ style: I,
814
814
  children: [/* @__PURE__ */ _(h, {
815
815
  component: "h3",
816
816
  variant: "h3",
@@ -821,13 +821,13 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
821
821
  children: "從上方新增第一個欄位,或直接建立常用文字欄位開始設計。"
822
822
  })]
823
823
  }), /* @__PURE__ */ v("div", {
824
- style: Lt,
824
+ style: It,
825
825
  children: [/* @__PURE__ */ _(c, {
826
- onClick: () => ur("text"),
826
+ onClick: () => fr("text"),
827
827
  variant: "base-primary",
828
828
  children: "新增文字欄位"
829
829
  }), /* @__PURE__ */ _(c, {
830
- onClick: () => ur("textarea"),
830
+ onClick: () => fr("textarea"),
831
831
  variant: "base-secondary",
832
832
  children: "新增長文字"
833
833
  })]
@@ -835,14 +835,14 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
835
835
  })]
836
836
  }), /* @__PURE__ */ v("div", {
837
837
  style: {
838
- ...P,
839
- ...xt
838
+ ...I,
839
+ ...bt
840
840
  },
841
841
  children: [/* @__PURE__ */ _(h, {
842
842
  component: "h2",
843
843
  variant: "label-primary",
844
844
  children: "欄位設定"
845
- }), q ? Ir(q) : /* @__PURE__ */ _(h, {
845
+ }), J ? Rr(J) : /* @__PURE__ */ _(h, {
846
846
  color: "text-neutral",
847
847
  variant: "body",
848
848
  children: "請先新增或選取欄位。"
@@ -851,137 +851,137 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
851
851
  })]
852
852
  });
853
853
  }
854
- function Ir(e) {
854
+ function Rr(e) {
855
855
  return /* @__PURE__ */ v("div", {
856
- style: Rt,
856
+ style: Lt,
857
857
  children: [
858
- Lr(e),
859
- O(e) ? Vr(e) : null,
860
- Rr(e)
858
+ zr(e),
859
+ j(e) ? Ur(e) : null,
860
+ Br(e)
861
861
  ]
862
862
  });
863
863
  }
864
- function Lr(e) {
864
+ function zr(e) {
865
865
  return /* @__PURE__ */ v("div", {
866
- style: zt,
866
+ style: Rt,
867
867
  children: [
868
868
  /* @__PURE__ */ _("div", {
869
- style: Vt,
869
+ style: Bt,
870
870
  children: /* @__PURE__ */ _(o, {
871
871
  size: "main",
872
- text: An(e.type),
872
+ text: kn(e.type),
873
873
  variant: "text-info"
874
874
  })
875
875
  }),
876
876
  $("標題", "fieldLabel", /* @__PURE__ */ _(f, {
877
- onChange: (e) => hr({ label: e.target.value }),
877
+ onChange: (e) => _r({ label: e.target.value }),
878
878
  placeholder: "例如:申請金額",
879
879
  value: e.label,
880
880
  variant: "base"
881
881
  })),
882
882
  $("欄位 Key", "fieldKey", /* @__PURE__ */ _(f, {
883
- onChange: (e) => hr({ fieldKey: e.target.value }),
883
+ onChange: (e) => _r({ fieldKey: e.target.value }),
884
884
  placeholder: "例如:amount",
885
885
  value: e.fieldKey,
886
886
  variant: "base"
887
887
  })),
888
- O(e) ? null : $("提示文字", "fieldPlaceholder", /* @__PURE__ */ _(f, {
889
- onChange: (e) => hr({ placeholder: e.target.value || void 0 }),
888
+ j(e) ? null : $("提示文字", "fieldPlaceholder", /* @__PURE__ */ _(f, {
889
+ onChange: (e) => _r({ placeholder: e.target.value || void 0 }),
890
890
  placeholder: "例如:請輸入申請金額",
891
891
  value: e.placeholder ?? "",
892
892
  variant: "base"
893
893
  })),
894
- zr(e, gr, xr),
895
- Jn(e) ? $("以連結顯示", "fieldDisplayAsLink", /* @__PURE__ */ _(m, {
894
+ Vr(e, vr, Cr, Cr),
895
+ qn(e) ? $("以連結顯示", "fieldDisplayAsLink", /* @__PURE__ */ _(m, {
896
896
  checked: e.displayAs === "link",
897
- onChange: (e) => J((t) => e.target.checked ? Jn(t) ? {
897
+ onChange: (e) => Y((t) => e.target.checked ? qn(t) ? {
898
898
  ...t,
899
899
  displayAs: "link"
900
- } : t : Gn(t, "displayAs"))
900
+ } : t : Wn(t, "displayAs"))
901
901
  })) : null,
902
902
  $("可篩選", "fieldFilterable", /* @__PURE__ */ _(m, {
903
903
  checked: e.filterable === !0,
904
- onChange: (e) => J((t) => e.target.checked ? {
904
+ onChange: (e) => Y((t) => e.target.checked ? {
905
905
  ...t,
906
906
  filterable: !0
907
- } : Gn(t, "filterable"))
907
+ } : Wn(t, "filterable"))
908
908
  })),
909
909
  e.filterable === !0 ? /* @__PURE__ */ _(h, {
910
910
  color: "text-neutral",
911
- style: F,
911
+ style: L,
912
912
  variant: "body",
913
- children: kn
913
+ children: On
914
914
  }) : null,
915
- L.has(e.fieldKey) ? /* @__PURE__ */ _(h, {
915
+ P.has(e.fieldKey) ? /* @__PURE__ */ _(h, {
916
916
  color: "text-error",
917
- style: F,
917
+ style: L,
918
918
  variant: "body",
919
- children: L.get(e.fieldKey)
919
+ children: P.get(e.fieldKey)
920
920
  }) : null,
921
921
  $("只存不顯示(系統整合用)", "fieldHidden", /* @__PURE__ */ _(m, {
922
922
  checked: e.hidden === !0,
923
- onChange: (e) => J((t) => e.target.checked ? {
923
+ onChange: (e) => Y((t) => e.target.checked ? {
924
924
  ...t,
925
925
  hidden: !0,
926
926
  required: !1
927
- } : Gn(t, "hidden"))
927
+ } : Wn(t, "hidden"))
928
928
  })),
929
929
  e.hidden === !0 ? /* @__PURE__ */ _(h, {
930
930
  color: "text-neutral",
931
- style: F,
931
+ style: L,
932
932
  variant: "body",
933
933
  children: "填寫、唯讀與重送畫面都不會顯示這個欄位,值仍會存下來; 透過 API 仍然讀得到這個值,不是權限控管。"
934
934
  }) : null
935
935
  ]
936
936
  });
937
937
  }
938
- function Rr(e) {
938
+ function Br(e) {
939
939
  return /* @__PURE__ */ _(a, {
940
- defaultExpanded: Kn(e),
940
+ defaultExpanded: Gn(e),
941
941
  size: "sub",
942
942
  title: "進階設定",
943
943
  children: /* @__PURE__ */ v("div", {
944
- style: zt,
944
+ style: Rt,
945
945
  children: [
946
946
  /* @__PURE__ */ _(h, {
947
947
  component: "h3",
948
- style: Bt,
948
+ style: zt,
949
949
  variant: "label-primary",
950
950
  children: "條件規則"
951
951
  }),
952
952
  /* @__PURE__ */ _(h, {
953
953
  color: "text-neutral",
954
- style: F,
954
+ style: L,
955
955
  variant: "body",
956
956
  children: "只有需要根據其他欄位改變顯示、必填或唯讀狀態時才需要設定。"
957
957
  }),
958
- hi(e)
958
+ vi(e)
959
959
  ]
960
960
  })
961
961
  });
962
962
  }
963
- function zr(e, t, n, r) {
964
- return Jn(e) ? qr(e, t) : Ce(e) ? Jr(e, t) : xe(e) ? Yr(e, t) : ot(e) ? Xr(e, t, n, r) : e.type === "boolean" ? fi(e, t) : e.type === "file_upload" ? mi(e, t) : ct(e) ? pi(e, t) : O(e) ? Br(e) : null;
963
+ function Vr(e, t, n, r, i) {
964
+ return qn(e) ? Yr(e, t) : Se(e) ? Xr(e, t) : be(e) ? Zr(e, t) : rt(e) ? Qr(e, t, n, r, i) : e.type === "boolean" ? hi(e, t) : e.type === "file_upload" ? _i(e, t) : at(e) ? gi(e, t) : j(e) ? Hr(e) : null;
965
965
  }
966
- function Br(e) {
967
- let t = Ue(e);
966
+ function Hr(e) {
967
+ let t = He(e);
968
968
  return /* @__PURE__ */ v(g, { children: [
969
- $("最少列數", "fieldMinRows", Q(e.minRows, (t) => Y(e.fieldKey, (e) => ({
969
+ $("最少列數", "fieldMinRows", Q(e.minRows, (t) => X(e.fieldKey, (e) => ({
970
970
  ...e,
971
971
  minRows: t
972
972
  })), "例如:1", {
973
973
  max: t.maxRows,
974
974
  min: 0
975
975
  })),
976
- $("最多列數", "fieldMaxRows", Q(e.maxRows, (t) => Y(e.fieldKey, (e) => ({
976
+ $("最多列數", "fieldMaxRows", Q(e.maxRows, (t) => X(e.fieldKey, (e) => ({
977
977
  ...e,
978
978
  maxRows: t
979
- })), `未設定即為 ${rt}`, {
980
- max: rt,
979
+ })), `未設定即為 ${et}`, {
980
+ max: et,
981
981
  min: Math.max(t.minRows, 1)
982
982
  })),
983
983
  $("新增列按鈕文字", "fieldAddRowLabel", /* @__PURE__ */ _(f, {
984
- onChange: (t) => Y(e.fieldKey, (e) => ({
984
+ onChange: (t) => X(e.fieldKey, (e) => ({
985
985
  ...e,
986
986
  addRowLabel: t.target.value || void 0
987
987
  })),
@@ -991,11 +991,11 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
991
991
  }))
992
992
  ] });
993
993
  }
994
- function Vr(e) {
994
+ function Ur(e) {
995
995
  return /* @__PURE__ */ v("div", {
996
- style: dn,
996
+ style: un,
997
997
  children: [/* @__PURE__ */ v("div", {
998
- style: fn,
998
+ style: dn,
999
999
  children: [/* @__PURE__ */ v(h, {
1000
1000
  component: "h3",
1001
1001
  variant: "label-primary",
@@ -1005,18 +1005,18 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1005
1005
  ")"
1006
1006
  ]
1007
1007
  }), /* @__PURE__ */ _(c, {
1008
- icon: et,
1008
+ icon: Ze,
1009
1009
  iconType: "leading",
1010
- onClick: () => _r(e),
1010
+ onClick: () => yr(e),
1011
1011
  size: "sub",
1012
1012
  type: "button",
1013
1013
  variant: "base-secondary",
1014
1014
  children: "新增欄"
1015
1015
  })]
1016
- }), Hr(e)]
1016
+ }), Wr(e)]
1017
1017
  });
1018
1018
  }
1019
- function Hr(e) {
1019
+ function Wr(e) {
1020
1020
  let t = e.columns.map((t, n) => ({
1021
1021
  fieldKey: t.fieldKey,
1022
1022
  index: n,
@@ -1028,8 +1028,8 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1028
1028
  key: "label",
1029
1029
  render: (t) => /* @__PURE__ */ _(f, {
1030
1030
  fullWidth: !0,
1031
- onChange: (n) => X(e, t.index, {
1032
- ...Kr(e, t.index),
1031
+ onChange: (n) => Z(e, t.index, {
1032
+ ...Jr(e, t.index),
1033
1033
  label: n.target.value
1034
1034
  }),
1035
1035
  placeholder: "例如:數量",
@@ -1044,21 +1044,21 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1044
1044
  render: (t) => /* @__PURE__ */ _(p, {
1045
1045
  fullWidth: !0,
1046
1046
  clearable: !1,
1047
- menuMaxHeight: St,
1048
- onChange: (n) => Wr(e, t.index, n?.id),
1049
- options: [...N],
1047
+ menuMaxHeight: xt,
1048
+ onChange: (n) => Kr(e, t.index, n?.id),
1049
+ options: [...F],
1050
1050
  size: "sub",
1051
- value: b(N, t.type)
1051
+ value: x(F, t.type)
1052
1052
  }),
1053
1053
  title: "型別"
1054
1054
  },
1055
1055
  {
1056
1056
  key: "required",
1057
1057
  render: (t) => /* @__PURE__ */ _(m, {
1058
- checked: Kr(e, t.index).required === !0,
1058
+ checked: Jr(e, t.index).required === !0,
1059
1059
  inputProps: { "aria-label": `${t.label || t.fieldKey} 必填` },
1060
- onChange: (n) => X(e, t.index, {
1061
- ...Kr(e, t.index),
1060
+ onChange: (n) => Z(e, t.index, {
1061
+ ...Jr(e, t.index),
1062
1062
  required: n.target.checked
1063
1063
  }),
1064
1064
  size: "sub"
@@ -1068,12 +1068,12 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1068
1068
  {
1069
1069
  key: "filterable",
1070
1070
  render: (t) => {
1071
- let n = Kr(e, t.index), r = L.get(`${e.fieldKey}.${n.fieldKey}`);
1071
+ let n = Jr(e, t.index), r = P.get(`${e.fieldKey}.${n.fieldKey}`);
1072
1072
  return /* @__PURE__ */ v("div", { children: [
1073
1073
  /* @__PURE__ */ _(m, {
1074
1074
  checked: n.filterable === !0,
1075
1075
  inputProps: { "aria-label": `${t.label || t.fieldKey} 可篩選` },
1076
- onChange: (r) => X(e, t.index, {
1076
+ onChange: (r) => Z(e, t.index, {
1077
1077
  ...n,
1078
1078
  filterable: r.target.checked
1079
1079
  }),
@@ -1082,7 +1082,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1082
1082
  n.filterable === !0 ? /* @__PURE__ */ _(h, {
1083
1083
  color: "text-neutral",
1084
1084
  variant: "caption",
1085
- children: kn
1085
+ children: On
1086
1086
  }) : null,
1087
1087
  r ? /* @__PURE__ */ _(h, {
1088
1088
  color: "text-error",
@@ -1096,10 +1096,10 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1096
1096
  ], r = {
1097
1097
  render: (t) => [{
1098
1098
  disabled: () => e.columns.length <= 1,
1099
- icon: tt,
1099
+ icon: Qe,
1100
1100
  iconType: "leading",
1101
1101
  name: "移除此欄",
1102
- onClick: () => G({
1102
+ onClick: () => K({
1103
1103
  columnIndex: t.index,
1104
1104
  columnKey: t.fieldKey,
1105
1105
  fieldKey: e.fieldKey,
@@ -1108,19 +1108,19 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1108
1108
  variant: "destructive-ghost"
1109
1109
  }],
1110
1110
  width: 104
1111
- }, i = lr === null ? void 0 : t[lr]?.key;
1111
+ }, i = dr === null ? void 0 : t[dr]?.key;
1112
1112
  return /* @__PURE__ */ _(oe, {
1113
1113
  actions: r,
1114
1114
  columns: n,
1115
1115
  dataSource: t,
1116
1116
  draggable: {
1117
1117
  enabled: !0,
1118
- onDragEnd: (t, n) => yr(e, n.fromIndex, n.toIndex)
1118
+ onDragEnd: (t, n) => xr(e, n.fromIndex, n.toIndex)
1119
1119
  },
1120
1120
  expandable: {
1121
1121
  expandedRowKeys: i ? [i] : [],
1122
- expandedRowRender: (t) => Ur(e, t.index),
1123
- onExpand: (e, t) => K(e ? t.index : null)
1122
+ expandedRowRender: (t) => Gr(e, t.index),
1123
+ onExpand: (e, t) => q(e ? t.index : null)
1124
1124
  },
1125
1125
  fullWidth: !0,
1126
1126
  rowHeightPreset: "roomy",
@@ -1128,13 +1128,13 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1128
1128
  size: "sub"
1129
1129
  });
1130
1130
  }
1131
- function Ur(e, t) {
1131
+ function Gr(e, t) {
1132
1132
  let n = e.columns[t];
1133
1133
  return n ? /* @__PURE__ */ v("div", {
1134
- style: un,
1134
+ style: ln,
1135
1135
  children: [
1136
1136
  $("欄位 Key", "columnFieldKey", /* @__PURE__ */ _(f, {
1137
- onChange: (r) => X(e, t, {
1137
+ onChange: (r) => Z(e, t, {
1138
1138
  ...n,
1139
1139
  fieldKey: r.target.value
1140
1140
  }),
@@ -1143,7 +1143,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1143
1143
  variant: "base"
1144
1144
  })),
1145
1145
  $("提示文字", "columnPlaceholder", /* @__PURE__ */ _(f, {
1146
- onChange: (r) => X(e, t, {
1146
+ onChange: (r) => Z(e, t, {
1147
1147
  ...n,
1148
1148
  placeholder: r.target.value || void 0
1149
1149
  }),
@@ -1151,38 +1151,45 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1151
1151
  value: n.placeholder ?? "",
1152
1152
  variant: "base"
1153
1153
  })),
1154
- zr(n, (n) => {
1155
- ut(n.type) && X(e, t, n);
1154
+ Vr(n, (n) => {
1155
+ st(n.type) && Z(e, t, n);
1156
1156
  }, (n, r) => {
1157
- ut(r.type) && X(e, t, r);
1158
- }, e.columns)
1157
+ st(r.type) && Z(e, t, r);
1158
+ }, (n, r, i) => K({
1159
+ columnIndex: t,
1160
+ columnKey: n.fieldKey,
1161
+ fieldKey: e.fieldKey,
1162
+ impact: i,
1163
+ kind: "replace-column",
1164
+ nextColumn: r
1165
+ }), e.columns)
1159
1166
  ]
1160
1167
  }) : null;
1161
1168
  }
1162
- function Wr(e, t, n) {
1163
- let r = e.columns[t], i = N.find((e) => e.id === n)?.id;
1169
+ function Kr(e, t, n) {
1170
+ let r = e.columns[t], i = F.find((e) => e.id === n)?.id;
1164
1171
  if (!r || !i || r.type === i) return;
1165
- let a = Wn(r, i), o = zn(r);
1166
- o.length === 0 ? (X(e, t, a), K(t)) : G({
1172
+ let a = Un(r, i), o = Rn(r);
1173
+ o.length === 0 ? (Z(e, t, a), q(t)) : K({
1167
1174
  columnIndex: t,
1168
1175
  columnKey: r.fieldKey,
1169
1176
  fieldKey: e.fieldKey,
1170
- impact: `「${r.label || r.fieldKey}」改為${Gr(i)}後,這一欄的${o.join("、")}會被捨棄。`,
1177
+ impact: `「${r.label || r.fieldKey}」改為${qr(i)}後,這一欄的${o.join("、")}會被捨棄。`,
1171
1178
  kind: "replace-column",
1172
1179
  nextColumn: a
1173
1180
  });
1174
1181
  }
1175
- function Gr(e) {
1176
- return N.find((t) => t.id === e)?.name ?? e;
1182
+ function qr(e) {
1183
+ return F.find((t) => t.id === e)?.name ?? e;
1177
1184
  }
1178
- function Kr(e, t) {
1185
+ function Jr(e, t) {
1179
1186
  let n = e.columns[t];
1180
1187
  if (!n) throw Error(`Table ${e.fieldKey} has no column at index ${t}.`);
1181
1188
  return n;
1182
1189
  }
1183
- function qr(e, t) {
1190
+ function Yr(e, t) {
1184
1191
  return /* @__PURE__ */ v(g, { children: [
1185
- $("預設值", "fieldDefaultValue", e.type === "textarea" ? vi({
1192
+ $("預設值", "fieldDefaultValue", e.type === "textarea" ? Si({
1186
1193
  name: "fieldDefaultValue",
1187
1194
  onChange: (n) => t({
1188
1195
  ...e,
@@ -1190,14 +1197,14 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1190
1197
  }),
1191
1198
  placeholder: "輸入此欄位的預設文字",
1192
1199
  rows: 3,
1193
- value: Yn(e.defaultValue)
1200
+ value: Jn(e.defaultValue)
1194
1201
  }) : /* @__PURE__ */ _(f, {
1195
1202
  onChange: (n) => t({
1196
1203
  ...e,
1197
1204
  defaultValue: n.target.value || void 0
1198
1205
  }),
1199
1206
  placeholder: "輸入此欄位的預設文字",
1200
- value: Yn(e.defaultValue),
1207
+ value: Jn(e.defaultValue),
1201
1208
  variant: "base"
1202
1209
  })),
1203
1210
  $("最小長度", "fieldMinLength", Q(e.minLength, (n) => t({
@@ -1209,20 +1216,20 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1209
1216
  maxLength: n
1210
1217
  }), "例如:100", { min: 1 })),
1211
1218
  $("格式(正規表示式)", "fieldPattern", /* @__PURE__ */ _(f, {
1212
- onChange: (n) => t(Bn(e, n.target.value)),
1219
+ onChange: (n) => t(zn(e, n.target.value)),
1213
1220
  placeholder: "例如:[0-9]{8}",
1214
1221
  value: e.pattern ?? "",
1215
1222
  variant: "base"
1216
- }), !1, Hn(e.pattern)),
1223
+ }), !1, Vn(e.pattern)),
1217
1224
  e.pattern ? $("格式錯誤訊息", "fieldPatternErrorMessage", /* @__PURE__ */ _(f, {
1218
- onChange: (n) => t(Vn(e, n.target.value)),
1225
+ onChange: (n) => t(Bn(e, n.target.value)),
1219
1226
  placeholder: "例如:統一編號為 8 位數字。",
1220
1227
  value: e.patternErrorMessage ?? "",
1221
1228
  variant: "base"
1222
- }), !1, Un(e.patternErrorMessage)) : null
1229
+ }), !1, Hn(e.patternErrorMessage)) : null
1223
1230
  ] });
1224
1231
  }
1225
- function Jr(e, t) {
1232
+ function Xr(e, t) {
1226
1233
  return /* @__PURE__ */ v(g, { children: [
1227
1234
  $("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (n) => t({
1228
1235
  ...e,
@@ -1241,62 +1248,89 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1241
1248
  }), "例如:999999"))
1242
1249
  ] });
1243
1250
  }
1244
- function Yr(e, t) {
1245
- return $("預設值", "fieldDefaultValue", yi(e, Yn(e.defaultValue), (n) => t({
1251
+ function Zr(e, t) {
1252
+ return $("預設值", "fieldDefaultValue", Ci(e, Jn(e.defaultValue), (n) => t({
1246
1253
  ...e,
1247
1254
  defaultValue: n
1248
1255
  })));
1249
1256
  }
1250
- function Xr(e, t, n, r) {
1251
- let i = Ae(e.type, H), a = {
1257
+ function Qr(e, t, n, r, i) {
1258
+ let a = ke(e.type, H), o = {
1252
1259
  commit: (e) => t(e),
1253
- rowColumns: r
1254
- }, o = D(e) ? jn(e.dataSource) : vn, 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 = [
1255
- ...Cn,
1256
- ...i.map(Nn),
1257
- ...D(e) && !c ? [{
1258
- id: o,
1260
+ requestDependencyChange: r,
1261
+ rowColumns: i
1262
+ }, s = A(e) ? An(e.dataSource) : _n, c = A(e) ? H.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version) : null, l = c ? a.some((e) => e.key === c.key && e.version === c.version) : !1, u = [
1263
+ ...Sn,
1264
+ ...a.map(Mn),
1265
+ ...A(e) && !l ? [{
1266
+ id: s,
1259
1267
  name: `${e.dataSource.key} v${e.dataSource.version}(目前不可用或不支援)`
1260
1268
  }] : []
1261
- ], u = dt(e);
1269
+ ], d = ct(e);
1262
1270
  return /* @__PURE__ */ v(g, { children: [
1263
1271
  e.type === "select" || e.type === "autocomplete" ? $("選擇模式", "fieldSelectionMode", /* @__PURE__ */ _(p, {
1264
1272
  clearable: !1,
1265
1273
  onChange: (t) => {
1266
- (t?.id === "single" || t?.id === "multiple") && br(e, t.id, n);
1274
+ (t?.id === "single" || t?.id === "multiple") && Sr(e, t.id, n);
1267
1275
  },
1268
- options: [...wn],
1269
- value: b(wn, u)
1276
+ options: [...Cn],
1277
+ value: x(Cn, d)
1270
1278
  })) : $("選擇模式", "fieldSelectionMode", /* @__PURE__ */ _(h, {
1271
1279
  color: "text-neutral",
1272
1280
  variant: "body",
1273
- children: u === "multiple" ? "固定複選" : "固定單選"
1281
+ children: d === "multiple" ? "固定複選" : "固定單選"
1274
1282
  })),
1275
1283
  $("選項來源", "fieldOptionSource", /* @__PURE__ */ _(p, {
1276
1284
  clearable: !1,
1277
- disabled: ir === "loading" && !D(e),
1278
- onChange: (n) => Sr(e, n?.id, t),
1279
- options: l,
1285
+ disabled: or === "loading" && !A(e),
1286
+ onChange: (n) => wr(e, n?.id, t),
1287
+ options: u,
1280
1288
  placeholder: "選擇選項來源",
1281
- value: b(l, o)
1289
+ value: x(u, s)
1282
1290
  })),
1283
- D(e) ? Zr(e, i, a) : di(e, t)
1291
+ A(e) ? ei(e, a, o) : mi(e, t)
1284
1292
  ] });
1285
1293
  }
1286
- function Zr(e, t, n) {
1287
- let r = H.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version), i = r && !Se(r, e.type);
1294
+ function $r(e, t) {
1295
+ let n = Zn(e), r = n ? {
1296
+ severity: "info",
1297
+ text: "選項依賴其他欄位的值,不能設定固定預設值;由使用者自行選擇。"
1298
+ } : void 0;
1299
+ if (ct(e) === "multiple") {
1300
+ let i = Array.isArray(e.defaultValue) ? e.defaultValue.filter((e) => typeof e == "string") : void 0;
1301
+ return $("預設值", "fieldDefaultValue", /* @__PURE__ */ _(Qn, {
1302
+ disabled: n,
1303
+ onCommit: (n) => t.commit({
1304
+ ...e,
1305
+ defaultValue: n ? [...n] : void 0
1306
+ }),
1307
+ value: i
1308
+ }, `${e.fieldKey}:${String(n)}`), !0, r);
1309
+ }
1310
+ return $("預設值", "fieldDefaultValue", /* @__PURE__ */ _(f, {
1311
+ disabled: n ? !0 : void 0,
1312
+ onChange: (n) => t.commit({
1313
+ ...e,
1314
+ defaultValue: n.target.value || void 0
1315
+ }),
1316
+ placeholder: "輸入預設選項的值",
1317
+ value: Jn(e.defaultValue)
1318
+ }), !1, r);
1319
+ }
1320
+ function ei(e, t, n) {
1321
+ let r = H.find((t) => t.key === e.dataSource.key && t.version === e.dataSource.version), i = r && !xe(r, e.type);
1288
1322
  return /* @__PURE__ */ v("div", {
1289
- style: rn,
1323
+ style: nn,
1290
1324
  children: [
1291
- ir === "loading" ? /* @__PURE__ */ _(h, {
1325
+ or === "loading" ? /* @__PURE__ */ _(h, {
1292
1326
  color: "text-neutral",
1293
1327
  variant: "body",
1294
1328
  children: "正在載入可用的選項來源…"
1295
1329
  }) : null,
1296
- nr ? /* @__PURE__ */ _(h, {
1330
+ ir ? /* @__PURE__ */ _(h, {
1297
1331
  color: "text-error",
1298
1332
  variant: "body",
1299
- children: nr
1333
+ children: ir
1300
1334
  }) : null,
1301
1335
  r ? null : /* @__PURE__ */ _(h, {
1302
1336
  color: "text-warning",
@@ -1308,28 +1342,29 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1308
1342
  variant: "body",
1309
1343
  children: "這個來源不支援目前的控制項,請改選其他來源。"
1310
1344
  }) : null,
1311
- r ? Qr(r) : null,
1312
- r && r.parameters.length > 0 ? $r(e, r, n) : null,
1313
- t.length === 0 && !nr ? /* @__PURE__ */ _(h, {
1345
+ r ? ti(r) : null,
1346
+ r && r.parameters.length > 0 ? ni(e, r, n) : null,
1347
+ r ? $r(e, n) : null,
1348
+ t.length === 0 && !ir ? /* @__PURE__ */ _(h, {
1314
1349
  color: "text-warning",
1315
1350
  variant: "body",
1316
1351
  children: "沒有支援目前控制項的已註冊來源。"
1317
1352
  }) : null,
1318
1353
  /* @__PURE__ */ _("div", {
1319
- style: sn,
1354
+ style: on,
1320
1355
  children: /* @__PURE__ */ _(c, {
1321
- disabled: sr,
1322
- loading: sr,
1323
- onClick: () => void Tr(),
1356
+ disabled: lr,
1357
+ loading: lr,
1358
+ onClick: () => void Dr(),
1324
1359
  size: "sub",
1325
1360
  type: "button",
1326
1361
  variant: "base-secondary",
1327
1362
  children: "檢查全部動態選項設定"
1328
1363
  })
1329
1364
  }),
1330
- or ? /* @__PURE__ */ _("div", {
1331
- style: an,
1332
- children: or.length > 0 ? or.map((e) => /* @__PURE__ */ _(h, {
1365
+ cr ? /* @__PURE__ */ _("div", {
1366
+ style: rn,
1367
+ children: cr.length > 0 ? cr.map((e) => /* @__PURE__ */ _(h, {
1333
1368
  color: "text-error",
1334
1369
  variant: "caption",
1335
1370
  children: e
@@ -1342,17 +1377,17 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1342
1377
  ]
1343
1378
  });
1344
1379
  }
1345
- function Qr(e) {
1380
+ function ti(e) {
1346
1381
  return /* @__PURE__ */ v("div", {
1347
- style: ln,
1382
+ style: cn,
1348
1383
  children: [
1349
1384
  e.description ? /* @__PURE__ */ _(h, {
1350
1385
  variant: "body",
1351
1386
  children: e.description
1352
1387
  }) : null,
1353
1388
  /* @__PURE__ */ _("div", {
1354
- style: cn,
1355
- children: Mn(e).map((e) => /* @__PURE__ */ _(se, {
1389
+ style: sn,
1390
+ children: jn(e).map((e) => /* @__PURE__ */ _(se, {
1356
1391
  label: e,
1357
1392
  readOnly: !0,
1358
1393
  size: "minor"
@@ -1371,14 +1406,14 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1371
1406
  ]
1372
1407
  });
1373
1408
  }
1374
- function $r(e, t, n) {
1409
+ function ni(e, t, n) {
1375
1410
  let r = t.parameters.map((e, t) => ({
1376
1411
  key: e.key,
1377
1412
  index: t,
1378
1413
  parameter: e
1379
1414
  }));
1380
1415
  return /* @__PURE__ */ v("div", {
1381
- style: on,
1416
+ style: an,
1382
1417
  children: [
1383
1418
  /* @__PURE__ */ _(h, {
1384
1419
  color: "text-neutral",
@@ -1390,7 +1425,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1390
1425
  {
1391
1426
  key: "parameter",
1392
1427
  render: (e) => /* @__PURE__ */ v("div", {
1393
- style: pn,
1428
+ style: fn,
1394
1429
  children: [/* @__PURE__ */ _(h, {
1395
1430
  variant: "input",
1396
1431
  children: e.parameter.label ?? e.parameter.key
@@ -1406,15 +1441,15 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1406
1441
  {
1407
1442
  key: "binding",
1408
1443
  width: 268,
1409
- render: (t) => ni(e, t.parameter, n),
1444
+ render: (t) => ai(e, t.parameter, n),
1410
1445
  title: "值從哪裡來"
1411
1446
  },
1412
1447
  {
1413
1448
  key: "constant",
1414
1449
  width: 140,
1415
1450
  render: (t) => {
1416
- let r = Be(y(e, t.parameter.key));
1417
- return r === "CONSTANT" ? oi(e, t.parameter.key, t.parameter.type, y(e, t.parameter.key), n) : /* @__PURE__ */ _(h, {
1451
+ let r = ze(b(e, t.parameter.key));
1452
+ return r === "CONSTANT" ? li(e, t.parameter.key, t.parameter.type, b(e, t.parameter.key), n) : /* @__PURE__ */ _(h, {
1418
1453
  color: "text-neutral",
1419
1454
  variant: "caption",
1420
1455
  children: r === "EXPRESSION" ? "見下方運算式" : "—"
@@ -1427,7 +1462,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1427
1462
  render: (t) => /* @__PURE__ */ _(h, {
1428
1463
  color: "text-neutral",
1429
1464
  variant: "caption",
1430
- children: ii(y(e, t.parameter.key), t.parameter, n, ti(e, t.parameter, n))
1465
+ children: si(b(e, t.parameter.key), t.parameter, n, ii(e, t.parameter, n))
1431
1466
  }),
1432
1467
  title: "填寫時的行為"
1433
1468
  }
@@ -1437,31 +1472,31 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1437
1472
  showHeader: !0,
1438
1473
  size: "sub"
1439
1474
  }),
1440
- ei(e, t, n)
1475
+ ri(e, t, n)
1441
1476
  ]
1442
1477
  });
1443
1478
  }
1444
- function ei(e, t, n) {
1445
- let r = t.parameters.filter((t) => Be(y(e, t.key)) === "EXPRESSION");
1479
+ function ri(e, t, n) {
1480
+ let r = t.parameters.filter((t) => ze(b(e, t.key)) === "EXPRESSION");
1446
1481
  return r.length === 0 ? null : /* @__PURE__ */ _("div", {
1447
- style: on,
1482
+ style: an,
1448
1483
  children: r.map((t) => {
1449
1484
  let r = `${t.label ?? t.key} 的運算式`;
1450
1485
  return /* @__PURE__ */ v("div", {
1451
1486
  "data-data-source-expression": t.key,
1452
- style: on,
1487
+ style: an,
1453
1488
  children: [
1454
1489
  /* @__PURE__ */ _(h, {
1455
1490
  color: "text-neutral",
1456
1491
  variant: "label-secondary",
1457
1492
  children: r
1458
1493
  }),
1459
- vi({
1494
+ Si({
1460
1495
  name: r,
1461
- onChange: (r) => li(e, t.key, r, n),
1496
+ onChange: (r) => fi(e, t.key, r, n),
1462
1497
  placeholder: n.rowColumns ? "例如:row.plant == \"\" ? form.plant : row.plant" : "例如:form.chargeTo == \"OTHER\" ? \"TW02\" : form.plant",
1463
1498
  rows: 2,
1464
- value: Re(e, t.key) ?? ""
1499
+ value: Le(e, t.key) ?? ""
1465
1500
  }),
1466
1501
  /* @__PURE__ */ _(h, {
1467
1502
  color: "text-neutral",
@@ -1473,61 +1508,61 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1473
1508
  })
1474
1509
  });
1475
1510
  }
1476
- function ti(e, t, n) {
1477
- return ke(t.type, x.fields, e.fieldKey).length + (n.rowColumns ? je(t.type, n.rowColumns, e.fieldKey).length : 0);
1511
+ function ii(e, t, n) {
1512
+ return Oe(t.type, w.fields, e.fieldKey).length + (n.rowColumns ? Ae(t.type, n.rowColumns, e.fieldKey).length : 0);
1478
1513
  }
1479
- function ni(e, t, n) {
1480
- let r = Pn(y(e, t.key)), i = n.rowColumns ? je(t.type, n.rowColumns, e.fieldKey).map((e) => ({
1481
- id: `${xn}${e.id}`,
1514
+ function ai(e, t, n) {
1515
+ let r = Nn(b(e, t.key)), i = n.rowColumns ? Ae(t.type, n.rowColumns, e.fieldKey).map((e) => ({
1516
+ id: `${bn}${e.id}`,
1482
1517
  name: `同列:${e.name}`
1483
1518
  })) : [], a = [
1484
1519
  ...t.required ? [] : [{
1485
- id: Sn,
1520
+ id: xn,
1486
1521
  name: "未綁定"
1487
1522
  }],
1488
1523
  ...i,
1489
- ...ke(t.type, x.fields, e.fieldKey),
1524
+ ...Oe(t.type, w.fields, e.fieldKey),
1490
1525
  ...t.type === "STRING_ARRAY" ? [] : [{
1491
- id: yn,
1526
+ id: vn,
1492
1527
  name: "固定常數"
1493
1528
  }, {
1494
- id: bn,
1529
+ id: yn,
1495
1530
  name: "運算式"
1496
1531
  }],
1497
- ...r === I ? [{
1498
- id: I,
1532
+ ...r === R ? [{
1533
+ id: R,
1499
1534
  name: "不支援的來源(請重新設定)"
1500
1535
  }] : []
1501
1536
  ];
1502
1537
  return /* @__PURE__ */ _("div", {
1503
1538
  "data-data-source-parameter": t.key,
1504
- style: mn,
1539
+ style: pn,
1505
1540
  children: /* @__PURE__ */ _(p, {
1506
1541
  clearable: !1,
1507
1542
  fullWidth: !0,
1508
1543
  inputProps: {
1509
1544
  "aria-label": `${t.label ?? t.key} 的值來源`,
1510
- title: b(a, r)?.name ?? ""
1545
+ title: x(a, r)?.name ?? ""
1511
1546
  },
1512
- onChange: (r) => ci(e, t.key, t.type, r?.id, n),
1547
+ onChange: (r) => di(e, t.key, t.type, r?.id, n),
1513
1548
  options: a,
1514
1549
  placeholder: "選擇欄位或常數",
1515
1550
  size: "sub",
1516
- value: b(a, r)
1551
+ value: x(a, r)
1517
1552
  })
1518
1553
  });
1519
1554
  }
1520
- function ri(e) {
1521
- return Ct[e];
1555
+ function oi(e) {
1556
+ return St[e];
1522
1557
  }
1523
- function ii(e, t, n, r) {
1524
- let i = Be(e);
1525
- return i === "CONSTANT" ? "固定值,不隨填寫變動" : i === "FIELD" ? `隨欄位「${ai(e, n)}」變動` : i === "ROW_FIELD" ? `隨同列「${ai(e, n)}」變動` : i === "EXPRESSION" ? "由運算式計算,隨引用的欄位變動" : e ? "這個來源目前的版本不支援,選項無法載入" : t.required ? r > 0 ? "尚未設定,選項無法載入" : `沒有相容的${ri(t.type)}欄位,請改用固定值` : "未設定,不做這層篩選";
1558
+ function si(e, t, n, r) {
1559
+ let i = ze(e);
1560
+ return i === "CONSTANT" ? "固定值,不隨填寫變動" : i === "FIELD" ? `隨欄位「${ci(e, n)}」變動` : i === "ROW_FIELD" ? `隨同列「${ci(e, n)}」變動` : i === "EXPRESSION" ? "由運算式計算,隨引用的欄位變動" : e ? "這個來源目前的版本不支援,選項無法載入" : t.required ? r > 0 ? "尚未設定,選項無法載入" : `沒有相容的${oi(t.type)}欄位,請改用固定值` : "未設定,不做這層篩選";
1526
1561
  }
1527
- function ai(e, t) {
1562
+ function ci(e, t) {
1528
1563
  let n = e?.from;
1529
1564
  if (n?.kind === "FIELD") {
1530
- let e = x.fields.find((e) => e.fieldKey === n.fieldKey);
1565
+ let e = w.fields.find((e) => e.fieldKey === n.fieldKey);
1531
1566
  return e ? e.label || e.fieldKey : "";
1532
1567
  }
1533
1568
  if (n?.kind === "ROW_FIELD") {
@@ -1536,14 +1571,14 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1536
1571
  }
1537
1572
  return "";
1538
1573
  }
1539
- function oi(e, t, n, r, i) {
1574
+ function li(e, t, n, r, i) {
1540
1575
  return /* @__PURE__ */ _("div", {
1541
1576
  "data-data-source-constant": t,
1542
- children: si(e, t, n, r, i)
1577
+ children: ui(e, t, n, r, i)
1543
1578
  });
1544
1579
  }
1545
- function si(e, t, n, r, i) {
1546
- let a = ze(e, t);
1580
+ function ui(e, t, n, r, i) {
1581
+ let a = Re(e, t);
1547
1582
  if (n === "BOOLEAN") {
1548
1583
  let n = [{
1549
1584
  id: "true",
@@ -1555,10 +1590,10 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1555
1590
  return /* @__PURE__ */ _(p, {
1556
1591
  clearable: !1,
1557
1592
  fullWidth: !0,
1558
- onChange: (n) => ui(e, t, n?.id === "true", i),
1593
+ onChange: (n) => pi(e, t, n?.id === "true", i),
1559
1594
  options: n,
1560
1595
  size: "sub",
1561
- value: b(n, a === !0 ? "true" : "false")
1596
+ value: x(n, a === !0 ? "true" : "false")
1562
1597
  });
1563
1598
  }
1564
1599
  return n === "STRING_ARRAY" ? /* @__PURE__ */ _(h, {
@@ -1566,35 +1601,35 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1566
1601
  variant: "caption",
1567
1602
  children: "這個條件要收多個值,請綁定一個複選欄位;不接受固定值。"
1568
1603
  }) : /* @__PURE__ */ _(f, {
1569
- onChange: (r) => ui(e, t, n === "NUMBER" ? Oe(r.target.value) ?? 0 : r.target.value, i),
1604
+ onChange: (r) => pi(e, t, n === "NUMBER" ? De(r.target.value) ?? 0 : r.target.value, i),
1570
1605
  placeholder: n === "NUMBER" ? "輸入數字" : "輸入固定值",
1571
- value: In(r, n),
1606
+ value: Fn(r, n),
1572
1607
  variant: "base"
1573
1608
  });
1574
1609
  }
1575
- function ci(e, t, n, r, i) {
1576
- r !== I && i.commit(Ke(e, t, Ln(t, n, r)));
1610
+ function di(e, t, n, r, i) {
1611
+ r !== R && $n(e, Ge(e, t, In(t, n, r)), i);
1577
1612
  }
1578
- function li(e, t, n, r) {
1579
- r.commit(Ke(e, t, {
1613
+ function fi(e, t, n, r) {
1614
+ $n(e, Ge(e, t, {
1580
1615
  from: {
1581
1616
  expression: n,
1582
1617
  kind: "EXPRESSION"
1583
1618
  },
1584
1619
  parameter: t
1585
- }));
1620
+ }), r);
1586
1621
  }
1587
- function ui(e, t, n, r) {
1588
- r.commit(Ke(e, t, {
1622
+ function pi(e, t, n, r) {
1623
+ $n(e, Ge(e, t, {
1589
1624
  from: {
1590
1625
  kind: "CONSTANT",
1591
1626
  value: n
1592
1627
  },
1593
1628
  parameter: t
1594
- }));
1629
+ }), r);
1595
1630
  }
1596
- function di(e, t) {
1597
- let n = dt(e), r = Array.isArray(e.defaultValue) ? e.defaultValue : [], i = e.options.map(Le), a = i.filter((e) => r.includes(e.id));
1631
+ function mi(e, t) {
1632
+ let n = ct(e), r = Array.isArray(e.defaultValue) ? e.defaultValue : [], i = e.options.map(Ie), a = i.filter((e) => r.includes(e.id));
1598
1633
  return /* @__PURE__ */ v(g, { children: [$("預設值", "fieldDefaultValue", n === "multiple" ? /* @__PURE__ */ _(p, {
1599
1634
  clearable: !0,
1600
1635
  mode: "multiple",
@@ -1613,10 +1648,10 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1613
1648
  }),
1614
1649
  options: i,
1615
1650
  placeholder: "選擇預設選項",
1616
- value: typeof e.defaultValue == "string" ? b(i, e.defaultValue) : null
1617
- })), $("選項", "fieldOptions", bi(e, t), !0)] });
1651
+ value: typeof e.defaultValue == "string" ? x(i, e.defaultValue) : null
1652
+ })), $("選項", "fieldOptions", wi(e, t), !0)] });
1618
1653
  }
1619
- function fi(e, t) {
1654
+ function hi(e, t) {
1620
1655
  let n = typeof e.defaultValue == "boolean" ? String(e.defaultValue) : "unset";
1621
1656
  return $("預設值", "fieldDefaultValue", /* @__PURE__ */ _(p, {
1622
1657
  clearable: !1,
@@ -1624,12 +1659,12 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1624
1659
  ...e,
1625
1660
  defaultValue: n?.id === "true" || n?.id !== "false" && void 0
1626
1661
  }),
1627
- options: [...Tn],
1662
+ options: [...wn],
1628
1663
  placeholder: "選擇預設狀態",
1629
- value: b(Tn, n)
1664
+ value: x(wn, n)
1630
1665
  }));
1631
1666
  }
1632
- function pi(e, t) {
1667
+ function gi(e, t) {
1633
1668
  return $("可複選", "fieldMemberMultiple", /* @__PURE__ */ _(m, {
1634
1669
  checked: e.multiple === !0,
1635
1670
  label: e.multiple === !0 ? "可選多位" : "只能選一位",
@@ -1641,38 +1676,38 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1641
1676
  size: "sub"
1642
1677
  }));
1643
1678
  }
1644
- function mi(e, t) {
1679
+ function _i(e, t) {
1645
1680
  return /* @__PURE__ */ v(g, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (n) => t({
1646
1681
  ...e,
1647
1682
  maxFiles: n
1648
- }), "例如:1", { min: 1 })), $("MIME", "fieldAcceptedMimeTypes", vi({
1683
+ }), "例如:1", { min: 1 })), $("MIME", "fieldAcceptedMimeTypes", Si({
1649
1684
  name: "fieldAcceptedMimeTypes",
1650
1685
  onChange: (n) => t({
1651
1686
  ...e,
1652
- acceptedMimeTypes: Xn(n)
1687
+ acceptedMimeTypes: Yn(n)
1653
1688
  }),
1654
1689
  placeholder: "每行一個 MIME type,例如:application/pdf",
1655
1690
  rows: 3,
1656
- value: Zn(e.acceptedMimeTypes)
1691
+ value: Xn(e.acceptedMimeTypes)
1657
1692
  }), !1)] });
1658
1693
  }
1659
- function hi(e) {
1660
- let t = x.fields.filter((t) => t.fieldKey !== e.fieldKey && !ct(t) && !lt(t));
1661
- return t.length ? /* @__PURE__ */ _(g, { children: Dn.map((n) => gi(e, n, t)) }) : /* @__PURE__ */ _(h, {
1694
+ function vi(e) {
1695
+ let t = w.fields.filter((t) => t.fieldKey !== e.fieldKey && !at(t) && !ot(t));
1696
+ return t.length ? /* @__PURE__ */ _(g, { children: En.map((n) => yi(e, n, t)) }) : /* @__PURE__ */ _(h, {
1662
1697
  color: "text-neutral",
1663
- style: F,
1698
+ style: L,
1664
1699
  variant: "body",
1665
1700
  children: "目前沒有其他欄位可作為條件來源。新增更多欄位後即可設定條件規則。"
1666
1701
  });
1667
1702
  }
1668
- function gi(e, t, n) {
1669
- let r = e[t.target], i = r ? De(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(qn), c = Ne(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Fe(o), u = i?.value ?? Ie(o), d = !!r, ee = d && (!i || !a);
1703
+ function yi(e, t, n) {
1704
+ let r = e[t.target], i = r ? Ee(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(Kn), c = Me(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Pe(o), u = i?.value ?? Fe(o), d = !!r, ee = d && (!i || !a);
1670
1705
  return $(t.label, t.name, /* @__PURE__ */ v("div", {
1671
- style: Xt,
1706
+ style: Yt,
1672
1707
  children: [/* @__PURE__ */ _(m, {
1673
1708
  checked: d,
1674
1709
  label: d ? "已啟用" : "不啟用",
1675
- onChange: (e) => Z(t.target, e.target.checked ? me(o, Fe(o), Ie(o)) : void 0),
1710
+ onChange: (e) => bi(t.target, e.target.checked ? y(o, Pe(o), Fe(o)) : void 0),
1676
1711
  size: "sub",
1677
1712
  supportingText: t.supportingText
1678
1713
  }), d ? ee ? /* @__PURE__ */ _(h, {
@@ -1680,67 +1715,67 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1680
1715
  variant: "body",
1681
1716
  children: "這個規則不是目前 UI 支援的格式。重新選擇條件後會取代既有規則。"
1682
1717
  }) : /* @__PURE__ */ v("div", {
1683
- style: Zt,
1718
+ style: Xt,
1684
1719
  children: [
1685
1720
  /* @__PURE__ */ _(p, {
1686
1721
  clearable: !1,
1687
1722
  onChange: (e) => {
1688
1723
  let r = n.find((t) => t.fieldKey === e?.id) ?? o;
1689
- Z(t.target, me(r, Fe(r), Ie(r)));
1724
+ bi(t.target, y(r, Pe(r), Fe(r)));
1690
1725
  },
1691
1726
  options: s,
1692
1727
  placeholder: "選擇欄位",
1693
- value: b(s, o.fieldKey)
1728
+ value: x(s, o.fieldKey)
1694
1729
  }),
1695
1730
  /* @__PURE__ */ _(p, {
1696
1731
  clearable: !1,
1697
- onChange: (e) => Z(t.target, me(o, Me(e?.id) ?? l, u)),
1732
+ onChange: (e) => bi(t.target, y(o, je(e?.id) ?? l, u)),
1698
1733
  options: [...c],
1699
1734
  placeholder: "判斷方式",
1700
- value: b(c, l)
1735
+ value: x(c, l)
1701
1736
  }),
1702
- _i(o, u, (e) => Z(t.target, me(o, l, e)))
1737
+ xi(o, u, (e) => bi(t.target, y(o, l, e)))
1703
1738
  ]
1704
1739
  }) : null]
1705
1740
  }), !0);
1706
1741
  }
1707
- function Z(e, t) {
1708
- hr({ [e]: t });
1742
+ function bi(e, t) {
1743
+ _r({ [e]: t });
1709
1744
  }
1710
- function _i(e, t, n) {
1745
+ function xi(e, t, n) {
1711
1746
  if (e.type === "boolean") return /* @__PURE__ */ _(p, {
1712
1747
  clearable: !1,
1713
1748
  onChange: (e) => n(e?.id ?? "true"),
1714
- options: [...En],
1749
+ options: [...Tn],
1715
1750
  placeholder: "比較值",
1716
- value: b(En, t === "false" ? "false" : "true")
1751
+ value: x(Tn, t === "false" ? "false" : "true")
1717
1752
  });
1718
- if (we(e)) {
1719
- let r = e.options.map(Le);
1753
+ if (Ce(e)) {
1754
+ let r = e.options.map(Ie);
1720
1755
  return /* @__PURE__ */ _(p, {
1721
1756
  clearable: !1,
1722
1757
  onChange: (e) => n(e?.id ?? r[0]?.id ?? ""),
1723
1758
  options: r,
1724
1759
  placeholder: "比較值",
1725
- value: b(r, t)
1760
+ value: x(r, t)
1726
1761
  });
1727
1762
  }
1728
- return Ce(e) ? Q(Oe(t), (e) => n(String(e ?? 0)), "比較值") : xe(e) ? yi(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ _(f, {
1763
+ return Se(e) ? Q(De(t), (e) => n(String(e ?? 0)), "比較值") : be(e) ? Ci(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ _(f, {
1729
1764
  onChange: (e) => n(e.target.value),
1730
1765
  placeholder: "比較值",
1731
1766
  value: t,
1732
1767
  variant: "base"
1733
1768
  });
1734
1769
  }
1735
- function vi({ name: e, onChange: t, placeholder: n, rows: r, value: i }) {
1770
+ function Si({ name: e, onChange: t, placeholder: n, rows: r, value: i }) {
1736
1771
  return /* @__PURE__ */ _(ce, {
1737
1772
  "aria-label": e,
1738
1773
  onChange: (e) => t(e.target.value),
1739
1774
  placeholder: n,
1740
- ref: hn,
1775
+ ref: mn,
1741
1776
  resize: "vertical",
1742
1777
  rows: r,
1743
- style: Gt,
1778
+ style: Wt,
1744
1779
  value: i
1745
1780
  });
1746
1781
  }
@@ -1748,7 +1783,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1748
1783
  return /* @__PURE__ */ _(f, {
1749
1784
  max: r.max,
1750
1785
  min: r.min,
1751
- onChange: (e) => t(ge(Oe(e.target.value), r)),
1786
+ onChange: (e) => t(he(De(e.target.value), r)),
1752
1787
  placeholder: n,
1753
1788
  showSpinner: !0,
1754
1789
  step: r.step ?? 1,
@@ -1756,23 +1791,23 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1756
1791
  variant: "measure"
1757
1792
  });
1758
1793
  }
1759
- function yi(e, t, n) {
1794
+ function Ci(e, t, n) {
1760
1795
  return e.type === "datetime" ? /* @__PURE__ */ _(u, {
1761
1796
  formatDate: "YYYY-MM-DD",
1762
1797
  formatTime: "HH:mm",
1763
1798
  hideSecond: !0,
1764
- onChange: (e) => n(be(e)),
1799
+ onChange: (e) => n(ye(e)),
1765
1800
  placeholderLeft: "選擇日期",
1766
1801
  placeholderRight: "選擇時間",
1767
- value: Pe(t)
1802
+ value: Ne(t)
1768
1803
  }) : /* @__PURE__ */ _(l, {
1769
1804
  format: "YYYY-MM-DD",
1770
- onChange: (e) => n(ye(e)),
1805
+ onChange: (e) => n(ve(e)),
1771
1806
  placeholder: "選擇日期",
1772
- value: Pe(t)
1807
+ value: Ne(t)
1773
1808
  });
1774
1809
  }
1775
- function bi(e, t) {
1810
+ function wi(e, t) {
1776
1811
  let n = e.options.map((t, n) => ({
1777
1812
  index: n,
1778
1813
  key: `${e.fieldKey}-${n}`,
@@ -1780,12 +1815,12 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1780
1815
  value: t.value
1781
1816
  }));
1782
1817
  return /* @__PURE__ */ v("div", {
1783
- style: en,
1818
+ style: $t,
1784
1819
  children: [/* @__PURE__ */ _(oe, {
1785
1820
  actions: {
1786
1821
  render: (n) => [{
1787
1822
  disabled: () => e.options.length <= 1,
1788
- icon: tt,
1823
+ icon: Qe,
1789
1824
  iconType: "icon-only",
1790
1825
  name: "移除選項",
1791
1826
  onClick: () => t({
@@ -1801,7 +1836,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1801
1836
  render: (n) => /* @__PURE__ */ _(f, {
1802
1837
  onChange: (r) => t({
1803
1838
  ...e,
1804
- options: Qn(e.options, n.index, { label: r.target.value })
1839
+ options: er(e.options, n.index, { label: r.target.value })
1805
1840
  }),
1806
1841
  placeholder: "例如:主管",
1807
1842
  size: "sub",
@@ -1814,7 +1849,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1814
1849
  render: (n) => /* @__PURE__ */ _(f, {
1815
1850
  onChange: (r) => t({
1816
1851
  ...e,
1817
- options: Qn(e.options, n.index, { value: r.target.value })
1852
+ options: er(e.options, n.index, { value: r.target.value })
1818
1853
  }),
1819
1854
  placeholder: "例如:manager",
1820
1855
  size: "sub",
@@ -1827,13 +1862,13 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1827
1862
  showHeader: !0,
1828
1863
  size: "sub"
1829
1864
  }), /* @__PURE__ */ _("div", {
1830
- style: tn,
1865
+ style: en,
1831
1866
  children: /* @__PURE__ */ _(c, {
1832
- icon: et,
1867
+ icon: Ze,
1833
1868
  iconType: "leading",
1834
1869
  onClick: () => t({
1835
1870
  ...e,
1836
- options: [...e.options, $n(e.options)]
1871
+ options: [...e.options, tr(e.options)]
1837
1872
  }),
1838
1873
  variant: "base-secondary",
1839
1874
  children: "新增選項"
@@ -1841,27 +1876,27 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1841
1876
  })]
1842
1877
  });
1843
1878
  }
1844
- function xi(e, t, n) {
1879
+ function Ti(e, t, n) {
1845
1880
  return /* @__PURE__ */ _("div", {
1846
1881
  ...t.draggableProps,
1847
1882
  "data-form-builder-field-key": e.fieldKey,
1848
1883
  ref: t.innerRef,
1849
1884
  style: {
1850
- ...Nt,
1851
- ...n ? Pt : null,
1885
+ ...Mt,
1886
+ ...n ? Nt : null,
1852
1887
  ...t.draggableProps.style
1853
1888
  },
1854
1889
  children: /* @__PURE__ */ _(s, {
1855
- style: e.fieldKey === q?.fieldKey ? Ft : void 0,
1856
- children: Si(e, t, n)
1890
+ style: e.fieldKey === J?.fieldKey ? Pt : void 0,
1891
+ children: Ei(e, t, n)
1857
1892
  })
1858
1893
  });
1859
1894
  }
1860
1895
  function $(t, n, r, i = !1, a) {
1861
1896
  return /* @__PURE__ */ _("div", {
1862
- style: i ? Ut : Ht,
1897
+ style: i ? Ht : Vt,
1863
1898
  children: /* @__PURE__ */ _("div", {
1864
- style: Wt,
1899
+ style: Ut,
1865
1900
  children: /* @__PURE__ */ _(e, {
1866
1901
  label: t,
1867
1902
  layout: i ? de.VERTICAL : de.STRETCH,
@@ -1875,33 +1910,33 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1875
1910
  })
1876
1911
  });
1877
1912
  }
1878
- function Si(e, t, n) {
1913
+ function Ei(e, t, n) {
1879
1914
  return /* @__PURE__ */ v("div", {
1880
1915
  ...t.dragHandleProps ?? {},
1881
1916
  "aria-label": "選取或拖曳排序欄位",
1882
- onClick: () => B(e.fieldKey),
1883
- style: kt,
1917
+ onClick: () => V(e.fieldKey),
1918
+ style: Ot,
1884
1919
  title: "點擊選取,拖曳排序",
1885
1920
  children: [
1886
1921
  /* @__PURE__ */ _("span", {
1887
1922
  "aria-label": "拖曳排序",
1888
1923
  role: "img",
1889
- style: Qt,
1924
+ style: Zt,
1890
1925
  title: "拖曳排序",
1891
1926
  children: /* @__PURE__ */ _(d, {
1892
- icon: Qe,
1927
+ icon: Ye,
1893
1928
  size: 20
1894
1929
  })
1895
1930
  }),
1896
1931
  /* @__PURE__ */ v("div", {
1897
- style: At,
1932
+ style: kt,
1898
1933
  children: [/* @__PURE__ */ v(h, {
1899
1934
  component: "span",
1900
1935
  ellipsis: !0,
1901
1936
  variant: "label-primary",
1902
1937
  children: [e.label, e.required ? /* @__PURE__ */ _("sup", {
1903
1938
  "aria-label": "必填",
1904
- style: nn,
1939
+ style: tn,
1905
1940
  children: "*"
1906
1941
  }) : null]
1907
1942
  }), /* @__PURE__ */ v(h, {
@@ -1910,7 +1945,7 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1910
1945
  ellipsis: !0,
1911
1946
  variant: "caption",
1912
1947
  children: [
1913
- An(e.type),
1948
+ kn(e.type),
1914
1949
  " ·",
1915
1950
  e.required ? " 必填" : " 選填",
1916
1951
  " ·",
@@ -1921,20 +1956,20 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1921
1956
  }),
1922
1957
  /* @__PURE__ */ v("div", {
1923
1958
  onClick: (e) => e.stopPropagation(),
1924
- style: jt,
1959
+ style: At,
1925
1960
  children: [/* @__PURE__ */ _("div", {
1926
- style: Mt,
1961
+ style: jt,
1927
1962
  children: /* @__PURE__ */ _(m, {
1928
1963
  checked: !!e.required,
1929
1964
  disabled: n || e.hidden === !0,
1930
1965
  label: "必填",
1931
- onChange: (t) => Mr(e.fieldKey, t.target.checked)
1966
+ onChange: (t) => Pr(e.fieldKey, t.target.checked)
1932
1967
  })
1933
1968
  }), /* @__PURE__ */ _(c, {
1934
1969
  disabled: n,
1935
- icon: tt,
1970
+ icon: Qe,
1936
1971
  iconType: "icon-only",
1937
- onClick: () => fr(e.fieldKey),
1972
+ onClick: () => mr(e.fieldKey),
1938
1973
  variant: "destructive-ghost",
1939
1974
  children: "移除欄位"
1940
1975
  })]
@@ -1942,61 +1977,61 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
1942
1977
  ]
1943
1978
  });
1944
1979
  }
1945
- function Ci() {
1980
+ function Di() {
1946
1981
  return /* @__PURE__ */ v("div", {
1947
- style: P,
1982
+ style: I,
1948
1983
  children: [/* @__PURE__ */ _(h, {
1949
1984
  component: "h2",
1950
1985
  variant: "h3",
1951
1986
  children: "填寫預覽"
1952
1987
  }), /* @__PURE__ */ _(t, {
1953
1988
  dataSourceContext: { kind: "preview" },
1954
- onChange: jr,
1955
- schema: x,
1956
- uiSchema: C,
1957
- value: at
1989
+ onChange: Nr,
1990
+ schema: w,
1991
+ uiSchema: E,
1992
+ value: nt
1958
1993
  })]
1959
1994
  });
1960
1995
  }
1961
- function wi() {
1996
+ function Oi() {
1962
1997
  return /* @__PURE__ */ v("div", {
1963
- style: P,
1998
+ style: I,
1964
1999
  children: [/* @__PURE__ */ _(h, {
1965
2000
  component: "h2",
1966
2001
  variant: "h3",
1967
2002
  children: "Schema"
1968
2003
  }), /* @__PURE__ */ v("div", {
1969
- style: Kt,
2004
+ style: Gt,
1970
2005
  children: [
1971
- Ti("Form Schema", "schemaJson", /* @__PURE__ */ _(_t, {
2006
+ ki("Form Schema", "schemaJson", /* @__PURE__ */ _(gt, {
1972
2007
  height: "360px",
1973
2008
  name: "schemaJson",
1974
- onChange: Nr,
2009
+ onChange: Fr,
1975
2010
  placeholder: "輸入 Form Schema JSON",
1976
- value: nt
2011
+ value: $e
1977
2012
  })),
1978
- Ti("UI Schema", "uiSchemaJson", /* @__PURE__ */ _(_t, {
2013
+ ki("UI Schema", "uiSchemaJson", /* @__PURE__ */ _(gt, {
1979
2014
  height: "240px",
1980
2015
  name: "uiSchemaJson",
1981
- onChange: Pr,
2016
+ onChange: Ir,
1982
2017
  placeholder: "輸入 UI Schema JSON",
1983
- value: it
2018
+ value: tt
1984
2019
  })),
1985
- ht ? /* @__PURE__ */ _(h, {
2020
+ ft ? /* @__PURE__ */ _(h, {
1986
2021
  color: "text-error",
1987
- style: Yt,
2022
+ style: Jt,
1988
2023
  variant: "body",
1989
- children: ht
2024
+ children: ft
1990
2025
  }) : null
1991
2026
  ]
1992
2027
  })]
1993
2028
  });
1994
2029
  }
1995
- function Ti(t, n, r) {
2030
+ function ki(t, n, r) {
1996
2031
  return /* @__PURE__ */ _("div", {
1997
- style: qt,
2032
+ style: Kt,
1998
2033
  children: /* @__PURE__ */ _("div", {
1999
- style: Jt,
2034
+ style: qt,
2000
2035
  children: /* @__PURE__ */ _(e, {
2001
2036
  label: t,
2002
2037
  name: n,
@@ -2006,40 +2041,40 @@ function L({ formDefinitionId: qe, onChange: Je, templateId: Ye, value: Xe }) {
2006
2041
  });
2007
2042
  }
2008
2043
  }
2009
- function An(e) {
2010
- return vt.find((t) => t.type === e)?.label ?? e;
2044
+ function kn(e) {
2045
+ return _t.find((t) => t.type === e)?.label ?? e;
2011
2046
  }
2012
- function jn(e) {
2047
+ function An(e) {
2013
2048
  return `${e.key}@${e.version}`;
2014
2049
  }
2015
- function Mn(e) {
2050
+ function jn(e) {
2016
2051
  return [
2017
2052
  e.supportsSearch ? `可輸入關鍵字搜尋${e.minimumSearchLength > 1 ? `(至少 ${e.minimumSearchLength} 字)` : ""}` : "不支援搜尋",
2018
2053
  e.paginationMode === "CURSOR" ? `捲動載入更多(每次 ${e.pageSize} 筆)` : `一次載入完整清單(最多 ${e.maximumResultCount} 筆)`,
2019
2054
  e.revalidationPolicy === "ALWAYS" ? "退回重送時一律重新確認" : "值與條件未變時沿用上次結果"
2020
2055
  ];
2021
2056
  }
2022
- function Nn(e) {
2057
+ function Mn(e) {
2023
2058
  return {
2024
- id: jn(e),
2059
+ id: An(e),
2025
2060
  name: e.label
2026
2061
  };
2027
2062
  }
2028
- function Pn(e) {
2029
- if (!e) return Sn;
2063
+ function Nn(e) {
2064
+ if (!e) return xn;
2030
2065
  let t = e.from;
2031
2066
  switch (t.kind) {
2032
2067
  case "FIELD": return t.fieldKey;
2033
- case "ROW_FIELD": return `${xn}${t.columnKey}`;
2034
- case "CONSTANT": return yn;
2035
- case "EXPRESSION": return bn;
2036
- default: return R(t);
2068
+ case "ROW_FIELD": return `${bn}${t.columnKey}`;
2069
+ case "CONSTANT": return vn;
2070
+ case "EXPRESSION": return yn;
2071
+ default: return Pn(t);
2037
2072
  }
2038
2073
  }
2039
- function R(e) {
2040
- return I;
2074
+ function Pn(e) {
2075
+ return R;
2041
2076
  }
2042
- function Fn(e) {
2077
+ function B(e) {
2043
2078
  switch (e) {
2044
2079
  case "BOOLEAN": return !1;
2045
2080
  case "NUMBER": return 0;
@@ -2048,24 +2083,24 @@ function Fn(e) {
2048
2083
  default: return "";
2049
2084
  }
2050
2085
  }
2051
- function In(e, t) {
2086
+ function Fn(e, t) {
2052
2087
  let n = e?.from.kind === "CONSTANT" ? e.from.value : "";
2053
2088
  return t === "NUMBER" ? typeof n == "number" ? String(n) : "" : typeof n == "string" ? n : "";
2054
2089
  }
2055
- function Ln(e, t, n) {
2056
- return !n || n === Sn ? null : n === bn ? {
2090
+ function In(e, t, n) {
2091
+ return !n || n === xn ? null : n === yn ? {
2057
2092
  from: {
2058
2093
  expression: "",
2059
2094
  kind: "EXPRESSION"
2060
2095
  },
2061
2096
  parameter: e
2062
- } : n === yn ? {
2097
+ } : n === vn ? {
2063
2098
  from: {
2064
2099
  kind: "CONSTANT",
2065
- value: Fn(t)
2100
+ value: B(t)
2066
2101
  },
2067
2102
  parameter: e
2068
- } : n.startsWith(xn) ? {
2103
+ } : n.startsWith(bn) ? {
2069
2104
  from: {
2070
2105
  columnKey: n.slice(14),
2071
2106
  kind: "ROW_FIELD"
@@ -2079,46 +2114,46 @@ function Ln(e, t, n) {
2079
2114
  parameter: e
2080
2115
  };
2081
2116
  }
2082
- function Rn(e) {
2117
+ function Ln(e) {
2083
2118
  return e.kind === "remove-field" ? "確認移除 dependency 欄位" : e.kind === "remove-column" ? "確認移除表格欄" : e.kind === "replace-column" ? "確認變更欄型別" : "確認變更選擇模式";
2084
2119
  }
2085
- var z = [{
2120
+ var V = [{
2086
2121
  label: "選項 A",
2087
2122
  value: "option_a"
2088
2123
  }, {
2089
2124
  label: "選項 B",
2090
2125
  value: "option_b"
2091
2126
  }];
2092
- function zn(e) {
2127
+ function Rn(e) {
2093
2128
  let t = [];
2094
- 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("數值範圍"), D(e) ? t.push("選項來源設定") : st(e) && !B(e.options) && t.push(`${e.options.length} 個選項`), (e.type === "select" || e.type === "autocomplete") && e.mode === "multiple" && t.push("選擇模式"), t;
2129
+ 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("數值範圍"), A(e) ? t.push("選項來源設定") : it(e) && !H(e.options) && t.push(`${e.options.length} 個選項`), (e.type === "select" || e.type === "autocomplete") && e.mode === "multiple" && t.push("選擇模式"), t;
2095
2130
  }
2096
- function B(e) {
2097
- return e.length === z.length && e.every((e, t) => e.label === z[t]?.label && e.value === z[t]?.value);
2131
+ function H(e) {
2132
+ return e.length === V.length && e.every((e, t) => e.label === V[t]?.label && e.value === V[t]?.value);
2098
2133
  }
2099
- function Bn(e, t) {
2134
+ function zn(e, t) {
2100
2135
  return t ? {
2101
2136
  ...e,
2102
2137
  pattern: t
2103
2138
  } : Object.fromEntries(Object.entries(e).filter(([e]) => e !== "pattern" && e !== "patternErrorMessage"));
2104
2139
  }
2105
- function Vn(e, t) {
2140
+ function Bn(e, t) {
2106
2141
  return t ? {
2107
2142
  ...e,
2108
2143
  patternErrorMessage: t
2109
2144
  } : Object.fromEntries(Object.entries(e).filter(([e]) => e !== "patternErrorMessage"));
2110
2145
  }
2111
- function Hn(e) {
2146
+ function Vn(e) {
2112
2147
  return e && !e.trim() ? {
2113
2148
  severity: "error",
2114
2149
  text: "格式不能只有空白,儲存時會被拒絕。"
2115
- } : e && e.length > it ? {
2150
+ } : e && e.length > tt ? {
2116
2151
  severity: "error",
2117
- text: `格式最多 ${it} 個字元,儲存時會被拒絕。`
2118
- } : e && !E(e) ? {
2152
+ text: `格式最多 ${tt} 個字元,儲存時會被拒絕。`
2153
+ } : e && !k(e) ? {
2119
2154
  severity: "error",
2120
2155
  text: "這不是有效的正規表示式,儲存時會被拒絕。格式以 u 模式檢查,多餘的跳脫(例如在方括號 [ ] 外寫 \\-)也算錯誤。"
2121
- } : e && at(e) ? {
2156
+ } : e && nt(e) ? {
2122
2157
  severity: "error",
2123
2158
  text: "格式裡的括號群組後面不能接重複次數(例如 (ab)+、(\\w|\\d)*、(ab){2}),填寫的內容可能讓系統卡住,儲存時會被拒絕。請把重複的部分直接寫出來,或改用 [ ] 字元集合加次數。"
2124
2159
  } : {
@@ -2126,13 +2161,13 @@ function Hn(e) {
2126
2161
  text: "填寫的內容要整段符合格式才能送出;留空表示不檢查格式。"
2127
2162
  };
2128
2163
  }
2129
- function Un(e) {
2130
- return e && e.length > T ? {
2164
+ function Hn(e) {
2165
+ return e && e.length > O ? {
2131
2166
  severity: "error",
2132
- text: `錯誤訊息最多 ${T} 個字元,儲存時會被拒絕。`
2167
+ text: `錯誤訊息最多 ${O} 個字元,儲存時會被拒絕。`
2133
2168
  } : void 0;
2134
2169
  }
2135
- function Wn(e, t) {
2170
+ function Un(e, t) {
2136
2171
  let n = {
2137
2172
  fieldKey: e.fieldKey,
2138
2173
  label: e.label,
@@ -2143,59 +2178,85 @@ function Wn(e, t) {
2143
2178
  return t === "select" || t === "autocomplete" ? {
2144
2179
  ...n,
2145
2180
  mode: "single",
2146
- options: [...z],
2181
+ options: [...V],
2147
2182
  type: t
2148
2183
  } : {
2149
2184
  ...n,
2150
2185
  type: t
2151
2186
  };
2152
2187
  }
2153
- function Gn(e, t) {
2188
+ function Wn(e, t) {
2154
2189
  return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
2155
2190
  }
2156
- function Kn(e) {
2191
+ function Gn(e) {
2157
2192
  return !!(e.visibleWhen || e.requiredWhen || e.readonlyWhen);
2158
2193
  }
2159
- function qn(e) {
2194
+ function Kn(e) {
2160
2195
  return {
2161
2196
  id: e.fieldKey,
2162
2197
  name: e.label
2163
2198
  };
2164
2199
  }
2165
- function Jn(e) {
2200
+ function qn(e) {
2166
2201
  return e.type === "text" || e.type === "textarea";
2167
2202
  }
2168
- function Yn(e) {
2203
+ function Jn(e) {
2169
2204
  return typeof e == "string" ? e : "";
2170
2205
  }
2171
- function Xn(e) {
2206
+ function Yn(e) {
2172
2207
  let t = e.split(/[\n,]/u).map((e) => e.trim()).filter(Boolean);
2173
2208
  return t.length ? t : void 0;
2174
2209
  }
2175
- function Zn(e) {
2210
+ function Xn(e) {
2176
2211
  return e?.join("\n") ?? "";
2177
2212
  }
2178
- function V(e) {
2213
+ function Zn(e) {
2214
+ return e.dataSource.bindings.some((e) => e.from.kind !== "CONSTANT");
2215
+ }
2216
+ function Qn({ disabled: e, onCommit: t, value: n }) {
2217
+ let [r, a] = i(Xn(n));
2218
+ return /* @__PURE__ */ _(ce, {
2219
+ "aria-label": "fieldDefaultValue",
2220
+ disabled: e,
2221
+ onBlur: () => t(Yn(r)),
2222
+ onChange: (e) => a(e.target.value),
2223
+ placeholder: "每行或以逗號分隔一個預設值",
2224
+ ref: mn,
2225
+ resize: "vertical",
2226
+ rows: 3,
2227
+ style: Wt,
2228
+ value: r
2229
+ });
2230
+ }
2231
+ function $n(e, t, n) {
2232
+ if (e.defaultValue === void 0 || Zn(e) || !Zn(t)) {
2233
+ n.commit(t);
2234
+ return;
2235
+ }
2236
+ let { defaultValue: r, ...i } = t;
2237
+ n.requestDependencyChange(e, i, P);
2238
+ }
2239
+ function U(e) {
2179
2240
  return JSON.stringify(e, null, 2);
2180
2241
  }
2181
- function Qn(e, t, n) {
2242
+ function er(e, t, n) {
2182
2243
  return e.map((e, r) => r === t ? {
2183
2244
  ...e,
2184
2245
  ...n
2185
2246
  } : e);
2186
2247
  }
2187
- function $n(e) {
2248
+ function tr(e) {
2188
2249
  let t = e.length + 1;
2189
2250
  return {
2190
2251
  label: `選項 ${t}`,
2191
- value: H(e, t)
2252
+ value: nr(e, t)
2192
2253
  };
2193
2254
  }
2194
- function H(e, t) {
2255
+ function nr(e, t) {
2195
2256
  let n = `option_${t}`;
2196
- return e.some((e) => e.value === n) ? H(e, t + 1) : n;
2257
+ return e.some((e) => e.value === n) ? nr(e, t + 1) : n;
2197
2258
  }
2198
- function er(e, t, n) {
2259
+ function rr(e, t, n) {
2199
2260
  let r = e[t];
2200
2261
  if (!r || t === n) return [...e];
2201
2262
  let i = e.filter((e, n) => n !== t);
@@ -2205,6 +2266,6 @@ function er(e, t, n) {
2205
2266
  ...i.slice(n)
2206
2267
  ];
2207
2268
  }
2208
- export { L as t };
2269
+ export { z as t };
2209
2270
 
2210
- //# sourceMappingURL=FormBuilderView-DbfbLZCI.js.map
2271
+ //# sourceMappingURL=FormBuilderView-CBvdcg_t.js.map