@rytass/bpm-core-react 0.11.0 → 0.12.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 +40 -0
- package/dist/chunks/FormBuilderView-CLFlfDGe.cjs +3 -0
- package/dist/chunks/FormBuilderView-CLFlfDGe.cjs.map +1 -0
- package/dist/chunks/FormBuilderView-D4xIuPYB.js +1960 -0
- package/dist/chunks/FormBuilderView-D4xIuPYB.js.map +1 -0
- package/dist/chunks/FormRendererView-BxGT16z0.cjs +2 -0
- package/dist/chunks/FormRendererView-BxGT16z0.cjs.map +1 -0
- package/dist/chunks/FormRendererView-DUceSOXe.js +798 -0
- package/dist/chunks/FormRendererView-DUceSOXe.js.map +1 -0
- package/dist/chunks/{compose-CUOe5Ia9.js → compose-Bb-REfoB.js} +4 -4
- package/dist/chunks/{compose-CUOe5Ia9.js.map → compose-Bb-REfoB.js.map} +1 -1
- package/dist/chunks/{compose-CyRkXdeu.cjs → compose-DzRYZcqe.cjs} +2 -2
- package/dist/chunks/{compose-CyRkXdeu.cjs.map → compose-DzRYZcqe.cjs.map} +1 -1
- package/dist/chunks/{designer-Cb3WAC46.js → designer-C6oIO9Kq.js} +2 -2
- package/dist/chunks/{designer-Cb3WAC46.js.map → designer-C6oIO9Kq.js.map} +1 -1
- package/dist/chunks/{designer-zLliyrHu.cjs → designer-gFUdImeZ.cjs} +2 -2
- package/dist/chunks/{designer-zLliyrHu.cjs.map → designer-gFUdImeZ.cjs.map} +1 -1
- package/dist/chunks/{detail-Cmw-aQcu.js → detail-BgKgMvYx.js} +391 -390
- package/dist/chunks/{detail-Cmw-aQcu.js.map → detail-BgKgMvYx.js.map} +1 -1
- package/dist/chunks/{detail-Bp2Nv0cs.cjs → detail-Dnz5aaI-.cjs} +2 -2
- package/dist/chunks/{detail-Bp2Nv0cs.cjs.map → detail-Dnz5aaI-.cjs.map} +1 -1
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/renderer/form-data-source-field.d.ts +16 -0
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.js +1 -1
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.cjs.map +1 -1
- package/dist/views/instances/new/index.js +48 -48
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunks/FormBuilderView-CAqjOYAP.cjs +0 -3
- package/dist/chunks/FormBuilderView-CAqjOYAP.cjs.map +0 -1
- package/dist/chunks/FormBuilderView-TzSezeqC.js +0 -1479
- package/dist/chunks/FormBuilderView-TzSezeqC.js.map +0 -1
- package/dist/chunks/FormRendererView-BurlEDUu.js +0 -580
- package/dist/chunks/FormRendererView-BurlEDUu.js.map +0 -1
- package/dist/chunks/FormRendererView-Dde1s3I0.cjs +0 -2
- package/dist/chunks/FormRendererView-Dde1s3I0.cjs.map +0 -1
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./bpm-form-field-Cao0rMol.js";
|
|
3
|
+
import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import { AutoComplete as o, Button as s, CheckboxGroup as c, DatePicker as l, DateTimePicker as u, Input as d, RadioGroup as f, Select as p, Table as m, Textarea as h, Toggle as g, Typography as _, Upload as v } from "@mezzanine-ui/react";
|
|
5
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
6
|
+
import { PlusIcon as x, TrashIcon as S } from "@mezzanine-ui/icons";
|
|
7
|
+
import { buildFormRendererValues as C, clampOptionalNumber as w, createFormTableRow as T, formatDatePickerValue as E, formatDateTimePickerValue as D, isFormRendererFieldReadonly as ee, isFormRendererFieldRequired as O, mergeFormDataSourceOptions as k, parseOptionalNumberInput as A, previewFormFieldOptions as te, previewResolveFormFieldOptions as j, readDatePickerValue as M, readFieldOptionAsSelectOption as N, readFormDataSourceErrorCode as ne, readFormDataSourceErrorMessage as re, readFormDataSourceSelectedValues as ie, readFormDataSourceValueSignature as P, readFormFieldOptions as ae, readFormTableCellPath as F, readFormTableRowBounds as oe, readFormTableRows as I, readMissingFormDataSourceDependencies as se, readMissingFormDataSourceOptionValues as ce, readSelectOption as le, readSelectedFormDataSourceOptions as ue, readVisibleFormRendererFields as L, resolveFormFieldOptions as de } from "@rytass/bpm-core-client/form";
|
|
8
|
+
import { isFormDataSourceFieldDefinition as R, isFormStaticOptionFieldDefinition as z, isFormTableCellValue as B, isTableFieldDefinition as fe, readFormFieldSelectionMode as pe } from "@rytass/bpm-core-shared/form";
|
|
9
|
+
//#region src/views/forms/renderer/form-data-source-field.ts
|
|
10
|
+
var me = {
|
|
11
|
+
canRetry: !1,
|
|
12
|
+
error: null,
|
|
13
|
+
hasValue: !1,
|
|
14
|
+
hasNextPage: !1,
|
|
15
|
+
invalidValues: [],
|
|
16
|
+
onReachBottom: () => void 0,
|
|
17
|
+
onSearch: () => void 0,
|
|
18
|
+
options: [],
|
|
19
|
+
retry: () => void 0,
|
|
20
|
+
status: "IDLE"
|
|
21
|
+
}, V = [], he = 10, ge = ["FORM_DATA_SOURCE_SEARCH_NOT_SUPPORTED", "FORM_DATA_SOURCE_SEARCH_TOO_SHORT"];
|
|
22
|
+
function H(e) {
|
|
23
|
+
let o = R(e.field) ? e.field : null, s = e.fieldPath ?? o?.fieldKey ?? "", c = o ? e.optionSnapshots?.[e.snapshotKey ?? o.fieldKey] : void 0, l = o ? JSON.stringify({
|
|
24
|
+
dataSource: o.dataSource,
|
|
25
|
+
fieldKey: o.fieldKey,
|
|
26
|
+
type: o.type
|
|
27
|
+
}) : "", u = JSON.stringify(c ?? null), d = r(() => c?.options ?? [], [u]), f = JSON.stringify(e.formData), p = JSON.stringify(e.initialFormData ?? {}), m = JSON.stringify(e.schema), h = JSON.stringify(e.uiSchema), g = e.context?.kind, _ = e.context?.kind === "runtime" ? e.context.instanceId : void 0, v = e.context?.kind === "runtime" ? e.context.templateId : void 0, y = JSON.stringify(e.row?.values ?? null), b = JSON.stringify(e.row?.initialValues ?? null), x = o ? e.row ? e.row.values[o.fieldKey] : e.formData[o.fieldKey] : void 0, S = P(x), C = r(() => ie(x), [S]), w = C.length > 0, T = o ? JSON.stringify({
|
|
28
|
+
bindings: o.dataSource.bindings.map((t) => t.from.kind === "FIELD" ? {
|
|
29
|
+
fieldKey: t.from.fieldKey,
|
|
30
|
+
value: e.formData[t.from.fieldKey]
|
|
31
|
+
} : t.from.kind === "CONSTANT" ? { value: t.from.value } : {
|
|
32
|
+
columnKey: t.from.columnKey,
|
|
33
|
+
value: e.row?.values[t.from.columnKey]
|
|
34
|
+
}),
|
|
35
|
+
value: e.initialFormData !== void 0 || e.initialValue !== void 0 ? x : void 0
|
|
36
|
+
}) : "", E = r(() => {
|
|
37
|
+
if (g === "preview") return { kind: "preview" };
|
|
38
|
+
if (g === "runtime" && !e.readonly) return {
|
|
39
|
+
instanceId: _,
|
|
40
|
+
kind: "runtime",
|
|
41
|
+
templateId: v
|
|
42
|
+
};
|
|
43
|
+
}, [
|
|
44
|
+
_,
|
|
45
|
+
g,
|
|
46
|
+
v,
|
|
47
|
+
e.readonly
|
|
48
|
+
]), D = o ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && P(e.initialValue) !== S : !1, ee = o ? e.initialFormData !== void 0 && o.dataSource.bindings.some((t) => t.from.kind === "FIELD" ? P(e.initialFormData?.[t.from.fieldKey]) !== P(e.formData[t.from.fieldKey]) : t.from.kind === "ROW_FIELD" && e.row?.initialValues ? P(e.row.initialValues[t.from.columnKey]) !== P(e.row.values[t.from.columnKey]) : !1) : !1, O = !!((c || w) && (D || ee)), A = !!(o && E && O && w), M = ve({
|
|
49
|
+
hasSnapshot: !!c,
|
|
50
|
+
hasValue: w,
|
|
51
|
+
isStale: O,
|
|
52
|
+
readonly: e.readonly
|
|
53
|
+
}), N = !!(o && E && o.type !== "autocomplete"), F = ye(O, N && o !== null && se(o, e.formData, e.row?.values).length > 0), [oe, I] = a([]), [ce, le] = a(""), [L, z] = a(null), [B, fe] = a(null), [pe, V] = a(() => o ? N ? F : M : "IDLE"), [H, U] = a(null), W = i(0), G = i(0), q = i(0), J = i(null), Y = i(null), Ce = i({
|
|
54
|
+
cursor: null,
|
|
55
|
+
searchText: ""
|
|
56
|
+
}), X = r(() => Se(e.formData), [f]), Z = r(() => e.row ? Se(e.row.values) : void 0, [y]), we = r(() => k(d, oe), [oe, d]), Te = B && B.signature === T ? B : null, Ee = A && !Te, De = _e({
|
|
57
|
+
options: we,
|
|
58
|
+
resolution: Te,
|
|
59
|
+
resolvePending: Ee,
|
|
60
|
+
value: x
|
|
61
|
+
}), Q = t((t, n) => {
|
|
62
|
+
if (!o || !E) return;
|
|
63
|
+
let r = G.current + 1;
|
|
64
|
+
G.current = r, Ce.current = {
|
|
65
|
+
cursor: n,
|
|
66
|
+
searchText: t
|
|
67
|
+
}, J.current?.abort();
|
|
68
|
+
let i = new AbortController();
|
|
69
|
+
J.current = i, V(F), U(null), (E.kind === "preview" ? te({
|
|
70
|
+
cursor: n,
|
|
71
|
+
fieldKey: s,
|
|
72
|
+
formData: X,
|
|
73
|
+
rowValues: Z,
|
|
74
|
+
schema: e.schema,
|
|
75
|
+
searchText: t,
|
|
76
|
+
signal: i.signal,
|
|
77
|
+
uiSchema: e.uiSchema
|
|
78
|
+
}) : ae({
|
|
79
|
+
cursor: n,
|
|
80
|
+
fieldKey: s,
|
|
81
|
+
formData: X,
|
|
82
|
+
instanceId: E.instanceId ?? null,
|
|
83
|
+
rowValues: Z,
|
|
84
|
+
searchText: t,
|
|
85
|
+
signal: i.signal,
|
|
86
|
+
templateId: E.templateId ?? null
|
|
87
|
+
})).then((e) => {
|
|
88
|
+
K(i, G, r) || (I((t) => {
|
|
89
|
+
let r = ue(x, t);
|
|
90
|
+
return k(r, n ? t : [], e.options);
|
|
91
|
+
}), z(e.nextCursor), U(null), W.current = n ? W.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && W.current < he && Oe.current(t, e.nextCursor), V(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
|
|
92
|
+
}).catch((e) => {
|
|
93
|
+
if (K(i, G, r)) return;
|
|
94
|
+
let t = re(e) ?? "選項來源暫時無法使用。", n = ne(e);
|
|
95
|
+
U(t), V(be(!!(n && ge.includes(n)), w));
|
|
96
|
+
});
|
|
97
|
+
}, [
|
|
98
|
+
S,
|
|
99
|
+
l,
|
|
100
|
+
E,
|
|
101
|
+
w,
|
|
102
|
+
F,
|
|
103
|
+
s,
|
|
104
|
+
X,
|
|
105
|
+
Z,
|
|
106
|
+
m,
|
|
107
|
+
h
|
|
108
|
+
]), Oe = i(Q);
|
|
109
|
+
Oe.current = Q;
|
|
110
|
+
let ke = t(() => {
|
|
111
|
+
if (!o || !E || C.length === 0) return;
|
|
112
|
+
let t = T, n = q.current + 1;
|
|
113
|
+
q.current = n, Y.current?.abort();
|
|
114
|
+
let r = new AbortController();
|
|
115
|
+
Y.current = r, U(null), (E.kind === "preview" ? j({
|
|
116
|
+
fieldKey: s,
|
|
117
|
+
formData: X,
|
|
118
|
+
rowValues: Z,
|
|
119
|
+
schema: e.schema,
|
|
120
|
+
signal: r.signal,
|
|
121
|
+
uiSchema: e.uiSchema,
|
|
122
|
+
values: C
|
|
123
|
+
}) : de({
|
|
124
|
+
fieldKey: s,
|
|
125
|
+
formData: X,
|
|
126
|
+
instanceId: E.instanceId ?? null,
|
|
127
|
+
rowValues: Z,
|
|
128
|
+
signal: r.signal,
|
|
129
|
+
templateId: E.templateId ?? null,
|
|
130
|
+
values: C
|
|
131
|
+
})).then((e) => {
|
|
132
|
+
if (!K(r, q, n)) {
|
|
133
|
+
if (e.waitingForFieldKeys.length) {
|
|
134
|
+
V("WAITING_FOR_DEPENDENCIES");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
I((t) => k(t, e.options)), fe({
|
|
138
|
+
signature: t,
|
|
139
|
+
unresolvedValues: e.unresolvedValues
|
|
140
|
+
}), V("VALID");
|
|
141
|
+
}
|
|
142
|
+
}).catch((e) => {
|
|
143
|
+
K(r, q, n) || (V("UNAVAILABLE"), U(re(e) ?? "選項來源暫時無法使用。"));
|
|
144
|
+
});
|
|
145
|
+
}, [
|
|
146
|
+
T,
|
|
147
|
+
l,
|
|
148
|
+
E,
|
|
149
|
+
s,
|
|
150
|
+
X,
|
|
151
|
+
Z,
|
|
152
|
+
m,
|
|
153
|
+
C,
|
|
154
|
+
h
|
|
155
|
+
]), Ae = i(ke);
|
|
156
|
+
Ae.current = ke, n(() => {
|
|
157
|
+
if (G.current += 1, J.current?.abort(), I((e) => ue(x, e)), z((e) => e === null ? e : null), le((e) => e && ""), U((e) => e && null), !o) {
|
|
158
|
+
V("IDLE");
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (!N) {
|
|
162
|
+
V(M);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
Oe.current("", null);
|
|
166
|
+
}, [
|
|
167
|
+
N,
|
|
168
|
+
l,
|
|
169
|
+
E,
|
|
170
|
+
T,
|
|
171
|
+
p,
|
|
172
|
+
b,
|
|
173
|
+
e.readonly,
|
|
174
|
+
F,
|
|
175
|
+
M,
|
|
176
|
+
u
|
|
177
|
+
]), n(() => {
|
|
178
|
+
A && Ae.current();
|
|
179
|
+
}, [
|
|
180
|
+
T,
|
|
181
|
+
E,
|
|
182
|
+
A
|
|
183
|
+
]), n(() => () => {
|
|
184
|
+
J.current?.abort(), Y.current?.abort();
|
|
185
|
+
}, []);
|
|
186
|
+
let je = t((e) => {
|
|
187
|
+
le(e), I((e) => ue(x, e)), z(null), Q(e, null);
|
|
188
|
+
}, [Q]), Me = t(() => {
|
|
189
|
+
L && Q(ce, L);
|
|
190
|
+
}, [
|
|
191
|
+
Q,
|
|
192
|
+
L,
|
|
193
|
+
ce
|
|
194
|
+
]), Ne = t(() => {
|
|
195
|
+
E && (Q(Ce.current.searchText, Ce.current.cursor), A && Ae.current());
|
|
196
|
+
}, [
|
|
197
|
+
E,
|
|
198
|
+
Q,
|
|
199
|
+
A
|
|
200
|
+
]);
|
|
201
|
+
return o ? {
|
|
202
|
+
canRetry: !!E,
|
|
203
|
+
error: H,
|
|
204
|
+
hasValue: w,
|
|
205
|
+
hasNextPage: !!L,
|
|
206
|
+
invalidValues: De,
|
|
207
|
+
onReachBottom: Me,
|
|
208
|
+
onSearch: je,
|
|
209
|
+
options: we,
|
|
210
|
+
retry: Ne,
|
|
211
|
+
status: xe({
|
|
212
|
+
invalidValues: De,
|
|
213
|
+
resolvePending: Ee,
|
|
214
|
+
status: pe
|
|
215
|
+
})
|
|
216
|
+
} : me;
|
|
217
|
+
}
|
|
218
|
+
function U(e) {
|
|
219
|
+
switch (e.status) {
|
|
220
|
+
case "WAITING_FOR_DEPENDENCIES": return "請先填寫相依欄位。";
|
|
221
|
+
case "STALE": return "選項需要重新載入或驗證。";
|
|
222
|
+
case "INVALID": return e.invalidValues.length ? `無法辨識選項:${e.invalidValues.join("、")}` : "目前選項已失效,請重新選擇。";
|
|
223
|
+
case "UNAVAILABLE": return e.error ?? "選項來源暫時無法使用。";
|
|
224
|
+
case "VALID": return e.error ?? (e.options.length ? null : "目前沒有可用選項。");
|
|
225
|
+
default: return e.error;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function W(e) {
|
|
229
|
+
return e.hasValue && e.status !== "VALID";
|
|
230
|
+
}
|
|
231
|
+
function G(e) {
|
|
232
|
+
let t = e.filter(W);
|
|
233
|
+
return t.length === 0 ? null : t.every((e) => e.status === "LOADING" || e.status === "STALE") ? "選項驗證中,請稍候再送出。" : "請先完成動態選項驗證。";
|
|
234
|
+
}
|
|
235
|
+
function _e(e) {
|
|
236
|
+
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? V : ce(e.value, e.options);
|
|
237
|
+
}
|
|
238
|
+
function ve(e) {
|
|
239
|
+
return e.isStale ? "STALE" : e.hasSnapshot ? "VALID" : e.readonly && e.hasValue ? "UNAVAILABLE" : "IDLE";
|
|
240
|
+
}
|
|
241
|
+
function ye(e, t) {
|
|
242
|
+
return t ? "WAITING_FOR_DEPENDENCIES" : e ? "STALE" : "LOADING";
|
|
243
|
+
}
|
|
244
|
+
function be(e, t) {
|
|
245
|
+
return e ? t ? "VALID" : "IDLE" : "UNAVAILABLE";
|
|
246
|
+
}
|
|
247
|
+
function xe(e) {
|
|
248
|
+
return e.status === "LOADING" || e.status === "UNAVAILABLE" || e.status === "WAITING_FOR_DEPENDENCIES" ? e.status : e.invalidValues.length ? "INVALID" : e.resolvePending ? "STALE" : e.status;
|
|
249
|
+
}
|
|
250
|
+
function K(e, t, n) {
|
|
251
|
+
return e.signal.aborted || t.current !== n;
|
|
252
|
+
}
|
|
253
|
+
function Se(e) {
|
|
254
|
+
return Object.entries(e).reduce((e, [t, n]) => n === void 0 ? e : {
|
|
255
|
+
...e,
|
|
256
|
+
[t]: n
|
|
257
|
+
}, {});
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/views/forms/renderer/FormRendererView.tsx
|
|
261
|
+
var q = {
|
|
262
|
+
alignItems: "start",
|
|
263
|
+
display: "grid",
|
|
264
|
+
gap: 12,
|
|
265
|
+
gridTemplateColumns: "repeat(12, minmax(0, 1fr))"
|
|
266
|
+
}, J = { gridColumn: "1 / -1" }, Y = {
|
|
267
|
+
alignItems: "start",
|
|
268
|
+
display: "grid",
|
|
269
|
+
gap: 8,
|
|
270
|
+
minWidth: 0
|
|
271
|
+
}, Ce = {
|
|
272
|
+
minWidth: "100%",
|
|
273
|
+
width: "100%"
|
|
274
|
+
};
|
|
275
|
+
function X(e) {
|
|
276
|
+
e && (e.style.width = "100%");
|
|
277
|
+
}
|
|
278
|
+
function Z({ dataSourceContext: e, dataSourceInitialValues: t, emptyText: o = "尚未建立欄位。", errors: s = {}, maxWidth: c, onChange: l, onDataSourceStateChange: u, onUploadAttachment: d, optionSnapshots: f, readonly: p = !1, schema: m, singleColumn: h = !1, uiSchema: g, value: v }) {
|
|
279
|
+
let [b, x] = a(() => C(m.fields, v ?? {})), S = r(() => C(m.fields, v ?? b), [
|
|
280
|
+
b,
|
|
281
|
+
m.fields,
|
|
282
|
+
v
|
|
283
|
+
]), w = i(S), T = r(() => L(m, g, S), [
|
|
284
|
+
m,
|
|
285
|
+
g,
|
|
286
|
+
S
|
|
287
|
+
]);
|
|
288
|
+
n(() => {
|
|
289
|
+
w.current = S;
|
|
290
|
+
}, [S]), n(() => {
|
|
291
|
+
x((e) => C(m.fields, v ?? e));
|
|
292
|
+
}, [m.fields, v]);
|
|
293
|
+
function E(e, t) {
|
|
294
|
+
let n = {
|
|
295
|
+
...w.current,
|
|
296
|
+
[e]: t
|
|
297
|
+
};
|
|
298
|
+
w.current = n, v || x(n), l?.(n);
|
|
299
|
+
}
|
|
300
|
+
return T.length ? /* @__PURE__ */ y("div", {
|
|
301
|
+
style: {
|
|
302
|
+
...q,
|
|
303
|
+
...h ? { width: "100%" } : {}
|
|
304
|
+
},
|
|
305
|
+
children: T.map((n) => /* @__PURE__ */ y(we, {
|
|
306
|
+
dataSourceContext: e,
|
|
307
|
+
dataSourceInitialValues: t,
|
|
308
|
+
field: n,
|
|
309
|
+
error: s[n.fieldKey] ?? null,
|
|
310
|
+
errors: s,
|
|
311
|
+
fields: m.fields,
|
|
312
|
+
onChange: E,
|
|
313
|
+
onDataSourceStateChange: u,
|
|
314
|
+
onUploadAttachment: d,
|
|
315
|
+
optionSnapshots: f,
|
|
316
|
+
readonly: p,
|
|
317
|
+
schema: m,
|
|
318
|
+
style: {
|
|
319
|
+
...Y,
|
|
320
|
+
gridColumn: `span ${h ? 12 : Be(n, g)}`,
|
|
321
|
+
...h && !fe(n) ? { maxWidth: c } : {}
|
|
322
|
+
},
|
|
323
|
+
value: S[n.fieldKey],
|
|
324
|
+
values: S,
|
|
325
|
+
uiSchema: g
|
|
326
|
+
}, n.fieldKey))
|
|
327
|
+
}) : /* @__PURE__ */ y("div", {
|
|
328
|
+
style: q,
|
|
329
|
+
children: /* @__PURE__ */ y(_, {
|
|
330
|
+
color: "text-neutral",
|
|
331
|
+
style: J,
|
|
332
|
+
variant: "body",
|
|
333
|
+
children: m.fields.length > 0 ? "目前條件下沒有可填寫欄位。" : o
|
|
334
|
+
})
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function we({ dataSourceContext: t, dataSourceInitialValues: r, error: i, errors: a, field: o, fields: c, onChange: l, onDataSourceStateChange: u, onUploadAttachment: d, optionSnapshots: f, readonly: p, schema: m, style: h, value: g, values: v, uiSchema: x }) {
|
|
338
|
+
let S = O(o, c, v), C = p || ee(o, c, v), w = H({
|
|
339
|
+
context: t,
|
|
340
|
+
field: o,
|
|
341
|
+
formData: v,
|
|
342
|
+
initialFormData: r,
|
|
343
|
+
initialValue: r?.[o.fieldKey],
|
|
344
|
+
optionSnapshots: f,
|
|
345
|
+
readonly: C,
|
|
346
|
+
schema: m,
|
|
347
|
+
uiSchema: x
|
|
348
|
+
}), T = U(w), E = JSON.stringify({
|
|
349
|
+
hasValue: w.hasValue,
|
|
350
|
+
invalidValues: w.invalidValues,
|
|
351
|
+
status: w.status
|
|
352
|
+
});
|
|
353
|
+
return n(() => {
|
|
354
|
+
R(o) && u?.(o.fieldKey, {
|
|
355
|
+
hasValue: w.hasValue,
|
|
356
|
+
invalidValues: w.invalidValues,
|
|
357
|
+
status: w.status
|
|
358
|
+
});
|
|
359
|
+
}, [
|
|
360
|
+
E,
|
|
361
|
+
o.fieldKey,
|
|
362
|
+
u
|
|
363
|
+
]), /* @__PURE__ */ b("div", {
|
|
364
|
+
"data-form-field-key": o.fieldKey,
|
|
365
|
+
style: h,
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ y(e, {
|
|
368
|
+
label: o.label,
|
|
369
|
+
name: o.fieldKey,
|
|
370
|
+
required: S,
|
|
371
|
+
children: fe(o) ? /* @__PURE__ */ y(je, {
|
|
372
|
+
dataSourceContext: t,
|
|
373
|
+
dataSourceInitialValues: r,
|
|
374
|
+
errors: a,
|
|
375
|
+
field: o,
|
|
376
|
+
onChange: l,
|
|
377
|
+
onDataSourceStateChange: u,
|
|
378
|
+
optionSnapshots: f,
|
|
379
|
+
readonly: C,
|
|
380
|
+
schema: m,
|
|
381
|
+
uiSchema: x,
|
|
382
|
+
value: g,
|
|
383
|
+
values: v
|
|
384
|
+
}) : Le(o, g, C, l, d, t, w)
|
|
385
|
+
}),
|
|
386
|
+
i ? /* @__PURE__ */ y(_, {
|
|
387
|
+
color: "text-error",
|
|
388
|
+
variant: "caption",
|
|
389
|
+
children: i
|
|
390
|
+
}) : null,
|
|
391
|
+
T ? /* @__PURE__ */ b("div", {
|
|
392
|
+
style: Te,
|
|
393
|
+
children: [/* @__PURE__ */ y(_, {
|
|
394
|
+
color: w.status === "INVALID" || w.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
395
|
+
variant: "caption",
|
|
396
|
+
children: T
|
|
397
|
+
}), w.status === "UNAVAILABLE" && w.canRetry ? /* @__PURE__ */ y(s, {
|
|
398
|
+
onClick: w.retry,
|
|
399
|
+
size: "sub",
|
|
400
|
+
type: "button",
|
|
401
|
+
variant: "base-ghost",
|
|
402
|
+
children: "重試"
|
|
403
|
+
}) : null]
|
|
404
|
+
}) : null
|
|
405
|
+
]
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
var Te = {
|
|
409
|
+
alignItems: "center",
|
|
410
|
+
display: "flex",
|
|
411
|
+
gap: 8
|
|
412
|
+
}, Ee = {
|
|
413
|
+
display: "grid",
|
|
414
|
+
gap: 8,
|
|
415
|
+
minWidth: 0,
|
|
416
|
+
width: "100%"
|
|
417
|
+
}, De = {
|
|
418
|
+
display: "flex",
|
|
419
|
+
justifyContent: "flex-start"
|
|
420
|
+
}, Q = {
|
|
421
|
+
maxWidth: "100%",
|
|
422
|
+
overflowX: "auto"
|
|
423
|
+
}, Oe = 160, ke = 56, Ae = {
|
|
424
|
+
display: "grid",
|
|
425
|
+
gap: 4,
|
|
426
|
+
minWidth: 0
|
|
427
|
+
};
|
|
428
|
+
function je({ dataSourceContext: e, dataSourceInitialValues: t, errors: r, field: o, onChange: c, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: h, values: g }) {
|
|
429
|
+
let _ = I(h), v = oe(o), C = i(0), [w, E] = a(() => _.map(() => Pe(C)));
|
|
430
|
+
n(() => {
|
|
431
|
+
w.length !== _.length && E(_.map(() => Pe(C)));
|
|
432
|
+
}, [w.length, _.length]);
|
|
433
|
+
function D(e) {
|
|
434
|
+
c(o.fieldKey, e);
|
|
435
|
+
}
|
|
436
|
+
function ee() {
|
|
437
|
+
E([...w, Pe(C)]), D([..._, T(o.columns)]);
|
|
438
|
+
}
|
|
439
|
+
function O(e) {
|
|
440
|
+
E(w.filter((t, n) => n !== e)), D(_.filter((t, n) => n !== e));
|
|
441
|
+
}
|
|
442
|
+
function k(e, t, n) {
|
|
443
|
+
D(_.map((r, i) => i === e ? Fe(r, t, n) : r));
|
|
444
|
+
}
|
|
445
|
+
let A = _.map((e, t) => ({
|
|
446
|
+
...e,
|
|
447
|
+
index: t,
|
|
448
|
+
key: w[t] ?? `row-${t}`
|
|
449
|
+
})), te = o.columns.map((n) => ({
|
|
450
|
+
key: n.fieldKey,
|
|
451
|
+
render: (i) => /* @__PURE__ */ y(Me, {
|
|
452
|
+
column: n,
|
|
453
|
+
dataSourceContext: e,
|
|
454
|
+
error: r[F(o.fieldKey, i.index, n.fieldKey)] ?? null,
|
|
455
|
+
fieldPath: `${o.fieldKey}.${n.fieldKey}`,
|
|
456
|
+
formData: g,
|
|
457
|
+
initialFormData: t,
|
|
458
|
+
initialRowValues: Ne(t?.[o.fieldKey], i.index),
|
|
459
|
+
onChange: (e) => k(i.index, n.fieldKey, e),
|
|
460
|
+
onDataSourceStateChange: l,
|
|
461
|
+
optionSnapshots: u,
|
|
462
|
+
path: F(o.fieldKey, i.index, n.fieldKey),
|
|
463
|
+
readonly: d,
|
|
464
|
+
rowValues: _[i.index] ?? {},
|
|
465
|
+
schema: f,
|
|
466
|
+
uiSchema: p
|
|
467
|
+
}, `${w[i.index] ?? i.index}-${n.fieldKey}`),
|
|
468
|
+
title: n.label || n.fieldKey
|
|
469
|
+
})), j = d ? void 0 : {
|
|
470
|
+
render: (e) => [{
|
|
471
|
+
disabled: () => _.length <= v.minRows,
|
|
472
|
+
icon: S,
|
|
473
|
+
iconType: "icon-only",
|
|
474
|
+
name: "刪除此列",
|
|
475
|
+
onClick: () => O(e.index),
|
|
476
|
+
variant: "destructive-ghost"
|
|
477
|
+
}],
|
|
478
|
+
width: 56
|
|
479
|
+
};
|
|
480
|
+
return /* @__PURE__ */ b("div", {
|
|
481
|
+
style: Ee,
|
|
482
|
+
children: [/* @__PURE__ */ y("div", {
|
|
483
|
+
style: Q,
|
|
484
|
+
children: /* @__PURE__ */ y("div", {
|
|
485
|
+
style: { minWidth: o.columns.length * Oe + (j ? ke : 0) },
|
|
486
|
+
children: /* @__PURE__ */ y(m, {
|
|
487
|
+
...j ? { actions: j } : {},
|
|
488
|
+
columns: te,
|
|
489
|
+
dataSource: [...A],
|
|
490
|
+
rowHeightPreset: "roomy",
|
|
491
|
+
showHeader: !0,
|
|
492
|
+
size: "sub"
|
|
493
|
+
})
|
|
494
|
+
})
|
|
495
|
+
}), d ? null : /* @__PURE__ */ y("div", {
|
|
496
|
+
style: De,
|
|
497
|
+
children: /* @__PURE__ */ y(s, {
|
|
498
|
+
disabled: _.length >= v.maxRows,
|
|
499
|
+
icon: x,
|
|
500
|
+
iconType: "leading",
|
|
501
|
+
onClick: ee,
|
|
502
|
+
size: "sub",
|
|
503
|
+
type: "button",
|
|
504
|
+
variant: "base-secondary",
|
|
505
|
+
children: o.addRowLabel || "新增一列"
|
|
506
|
+
})
|
|
507
|
+
})]
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
function Me({ column: e, dataSourceContext: t, error: r, fieldPath: i, formData: a, initialFormData: o, initialRowValues: c, onChange: l, onDataSourceStateChange: u, optionSnapshots: d, path: f, readonly: p, rowValues: m, schema: h, uiSchema: g }) {
|
|
511
|
+
let v = Ie(m, e.fieldKey), x = H({
|
|
512
|
+
context: t,
|
|
513
|
+
field: e,
|
|
514
|
+
fieldPath: i,
|
|
515
|
+
formData: a,
|
|
516
|
+
initialFormData: o,
|
|
517
|
+
initialValue: c ? Ie(c, e.fieldKey) : void 0,
|
|
518
|
+
optionSnapshots: d,
|
|
519
|
+
readonly: p,
|
|
520
|
+
row: {
|
|
521
|
+
initialValues: c,
|
|
522
|
+
values: m
|
|
523
|
+
},
|
|
524
|
+
schema: h,
|
|
525
|
+
snapshotKey: f,
|
|
526
|
+
uiSchema: g
|
|
527
|
+
}), S = U(x), C = JSON.stringify({
|
|
528
|
+
hasValue: x.hasValue,
|
|
529
|
+
invalidValues: x.invalidValues,
|
|
530
|
+
status: x.status
|
|
531
|
+
});
|
|
532
|
+
return n(() => {
|
|
533
|
+
if (R(e)) return u?.(f, {
|
|
534
|
+
hasValue: x.hasValue,
|
|
535
|
+
invalidValues: x.invalidValues,
|
|
536
|
+
status: x.status
|
|
537
|
+
}), () => {
|
|
538
|
+
u?.(f, {
|
|
539
|
+
hasValue: !1,
|
|
540
|
+
invalidValues: [],
|
|
541
|
+
status: "IDLE"
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
}, [
|
|
545
|
+
u,
|
|
546
|
+
f,
|
|
547
|
+
C
|
|
548
|
+
]), /* @__PURE__ */ b("div", {
|
|
549
|
+
"data-form-field-key": f,
|
|
550
|
+
style: Ae,
|
|
551
|
+
children: [
|
|
552
|
+
Le(e, v, p, (e, t) => l(t), void 0, t, x, "sub"),
|
|
553
|
+
r ? /* @__PURE__ */ y(_, {
|
|
554
|
+
color: "text-error",
|
|
555
|
+
variant: "caption",
|
|
556
|
+
children: r
|
|
557
|
+
}) : null,
|
|
558
|
+
S ? /* @__PURE__ */ b("div", {
|
|
559
|
+
style: Te,
|
|
560
|
+
children: [/* @__PURE__ */ y(_, {
|
|
561
|
+
color: x.status === "INVALID" || x.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
562
|
+
variant: "caption",
|
|
563
|
+
children: S
|
|
564
|
+
}), x.status === "UNAVAILABLE" && x.canRetry ? /* @__PURE__ */ y(s, {
|
|
565
|
+
onClick: x.retry,
|
|
566
|
+
size: "sub",
|
|
567
|
+
type: "button",
|
|
568
|
+
variant: "base-ghost",
|
|
569
|
+
children: "重試"
|
|
570
|
+
}) : null]
|
|
571
|
+
}) : null
|
|
572
|
+
]
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
function Ne(e, t) {
|
|
576
|
+
return I(e)[t];
|
|
577
|
+
}
|
|
578
|
+
function Pe(e) {
|
|
579
|
+
return e.current += 1, `table-row-${e.current}`;
|
|
580
|
+
}
|
|
581
|
+
function Fe(e, t, n) {
|
|
582
|
+
return n === void 0 || !B(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
|
|
583
|
+
...e,
|
|
584
|
+
[t]: n
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
function Ie(e, t) {
|
|
588
|
+
if (!(!e || !Object.prototype.hasOwnProperty.call(e, t))) return e[t];
|
|
589
|
+
}
|
|
590
|
+
function Le(e, t, n, r, i, a, o, s = "main") {
|
|
591
|
+
return R(e) ? ze(e, t, n, r, a, o, s) : Re(e, t, n, r, i, s);
|
|
592
|
+
}
|
|
593
|
+
function Re(e, t, n, r, i, a = "main") {
|
|
594
|
+
if (e.type === "textarea") return /* @__PURE__ */ y(h, {
|
|
595
|
+
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
596
|
+
placeholder: e.placeholder ?? "請輸入多行文字",
|
|
597
|
+
readOnly: n,
|
|
598
|
+
ref: X,
|
|
599
|
+
rows: 3,
|
|
600
|
+
style: Ce,
|
|
601
|
+
value: $(t)
|
|
602
|
+
});
|
|
603
|
+
if (e.type === "boolean") return /* @__PURE__ */ y(g, {
|
|
604
|
+
checked: t === !0,
|
|
605
|
+
disabled: n,
|
|
606
|
+
label: "啟用",
|
|
607
|
+
onChange: (t) => r(e.fieldKey, t.target.checked),
|
|
608
|
+
size: a
|
|
609
|
+
});
|
|
610
|
+
if (z(e) && e.type === "checkbox") {
|
|
611
|
+
let i = e.options.map(N);
|
|
612
|
+
return /* @__PURE__ */ y(p, {
|
|
613
|
+
mode: "multiple",
|
|
614
|
+
onChange: (t) => r(e.fieldKey, t?.length ? t.map((e) => e.id) : void 0),
|
|
615
|
+
options: i,
|
|
616
|
+
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
617
|
+
readOnly: n,
|
|
618
|
+
size: a,
|
|
619
|
+
value: i.filter((e) => Ve(t).includes(e.id))
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
if (z(e)) {
|
|
623
|
+
let i = e.options.map(N);
|
|
624
|
+
return /* @__PURE__ */ y(p, {
|
|
625
|
+
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
626
|
+
options: i,
|
|
627
|
+
placeholder: e.placeholder ?? "請選擇",
|
|
628
|
+
readOnly: n,
|
|
629
|
+
size: a,
|
|
630
|
+
value: le(i, $(t))
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
return e.type === "file_upload" ? /* @__PURE__ */ y(v, {
|
|
634
|
+
accept: e.acceptedMimeTypes?.join(","),
|
|
635
|
+
disabled: n,
|
|
636
|
+
maxFiles: e.maxFiles,
|
|
637
|
+
mode: "button-list",
|
|
638
|
+
...(e.maxFiles ?? 1) > 1 ? { multiple: !0 } : {},
|
|
639
|
+
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
640
|
+
onUpload: async (t) => Promise.all(t.map(async (t) => ({
|
|
641
|
+
file: t,
|
|
642
|
+
id: (i ? await i(e, t) : { id: `${t.name}-${t.lastModified}` }).id,
|
|
643
|
+
progress: 100,
|
|
644
|
+
status: "done"
|
|
645
|
+
}))),
|
|
646
|
+
size: "sub"
|
|
647
|
+
}) : e.type === "date" ? /* @__PURE__ */ y(l, {
|
|
648
|
+
format: "YYYY-MM-DD",
|
|
649
|
+
fullWidth: !0,
|
|
650
|
+
onChange: (t) => r(e.fieldKey, E(t)),
|
|
651
|
+
placeholder: e.placeholder ?? Ue(e.type),
|
|
652
|
+
readOnly: n,
|
|
653
|
+
value: M(t)
|
|
654
|
+
}) : e.type === "datetime" ? /* @__PURE__ */ y(u, {
|
|
655
|
+
formatDate: "YYYY-MM-DD",
|
|
656
|
+
formatTime: "HH:mm",
|
|
657
|
+
fullWidth: !0,
|
|
658
|
+
hideSecond: !0,
|
|
659
|
+
onChange: (t) => r(e.fieldKey, D(t)),
|
|
660
|
+
placeholderLeft: "選擇日期",
|
|
661
|
+
placeholderRight: "選擇時間",
|
|
662
|
+
readOnly: n,
|
|
663
|
+
value: M(t)
|
|
664
|
+
}) : e.type === "number" || e.type === "money" ? /* @__PURE__ */ y(d, {
|
|
665
|
+
fullWidth: !0,
|
|
666
|
+
max: e.maximum,
|
|
667
|
+
min: e.minimum,
|
|
668
|
+
size: a,
|
|
669
|
+
onChange: (t) => r(e.fieldKey, w(A(t.target.value), {
|
|
670
|
+
max: e.maximum,
|
|
671
|
+
min: e.minimum
|
|
672
|
+
})),
|
|
673
|
+
placeholder: e.placeholder ?? Ue(e.type),
|
|
674
|
+
...n ? { readonly: !0 } : {},
|
|
675
|
+
showSpinner: !0,
|
|
676
|
+
value: He(t),
|
|
677
|
+
variant: "measure"
|
|
678
|
+
}) : /* @__PURE__ */ y(d, {
|
|
679
|
+
fullWidth: !0,
|
|
680
|
+
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
681
|
+
placeholder: e.placeholder ?? Ue(e.type),
|
|
682
|
+
...n ? { readonly: !0 } : {},
|
|
683
|
+
size: a,
|
|
684
|
+
value: $(t),
|
|
685
|
+
variant: "base"
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
function ze(e, t, n, r, i, a, s = "main") {
|
|
689
|
+
let l = a.options.map(N), u = ue(t, a.options).map(N), d = a.status === "LOADING", m = a.status === "WAITING_FOR_DEPENDENCIES", h = !!i && !n, g = n || m, _ = n;
|
|
690
|
+
return e.type === "autocomplete" ? pe(e) === "multiple" ? /* @__PURE__ */ y(o, {
|
|
691
|
+
asyncData: h,
|
|
692
|
+
clearSearchText: !0,
|
|
693
|
+
disabled: _,
|
|
694
|
+
disabledOptionsFilter: h,
|
|
695
|
+
globalPortal: !0,
|
|
696
|
+
loading: d,
|
|
697
|
+
mode: "multiple",
|
|
698
|
+
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
699
|
+
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
700
|
+
onSearch: h ? a.onSearch : void 0,
|
|
701
|
+
options: l,
|
|
702
|
+
placeholder: e.placeholder ?? "請輸入或選擇",
|
|
703
|
+
readOnly: n,
|
|
704
|
+
searchDebounceTime: 300,
|
|
705
|
+
size: s,
|
|
706
|
+
value: u
|
|
707
|
+
}) : /* @__PURE__ */ y(o, {
|
|
708
|
+
asyncData: h,
|
|
709
|
+
clearSearchText: !0,
|
|
710
|
+
disabled: _,
|
|
711
|
+
disabledOptionsFilter: h,
|
|
712
|
+
globalPortal: !0,
|
|
713
|
+
loading: d,
|
|
714
|
+
mode: "single",
|
|
715
|
+
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
716
|
+
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
717
|
+
onSearch: h ? a.onSearch : void 0,
|
|
718
|
+
options: l,
|
|
719
|
+
placeholder: e.placeholder ?? "請輸入或選擇",
|
|
720
|
+
readOnly: n,
|
|
721
|
+
searchDebounceTime: 300,
|
|
722
|
+
size: s,
|
|
723
|
+
value: u[0] ?? null
|
|
724
|
+
}) : e.type === "radio" ? /* @__PURE__ */ y(f, {
|
|
725
|
+
disabled: g,
|
|
726
|
+
name: e.fieldKey,
|
|
727
|
+
onChange: (t) => r(e.fieldKey, t.target.value || void 0),
|
|
728
|
+
options: l,
|
|
729
|
+
value: $(t)
|
|
730
|
+
}) : e.type === "checkbox" ? /* @__PURE__ */ y(c, {
|
|
731
|
+
disabled: g,
|
|
732
|
+
name: e.fieldKey,
|
|
733
|
+
onChange: (t) => r(e.fieldKey, t.target.values.length ? t.target.values : void 0),
|
|
734
|
+
options: l.map((e) => ({
|
|
735
|
+
label: e.name,
|
|
736
|
+
value: e.id
|
|
737
|
+
})),
|
|
738
|
+
value: [...Ve(t)]
|
|
739
|
+
}) : pe(e) === "multiple" ? /* @__PURE__ */ y(p, {
|
|
740
|
+
disabled: g,
|
|
741
|
+
loading: d,
|
|
742
|
+
mode: "multiple",
|
|
743
|
+
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
744
|
+
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
745
|
+
options: l,
|
|
746
|
+
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
747
|
+
readOnly: n,
|
|
748
|
+
size: s,
|
|
749
|
+
value: u
|
|
750
|
+
}) : /* @__PURE__ */ y(p, {
|
|
751
|
+
disabled: g,
|
|
752
|
+
loading: d,
|
|
753
|
+
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
754
|
+
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
755
|
+
options: l,
|
|
756
|
+
placeholder: e.placeholder ?? "請選擇",
|
|
757
|
+
readOnly: n,
|
|
758
|
+
size: s,
|
|
759
|
+
value: u[0] ?? null
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
function Be(e, t) {
|
|
763
|
+
return {
|
|
764
|
+
FULL: 12,
|
|
765
|
+
HALF: 6,
|
|
766
|
+
THIRD: 4
|
|
767
|
+
}[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
|
|
768
|
+
}
|
|
769
|
+
function $(e) {
|
|
770
|
+
return typeof e == "string" ? e : "";
|
|
771
|
+
}
|
|
772
|
+
function Ve(e) {
|
|
773
|
+
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
774
|
+
}
|
|
775
|
+
function He(e) {
|
|
776
|
+
return typeof e == "number" ? String(e) : "";
|
|
777
|
+
}
|
|
778
|
+
function Ue(e) {
|
|
779
|
+
return {
|
|
780
|
+
boolean: "",
|
|
781
|
+
autocomplete: "請輸入或選擇",
|
|
782
|
+
checkbox: "請選擇一或多個選項",
|
|
783
|
+
date: "請選擇日期",
|
|
784
|
+
datetime: "請選擇日期與時間",
|
|
785
|
+
file_upload: "請上傳附件",
|
|
786
|
+
money: "請輸入金額",
|
|
787
|
+
number: "請輸入數字",
|
|
788
|
+
radio: "請選擇一個選項",
|
|
789
|
+
select: "請選擇一個選項",
|
|
790
|
+
table: "",
|
|
791
|
+
text: "請輸入文字",
|
|
792
|
+
textarea: "請輸入多行文字"
|
|
793
|
+
}[e];
|
|
794
|
+
}
|
|
795
|
+
//#endregion
|
|
796
|
+
export { H as a, G as i, W as n, U as r, Z as t };
|
|
797
|
+
|
|
798
|
+
//# sourceMappingURL=FormRendererView-DUceSOXe.js.map
|