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