@rytass/bpm-core-react 0.3.0 → 0.3.2

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 (184) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +13 -1
  3. package/dist/chunks/app-navigation-BSkMsEhy.js +268 -0
  4. package/dist/chunks/app-navigation-BSkMsEhy.js.map +1 -0
  5. package/dist/chunks/app-navigation-KnlJCUp1.cjs +2 -0
  6. package/dist/chunks/app-navigation-KnlJCUp1.cjs.map +1 -0
  7. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs +2 -0
  8. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs.map +1 -0
  9. package/dist/chunks/{approval-instance-list-page-BgE4vQw8.js → approval-instance-list-page-CqNdoZqx.js} +103 -99
  10. package/dist/chunks/approval-instance-list-page-CqNdoZqx.js.map +1 -0
  11. package/dist/chunks/builder-CMlJfQHE.cjs +3 -0
  12. package/dist/chunks/builder-CMlJfQHE.cjs.map +1 -0
  13. package/dist/chunks/{builder-Du_0apkh.js → builder-D950gct_.js} +436 -432
  14. package/dist/chunks/builder-D950gct_.js.map +1 -0
  15. package/dist/chunks/categories-5yEM3p3N.cjs +2 -0
  16. package/dist/chunks/categories-5yEM3p3N.cjs.map +1 -0
  17. package/dist/chunks/categories-BIpOG451.js +387 -0
  18. package/dist/chunks/categories-BIpOG451.js.map +1 -0
  19. package/dist/chunks/dashboard-page-1K_jQXQk.cjs +2 -0
  20. package/dist/chunks/dashboard-page-1K_jQXQk.cjs.map +1 -0
  21. package/dist/chunks/dashboard-page-R_T2OEiE.js +122 -0
  22. package/dist/chunks/dashboard-page-R_T2OEiE.js.map +1 -0
  23. package/dist/chunks/delegations-B2j-wNEO.js +646 -0
  24. package/dist/chunks/delegations-B2j-wNEO.js.map +1 -0
  25. package/dist/chunks/delegations-CsB9ozLu.cjs +2 -0
  26. package/dist/chunks/delegations-CsB9ozLu.cjs.map +1 -0
  27. package/dist/chunks/delegations-CvtwTXNP.cjs +2 -0
  28. package/dist/chunks/delegations-CvtwTXNP.cjs.map +1 -0
  29. package/dist/chunks/delegations-dKodb0WW.js +573 -0
  30. package/dist/chunks/delegations-dKodb0WW.js.map +1 -0
  31. package/dist/chunks/detail-BcGAqJ_R.js +1523 -0
  32. package/dist/chunks/detail-BcGAqJ_R.js.map +1 -0
  33. package/dist/chunks/detail-CqjqLd65.cjs +2 -0
  34. package/dist/chunks/detail-CqjqLd65.cjs.map +1 -0
  35. package/dist/chunks/{format-date-time-hKLVMxq4.cjs → format-date-time-26_pFvv4.cjs} +2 -2
  36. package/dist/chunks/{format-date-time-hKLVMxq4.cjs.map → format-date-time-26_pFvv4.cjs.map} +1 -1
  37. package/dist/chunks/notifications-2swRqDPF.js +198 -0
  38. package/dist/chunks/notifications-2swRqDPF.js.map +1 -0
  39. package/dist/chunks/notifications-BaYDebFt.cjs +2 -0
  40. package/dist/chunks/notifications-BaYDebFt.cjs.map +1 -0
  41. package/dist/chunks/{orgs-c29y74w2.js → orgs-CuHxxd_n.js} +665 -661
  42. package/dist/chunks/orgs-CuHxxd_n.js.map +1 -0
  43. package/dist/chunks/orgs-YMiVLNvL.cjs +2 -0
  44. package/dist/chunks/orgs-YMiVLNvL.cjs.map +1 -0
  45. package/dist/chunks/routes-config-2aKbWq2H.cjs +2 -0
  46. package/dist/chunks/routes-config-2aKbWq2H.cjs.map +1 -0
  47. package/dist/chunks/routes-config-dxahImVe.js +43 -0
  48. package/dist/chunks/routes-config-dxahImVe.js.map +1 -0
  49. package/dist/chunks/templates-DTkbSgFY.cjs +2 -0
  50. package/dist/chunks/templates-DTkbSgFY.cjs.map +1 -0
  51. package/dist/chunks/{templates-Dn9QHFSy.js → templates-DoDWM68t.js} +136 -132
  52. package/dist/chunks/templates-DoDWM68t.js.map +1 -0
  53. package/dist/chunks/users-3ySyUW4u.cjs +2 -0
  54. package/dist/chunks/users-3ySyUW4u.cjs.map +1 -0
  55. package/dist/chunks/users-sMfrSjRQ.js +219 -0
  56. package/dist/chunks/users-sMfrSjRQ.js.map +1 -0
  57. package/dist/components/app-navigation.d.ts +17 -10
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.ts +1 -0
  61. package/dist/index.js +101 -99
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/notification-drawer-provider.d.ts +1 -1
  64. package/dist/lib/notification-unread-provider.d.ts +1 -1
  65. package/dist/lib/providers.d.ts +1 -1
  66. package/dist/lib/routes-config.d.ts +96 -0
  67. package/dist/next/index.cjs +1 -1
  68. package/dist/next/index.cjs.map +1 -1
  69. package/dist/next/index.d.ts +1 -0
  70. package/dist/next/index.js +22 -21
  71. package/dist/next/index.js.map +1 -1
  72. package/dist/pages/admin/delegations/index.cjs +1 -1
  73. package/dist/pages/admin/delegations/index.js +1 -1
  74. package/dist/pages/admin/orgs/index.cjs +1 -1
  75. package/dist/pages/admin/orgs/index.js +1 -1
  76. package/dist/pages/admin/users/index.cjs +1 -1
  77. package/dist/pages/admin/users/index.js +1 -1
  78. package/dist/pages/delegations/index.cjs +1 -1
  79. package/dist/pages/delegations/index.js +1 -1
  80. package/dist/pages/forms/builder/index.cjs +1 -1
  81. package/dist/pages/forms/builder/index.js +1 -1
  82. package/dist/pages/instances/detail/index.cjs +1 -1
  83. package/dist/pages/instances/detail/index.js +1 -1
  84. package/dist/pages/settings/notifications/index.cjs +1 -1
  85. package/dist/pages/settings/notifications/index.js +1 -1
  86. package/dist/pages/templates/categories/index.cjs +1 -1
  87. package/dist/pages/templates/categories/index.js +1 -1
  88. package/dist/pages/templates/index.cjs +1 -1
  89. package/dist/pages/templates/index.js +1 -1
  90. package/dist/views/admin/delegations/index.cjs +1 -1
  91. package/dist/views/admin/delegations/index.js +1 -1
  92. package/dist/views/admin/index.cjs +1 -1
  93. package/dist/views/admin/index.js +3 -3
  94. package/dist/views/admin/orgs/index.cjs +1 -1
  95. package/dist/views/admin/orgs/index.js +1 -1
  96. package/dist/views/admin/users/index.cjs +1 -1
  97. package/dist/views/admin/users/index.js +1 -1
  98. package/dist/views/cc/index.cjs +1 -1
  99. package/dist/views/cc/index.js +1 -1
  100. package/dist/views/dashboard/index.cjs +1 -1
  101. package/dist/views/dashboard/index.js +1 -1
  102. package/dist/views/delegations/index.cjs +1 -1
  103. package/dist/views/delegations/index.js +1 -1
  104. package/dist/views/forms/builder/index.cjs +1 -1
  105. package/dist/views/forms/builder/index.js +1 -1
  106. package/dist/views/forms/index.cjs +1 -1
  107. package/dist/views/forms/index.cjs.map +1 -1
  108. package/dist/views/forms/index.js +84 -80
  109. package/dist/views/forms/index.js.map +1 -1
  110. package/dist/views/inbox/index.cjs +1 -1
  111. package/dist/views/inbox/index.cjs.map +1 -1
  112. package/dist/views/inbox/index.js +83 -79
  113. package/dist/views/inbox/index.js.map +1 -1
  114. package/dist/views/instances/detail/index.cjs +1 -1
  115. package/dist/views/instances/detail/index.js +1 -1
  116. package/dist/views/instances/new/index.cjs +1 -1
  117. package/dist/views/instances/new/index.cjs.map +1 -1
  118. package/dist/views/instances/new/index.js +107 -100
  119. package/dist/views/instances/new/index.js.map +1 -1
  120. package/dist/views/search/index.cjs +1 -1
  121. package/dist/views/search/index.js +1 -1
  122. package/dist/views/sent/index.cjs +1 -1
  123. package/dist/views/sent/index.js +1 -1
  124. package/dist/views/settings/index.cjs +1 -1
  125. package/dist/views/settings/index.js +1 -1
  126. package/dist/views/settings/notifications/index.cjs +1 -1
  127. package/dist/views/settings/notifications/index.js +1 -1
  128. package/dist/views/templates/categories/index.cjs +1 -1
  129. package/dist/views/templates/categories/index.js +1 -1
  130. package/dist/views/templates/designer/index.cjs +6 -6
  131. package/dist/views/templates/designer/index.cjs.map +1 -1
  132. package/dist/views/templates/designer/index.js +758 -754
  133. package/dist/views/templates/designer/index.js.map +1 -1
  134. package/dist/views/templates/index.cjs +1 -1
  135. package/dist/views/templates/index.js +2 -2
  136. package/dist/views/templates/versions/index.cjs +1 -1
  137. package/dist/views/templates/versions/index.cjs.map +1 -1
  138. package/dist/views/templates/versions/index.js +47 -43
  139. package/dist/views/templates/versions/index.js.map +1 -1
  140. package/package.json +3 -3
  141. package/dist/chunks/app-navigation-BRRFCkxZ.cjs +0 -2
  142. package/dist/chunks/app-navigation-BRRFCkxZ.cjs.map +0 -1
  143. package/dist/chunks/app-navigation-rxhpHCch.js +0 -262
  144. package/dist/chunks/app-navigation-rxhpHCch.js.map +0 -1
  145. package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs +0 -2
  146. package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs.map +0 -1
  147. package/dist/chunks/approval-instance-list-page-BgE4vQw8.js.map +0 -1
  148. package/dist/chunks/builder-B8X-m6C5.cjs +0 -3
  149. package/dist/chunks/builder-B8X-m6C5.cjs.map +0 -1
  150. package/dist/chunks/builder-Du_0apkh.js.map +0 -1
  151. package/dist/chunks/categories-DG4k7S8V.js +0 -383
  152. package/dist/chunks/categories-DG4k7S8V.js.map +0 -1
  153. package/dist/chunks/categories-DshBQG33.cjs +0 -2
  154. package/dist/chunks/categories-DshBQG33.cjs.map +0 -1
  155. package/dist/chunks/dashboard-page-CTBwpu_D.js +0 -114
  156. package/dist/chunks/dashboard-page-CTBwpu_D.js.map +0 -1
  157. package/dist/chunks/dashboard-page-DcDiWQp2.cjs +0 -2
  158. package/dist/chunks/dashboard-page-DcDiWQp2.cjs.map +0 -1
  159. package/dist/chunks/delegations-BAZQbElH.js +0 -642
  160. package/dist/chunks/delegations-BAZQbElH.js.map +0 -1
  161. package/dist/chunks/delegations-DzrckrPp.js +0 -569
  162. package/dist/chunks/delegations-DzrckrPp.js.map +0 -1
  163. package/dist/chunks/delegations-Z8hTajLj.cjs +0 -2
  164. package/dist/chunks/delegations-Z8hTajLj.cjs.map +0 -1
  165. package/dist/chunks/delegations-hb9JoVZe.cjs +0 -2
  166. package/dist/chunks/delegations-hb9JoVZe.cjs.map +0 -1
  167. package/dist/chunks/detail-DilI0PPe.js +0 -1519
  168. package/dist/chunks/detail-DilI0PPe.js.map +0 -1
  169. package/dist/chunks/detail-DuRg3Y7b.cjs +0 -2
  170. package/dist/chunks/detail-DuRg3Y7b.cjs.map +0 -1
  171. package/dist/chunks/notifications-B2Lk3grg.js +0 -194
  172. package/dist/chunks/notifications-B2Lk3grg.js.map +0 -1
  173. package/dist/chunks/notifications-C8ADhnxF.cjs +0 -2
  174. package/dist/chunks/notifications-C8ADhnxF.cjs.map +0 -1
  175. package/dist/chunks/orgs-CGv3VNDR.cjs +0 -2
  176. package/dist/chunks/orgs-CGv3VNDR.cjs.map +0 -1
  177. package/dist/chunks/orgs-c29y74w2.js.map +0 -1
  178. package/dist/chunks/templates-Cd0WFheA.cjs +0 -2
  179. package/dist/chunks/templates-Cd0WFheA.cjs.map +0 -1
  180. package/dist/chunks/templates-Dn9QHFSy.js.map +0 -1
  181. package/dist/chunks/users-B-trMu0E.cjs +0 -2
  182. package/dist/chunks/users-B-trMu0E.cjs.map +0 -1
  183. package/dist/chunks/users-itVXXRj7.js +0 -215
  184. package/dist/chunks/users-itVXXRj7.js.map +0 -1
@@ -1,22 +1,23 @@
1
1
  "use client";
2
2
  import { a as e } from "./auth-provider-Bnox5gsx.js";
3
3
  import { t } from "./format-date-time-CB-LxzqT.js";
4
- import { t as n } from "./app-navigation-rxhpHCch.js";
5
- import { t as r } from "./bpm-form-field-Cao0rMol.js";
6
- import { t as i } from "./FormRendererView-DrHsuSVo.js";
7
- import { t as a } from "./form-name-modal-C3OEvkCV.js";
8
- import { useEffect as o, useMemo as s, useState as c } from "react";
9
- import { Accordion as l, Badge as u, BaseCard as d, Button as f, DatePicker as ee, DateTimePicker as te, Icon as ne, Input as p, Layout as re, PageHeader as ie, Section as ae, SectionGroup as oe, Select as m, Tab as se, TabItem as h, Table as ce, Textarea as le, Toggle as ue, Typography as g } from "@mezzanine-ui/react";
10
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
11
- import { AlignLeftIcon as de, CalendarIcon as fe, CheckedIcon as pe, CheckedOutlineIcon as b, CurrencyDollarIcon as x, DotDragVerticalIcon as me, DotGridIcon as S, EditIcon as he, FileAttachmentIcon as C, FileIcon as ge, ListIcon as w, PlusIcon as _e, SaveIcon as ve, TrashIcon as ye } from "@mezzanine-ui/icons";
12
- import be from "@mezzanine-ui/react/ContentHeader";
13
- import { buildConditionExpression as T, buildFormRendererValues as xe, clampOptionalNumber as Se, createFieldDefinition as Ce, forkFormDefinition as we, formatDatePickerValue as Te, formatDateTimePickerValue as Ee, isDateFieldDefinition as De, isNumberFieldDefinition as Oe, isSelectFieldDefinition as ke, parseConditionRule as Ae, parseOptionalNumberInput as je, publishFormDefinitionVersion as Me, readConditionOperatorOption as Ne, readConditionOperatorOptions as Pe, readDatePickerValue as Fe, readDefaultConditionOperator as Ie, readDefaultConditionValue as Le, readFieldOptionAsSelectOption as E, readFormBuilder as Re, readSelectOption as D, updateFormDefinition as ze, updateFormDefinitionDraft as Be } from "@rytass/bpm-core-client/form";
14
- import { DragDropContext as Ve, Draggable as He, Droppable as Ue } from "@hello-pangea/dnd";
15
- import O from "next/dynamic";
16
- import { json as k } from "@codemirror/lang-json";
17
- import { EditorView as A } from "@codemirror/view";
4
+ import { t as n } from "./app-navigation-BSkMsEhy.js";
5
+ import { r } from "./routes-config-dxahImVe.js";
6
+ import { t as i } from "./bpm-form-field-Cao0rMol.js";
7
+ import { t as a } from "./FormRendererView-DrHsuSVo.js";
8
+ import { t as o } from "./form-name-modal-C3OEvkCV.js";
9
+ import { useEffect as s, useMemo as c, useState as l } from "react";
10
+ import { Accordion as ee, Badge as u, BaseCard as te, Button as d, DatePicker as ne, DateTimePicker as re, Icon as ie, Input as f, PageHeader as ae, Section as oe, SectionGroup as se, Select as p, Tab as ce, TabItem as m, Table as le, Textarea as ue, Toggle as de, Typography as h } from "@mezzanine-ui/react";
11
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
12
+ import { AlignLeftIcon as fe, CalendarIcon as pe, CheckedIcon as me, CheckedOutlineIcon as he, CurrencyDollarIcon as y, DotDragVerticalIcon as ge, DotGridIcon as b, EditIcon as _e, FileAttachmentIcon as x, FileIcon as S, ListIcon as C, PlusIcon as ve, SaveIcon as ye, TrashIcon as be } from "@mezzanine-ui/icons";
13
+ import xe from "@mezzanine-ui/react/ContentHeader";
14
+ import { buildConditionExpression as w, buildFormRendererValues as Se, clampOptionalNumber as Ce, createFieldDefinition as we, forkFormDefinition as Te, formatDatePickerValue as Ee, formatDateTimePickerValue as De, isDateFieldDefinition as Oe, isNumberFieldDefinition as ke, isSelectFieldDefinition as Ae, parseConditionRule as je, parseOptionalNumberInput as Me, publishFormDefinitionVersion as Ne, readConditionOperatorOption as Pe, readConditionOperatorOptions as Fe, readDatePickerValue as Ie, readDefaultConditionOperator as Le, readDefaultConditionValue as Re, readFieldOptionAsSelectOption as T, readFormBuilder as ze, readSelectOption as E, updateFormDefinition as Be, updateFormDefinitionDraft as Ve } from "@rytass/bpm-core-client/form";
15
+ import { DragDropContext as He, Draggable as Ue, Droppable as We } from "@hello-pangea/dnd";
16
+ import D from "next/dynamic";
17
+ import { json as O } from "@codemirror/lang-json";
18
+ import { EditorView as k } from "@codemirror/view";
18
19
  //#region src/views/forms/builder/json-code-editor.tsx
19
- var We = {
20
+ var A = {
20
21
  alignItems: "center",
21
22
  border: "1px solid var(--mzn-color-border-neutral)",
22
23
  borderRadius: 4,
@@ -25,10 +26,10 @@ var We = {
25
26
  minHeight: 160,
26
27
  padding: 12,
27
28
  width: "100%"
28
- }, j = [
29
- k(),
30
- A.lineWrapping,
31
- A.theme({
29
+ }, Ge = [
30
+ O(),
31
+ k.lineWrapping,
32
+ k.theme({
32
33
  "&": {
33
34
  border: "1px solid var(--mzn-color-border-neutral)",
34
35
  borderRadius: "4px",
@@ -44,15 +45,15 @@ var We = {
44
45
  ".cm-gutters": { borderRight: "1px solid var(--mzn-color-border-neutral)" },
45
46
  ".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace" }
46
47
  })
47
- ], Ge = O(() => import("@uiw/react-codemirror"), {
48
- loading: () => /* @__PURE__ */ v("div", {
49
- style: We,
48
+ ], j = D(() => import("@uiw/react-codemirror"), {
49
+ loading: () => /* @__PURE__ */ _("div", {
50
+ style: A,
50
51
  children: "載入 JSON 編輯器"
51
52
  }),
52
53
  ssr: !1
53
54
  });
54
55
  function Ke({ disabled: e, height: t, name: n, onChange: r, placeholder: i, value: a }) {
55
- return /* @__PURE__ */ v(Ge, {
56
+ return /* @__PURE__ */ _(j, {
56
57
  "aria-label": n,
57
58
  basicSetup: {
58
59
  autocompletion: !0,
@@ -66,7 +67,7 @@ function Ke({ disabled: e, height: t, name: n, onChange: r, placeholder: i, valu
66
67
  syntaxHighlighting: !0
67
68
  },
68
69
  editable: !e,
69
- extensions: [...j],
70
+ extensions: [...Ge],
70
71
  height: t,
71
72
  indentWithTab: !1,
72
73
  onChange: r,
@@ -82,67 +83,67 @@ function Ke({ disabled: e, height: t, name: n, onChange: r, placeholder: i, valu
82
83
  var qe = [
83
84
  {
84
85
  description: "單行文字、姓名、編號",
85
- icon: de,
86
+ icon: fe,
86
87
  label: "文字",
87
88
  type: "text"
88
89
  },
89
90
  {
90
91
  description: "多行補充內容",
91
- icon: ge,
92
+ icon: S,
92
93
  label: "長文字",
93
94
  type: "textarea"
94
95
  },
95
96
  {
96
97
  description: "金額、數量、分數",
97
- icon: x,
98
+ icon: y,
98
99
  label: "數字",
99
100
  type: "number"
100
101
  },
101
102
  {
102
103
  description: "金額與費用",
103
- icon: x,
104
+ icon: y,
104
105
  label: "金額",
105
106
  type: "money"
106
107
  },
107
108
  {
108
109
  description: "日期或到期日",
109
- icon: fe,
110
+ icon: pe,
110
111
  label: "日期",
111
112
  type: "date"
112
113
  },
113
114
  {
114
115
  description: "日期與時間",
115
- icon: fe,
116
+ icon: pe,
116
117
  label: "日期時間",
117
118
  type: "datetime"
118
119
  },
119
120
  {
120
121
  description: "是 / 否狀態",
121
- icon: pe,
122
+ icon: me,
122
123
  label: "開關",
123
124
  type: "boolean"
124
125
  },
125
126
  {
126
127
  description: "固定選項擇一",
127
- icon: w,
128
+ icon: C,
128
129
  label: "下拉選單",
129
130
  type: "select"
130
131
  },
131
132
  {
132
133
  description: "固定選項單選",
133
- icon: S,
134
+ icon: b,
134
135
  label: "單選",
135
136
  type: "radio"
136
137
  },
137
138
  {
138
139
  description: "固定選項複選",
139
- icon: b,
140
+ icon: he,
140
141
  label: "複選",
141
142
  type: "checkbox"
142
143
  },
143
144
  {
144
145
  description: "附件或佐證資料",
145
- icon: C,
146
+ icon: x,
146
147
  label: "附件",
147
148
  type: "file_upload"
148
149
  }
@@ -312,28 +313,28 @@ var N = {
312
313
  target: "readonlyWhen"
313
314
  }
314
315
  ];
315
- function F({ formId: de }) {
316
- let fe = e(), b = de, [x, S] = c(null), [C, ge] = c(null), [w, O] = c(N), [k, A] = c(P), [We, j] = c(I(N)), [Ge, F] = c(I(P)), [Vt, Gt] = c({}), [Jt, R] = c(null), [z, Yt] = c("design"), [B, V] = c(null), [Xt, H] = c(null), [Zt, Qt] = c(!1), [$t, en] = c(Ht(N, P)), [tn, nn] = c(!0), [rn, an] = c(!1), [U, W] = c(!1);
317
- o(() => {
318
- gn();
319
- }, [b]), o(() => {
320
- w.fields.some((e) => e.fieldKey === B) || V(w.fields[0]?.fieldKey ?? null);
321
- }, [w.fields, B]), o(() => {
322
- Gt((e) => xe(w.fields, e));
323
- }, [w.fields]), o(() => {
324
- z !== "advanced" && (j(I(w)), F(I(k)));
316
+ function Mt({ formId: fe }) {
317
+ let pe = e(), he = r(), y = fe, [b, x] = l(null), [S, C] = l(null), [D, O] = l(N), [k, A] = l(P), [Ge, j] = l(F(N)), [Mt, I] = l(F(P)), [Gt, Yt] = l({}), [Xt, L] = l(null), [R, Zt] = l("design"), [z, B] = l(null), [Qt, V] = l(null), [$t, en] = l(!1), [tn, nn] = l(Ht(N, P)), [rn, an] = l(!0), [on, sn] = l(!1), [H, U] = l(!1);
318
+ s(() => {
319
+ vn();
320
+ }, [y]), s(() => {
321
+ D.fields.some((e) => e.fieldKey === z) || B(D.fields[0]?.fieldKey ?? null);
322
+ }, [D.fields, z]), s(() => {
323
+ Yt((e) => Se(D.fields, e));
324
+ }, [D.fields]), s(() => {
325
+ R !== "advanced" && (j(F(D)), I(F(k)));
325
326
  }, [
326
- z,
327
- w,
327
+ R,
328
+ D,
328
329
  k
329
330
  ]);
330
- let G = s(() => w.fields.find((e) => e.fieldKey === B) ?? w.fields[0] ?? null, [w.fields, B]), on = s(() => (x?.versions ?? []).map((e) => ({
331
+ let W = c(() => D.fields.find((e) => e.fieldKey === z) ?? D.fields[0] ?? null, [D.fields, z]), cn = c(() => (b?.versions ?? []).map((e) => ({
331
332
  key: e.id,
332
333
  publishedAt: t(e.publishedAt),
333
334
  status: e.status,
334
335
  updatedAt: t(e.updatedAt),
335
336
  version: `v${e.version}`
336
- })), [x]), sn = s(() => [
337
+ })), [b]), ln = c(() => [
337
338
  {
338
339
  dataIndex: "version",
339
340
  key: "version",
@@ -342,7 +343,7 @@ function F({ formId: de }) {
342
343
  },
343
344
  {
344
345
  key: "status",
345
- render: (e) => /* @__PURE__ */ v(qt, { status: e.status }),
346
+ render: (e) => /* @__PURE__ */ _(qt, { status: e.status }),
346
347
  title: "狀態",
347
348
  width: 140
348
349
  },
@@ -358,102 +359,102 @@ function F({ formId: de }) {
358
359
  title: "發布時間",
359
360
  width: 180
360
361
  }
361
- ], []), cn = s(() => Ht(w, k), [w, k]), K = cn.schemaJson !== $t.schemaJson || cn.uiSchemaJson !== $t.uiSchemaJson;
362
- o(() => {
362
+ ], []), un = c(() => Ht(D, k), [D, k]), G = un.schemaJson !== tn.schemaJson || un.uiSchemaJson !== tn.uiSchemaJson;
363
+ s(() => {
363
364
  function e(e) {
364
- K && (e.preventDefault(), e.returnValue = "");
365
+ G && (e.preventDefault(), e.returnValue = "");
365
366
  }
366
367
  return window.addEventListener("beforeunload", e), () => {
367
368
  window.removeEventListener("beforeunload", e);
368
369
  };
369
- }, [K]);
370
- function ln() {
371
- K && !window.confirm("目前有尚未儲存的表單草稿,確定要離開嗎?") || fe.push("/forms");
370
+ }, [G]);
371
+ function dn() {
372
+ G && !window.confirm("目前有尚未儲存的表單草稿,確定要離開嗎?") || pe.push(he.forms());
372
373
  }
373
- let un = s(() => Ut(x?.versions ?? [], x?.definition.currentVersionId), [x?.definition.currentVersionId, x?.versions]), dn = C ?? un ?? x?.versions[0] ?? null, fn = !K && dn?.status === "PUBLISHED", pn = Wt({
374
- hasUnsavedChanges: K,
375
- latestPublishedVersion: un,
376
- openedContentPublished: fn,
377
- openedVersion: dn
378
- }), mn = U || !K && fn && !C, hn = K ? "保存並發布" : C ? "發布草稿" : fn ? "已發布" : "發布版本";
379
- async function gn() {
380
- nn(!0), H(null);
374
+ let fn = c(() => Ut(b?.versions ?? [], b?.definition.currentVersionId), [b?.definition.currentVersionId, b?.versions]), pn = S ?? fn ?? b?.versions[0] ?? null, mn = !G && pn?.status === "PUBLISHED", hn = Wt({
375
+ hasUnsavedChanges: G,
376
+ latestPublishedVersion: fn,
377
+ openedContentPublished: mn,
378
+ openedVersion: pn
379
+ }), gn = H || !G && mn && !S, _n = G ? "保存並發布" : S ? "發布草稿" : mn ? "已發布" : "發布版本";
380
+ async function vn() {
381
+ an(!0), V(null);
381
382
  try {
382
- let e = await Re(b), t = e.versions.find((e) => e.status === "DRAFT") ?? null;
383
- S(e), ge(t);
383
+ let e = await ze(y), t = e.versions.find((e) => e.status === "DRAFT") ?? null;
384
+ x(e), C(t);
384
385
  let n = t?.schema ?? e.versions[0]?.schema ?? N, r = t?.uiSchema ?? e.versions[0]?.uiSchema ?? P;
385
- O(n), A(r), en(Ht(n, r)), j(I(n)), F(I(r)), V(t?.schema.fields[0]?.fieldKey ?? e.versions[0]?.schema.fields[0]?.fieldKey ?? null), R(null);
386
+ O(n), A(r), nn(Ht(n, r)), j(F(n)), I(F(r)), B(t?.schema.fields[0]?.fieldKey ?? e.versions[0]?.schema.fields[0]?.fieldKey ?? null), L(null);
386
387
  } catch (e) {
387
- H(L(e));
388
+ V(Jt(e));
388
389
  } finally {
389
- nn(!1);
390
+ an(!1);
390
391
  }
391
392
  }
392
- async function _n() {
393
- let e = await Be((C ?? await we(b)).id, w, k);
394
- return ge(e), e;
393
+ async function yn() {
394
+ let e = await Ve((S ?? await Te(y)).id, D, k);
395
+ return C(e), e;
395
396
  }
396
- async function vn() {
397
- W(!0), H(null);
397
+ async function bn() {
398
+ U(!0), V(null);
398
399
  try {
399
- await _n(), await gn();
400
+ await yn(), await vn();
400
401
  } catch (e) {
401
- H(L(e));
402
+ V(Jt(e));
402
403
  } finally {
403
- W(!1);
404
+ U(!1);
404
405
  }
405
406
  }
406
- async function yn() {
407
- W(!0), H(null);
407
+ async function xn() {
408
+ U(!0), V(null);
408
409
  try {
409
- await Me((await _n()).id), await gn();
410
+ await Ne((await yn()).id), await vn();
410
411
  } catch (e) {
411
- H(L(e));
412
+ V(Jt(e));
412
413
  } finally {
413
- W(!1);
414
+ U(!1);
414
415
  }
415
416
  }
416
- async function bn(e) {
417
- if (!x) throw Error("尚未載入表單資料");
418
- an(!0);
417
+ async function Sn(e) {
418
+ if (!b) throw Error("尚未載入表單資料");
419
+ sn(!0);
419
420
  try {
420
- let t = await ze(x.definition.id, e);
421
- S({
422
- ...x,
421
+ let t = await Be(b.definition.id, e);
422
+ x({
423
+ ...b,
423
424
  definition: t
424
- }), Qt(!1);
425
+ }), en(!1);
425
426
  } finally {
426
- an(!1);
427
+ sn(!1);
427
428
  }
428
429
  }
429
- function xn(e) {
430
- let t = Ce(e, w.fields.length + 1);
430
+ function Cn(e) {
431
+ let t = we(e, D.fields.length + 1);
431
432
  O({
432
- ...w,
433
- fields: [...w.fields, t]
433
+ ...D,
434
+ fields: [...D.fields, t]
434
435
  }), A({
435
436
  ...k,
436
437
  layout: [...k.layout, {
437
438
  fieldKey: t.fieldKey,
438
439
  width: e === "textarea" || e === "file_upload" ? "FULL" : "HALF"
439
440
  }]
440
- }), V(t.fieldKey), Yt("design"), R(null);
441
+ }), B(t.fieldKey), Zt("design"), L(null);
441
442
  }
442
- function Sn(e) {
443
+ function wn(e) {
443
444
  let t = e;
444
- t === "advanced" && z !== "advanced" && (j(I(w)), F(I(k))), Yt(t);
445
+ t === "advanced" && R !== "advanced" && (j(F(D)), I(F(k))), Zt(t);
445
446
  }
446
- function Cn(e) {
447
- let t = w.fields.filter((t) => t.fieldKey !== e);
447
+ function Tn(e) {
448
+ let t = D.fields.filter((t) => t.fieldKey !== e);
448
449
  O({
449
- ...w,
450
+ ...D,
450
451
  fields: t
451
452
  }), A({
452
453
  ...k,
453
454
  layout: k.layout.filter((t) => t.fieldKey !== e)
454
- }), V(B === e ? t[0]?.fieldKey ?? null : B), R(null);
455
+ }), B(z === e ? t[0]?.fieldKey ?? null : z), L(null);
455
456
  }
456
- function wn(e) {
457
+ function En(e) {
457
458
  let t = e.destination;
458
459
  t && e.source.index !== t.index && (O((n) => ({
459
460
  ...n,
@@ -461,173 +462,176 @@ function F({ formId: de }) {
461
462
  })), A((n) => ({
462
463
  ...n,
463
464
  layout: Kt(n.layout, e.source.index, t.index)
464
- })), R(null));
465
+ })), L(null));
465
466
  }
466
- function q(e) {
467
- J((t) => ({
467
+ function K(e) {
468
+ q((t) => ({
468
469
  ...t,
469
470
  ...e
470
471
  }));
471
472
  }
472
- function J(e) {
473
- if (!G) return;
474
- let t = G.fieldKey, n = e(G), r = n.fieldKey;
473
+ function q(e) {
474
+ if (!W) return;
475
+ let t = W.fieldKey, n = e(W), r = n.fieldKey;
475
476
  O({
476
- ...w,
477
- fields: w.fields.map((e) => e.fieldKey === t ? n : e)
477
+ ...D,
478
+ fields: D.fields.map((e) => e.fieldKey === t ? n : e)
478
479
  }), A({
479
480
  ...k,
480
481
  layout: k.layout.map((e) => e.fieldKey === t ? {
481
482
  ...e,
482
483
  fieldKey: r
483
484
  } : e)
484
- }), V(r), R(null);
485
+ }), B(r), L(null);
485
486
  }
486
- function Y(e) {
487
- J((t) => Ft(t) ? {
487
+ function J(e) {
488
+ q((t) => It(t) ? {
488
489
  ...t,
489
490
  ...e
490
491
  } : t);
491
492
  }
492
- function Tn(e) {
493
- J((t) => Oe(t) ? {
493
+ function Y(e) {
494
+ q((t) => ke(t) ? {
494
495
  ...t,
495
496
  ...e
496
497
  } : t);
497
498
  }
498
- function En(e) {
499
- J((t) => De(t) ? {
499
+ function Dn(e) {
500
+ q((t) => Oe(t) ? {
500
501
  ...t,
501
502
  ...e
502
503
  } : t);
503
504
  }
504
505
  function X(e) {
505
- J((t) => ke(t) ? {
506
+ q((t) => Ae(t) ? {
506
507
  ...t,
507
508
  ...e
508
509
  } : t);
509
510
  }
510
- function Dn(e) {
511
- J((t) => t.type === "boolean" ? {
511
+ function On(e) {
512
+ q((t) => t.type === "boolean" ? {
512
513
  ...t,
513
514
  ...e
514
515
  } : t);
515
516
  }
516
- function On(e) {
517
- J((t) => t.type === "file_upload" ? {
517
+ function kn(e) {
518
+ q((t) => t.type === "file_upload" ? {
518
519
  ...t,
519
520
  ...e
520
521
  } : t);
521
522
  }
522
- function kn(e) {
523
- Gt(e);
523
+ function An(e) {
524
+ Yt(e);
524
525
  }
525
- function An(e, t) {
526
+ function jn(e, t) {
526
527
  O((n) => ({
527
528
  ...n,
528
529
  fields: n.fields.map((n) => n.fieldKey === e ? {
529
530
  ...n,
530
531
  required: t
531
532
  } : n)
532
- })), R(null);
533
+ })), L(null);
533
534
  }
534
- function jn(e) {
535
+ function Mn(e) {
535
536
  j(e);
536
537
  try {
537
- O(JSON.parse(e)), R(null);
538
+ O(JSON.parse(e)), L(null);
538
539
  } catch {
539
- R("Form Schema JSON 格式不正確");
540
+ L("Form Schema JSON 格式不正確");
540
541
  }
541
542
  }
542
- function Mn(e) {
543
- F(e);
543
+ function Nn(e) {
544
+ I(e);
544
545
  try {
545
- A(JSON.parse(e)), R(null);
546
+ A(JSON.parse(e)), L(null);
546
547
  } catch {
547
- R("UI Schema JSON 格式不正確");
548
+ L("UI Schema JSON 格式不正確");
548
549
  }
549
550
  }
550
- return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y(re, { children: [/* @__PURE__ */ v(n, { activeHref: "/forms" }), /* @__PURE__ */ y(re.Main, { children: [/* @__PURE__ */ v(ie, { children: /* @__PURE__ */ y(be, {
551
- description: pn,
552
- onBackClick: ln,
553
- title: x?.definition.name ?? "表單設計器",
554
- children: [
555
- /* @__PURE__ */ v(f, {
556
- "aria-label": "修改表單名稱",
557
- disabled: rn || !x,
558
- icon: he,
559
- iconType: "icon-only",
560
- onClick: () => Qt(!0),
561
- variant: "base-ghost",
562
- children: "修改表單名稱"
563
- }),
564
- /* @__PURE__ */ v(f, {
565
- "aria-label": "儲存草稿",
566
- disabled: U || !K,
567
- icon: ve,
568
- iconType: "icon-only",
569
- onClick: () => void vn(),
570
- variant: "base-secondary",
571
- children: "儲存草稿"
572
- }),
573
- /* @__PURE__ */ v(f, {
574
- disabled: mn,
575
- icon: pe,
576
- iconType: "leading",
577
- onClick: () => void yn(),
578
- variant: "base-primary",
579
- children: hn
580
- })
581
- ]
582
- }) }), /* @__PURE__ */ v(oe, { children: /* @__PURE__ */ v(ae, { children: /* @__PURE__ */ y("div", {
583
- style: wt,
584
- children: [
585
- Xt ? /* @__PURE__ */ v(g, {
586
- color: "text-error",
587
- variant: "body",
588
- children: Xt
589
- }) : null,
590
- /* @__PURE__ */ y(se, {
591
- activeKey: z,
592
- onChange: Sn,
593
- size: "sub",
594
- children: [
595
- /* @__PURE__ */ v(h, { children: "設計" }, "design"),
596
- /* @__PURE__ */ v(h, { children: "預覽" }, "preview"),
597
- /* @__PURE__ */ v(h, { children: "版本" }, "versions"),
598
- /* @__PURE__ */ v(h, { children: "進階" }, "advanced")
599
- ]
600
- }),
601
- z === "design" ? Nn() : null,
602
- z === "preview" ? Qn() : null,
603
- z === "versions" ? $n() : null,
604
- z === "advanced" ? er() : null
605
- ]
606
- }) }) })] })] }), /* @__PURE__ */ v(a, {
551
+ return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v(n, {
552
+ activeHref: he.forms(),
553
+ children: [/* @__PURE__ */ _(ae, { children: /* @__PURE__ */ v(xe, {
554
+ description: hn,
555
+ onBackClick: dn,
556
+ title: b?.definition.name ?? "表單設計器",
557
+ children: [
558
+ /* @__PURE__ */ _(d, {
559
+ "aria-label": "修改表單名稱",
560
+ disabled: on || !b,
561
+ icon: _e,
562
+ iconType: "icon-only",
563
+ onClick: () => en(!0),
564
+ variant: "base-ghost",
565
+ children: "修改表單名稱"
566
+ }),
567
+ /* @__PURE__ */ _(d, {
568
+ "aria-label": "儲存草稿",
569
+ disabled: H || !G,
570
+ icon: ye,
571
+ iconType: "icon-only",
572
+ onClick: () => void bn(),
573
+ variant: "base-secondary",
574
+ children: "儲存草稿"
575
+ }),
576
+ /* @__PURE__ */ _(d, {
577
+ disabled: gn,
578
+ icon: me,
579
+ iconType: "leading",
580
+ onClick: () => void xn(),
581
+ variant: "base-primary",
582
+ children: _n
583
+ })
584
+ ]
585
+ }) }), /* @__PURE__ */ _(se, { children: /* @__PURE__ */ _(oe, { children: /* @__PURE__ */ v("div", {
586
+ style: wt,
587
+ children: [
588
+ Qt ? /* @__PURE__ */ _(h, {
589
+ color: "text-error",
590
+ variant: "body",
591
+ children: Qt
592
+ }) : null,
593
+ /* @__PURE__ */ v(ce, {
594
+ activeKey: R,
595
+ onChange: wn,
596
+ size: "sub",
597
+ children: [
598
+ /* @__PURE__ */ _(m, { children: "設計" }, "design"),
599
+ /* @__PURE__ */ _(m, { children: "預覽" }, "preview"),
600
+ /* @__PURE__ */ _(m, { children: "版本" }, "versions"),
601
+ /* @__PURE__ */ _(m, { children: "進階" }, "advanced")
602
+ ]
603
+ }),
604
+ R === "design" ? Pn() : null,
605
+ R === "preview" ? $n() : null,
606
+ R === "versions" ? er() : null,
607
+ R === "advanced" ? tr() : null
608
+ ]
609
+ }) }) })]
610
+ }), /* @__PURE__ */ _(o, {
607
611
  confirmText: "儲存",
608
- initialName: x?.definition.name ?? "",
609
- loading: rn,
610
- onClose: () => Qt(!1),
611
- onSubmit: bn,
612
- open: Zt,
612
+ initialName: b?.definition.name ?? "",
613
+ loading: on,
614
+ onClose: () => en(!1),
615
+ onSubmit: Sn,
616
+ open: $t,
613
617
  title: "修改表單名稱"
614
618
  })] });
615
- function Nn() {
616
- return /* @__PURE__ */ y("div", {
619
+ function Pn() {
620
+ return /* @__PURE__ */ v("div", {
617
621
  style: M,
618
- children: [/* @__PURE__ */ y("div", {
622
+ children: [/* @__PURE__ */ v("div", {
619
623
  style: $e,
620
- children: [/* @__PURE__ */ v(g, {
624
+ children: [/* @__PURE__ */ _(h, {
621
625
  component: "h2",
622
626
  variant: "label-primary",
623
627
  children: "新增欄位"
624
- }), /* @__PURE__ */ v("div", {
628
+ }), /* @__PURE__ */ _("div", {
625
629
  style: Ze,
626
- children: qe.map((e) => /* @__PURE__ */ v(f, {
627
- disabled: U,
630
+ children: qe.map((e) => /* @__PURE__ */ _(d, {
631
+ disabled: H,
628
632
  icon: e.icon,
629
633
  iconType: "leading",
630
- onClick: () => xn(e.type),
634
+ onClick: () => Cn(e.type),
631
635
  size: "sub",
632
636
  style: Qe,
633
637
  type: "button",
@@ -635,71 +639,71 @@ function F({ formId: de }) {
635
639
  children: e.label
636
640
  }, e.type))
637
641
  })]
638
- }), /* @__PURE__ */ y("div", {
642
+ }), /* @__PURE__ */ v("div", {
639
643
  style: Je,
640
- children: [/* @__PURE__ */ y("div", {
644
+ children: [/* @__PURE__ */ v("div", {
641
645
  style: {
642
646
  ...M,
643
647
  ...Ye
644
648
  },
645
- children: [/* @__PURE__ */ v(g, {
649
+ children: [/* @__PURE__ */ _(h, {
646
650
  component: "h2",
647
651
  variant: "label-primary",
648
652
  children: "表單畫布"
649
- }), w.fields.length > 0 ? /* @__PURE__ */ v(Ve, {
650
- onDragEnd: wn,
651
- children: /* @__PURE__ */ v(Ue, {
653
+ }), D.fields.length > 0 ? /* @__PURE__ */ _(He, {
654
+ onDragEnd: En,
655
+ children: /* @__PURE__ */ _(We, {
652
656
  droppableId: "form-builder-fields",
653
- children: (e) => /* @__PURE__ */ y("div", {
657
+ children: (e) => /* @__PURE__ */ v("div", {
654
658
  ...e.droppableProps,
655
659
  ref: e.innerRef,
656
660
  style: M,
657
- children: [w.fields.map((e, t) => /* @__PURE__ */ v(He, {
661
+ children: [D.fields.map((e, t) => /* @__PURE__ */ _(Ue, {
658
662
  draggableId: e.fieldKey,
659
663
  index: t,
660
- isDragDisabled: U,
661
- children: (t, n) => Xn(e, t, n.isDragging)
664
+ isDragDisabled: H,
665
+ children: (t, n) => Zn(e, t, n.isDragging)
662
666
  }, e.fieldKey)), e.placeholder]
663
667
  })
664
668
  })
665
- }) : /* @__PURE__ */ y("div", {
669
+ }) : /* @__PURE__ */ v("div", {
666
670
  style: ot,
667
- children: [/* @__PURE__ */ y("div", {
671
+ children: [/* @__PURE__ */ v("div", {
668
672
  style: M,
669
- children: [/* @__PURE__ */ v(g, {
673
+ children: [/* @__PURE__ */ _(h, {
670
674
  component: "h3",
671
675
  variant: "h3",
672
676
  children: "尚未建立欄位"
673
- }), /* @__PURE__ */ v(g, {
677
+ }), /* @__PURE__ */ _(h, {
674
678
  color: "text-neutral",
675
679
  variant: "body",
676
680
  children: "從上方新增第一個欄位,或直接建立常用文字欄位開始設計。"
677
681
  })]
678
- }), /* @__PURE__ */ y("div", {
682
+ }), /* @__PURE__ */ v("div", {
679
683
  style: st,
680
- children: [/* @__PURE__ */ v(f, {
681
- disabled: U,
682
- onClick: () => xn("text"),
684
+ children: [/* @__PURE__ */ _(d, {
685
+ disabled: H,
686
+ onClick: () => Cn("text"),
683
687
  variant: "base-primary",
684
688
  children: "新增文字欄位"
685
- }), /* @__PURE__ */ v(f, {
686
- disabled: U,
687
- onClick: () => xn("textarea"),
689
+ }), /* @__PURE__ */ _(d, {
690
+ disabled: H,
691
+ onClick: () => Cn("textarea"),
688
692
  variant: "base-secondary",
689
693
  children: "新增長文字"
690
694
  })]
691
695
  })]
692
696
  })]
693
- }), /* @__PURE__ */ y("div", {
697
+ }), /* @__PURE__ */ v("div", {
694
698
  style: {
695
699
  ...M,
696
700
  ...Xe
697
701
  },
698
- children: [/* @__PURE__ */ v(g, {
702
+ children: [/* @__PURE__ */ _(h, {
699
703
  component: "h2",
700
704
  variant: "label-primary",
701
705
  children: "欄位設定"
702
- }), G ? Pn(G) : /* @__PURE__ */ v(g, {
706
+ }), W ? Fn(W) : /* @__PURE__ */ _(h, {
703
707
  color: "text-neutral",
704
708
  variant: "body",
705
709
  children: "請先新增或選取欄位。"
@@ -708,222 +712,222 @@ function F({ formId: de }) {
708
712
  })]
709
713
  });
710
714
  }
711
- function Pn(e) {
712
- return /* @__PURE__ */ y("div", {
715
+ function Fn(e) {
716
+ return /* @__PURE__ */ v("div", {
713
717
  style: ct,
714
- children: [Fn(e), In(e)]
718
+ children: [In(e), Ln(e)]
715
719
  });
716
720
  }
717
- function Fn(e) {
718
- return /* @__PURE__ */ y("div", {
721
+ function In(e) {
722
+ return /* @__PURE__ */ v("div", {
719
723
  style: lt,
720
724
  children: [
721
- /* @__PURE__ */ v("div", {
725
+ /* @__PURE__ */ _("div", {
722
726
  style: dt,
723
- children: /* @__PURE__ */ v(u, {
727
+ children: /* @__PURE__ */ _(u, {
724
728
  size: "main",
725
- text: Mt(e.type),
729
+ text: Nt(e.type),
726
730
  variant: "text-info"
727
731
  })
728
732
  }),
729
- $("標題", "fieldLabel", /* @__PURE__ */ v(p, {
730
- onChange: (e) => q({ label: e.target.value }),
733
+ $("標題", "fieldLabel", /* @__PURE__ */ _(f, {
734
+ onChange: (e) => K({ label: e.target.value }),
731
735
  placeholder: "例如:申請金額",
732
736
  value: e.label,
733
737
  variant: "base"
734
- }), U),
735
- $("欄位 Key", "fieldKey", /* @__PURE__ */ v(p, {
736
- onChange: (e) => q({ fieldKey: e.target.value }),
738
+ }), H),
739
+ $("欄位 Key", "fieldKey", /* @__PURE__ */ _(f, {
740
+ onChange: (e) => K({ fieldKey: e.target.value }),
737
741
  placeholder: "例如:amount",
738
742
  value: e.fieldKey,
739
743
  variant: "base"
740
- }), U),
741
- $("提示文字", "fieldPlaceholder", /* @__PURE__ */ v(p, {
742
- onChange: (e) => q({ placeholder: e.target.value || void 0 }),
744
+ }), H),
745
+ $("提示文字", "fieldPlaceholder", /* @__PURE__ */ _(f, {
746
+ onChange: (e) => K({ placeholder: e.target.value || void 0 }),
743
747
  placeholder: "例如:請輸入申請金額",
744
748
  value: e.placeholder ?? "",
745
749
  variant: "base"
746
- }), U),
747
- Ln(e)
750
+ }), H),
751
+ Rn(e)
748
752
  ]
749
753
  });
750
754
  }
751
- function In(e) {
752
- return /* @__PURE__ */ v(l, {
753
- defaultExpanded: Nt(e),
755
+ function Ln(e) {
756
+ return /* @__PURE__ */ _(ee, {
757
+ defaultExpanded: Pt(e),
754
758
  size: "sub",
755
759
  title: "進階設定",
756
- children: /* @__PURE__ */ y("div", {
760
+ children: /* @__PURE__ */ v("div", {
757
761
  style: lt,
758
762
  children: [
759
- /* @__PURE__ */ v(g, {
763
+ /* @__PURE__ */ _(h, {
760
764
  component: "h3",
761
765
  style: ut,
762
766
  variant: "label-primary",
763
767
  children: "條件規則"
764
768
  }),
765
- /* @__PURE__ */ v(g, {
769
+ /* @__PURE__ */ _(h, {
766
770
  color: "text-neutral",
767
771
  style: ft,
768
772
  variant: "body",
769
773
  children: "只有需要根據其他欄位改變顯示、必填或唯讀狀態時才需要設定。"
770
774
  }),
771
- Wn(e)
775
+ Gn(e)
772
776
  ]
773
777
  })
774
778
  });
775
779
  }
776
- function Ln(e) {
777
- return Ft(e) ? Rn(e) : Oe(e) ? zn(e) : De(e) ? Bn(e) : ke(e) ? Vn(e) : e.type === "boolean" ? Hn(e) : Un(e);
778
- }
779
780
  function Rn(e) {
780
- return /* @__PURE__ */ y(_, { children: [
781
- $("預設值", "fieldDefaultValue", e.type === "textarea" ? qn({
782
- disabled: U,
781
+ return It(e) ? zn(e) : ke(e) ? Bn(e) : Oe(e) ? Vn(e) : Ae(e) ? Hn(e) : e.type === "boolean" ? Un(e) : Wn(e);
782
+ }
783
+ function zn(e) {
784
+ return /* @__PURE__ */ v(g, { children: [
785
+ $("預設值", "fieldDefaultValue", e.type === "textarea" ? Jn({
786
+ disabled: H,
783
787
  name: "fieldDefaultValue",
784
- onChange: (e) => Y({ defaultValue: e || void 0 }),
788
+ onChange: (e) => J({ defaultValue: e || void 0 }),
785
789
  placeholder: "輸入此欄位的預設文字",
786
790
  rows: 3,
787
- value: It(e.defaultValue)
788
- }) : /* @__PURE__ */ v(p, {
789
- onChange: (e) => Y({ defaultValue: e.target.value || void 0 }),
791
+ value: Lt(e.defaultValue)
792
+ }) : /* @__PURE__ */ _(f, {
793
+ onChange: (e) => J({ defaultValue: e.target.value || void 0 }),
790
794
  placeholder: "輸入此欄位的預設文字",
791
- value: It(e.defaultValue),
795
+ value: Lt(e.defaultValue),
792
796
  variant: "base"
793
- }), U),
794
- $("最小長度", "fieldMinLength", Q(e.minLength, (e) => Y({ minLength: e }), "例如:2", { min: 0 }), U),
795
- $("最大長度", "fieldMaxLength", Q(e.maxLength, (e) => Y({ maxLength: e }), "例如:100", { min: 1 }), U)
797
+ }), H),
798
+ $("最小長度", "fieldMinLength", Q(e.minLength, (e) => J({ minLength: e }), "例如:2", { min: 0 }), H),
799
+ $("最大長度", "fieldMaxLength", Q(e.maxLength, (e) => J({ maxLength: e }), "例如:100", { min: 1 }), H)
796
800
  ] });
797
801
  }
798
- function zn(e) {
799
- return /* @__PURE__ */ y(_, { children: [
800
- $("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (e) => Tn({ defaultValue: e }), e.type === "money" ? "例如:1000" : "輸入預設數值", {
802
+ function Bn(e) {
803
+ return /* @__PURE__ */ v(g, { children: [
804
+ $("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (e) => Y({ defaultValue: e }), e.type === "money" ? "例如:1000" : "輸入預設數值", {
801
805
  max: e.maximum,
802
806
  min: e.minimum
803
- }), U),
804
- $("最小值", "fieldMinimum", Q(e.minimum, (e) => Tn({ minimum: e }), "例如:0"), U),
805
- $("最大值", "fieldMaximum", Q(e.maximum, (e) => Tn({ maximum: e }), "例如:999999"), U)
807
+ }), H),
808
+ $("最小值", "fieldMinimum", Q(e.minimum, (e) => Y({ minimum: e }), "例如:0"), H),
809
+ $("最大值", "fieldMaximum", Q(e.maximum, (e) => Y({ maximum: e }), "例如:999999"), H)
806
810
  ] });
807
811
  }
808
- function Bn(e) {
809
- return $("預設值", "fieldDefaultValue", Jn(e, It(e.defaultValue), (e) => En({ defaultValue: e })), U);
810
- }
811
812
  function Vn(e) {
812
- let t = Array.isArray(e.defaultValue) ? e.defaultValue : [], n = e.options.filter((e) => t.includes(e.value)).map(E);
813
- return /* @__PURE__ */ y(_, { children: [$("預設值", "fieldDefaultValue", e.type === "checkbox" ? /* @__PURE__ */ v(m, {
813
+ return $("預設值", "fieldDefaultValue", Yn(e, Lt(e.defaultValue), (e) => Dn({ defaultValue: e })), H);
814
+ }
815
+ function Hn(e) {
816
+ let t = Array.isArray(e.defaultValue) ? e.defaultValue : [], n = e.options.filter((e) => t.includes(e.value)).map(T);
817
+ return /* @__PURE__ */ v(g, { children: [$("預設值", "fieldDefaultValue", e.type === "checkbox" ? /* @__PURE__ */ _(p, {
814
818
  clearable: !0,
815
819
  mode: "multiple",
816
820
  onChange: (e) => X({ defaultValue: e.length ? e.map((e) => e.id) : void 0 }),
817
- options: e.options.map(E),
821
+ options: e.options.map(T),
818
822
  placeholder: "選擇一或多個預設選項",
819
823
  value: n
820
- }) : /* @__PURE__ */ v(m, {
824
+ }) : /* @__PURE__ */ _(p, {
821
825
  clearable: !0,
822
826
  onChange: (e) => X({ defaultValue: e?.id || void 0 }),
823
- options: e.options.map(E),
827
+ options: e.options.map(T),
824
828
  placeholder: "選擇預設選項",
825
- value: typeof e.defaultValue == "string" ? D(e.options.map(E), e.defaultValue) : null
826
- }), U), $("選項", "fieldOptions", Yn(e), U, !0)] });
829
+ value: typeof e.defaultValue == "string" ? E(e.options.map(T), e.defaultValue) : null
830
+ }), H), $("選項", "fieldOptions", Xn(e), H, !0)] });
827
831
  }
828
- function Hn(e) {
832
+ function Un(e) {
829
833
  let t = typeof e.defaultValue == "boolean" ? String(e.defaultValue) : "unset";
830
- return $("預設值", "fieldDefaultValue", /* @__PURE__ */ v(m, {
834
+ return $("預設值", "fieldDefaultValue", /* @__PURE__ */ _(p, {
831
835
  clearable: !1,
832
- onChange: (e) => Dn({ defaultValue: e?.id === "true" ? !0 : e?.id === "false" ? !1 : void 0 }),
836
+ onChange: (e) => On({ defaultValue: e?.id === "true" ? !0 : e?.id === "false" ? !1 : void 0 }),
833
837
  options: [...kt],
834
838
  placeholder: "選擇預設狀態",
835
- value: D(kt, t)
836
- }), U);
839
+ value: E(kt, t)
840
+ }), H);
837
841
  }
838
- function Un(e) {
839
- return /* @__PURE__ */ y(_, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (e) => On({ maxFiles: e }), "例如:1", { min: 1 }), U), $("MIME", "fieldAcceptedMimeTypes", qn({
840
- disabled: U,
842
+ function Wn(e) {
843
+ return /* @__PURE__ */ v(g, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (e) => kn({ maxFiles: e }), "例如:1", { min: 1 }), H), $("MIME", "fieldAcceptedMimeTypes", Jn({
844
+ disabled: H,
841
845
  name: "fieldAcceptedMimeTypes",
842
- onChange: (e) => On({ acceptedMimeTypes: Lt(e) }),
846
+ onChange: (e) => kn({ acceptedMimeTypes: Rt(e) }),
843
847
  placeholder: "每行一個 MIME type,例如:application/pdf",
844
848
  rows: 3,
845
- value: Rt(e.acceptedMimeTypes)
849
+ value: zt(e.acceptedMimeTypes)
846
850
  }), !1)] });
847
851
  }
848
- function Wn(e) {
849
- let t = w.fields.filter((t) => t.fieldKey !== e.fieldKey);
850
- return t.length ? /* @__PURE__ */ v(_, { children: jt.map((n) => Gn(e, n, t)) }) : /* @__PURE__ */ v(g, {
852
+ function Gn(e) {
853
+ let t = D.fields.filter((t) => t.fieldKey !== e.fieldKey);
854
+ return t.length ? /* @__PURE__ */ _(g, { children: jt.map((n) => Kn(e, n, t)) }) : /* @__PURE__ */ _(h, {
851
855
  color: "text-neutral",
852
856
  style: ft,
853
857
  variant: "body",
854
858
  children: "目前沒有其他欄位可作為條件來源。新增更多欄位後即可設定條件規則。"
855
859
  });
856
860
  }
857
- function Gn(e, t, n) {
858
- let r = e[t.target], i = r ? Ae(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(Pt), c = Pe(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Ie(o), u = i?.value ?? Le(o), d = !!r, f = d && (!i || !a);
859
- return $(t.label, t.name, /* @__PURE__ */ y("div", {
861
+ function Kn(e, t, n) {
862
+ let r = e[t.target], i = r ? je(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(Ft), c = Fe(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Le(o), ee = i?.value ?? Re(o), u = !!r, te = u && (!i || !a);
863
+ return $(t.label, t.name, /* @__PURE__ */ v("div", {
860
864
  style: xt,
861
- children: [/* @__PURE__ */ v(ue, {
862
- checked: d,
863
- disabled: U,
864
- label: d ? "已啟用" : "不啟用",
865
- onChange: (e) => Z(t.target, e.target.checked ? T(o, Ie(o), Le(o)) : void 0),
865
+ children: [/* @__PURE__ */ _(de, {
866
+ checked: u,
867
+ disabled: H,
868
+ label: u ? "已啟用" : "不啟用",
869
+ onChange: (e) => Z(t.target, e.target.checked ? w(o, Le(o), Re(o)) : void 0),
866
870
  size: "sub",
867
871
  supportingText: t.supportingText
868
- }), d ? f ? /* @__PURE__ */ v(g, {
872
+ }), u ? te ? /* @__PURE__ */ _(h, {
869
873
  color: "text-warning",
870
874
  variant: "body",
871
875
  children: "這個規則不是目前 UI 支援的格式。重新選擇條件後會取代既有規則。"
872
- }) : /* @__PURE__ */ y("div", {
876
+ }) : /* @__PURE__ */ v("div", {
873
877
  style: St,
874
878
  children: [
875
- /* @__PURE__ */ v(m, {
879
+ /* @__PURE__ */ _(p, {
876
880
  clearable: !1,
877
881
  onChange: (e) => {
878
882
  let r = n.find((t) => t.fieldKey === e?.id) ?? o;
879
- Z(t.target, T(r, Ie(r), Le(r)));
883
+ Z(t.target, w(r, Le(r), Re(r)));
880
884
  },
881
885
  options: s,
882
886
  placeholder: "選擇欄位",
883
- value: D(s, o.fieldKey)
887
+ value: E(s, o.fieldKey)
884
888
  }),
885
- /* @__PURE__ */ v(m, {
889
+ /* @__PURE__ */ _(p, {
886
890
  clearable: !1,
887
- onChange: (e) => Z(t.target, T(o, Ne(e?.id) ?? l, u)),
891
+ onChange: (e) => Z(t.target, w(o, Pe(e?.id) ?? l, ee)),
888
892
  options: [...c],
889
893
  placeholder: "判斷方式",
890
- value: D(c, l)
894
+ value: E(c, l)
891
895
  }),
892
- Kn(o, u, (e) => Z(t.target, T(o, l, e)))
896
+ qn(o, ee, (e) => Z(t.target, w(o, l, e)))
893
897
  ]
894
898
  }) : null]
895
- }), U, !0);
899
+ }), H, !0);
896
900
  }
897
901
  function Z(e, t) {
898
- q({ [e]: t });
902
+ K({ [e]: t });
899
903
  }
900
- function Kn(e, t, n) {
901
- if (e.type === "boolean") return /* @__PURE__ */ v(m, {
904
+ function qn(e, t, n) {
905
+ if (e.type === "boolean") return /* @__PURE__ */ _(p, {
902
906
  clearable: !1,
903
907
  onChange: (e) => n(e?.id ?? "true"),
904
908
  options: [...At],
905
909
  placeholder: "比較值",
906
- value: D(At, t === "false" ? "false" : "true")
910
+ value: E(At, t === "false" ? "false" : "true")
907
911
  });
908
- if (ke(e)) {
909
- let r = e.options.map(E);
910
- return /* @__PURE__ */ v(m, {
912
+ if (Ae(e)) {
913
+ let r = e.options.map(T);
914
+ return /* @__PURE__ */ _(p, {
911
915
  clearable: !1,
912
916
  onChange: (e) => n(e?.id ?? r[0]?.id ?? ""),
913
917
  options: r,
914
918
  placeholder: "比較值",
915
- value: D(r, t)
919
+ value: E(r, t)
916
920
  });
917
921
  }
918
- return Oe(e) ? Q(je(t), (e) => n(String(e ?? 0)), "比較值") : De(e) ? Jn(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ v(p, {
922
+ return ke(e) ? Q(Me(t), (e) => n(String(e ?? 0)), "比較值") : Oe(e) ? Yn(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ _(f, {
919
923
  onChange: (e) => n(e.target.value),
920
924
  placeholder: "比較值",
921
925
  value: t,
922
926
  variant: "base"
923
927
  });
924
928
  }
925
- function qn({ disabled: e, name: t, onChange: n, placeholder: r, rows: i, value: a }) {
926
- return /* @__PURE__ */ v(le, {
929
+ function Jn({ disabled: e, name: t, onChange: n, placeholder: r, rows: i, value: a }) {
930
+ return /* @__PURE__ */ _(ue, {
927
931
  "aria-label": t,
928
932
  disabled: e,
929
933
  onChange: (e) => n(e.target.value),
@@ -936,10 +940,10 @@ function F({ formId: de }) {
936
940
  });
937
941
  }
938
942
  function Q(e, t, n, r = {}) {
939
- return /* @__PURE__ */ v(p, {
943
+ return /* @__PURE__ */ _(f, {
940
944
  max: r.max,
941
945
  min: r.min,
942
- onChange: (e) => t(Se(je(e.target.value), r)),
946
+ onChange: (e) => t(Ce(Me(e.target.value), r)),
943
947
  placeholder: n,
944
948
  showSpinner: !0,
945
949
  step: r.step ?? 1,
@@ -947,30 +951,30 @@ function F({ formId: de }) {
947
951
  variant: "measure"
948
952
  });
949
953
  }
950
- function Jn(e, t, n) {
951
- return e.type === "datetime" ? /* @__PURE__ */ v(te, {
954
+ function Yn(e, t, n) {
955
+ return e.type === "datetime" ? /* @__PURE__ */ _(re, {
952
956
  formatDate: "YYYY-MM-DD",
953
957
  formatTime: "HH:mm",
954
958
  hideSecond: !0,
955
- onChange: (e) => n(Ee(e)),
959
+ onChange: (e) => n(De(e)),
956
960
  placeholderLeft: "選擇日期",
957
961
  placeholderRight: "選擇時間",
958
- value: Fe(t)
959
- }) : /* @__PURE__ */ v(ee, {
962
+ value: Ie(t)
963
+ }) : /* @__PURE__ */ _(ne, {
960
964
  format: "YYYY-MM-DD",
961
- onChange: (e) => n(Te(e)),
965
+ onChange: (e) => n(Ee(e)),
962
966
  placeholder: "選擇日期",
963
- value: Fe(t)
967
+ value: Ie(t)
964
968
  });
965
969
  }
966
- function Yn(e) {
967
- return /* @__PURE__ */ y("div", {
970
+ function Xn(e) {
971
+ return /* @__PURE__ */ v("div", {
968
972
  style: Tt,
969
- children: [/* @__PURE__ */ v(ce, {
973
+ children: [/* @__PURE__ */ _(le, {
970
974
  actions: {
971
975
  render: (t) => [{
972
- disabled: () => U || e.options.length <= 1,
973
- icon: ye,
976
+ disabled: () => H || e.options.length <= 1,
977
+ icon: be,
974
978
  iconType: "icon-only",
975
979
  name: "移除選項",
976
980
  onClick: () => X({ options: e.options.filter((e, n) => n !== t.index) }),
@@ -980,8 +984,8 @@ function F({ formId: de }) {
980
984
  },
981
985
  columns: [{
982
986
  key: "label",
983
- render: (t) => /* @__PURE__ */ v(p, {
984
- onChange: (n) => X({ options: zt(e.options, t.index, { label: n.target.value }) }),
987
+ render: (t) => /* @__PURE__ */ _(f, {
988
+ onChange: (n) => X({ options: Bt(e.options, t.index, { label: n.target.value }) }),
985
989
  placeholder: "例如:主管",
986
990
  size: "sub",
987
991
  value: t.label,
@@ -990,8 +994,8 @@ function F({ formId: de }) {
990
994
  title: "Label"
991
995
  }, {
992
996
  key: "value",
993
- render: (t) => /* @__PURE__ */ v(p, {
994
- onChange: (n) => X({ options: zt(e.options, t.index, { value: n.target.value }) }),
997
+ render: (t) => /* @__PURE__ */ _(f, {
998
+ onChange: (n) => X({ options: Bt(e.options, t.index, { value: n.target.value }) }),
995
999
  placeholder: "例如:manager",
996
1000
  size: "sub",
997
1001
  value: t.value,
@@ -1007,21 +1011,21 @@ function F({ formId: de }) {
1007
1011
  })),
1008
1012
  showHeader: !0,
1009
1013
  size: "sub"
1010
- }), /* @__PURE__ */ v("div", {
1014
+ }), /* @__PURE__ */ _("div", {
1011
1015
  style: Et,
1012
- children: /* @__PURE__ */ v(f, {
1013
- disabled: U,
1014
- icon: _e,
1016
+ children: /* @__PURE__ */ _(d, {
1017
+ disabled: H,
1018
+ icon: ve,
1015
1019
  iconType: "leading",
1016
- onClick: () => X({ options: [...e.options, Bt(e.options)] }),
1020
+ onClick: () => X({ options: [...e.options, Vt(e.options)] }),
1017
1021
  variant: "base-secondary",
1018
1022
  children: "新增選項"
1019
1023
  })
1020
1024
  })]
1021
1025
  });
1022
1026
  }
1023
- function Xn(e, t, n) {
1024
- return /* @__PURE__ */ v("div", {
1027
+ function Zn(e, t, n) {
1028
+ return /* @__PURE__ */ _("div", {
1025
1029
  ...t.draggableProps,
1026
1030
  "data-form-builder-field-key": e.fieldKey,
1027
1031
  ref: t.innerRef,
@@ -1030,16 +1034,16 @@ function F({ formId: de }) {
1030
1034
  ...n ? at : null,
1031
1035
  ...t.draggableProps.style
1032
1036
  },
1033
- children: /* @__PURE__ */ v(d, { children: Zn(e, t, n) })
1037
+ children: /* @__PURE__ */ _(te, { children: Qn(e, t, n) })
1034
1038
  });
1035
1039
  }
1036
- function $(e, t, n, i, a = !1) {
1037
- return /* @__PURE__ */ v("div", {
1040
+ function $(e, t, n, r, a = !1) {
1041
+ return /* @__PURE__ */ _("div", {
1038
1042
  style: a ? mt : pt,
1039
- children: /* @__PURE__ */ v("div", {
1043
+ children: /* @__PURE__ */ _("div", {
1040
1044
  style: ht,
1041
- children: /* @__PURE__ */ v(r, {
1042
- disabled: i,
1045
+ children: /* @__PURE__ */ _(i, {
1046
+ disabled: r,
1043
1047
  label: e,
1044
1048
  name: t,
1045
1049
  children: n
@@ -1047,41 +1051,41 @@ function F({ formId: de }) {
1047
1051
  })
1048
1052
  });
1049
1053
  }
1050
- function Zn(e, t, n) {
1051
- return /* @__PURE__ */ y("div", {
1054
+ function Qn(e, t, n) {
1055
+ return /* @__PURE__ */ v("div", {
1052
1056
  ...t.dragHandleProps ?? {},
1053
1057
  "aria-label": "拖曳排序欄位",
1054
1058
  style: et,
1055
1059
  title: "拖曳排序",
1056
1060
  children: [
1057
- /* @__PURE__ */ v("span", {
1061
+ /* @__PURE__ */ _("span", {
1058
1062
  "aria-label": "拖曳排序",
1059
1063
  role: "img",
1060
1064
  style: Ct,
1061
1065
  title: "拖曳排序",
1062
- children: /* @__PURE__ */ v(ne, {
1063
- icon: me,
1066
+ children: /* @__PURE__ */ _(ie, {
1067
+ icon: ge,
1064
1068
  size: 20
1065
1069
  })
1066
1070
  }),
1067
- /* @__PURE__ */ y("div", {
1071
+ /* @__PURE__ */ v("div", {
1068
1072
  style: tt,
1069
- children: [/* @__PURE__ */ y(g, {
1073
+ children: [/* @__PURE__ */ v(h, {
1070
1074
  component: "span",
1071
1075
  ellipsis: !0,
1072
1076
  variant: "label-primary",
1073
- children: [e.label, e.required ? /* @__PURE__ */ v("sup", {
1077
+ children: [e.label, e.required ? /* @__PURE__ */ _("sup", {
1074
1078
  "aria-label": "必填",
1075
1079
  style: Dt,
1076
1080
  children: "*"
1077
1081
  }) : null]
1078
- }), /* @__PURE__ */ y(g, {
1082
+ }), /* @__PURE__ */ v(h, {
1079
1083
  color: "text-neutral",
1080
1084
  component: "span",
1081
1085
  ellipsis: !0,
1082
1086
  variant: "caption",
1083
1087
  children: [
1084
- Mt(e.type),
1088
+ Nt(e.type),
1085
1089
  " ·",
1086
1090
  e.required ? " 必填" : " 選填",
1087
1091
  " ·",
@@ -1089,31 +1093,31 @@ function F({ formId: de }) {
1089
1093
  ]
1090
1094
  })]
1091
1095
  }),
1092
- /* @__PURE__ */ y("div", {
1096
+ /* @__PURE__ */ v("div", {
1093
1097
  style: nt,
1094
1098
  children: [
1095
- /* @__PURE__ */ v("div", {
1099
+ /* @__PURE__ */ _("div", {
1096
1100
  style: rt,
1097
- children: /* @__PURE__ */ v(ue, {
1101
+ children: /* @__PURE__ */ _(de, {
1098
1102
  checked: !!e.required,
1099
- disabled: U || n,
1103
+ disabled: H || n,
1100
1104
  label: "必填",
1101
- onChange: (t) => An(e.fieldKey, t.target.checked)
1105
+ onChange: (t) => jn(e.fieldKey, t.target.checked)
1102
1106
  })
1103
1107
  }),
1104
- /* @__PURE__ */ v(f, {
1108
+ /* @__PURE__ */ _(d, {
1105
1109
  disabled: n,
1106
- icon: he,
1110
+ icon: _e,
1107
1111
  iconType: "icon-only",
1108
- onClick: () => V(e.fieldKey),
1109
- variant: e.fieldKey === G?.fieldKey ? "base-primary" : "base-ghost",
1112
+ onClick: () => B(e.fieldKey),
1113
+ variant: e.fieldKey === W?.fieldKey ? "base-primary" : "base-ghost",
1110
1114
  children: "編輯欄位"
1111
1115
  }),
1112
- /* @__PURE__ */ v(f, {
1113
- disabled: U || n,
1114
- icon: ye,
1116
+ /* @__PURE__ */ _(d, {
1117
+ disabled: H || n,
1118
+ icon: be,
1115
1119
  iconType: "icon-only",
1116
- onClick: () => Cn(e.fieldKey),
1120
+ onClick: () => Tn(e.fieldKey),
1117
1121
  variant: "destructive-ghost",
1118
1122
  children: "移除欄位"
1119
1123
  })
@@ -1122,78 +1126,78 @@ function F({ formId: de }) {
1122
1126
  ]
1123
1127
  });
1124
1128
  }
1125
- function Qn() {
1126
- return /* @__PURE__ */ y("div", {
1129
+ function $n() {
1130
+ return /* @__PURE__ */ v("div", {
1127
1131
  style: M,
1128
- children: [/* @__PURE__ */ v(g, {
1132
+ children: [/* @__PURE__ */ _(h, {
1129
1133
  component: "h2",
1130
1134
  variant: "h3",
1131
1135
  children: "填寫預覽"
1132
- }), /* @__PURE__ */ v(i, {
1133
- onChange: kn,
1134
- schema: w,
1136
+ }), /* @__PURE__ */ _(a, {
1137
+ onChange: An,
1138
+ schema: D,
1135
1139
  uiSchema: k,
1136
- value: Vt
1140
+ value: Gt
1137
1141
  })]
1138
1142
  });
1139
1143
  }
1140
- function $n() {
1141
- return /* @__PURE__ */ y("div", {
1144
+ function er() {
1145
+ return /* @__PURE__ */ v("div", {
1142
1146
  style: M,
1143
- children: [/* @__PURE__ */ v(g, {
1147
+ children: [/* @__PURE__ */ _(h, {
1144
1148
  component: "h2",
1145
1149
  variant: "h3",
1146
1150
  children: "版本紀錄"
1147
- }), /* @__PURE__ */ v(ce, {
1148
- columns: sn,
1149
- dataSource: on,
1150
- loading: tn
1151
+ }), /* @__PURE__ */ _(le, {
1152
+ columns: ln,
1153
+ dataSource: cn,
1154
+ loading: rn
1151
1155
  })]
1152
1156
  });
1153
1157
  }
1154
- function er() {
1155
- return /* @__PURE__ */ y("div", {
1158
+ function tr() {
1159
+ return /* @__PURE__ */ v("div", {
1156
1160
  style: M,
1157
- children: [/* @__PURE__ */ v(g, {
1161
+ children: [/* @__PURE__ */ _(h, {
1158
1162
  component: "h2",
1159
1163
  variant: "h3",
1160
1164
  children: "Schema"
1161
- }), /* @__PURE__ */ y("div", {
1165
+ }), /* @__PURE__ */ v("div", {
1162
1166
  style: _t,
1163
1167
  children: [
1164
- tr("Form Schema", "schemaJson", /* @__PURE__ */ v(Ke, {
1165
- disabled: U,
1168
+ nr("Form Schema", "schemaJson", /* @__PURE__ */ _(Ke, {
1169
+ disabled: H,
1166
1170
  height: "360px",
1167
1171
  name: "schemaJson",
1168
- onChange: jn,
1172
+ onChange: Mn,
1169
1173
  placeholder: "輸入 Form Schema JSON",
1170
- value: We
1174
+ value: Ge
1171
1175
  })),
1172
- tr("UI Schema", "uiSchemaJson", /* @__PURE__ */ v(Ke, {
1173
- disabled: U,
1176
+ nr("UI Schema", "uiSchemaJson", /* @__PURE__ */ _(Ke, {
1177
+ disabled: H,
1174
1178
  height: "240px",
1175
1179
  name: "uiSchemaJson",
1176
- onChange: Mn,
1180
+ onChange: Nn,
1177
1181
  placeholder: "輸入 UI Schema JSON",
1178
- value: Ge
1182
+ value: Mt
1179
1183
  })),
1180
- Jt ? /* @__PURE__ */ v(g, {
1184
+ Xt ? /* @__PURE__ */ _(h, {
1181
1185
  color: "text-error",
1182
1186
  style: bt,
1183
1187
  variant: "body",
1184
- children: Jt
1188
+ children: Xt
1185
1189
  }) : null
1186
1190
  ]
1187
1191
  })]
1188
1192
  });
1189
1193
  }
1190
- function tr(e, t, n) {
1191
- return /* @__PURE__ */ v("div", {
1194
+ function nr(e, t, n) {
1195
+ return /* @__PURE__ */ _("div", {
1192
1196
  style: vt,
1193
- children: /* @__PURE__ */ v("div", {
1197
+ children: /* @__PURE__ */ _("div", {
1194
1198
  style: yt,
1195
- children: /* @__PURE__ */ v(r, {
1196
- disabled: U,
1199
+ children: /* @__PURE__ */ _(i, {
1200
+ disabled: H,
1197
1201
  label: e,
1198
1202
  name: t,
1199
1203
  children: n
@@ -1202,55 +1206,55 @@ function F({ formId: de }) {
1202
1206
  });
1203
1207
  }
1204
1208
  }
1205
- function Mt(e) {
1209
+ function Nt(e) {
1206
1210
  return qe.find((t) => t.type === e)?.label ?? e;
1207
1211
  }
1208
- function Nt(e) {
1212
+ function Pt(e) {
1209
1213
  return !!(e.visibleWhen || e.requiredWhen || e.readonlyWhen);
1210
1214
  }
1211
- function Pt(e) {
1215
+ function Ft(e) {
1212
1216
  return {
1213
1217
  id: e.fieldKey,
1214
1218
  name: e.label
1215
1219
  };
1216
1220
  }
1217
- function Ft(e) {
1221
+ function It(e) {
1218
1222
  return e.type === "text" || e.type === "textarea";
1219
1223
  }
1220
- function It(e) {
1224
+ function Lt(e) {
1221
1225
  return typeof e == "string" ? e : "";
1222
1226
  }
1223
- function Lt(e) {
1227
+ function Rt(e) {
1224
1228
  let t = e.split(/[\n,]/u).map((e) => e.trim()).filter(Boolean);
1225
1229
  return t.length ? t : void 0;
1226
1230
  }
1227
- function Rt(e) {
1231
+ function zt(e) {
1228
1232
  return e?.join("\n") ?? "";
1229
1233
  }
1230
- function I(e) {
1234
+ function F(e) {
1231
1235
  return JSON.stringify(e, null, 2);
1232
1236
  }
1233
- function zt(e, t, n) {
1237
+ function Bt(e, t, n) {
1234
1238
  return e.map((e, r) => r === t ? {
1235
1239
  ...e,
1236
1240
  ...n
1237
1241
  } : e);
1238
1242
  }
1239
- function Bt(e) {
1243
+ function Vt(e) {
1240
1244
  let t = e.length + 1;
1241
1245
  return {
1242
1246
  label: `選項 ${t}`,
1243
- value: Vt(e, t)
1247
+ value: I(e, t)
1244
1248
  };
1245
1249
  }
1246
- function Vt(e, t) {
1250
+ function I(e, t) {
1247
1251
  let n = `option_${t}`;
1248
- return e.some((e) => e.value === n) ? Vt(e, t + 1) : n;
1252
+ return e.some((e) => e.value === n) ? I(e, t + 1) : n;
1249
1253
  }
1250
1254
  function Ht(e, t) {
1251
1255
  return {
1252
- schemaJson: I(e),
1253
- uiSchemaJson: I(t)
1256
+ schemaJson: F(e),
1257
+ uiSchemaJson: F(t)
1254
1258
  };
1255
1259
  }
1256
1260
  function Ut(e, t) {
@@ -1277,24 +1281,24 @@ function Kt(e, t, n) {
1277
1281
  ];
1278
1282
  }
1279
1283
  function qt({ status: e }) {
1280
- return e === "PUBLISHED" ? /* @__PURE__ */ v(u, {
1284
+ return e === "PUBLISHED" ? /* @__PURE__ */ _(u, {
1281
1285
  size: "sub",
1282
1286
  text: "已發布",
1283
1287
  variant: "dot-success"
1284
- }) : e === "ARCHIVED" ? /* @__PURE__ */ v(u, {
1288
+ }) : e === "ARCHIVED" ? /* @__PURE__ */ _(u, {
1285
1289
  size: "sub",
1286
1290
  text: "已封存",
1287
1291
  variant: "dot-inactive"
1288
- }) : /* @__PURE__ */ v(u, {
1292
+ }) : /* @__PURE__ */ _(u, {
1289
1293
  size: "sub",
1290
1294
  text: "草稿",
1291
1295
  variant: "dot-warning"
1292
1296
  });
1293
1297
  }
1294
- function L(e) {
1298
+ function Jt(e) {
1295
1299
  return e instanceof Error ? e.message : "發生未知錯誤";
1296
1300
  }
1297
1301
  //#endregion
1298
- export { F as t };
1302
+ export { Mt as t };
1299
1303
 
1300
- //# sourceMappingURL=builder-Du_0apkh.js.map
1304
+ //# sourceMappingURL=builder-D950gct_.js.map