@rytass/bpm-core-react 0.8.0 → 0.9.1

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 (154) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +18 -2
  3. package/dist/chunks/FormBuilderView-BPLwAJGv.cjs +3 -0
  4. package/dist/chunks/FormBuilderView-BPLwAJGv.cjs.map +1 -0
  5. package/dist/chunks/FormBuilderView-Do9-MIAe.js +1477 -0
  6. package/dist/chunks/FormBuilderView-Do9-MIAe.js.map +1 -0
  7. package/dist/chunks/FormRendererView-C5POZbWz.js +492 -0
  8. package/dist/chunks/FormRendererView-C5POZbWz.js.map +1 -0
  9. package/dist/chunks/FormRendererView-DNtNodNl.cjs +2 -0
  10. package/dist/chunks/FormRendererView-DNtNodNl.cjs.map +1 -0
  11. package/dist/chunks/{approval-instance-list-page-YZcGGDD8.js → approval-instance-list-page-BjX2kaoF.js} +56 -54
  12. package/dist/chunks/approval-instance-list-page-BjX2kaoF.js.map +1 -0
  13. package/dist/chunks/approval-instance-list-page-C408vxE2.cjs +2 -0
  14. package/dist/chunks/approval-instance-list-page-C408vxE2.cjs.map +1 -0
  15. package/dist/chunks/{categories-DBPoSrsi.js → categories-DGlxuC6X.js} +5 -5
  16. package/dist/chunks/{categories-DBPoSrsi.js.map → categories-DGlxuC6X.js.map} +1 -1
  17. package/dist/chunks/{categories-B6QZKZRt.cjs → categories-DUfldZ_9.cjs} +2 -2
  18. package/dist/chunks/{categories-B6QZKZRt.cjs.map → categories-DUfldZ_9.cjs.map} +1 -1
  19. package/dist/chunks/compose-CULMDsLS.cjs +2 -0
  20. package/dist/chunks/compose-CULMDsLS.cjs.map +1 -0
  21. package/dist/chunks/{compose-CQHDT7vh.js → compose-DJBlA5PD.js} +60 -58
  22. package/dist/chunks/compose-DJBlA5PD.js.map +1 -0
  23. package/dist/chunks/{delegations-DDEk-WI6.cjs → delegations-CGj-tZNO.cjs} +2 -2
  24. package/dist/chunks/{delegations-DDEk-WI6.cjs.map → delegations-CGj-tZNO.cjs.map} +1 -1
  25. package/dist/chunks/{delegations-iVnRi3QE.js → delegations-DLEEFBlH.js} +231 -231
  26. package/dist/chunks/{delegations-iVnRi3QE.js.map → delegations-DLEEFBlH.js.map} +1 -1
  27. package/dist/chunks/{delegations-ZNtodFaD.js → delegations-DqMpI_Nk.js} +168 -167
  28. package/dist/chunks/delegations-DqMpI_Nk.js.map +1 -0
  29. package/dist/chunks/delegations-kbMOSEif.cjs +2 -0
  30. package/dist/chunks/delegations-kbMOSEif.cjs.map +1 -0
  31. package/dist/chunks/{designer-CUbVXEtS.js → designer-BszXJ5RO.js} +1227 -990
  32. package/dist/chunks/designer-BszXJ5RO.js.map +1 -0
  33. package/dist/chunks/designer-CmqAU92b.cjs +65 -0
  34. package/dist/chunks/designer-CmqAU92b.cjs.map +1 -0
  35. package/dist/chunks/detail-CDexqBoU.cjs +2 -0
  36. package/dist/chunks/detail-CDexqBoU.cjs.map +1 -0
  37. package/dist/chunks/{detail-Cts5_gVp.js → detail-DAak2OXS.js} +704 -622
  38. package/dist/chunks/detail-DAak2OXS.js.map +1 -0
  39. package/dist/chunks/notifications--hwl-DR0.cjs +2 -0
  40. package/dist/chunks/{notifications-BKs4--96.cjs.map → notifications--hwl-DR0.cjs.map} +1 -1
  41. package/dist/chunks/{notifications-CSulztkU.js → notifications-DJ5wzCye.js} +7 -7
  42. package/dist/chunks/{notifications-CSulztkU.js.map → notifications-DJ5wzCye.js.map} +1 -1
  43. package/dist/chunks/{orgs-CrNxqlwp.js → orgs-DytLvZ_X.js} +243 -241
  44. package/dist/chunks/{orgs-CrNxqlwp.js.map → orgs-DytLvZ_X.js.map} +1 -1
  45. package/dist/chunks/orgs-Ni22buHs.cjs +2 -0
  46. package/dist/chunks/orgs-Ni22buHs.cjs.map +1 -0
  47. package/dist/chunks/providers-DEqcuXw9.js +506 -0
  48. package/dist/chunks/providers-DEqcuXw9.js.map +1 -0
  49. package/dist/chunks/providers-D_zTbkQH.cjs +2 -0
  50. package/dist/chunks/providers-D_zTbkQH.cjs.map +1 -0
  51. package/dist/chunks/{users-qghSMtLn.cjs → users-0HqlM_VQ.cjs} +2 -2
  52. package/dist/chunks/{users-qghSMtLn.cjs.map → users-0HqlM_VQ.cjs.map} +1 -1
  53. package/dist/chunks/{users-CUY139DF.js → users-FWrb3ehW.js} +5 -5
  54. package/dist/chunks/{users-CUY139DF.js.map → users-FWrb3ehW.js.map} +1 -1
  55. package/dist/components/notification-drawer.d.ts +4 -3
  56. package/dist/index.cjs +1 -1
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.js +21 -428
  59. package/dist/index.js.map +1 -1
  60. package/dist/next/index.cjs +1 -1
  61. package/dist/next/index.cjs.map +1 -1
  62. package/dist/next/index.js +16 -15
  63. package/dist/next/index.js.map +1 -1
  64. package/dist/pages/admin/delegations/index.cjs +1 -1
  65. package/dist/pages/admin/delegations/index.js +1 -1
  66. package/dist/pages/admin/orgs/index.cjs +1 -1
  67. package/dist/pages/admin/orgs/index.js +1 -1
  68. package/dist/pages/admin/users/index.cjs +1 -1
  69. package/dist/pages/admin/users/index.js +1 -1
  70. package/dist/pages/delegations/index.cjs +1 -1
  71. package/dist/pages/delegations/index.js +1 -1
  72. package/dist/pages/instances/detail/index.cjs +1 -1
  73. package/dist/pages/instances/detail/index.js +1 -1
  74. package/dist/pages/settings/notifications/index.cjs +1 -1
  75. package/dist/pages/settings/notifications/index.js +1 -1
  76. package/dist/pages/templates/categories/index.cjs +1 -1
  77. package/dist/pages/templates/categories/index.js +1 -1
  78. package/dist/pages/templates/compose/index.cjs +1 -1
  79. package/dist/pages/templates/compose/index.js +1 -1
  80. package/dist/pages/templates/designer/index.cjs +1 -1
  81. package/dist/pages/templates/designer/index.js +1 -1
  82. package/dist/views/admin/delegations/index.cjs +1 -1
  83. package/dist/views/admin/delegations/index.js +1 -1
  84. package/dist/views/admin/index.cjs +1 -1
  85. package/dist/views/admin/index.js +3 -3
  86. package/dist/views/admin/orgs/index.cjs +1 -1
  87. package/dist/views/admin/orgs/index.js +1 -1
  88. package/dist/views/admin/users/index.cjs +1 -1
  89. package/dist/views/admin/users/index.js +1 -1
  90. package/dist/views/cc/index.cjs +1 -1
  91. package/dist/views/cc/index.js +1 -1
  92. package/dist/views/delegations/index.cjs +1 -1
  93. package/dist/views/delegations/index.js +1 -1
  94. package/dist/views/forms/builder/index.cjs +1 -1
  95. package/dist/views/forms/builder/index.js +1 -1
  96. package/dist/views/forms/renderer/FormRendererView.d.ts +7 -2
  97. package/dist/views/forms/renderer/form-data-source-field.d.ts +34 -0
  98. package/dist/views/forms/renderer/index.cjs +1 -1
  99. package/dist/views/forms/renderer/index.d.ts +1 -0
  100. package/dist/views/forms/renderer/index.js +2 -2
  101. package/dist/views/instances/detail/index.cjs +1 -1
  102. package/dist/views/instances/detail/index.js +1 -1
  103. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +4 -1
  104. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +5 -1
  105. package/dist/views/instances/new/index.cjs +1 -1
  106. package/dist/views/instances/new/index.cjs.map +1 -1
  107. package/dist/views/instances/new/index.js +105 -86
  108. package/dist/views/instances/new/index.js.map +1 -1
  109. package/dist/views/search/index.cjs +1 -1
  110. package/dist/views/search/index.js +1 -1
  111. package/dist/views/sent/index.cjs +1 -1
  112. package/dist/views/sent/index.js +1 -1
  113. package/dist/views/settings/index.cjs +1 -1
  114. package/dist/views/settings/index.js +1 -1
  115. package/dist/views/settings/notifications/index.cjs +1 -1
  116. package/dist/views/settings/notifications/index.js +1 -1
  117. package/dist/views/templates/categories/index.cjs +1 -1
  118. package/dist/views/templates/categories/index.js +1 -1
  119. package/dist/views/templates/compose/TemplateComposeWizardView.d.ts +3 -2
  120. package/dist/views/templates/compose/index.cjs +1 -1
  121. package/dist/views/templates/compose/index.js +1 -1
  122. package/dist/views/templates/designer/index.cjs +1 -1
  123. package/dist/views/templates/designer/index.js +1 -1
  124. package/dist/views/templates/index.cjs +1 -1
  125. package/dist/views/templates/index.cjs.map +1 -1
  126. package/dist/views/templates/index.js +153 -112
  127. package/dist/views/templates/index.js.map +1 -1
  128. package/package.json +56 -11
  129. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs +0 -3
  130. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs.map +0 -1
  131. package/dist/chunks/FormBuilderView-D8DrQOXD.js +0 -1090
  132. package/dist/chunks/FormBuilderView-D8DrQOXD.js.map +0 -1
  133. package/dist/chunks/FormRendererView-BwVsH2eX.cjs +0 -2
  134. package/dist/chunks/FormRendererView-BwVsH2eX.cjs.map +0 -1
  135. package/dist/chunks/FormRendererView-DrHsuSVo.js +0 -220
  136. package/dist/chunks/FormRendererView-DrHsuSVo.js.map +0 -1
  137. package/dist/chunks/approval-instance-list-page-BMUKxzcz.cjs +0 -2
  138. package/dist/chunks/approval-instance-list-page-BMUKxzcz.cjs.map +0 -1
  139. package/dist/chunks/approval-instance-list-page-YZcGGDD8.js.map +0 -1
  140. package/dist/chunks/compose-CQHDT7vh.js.map +0 -1
  141. package/dist/chunks/compose-Ds_cAefe.cjs +0 -2
  142. package/dist/chunks/compose-Ds_cAefe.cjs.map +0 -1
  143. package/dist/chunks/delegations-C2wLWsDQ.cjs +0 -2
  144. package/dist/chunks/delegations-C2wLWsDQ.cjs.map +0 -1
  145. package/dist/chunks/delegations-ZNtodFaD.js.map +0 -1
  146. package/dist/chunks/designer-CQ9hxSdD.cjs +0 -65
  147. package/dist/chunks/designer-CQ9hxSdD.cjs.map +0 -1
  148. package/dist/chunks/designer-CUbVXEtS.js.map +0 -1
  149. package/dist/chunks/detail-B-Q4W-iw.cjs +0 -2
  150. package/dist/chunks/detail-B-Q4W-iw.cjs.map +0 -1
  151. package/dist/chunks/detail-Cts5_gVp.js.map +0 -1
  152. package/dist/chunks/notifications-BKs4--96.cjs +0 -2
  153. package/dist/chunks/orgs-iNJ0QEcK.cjs +0 -2
  154. package/dist/chunks/orgs-iNJ0QEcK.cjs.map +0 -1
@@ -1,1090 +0,0 @@
1
- "use client";
2
- import { t as e } from "./bpm-form-field-Cao0rMol.js";
3
- import { t } from "./FormRendererView-DrHsuSVo.js";
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, Section as ee, SectionGroup as te, Select as p, Tab as ne, TabItem as m, Table as re, Textarea as ie, Toggle as ae, Typography as h } from "@mezzanine-ui/react";
6
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
7
- import { AlignLeftIcon as oe, CalendarIcon as y, CheckedIcon as se, CheckedOutlineIcon as b, CurrencyDollarIcon as x, DotDragVerticalIcon as ce, DotGridIcon as S, FileAttachmentIcon as C, FileIcon as w, ListIcon as le, PlusIcon as ue, TrashIcon as de } from "@mezzanine-ui/icons";
8
- import { buildConditionExpression as T, buildFormRendererValues as fe, clampOptionalNumber as pe, createFieldDefinition as me, formatDatePickerValue as he, formatDateTimePickerValue as ge, isDateFieldDefinition as E, isNumberFieldDefinition as D, isSelectFieldDefinition as O, parseConditionRule as _e, parseOptionalNumberInput as ve, readConditionOperatorOption as ye, readConditionOperatorOptions as be, readDatePickerValue as xe, readDefaultConditionOperator as k, readDefaultConditionValue as A, readFieldOptionAsSelectOption as j, readSelectOption as M } from "@rytass/bpm-core-client/form";
9
- import { DragDropContext as Se, Draggable as Ce, Droppable as we } from "@hello-pangea/dnd";
10
- import N from "next/dynamic";
11
- import { json as Te } from "@codemirror/lang-json";
12
- import { EditorView as P } from "@codemirror/view";
13
- //#region src/views/forms/builder/json-code-editor.tsx
14
- var Ee = {
15
- alignItems: "center",
16
- border: "1px solid var(--mzn-color-border-neutral)",
17
- borderRadius: 4,
18
- color: "var(--mzn-color-text-neutral)",
19
- display: "flex",
20
- minHeight: 160,
21
- padding: 12,
22
- width: "100%"
23
- }, F = [
24
- Te(),
25
- P.lineWrapping,
26
- P.theme({
27
- "&": {
28
- border: "1px solid var(--mzn-color-border-neutral)",
29
- borderRadius: "4px",
30
- fontSize: "13px",
31
- width: "100%"
32
- },
33
- "&.cm-focused": { outline: "1px solid var(--mzn-color-border-primary)" },
34
- ".cm-content": {
35
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace",
36
- minHeight: "100%"
37
- },
38
- ".cm-editor": { width: "100%" },
39
- ".cm-gutters": { borderRight: "1px solid var(--mzn-color-border-neutral)" },
40
- ".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace" }
41
- })
42
- ], I = N(() => import("@uiw/react-codemirror"), {
43
- loading: () => /* @__PURE__ */ _("div", {
44
- style: Ee,
45
- children: "載入 JSON 編輯器"
46
- }),
47
- ssr: !1
48
- });
49
- function De({ disabled: e = !1, height: t, name: n, onChange: r, placeholder: i, value: a }) {
50
- return /* @__PURE__ */ _(I, {
51
- "aria-label": n,
52
- basicSetup: {
53
- autocompletion: !0,
54
- bracketMatching: !0,
55
- closeBrackets: !0,
56
- defaultKeymap: !0,
57
- foldGutter: !0,
58
- highlightActiveLine: !0,
59
- highlightSelectionMatches: !0,
60
- lineNumbers: !0,
61
- syntaxHighlighting: !0
62
- },
63
- editable: !e,
64
- extensions: [...F],
65
- height: t,
66
- indentWithTab: !1,
67
- onChange: r,
68
- placeholder: i,
69
- readOnly: e,
70
- theme: "light",
71
- value: a,
72
- width: "100%"
73
- });
74
- }
75
- //#endregion
76
- //#region src/views/forms/builder/FormBuilderView.tsx
77
- var Oe = [
78
- {
79
- description: "單行文字、姓名、編號",
80
- icon: oe,
81
- label: "文字",
82
- type: "text"
83
- },
84
- {
85
- description: "多行補充內容",
86
- icon: w,
87
- label: "長文字",
88
- type: "textarea"
89
- },
90
- {
91
- description: "金額、數量、分數",
92
- icon: x,
93
- label: "數字",
94
- type: "number"
95
- },
96
- {
97
- description: "金額與費用",
98
- icon: x,
99
- label: "金額",
100
- type: "money"
101
- },
102
- {
103
- description: "日期或到期日",
104
- icon: y,
105
- label: "日期",
106
- type: "date"
107
- },
108
- {
109
- description: "日期與時間",
110
- icon: y,
111
- label: "日期時間",
112
- type: "datetime"
113
- },
114
- {
115
- description: "是 / 否狀態",
116
- icon: se,
117
- label: "開關",
118
- type: "boolean"
119
- },
120
- {
121
- description: "固定選項擇一",
122
- icon: le,
123
- label: "下拉選單",
124
- type: "select"
125
- },
126
- {
127
- description: "固定選項單選",
128
- icon: S,
129
- label: "單選",
130
- type: "radio"
131
- },
132
- {
133
- description: "固定選項複選",
134
- icon: b,
135
- label: "複選",
136
- type: "checkbox"
137
- },
138
- {
139
- description: "附件或佐證資料",
140
- icon: C,
141
- label: "附件",
142
- type: "file_upload"
143
- }
144
- ], ke = {
145
- alignItems: "start",
146
- display: "flex",
147
- flexWrap: "wrap",
148
- gap: 16
149
- }, Ae = {
150
- flex: "0.55 1 300px",
151
- minWidth: 0
152
- }, je = {
153
- flex: "1.45 1 720px",
154
- minWidth: 620
155
- }, L = {
156
- display: "grid",
157
- gap: 12
158
- }, Me = {
159
- display: "flex",
160
- flexWrap: "wrap",
161
- gap: 6
162
- }, Ne = {
163
- flex: "0 0 auto",
164
- whiteSpace: "nowrap"
165
- }, Pe = {
166
- display: "grid",
167
- gap: 8
168
- }, Fe = {
169
- alignItems: "center",
170
- cursor: "grab",
171
- display: "flex",
172
- gap: 12,
173
- touchAction: "none"
174
- }, Ie = {
175
- display: "grid",
176
- flex: "1 1 auto",
177
- gap: 2,
178
- minWidth: 0
179
- }, Le = {
180
- alignItems: "center",
181
- display: "flex",
182
- flex: "0 0 auto",
183
- gap: 4
184
- }, Re = {
185
- alignItems: "center",
186
- display: "flex",
187
- gap: 6
188
- }, ze = {
189
- cursor: "pointer",
190
- userSelect: "none"
191
- }, Be = { filter: "drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))" }, Ve = {
192
- backgroundColor: "color-mix(in srgb, var(--mzn-color-primary) 8%, var(--mzn-color-bg-surface))",
193
- boxShadow: "inset 0 0 0 1px var(--mzn-color-border-primary)"
194
- }, He = {
195
- alignItems: "center",
196
- border: "1px dashed var(--mzn-color-border-neutral)",
197
- borderRadius: 6,
198
- display: "grid",
199
- gap: 12,
200
- minHeight: 240,
201
- padding: 32,
202
- textAlign: "center"
203
- }, Ue = {
204
- display: "flex",
205
- gap: 8,
206
- justifyContent: "center"
207
- }, We = {
208
- display: "grid",
209
- gap: 14
210
- }, Ge = {
211
- display: "grid",
212
- columnGap: 16,
213
- gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
214
- rowGap: 8
215
- }, Ke = { gridColumn: "1 / -1" }, qe = {
216
- alignItems: "center",
217
- display: "flex",
218
- gap: 8,
219
- gridColumn: "1 / -1",
220
- justifyContent: "flex-end"
221
- }, Je = { gridColumn: "1 / -1" }, Ye = {
222
- alignItems: "start",
223
- display: "block",
224
- width: "100%"
225
- }, Xe = {
226
- ...Ye,
227
- gridColumn: "1 / -1"
228
- }, Ze = {
229
- minWidth: 0,
230
- width: "100%"
231
- }, Qe = {
232
- minWidth: "100%",
233
- width: "100%"
234
- }, $e = {
235
- display: "grid",
236
- gap: 14
237
- }, et = {
238
- alignItems: "start",
239
- display: "block",
240
- width: "100%"
241
- }, tt = {
242
- minWidth: 0,
243
- width: "100%"
244
- }, nt = { gridColumn: "2 / -1" }, rt = {
245
- display: "grid",
246
- gap: 10,
247
- width: "100%"
248
- }, it = {
249
- display: "grid",
250
- gap: 8,
251
- gridTemplateColumns: "repeat(auto-fit, minmax(160px, 1fr))"
252
- }, at = { display: "inline-flex" }, ot = {
253
- display: "grid",
254
- gap: 16
255
- }, st = {
256
- display: "grid",
257
- gap: 8
258
- }, ct = {
259
- display: "flex",
260
- justifyContent: "flex-end"
261
- }, lt = {
262
- color: "var(--mzn-color-text-error)",
263
- fontSize: "0.72em",
264
- lineHeight: 0,
265
- marginLeft: 2,
266
- verticalAlign: "super"
267
- };
268
- function ut(e) {
269
- e && (e.style.width = "100%");
270
- }
271
- var dt = {
272
- fields: [],
273
- schemaVersion: 1
274
- }, ft = {
275
- layout: [],
276
- schemaVersion: 1
277
- }, pt = [
278
- {
279
- id: "unset",
280
- name: "不預設"
281
- },
282
- {
283
- id: "true",
284
- name: "是"
285
- },
286
- {
287
- id: "false",
288
- name: "否"
289
- }
290
- ], mt = [{
291
- id: "true",
292
- name: "是"
293
- }, {
294
- id: "false",
295
- name: "否"
296
- }], ht = [
297
- {
298
- label: "顯示",
299
- name: "fieldVisibleWhen",
300
- supportingText: "符合條件時才顯示這個欄位。",
301
- target: "visibleWhen"
302
- },
303
- {
304
- label: "必填",
305
- name: "fieldRequiredWhen",
306
- supportingText: "符合條件時才要求填寫這個欄位。",
307
- target: "requiredWhen"
308
- },
309
- {
310
- label: "唯讀",
311
- name: "fieldReadonlyWhen",
312
- supportingText: "符合條件時不允許修改這個欄位。",
313
- target: "readonlyWhen"
314
- }
315
- ];
316
- function R({ onChange: oe, value: y }) {
317
- let se = y?.schema ?? dt, b = y?.uiSchema ?? ft, [x, S] = i(se), [C, w] = i(b), [le, N] = i(B(se)), [Te, P] = i(B(b)), [Ee, F] = i({}), [I, R] = i(null), [V, Tt] = i("design"), [H, U] = i(null);
318
- n(() => {
319
- x.fields.some((e) => e.fieldKey === H) || U(x.fields[0]?.fieldKey ?? null);
320
- }, [x.fields, H]), n(() => {
321
- F((e) => fe(x.fields, e));
322
- }, [x.fields]), n(() => {
323
- V !== "advanced" && (N(B(x)), P(B(C)));
324
- }, [
325
- V,
326
- x,
327
- C
328
- ]);
329
- let W = r(() => x.fields.find((e) => e.fieldKey === H) ?? x.fields[0] ?? null, [x.fields, H]);
330
- n(() => {
331
- oe?.({
332
- schema: x,
333
- uiSchema: C
334
- });
335
- }, [x, C]);
336
- function G(e) {
337
- let t = me(e, x.fields.length + 1);
338
- S({
339
- ...x,
340
- fields: [...x.fields, t]
341
- }), w({
342
- ...C,
343
- layout: [...C.layout, {
344
- fieldKey: t.fieldKey,
345
- width: e === "textarea" || e === "file_upload" ? "FULL" : "HALF"
346
- }]
347
- }), U(t.fieldKey), Tt("design"), R(null);
348
- }
349
- function Et(e) {
350
- let t = e;
351
- t === "advanced" && V !== "advanced" && (N(B(x)), P(B(C))), Tt(t);
352
- }
353
- function Dt(e) {
354
- let t = x.fields.filter((t) => t.fieldKey !== e);
355
- S({
356
- ...x,
357
- fields: t
358
- }), w({
359
- ...C,
360
- layout: C.layout.filter((t) => t.fieldKey !== e)
361
- }), U(H === e ? t[0]?.fieldKey ?? null : H), R(null);
362
- }
363
- function Ot(e) {
364
- let t = e.destination;
365
- t && e.source.index !== t.index && (S((n) => ({
366
- ...n,
367
- fields: wt(n.fields, e.source.index, t.index)
368
- })), w((n) => ({
369
- ...n,
370
- layout: wt(n.layout, e.source.index, t.index)
371
- })), R(null));
372
- }
373
- function K(e) {
374
- q((t) => ({
375
- ...t,
376
- ...e
377
- }));
378
- }
379
- function q(e) {
380
- if (!W) return;
381
- let t = W.fieldKey, n = e(W), r = n.fieldKey;
382
- S({
383
- ...x,
384
- fields: x.fields.map((e) => e.fieldKey === t ? n : e)
385
- }), w({
386
- ...C,
387
- layout: C.layout.map((e) => e.fieldKey === t ? {
388
- ...e,
389
- fieldKey: r
390
- } : e)
391
- }), U(r), R(null);
392
- }
393
- function J(e) {
394
- q((t) => yt(t) ? {
395
- ...t,
396
- ...e
397
- } : t);
398
- }
399
- function Y(e) {
400
- q((t) => D(t) ? {
401
- ...t,
402
- ...e
403
- } : t);
404
- }
405
- function kt(e) {
406
- q((t) => E(t) ? {
407
- ...t,
408
- ...e
409
- } : t);
410
- }
411
- function X(e) {
412
- q((t) => O(t) ? {
413
- ...t,
414
- ...e
415
- } : t);
416
- }
417
- function At(e) {
418
- q((t) => t.type === "boolean" ? {
419
- ...t,
420
- ...e
421
- } : t);
422
- }
423
- function jt(e) {
424
- q((t) => t.type === "file_upload" ? {
425
- ...t,
426
- ...e
427
- } : t);
428
- }
429
- function Mt(e) {
430
- F(e);
431
- }
432
- function Nt(e, t) {
433
- S((n) => ({
434
- ...n,
435
- fields: n.fields.map((n) => n.fieldKey === e ? {
436
- ...n,
437
- required: t
438
- } : n)
439
- })), R(null);
440
- }
441
- function Pt(e) {
442
- N(e);
443
- try {
444
- S(JSON.parse(e)), R(null);
445
- } catch {
446
- R("Form Schema JSON 格式不正確");
447
- }
448
- }
449
- function Ft(e) {
450
- P(e);
451
- try {
452
- w(JSON.parse(e)), R(null);
453
- } catch {
454
- R("UI Schema JSON 格式不正確");
455
- }
456
- }
457
- return /* @__PURE__ */ _(g, { children: /* @__PURE__ */ _(g, { children: /* @__PURE__ */ _(te, { children: /* @__PURE__ */ _(ee, { children: /* @__PURE__ */ v("div", {
458
- style: ot,
459
- children: [
460
- /* @__PURE__ */ v(ne, {
461
- activeKey: V,
462
- onChange: Et,
463
- size: "sub",
464
- children: [
465
- /* @__PURE__ */ _(m, { children: "設計" }, "design"),
466
- /* @__PURE__ */ _(m, { children: "預覽" }, "preview"),
467
- /* @__PURE__ */ _(m, { children: "進階" }, "advanced")
468
- ]
469
- }),
470
- V === "design" ? It() : null,
471
- V === "preview" ? tn() : null,
472
- V === "advanced" ? nn() : null
473
- ]
474
- }) }) }) }) });
475
- function It() {
476
- return /* @__PURE__ */ v("div", {
477
- style: L,
478
- children: [/* @__PURE__ */ v("div", {
479
- style: Pe,
480
- children: [/* @__PURE__ */ _(h, {
481
- component: "h2",
482
- variant: "label-primary",
483
- children: "新增欄位"
484
- }), /* @__PURE__ */ _("div", {
485
- style: Me,
486
- children: Oe.map((e) => /* @__PURE__ */ _(c, {
487
- icon: e.icon,
488
- iconType: "leading",
489
- onClick: () => G(e.type),
490
- size: "sub",
491
- style: Ne,
492
- type: "button",
493
- variant: "base-secondary",
494
- children: e.label
495
- }, e.type))
496
- })]
497
- }), /* @__PURE__ */ v("div", {
498
- style: ke,
499
- children: [/* @__PURE__ */ v("div", {
500
- style: {
501
- ...L,
502
- ...Ae
503
- },
504
- children: [/* @__PURE__ */ _(h, {
505
- component: "h2",
506
- variant: "label-primary",
507
- children: "表單畫布"
508
- }), x.fields.length > 0 ? /* @__PURE__ */ _(Se, {
509
- onDragEnd: Ot,
510
- children: /* @__PURE__ */ _(we, {
511
- droppableId: "form-builder-fields",
512
- children: (e) => /* @__PURE__ */ v("div", {
513
- ...e.droppableProps,
514
- ref: e.innerRef,
515
- style: L,
516
- children: [x.fields.map((e, t) => /* @__PURE__ */ _(Ce, {
517
- draggableId: e.fieldKey,
518
- index: t,
519
- children: (t, n) => $t(e, t, n.isDragging)
520
- }, e.fieldKey)), e.placeholder]
521
- })
522
- })
523
- }) : /* @__PURE__ */ v("div", {
524
- style: He,
525
- children: [/* @__PURE__ */ v("div", {
526
- style: L,
527
- children: [/* @__PURE__ */ _(h, {
528
- component: "h3",
529
- variant: "h3",
530
- children: "尚未建立欄位"
531
- }), /* @__PURE__ */ _(h, {
532
- color: "text-neutral",
533
- variant: "body",
534
- children: "從上方新增第一個欄位,或直接建立常用文字欄位開始設計。"
535
- })]
536
- }), /* @__PURE__ */ v("div", {
537
- style: Ue,
538
- children: [/* @__PURE__ */ _(c, {
539
- onClick: () => G("text"),
540
- variant: "base-primary",
541
- children: "新增文字欄位"
542
- }), /* @__PURE__ */ _(c, {
543
- onClick: () => G("textarea"),
544
- variant: "base-secondary",
545
- children: "新增長文字"
546
- })]
547
- })]
548
- })]
549
- }), /* @__PURE__ */ v("div", {
550
- style: {
551
- ...L,
552
- ...je
553
- },
554
- children: [/* @__PURE__ */ _(h, {
555
- component: "h2",
556
- variant: "label-primary",
557
- children: "欄位設定"
558
- }), W ? Lt(W) : /* @__PURE__ */ _(h, {
559
- color: "text-neutral",
560
- variant: "body",
561
- children: "請先新增或選取欄位。"
562
- })]
563
- })]
564
- })]
565
- });
566
- }
567
- function Lt(e) {
568
- return /* @__PURE__ */ v("div", {
569
- style: We,
570
- children: [Rt(e), zt(e)]
571
- });
572
- }
573
- function Rt(e) {
574
- return /* @__PURE__ */ v("div", {
575
- style: Ge,
576
- children: [
577
- /* @__PURE__ */ _("div", {
578
- style: qe,
579
- children: /* @__PURE__ */ _(o, {
580
- size: "main",
581
- text: gt(e.type),
582
- variant: "text-info"
583
- })
584
- }),
585
- $("標題", "fieldLabel", /* @__PURE__ */ _(f, {
586
- onChange: (e) => K({ label: e.target.value }),
587
- placeholder: "例如:申請金額",
588
- value: e.label,
589
- variant: "base"
590
- })),
591
- $("欄位 Key", "fieldKey", /* @__PURE__ */ _(f, {
592
- onChange: (e) => K({ fieldKey: e.target.value }),
593
- placeholder: "例如:amount",
594
- value: e.fieldKey,
595
- variant: "base"
596
- })),
597
- $("提示文字", "fieldPlaceholder", /* @__PURE__ */ _(f, {
598
- onChange: (e) => K({ placeholder: e.target.value || void 0 }),
599
- placeholder: "例如:請輸入申請金額",
600
- value: e.placeholder ?? "",
601
- variant: "base"
602
- })),
603
- Bt(e)
604
- ]
605
- });
606
- }
607
- function zt(e) {
608
- return /* @__PURE__ */ _(a, {
609
- defaultExpanded: _t(e),
610
- size: "sub",
611
- title: "進階設定",
612
- children: /* @__PURE__ */ v("div", {
613
- style: Ge,
614
- children: [
615
- /* @__PURE__ */ _(h, {
616
- component: "h3",
617
- style: Ke,
618
- variant: "label-primary",
619
- children: "條件規則"
620
- }),
621
- /* @__PURE__ */ _(h, {
622
- color: "text-neutral",
623
- style: Je,
624
- variant: "body",
625
- children: "只有需要根據其他欄位改變顯示、必填或唯讀狀態時才需要設定。"
626
- }),
627
- qt(e)
628
- ]
629
- })
630
- });
631
- }
632
- function Bt(e) {
633
- return yt(e) ? Vt(e) : D(e) ? Ht(e) : E(e) ? Ut(e) : O(e) ? Wt(e) : e.type === "boolean" ? Gt(e) : Kt(e);
634
- }
635
- function Vt(e) {
636
- return /* @__PURE__ */ v(g, { children: [
637
- $("預設值", "fieldDefaultValue", e.type === "textarea" ? Xt({
638
- name: "fieldDefaultValue",
639
- onChange: (e) => J({ defaultValue: e || void 0 }),
640
- placeholder: "輸入此欄位的預設文字",
641
- rows: 3,
642
- value: z(e.defaultValue)
643
- }) : /* @__PURE__ */ _(f, {
644
- onChange: (e) => J({ defaultValue: e.target.value || void 0 }),
645
- placeholder: "輸入此欄位的預設文字",
646
- value: z(e.defaultValue),
647
- variant: "base"
648
- })),
649
- $("最小長度", "fieldMinLength", Q(e.minLength, (e) => J({ minLength: e }), "例如:2", { min: 0 })),
650
- $("最大長度", "fieldMaxLength", Q(e.maxLength, (e) => J({ maxLength: e }), "例如:100", { min: 1 }))
651
- ] });
652
- }
653
- function Ht(e) {
654
- return /* @__PURE__ */ v(g, { children: [
655
- $("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (e) => Y({ defaultValue: e }), e.type === "money" ? "例如:1000" : "輸入預設數值", {
656
- max: e.maximum,
657
- min: e.minimum
658
- })),
659
- $("最小值", "fieldMinimum", Q(e.minimum, (e) => Y({ minimum: e }), "例如:0")),
660
- $("最大值", "fieldMaximum", Q(e.maximum, (e) => Y({ maximum: e }), "例如:999999"))
661
- ] });
662
- }
663
- function Ut(e) {
664
- return $("預設值", "fieldDefaultValue", Zt(e, z(e.defaultValue), (e) => kt({ defaultValue: e })));
665
- }
666
- function Wt(e) {
667
- let t = Array.isArray(e.defaultValue) ? e.defaultValue : [], n = e.options.filter((e) => t.includes(e.value)).map(j);
668
- return /* @__PURE__ */ v(g, { children: [$("預設值", "fieldDefaultValue", e.type === "checkbox" ? /* @__PURE__ */ _(p, {
669
- clearable: !0,
670
- mode: "multiple",
671
- onChange: (e) => X({ defaultValue: e.length ? e.map((e) => e.id) : void 0 }),
672
- options: e.options.map(j),
673
- placeholder: "選擇一或多個預設選項",
674
- value: n
675
- }) : /* @__PURE__ */ _(p, {
676
- clearable: !0,
677
- onChange: (e) => X({ defaultValue: e?.id || void 0 }),
678
- options: e.options.map(j),
679
- placeholder: "選擇預設選項",
680
- value: typeof e.defaultValue == "string" ? M(e.options.map(j), e.defaultValue) : null
681
- })), $("選項", "fieldOptions", Qt(e), !0)] });
682
- }
683
- function Gt(e) {
684
- let t = typeof e.defaultValue == "boolean" ? String(e.defaultValue) : "unset";
685
- return $("預設值", "fieldDefaultValue", /* @__PURE__ */ _(p, {
686
- clearable: !1,
687
- onChange: (e) => At({ defaultValue: e?.id === "true" ? !0 : e?.id === "false" ? !1 : void 0 }),
688
- options: [...pt],
689
- placeholder: "選擇預設狀態",
690
- value: M(pt, t)
691
- }));
692
- }
693
- function Kt(e) {
694
- return /* @__PURE__ */ v(g, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (e) => jt({ maxFiles: e }), "例如:1", { min: 1 })), $("MIME", "fieldAcceptedMimeTypes", Xt({
695
- name: "fieldAcceptedMimeTypes",
696
- onChange: (e) => jt({ acceptedMimeTypes: bt(e) }),
697
- placeholder: "每行一個 MIME type,例如:application/pdf",
698
- rows: 3,
699
- value: xt(e.acceptedMimeTypes)
700
- }), !1)] });
701
- }
702
- function qt(e) {
703
- let t = x.fields.filter((t) => t.fieldKey !== e.fieldKey);
704
- return t.length ? /* @__PURE__ */ _(g, { children: ht.map((n) => Jt(e, n, t)) }) : /* @__PURE__ */ _(h, {
705
- color: "text-neutral",
706
- style: Je,
707
- variant: "body",
708
- children: "目前沒有其他欄位可作為條件來源。新增更多欄位後即可設定條件規則。"
709
- });
710
- }
711
- function Jt(e, t, n) {
712
- let r = e[t.target], i = r ? _e(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(vt), c = be(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : k(o), u = i?.value ?? A(o), d = !!r, f = d && (!i || !a);
713
- return $(t.label, t.name, /* @__PURE__ */ v("div", {
714
- style: rt,
715
- children: [/* @__PURE__ */ _(ae, {
716
- checked: d,
717
- label: d ? "已啟用" : "不啟用",
718
- onChange: (e) => Z(t.target, e.target.checked ? T(o, k(o), A(o)) : void 0),
719
- size: "sub",
720
- supportingText: t.supportingText
721
- }), d ? f ? /* @__PURE__ */ _(h, {
722
- color: "text-warning",
723
- variant: "body",
724
- children: "這個規則不是目前 UI 支援的格式。重新選擇條件後會取代既有規則。"
725
- }) : /* @__PURE__ */ v("div", {
726
- style: it,
727
- children: [
728
- /* @__PURE__ */ _(p, {
729
- clearable: !1,
730
- onChange: (e) => {
731
- let r = n.find((t) => t.fieldKey === e?.id) ?? o;
732
- Z(t.target, T(r, k(r), A(r)));
733
- },
734
- options: s,
735
- placeholder: "選擇欄位",
736
- value: M(s, o.fieldKey)
737
- }),
738
- /* @__PURE__ */ _(p, {
739
- clearable: !1,
740
- onChange: (e) => Z(t.target, T(o, ye(e?.id) ?? l, u)),
741
- options: [...c],
742
- placeholder: "判斷方式",
743
- value: M(c, l)
744
- }),
745
- Yt(o, u, (e) => Z(t.target, T(o, l, e)))
746
- ]
747
- }) : null]
748
- }), !0);
749
- }
750
- function Z(e, t) {
751
- K({ [e]: t });
752
- }
753
- function Yt(e, t, n) {
754
- if (e.type === "boolean") return /* @__PURE__ */ _(p, {
755
- clearable: !1,
756
- onChange: (e) => n(e?.id ?? "true"),
757
- options: [...mt],
758
- placeholder: "比較值",
759
- value: M(mt, t === "false" ? "false" : "true")
760
- });
761
- if (O(e)) {
762
- let r = e.options.map(j);
763
- return /* @__PURE__ */ _(p, {
764
- clearable: !1,
765
- onChange: (e) => n(e?.id ?? r[0]?.id ?? ""),
766
- options: r,
767
- placeholder: "比較值",
768
- value: M(r, t)
769
- });
770
- }
771
- return D(e) ? Q(ve(t), (e) => n(String(e ?? 0)), "比較值") : E(e) ? Zt(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ _(f, {
772
- onChange: (e) => n(e.target.value),
773
- placeholder: "比較值",
774
- value: t,
775
- variant: "base"
776
- });
777
- }
778
- function Xt({ name: e, onChange: t, placeholder: n, rows: r, value: i }) {
779
- return /* @__PURE__ */ _(ie, {
780
- "aria-label": e,
781
- onChange: (e) => t(e.target.value),
782
- placeholder: n,
783
- ref: ut,
784
- resize: "vertical",
785
- rows: r,
786
- style: Qe,
787
- value: i
788
- });
789
- }
790
- function Q(e, t, n, r = {}) {
791
- return /* @__PURE__ */ _(f, {
792
- max: r.max,
793
- min: r.min,
794
- onChange: (e) => t(pe(ve(e.target.value), r)),
795
- placeholder: n,
796
- showSpinner: !0,
797
- step: r.step ?? 1,
798
- value: typeof e == "number" ? String(e) : "",
799
- variant: "measure"
800
- });
801
- }
802
- function Zt(e, t, n) {
803
- return e.type === "datetime" ? /* @__PURE__ */ _(u, {
804
- formatDate: "YYYY-MM-DD",
805
- formatTime: "HH:mm",
806
- hideSecond: !0,
807
- onChange: (e) => n(ge(e)),
808
- placeholderLeft: "選擇日期",
809
- placeholderRight: "選擇時間",
810
- value: xe(t)
811
- }) : /* @__PURE__ */ _(l, {
812
- format: "YYYY-MM-DD",
813
- onChange: (e) => n(he(e)),
814
- placeholder: "選擇日期",
815
- value: xe(t)
816
- });
817
- }
818
- function Qt(e) {
819
- return /* @__PURE__ */ v("div", {
820
- style: st,
821
- children: [/* @__PURE__ */ _(re, {
822
- actions: {
823
- render: (t) => [{
824
- disabled: () => e.options.length <= 1,
825
- icon: de,
826
- iconType: "icon-only",
827
- name: "移除選項",
828
- onClick: () => X({ options: e.options.filter((e, n) => n !== t.index) }),
829
- variant: "destructive-ghost"
830
- }],
831
- width: 56
832
- },
833
- columns: [{
834
- key: "label",
835
- render: (t) => /* @__PURE__ */ _(f, {
836
- onChange: (n) => X({ options: St(e.options, t.index, { label: n.target.value }) }),
837
- placeholder: "例如:主管",
838
- size: "sub",
839
- value: t.label,
840
- variant: "base"
841
- }),
842
- title: "Label"
843
- }, {
844
- key: "value",
845
- render: (t) => /* @__PURE__ */ _(f, {
846
- onChange: (n) => X({ options: St(e.options, t.index, { value: n.target.value }) }),
847
- placeholder: "例如:manager",
848
- size: "sub",
849
- value: t.value,
850
- variant: "base"
851
- }),
852
- title: "Value"
853
- }],
854
- dataSource: e.options.map((t, n) => ({
855
- index: n,
856
- key: `${e.fieldKey}-${n}`,
857
- label: t.label,
858
- value: t.value
859
- })),
860
- showHeader: !0,
861
- size: "sub"
862
- }), /* @__PURE__ */ _("div", {
863
- style: ct,
864
- children: /* @__PURE__ */ _(c, {
865
- icon: ue,
866
- iconType: "leading",
867
- onClick: () => X({ options: [...e.options, Ct(e.options)] }),
868
- variant: "base-secondary",
869
- children: "新增選項"
870
- })
871
- })]
872
- });
873
- }
874
- function $t(e, t, n) {
875
- return /* @__PURE__ */ _("div", {
876
- ...t.draggableProps,
877
- "data-form-builder-field-key": e.fieldKey,
878
- ref: t.innerRef,
879
- style: {
880
- ...ze,
881
- ...n ? Be : null,
882
- ...t.draggableProps.style
883
- },
884
- children: /* @__PURE__ */ _(s, {
885
- style: e.fieldKey === W?.fieldKey ? Ve : void 0,
886
- children: en(e, t, n)
887
- })
888
- });
889
- }
890
- function $(t, n, r, i = !1) {
891
- return /* @__PURE__ */ _("div", {
892
- style: i ? Xe : Ye,
893
- children: /* @__PURE__ */ _("div", {
894
- style: Ze,
895
- children: /* @__PURE__ */ _(e, {
896
- label: t,
897
- name: n,
898
- children: r
899
- })
900
- })
901
- });
902
- }
903
- function en(e, t, n) {
904
- return /* @__PURE__ */ v("div", {
905
- ...t.dragHandleProps ?? {},
906
- "aria-label": "選取或拖曳排序欄位",
907
- onClick: () => U(e.fieldKey),
908
- style: Fe,
909
- title: "點擊選取,拖曳排序",
910
- children: [
911
- /* @__PURE__ */ _("span", {
912
- "aria-label": "拖曳排序",
913
- role: "img",
914
- style: at,
915
- title: "拖曳排序",
916
- children: /* @__PURE__ */ _(d, {
917
- icon: ce,
918
- size: 20
919
- })
920
- }),
921
- /* @__PURE__ */ v("div", {
922
- style: Ie,
923
- children: [/* @__PURE__ */ v(h, {
924
- component: "span",
925
- ellipsis: !0,
926
- variant: "label-primary",
927
- children: [e.label, e.required ? /* @__PURE__ */ _("sup", {
928
- "aria-label": "必填",
929
- style: lt,
930
- children: "*"
931
- }) : null]
932
- }), /* @__PURE__ */ v(h, {
933
- color: "text-neutral",
934
- component: "span",
935
- ellipsis: !0,
936
- variant: "caption",
937
- children: [
938
- gt(e.type),
939
- " ·",
940
- e.required ? " 必填" : " 選填",
941
- " ·",
942
- e.fieldKey
943
- ]
944
- })]
945
- }),
946
- /* @__PURE__ */ v("div", {
947
- onClick: (e) => e.stopPropagation(),
948
- style: Le,
949
- children: [/* @__PURE__ */ _("div", {
950
- style: Re,
951
- children: /* @__PURE__ */ _(ae, {
952
- checked: !!e.required,
953
- disabled: n,
954
- label: "必填",
955
- onChange: (t) => Nt(e.fieldKey, t.target.checked)
956
- })
957
- }), /* @__PURE__ */ _(c, {
958
- disabled: n,
959
- icon: de,
960
- iconType: "icon-only",
961
- onClick: () => Dt(e.fieldKey),
962
- variant: "destructive-ghost",
963
- children: "移除欄位"
964
- })]
965
- })
966
- ]
967
- });
968
- }
969
- function tn() {
970
- return /* @__PURE__ */ v("div", {
971
- style: L,
972
- children: [/* @__PURE__ */ _(h, {
973
- component: "h2",
974
- variant: "h3",
975
- children: "填寫預覽"
976
- }), /* @__PURE__ */ _(t, {
977
- onChange: Mt,
978
- schema: x,
979
- uiSchema: C,
980
- value: Ee
981
- })]
982
- });
983
- }
984
- function nn() {
985
- return /* @__PURE__ */ v("div", {
986
- style: L,
987
- children: [/* @__PURE__ */ _(h, {
988
- component: "h2",
989
- variant: "h3",
990
- children: "Schema"
991
- }), /* @__PURE__ */ v("div", {
992
- style: $e,
993
- children: [
994
- rn("Form Schema", "schemaJson", /* @__PURE__ */ _(De, {
995
- height: "360px",
996
- name: "schemaJson",
997
- onChange: Pt,
998
- placeholder: "輸入 Form Schema JSON",
999
- value: le
1000
- })),
1001
- rn("UI Schema", "uiSchemaJson", /* @__PURE__ */ _(De, {
1002
- height: "240px",
1003
- name: "uiSchemaJson",
1004
- onChange: Ft,
1005
- placeholder: "輸入 UI Schema JSON",
1006
- value: Te
1007
- })),
1008
- I ? /* @__PURE__ */ _(h, {
1009
- color: "text-error",
1010
- style: nt,
1011
- variant: "body",
1012
- children: I
1013
- }) : null
1014
- ]
1015
- })]
1016
- });
1017
- }
1018
- function rn(t, n, r) {
1019
- return /* @__PURE__ */ _("div", {
1020
- style: et,
1021
- children: /* @__PURE__ */ _("div", {
1022
- style: tt,
1023
- children: /* @__PURE__ */ _(e, {
1024
- label: t,
1025
- name: n,
1026
- children: r
1027
- })
1028
- })
1029
- });
1030
- }
1031
- }
1032
- function gt(e) {
1033
- return Oe.find((t) => t.type === e)?.label ?? e;
1034
- }
1035
- function _t(e) {
1036
- return !!(e.visibleWhen || e.requiredWhen || e.readonlyWhen);
1037
- }
1038
- function vt(e) {
1039
- return {
1040
- id: e.fieldKey,
1041
- name: e.label
1042
- };
1043
- }
1044
- function yt(e) {
1045
- return e.type === "text" || e.type === "textarea";
1046
- }
1047
- function z(e) {
1048
- return typeof e == "string" ? e : "";
1049
- }
1050
- function bt(e) {
1051
- let t = e.split(/[\n,]/u).map((e) => e.trim()).filter(Boolean);
1052
- return t.length ? t : void 0;
1053
- }
1054
- function xt(e) {
1055
- return e?.join("\n") ?? "";
1056
- }
1057
- function B(e) {
1058
- return JSON.stringify(e, null, 2);
1059
- }
1060
- function St(e, t, n) {
1061
- return e.map((e, r) => r === t ? {
1062
- ...e,
1063
- ...n
1064
- } : e);
1065
- }
1066
- function Ct(e) {
1067
- let t = e.length + 1;
1068
- return {
1069
- label: `選項 ${t}`,
1070
- value: V(e, t)
1071
- };
1072
- }
1073
- function V(e, t) {
1074
- let n = `option_${t}`;
1075
- return e.some((e) => e.value === n) ? V(e, t + 1) : n;
1076
- }
1077
- function wt(e, t, n) {
1078
- let r = e[t];
1079
- if (!r || t === n) return [...e];
1080
- let i = e.filter((e, n) => n !== t);
1081
- return [
1082
- ...i.slice(0, n),
1083
- r,
1084
- ...i.slice(n)
1085
- ];
1086
- }
1087
- //#endregion
1088
- export { R as t };
1089
-
1090
- //# sourceMappingURL=FormBuilderView-D8DrQOXD.js.map