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