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