@rytass/bpm-core-react 0.18.1 → 0.19.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 +20 -0
- package/dist/chunks/{FormBuilderView-vQfVc08Z.js → FormBuilderView-Djlm3y4S.js} +2 -2
- package/dist/chunks/{FormBuilderView-vQfVc08Z.js.map → FormBuilderView-Djlm3y4S.js.map} +1 -1
- package/dist/chunks/{FormBuilderView-CHaAQL5v.cjs → FormBuilderView-G6uRSywl.cjs} +2 -2
- package/dist/chunks/{FormBuilderView-CHaAQL5v.cjs.map → FormBuilderView-G6uRSywl.cjs.map} +1 -1
- package/dist/chunks/{FormRendererView-CTLlG13b.js → FormRendererView-DHfVgbo6.js} +391 -265
- package/dist/chunks/FormRendererView-DHfVgbo6.js.map +1 -0
- package/dist/chunks/FormRendererView-DwfFbaip.cjs +6 -0
- package/dist/chunks/FormRendererView-DwfFbaip.cjs.map +1 -0
- package/dist/chunks/{compose-D9ipJpF_.js → compose-D6zBIc2Z.js} +4 -4
- package/dist/chunks/{compose-D9ipJpF_.js.map → compose-D6zBIc2Z.js.map} +1 -1
- package/dist/chunks/{compose-DtfX8DQ9.cjs → compose-NH6dsFXD.cjs} +2 -2
- package/dist/chunks/{compose-DtfX8DQ9.cjs.map → compose-NH6dsFXD.cjs.map} +1 -1
- package/dist/chunks/{designer-Df79YzUn.cjs → designer-Be9UI9Tg.cjs} +2 -2
- package/dist/chunks/{designer-Df79YzUn.cjs.map → designer-Be9UI9Tg.cjs.map} +1 -1
- package/dist/chunks/{designer-ubnZbP-A.js → designer-uhC_7m2i.js} +3 -3
- package/dist/chunks/{designer-ubnZbP-A.js.map → designer-uhC_7m2i.js.map} +1 -1
- package/dist/chunks/detail-6uw5dmTi.cjs +5 -0
- package/dist/chunks/detail-6uw5dmTi.cjs.map +1 -0
- package/dist/chunks/{detail-C6XKZjlF.js → detail-_GeKqNC-.js} +851 -839
- package/dist/chunks/detail-_GeKqNC-.js.map +1 -0
- package/dist/chunks/{approver-filled-form-B4zPg9kz.cjs → instance-error-message-DTARGbGo.cjs} +2 -2
- package/dist/chunks/instance-error-message-DTARGbGo.cjs.map +1 -0
- package/dist/chunks/{approver-filled-form-Bgazhbvd.js → instance-error-message-q6gy5evy.js} +44 -36
- package/dist/chunks/instance-error-message-q6gy5evy.js.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 +24 -1
- package/dist/views/forms/renderer/FormRendererView.d.ts +24 -1
- package/dist/views/forms/renderer/file-upload-field.d.cts +84 -0
- package/dist/views/forms/renderer/file-upload-field.d.ts +84 -0
- package/dist/views/forms/renderer/form-value-readers.d.cts +7 -0
- package/dist/views/forms/renderer/form-value-readers.d.ts +7 -0
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.d.cts +1 -0
- package/dist/views/forms/renderer/index.d.ts +1 -0
- package/dist/views/forms/renderer/index.js +1 -1
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +19 -2
- package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +19 -2
- package/dist/views/instances/detail/sections/shared.d.cts +1 -2
- package/dist/views/instances/detail/sections/shared.d.ts +1 -2
- package/dist/views/instances/instance-error-message.d.cts +5 -0
- package/dist/views/instances/instance-error-message.d.ts +5 -0
- 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 +77 -75
- 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/FormRendererView-CTLlG13b.js.map +0 -1
- package/dist/chunks/FormRendererView-ChmM_4Yc.cjs +0 -4
- package/dist/chunks/FormRendererView-ChmM_4Yc.cjs.map +0 -1
- package/dist/chunks/approver-filled-form-B4zPg9kz.cjs.map +0 -1
- package/dist/chunks/approver-filled-form-Bgazhbvd.js.map +0 -1
- package/dist/chunks/detail-BBC9kqXd.cjs +0 -5
- package/dist/chunks/detail-BBC9kqXd.cjs.map +0 -1
- package/dist/chunks/detail-C6XKZjlF.js.map +0 -1
|
@@ -6,8 +6,8 @@ import { AutoComplete as s, Button as c, CheckboxGroup as l, DatePicker as u, Da
|
|
|
6
6
|
import { resolveMembers as b, searchMembers as x } from "@rytass/bpm-core-client";
|
|
7
7
|
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
8
8
|
import { PlusIcon as w, TrashIcon as T } from "@mezzanine-ui/icons";
|
|
9
|
-
import { buildFormRendererValues as E, clampOptionalNumber as D, createFormTableRow as
|
|
10
|
-
import { isFormDataSourceFieldDefinition as
|
|
9
|
+
import { buildFormRendererValues as E, clampOptionalNumber as D, createFormTableRow as O, formatDatePickerValue as k, formatDateTimePickerValue as A, isFormRendererFieldReadonly as j, isFormRendererFieldRequired as M, mergeFormDataSourceOptions as N, parseOptionalNumberInput as P, previewFormFieldOptions as ee, previewResolveFormFieldOptions as te, readDatePickerValue as F, readFieldOptionAsSelectOption as I, readFormDataSourceErrorCode as ne, readFormDataSourceErrorMessage as re, readFormDataSourceSelectedValues as ie, readFormDataSourceValueSignature as L, readFormFieldOptions as ae, readFormTableCellPath as oe, readFormTableRowBounds as se, readFormTableRows as R, readMissingFormDataSourceDependencies as ce, readMissingFormDataSourceOptionValues as z, readSelectOption as le, readSelectedFormDataSourceOptions as ue, readVisibleFormRendererFields as de, resolveFormFieldOptions as fe } from "@rytass/bpm-core-client/form";
|
|
10
|
+
import { isFormDataSourceFieldDefinition as B, isFormStaticOptionFieldDefinition as pe, isFormTableCellValue as V, isTableFieldDefinition as me, readFormFieldSelectionMode as H, readFormMemberIds as U } from "@rytass/bpm-core-shared/form";
|
|
11
11
|
import { resolveOrgUnitOptions as W, searchOrgUnitOptions as G } from "@rytass/bpm-core-client/organization";
|
|
12
12
|
// src/views/forms/renderer/form-data-source-field.ts
|
|
13
13
|
var he = {
|
|
@@ -23,11 +23,11 @@ var he = {
|
|
|
23
23
|
status: "IDLE"
|
|
24
24
|
}, K = [], ge = 10, _e = ["FORM_DATA_SOURCE_SEARCH_NOT_SUPPORTED", "FORM_DATA_SOURCE_SEARCH_TOO_SHORT"];
|
|
25
25
|
function q(e) {
|
|
26
|
-
let t =
|
|
26
|
+
let t = B(e.field) ? e.field : null, s = e.fieldPath ?? t?.fieldKey ?? "", c = t ? e.optionSnapshots?.[e.snapshotKey ?? t.fieldKey] : void 0, l = t ? JSON.stringify({
|
|
27
27
|
dataSource: t.dataSource,
|
|
28
28
|
fieldKey: t.fieldKey,
|
|
29
29
|
type: t.type
|
|
30
|
-
}) : "", u = JSON.stringify(c ?? null), d = i(() => 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 = t ? e.row ? e.row.values[t.fieldKey] : e.formData[t.fieldKey] : void 0, S =
|
|
30
|
+
}) : "", u = JSON.stringify(c ?? null), d = i(() => 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 = t ? e.row ? e.row.values[t.fieldKey] : e.formData[t.fieldKey] : void 0, S = L(x), C = i(() => ie(x), [S]), w = C.length > 0, T = t ? JSON.stringify({
|
|
31
31
|
bindings: t.dataSource.bindings.map((t) => t.from.kind === "FIELD" ? {
|
|
32
32
|
fieldKey: t.from.fieldKey,
|
|
33
33
|
value: e.formData[t.from.fieldKey]
|
|
@@ -48,20 +48,20 @@ function q(e) {
|
|
|
48
48
|
g,
|
|
49
49
|
v,
|
|
50
50
|
e.readonly
|
|
51
|
-
]), D = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) &&
|
|
51
|
+
]), D = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && L(e.initialValue) !== S : !1, O = t ? e.initialFormData !== void 0 && t.dataSource.bindings.some((t) => t.from.kind === "FIELD" ? L(e.initialFormData?.[t.from.fieldKey]) !== L(e.formData[t.from.fieldKey]) : t.from.kind === "ROW_FIELD" && e.row?.initialValues ? L(e.row.initialValues[t.from.columnKey]) !== L(e.row.values[t.from.columnKey]) : !1) : !1, k = !(!c && !w || !D && !O), A = !!(t && E && k && w), j = ye({
|
|
52
52
|
hasSnapshot: !!c,
|
|
53
53
|
hasValue: w,
|
|
54
|
-
isStale:
|
|
54
|
+
isStale: k,
|
|
55
55
|
readonly: e.readonly
|
|
56
|
-
}),
|
|
56
|
+
}), M = !!(t && E && t.type !== "autocomplete"), P = be(k, M && t !== null && ce(t, e.formData, e.row?.values).length > 0), [F, I] = o([]), [oe, se] = o(""), [R, z] = o(null), [le, de] = o(null), [pe, V] = o(() => t ? M ? P : j : "IDLE"), [me, H] = o(null), U = a(0), W = a(0), G = a(0), K = a(null), q = a(null), J = a({
|
|
57
57
|
cursor: null,
|
|
58
58
|
searchText: ""
|
|
59
|
-
}), Y = i(() => we(e.formData), [f]), X = i(() => e.row ? we(e.row.values) : void 0, [y]),
|
|
60
|
-
options:
|
|
61
|
-
resolution:
|
|
62
|
-
resolvePending:
|
|
59
|
+
}), Y = i(() => we(e.formData), [f]), X = i(() => e.row ? we(e.row.values) : void 0, [y]), Z = i(() => N(d, F), [F, d]), Te = le && le.signature === T ? le : null, Ee = A && !Te, De = ve({
|
|
60
|
+
options: Z,
|
|
61
|
+
resolution: Te,
|
|
62
|
+
resolvePending: Ee,
|
|
63
63
|
value: x
|
|
64
|
-
}),
|
|
64
|
+
}), Q = n((n, r) => {
|
|
65
65
|
if (!t || !E) return;
|
|
66
66
|
let i = W.current + 1;
|
|
67
67
|
W.current = i, J.current = {
|
|
@@ -69,7 +69,7 @@ function q(e) {
|
|
|
69
69
|
searchText: n
|
|
70
70
|
}, K.current?.abort();
|
|
71
71
|
let a = new AbortController();
|
|
72
|
-
K.current = a, V(
|
|
72
|
+
K.current = a, V(P), H(null), (E.kind === "preview" ? ee({
|
|
73
73
|
cursor: r,
|
|
74
74
|
fieldKey: s,
|
|
75
75
|
formData: Y,
|
|
@@ -78,7 +78,7 @@ function q(e) {
|
|
|
78
78
|
searchText: n,
|
|
79
79
|
signal: a.signal,
|
|
80
80
|
uiSchema: e.uiSchema
|
|
81
|
-
}) :
|
|
81
|
+
}) : ae({
|
|
82
82
|
cursor: r,
|
|
83
83
|
fieldKey: s,
|
|
84
84
|
formData: Y,
|
|
@@ -88,13 +88,13 @@ function q(e) {
|
|
|
88
88
|
signal: a.signal,
|
|
89
89
|
templateId: E.templateId ?? null
|
|
90
90
|
})).then((e) => {
|
|
91
|
-
Ce(a, W, i) || (
|
|
92
|
-
let n =
|
|
93
|
-
return
|
|
94
|
-
}), z(e.nextCursor), H(null), U.current = r ? U.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && U.current < ge &&
|
|
91
|
+
Ce(a, W, i) || (I((t) => {
|
|
92
|
+
let n = ue(x, t);
|
|
93
|
+
return N(n, r ? t : [], e.options);
|
|
94
|
+
}), z(e.nextCursor), H(null), U.current = r ? U.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && U.current < ge && Oe.current(n, e.nextCursor), V(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
|
|
95
95
|
}).catch((e) => {
|
|
96
96
|
if (Ce(a, W, i)) return;
|
|
97
|
-
let t =
|
|
97
|
+
let t = re(e) ?? "選項來源暫時無法使用。", n = ne(e);
|
|
98
98
|
H(t), V(xe(!!(n && _e.includes(n)), w));
|
|
99
99
|
});
|
|
100
100
|
}, [
|
|
@@ -102,20 +102,20 @@ function q(e) {
|
|
|
102
102
|
l,
|
|
103
103
|
E,
|
|
104
104
|
w,
|
|
105
|
-
|
|
105
|
+
P,
|
|
106
106
|
s,
|
|
107
107
|
Y,
|
|
108
108
|
X,
|
|
109
109
|
m,
|
|
110
110
|
h
|
|
111
|
-
]),
|
|
112
|
-
|
|
113
|
-
let
|
|
111
|
+
]), Oe = a(Q);
|
|
112
|
+
Oe.current = Q;
|
|
113
|
+
let ke = n(() => {
|
|
114
114
|
if (!t || !E || C.length === 0) return;
|
|
115
115
|
let n = T, r = G.current + 1;
|
|
116
116
|
G.current = r, q.current?.abort();
|
|
117
117
|
let i = new AbortController();
|
|
118
|
-
q.current = i, H(null), (E.kind === "preview" ?
|
|
118
|
+
q.current = i, H(null), (E.kind === "preview" ? te({
|
|
119
119
|
fieldKey: s,
|
|
120
120
|
formData: Y,
|
|
121
121
|
rowValues: X,
|
|
@@ -123,7 +123,7 @@ function q(e) {
|
|
|
123
123
|
signal: i.signal,
|
|
124
124
|
uiSchema: e.uiSchema,
|
|
125
125
|
values: C
|
|
126
|
-
}) :
|
|
126
|
+
}) : fe({
|
|
127
127
|
fieldKey: s,
|
|
128
128
|
formData: Y,
|
|
129
129
|
instanceId: E.instanceId ?? null,
|
|
@@ -132,12 +132,12 @@ function q(e) {
|
|
|
132
132
|
templateId: E.templateId ?? null,
|
|
133
133
|
values: C
|
|
134
134
|
})).then((e) => {
|
|
135
|
-
Ce(i, G, r) || (e.waitingForFieldKeys.length ? V("WAITING_FOR_DEPENDENCIES") : (
|
|
135
|
+
Ce(i, G, r) || (e.waitingForFieldKeys.length ? V("WAITING_FOR_DEPENDENCIES") : (I((t) => N(t, e.options)), de({
|
|
136
136
|
signature: n,
|
|
137
137
|
unresolvedValues: e.unresolvedValues
|
|
138
138
|
}), V("VALID")));
|
|
139
139
|
}).catch((e) => {
|
|
140
|
-
Ce(i, G, r) || (V("UNAVAILABLE"), H(
|
|
140
|
+
Ce(i, G, r) || (V("UNAVAILABLE"), H(re(e) ?? "選項來源暫時無法使用。"));
|
|
141
141
|
});
|
|
142
142
|
}, [
|
|
143
143
|
T,
|
|
@@ -149,57 +149,57 @@ function q(e) {
|
|
|
149
149
|
m,
|
|
150
150
|
C,
|
|
151
151
|
h
|
|
152
|
-
]),
|
|
153
|
-
|
|
154
|
-
W.current += 1, K.current?.abort(),
|
|
152
|
+
]), Ae = a(ke);
|
|
153
|
+
Ae.current = ke, r(() => {
|
|
154
|
+
W.current += 1, K.current?.abort(), I((e) => ue(x, e)), z((e) => e === null ? e : null), se((e) => e && ""), H((e) => e && null), t ? M ? Oe.current("", null) : V(j) : V("IDLE");
|
|
155
155
|
}, [
|
|
156
|
-
|
|
156
|
+
M,
|
|
157
157
|
l,
|
|
158
158
|
E,
|
|
159
159
|
T,
|
|
160
160
|
p,
|
|
161
161
|
b,
|
|
162
162
|
e.readonly,
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
P,
|
|
164
|
+
j,
|
|
165
165
|
u
|
|
166
166
|
]), r(() => {
|
|
167
|
-
|
|
167
|
+
A && Ae.current();
|
|
168
168
|
}, [
|
|
169
169
|
T,
|
|
170
170
|
E,
|
|
171
|
-
|
|
171
|
+
A
|
|
172
172
|
]), r(() => () => {
|
|
173
173
|
K.current?.abort(), q.current?.abort();
|
|
174
174
|
}, []);
|
|
175
175
|
let je = n((e) => {
|
|
176
|
-
se(e),
|
|
177
|
-
}, [
|
|
178
|
-
R &&
|
|
176
|
+
se(e), I((e) => ue(x, e)), z(null), Q(e, null);
|
|
177
|
+
}, [Q]), Me = n(() => {
|
|
178
|
+
R && Q(oe, R);
|
|
179
179
|
}, [
|
|
180
|
-
|
|
180
|
+
Q,
|
|
181
181
|
R,
|
|
182
|
-
|
|
182
|
+
oe
|
|
183
183
|
]), Ne = n(() => {
|
|
184
|
-
E && (
|
|
184
|
+
E && (Q(J.current.searchText, J.current.cursor), A && Ae.current());
|
|
185
185
|
}, [
|
|
186
186
|
E,
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
Q,
|
|
188
|
+
A
|
|
189
189
|
]);
|
|
190
190
|
return t ? {
|
|
191
191
|
canRetry: !!E,
|
|
192
192
|
error: me,
|
|
193
193
|
hasValue: w,
|
|
194
194
|
hasNextPage: !!R,
|
|
195
|
-
invalidValues:
|
|
195
|
+
invalidValues: De,
|
|
196
196
|
onReachBottom: Me,
|
|
197
197
|
onSearch: je,
|
|
198
|
-
options:
|
|
198
|
+
options: Z,
|
|
199
199
|
retry: Ne,
|
|
200
200
|
status: Se({
|
|
201
|
-
invalidValues:
|
|
202
|
-
resolvePending:
|
|
201
|
+
invalidValues: De,
|
|
202
|
+
resolvePending: Ee,
|
|
203
203
|
status: pe
|
|
204
204
|
})
|
|
205
205
|
} : he;
|
|
@@ -245,34 +245,158 @@ function we(e) {
|
|
|
245
245
|
[t]: n
|
|
246
246
|
}, {});
|
|
247
247
|
}
|
|
248
|
+
// src/views/forms/renderer/form-value-readers.ts
|
|
249
|
+
function Z(e) {
|
|
250
|
+
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
251
|
+
}
|
|
252
|
+
// src/views/forms/renderer/file-upload-field.tsx
|
|
253
|
+
function Te(e) {
|
|
254
|
+
return e.some((e) => e.pendingCount > 0) ? "附件仍在上傳中,請稍候再送出。" : e.some((e) => e.failedCount > 0) ? "有附件上傳失敗,請重試或移除後再送出。" : null;
|
|
255
|
+
}
|
|
256
|
+
function Ee() {
|
|
257
|
+
let [e, t] = o({}), r = n((e, n) => t((t) => ({
|
|
258
|
+
...t,
|
|
259
|
+
[e]: n
|
|
260
|
+
})), []);
|
|
261
|
+
return {
|
|
262
|
+
blockMessage: Te(Object.values(e)),
|
|
263
|
+
onFileUploadStateChange: r
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
var De = "無法讀取檔名的附件", Q = "此處無法上傳附件";
|
|
267
|
+
function Oe({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onStateChange: l, onUploadAttachment: u, readonly: d, value: f }) {
|
|
268
|
+
let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b = Z(f), x = b.join("\n"), C = i(() => new Map((e ?? []).map((e) => [e.id, e])), [e]), w = i(() => {
|
|
269
|
+
let e = new Map(_.map((e, t) => [e, t]));
|
|
270
|
+
return [...b.map((e) => h.get(e) ?? ke(e, C.get(e))), ...p].sort((t, n) => (e.get(t.id) ?? -1) - (e.get(n.id) ?? -1));
|
|
271
|
+
}, [
|
|
272
|
+
C,
|
|
273
|
+
_,
|
|
274
|
+
h,
|
|
275
|
+
p,
|
|
276
|
+
x
|
|
277
|
+
]), T = a(w), E = a(!0), D = a(M);
|
|
278
|
+
D.current = M, r(() => {
|
|
279
|
+
T.current = w;
|
|
280
|
+
}, [w]);
|
|
281
|
+
let O = n((e) => D.current(e), []), k = p.filter((e) => e.status === "loading").length, A = p.filter((e) => e.status === "error").length, j = a(l);
|
|
282
|
+
j.current = l, r(() => {
|
|
283
|
+
j.current?.({
|
|
284
|
+
failedCount: A,
|
|
285
|
+
pendingCount: k
|
|
286
|
+
});
|
|
287
|
+
}, [A, k]), r(() => (E.current = !0, () => {
|
|
288
|
+
E.current = !1, j.current?.({
|
|
289
|
+
failedCount: 0,
|
|
290
|
+
pendingCount: 0
|
|
291
|
+
});
|
|
292
|
+
}), []);
|
|
293
|
+
function M(e) {
|
|
294
|
+
if (!E.current) return;
|
|
295
|
+
let t = e.filter((e) => e.status === "done"), n = t.map((e) => e.id), r = new Set(b), i = t.filter((e) => e.file !== void 0 && !r.has(e.id));
|
|
296
|
+
T.current = e, v(e.map((e) => e.id)), m(e.filter((e) => e.status !== "done")), i.length > 0 && g((e) => new Map([...e, ...i.map((e) => [e.id, e])])), n.join("\n") !== x && s(n.length ? n : void 0);
|
|
297
|
+
}
|
|
298
|
+
async function N(e) {
|
|
299
|
+
if (!u) throw Error(Q);
|
|
300
|
+
return {
|
|
301
|
+
file: e,
|
|
302
|
+
id: (await u(t, e)).id,
|
|
303
|
+
progress: 100,
|
|
304
|
+
status: "done"
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
async function P(e, t) {
|
|
308
|
+
let n = await N(t).catch((n) => ({
|
|
309
|
+
errorMessage: je(n),
|
|
310
|
+
file: t,
|
|
311
|
+
id: e,
|
|
312
|
+
status: "error"
|
|
313
|
+
}));
|
|
314
|
+
D.current(T.current.map((t) => t.id === e ? n : t));
|
|
315
|
+
}
|
|
316
|
+
function ee(e, t) {
|
|
317
|
+
h.has(e) ? Me(t) : c?.(e);
|
|
318
|
+
}
|
|
319
|
+
let te = !!u && !d, F = [...!d && !u ? [{
|
|
320
|
+
label: Q,
|
|
321
|
+
type: "info"
|
|
322
|
+
}] : [], ...p.filter((e) => e.status === "error").map((e) => ({
|
|
323
|
+
label: `${e.file?.name ?? "檔案"}:${e.errorMessage ?? "上傳失敗"},未附加。請重試或刪除。`,
|
|
324
|
+
type: "error"
|
|
325
|
+
}))];
|
|
326
|
+
return /* @__PURE__ */ S(y, {
|
|
327
|
+
accept: t.acceptedMimeTypes?.join(","),
|
|
328
|
+
disabled: !te,
|
|
329
|
+
files: w,
|
|
330
|
+
...F.length > 0 ? { hints: F } : {},
|
|
331
|
+
maxFiles: t.maxFiles,
|
|
332
|
+
mode: "button-list",
|
|
333
|
+
...(t.maxFiles ?? 1) > 1 ? { multiple: !0 } : {},
|
|
334
|
+
onChange: O,
|
|
335
|
+
onDownload: ee,
|
|
336
|
+
onReload: (e, t) => {
|
|
337
|
+
P(e, t);
|
|
338
|
+
},
|
|
339
|
+
onUpload: async (e) => Promise.all(e.map(async (e) => N(e).catch((t) => ({
|
|
340
|
+
errorMessage: je(t),
|
|
341
|
+
file: e,
|
|
342
|
+
id: `failed-${e.name}-${e.lastModified}-${Math.random()}`,
|
|
343
|
+
status: "error"
|
|
344
|
+
})))),
|
|
345
|
+
size: "sub"
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function ke(e, t) {
|
|
349
|
+
return t ? {
|
|
350
|
+
file: Ae(t),
|
|
351
|
+
id: e,
|
|
352
|
+
progress: 100,
|
|
353
|
+
status: "done"
|
|
354
|
+
} : {
|
|
355
|
+
id: e,
|
|
356
|
+
progress: 100,
|
|
357
|
+
status: "done",
|
|
358
|
+
url: De
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function Ae(e) {
|
|
362
|
+
let t = new File([], e.filename), n = Number(e.sizeBytes);
|
|
363
|
+
return Number.isFinite(n) && n >= 0 && Object.defineProperty(t, "size", { value: n }), t;
|
|
364
|
+
}
|
|
365
|
+
function je(e) {
|
|
366
|
+
return e instanceof Error && e.message ? `上傳失敗:${e.message}` : "上傳失敗,請重試。";
|
|
367
|
+
}
|
|
368
|
+
function Me(e) {
|
|
369
|
+
let t = URL.createObjectURL(e), n = document.createElement("a");
|
|
370
|
+
n.href = t, n.download = e.name, n.style.display = "none", document.body.appendChild(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 3e4);
|
|
371
|
+
}
|
|
248
372
|
// src/views/forms/renderer/form-field-link.ts
|
|
249
|
-
var
|
|
250
|
-
function
|
|
373
|
+
var Ne = /\s/u;
|
|
374
|
+
function Pe(e) {
|
|
251
375
|
return [...e].some((e) => {
|
|
252
376
|
let t = e.codePointAt(0) ?? 0;
|
|
253
|
-
return t <= 32 || t >= 127 && t <= 160 ||
|
|
377
|
+
return t <= 32 || t >= 127 && t <= 160 || Ne.test(e);
|
|
254
378
|
});
|
|
255
379
|
}
|
|
256
|
-
var
|
|
257
|
-
function
|
|
258
|
-
return typeof e != "string" || !e || e.includes("\\") ||
|
|
380
|
+
var Fe = /^https?:\/\//iu;
|
|
381
|
+
function Ie(e) {
|
|
382
|
+
return typeof e != "string" || !e || e.includes("\\") || Pe(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Re(e) ? {
|
|
259
383
|
external: !1,
|
|
260
384
|
href: e
|
|
261
|
-
} : null :
|
|
385
|
+
} : null : Fe.test(e) && ze(e) ? {
|
|
262
386
|
external: !0,
|
|
263
387
|
href: e
|
|
264
388
|
} : null;
|
|
265
389
|
}
|
|
266
|
-
var
|
|
267
|
-
function
|
|
390
|
+
var Le = "http://placeholder.invalid";
|
|
391
|
+
function Re(e) {
|
|
268
392
|
try {
|
|
269
|
-
let t = new URL(e,
|
|
270
|
-
return t.origin ===
|
|
393
|
+
let t = new URL(e, Le);
|
|
394
|
+
return t.origin === Le && !t.pathname.startsWith("//");
|
|
271
395
|
} catch {
|
|
272
396
|
return !1;
|
|
273
397
|
}
|
|
274
398
|
}
|
|
275
|
-
function
|
|
399
|
+
function ze(e) {
|
|
276
400
|
try {
|
|
277
401
|
let t = new URL(e);
|
|
278
402
|
return (t.protocol === "http:" || t.protocol === "https:") && !!t.hostname && !t.username && !t.password;
|
|
@@ -280,7 +404,7 @@ function Ae(e) {
|
|
|
280
404
|
return !1;
|
|
281
405
|
}
|
|
282
406
|
}
|
|
283
|
-
async function
|
|
407
|
+
async function Be(e, t, n = {}) {
|
|
284
408
|
let r = n.maxPerIdRequests ?? 20, i = Math.max(1, n.concurrency ?? 4);
|
|
285
409
|
try {
|
|
286
410
|
return {
|
|
@@ -295,17 +419,17 @@ async function Q(e, t, n = {}) {
|
|
|
295
419
|
skippedIds: []
|
|
296
420
|
};
|
|
297
421
|
}
|
|
298
|
-
let a = e.slice(0, r), o = await
|
|
422
|
+
let a = e.slice(0, r), o = await He(a, i, (e) => t([e]));
|
|
299
423
|
return {
|
|
300
424
|
failedIds: a.filter((e, t) => o[t].status === "rejected"),
|
|
301
425
|
profiles: o.flatMap((e) => e.status === "fulfilled" ? e.value : []),
|
|
302
426
|
skippedIds: e.slice(r)
|
|
303
427
|
};
|
|
304
428
|
}
|
|
305
|
-
function
|
|
429
|
+
function Ve(e, t) {
|
|
306
430
|
return e.filter((e) => !t.has(e));
|
|
307
431
|
}
|
|
308
|
-
async function
|
|
432
|
+
async function He(e, t, n) {
|
|
309
433
|
let r = [], i = 0;
|
|
310
434
|
async function a() {
|
|
311
435
|
for (; i < e.length;) {
|
|
@@ -322,43 +446,43 @@ async function Me(e, t, n) {
|
|
|
322
446
|
return await Promise.all(Array.from({ length: Math.min(t, e.length) }, a)), r;
|
|
323
447
|
}
|
|
324
448
|
// src/views/forms/renderer/member-field-options.ts
|
|
325
|
-
var
|
|
326
|
-
function
|
|
449
|
+
var Ue = "未知會員";
|
|
450
|
+
function We(e) {
|
|
327
451
|
return {
|
|
328
452
|
id: e.memberId,
|
|
329
453
|
name: t(e.name, e.email)
|
|
330
454
|
};
|
|
331
455
|
}
|
|
332
|
-
function
|
|
456
|
+
function Ge(e) {
|
|
333
457
|
return {
|
|
334
458
|
id: e,
|
|
335
|
-
name:
|
|
459
|
+
name: Ue,
|
|
336
460
|
unresolved: !0
|
|
337
461
|
};
|
|
338
462
|
}
|
|
339
|
-
function
|
|
463
|
+
function Ke(e, t) {
|
|
340
464
|
let n = new Map(t.filter((e) => !e.unresolved).map((e) => [e.id, e])), r = new Set(e.map((e) => e.id)), i = t.filter((e, n) => !r.has(e.id) && t.findIndex((t) => t.id === e.id) === n), a = e.map((e) => (e.unresolved ? n.get(e.id) : void 0) ?? e);
|
|
341
465
|
return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
|
|
342
466
|
}
|
|
343
|
-
function
|
|
467
|
+
function qe(e, t) {
|
|
344
468
|
let n = new Set(t.filter((e) => !e.unresolved).map((e) => e.id));
|
|
345
469
|
return U(e).filter((e) => !n.has(e));
|
|
346
470
|
}
|
|
347
|
-
function
|
|
348
|
-
return U(e).map((e) => t.find((t) => t.id === e) ??
|
|
471
|
+
function Je(e, t) {
|
|
472
|
+
return U(e).map((e) => t.find((t) => t.id === e) ?? Ge(e));
|
|
349
473
|
}
|
|
350
|
-
function
|
|
474
|
+
function Ye(e, t) {
|
|
351
475
|
if (e.length !== 0) return t ? e.map((e) => e.id) : e[0]?.id;
|
|
352
476
|
}
|
|
353
477
|
// src/views/forms/renderer/member-field.tsx
|
|
354
|
-
function
|
|
355
|
-
let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y =
|
|
478
|
+
function Xe({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, size: l, value: u }) {
|
|
479
|
+
let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y = qe(u, d).join("\n");
|
|
356
480
|
r(() => {
|
|
357
|
-
let e =
|
|
358
|
-
return e.length === 0 ? () => void 0 : (
|
|
481
|
+
let e = Ve(y ? y.split("\n") : [], v.current), t = !1;
|
|
482
|
+
return e.length === 0 ? () => void 0 : (Be(e, b).then(({ profiles: n, skippedIds: r }) => {
|
|
359
483
|
if (t) return;
|
|
360
|
-
let i = n.map(
|
|
361
|
-
a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) =>
|
|
484
|
+
let i = n.map(We), a = e.filter((e) => !i.some((t) => t.id === e)).map(Ge);
|
|
485
|
+
a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) => Ke(e, [...i, ...a]));
|
|
362
486
|
}), () => {
|
|
363
487
|
t = !0;
|
|
364
488
|
});
|
|
@@ -367,15 +491,15 @@ function Be({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
|
|
|
367
491
|
let t = _.current + 1;
|
|
368
492
|
_.current = t, g(!0);
|
|
369
493
|
try {
|
|
370
|
-
let n = (await x(e)).map(
|
|
371
|
-
_.current === t && (m(n), f((e) =>
|
|
494
|
+
let n = (await x(e)).map(We);
|
|
495
|
+
_.current === t && (m(n), f((e) => Ke(e, n)));
|
|
372
496
|
} catch {
|
|
373
497
|
_.current === t && m([]);
|
|
374
498
|
} finally {
|
|
375
499
|
_.current === t && g(!1);
|
|
376
500
|
}
|
|
377
501
|
}
|
|
378
|
-
let w =
|
|
502
|
+
let w = Je(u, d), T = [...Ke(w, p)], E = {
|
|
379
503
|
asyncData: !0,
|
|
380
504
|
clearSearchText: !0,
|
|
381
505
|
disabled: c,
|
|
@@ -403,72 +527,72 @@ function Be({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
|
|
|
403
527
|
return e ? /* @__PURE__ */ S(s, {
|
|
404
528
|
...E,
|
|
405
529
|
mode: "multiple",
|
|
406
|
-
onChange: (e) => n(
|
|
530
|
+
onChange: (e) => n(Ye(e, !0)),
|
|
407
531
|
value: [...w]
|
|
408
532
|
}) : /* @__PURE__ */ S(s, {
|
|
409
533
|
...E,
|
|
410
534
|
mode: "single",
|
|
411
|
-
onChange: (e) => n(
|
|
535
|
+
onChange: (e) => n(Ye(e ? [e] : [], !1)),
|
|
412
536
|
value: w[0] ?? null
|
|
413
537
|
});
|
|
414
538
|
}
|
|
415
539
|
// src/views/forms/renderer/org-unit-field-options.ts
|
|
416
|
-
var
|
|
417
|
-
function
|
|
540
|
+
var Ze = "未知組織", Qe = "(已刪除)";
|
|
541
|
+
function $e(e) {
|
|
418
542
|
return {
|
|
419
543
|
id: e.id,
|
|
420
|
-
name: e.deleted ? `${e.name}${
|
|
544
|
+
name: e.deleted ? `${e.name}${Qe}` : e.name
|
|
421
545
|
};
|
|
422
546
|
}
|
|
423
|
-
function
|
|
547
|
+
function et(e) {
|
|
424
548
|
return {
|
|
425
549
|
id: e,
|
|
426
550
|
name: e,
|
|
427
551
|
unresolved: !0
|
|
428
552
|
};
|
|
429
553
|
}
|
|
430
|
-
function
|
|
554
|
+
function tt(e) {
|
|
431
555
|
return {
|
|
432
556
|
id: e,
|
|
433
|
-
name:
|
|
557
|
+
name: Ze,
|
|
434
558
|
unresolved: !0
|
|
435
559
|
};
|
|
436
560
|
}
|
|
437
|
-
function
|
|
561
|
+
function nt(e) {
|
|
438
562
|
return typeof e == "string" && e.trim() ? e : null;
|
|
439
563
|
}
|
|
440
564
|
function $(e) {
|
|
441
565
|
return e.toLowerCase();
|
|
442
566
|
}
|
|
443
|
-
function
|
|
567
|
+
function rt(e, t) {
|
|
444
568
|
return $(e) === $(t);
|
|
445
569
|
}
|
|
446
|
-
function
|
|
447
|
-
let n =
|
|
448
|
-
return n === null ? null : t.find((e) =>
|
|
570
|
+
function it(e, t) {
|
|
571
|
+
let n = nt(e);
|
|
572
|
+
return n === null ? null : t.find((e) => rt(e.id, n)) ?? et(n);
|
|
449
573
|
}
|
|
450
|
-
function
|
|
451
|
-
let n =
|
|
452
|
-
return n !== null && !t.some((e) =>
|
|
574
|
+
function at(e, t) {
|
|
575
|
+
let n = nt(e);
|
|
576
|
+
return n !== null && !t.some((e) => rt(e.id, n)) ? n : null;
|
|
453
577
|
}
|
|
454
|
-
function
|
|
455
|
-
let n = new Map(t.filter((e) => !e.unresolved).map((e) => [$(e.id), e])), r = new Set(e.map((e) => $(e.id))), i = t.filter((e, n) => !r.has($(e.id)) && t.findIndex((t) =>
|
|
578
|
+
function ot(e, t) {
|
|
579
|
+
let n = new Map(t.filter((e) => !e.unresolved).map((e) => [$(e.id), e])), r = new Set(e.map((e) => $(e.id))), i = t.filter((e, n) => !r.has($(e.id)) && t.findIndex((t) => rt(t.id, e.id)) === n), a = e.map((e) => (e.unresolved ? n.get($(e.id)) : void 0) ?? e);
|
|
456
580
|
return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
|
|
457
581
|
}
|
|
458
|
-
function
|
|
582
|
+
function st(e) {
|
|
459
583
|
return e ? e.id : void 0;
|
|
460
584
|
}
|
|
461
585
|
// src/views/forms/renderer/org-unit-field.tsx
|
|
462
|
-
var
|
|
463
|
-
function
|
|
464
|
-
let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b =
|
|
586
|
+
var ct = "搜尋組織失敗,請稍後再試。";
|
|
587
|
+
function lt({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value: l }) {
|
|
588
|
+
let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b = at(l, u);
|
|
465
589
|
r(() => {
|
|
466
590
|
let e = !1;
|
|
467
591
|
return b === null ? () => void 0 : (W([b]).then((e) => {
|
|
468
|
-
let t = e.map(
|
|
469
|
-
return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t,
|
|
470
|
-
}).catch(() => [
|
|
471
|
-
e || d((e) =>
|
|
592
|
+
let t = e.map($e);
|
|
593
|
+
return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t, tt(b)];
|
|
594
|
+
}).catch(() => [tt(b)]).then((t) => {
|
|
595
|
+
e || d((e) => ot(e, t));
|
|
472
596
|
}), () => {
|
|
473
597
|
e = !0;
|
|
474
598
|
});
|
|
@@ -477,15 +601,15 @@ function $e({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
477
601
|
let t = y.current + 1;
|
|
478
602
|
y.current = t, h(!0);
|
|
479
603
|
try {
|
|
480
|
-
let n = (await G(e)).map(
|
|
481
|
-
y.current === t && (p(n), _(!1), d((e) =>
|
|
604
|
+
let n = (await G(e)).map($e);
|
|
605
|
+
y.current === t && (p(n), _(!1), d((e) => ot(e, n)));
|
|
482
606
|
} catch {
|
|
483
607
|
y.current === t && (p([]), _(!0));
|
|
484
608
|
} finally {
|
|
485
609
|
y.current === t && h(!1);
|
|
486
610
|
}
|
|
487
611
|
}
|
|
488
|
-
let w =
|
|
612
|
+
let w = it(l, u), T = [...ot(w ? [w] : [], f)];
|
|
489
613
|
return /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S(s, {
|
|
490
614
|
asyncData: !0,
|
|
491
615
|
clearSearchText: !0,
|
|
@@ -502,7 +626,7 @@ function $e({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
502
626
|
loading: m,
|
|
503
627
|
loadingText: "搜尋組織中...",
|
|
504
628
|
mode: "single",
|
|
505
|
-
onChange: (e) => t(
|
|
629
|
+
onChange: (e) => t(st(e ?? null)),
|
|
506
630
|
onSearch: x,
|
|
507
631
|
onVisibilityChange: (e) => {
|
|
508
632
|
e && (p([]), x(""));
|
|
@@ -516,96 +640,106 @@ function $e({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
516
640
|
}), g ? /* @__PURE__ */ S(v, {
|
|
517
641
|
color: "text-error",
|
|
518
642
|
variant: "caption",
|
|
519
|
-
children:
|
|
643
|
+
children: ct
|
|
520
644
|
}) : null] });
|
|
521
645
|
}
|
|
522
646
|
// src/views/forms/renderer/FormRendererView.tsx
|
|
523
|
-
var
|
|
647
|
+
var ut = {
|
|
524
648
|
alignItems: "start",
|
|
525
649
|
display: "grid",
|
|
526
650
|
gap: 12,
|
|
527
651
|
gridTemplateColumns: "repeat(12, minmax(0, 1fr))"
|
|
528
|
-
},
|
|
652
|
+
}, dt = { gridColumn: "1 / -1" }, ft = {
|
|
529
653
|
alignItems: "start",
|
|
530
654
|
display: "grid",
|
|
531
655
|
gap: 8,
|
|
532
656
|
minWidth: 0
|
|
533
|
-
},
|
|
657
|
+
}, pt = {
|
|
534
658
|
minWidth: "100%",
|
|
535
659
|
width: "100%"
|
|
536
660
|
};
|
|
537
|
-
function
|
|
661
|
+
function mt(e) {
|
|
538
662
|
e && (e.style.width = "100%");
|
|
539
663
|
}
|
|
540
|
-
function
|
|
541
|
-
let
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
664
|
+
function ht({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n, emptyText: s = "尚未建立欄位。", errors: c = {}, fieldAccess: l, fieldLabelMarkers: u, maxWidth: d, onChange: f, onDataSourceStateChange: p, onDownloadAttachment: m, onFileUploadStateChange: h, onUploadAttachment: g, optionSnapshots: _, readonly: y = !1, schema: b, singleColumn: x = !1, uiSchema: C, value: w }) {
|
|
665
|
+
let T = i(() => ({
|
|
666
|
+
attachments: e,
|
|
667
|
+
onDownloadAttachment: m,
|
|
668
|
+
onStateChange: h,
|
|
669
|
+
onUploadAttachment: g
|
|
670
|
+
}), [
|
|
671
|
+
e,
|
|
672
|
+
m,
|
|
673
|
+
h,
|
|
674
|
+
g
|
|
675
|
+
]), [D, O] = o(() => E(b.fields, w ?? {})), k = i(() => E(b.fields, w ?? D), [
|
|
676
|
+
D,
|
|
677
|
+
b.fields,
|
|
549
678
|
w
|
|
679
|
+
]), A = a(k), j = i(() => de(b, C, k).filter((e) => gt(l, e.fieldKey)?.visible !== !1), [
|
|
680
|
+
l,
|
|
681
|
+
b,
|
|
682
|
+
C,
|
|
683
|
+
k
|
|
550
684
|
]);
|
|
551
685
|
r(() => {
|
|
552
|
-
|
|
553
|
-
}, [
|
|
554
|
-
|
|
555
|
-
}, [
|
|
556
|
-
function
|
|
686
|
+
A.current = k;
|
|
687
|
+
}, [k]), r(() => {
|
|
688
|
+
O((e) => E(b.fields, w ?? e));
|
|
689
|
+
}, [b.fields, w]);
|
|
690
|
+
function M(e, t) {
|
|
557
691
|
let n = {
|
|
558
|
-
...
|
|
692
|
+
...A.current,
|
|
559
693
|
[e]: t
|
|
560
694
|
};
|
|
561
|
-
|
|
695
|
+
A.current = n, w || O(n), f?.(n);
|
|
562
696
|
}
|
|
563
|
-
return
|
|
697
|
+
return j.length ? /* @__PURE__ */ S("div", {
|
|
564
698
|
style: {
|
|
565
|
-
...
|
|
566
|
-
...
|
|
699
|
+
...ut,
|
|
700
|
+
...x ? { width: "100%" } : {}
|
|
567
701
|
},
|
|
568
|
-
children:
|
|
569
|
-
dataSourceContext:
|
|
570
|
-
dataSourceInitialValues:
|
|
571
|
-
field:
|
|
572
|
-
error:
|
|
573
|
-
errors:
|
|
574
|
-
fields:
|
|
575
|
-
labelMarker:
|
|
576
|
-
onChange:
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
optionSnapshots:
|
|
580
|
-
readonly:
|
|
581
|
-
schema:
|
|
702
|
+
children: j.map((e) => /* @__PURE__ */ S(vt, {
|
|
703
|
+
dataSourceContext: t,
|
|
704
|
+
dataSourceInitialValues: n,
|
|
705
|
+
field: e,
|
|
706
|
+
error: c[e.fieldKey] ?? null,
|
|
707
|
+
errors: c,
|
|
708
|
+
fields: b.fields,
|
|
709
|
+
labelMarker: u !== void 0 && Object.prototype.hasOwnProperty.call(u, e.fieldKey) ? u[e.fieldKey] : void 0,
|
|
710
|
+
onChange: M,
|
|
711
|
+
fileUpload: T,
|
|
712
|
+
onDataSourceStateChange: p,
|
|
713
|
+
optionSnapshots: _,
|
|
714
|
+
readonly: _t(gt(l, e.fieldKey), y),
|
|
715
|
+
schema: b,
|
|
582
716
|
style: {
|
|
583
|
-
...
|
|
584
|
-
gridColumn: `span ${
|
|
585
|
-
...
|
|
717
|
+
...ft,
|
|
718
|
+
gridColumn: `span ${x ? 12 : Rt(e, C)}`,
|
|
719
|
+
...x && !me(e) ? { maxWidth: d } : {}
|
|
586
720
|
},
|
|
587
|
-
value:
|
|
588
|
-
values:
|
|
589
|
-
uiSchema:
|
|
590
|
-
},
|
|
721
|
+
value: k[e.fieldKey],
|
|
722
|
+
values: k,
|
|
723
|
+
uiSchema: C
|
|
724
|
+
}, e.fieldKey))
|
|
591
725
|
}) : /* @__PURE__ */ S("div", {
|
|
592
|
-
style:
|
|
726
|
+
style: ut,
|
|
593
727
|
children: /* @__PURE__ */ S(v, {
|
|
594
728
|
color: "text-neutral",
|
|
595
|
-
style:
|
|
729
|
+
style: dt,
|
|
596
730
|
variant: "body",
|
|
597
|
-
children:
|
|
731
|
+
children: b.fields.length > 0 ? "目前條件下沒有可填寫欄位。" : s
|
|
598
732
|
})
|
|
599
733
|
});
|
|
600
734
|
}
|
|
601
|
-
function
|
|
735
|
+
function gt(e, t) {
|
|
602
736
|
return e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
603
737
|
}
|
|
604
|
-
function
|
|
738
|
+
function _t(e, t) {
|
|
605
739
|
return e === void 0 ? t : !e.editable;
|
|
606
740
|
}
|
|
607
|
-
function
|
|
608
|
-
let x =
|
|
741
|
+
function vt({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors: a, field: o, fields: s, fileUpload: l, labelMarker: u, onChange: d, onDataSourceStateChange: f, optionSnapshots: p, readonly: m, schema: h, style: g, value: _, values: y, uiSchema: b }) {
|
|
742
|
+
let x = M(o, s, y), w = m || j(o, s, y), T = q({
|
|
609
743
|
context: t,
|
|
610
744
|
field: o,
|
|
611
745
|
formData: y,
|
|
@@ -621,7 +755,7 @@ function ct({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
621
755
|
status: T.status
|
|
622
756
|
});
|
|
623
757
|
return r(() => {
|
|
624
|
-
|
|
758
|
+
B(o) && f?.(o.fieldKey, {
|
|
625
759
|
hasValue: T.hasValue,
|
|
626
760
|
invalidValues: T.invalidValues,
|
|
627
761
|
status: T.status
|
|
@@ -629,30 +763,30 @@ function ct({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
629
763
|
}, [
|
|
630
764
|
D,
|
|
631
765
|
o.fieldKey,
|
|
632
|
-
|
|
766
|
+
f
|
|
633
767
|
]), /* @__PURE__ */ C("div", {
|
|
634
768
|
"data-form-field-key": o.fieldKey,
|
|
635
769
|
style: g,
|
|
636
770
|
children: [
|
|
637
771
|
/* @__PURE__ */ S(e, {
|
|
638
772
|
label: o.label,
|
|
639
|
-
...
|
|
773
|
+
...u ? { labelOptionalMarker: u } : {},
|
|
640
774
|
name: o.fieldKey,
|
|
641
775
|
required: x,
|
|
642
|
-
children: me(o) ? /* @__PURE__ */ S(
|
|
776
|
+
children: me(o) ? /* @__PURE__ */ S(kt, {
|
|
643
777
|
dataSourceContext: t,
|
|
644
778
|
dataSourceInitialValues: n,
|
|
645
779
|
errors: a,
|
|
646
780
|
field: o,
|
|
647
|
-
onChange:
|
|
648
|
-
onDataSourceStateChange:
|
|
781
|
+
onChange: d,
|
|
782
|
+
onDataSourceStateChange: f,
|
|
649
783
|
optionSnapshots: p,
|
|
650
784
|
readonly: w,
|
|
651
785
|
schema: h,
|
|
652
786
|
uiSchema: b,
|
|
653
787
|
value: _,
|
|
654
788
|
values: y
|
|
655
|
-
}) :
|
|
789
|
+
}) : Ft(o, _, w, d, l, t, T)
|
|
656
790
|
}),
|
|
657
791
|
i ? /* @__PURE__ */ S(v, {
|
|
658
792
|
color: "text-error",
|
|
@@ -660,7 +794,7 @@ function ct({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
660
794
|
children: i
|
|
661
795
|
}) : null,
|
|
662
796
|
E ? /* @__PURE__ */ C("div", {
|
|
663
|
-
style:
|
|
797
|
+
style: St,
|
|
664
798
|
children: [/* @__PURE__ */ S(v, {
|
|
665
799
|
color: T.status === "INVALID" || T.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
666
800
|
variant: "caption",
|
|
@@ -676,99 +810,99 @@ function ct({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
676
810
|
]
|
|
677
811
|
});
|
|
678
812
|
}
|
|
679
|
-
var
|
|
813
|
+
var yt = "(另開新分頁)", bt = "另開新分頁", xt = {
|
|
680
814
|
color: "inherit",
|
|
681
815
|
textDecoration: "underline",
|
|
682
816
|
wordBreak: "break-all"
|
|
683
|
-
},
|
|
817
|
+
}, St = {
|
|
684
818
|
alignItems: "center",
|
|
685
819
|
display: "flex",
|
|
686
820
|
gap: 8
|
|
687
|
-
},
|
|
821
|
+
}, Ct = {
|
|
688
822
|
display: "grid",
|
|
689
823
|
gap: 8,
|
|
690
824
|
minWidth: 0,
|
|
691
825
|
width: "100%"
|
|
692
|
-
},
|
|
826
|
+
}, wt = {
|
|
693
827
|
display: "flex",
|
|
694
828
|
justifyContent: "flex-start"
|
|
695
|
-
},
|
|
829
|
+
}, Tt = {
|
|
696
830
|
maxWidth: "100%",
|
|
697
831
|
overflowX: "auto"
|
|
698
|
-
},
|
|
832
|
+
}, Et = 160, Dt = 56, Ot = {
|
|
699
833
|
display: "grid",
|
|
700
834
|
gap: 4,
|
|
701
835
|
minWidth: 0
|
|
702
836
|
};
|
|
703
|
-
function
|
|
704
|
-
let _ = R(m), v = se(i), y = a(0), [b, x] = o(() => _.map(() =>
|
|
837
|
+
function kt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
|
|
838
|
+
let _ = R(m), v = se(i), y = a(0), [b, x] = o(() => _.map(() => Mt(y)));
|
|
705
839
|
r(() => {
|
|
706
|
-
b.length !== _.length && x(_.map(() =>
|
|
840
|
+
b.length !== _.length && x(_.map(() => Mt(y)));
|
|
707
841
|
}, [b.length, _.length]);
|
|
708
842
|
function E(e) {
|
|
709
843
|
s(i.fieldKey, e);
|
|
710
844
|
}
|
|
711
845
|
function D() {
|
|
712
|
-
x([...b,
|
|
846
|
+
x([...b, Mt(y)]), E([..._, O(i.columns)]);
|
|
713
847
|
}
|
|
714
|
-
function
|
|
848
|
+
function k(e) {
|
|
715
849
|
x(b.filter((t, n) => n !== e)), E(_.filter((t, n) => n !== e));
|
|
716
850
|
}
|
|
717
|
-
function
|
|
718
|
-
E(_.map((r, i) => i === e ?
|
|
851
|
+
function A(e, t, n) {
|
|
852
|
+
E(_.map((r, i) => i === e ? Nt(r, t, n) : r));
|
|
719
853
|
}
|
|
720
|
-
let
|
|
854
|
+
let j = _.map((e, t) => ({
|
|
721
855
|
...e,
|
|
722
856
|
index: t,
|
|
723
857
|
key: b[t] ?? `row-${t}`
|
|
724
|
-
})),
|
|
858
|
+
})), M = i.columns.map((r) => ({
|
|
725
859
|
key: r.fieldKey,
|
|
726
|
-
render: (a) => /* @__PURE__ */ S(
|
|
860
|
+
render: (a) => /* @__PURE__ */ S(At, {
|
|
727
861
|
column: r,
|
|
728
862
|
dataSourceContext: e,
|
|
729
|
-
error: n[
|
|
863
|
+
error: n[oe(i.fieldKey, a.index, r.fieldKey)] ?? null,
|
|
730
864
|
fieldPath: `${i.fieldKey}.${r.fieldKey}`,
|
|
731
865
|
formData: g,
|
|
732
866
|
initialFormData: t,
|
|
733
|
-
initialRowValues:
|
|
734
|
-
onChange: (e) =>
|
|
867
|
+
initialRowValues: jt(t?.[i.fieldKey], a.index),
|
|
868
|
+
onChange: (e) => A(a.index, r.fieldKey, e),
|
|
735
869
|
onDataSourceStateChange: l,
|
|
736
870
|
optionSnapshots: u,
|
|
737
|
-
path:
|
|
871
|
+
path: oe(i.fieldKey, a.index, r.fieldKey),
|
|
738
872
|
readonly: d,
|
|
739
873
|
rowValues: _[a.index] ?? {},
|
|
740
874
|
schema: f,
|
|
741
875
|
uiSchema: p
|
|
742
876
|
}, `${b[a.index] ?? a.index}-${r.fieldKey}`),
|
|
743
877
|
title: r.label || r.fieldKey
|
|
744
|
-
})),
|
|
878
|
+
})), N = d ? void 0 : {
|
|
745
879
|
render: (e) => [{
|
|
746
880
|
disabled: () => _.length <= v.minRows,
|
|
747
881
|
icon: T,
|
|
748
882
|
iconType: "icon-only",
|
|
749
883
|
name: "刪除此列",
|
|
750
|
-
onClick: () =>
|
|
884
|
+
onClick: () => k(e.index),
|
|
751
885
|
variant: "destructive-ghost"
|
|
752
886
|
}],
|
|
753
887
|
width: 56
|
|
754
888
|
};
|
|
755
889
|
return /* @__PURE__ */ C("div", {
|
|
756
|
-
style:
|
|
890
|
+
style: Ct,
|
|
757
891
|
children: [/* @__PURE__ */ S("div", {
|
|
758
|
-
style:
|
|
892
|
+
style: Tt,
|
|
759
893
|
children: /* @__PURE__ */ S("div", {
|
|
760
|
-
style: { minWidth: i.columns.length *
|
|
894
|
+
style: { minWidth: i.columns.length * Et + (N ? Dt : 0) },
|
|
761
895
|
children: /* @__PURE__ */ S(h, {
|
|
762
|
-
...
|
|
763
|
-
columns:
|
|
764
|
-
dataSource: [...
|
|
896
|
+
...N ? { actions: N } : {},
|
|
897
|
+
columns: M,
|
|
898
|
+
dataSource: [...j],
|
|
765
899
|
rowHeightPreset: "roomy",
|
|
766
900
|
showHeader: !0,
|
|
767
901
|
size: "sub"
|
|
768
902
|
})
|
|
769
903
|
})
|
|
770
904
|
}), d ? null : /* @__PURE__ */ S("div", {
|
|
771
|
-
style:
|
|
905
|
+
style: wt,
|
|
772
906
|
children: /* @__PURE__ */ S(c, {
|
|
773
907
|
disabled: _.length >= v.maxRows,
|
|
774
908
|
icon: w,
|
|
@@ -782,14 +916,14 @@ function yt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
|
|
|
782
916
|
})]
|
|
783
917
|
});
|
|
784
918
|
}
|
|
785
|
-
function
|
|
786
|
-
let _ =
|
|
919
|
+
function At({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData: a, initialFormData: o, initialRowValues: s, onChange: l, onDataSourceStateChange: u, optionSnapshots: d, path: f, readonly: p, rowValues: m, schema: h, uiSchema: g }) {
|
|
920
|
+
let _ = Pt(m, e.fieldKey), y = q({
|
|
787
921
|
context: t,
|
|
788
922
|
field: e,
|
|
789
923
|
fieldPath: i,
|
|
790
924
|
formData: a,
|
|
791
925
|
initialFormData: o,
|
|
792
|
-
initialValue: s ?
|
|
926
|
+
initialValue: s ? Pt(s, e.fieldKey) : void 0,
|
|
793
927
|
optionSnapshots: d,
|
|
794
928
|
readonly: p,
|
|
795
929
|
row: {
|
|
@@ -805,7 +939,7 @@ function bt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
805
939
|
status: y.status
|
|
806
940
|
});
|
|
807
941
|
return r(() => {
|
|
808
|
-
if (
|
|
942
|
+
if (B(e)) return u?.(f, {
|
|
809
943
|
hasValue: y.hasValue,
|
|
810
944
|
invalidValues: y.invalidValues,
|
|
811
945
|
status: y.status
|
|
@@ -822,16 +956,16 @@ function bt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
822
956
|
x
|
|
823
957
|
]), /* @__PURE__ */ C("div", {
|
|
824
958
|
"data-form-field-key": f,
|
|
825
|
-
style:
|
|
959
|
+
style: Ot,
|
|
826
960
|
children: [
|
|
827
|
-
|
|
961
|
+
Ft(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
|
|
828
962
|
n ? /* @__PURE__ */ S(v, {
|
|
829
963
|
color: "text-error",
|
|
830
964
|
variant: "caption",
|
|
831
965
|
children: n
|
|
832
966
|
}) : null,
|
|
833
967
|
b ? /* @__PURE__ */ C("div", {
|
|
834
|
-
style:
|
|
968
|
+
style: St,
|
|
835
969
|
children: [/* @__PURE__ */ S(v, {
|
|
836
970
|
color: y.status === "INVALID" || y.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
837
971
|
variant: "caption",
|
|
@@ -847,38 +981,38 @@ function bt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
847
981
|
]
|
|
848
982
|
});
|
|
849
983
|
}
|
|
850
|
-
function
|
|
984
|
+
function jt(e, t) {
|
|
851
985
|
return R(e)[t];
|
|
852
986
|
}
|
|
853
|
-
function
|
|
987
|
+
function Mt(e) {
|
|
854
988
|
return e.current += 1, `table-row-${e.current}`;
|
|
855
989
|
}
|
|
856
|
-
function
|
|
990
|
+
function Nt(e, t, n) {
|
|
857
991
|
return n === void 0 || !V(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
|
|
858
992
|
...e,
|
|
859
993
|
[t]: n
|
|
860
994
|
};
|
|
861
995
|
}
|
|
862
|
-
function
|
|
996
|
+
function Pt(e, t) {
|
|
863
997
|
if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
864
998
|
}
|
|
865
|
-
function
|
|
866
|
-
return
|
|
999
|
+
function Ft(e, t, n, r, i, a, o, s = "main") {
|
|
1000
|
+
return B(e) ? Lt(e, t, n, r, a, o, s) : It(e, t, n, r, i, s);
|
|
867
1001
|
}
|
|
868
|
-
function
|
|
869
|
-
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ?
|
|
1002
|
+
function It(e, t, n, r, i, a = "main") {
|
|
1003
|
+
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? Ie(t) : null;
|
|
870
1004
|
if (o) return /* @__PURE__ */ S(v, {
|
|
871
1005
|
color: "text-brand",
|
|
872
1006
|
component: "span",
|
|
873
1007
|
variant: "body",
|
|
874
1008
|
children: /* @__PURE__ */ S("a", {
|
|
875
1009
|
href: o.href,
|
|
876
|
-
style:
|
|
1010
|
+
style: xt,
|
|
877
1011
|
...o.external ? {
|
|
878
|
-
"aria-label": `${o.href}${
|
|
1012
|
+
"aria-label": `${o.href}${yt}`,
|
|
879
1013
|
rel: "noopener noreferrer",
|
|
880
1014
|
target: "_blank",
|
|
881
|
-
title:
|
|
1015
|
+
title: bt
|
|
882
1016
|
} : {},
|
|
883
1017
|
children: o.href
|
|
884
1018
|
})
|
|
@@ -887,10 +1021,10 @@ function Et(e, t, n, r, i, a = "main") {
|
|
|
887
1021
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
888
1022
|
placeholder: e.placeholder ?? "請輸入多行文字",
|
|
889
1023
|
readOnly: n,
|
|
890
|
-
ref:
|
|
1024
|
+
ref: mt,
|
|
891
1025
|
rows: 3,
|
|
892
|
-
style:
|
|
893
|
-
value:
|
|
1026
|
+
style: pt,
|
|
1027
|
+
value: zt(t)
|
|
894
1028
|
});
|
|
895
1029
|
if (e.type === "boolean") return /* @__PURE__ */ S(_, {
|
|
896
1030
|
checked: t === !0,
|
|
@@ -900,7 +1034,7 @@ function Et(e, t, n, r, i, a = "main") {
|
|
|
900
1034
|
size: a
|
|
901
1035
|
});
|
|
902
1036
|
if (pe(e) && e.type === "checkbox") {
|
|
903
|
-
let i = e.options.map(
|
|
1037
|
+
let i = e.options.map(I);
|
|
904
1038
|
return /* @__PURE__ */ S(m, {
|
|
905
1039
|
mode: "multiple",
|
|
906
1040
|
onChange: (t) => r(e.fieldKey, t?.length ? t.map((e) => e.id) : void 0),
|
|
@@ -908,21 +1042,21 @@ function Et(e, t, n, r, i, a = "main") {
|
|
|
908
1042
|
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
909
1043
|
readOnly: n,
|
|
910
1044
|
size: a,
|
|
911
|
-
value: i.filter((e) =>
|
|
1045
|
+
value: i.filter((e) => Z(t).includes(e.id))
|
|
912
1046
|
});
|
|
913
1047
|
}
|
|
914
1048
|
if (pe(e)) {
|
|
915
|
-
let i = e.options.map(
|
|
1049
|
+
let i = e.options.map(I);
|
|
916
1050
|
return /* @__PURE__ */ S(m, {
|
|
917
1051
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
918
1052
|
options: i,
|
|
919
1053
|
placeholder: e.placeholder ?? "請選擇",
|
|
920
1054
|
readOnly: n,
|
|
921
1055
|
size: a,
|
|
922
|
-
value:
|
|
1056
|
+
value: le(i, zt(t))
|
|
923
1057
|
});
|
|
924
1058
|
}
|
|
925
|
-
return e.type === "member" ? /* @__PURE__ */ S(
|
|
1059
|
+
return e.type === "member" ? /* @__PURE__ */ S(Xe, {
|
|
926
1060
|
multiple: e.multiple === !0,
|
|
927
1061
|
name: e.fieldKey,
|
|
928
1062
|
onChange: (t) => r(e.fieldKey, t),
|
|
@@ -930,70 +1064,65 @@ function Et(e, t, n, r, i, a = "main") {
|
|
|
930
1064
|
readonly: n,
|
|
931
1065
|
size: a,
|
|
932
1066
|
value: t
|
|
933
|
-
}) : e.type === "org_unit" ? /* @__PURE__ */ S(
|
|
1067
|
+
}) : e.type === "org_unit" ? /* @__PURE__ */ S(lt, {
|
|
934
1068
|
name: e.fieldKey,
|
|
935
1069
|
onChange: (t) => r(e.fieldKey, t),
|
|
936
|
-
placeholder: e.placeholder ??
|
|
1070
|
+
placeholder: e.placeholder ?? Vt(e.type),
|
|
937
1071
|
readonly: n,
|
|
938
1072
|
size: a,
|
|
939
1073
|
value: t
|
|
940
|
-
}) : e.type === "file_upload" ? /* @__PURE__ */ S(
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
id: (i ? await i(e, t) : { id: `${t.name}-${t.lastModified}` }).id,
|
|
950
|
-
progress: 100,
|
|
951
|
-
status: "done"
|
|
952
|
-
}))),
|
|
953
|
-
size: "sub"
|
|
1074
|
+
}) : e.type === "file_upload" ? /* @__PURE__ */ S(Oe, {
|
|
1075
|
+
attachments: i?.attachments,
|
|
1076
|
+
field: e,
|
|
1077
|
+
onChange: (t) => r(e.fieldKey, t),
|
|
1078
|
+
onDownloadAttachment: i?.onDownloadAttachment,
|
|
1079
|
+
onStateChange: (t) => i?.onStateChange?.(e.fieldKey, t),
|
|
1080
|
+
onUploadAttachment: i?.onUploadAttachment,
|
|
1081
|
+
readonly: n,
|
|
1082
|
+
value: t
|
|
954
1083
|
}) : e.type === "date" ? /* @__PURE__ */ S(u, {
|
|
955
1084
|
format: "YYYY-MM-DD",
|
|
956
1085
|
fullWidth: !0,
|
|
957
|
-
onChange: (t) => r(e.fieldKey,
|
|
958
|
-
placeholder: e.placeholder ??
|
|
1086
|
+
onChange: (t) => r(e.fieldKey, k(t)),
|
|
1087
|
+
placeholder: e.placeholder ?? Vt(e.type),
|
|
959
1088
|
readOnly: n,
|
|
960
|
-
value:
|
|
1089
|
+
value: F(t)
|
|
961
1090
|
}) : e.type === "datetime" ? /* @__PURE__ */ S(d, {
|
|
962
1091
|
formatDate: "YYYY-MM-DD",
|
|
963
1092
|
formatTime: "HH:mm",
|
|
964
1093
|
fullWidth: !0,
|
|
965
1094
|
hideSecond: !0,
|
|
966
|
-
onChange: (t) => r(e.fieldKey,
|
|
1095
|
+
onChange: (t) => r(e.fieldKey, A(t)),
|
|
967
1096
|
placeholderLeft: "選擇日期",
|
|
968
1097
|
placeholderRight: "選擇時間",
|
|
969
1098
|
readOnly: n,
|
|
970
|
-
value:
|
|
1099
|
+
value: F(t)
|
|
971
1100
|
}) : e.type === "number" || e.type === "money" ? /* @__PURE__ */ S(f, {
|
|
972
1101
|
fullWidth: !0,
|
|
973
1102
|
max: e.maximum,
|
|
974
1103
|
min: e.minimum,
|
|
975
1104
|
size: a,
|
|
976
|
-
onChange: (t) => r(e.fieldKey, D(
|
|
1105
|
+
onChange: (t) => r(e.fieldKey, D(P(t.target.value), {
|
|
977
1106
|
max: e.maximum,
|
|
978
1107
|
min: e.minimum
|
|
979
1108
|
})),
|
|
980
|
-
placeholder: e.placeholder ??
|
|
1109
|
+
placeholder: e.placeholder ?? Vt(e.type),
|
|
981
1110
|
...n ? { readonly: !0 } : {},
|
|
982
1111
|
showSpinner: !0,
|
|
983
|
-
value:
|
|
1112
|
+
value: Bt(t),
|
|
984
1113
|
variant: "measure"
|
|
985
1114
|
}) : /* @__PURE__ */ S(f, {
|
|
986
1115
|
fullWidth: !0,
|
|
987
1116
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
988
|
-
placeholder: e.placeholder ??
|
|
1117
|
+
placeholder: e.placeholder ?? Vt(e.type),
|
|
989
1118
|
...n ? { readonly: !0 } : {},
|
|
990
1119
|
size: a,
|
|
991
|
-
value:
|
|
1120
|
+
value: zt(t),
|
|
992
1121
|
variant: "base"
|
|
993
1122
|
});
|
|
994
1123
|
}
|
|
995
|
-
function
|
|
996
|
-
let c = a.options.map(
|
|
1124
|
+
function Lt(e, t, n, r, i, a, o = "main") {
|
|
1125
|
+
let c = a.options.map(I), u = ue(t, a.options).map(I), d = a.status === "LOADING", f = a.status === "WAITING_FOR_DEPENDENCIES", h = !!i && !n, g = n || f, _ = n;
|
|
997
1126
|
return e.type === "autocomplete" ? H(e) === "multiple" ? /* @__PURE__ */ S(s, {
|
|
998
1127
|
asyncData: h,
|
|
999
1128
|
clearSearchText: !0,
|
|
@@ -1033,7 +1162,7 @@ function Dt(e, t, n, r, i, a, o = "main") {
|
|
|
1033
1162
|
name: e.fieldKey,
|
|
1034
1163
|
onChange: (t) => r(e.fieldKey, t.target.value || void 0),
|
|
1035
1164
|
options: c,
|
|
1036
|
-
value:
|
|
1165
|
+
value: zt(t)
|
|
1037
1166
|
}) : e.type === "checkbox" ? /* @__PURE__ */ S(l, {
|
|
1038
1167
|
disabled: g,
|
|
1039
1168
|
name: e.fieldKey,
|
|
@@ -1042,7 +1171,7 @@ function Dt(e, t, n, r, i, a, o = "main") {
|
|
|
1042
1171
|
label: e.name,
|
|
1043
1172
|
value: e.id
|
|
1044
1173
|
})),
|
|
1045
|
-
value: [...
|
|
1174
|
+
value: [...Z(t)]
|
|
1046
1175
|
}) : H(e) === "multiple" ? /* @__PURE__ */ S(m, {
|
|
1047
1176
|
disabled: g,
|
|
1048
1177
|
loading: d,
|
|
@@ -1066,23 +1195,20 @@ function Dt(e, t, n, r, i, a, o = "main") {
|
|
|
1066
1195
|
value: u[0] ?? null
|
|
1067
1196
|
});
|
|
1068
1197
|
}
|
|
1069
|
-
function
|
|
1198
|
+
function Rt(e, t) {
|
|
1070
1199
|
return {
|
|
1071
1200
|
FULL: 12,
|
|
1072
1201
|
HALF: 6,
|
|
1073
1202
|
THIRD: 4
|
|
1074
1203
|
}[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
|
|
1075
1204
|
}
|
|
1076
|
-
function
|
|
1205
|
+
function zt(e) {
|
|
1077
1206
|
return typeof e == "string" ? e : "";
|
|
1078
1207
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
1081
|
-
}
|
|
1082
|
-
function jt(e) {
|
|
1208
|
+
function Bt(e) {
|
|
1083
1209
|
return typeof e == "number" ? String(e) : "";
|
|
1084
1210
|
}
|
|
1085
|
-
function
|
|
1211
|
+
function Vt(e) {
|
|
1086
1212
|
return {
|
|
1087
1213
|
boolean: "",
|
|
1088
1214
|
autocomplete: "請輸入或選擇",
|
|
@@ -1101,6 +1227,6 @@ function Mt(e) {
|
|
|
1101
1227
|
textarea: "請輸入多行文字"
|
|
1102
1228
|
}[e];
|
|
1103
1229
|
}
|
|
1104
|
-
export {
|
|
1230
|
+
export { Te as a, J as c, Be as i, X as l, $e as n, Ee as o, Ve as r, Y as s, ht as t, q as u };
|
|
1105
1231
|
|
|
1106
|
-
//# sourceMappingURL=FormRendererView-
|
|
1232
|
+
//# sourceMappingURL=FormRendererView-DHfVgbo6.js.map
|