@rytass/bpm-core-react 0.3.7 → 0.4.0

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