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