@rytass/bpm-core-react 0.21.2 → 0.21.4
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 +26 -0
- package/dist/chunks/{FormBuilderView-CGKkuVFi.cjs → FormBuilderView-Bok4Y59D.cjs} +2 -2
- package/dist/chunks/{FormBuilderView-CGKkuVFi.cjs.map → FormBuilderView-Bok4Y59D.cjs.map} +1 -1
- package/dist/chunks/{FormBuilderView-6KdApi-D.js → FormBuilderView-DbfbLZCI.js} +2 -2
- package/dist/chunks/{FormBuilderView-6KdApi-D.js.map → FormBuilderView-DbfbLZCI.js.map} +1 -1
- package/dist/chunks/{FormRendererView-BcQKUi1A.js → FormRendererView-CAyPXhPq.js} +372 -342
- package/dist/chunks/FormRendererView-CAyPXhPq.js.map +1 -0
- package/dist/chunks/FormRendererView-iLlHFIUR.cjs +6 -0
- package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +1 -0
- package/dist/chunks/admin-pickers-BjbkBpSJ.cjs.map +1 -1
- package/dist/chunks/admin-pickers-DfGxsjpp.js.map +1 -1
- package/dist/chunks/approval-instance-list-page-BI5fIXc-.js.map +1 -1
- package/dist/chunks/approval-instance-list-page-Cv5I1YPX.cjs.map +1 -1
- package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
- package/dist/chunks/auth-provider-C2b-5mGt.js.map +1 -1
- package/dist/chunks/categories-CyyqG6wG.cjs.map +1 -1
- package/dist/chunks/categories-f7E-RJEc.js.map +1 -1
- package/dist/chunks/{compose-CtWuunwB.cjs → compose-DP1N4twA.cjs} +2 -2
- package/dist/chunks/{compose-CtWuunwB.cjs.map → compose-DP1N4twA.cjs.map} +1 -1
- package/dist/chunks/{compose-M-GR6smM.js → compose-U1zs3Yof.js} +4 -4
- package/dist/chunks/{compose-M-GR6smM.js.map → compose-U1zs3Yof.js.map} +1 -1
- package/dist/chunks/dashboard-page-BoqNhjT_.js.map +1 -1
- package/dist/chunks/dashboard-page-D7YJ3udk.cjs.map +1 -1
- package/dist/chunks/delegations-ClRCwD1I.cjs.map +1 -1
- package/dist/chunks/delegations-CqND-Qtz.js.map +1 -1
- package/dist/chunks/delegations-D43VDSz1.cjs.map +1 -1
- package/dist/chunks/delegations-zisffLwk.js.map +1 -1
- package/dist/chunks/{designer-D6fCDq_q.cjs → designer-CWL-dCQ_.cjs} +2 -2
- package/dist/chunks/{designer-D6fCDq_q.cjs.map → designer-CWL-dCQ_.cjs.map} +1 -1
- package/dist/chunks/{designer-BnMeiMVe.js → designer-DPG7R_WP.js} +3 -3
- package/dist/chunks/{designer-BnMeiMVe.js.map → designer-DPG7R_WP.js.map} +1 -1
- package/dist/chunks/{detail-C5KrUC7s.cjs → detail-BUfsSal0.cjs} +2 -2
- package/dist/chunks/detail-BUfsSal0.cjs.map +1 -0
- package/dist/chunks/{detail-Dnc4PPWO.js → detail-CHZDNNM6.js} +2 -2
- package/dist/chunks/detail-CHZDNNM6.js.map +1 -0
- package/dist/chunks/login-D6cc3bo7.js.map +1 -1
- package/dist/chunks/login-uvVcltrS.cjs.map +1 -1
- package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
- package/dist/chunks/notifications-Cvme5Qbl.js.map +1 -1
- package/dist/chunks/orgs-B_2J2tLX.cjs.map +1 -1
- package/dist/chunks/orgs-DqxMds26.js.map +1 -1
- package/dist/chunks/users-BBtiZ9QQ.js.map +1 -1
- package/dist/chunks/users-EqSzDhuj.cjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.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-control-menu.d.cts +7 -0
- package/dist/views/forms/renderer/form-control-menu.d.ts +7 -0
- package/dist/views/forms/renderer/form-data-source-field.d.cts +12 -0
- package/dist/views/forms/renderer/form-data-source-field.d.ts +12 -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.js +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-B-xycC9S.cjs +0 -6
- package/dist/chunks/FormRendererView-B-xycC9S.cjs.map +0 -1
- package/dist/chunks/FormRendererView-BcQKUi1A.js.map +0 -1
- package/dist/chunks/detail-C5KrUC7s.cjs.map +0 -1
- package/dist/chunks/detail-Dnc4PPWO.js.map +0 -1
|
@@ -5,17 +5,20 @@ import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState a
|
|
|
5
5
|
import { AutoComplete as s, Button as c, CheckboxGroup as l, DatePicker as u, DateTimePicker as d, Input as f, RadioGroup as p, Select as m, Table as h, Textarea as g, Toggle as _, Typography as v, Upload as y } from "@mezzanine-ui/react";
|
|
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
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { FormFieldDensity as w, FormFieldLayout as T } from "@mezzanine-ui/core/form";
|
|
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 ee, previewFormFieldOptions as te, previewResolveFormFieldOptions as ne, readDatePickerValue as P, readFieldOptionAsSelectOption as F, readFormDataSourceErrorCode as re, readFormDataSourceErrorMessage as ie, readFormDataSourceSelectedValues as ae, readFormDataSourceValueSignature as I, readFormFieldOptions as oe, readFormTableCellPath as se, readFormTableRowBounds as ce, readFormTableRows as L, readMissingFormDataSourceDependencies as le, readMissingFormDataSourceOptionValues as R, readSelectOption as z, readSelectedFormDataSourceOptions as ue, readVisibleFormRendererFields as B, resolveFormFieldOptions as de } from "@rytass/bpm-core-client/form";
|
|
10
|
+
import { PlusIcon as V, TrashIcon as fe } from "@mezzanine-ui/icons";
|
|
11
|
+
import { isFormDataSourceFieldDefinition as pe, isFormStaticOptionFieldDefinition as me, isFormTableCellValue as he, isTableFieldDefinition as H, readFormFieldSelectionMode as ge, readFormMemberIds as _e } from "@rytass/bpm-core-shared/form";
|
|
12
|
+
import { resolveOrgUnitOptions as ve, searchOrgUnitOptions as ye } from "@rytass/bpm-core-client/organization";
|
|
12
13
|
// src/views/forms/renderer/form-data-source-field.ts
|
|
13
14
|
var be = {
|
|
14
15
|
canRetry: !1,
|
|
15
16
|
error: null,
|
|
16
17
|
hasValue: !1,
|
|
17
18
|
hasNextPage: !1,
|
|
19
|
+
loadingNextPage: !1,
|
|
18
20
|
invalidValues: [],
|
|
21
|
+
onOpen: () => void 0,
|
|
19
22
|
onReachBottom: () => void 0,
|
|
20
23
|
onSearch: () => void 0,
|
|
21
24
|
options: [],
|
|
@@ -27,10 +30,10 @@ function Te(e, t) {
|
|
|
27
30
|
let n = t.fieldPath?.indexOf(".") ?? -1;
|
|
28
31
|
return t.fieldPath && n > 0 ? t.fieldPath.slice(0, n) : null;
|
|
29
32
|
}
|
|
30
|
-
function
|
|
33
|
+
function Ee(e, t) {
|
|
31
34
|
return t === null ? e : Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
|
|
32
35
|
}
|
|
33
|
-
function
|
|
36
|
+
function De(e, t) {
|
|
34
37
|
let n = e.from;
|
|
35
38
|
switch (n.kind) {
|
|
36
39
|
case "FIELD": return {
|
|
@@ -44,13 +47,13 @@ function Ee(e, t) {
|
|
|
44
47
|
};
|
|
45
48
|
case "EXPRESSION": return {
|
|
46
49
|
expression: n.expression,
|
|
47
|
-
form:
|
|
48
|
-
row: t.rowValues ?
|
|
50
|
+
form: Ee(t.formData, t.ownFormKey),
|
|
51
|
+
row: t.rowValues ? Ee(t.rowValues, t.ownRowKey) : null
|
|
49
52
|
};
|
|
50
|
-
default: return
|
|
53
|
+
default: return U(n);
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
|
-
function
|
|
56
|
+
function U(e) {
|
|
54
57
|
return { unsupported: !0 };
|
|
55
58
|
}
|
|
56
59
|
function Oe(e) {
|
|
@@ -59,17 +62,17 @@ function Oe(e) {
|
|
|
59
62
|
function ke(e) {
|
|
60
63
|
return Array.isArray(e) ? e.map(ke) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => [e, ke(t)])) : e;
|
|
61
64
|
}
|
|
62
|
-
function
|
|
63
|
-
let t =
|
|
65
|
+
function W(e) {
|
|
66
|
+
let t = pe(e.field) ? e.field : null, s = e.fieldPath ?? t?.fieldKey ?? "", c = t ? e.optionSnapshots?.[e.snapshotKey ?? t.fieldKey] : void 0, l = t ? JSON.stringify({
|
|
64
67
|
dataSource: t.dataSource,
|
|
65
68
|
fieldKey: t.fieldKey,
|
|
66
69
|
type: t.type
|
|
67
|
-
}) : "", 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 =
|
|
70
|
+
}) : "", 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 = I(x), C = i(() => ae(x), [S]), w = C.length > 0, T = t ? JSON.stringify(t.dataSource.bindings.map((n) => De(n, {
|
|
68
71
|
formData: e.formData,
|
|
69
72
|
ownFormKey: Te(t.fieldKey, e),
|
|
70
73
|
ownRowKey: e.row ? t.fieldKey : null,
|
|
71
74
|
rowValues: e.row?.values
|
|
72
|
-
}))) : "", D = t ? JSON.stringify(e.initialFormData !== void 0 || e.initialValue !== void 0 ? x ?? null : null) : "", O = t ? `${
|
|
75
|
+
}))) : "", D = t ? JSON.stringify(e.initialFormData !== void 0 || e.initialValue !== void 0 ? x ?? null : null) : "", O = t ? `${T}\u0000${D}` : "", k = Ae(T, t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION") ? Ce : 0), A = k !== T, j = i(() => {
|
|
73
76
|
if (g === "preview") return { kind: "preview" };
|
|
74
77
|
if (g === "runtime" && !e.readonly) return {
|
|
75
78
|
instanceId: _,
|
|
@@ -81,62 +84,62 @@ function H(e) {
|
|
|
81
84
|
g,
|
|
82
85
|
v,
|
|
83
86
|
e.readonly
|
|
84
|
-
]),
|
|
85
|
-
if (n.from.kind === "FIELD") return
|
|
86
|
-
if (n.from.kind === "ROW_FIELD" && e.row?.initialValues) return
|
|
87
|
+
]), M = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && I(e.initialValue) !== S : !1, ee = t ? e.initialFormData !== void 0 && t.dataSource.bindings.some((n) => {
|
|
88
|
+
if (n.from.kind === "FIELD") return I(e.initialFormData?.[n.from.fieldKey]) !== I(e.formData[n.from.fieldKey]);
|
|
89
|
+
if (n.from.kind === "ROW_FIELD" && e.row?.initialValues) return I(e.row.initialValues[n.from.columnKey]) !== I(e.row.values[n.from.columnKey]);
|
|
87
90
|
if (n.from.kind === "EXPRESSION") {
|
|
88
|
-
if (!
|
|
91
|
+
if (!j) return !1;
|
|
89
92
|
let r = {
|
|
90
93
|
ownFormKey: Te(t.fieldKey, e),
|
|
91
94
|
ownRowKey: e.row ? t.fieldKey : null
|
|
92
95
|
};
|
|
93
|
-
return Oe(
|
|
96
|
+
return Oe(De(n, {
|
|
94
97
|
...r,
|
|
95
|
-
formData:
|
|
98
|
+
formData: E(e.schema.fields, e.initialFormData ?? {}),
|
|
96
99
|
rowValues: e.row?.initialValues ?? e.row?.values
|
|
97
|
-
})) !== Oe(
|
|
100
|
+
})) !== Oe(De(n, {
|
|
98
101
|
...r,
|
|
99
|
-
formData:
|
|
102
|
+
formData: E(e.schema.fields, e.formData),
|
|
100
103
|
rowValues: e.row?.values
|
|
101
104
|
}));
|
|
102
105
|
}
|
|
103
106
|
return !1;
|
|
104
|
-
}) : !1,
|
|
107
|
+
}) : !1, P = !!t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION"), [F, se] = o(() => ({
|
|
105
108
|
bindings: k,
|
|
106
109
|
value: S
|
|
107
110
|
}));
|
|
108
|
-
|
|
111
|
+
F.value !== S && se({
|
|
109
112
|
bindings: k,
|
|
110
113
|
value: S
|
|
111
114
|
});
|
|
112
|
-
let
|
|
115
|
+
let ce = !!(P && j && w && F.value === S && F.bindings !== k), L = !!((c || w) && (M || ee || ce)), R = !!(t && j && L && w), z = Pe({
|
|
113
116
|
hasSnapshot: !!c,
|
|
114
|
-
hasValue:
|
|
115
|
-
isStale:
|
|
117
|
+
hasValue: w,
|
|
118
|
+
isStale: L,
|
|
116
119
|
readonly: e.readonly
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
let [
|
|
120
|
+
}), B = !!(t && j && t.type !== "autocomplete"), V = Fe(L, B && t !== null && le(t, e.formData, e.row?.values).length > 0), fe = a(z);
|
|
121
|
+
fe.current = z;
|
|
122
|
+
let [me, he] = o([]), [H, ge] = o(""), [_e, ve] = o(null), [ye, xe] = o(null), [Ee, U] = o(() => t ? B ? V : z : "IDLE"), [ke, W] = o(null), [je, G] = o(!1), Me = a(0), K = a(0), q = a(0), Be = a(null), Ve = a(null), J = a(!1), He = a({
|
|
120
123
|
cursor: null,
|
|
121
124
|
searchText: ""
|
|
122
|
-
}),
|
|
123
|
-
options:
|
|
124
|
-
resolution:
|
|
125
|
-
resolvePending:
|
|
125
|
+
}), Y = i(() => ze(e.formData), [f]), X = i(() => e.row ? ze(e.row.values) : void 0, [y]), Ue = i(() => N(d, me), [me, d]), We = ye && ye.signature === O && ye.valueSignature === S ? ye : null, Ge = R && !We, Ke = !!(ce && We && We.unresolvedValues.length > 0), qe = Ne({
|
|
126
|
+
options: Ue,
|
|
127
|
+
resolution: We,
|
|
128
|
+
resolvePending: Ge,
|
|
126
129
|
value: x
|
|
127
130
|
}), Z = n((n, r) => {
|
|
128
|
-
if (!t || !
|
|
129
|
-
let i =
|
|
130
|
-
|
|
131
|
+
if (!t || !j) return;
|
|
132
|
+
let i = K.current + 1;
|
|
133
|
+
K.current = i, J.current = !0, He.current = {
|
|
131
134
|
cursor: r,
|
|
132
135
|
searchText: n
|
|
133
|
-
},
|
|
136
|
+
}, Be.current?.abort();
|
|
134
137
|
let a = new AbortController();
|
|
135
|
-
|
|
138
|
+
Be.current = a, U(V), G(r !== null), W(null), (j.kind === "preview" ? te({
|
|
136
139
|
cursor: r,
|
|
137
140
|
fieldKey: s,
|
|
138
|
-
formData:
|
|
139
|
-
rowValues:
|
|
141
|
+
formData: Y,
|
|
142
|
+
rowValues: X,
|
|
140
143
|
schema: e.schema,
|
|
141
144
|
searchText: n,
|
|
142
145
|
signal: a.signal,
|
|
@@ -144,83 +147,84 @@ function H(e) {
|
|
|
144
147
|
}) : oe({
|
|
145
148
|
cursor: r,
|
|
146
149
|
fieldKey: s,
|
|
147
|
-
formData:
|
|
148
|
-
instanceId:
|
|
149
|
-
rowValues:
|
|
150
|
+
formData: Y,
|
|
151
|
+
instanceId: j.instanceId ?? null,
|
|
152
|
+
rowValues: X,
|
|
150
153
|
searchText: n,
|
|
151
154
|
signal: a.signal,
|
|
152
|
-
templateId:
|
|
155
|
+
templateId: j.templateId ?? null
|
|
153
156
|
})).then((e) => {
|
|
154
|
-
Re(a,
|
|
155
|
-
let n =
|
|
156
|
-
return
|
|
157
|
-
}),
|
|
157
|
+
Re(a, K, i) || (G(!1), he((t) => {
|
|
158
|
+
let n = ue(x, t);
|
|
159
|
+
return N(n, r ? t : [], e.options);
|
|
160
|
+
}), ve(e.nextCursor), W(null), Me.current = r ? Me.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && Me.current < Se && Q.current(n, e.nextCursor), U(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
|
|
158
161
|
}).catch((e) => {
|
|
159
|
-
if (Re(a,
|
|
162
|
+
if (Re(a, K, i)) return;
|
|
163
|
+
r === null && (J.current = !1), G(!1);
|
|
160
164
|
let t = ie(e) ?? "選項來源暫時無法使用。", n = re(e);
|
|
161
|
-
|
|
165
|
+
W(t), U(Ie(!!(n && we.includes(n)), w));
|
|
162
166
|
});
|
|
163
167
|
}, [
|
|
164
168
|
S,
|
|
165
169
|
l,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
j,
|
|
171
|
+
w,
|
|
172
|
+
V,
|
|
169
173
|
s,
|
|
170
|
-
J,
|
|
171
174
|
Y,
|
|
175
|
+
X,
|
|
172
176
|
m,
|
|
173
177
|
h
|
|
174
|
-
]),
|
|
175
|
-
|
|
176
|
-
let
|
|
177
|
-
if (!t || !
|
|
178
|
-
let n = O, r = S, i =
|
|
179
|
-
|
|
178
|
+
]), Q = a(Z);
|
|
179
|
+
Q.current = Z;
|
|
180
|
+
let Je = n(() => {
|
|
181
|
+
if (!t || !j || C.length === 0) return;
|
|
182
|
+
let n = O, r = S, i = q.current + 1;
|
|
183
|
+
q.current = i, Ve.current?.abort();
|
|
180
184
|
let a = new AbortController();
|
|
181
|
-
|
|
185
|
+
Ve.current = a, W(null), (j.kind === "preview" ? ne({
|
|
182
186
|
fieldKey: s,
|
|
183
|
-
formData:
|
|
184
|
-
rowValues:
|
|
187
|
+
formData: Y,
|
|
188
|
+
rowValues: X,
|
|
185
189
|
schema: e.schema,
|
|
186
190
|
signal: a.signal,
|
|
187
191
|
uiSchema: e.uiSchema,
|
|
188
192
|
values: C
|
|
189
|
-
}) :
|
|
193
|
+
}) : de({
|
|
190
194
|
fieldKey: s,
|
|
191
|
-
formData:
|
|
192
|
-
instanceId:
|
|
193
|
-
rowValues:
|
|
195
|
+
formData: Y,
|
|
196
|
+
instanceId: j.instanceId ?? null,
|
|
197
|
+
rowValues: X,
|
|
194
198
|
signal: a.signal,
|
|
195
|
-
templateId:
|
|
199
|
+
templateId: j.templateId ?? null,
|
|
196
200
|
values: C
|
|
197
201
|
})).then((e) => {
|
|
198
|
-
Re(a,
|
|
202
|
+
Re(a, q, i) || (e.waitingForFieldKeys.length ? U("WAITING_FOR_DEPENDENCIES") : (he((t) => N(t, e.options)), xe({
|
|
199
203
|
signature: n,
|
|
200
204
|
unresolvedValues: e.unresolvedValues,
|
|
201
205
|
valueSignature: r
|
|
202
|
-
}),
|
|
206
|
+
}), U("VALID")));
|
|
203
207
|
}).catch((e) => {
|
|
204
|
-
Re(a,
|
|
208
|
+
Re(a, q, i) || (U("UNAVAILABLE"), W(ie(e) ?? "選項來源暫時無法使用。"));
|
|
205
209
|
});
|
|
206
210
|
}, [
|
|
207
211
|
S,
|
|
208
212
|
O,
|
|
209
213
|
l,
|
|
210
|
-
|
|
214
|
+
j,
|
|
211
215
|
s,
|
|
212
|
-
J,
|
|
213
216
|
Y,
|
|
217
|
+
X,
|
|
214
218
|
m,
|
|
215
219
|
C,
|
|
216
220
|
h
|
|
217
|
-
]),
|
|
218
|
-
|
|
219
|
-
|
|
221
|
+
]), Ye = a(Je);
|
|
222
|
+
Ye.current = Je, r(() => {
|
|
223
|
+
K.current += 1, J.current = !1, Be.current?.abort(), G(!1), he((e) => ue(x, e)), ve((e) => e === null ? e : null), ge((e) => e && ""), W((e) => e && null), t ? B ? Q.current("", null) : U(fe.current) : U("IDLE");
|
|
220
224
|
}, [
|
|
221
|
-
|
|
225
|
+
B,
|
|
222
226
|
l,
|
|
223
|
-
|
|
227
|
+
j,
|
|
224
228
|
k,
|
|
225
229
|
D,
|
|
226
230
|
p,
|
|
@@ -228,52 +232,67 @@ function H(e) {
|
|
|
228
232
|
e.readonly,
|
|
229
233
|
u
|
|
230
234
|
]), r(() => {
|
|
231
|
-
t && !
|
|
235
|
+
t && !B && U(z);
|
|
232
236
|
}, [
|
|
233
|
-
|
|
237
|
+
B,
|
|
234
238
|
l,
|
|
235
|
-
|
|
239
|
+
z
|
|
236
240
|
]), r(() => {
|
|
237
|
-
|
|
241
|
+
R && !A && Ye.current();
|
|
238
242
|
}, [
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
j,
|
|
244
|
+
R,
|
|
241
245
|
A,
|
|
242
246
|
k,
|
|
243
247
|
D
|
|
244
248
|
]), r(() => () => {
|
|
245
|
-
|
|
249
|
+
Be.current?.abort(), Ve.current?.abort();
|
|
246
250
|
}, []);
|
|
247
|
-
let
|
|
248
|
-
|
|
249
|
-
}, [Z]),
|
|
250
|
-
B &&
|
|
251
|
+
let Xe = n((e) => {
|
|
252
|
+
ge(e), he((e) => ue(x, e)), ve(null), Z(e, null);
|
|
253
|
+
}, [Z]), Ze = n(() => {
|
|
254
|
+
B || !j || e.readonly || J.current && H === "" || Xe("");
|
|
251
255
|
}, [
|
|
252
|
-
Z,
|
|
253
256
|
B,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
j,
|
|
258
|
+
e.readonly,
|
|
259
|
+
Xe,
|
|
260
|
+
H
|
|
261
|
+
]), Qe = a({
|
|
262
|
+
cursor: _e,
|
|
263
|
+
searchText: H
|
|
264
|
+
});
|
|
265
|
+
Qe.current = {
|
|
266
|
+
cursor: _e,
|
|
267
|
+
searchText: H
|
|
268
|
+
};
|
|
269
|
+
let $e = n(() => {
|
|
270
|
+
let { cursor: e, searchText: t } = Qe.current;
|
|
271
|
+
e && Q.current(t, e);
|
|
272
|
+
}, []), et = n(() => {
|
|
273
|
+
j && (Z(He.current.searchText, He.current.cursor), R && Ye.current());
|
|
257
274
|
}, [
|
|
258
|
-
|
|
275
|
+
j,
|
|
259
276
|
Z,
|
|
260
|
-
|
|
277
|
+
R
|
|
261
278
|
]);
|
|
262
279
|
return t ? {
|
|
263
|
-
canRetry: !!
|
|
264
|
-
error:
|
|
265
|
-
hasValue:
|
|
266
|
-
hasNextPage: !!
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
280
|
+
canRetry: !!j,
|
|
281
|
+
error: ke,
|
|
282
|
+
hasValue: w,
|
|
283
|
+
hasNextPage: !!_e,
|
|
284
|
+
loadingNextPage: je,
|
|
285
|
+
invalidValues: qe,
|
|
286
|
+
onOpen: Ze,
|
|
287
|
+
onReachBottom: $e,
|
|
288
|
+
onSearch: Xe,
|
|
289
|
+
options: Ue,
|
|
290
|
+
retry: et,
|
|
291
|
+
selectionExpired: Ke,
|
|
292
|
+
status: A && j && (B || w) ? B ? V : "STALE" : Le({
|
|
293
|
+
invalidValues: qe,
|
|
294
|
+
resolvePending: Ge,
|
|
295
|
+
status: Ee
|
|
277
296
|
})
|
|
278
297
|
} : be;
|
|
279
298
|
}
|
|
@@ -299,15 +318,15 @@ function je(e) {
|
|
|
299
318
|
default: return e.error;
|
|
300
319
|
}
|
|
301
320
|
}
|
|
302
|
-
function
|
|
321
|
+
function G(e) {
|
|
303
322
|
return e.hasValue && e.status !== "VALID";
|
|
304
323
|
}
|
|
305
324
|
function Me(e) {
|
|
306
|
-
let t = e.filter(
|
|
325
|
+
let t = e.filter(G);
|
|
307
326
|
return t.length === 0 ? null : t.some((e) => e.status === "INVALID" && e.selectionExpired === !0) ? ie("FORM_DATA_SOURCE_VALUE_NOT_RESOLVED") : t.every((e) => e.status === "LOADING" || e.status === "STALE") ? "選項驗證中,請稍候再送出。" : "請先完成動態選項驗證。";
|
|
308
327
|
}
|
|
309
328
|
function Ne(e) {
|
|
310
|
-
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? xe :
|
|
329
|
+
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? xe : R(e.value, e.options);
|
|
311
330
|
}
|
|
312
331
|
function Pe(e) {
|
|
313
332
|
return e.isStale ? "STALE" : e.hasSnapshot ? "VALID" : e.readonly && e.hasValue ? "UNAVAILABLE" : "IDLE";
|
|
@@ -331,26 +350,26 @@ function ze(e) {
|
|
|
331
350
|
}, {});
|
|
332
351
|
}
|
|
333
352
|
// src/views/forms/renderer/form-value-readers.ts
|
|
334
|
-
function
|
|
353
|
+
function K(e) {
|
|
335
354
|
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
336
355
|
}
|
|
337
356
|
// src/views/forms/renderer/file-upload-field.tsx
|
|
338
|
-
function
|
|
357
|
+
function q(e) {
|
|
339
358
|
return e.some((e) => e.pendingCount > 0) ? "附件仍在上傳中,請稍候再送出。" : e.some((e) => e.failedCount > 0) ? "有附件上傳失敗,請重試或移除後再送出。" : null;
|
|
340
359
|
}
|
|
341
|
-
function
|
|
360
|
+
function Be() {
|
|
342
361
|
let [e, t] = o({}), r = n((e, n) => t((t) => ({
|
|
343
362
|
...t,
|
|
344
363
|
[e]: n
|
|
345
364
|
})), []);
|
|
346
365
|
return {
|
|
347
|
-
blockMessage:
|
|
366
|
+
blockMessage: q(Object.values(e)),
|
|
348
367
|
onFileUploadStateChange: r
|
|
349
368
|
};
|
|
350
369
|
}
|
|
351
|
-
var
|
|
352
|
-
function
|
|
353
|
-
let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b =
|
|
370
|
+
var Ve = "無法讀取檔名的附件", J = "此處無法上傳附件";
|
|
371
|
+
function He({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onStateChange: l, onUploadAttachment: u, readonly: d, value: f }) {
|
|
372
|
+
let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b = K(f), x = b.join("\n"), C = i(() => new Map((e ?? []).map((e) => [e.id, e])), [e]), w = i(() => {
|
|
354
373
|
let e = new Map(_.map((e, t) => [e, t]));
|
|
355
374
|
return [...b.map((e) => h.get(e) ?? Y(e, C.get(e))), ...p].sort((t, n) => (e.get(t.id) ?? -1) - (e.get(n.id) ?? -1));
|
|
356
375
|
}, [
|
|
@@ -380,8 +399,8 @@ function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onS
|
|
|
380
399
|
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));
|
|
381
400
|
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);
|
|
382
401
|
}
|
|
383
|
-
async function
|
|
384
|
-
if (!u) throw Error(
|
|
402
|
+
async function N(e) {
|
|
403
|
+
if (!u) throw Error(J);
|
|
385
404
|
return {
|
|
386
405
|
file: e,
|
|
387
406
|
id: (await u(t, e)).id,
|
|
@@ -389,20 +408,20 @@ function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onS
|
|
|
389
408
|
status: "done"
|
|
390
409
|
};
|
|
391
410
|
}
|
|
392
|
-
async function
|
|
393
|
-
let n = await
|
|
394
|
-
errorMessage:
|
|
411
|
+
async function ee(e, t) {
|
|
412
|
+
let n = await N(t).catch((n) => ({
|
|
413
|
+
errorMessage: Ue(n),
|
|
395
414
|
file: t,
|
|
396
415
|
id: e,
|
|
397
416
|
status: "error"
|
|
398
417
|
}));
|
|
399
418
|
D.current(T.current.map((t) => t.id === e ? n : t));
|
|
400
419
|
}
|
|
401
|
-
function
|
|
402
|
-
h.has(e) ?
|
|
420
|
+
function te(e, t) {
|
|
421
|
+
h.has(e) ? We(t) : c?.(e);
|
|
403
422
|
}
|
|
404
|
-
let
|
|
405
|
-
label:
|
|
423
|
+
let ne = !!u && !d, P = [...!d && !u ? [{
|
|
424
|
+
label: J,
|
|
406
425
|
type: "info"
|
|
407
426
|
}] : [], ...p.filter((e) => e.status === "error").map((e) => ({
|
|
408
427
|
label: `${e.file?.name ?? "檔案"}:${e.errorMessage ?? "上傳失敗"},未附加。請重試或刪除。`,
|
|
@@ -410,19 +429,19 @@ function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onS
|
|
|
410
429
|
}))];
|
|
411
430
|
return /* @__PURE__ */ S(y, {
|
|
412
431
|
accept: t.acceptedMimeTypes?.join(","),
|
|
413
|
-
disabled: !
|
|
432
|
+
disabled: !ne,
|
|
414
433
|
files: w,
|
|
415
|
-
...
|
|
434
|
+
...P.length > 0 ? { hints: P } : {},
|
|
416
435
|
maxFiles: t.maxFiles,
|
|
417
436
|
mode: "button-list",
|
|
418
437
|
...(t.maxFiles ?? 1) > 1 ? { multiple: !0 } : {},
|
|
419
438
|
onChange: O,
|
|
420
|
-
onDownload:
|
|
439
|
+
onDownload: te,
|
|
421
440
|
onReload: (e, t) => {
|
|
422
|
-
|
|
441
|
+
ee(e, t);
|
|
423
442
|
},
|
|
424
|
-
onUpload: async (e) => Promise.all(e.map(async (e) =>
|
|
425
|
-
errorMessage:
|
|
443
|
+
onUpload: async (e) => Promise.all(e.map(async (e) => N(e).catch((t) => ({
|
|
444
|
+
errorMessage: Ue(t),
|
|
426
445
|
file: e,
|
|
427
446
|
id: `failed-${e.name}-${e.lastModified}-${Math.random()}`,
|
|
428
447
|
status: "error"
|
|
@@ -432,7 +451,7 @@ function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onS
|
|
|
432
451
|
}
|
|
433
452
|
function Y(e, t) {
|
|
434
453
|
return t ? {
|
|
435
|
-
file:
|
|
454
|
+
file: X(t),
|
|
436
455
|
id: e,
|
|
437
456
|
progress: 100,
|
|
438
457
|
status: "done"
|
|
@@ -440,40 +459,40 @@ function Y(e, t) {
|
|
|
440
459
|
id: e,
|
|
441
460
|
progress: 100,
|
|
442
461
|
status: "done",
|
|
443
|
-
url:
|
|
462
|
+
url: Ve
|
|
444
463
|
};
|
|
445
464
|
}
|
|
446
|
-
function
|
|
465
|
+
function X(e) {
|
|
447
466
|
let t = new File([], e.filename), n = Number(e.sizeBytes);
|
|
448
467
|
return Number.isFinite(n) && n >= 0 && Object.defineProperty(t, "size", { value: n }), t;
|
|
449
468
|
}
|
|
450
|
-
function
|
|
469
|
+
function Ue(e) {
|
|
451
470
|
return e instanceof Error && e.message ? `上傳失敗:${e.message}` : "上傳失敗,請重試。";
|
|
452
471
|
}
|
|
453
|
-
function
|
|
472
|
+
function We(e) {
|
|
454
473
|
let t = URL.createObjectURL(e), n = document.createElement("a");
|
|
455
474
|
n.href = t, n.download = e.name, n.style.display = "none", document.body.appendChild(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 3e4);
|
|
456
475
|
}
|
|
457
476
|
// src/views/forms/renderer/form-field-link.ts
|
|
458
|
-
var
|
|
459
|
-
function
|
|
477
|
+
var Ge = /\s/u;
|
|
478
|
+
function Ke(e) {
|
|
460
479
|
return [...e].some((e) => {
|
|
461
480
|
let t = e.codePointAt(0) ?? 0;
|
|
462
|
-
return t <= 32 || t >= 127 && t <= 160 ||
|
|
481
|
+
return t <= 32 || t >= 127 && t <= 160 || Ge.test(e);
|
|
463
482
|
});
|
|
464
483
|
}
|
|
465
|
-
var
|
|
466
|
-
function
|
|
467
|
-
return typeof e != "string" || !e || e.includes("\\") ||
|
|
484
|
+
var qe = /^https?:\/\//iu;
|
|
485
|
+
function Z(e) {
|
|
486
|
+
return typeof e != "string" || !e || e.includes("\\") || Ke(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Je(e) ? {
|
|
468
487
|
external: !1,
|
|
469
488
|
href: e
|
|
470
|
-
} : null :
|
|
489
|
+
} : null : qe.test(e) && Ye(e) ? {
|
|
471
490
|
external: !0,
|
|
472
491
|
href: e
|
|
473
492
|
} : null;
|
|
474
493
|
}
|
|
475
494
|
var Q = "http://placeholder.invalid";
|
|
476
|
-
function
|
|
495
|
+
function Je(e) {
|
|
477
496
|
try {
|
|
478
497
|
let t = new URL(e, Q);
|
|
479
498
|
return t.origin === Q && !t.pathname.startsWith("//");
|
|
@@ -481,7 +500,7 @@ function Ke(e) {
|
|
|
481
500
|
return !1;
|
|
482
501
|
}
|
|
483
502
|
}
|
|
484
|
-
function
|
|
503
|
+
function Ye(e) {
|
|
485
504
|
try {
|
|
486
505
|
let t = new URL(e);
|
|
487
506
|
return (t.protocol === "http:" || t.protocol === "https:") && !!t.hostname && !t.username && !t.password;
|
|
@@ -489,7 +508,7 @@ function qe(e) {
|
|
|
489
508
|
return !1;
|
|
490
509
|
}
|
|
491
510
|
}
|
|
492
|
-
async function
|
|
511
|
+
async function Xe(e, t, n = {}) {
|
|
493
512
|
let r = n.maxPerIdRequests ?? 20, i = Math.max(1, n.concurrency ?? 4);
|
|
494
513
|
try {
|
|
495
514
|
return {
|
|
@@ -504,17 +523,17 @@ async function Je(e, t, n = {}) {
|
|
|
504
523
|
skippedIds: []
|
|
505
524
|
};
|
|
506
525
|
}
|
|
507
|
-
let a = e.slice(0, r), o = await
|
|
526
|
+
let a = e.slice(0, r), o = await Qe(a, i, (e) => t([e]));
|
|
508
527
|
return {
|
|
509
528
|
failedIds: a.filter((e, t) => o[t].status === "rejected"),
|
|
510
529
|
profiles: o.flatMap((e) => e.status === "fulfilled" ? e.value : []),
|
|
511
530
|
skippedIds: e.slice(r)
|
|
512
531
|
};
|
|
513
532
|
}
|
|
514
|
-
function
|
|
533
|
+
function Ze(e, t) {
|
|
515
534
|
return e.filter((e) => !t.has(e));
|
|
516
535
|
}
|
|
517
|
-
async function
|
|
536
|
+
async function Qe(e, t, n) {
|
|
518
537
|
let r = [], i = 0;
|
|
519
538
|
async function a() {
|
|
520
539
|
for (; i < e.length;) {
|
|
@@ -531,43 +550,43 @@ async function Xe(e, t, n) {
|
|
|
531
550
|
return await Promise.all(Array.from({ length: Math.min(t, e.length) }, a)), r;
|
|
532
551
|
}
|
|
533
552
|
// src/views/forms/renderer/member-field-options.ts
|
|
534
|
-
var
|
|
535
|
-
function
|
|
553
|
+
var $e = "未知會員";
|
|
554
|
+
function et(e) {
|
|
536
555
|
return {
|
|
537
556
|
id: e.memberId,
|
|
538
557
|
name: t(e.name, e.email)
|
|
539
558
|
};
|
|
540
559
|
}
|
|
541
|
-
function
|
|
560
|
+
function tt(e) {
|
|
542
561
|
return {
|
|
543
562
|
id: e,
|
|
544
|
-
name:
|
|
563
|
+
name: $e,
|
|
545
564
|
unresolved: !0
|
|
546
565
|
};
|
|
547
566
|
}
|
|
548
|
-
function
|
|
567
|
+
function nt(e, t) {
|
|
549
568
|
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);
|
|
550
569
|
return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
|
|
551
570
|
}
|
|
552
|
-
function
|
|
571
|
+
function rt(e, t) {
|
|
553
572
|
let n = new Set(t.filter((e) => !e.unresolved).map((e) => e.id));
|
|
554
|
-
return
|
|
573
|
+
return _e(e).filter((e) => !n.has(e));
|
|
555
574
|
}
|
|
556
|
-
function
|
|
557
|
-
return
|
|
575
|
+
function it(e, t) {
|
|
576
|
+
return _e(e).map((e) => t.find((t) => t.id === e) ?? tt(e));
|
|
558
577
|
}
|
|
559
|
-
function
|
|
578
|
+
function at(e, t) {
|
|
560
579
|
if (e.length !== 0) return t ? e.map((e) => e.id) : e[0]?.id;
|
|
561
580
|
}
|
|
562
581
|
// src/views/forms/renderer/member-field.tsx
|
|
563
|
-
function
|
|
564
|
-
let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y =
|
|
582
|
+
function ot({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, size: l, value: u }) {
|
|
583
|
+
let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y = rt(u, d).join("\n");
|
|
565
584
|
r(() => {
|
|
566
|
-
let e =
|
|
567
|
-
return e.length === 0 ? () => void 0 : (
|
|
585
|
+
let e = Ze(y ? y.split("\n") : [], v.current), t = !1;
|
|
586
|
+
return e.length === 0 ? () => void 0 : (Xe(e, b).then(({ profiles: n, skippedIds: r }) => {
|
|
568
587
|
if (t) return;
|
|
569
|
-
let i = n.map(
|
|
570
|
-
a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) =>
|
|
588
|
+
let i = n.map(et), a = e.filter((e) => !i.some((t) => t.id === e)).map(tt);
|
|
589
|
+
a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) => nt(e, [...i, ...a]));
|
|
571
590
|
}), () => {
|
|
572
591
|
t = !0;
|
|
573
592
|
});
|
|
@@ -576,15 +595,15 @@ function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
|
|
|
576
595
|
let t = _.current + 1;
|
|
577
596
|
_.current = t, g(!0);
|
|
578
597
|
try {
|
|
579
|
-
let n = (await x(e)).map(
|
|
580
|
-
_.current === t && (m(n), f((e) =>
|
|
598
|
+
let n = (await x(e)).map(et);
|
|
599
|
+
_.current === t && (m(n), f((e) => nt(e, n)));
|
|
581
600
|
} catch {
|
|
582
601
|
_.current === t && m([]);
|
|
583
602
|
} finally {
|
|
584
603
|
_.current === t && g(!1);
|
|
585
604
|
}
|
|
586
605
|
}
|
|
587
|
-
let w =
|
|
606
|
+
let w = it(u, d), T = [...nt(w, p)], E = {
|
|
588
607
|
asyncData: !0,
|
|
589
608
|
clearSearchText: !0,
|
|
590
609
|
disabled: c,
|
|
@@ -599,6 +618,7 @@ function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
|
|
|
599
618
|
},
|
|
600
619
|
loading: h,
|
|
601
620
|
loadingText: "搜尋成員中...",
|
|
621
|
+
menuMaxHeight: 320,
|
|
602
622
|
onSearch: C,
|
|
603
623
|
onVisibilityChange: (e) => {
|
|
604
624
|
e && (m([]), C(""));
|
|
@@ -612,72 +632,72 @@ function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
|
|
|
612
632
|
return e ? /* @__PURE__ */ S(s, {
|
|
613
633
|
...E,
|
|
614
634
|
mode: "multiple",
|
|
615
|
-
onChange: (e) => n(
|
|
635
|
+
onChange: (e) => n(at(e, !0)),
|
|
616
636
|
value: [...w]
|
|
617
637
|
}) : /* @__PURE__ */ S(s, {
|
|
618
638
|
...E,
|
|
619
639
|
mode: "single",
|
|
620
|
-
onChange: (e) => n(
|
|
640
|
+
onChange: (e) => n(at(e ? [e] : [], !1)),
|
|
621
641
|
value: w[0] ?? null
|
|
622
642
|
});
|
|
623
643
|
}
|
|
624
644
|
// src/views/forms/renderer/org-unit-field-options.ts
|
|
625
|
-
var
|
|
626
|
-
function
|
|
645
|
+
var st = "未知組織", ct = "(已刪除)";
|
|
646
|
+
function lt(e) {
|
|
627
647
|
return {
|
|
628
648
|
id: e.id,
|
|
629
|
-
name: e.deleted ? `${e.name}${
|
|
649
|
+
name: e.deleted ? `${e.name}${ct}` : e.name
|
|
630
650
|
};
|
|
631
651
|
}
|
|
632
|
-
function
|
|
652
|
+
function ut(e) {
|
|
633
653
|
return {
|
|
634
654
|
id: e,
|
|
635
655
|
name: e,
|
|
636
656
|
unresolved: !0
|
|
637
657
|
};
|
|
638
658
|
}
|
|
639
|
-
function
|
|
659
|
+
function dt(e) {
|
|
640
660
|
return {
|
|
641
661
|
id: e,
|
|
642
|
-
name:
|
|
662
|
+
name: st,
|
|
643
663
|
unresolved: !0
|
|
644
664
|
};
|
|
645
665
|
}
|
|
646
|
-
function
|
|
666
|
+
function ft(e) {
|
|
647
667
|
return typeof e == "string" && e.trim() ? e : null;
|
|
648
668
|
}
|
|
649
669
|
function $(e) {
|
|
650
670
|
return e.toLowerCase();
|
|
651
671
|
}
|
|
652
|
-
function
|
|
672
|
+
function pt(e, t) {
|
|
653
673
|
return $(e) === $(t);
|
|
654
674
|
}
|
|
655
|
-
function
|
|
656
|
-
let n =
|
|
657
|
-
return n === null ? null : t.find((e) =>
|
|
675
|
+
function mt(e, t) {
|
|
676
|
+
let n = ft(e);
|
|
677
|
+
return n === null ? null : t.find((e) => pt(e.id, n)) ?? ut(n);
|
|
658
678
|
}
|
|
659
|
-
function
|
|
660
|
-
let n =
|
|
661
|
-
return n !== null && !t.some((e) =>
|
|
679
|
+
function ht(e, t) {
|
|
680
|
+
let n = ft(e);
|
|
681
|
+
return n !== null && !t.some((e) => pt(e.id, n)) ? n : null;
|
|
662
682
|
}
|
|
663
|
-
function
|
|
664
|
-
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) =>
|
|
683
|
+
function gt(e, t) {
|
|
684
|
+
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) => pt(t.id, e.id)) === n), a = e.map((e) => (e.unresolved ? n.get($(e.id)) : void 0) ?? e);
|
|
665
685
|
return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
|
|
666
686
|
}
|
|
667
|
-
function
|
|
687
|
+
function _t(e) {
|
|
668
688
|
return e ? e.id : void 0;
|
|
669
689
|
}
|
|
670
690
|
// src/views/forms/renderer/org-unit-field.tsx
|
|
671
|
-
var
|
|
672
|
-
function
|
|
673
|
-
let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b =
|
|
691
|
+
var vt = "搜尋組織失敗,請稍後再試。";
|
|
692
|
+
function yt({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value: l }) {
|
|
693
|
+
let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b = ht(l, u);
|
|
674
694
|
r(() => {
|
|
675
695
|
let e = !1;
|
|
676
|
-
return b === null ? () => void 0 : (
|
|
677
|
-
let t = e.map(
|
|
678
|
-
return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t,
|
|
679
|
-
}).catch(() => [
|
|
680
|
-
e || d((e) =>
|
|
696
|
+
return b === null ? () => void 0 : (ve([b]).then((e) => {
|
|
697
|
+
let t = e.map(lt);
|
|
698
|
+
return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t, dt(b)];
|
|
699
|
+
}).catch(() => [dt(b)]).then((t) => {
|
|
700
|
+
e || d((e) => gt(e, t));
|
|
681
701
|
}), () => {
|
|
682
702
|
e = !0;
|
|
683
703
|
});
|
|
@@ -686,15 +706,15 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
686
706
|
let t = y.current + 1;
|
|
687
707
|
y.current = t, h(!0);
|
|
688
708
|
try {
|
|
689
|
-
let n = (await
|
|
690
|
-
y.current === t && (p(n), _(!1), d((e) =>
|
|
709
|
+
let n = (await ye(e)).map(lt);
|
|
710
|
+
y.current === t && (p(n), _(!1), d((e) => gt(e, n)));
|
|
691
711
|
} catch {
|
|
692
712
|
y.current === t && (p([]), _(!0));
|
|
693
713
|
} finally {
|
|
694
714
|
y.current === t && h(!1);
|
|
695
715
|
}
|
|
696
716
|
}
|
|
697
|
-
let w =
|
|
717
|
+
let w = mt(l, u), T = [...gt(w ? [w] : [], f)];
|
|
698
718
|
return /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S(s, {
|
|
699
719
|
asyncData: !0,
|
|
700
720
|
clearSearchText: !0,
|
|
@@ -710,8 +730,9 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
710
730
|
},
|
|
711
731
|
loading: m,
|
|
712
732
|
loadingText: "搜尋組織中...",
|
|
733
|
+
menuMaxHeight: 320,
|
|
713
734
|
mode: "single",
|
|
714
|
-
onChange: (e) => t(
|
|
735
|
+
onChange: (e) => t(_t(e ?? null)),
|
|
715
736
|
onSearch: x,
|
|
716
737
|
onVisibilityChange: (e) => {
|
|
717
738
|
e && (p([]), x(""));
|
|
@@ -725,29 +746,29 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
725
746
|
}), g ? /* @__PURE__ */ S(v, {
|
|
726
747
|
color: "text-error",
|
|
727
748
|
variant: "caption",
|
|
728
|
-
children:
|
|
749
|
+
children: vt
|
|
729
750
|
}) : null] });
|
|
730
751
|
}
|
|
731
752
|
// src/views/forms/renderer/FormRendererView.tsx
|
|
732
|
-
var
|
|
753
|
+
var bt = {
|
|
733
754
|
alignItems: "start",
|
|
734
755
|
display: "grid",
|
|
735
756
|
gap: 12,
|
|
736
757
|
gridTemplateColumns: "repeat(12, minmax(0, 1fr))"
|
|
737
|
-
},
|
|
758
|
+
}, xt = { gridColumn: "1 / -1" }, St = {
|
|
738
759
|
alignItems: "start",
|
|
739
760
|
display: "grid",
|
|
740
761
|
gap: 8,
|
|
741
762
|
minWidth: 0
|
|
742
|
-
},
|
|
763
|
+
}, Ct = {
|
|
743
764
|
minWidth: "100%",
|
|
744
765
|
width: "100%"
|
|
745
766
|
};
|
|
746
|
-
function
|
|
767
|
+
function wt(e) {
|
|
747
768
|
e && (e.style.width = "100%");
|
|
748
769
|
}
|
|
749
|
-
function
|
|
750
|
-
let
|
|
770
|
+
function Tt({ 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 }) {
|
|
771
|
+
let T = i(() => ({
|
|
751
772
|
attachments: e,
|
|
752
773
|
onDownloadAttachment: m,
|
|
753
774
|
onStateChange: h,
|
|
@@ -757,11 +778,11 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
|
|
|
757
778
|
m,
|
|
758
779
|
h,
|
|
759
780
|
g
|
|
760
|
-
]), [D, O] = o(() =>
|
|
781
|
+
]), [D, O] = o(() => E(b.fields, w ?? {})), k = i(() => E(b.fields, w ?? D), [
|
|
761
782
|
D,
|
|
762
783
|
b.fields,
|
|
763
|
-
|
|
764
|
-
]), A = a(k), j = i(() =>
|
|
784
|
+
w
|
|
785
|
+
]), A = a(k), j = i(() => B(b, C, k).filter((e) => Et(l, e.fieldKey)?.visible !== !1), [
|
|
765
786
|
l,
|
|
766
787
|
b,
|
|
767
788
|
C,
|
|
@@ -770,21 +791,21 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
|
|
|
770
791
|
r(() => {
|
|
771
792
|
A.current = k;
|
|
772
793
|
}, [k]), r(() => {
|
|
773
|
-
O((e) =>
|
|
774
|
-
}, [b.fields,
|
|
794
|
+
O((e) => E(b.fields, w ?? e));
|
|
795
|
+
}, [b.fields, w]);
|
|
775
796
|
function M(e, t) {
|
|
776
797
|
let n = {
|
|
777
798
|
...A.current,
|
|
778
799
|
[e]: t
|
|
779
800
|
};
|
|
780
|
-
A.current = n,
|
|
801
|
+
A.current = n, w || O(n), f?.(n);
|
|
781
802
|
}
|
|
782
803
|
return j.length ? /* @__PURE__ */ S("div", {
|
|
783
804
|
style: {
|
|
784
|
-
...
|
|
805
|
+
...bt,
|
|
785
806
|
...x ? { width: "100%" } : {}
|
|
786
807
|
},
|
|
787
|
-
children: j.map((e) => /* @__PURE__ */ S(
|
|
808
|
+
children: j.map((e) => /* @__PURE__ */ S(Ot, {
|
|
788
809
|
dataSourceContext: t,
|
|
789
810
|
dataSourceInitialValues: n,
|
|
790
811
|
field: e,
|
|
@@ -793,38 +814,38 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
|
|
|
793
814
|
fields: b.fields,
|
|
794
815
|
labelMarker: u !== void 0 && Object.prototype.hasOwnProperty.call(u, e.fieldKey) ? u[e.fieldKey] : void 0,
|
|
795
816
|
onChange: M,
|
|
796
|
-
fileUpload:
|
|
817
|
+
fileUpload: T,
|
|
797
818
|
onDataSourceStateChange: p,
|
|
798
819
|
optionSnapshots: _,
|
|
799
|
-
readonly:
|
|
820
|
+
readonly: Dt(Et(l, e.fieldKey), y),
|
|
800
821
|
schema: b,
|
|
801
822
|
style: {
|
|
802
|
-
...
|
|
803
|
-
gridColumn: `span ${x ? 12 :
|
|
804
|
-
...x && !
|
|
823
|
+
...St,
|
|
824
|
+
gridColumn: `span ${x ? 12 : qt(e, C)}`,
|
|
825
|
+
...x && !H(e) ? { maxWidth: d } : {}
|
|
805
826
|
},
|
|
806
827
|
value: k[e.fieldKey],
|
|
807
828
|
values: k,
|
|
808
829
|
uiSchema: C
|
|
809
830
|
}, e.fieldKey))
|
|
810
831
|
}) : /* @__PURE__ */ S("div", {
|
|
811
|
-
style:
|
|
832
|
+
style: bt,
|
|
812
833
|
children: /* @__PURE__ */ S(v, {
|
|
813
834
|
color: "text-neutral",
|
|
814
|
-
style:
|
|
835
|
+
style: xt,
|
|
815
836
|
variant: "body",
|
|
816
837
|
children: b.fields.length > 0 ? "目前條件下沒有可填寫欄位。" : s
|
|
817
838
|
})
|
|
818
839
|
});
|
|
819
840
|
}
|
|
820
|
-
function
|
|
841
|
+
function Et(e, t) {
|
|
821
842
|
return e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
822
843
|
}
|
|
823
|
-
function
|
|
844
|
+
function Dt(e, t) {
|
|
824
845
|
return e === void 0 ? t : !e.editable;
|
|
825
846
|
}
|
|
826
|
-
function
|
|
827
|
-
let x =
|
|
847
|
+
function Ot({ 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 }) {
|
|
848
|
+
let x = M(o, s, y), w = m || j(o, s, y), T = W({
|
|
828
849
|
context: t,
|
|
829
850
|
field: o,
|
|
830
851
|
formData: y,
|
|
@@ -841,7 +862,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
841
862
|
status: T.status
|
|
842
863
|
});
|
|
843
864
|
return r(() => {
|
|
844
|
-
|
|
865
|
+
pe(o) && f?.(o.fieldKey, {
|
|
845
866
|
hasValue: T.hasValue,
|
|
846
867
|
invalidValues: T.invalidValues,
|
|
847
868
|
selectionExpired: T.selectionExpired === !0,
|
|
@@ -858,9 +879,10 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
858
879
|
/* @__PURE__ */ S(e, {
|
|
859
880
|
label: o.label,
|
|
860
881
|
...u ? { labelOptionalMarker: u } : {},
|
|
882
|
+
...H(o) ? It : {},
|
|
861
883
|
name: o.fieldKey,
|
|
862
884
|
required: x,
|
|
863
|
-
children:
|
|
885
|
+
children: H(o) ? /* @__PURE__ */ S(Rt, {
|
|
864
886
|
dataSourceContext: t,
|
|
865
887
|
dataSourceInitialValues: n,
|
|
866
888
|
errors: a,
|
|
@@ -873,7 +895,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
873
895
|
uiSchema: b,
|
|
874
896
|
value: _,
|
|
875
897
|
values: y
|
|
876
|
-
}) :
|
|
898
|
+
}) : Wt(o, _, w, d, l, t, T)
|
|
877
899
|
}),
|
|
878
900
|
i ? /* @__PURE__ */ S(v, {
|
|
879
901
|
color: "text-error",
|
|
@@ -881,7 +903,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
881
903
|
children: i
|
|
882
904
|
}) : null,
|
|
883
905
|
E ? /* @__PURE__ */ C("div", {
|
|
884
|
-
style:
|
|
906
|
+
style: Mt,
|
|
885
907
|
children: [/* @__PURE__ */ S(v, {
|
|
886
908
|
color: T.status === "INVALID" || T.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
887
909
|
variant: "caption",
|
|
@@ -897,46 +919,46 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
897
919
|
]
|
|
898
920
|
});
|
|
899
921
|
}
|
|
900
|
-
var
|
|
922
|
+
var kt = "(另開新分頁)", At = "另開新分頁", jt = {
|
|
901
923
|
color: "inherit",
|
|
902
924
|
textDecoration: "underline",
|
|
903
925
|
wordBreak: "break-all"
|
|
904
|
-
},
|
|
926
|
+
}, Mt = {
|
|
905
927
|
alignItems: "center",
|
|
906
928
|
display: "flex",
|
|
907
929
|
gap: 8
|
|
908
|
-
},
|
|
930
|
+
}, Nt = {
|
|
909
931
|
display: "grid",
|
|
910
932
|
gap: 8,
|
|
911
933
|
minWidth: 0,
|
|
912
934
|
width: "100%"
|
|
913
|
-
},
|
|
935
|
+
}, Pt = {
|
|
914
936
|
display: "flex",
|
|
915
937
|
justifyContent: "flex-start"
|
|
916
|
-
},
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
},
|
|
938
|
+
}, Ft = 160, It = {
|
|
939
|
+
density: w.BASE,
|
|
940
|
+
layout: T.STRETCH
|
|
941
|
+
}, Lt = {
|
|
920
942
|
display: "grid",
|
|
921
943
|
gap: 4,
|
|
922
944
|
minWidth: 0
|
|
923
945
|
};
|
|
924
|
-
function
|
|
925
|
-
let _ =
|
|
946
|
+
function Rt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
|
|
947
|
+
let _ = L(m), v = ce(i), y = a(0), [b, x] = o(() => _.map(() => Vt(y)));
|
|
926
948
|
r(() => {
|
|
927
|
-
b.length !== _.length && x(_.map(() =>
|
|
949
|
+
b.length !== _.length && x(_.map(() => Vt(y)));
|
|
928
950
|
}, [b.length, _.length]);
|
|
929
951
|
function w(e) {
|
|
930
952
|
s(i.fieldKey, e);
|
|
931
953
|
}
|
|
932
954
|
function T() {
|
|
933
|
-
x([...b,
|
|
955
|
+
x([...b, Vt(y)]), w([..._, O(i.columns)]);
|
|
934
956
|
}
|
|
935
|
-
function
|
|
957
|
+
function E(e) {
|
|
936
958
|
x(b.filter((t, n) => n !== e)), w(_.filter((t, n) => n !== e));
|
|
937
959
|
}
|
|
938
|
-
function
|
|
939
|
-
w(_.map((r, i) => i === e ?
|
|
960
|
+
function D(e, t, n) {
|
|
961
|
+
w(_.map((r, i) => i === e ? Ht(r, t, n) : r));
|
|
940
962
|
}
|
|
941
963
|
let k = _.map((e, t) => ({
|
|
942
964
|
...e,
|
|
@@ -944,15 +966,16 @@ function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
|
|
|
944
966
|
key: b[t] ?? `row-${t}`
|
|
945
967
|
})), A = i.columns.map((r) => ({
|
|
946
968
|
key: r.fieldKey,
|
|
947
|
-
|
|
969
|
+
minWidth: Ft,
|
|
970
|
+
render: (a) => /* @__PURE__ */ S(zt, {
|
|
948
971
|
column: r,
|
|
949
972
|
dataSourceContext: e,
|
|
950
973
|
error: n[se(i.fieldKey, a.index, r.fieldKey)] ?? null,
|
|
951
974
|
fieldPath: `${i.fieldKey}.${r.fieldKey}`,
|
|
952
975
|
formData: g,
|
|
953
976
|
initialFormData: t,
|
|
954
|
-
initialRowValues:
|
|
955
|
-
onChange: (e) =>
|
|
977
|
+
initialRowValues: Bt(t?.[i.fieldKey], a.index),
|
|
978
|
+
onChange: (e) => D(a.index, r.fieldKey, e),
|
|
956
979
|
onDataSourceStateChange: l,
|
|
957
980
|
optionSnapshots: u,
|
|
958
981
|
path: se(i.fieldKey, a.index, r.fieldKey),
|
|
@@ -965,34 +988,29 @@ function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
|
|
|
965
988
|
})), j = d ? void 0 : {
|
|
966
989
|
render: (e) => [{
|
|
967
990
|
disabled: () => _.length <= v.minRows,
|
|
968
|
-
icon:
|
|
991
|
+
icon: fe,
|
|
969
992
|
iconType: "icon-only",
|
|
970
993
|
name: "刪除此列",
|
|
971
|
-
onClick: () =>
|
|
994
|
+
onClick: () => E(e.index),
|
|
972
995
|
variant: "destructive-ghost"
|
|
973
996
|
}],
|
|
997
|
+
fixed: "end",
|
|
974
998
|
width: 56
|
|
975
999
|
};
|
|
976
1000
|
return /* @__PURE__ */ C("div", {
|
|
977
|
-
style:
|
|
978
|
-
children: [/* @__PURE__ */ S(
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
dataSource: [...k],
|
|
986
|
-
rowHeightPreset: "roomy",
|
|
987
|
-
showHeader: !0,
|
|
988
|
-
size: "sub"
|
|
989
|
-
})
|
|
990
|
-
})
|
|
1001
|
+
style: Nt,
|
|
1002
|
+
children: [/* @__PURE__ */ S(h, {
|
|
1003
|
+
...j ? { actions: j } : {},
|
|
1004
|
+
columns: A,
|
|
1005
|
+
dataSource: [...k],
|
|
1006
|
+
rowHeightPreset: "roomy",
|
|
1007
|
+
showHeader: !0,
|
|
1008
|
+
size: "sub"
|
|
991
1009
|
}), d ? null : /* @__PURE__ */ S("div", {
|
|
992
|
-
style:
|
|
1010
|
+
style: Pt,
|
|
993
1011
|
children: /* @__PURE__ */ S(c, {
|
|
994
1012
|
disabled: _.length >= v.maxRows,
|
|
995
|
-
icon:
|
|
1013
|
+
icon: V,
|
|
996
1014
|
iconType: "leading",
|
|
997
1015
|
onClick: T,
|
|
998
1016
|
size: "sub",
|
|
@@ -1003,14 +1021,14 @@ function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
|
|
|
1003
1021
|
})]
|
|
1004
1022
|
});
|
|
1005
1023
|
}
|
|
1006
|
-
function
|
|
1007
|
-
let _ =
|
|
1024
|
+
function zt({ 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 }) {
|
|
1025
|
+
let _ = Ut(m, e.fieldKey), y = W({
|
|
1008
1026
|
context: t,
|
|
1009
1027
|
field: e,
|
|
1010
1028
|
fieldPath: i,
|
|
1011
1029
|
formData: a,
|
|
1012
1030
|
initialFormData: o,
|
|
1013
|
-
initialValue: s ?
|
|
1031
|
+
initialValue: s ? Ut(s, e.fieldKey) : void 0,
|
|
1014
1032
|
optionSnapshots: d,
|
|
1015
1033
|
readonly: p,
|
|
1016
1034
|
row: {
|
|
@@ -1027,7 +1045,7 @@ function Rt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
1027
1045
|
status: y.status
|
|
1028
1046
|
});
|
|
1029
1047
|
return r(() => {
|
|
1030
|
-
if (
|
|
1048
|
+
if (pe(e)) return u?.(f, {
|
|
1031
1049
|
hasValue: y.hasValue,
|
|
1032
1050
|
invalidValues: y.invalidValues,
|
|
1033
1051
|
selectionExpired: y.selectionExpired === !0,
|
|
@@ -1045,16 +1063,16 @@ function Rt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
1045
1063
|
x
|
|
1046
1064
|
]), /* @__PURE__ */ C("div", {
|
|
1047
1065
|
"data-form-field-key": f,
|
|
1048
|
-
style:
|
|
1066
|
+
style: Lt,
|
|
1049
1067
|
children: [
|
|
1050
|
-
|
|
1068
|
+
Wt(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
|
|
1051
1069
|
n ? /* @__PURE__ */ S(v, {
|
|
1052
1070
|
color: "text-error",
|
|
1053
1071
|
variant: "caption",
|
|
1054
1072
|
children: n
|
|
1055
1073
|
}) : null,
|
|
1056
1074
|
b ? /* @__PURE__ */ C("div", {
|
|
1057
|
-
style:
|
|
1075
|
+
style: Mt,
|
|
1058
1076
|
children: [/* @__PURE__ */ S(v, {
|
|
1059
1077
|
color: y.status === "INVALID" || y.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
1060
1078
|
variant: "caption",
|
|
@@ -1070,38 +1088,38 @@ function Rt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
1070
1088
|
]
|
|
1071
1089
|
});
|
|
1072
1090
|
}
|
|
1073
|
-
function
|
|
1074
|
-
return
|
|
1091
|
+
function Bt(e, t) {
|
|
1092
|
+
return L(e)[t];
|
|
1075
1093
|
}
|
|
1076
|
-
function
|
|
1094
|
+
function Vt(e) {
|
|
1077
1095
|
return e.current += 1, `table-row-${e.current}`;
|
|
1078
1096
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return n === void 0 || !
|
|
1097
|
+
function Ht(e, t, n) {
|
|
1098
|
+
return n === void 0 || !he(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
|
|
1081
1099
|
...e,
|
|
1082
1100
|
[t]: n
|
|
1083
1101
|
};
|
|
1084
1102
|
}
|
|
1085
|
-
function
|
|
1103
|
+
function Ut(e, t) {
|
|
1086
1104
|
if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
1087
1105
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1106
|
+
function Wt(e, t, n, r, i, a, o, s = "main") {
|
|
1107
|
+
return pe(e) ? Kt(e, t, n, r, a, o, s) : Gt(e, t, n, r, i, s);
|
|
1090
1108
|
}
|
|
1091
|
-
function
|
|
1092
|
-
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ?
|
|
1109
|
+
function Gt(e, t, n, r, i, a = "main") {
|
|
1110
|
+
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? Z(t) : null;
|
|
1093
1111
|
if (o) return /* @__PURE__ */ S(v, {
|
|
1094
1112
|
color: "text-brand",
|
|
1095
1113
|
component: "span",
|
|
1096
1114
|
variant: "body",
|
|
1097
1115
|
children: /* @__PURE__ */ S("a", {
|
|
1098
1116
|
href: o.href,
|
|
1099
|
-
style:
|
|
1117
|
+
style: jt,
|
|
1100
1118
|
...o.external ? {
|
|
1101
|
-
"aria-label": `${o.href}${
|
|
1119
|
+
"aria-label": `${o.href}${kt}`,
|
|
1102
1120
|
rel: "noopener noreferrer",
|
|
1103
1121
|
target: "_blank",
|
|
1104
|
-
title:
|
|
1122
|
+
title: At
|
|
1105
1123
|
} : {},
|
|
1106
1124
|
children: o.href
|
|
1107
1125
|
})
|
|
@@ -1110,10 +1128,10 @@ function Wt(e, t, n, r, i, a = "main") {
|
|
|
1110
1128
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
1111
1129
|
placeholder: e.placeholder ?? "請輸入多行文字",
|
|
1112
1130
|
readOnly: n,
|
|
1113
|
-
ref:
|
|
1131
|
+
ref: wt,
|
|
1114
1132
|
rows: 3,
|
|
1115
|
-
style:
|
|
1116
|
-
value:
|
|
1133
|
+
style: Ct,
|
|
1134
|
+
value: Jt(t)
|
|
1117
1135
|
});
|
|
1118
1136
|
if (e.type === "boolean") return /* @__PURE__ */ S(_, {
|
|
1119
1137
|
checked: t === !0,
|
|
@@ -1122,30 +1140,32 @@ function Wt(e, t, n, r, i, a = "main") {
|
|
|
1122
1140
|
onChange: (t) => r(e.fieldKey, t.target.checked),
|
|
1123
1141
|
size: a
|
|
1124
1142
|
});
|
|
1125
|
-
if (
|
|
1126
|
-
let i = e.options.map(
|
|
1143
|
+
if (me(e) && e.type === "checkbox") {
|
|
1144
|
+
let i = e.options.map(F);
|
|
1127
1145
|
return /* @__PURE__ */ S(m, {
|
|
1146
|
+
menuMaxHeight: 320,
|
|
1128
1147
|
mode: "multiple",
|
|
1129
1148
|
onChange: (t) => r(e.fieldKey, t?.length ? t.map((e) => e.id) : void 0),
|
|
1130
1149
|
options: i,
|
|
1131
1150
|
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
1132
1151
|
readOnly: n,
|
|
1133
1152
|
size: a,
|
|
1134
|
-
value: i.filter((e) =>
|
|
1153
|
+
value: i.filter((e) => K(t).includes(e.id))
|
|
1135
1154
|
});
|
|
1136
1155
|
}
|
|
1137
|
-
if (
|
|
1138
|
-
let i = e.options.map(
|
|
1156
|
+
if (me(e)) {
|
|
1157
|
+
let i = e.options.map(F);
|
|
1139
1158
|
return /* @__PURE__ */ S(m, {
|
|
1159
|
+
menuMaxHeight: 320,
|
|
1140
1160
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
1141
1161
|
options: i,
|
|
1142
1162
|
placeholder: e.placeholder ?? "請選擇",
|
|
1143
1163
|
readOnly: n,
|
|
1144
1164
|
size: a,
|
|
1145
|
-
value:
|
|
1165
|
+
value: z(i, Jt(t))
|
|
1146
1166
|
});
|
|
1147
1167
|
}
|
|
1148
|
-
return e.type === "member" ? /* @__PURE__ */ S(
|
|
1168
|
+
return e.type === "member" ? /* @__PURE__ */ S(ot, {
|
|
1149
1169
|
multiple: e.multiple === !0,
|
|
1150
1170
|
name: e.fieldKey,
|
|
1151
1171
|
onChange: (t) => r(e.fieldKey, t),
|
|
@@ -1153,14 +1173,14 @@ function Wt(e, t, n, r, i, a = "main") {
|
|
|
1153
1173
|
readonly: n,
|
|
1154
1174
|
size: a,
|
|
1155
1175
|
value: t
|
|
1156
|
-
}) : e.type === "org_unit" ? /* @__PURE__ */ S(
|
|
1176
|
+
}) : e.type === "org_unit" ? /* @__PURE__ */ S(yt, {
|
|
1157
1177
|
name: e.fieldKey,
|
|
1158
1178
|
onChange: (t) => r(e.fieldKey, t),
|
|
1159
|
-
placeholder: e.placeholder ??
|
|
1179
|
+
placeholder: e.placeholder ?? Xt(e.type),
|
|
1160
1180
|
readonly: n,
|
|
1161
1181
|
size: a,
|
|
1162
1182
|
value: t
|
|
1163
|
-
}) : e.type === "file_upload" ? /* @__PURE__ */ S(
|
|
1183
|
+
}) : e.type === "file_upload" ? /* @__PURE__ */ S(He, {
|
|
1164
1184
|
attachments: i?.attachments,
|
|
1165
1185
|
field: e,
|
|
1166
1186
|
onChange: (t) => r(e.fieldKey, t),
|
|
@@ -1172,57 +1192,61 @@ function Wt(e, t, n, r, i, a = "main") {
|
|
|
1172
1192
|
}) : e.type === "date" ? /* @__PURE__ */ S(u, {
|
|
1173
1193
|
format: "YYYY-MM-DD",
|
|
1174
1194
|
fullWidth: !0,
|
|
1175
|
-
onChange: (t) => r(e.fieldKey,
|
|
1176
|
-
placeholder: e.placeholder ??
|
|
1195
|
+
onChange: (t) => r(e.fieldKey, k(t)),
|
|
1196
|
+
placeholder: e.placeholder ?? Xt(e.type),
|
|
1177
1197
|
readOnly: n,
|
|
1178
|
-
value:
|
|
1198
|
+
value: P(t)
|
|
1179
1199
|
}) : e.type === "datetime" ? /* @__PURE__ */ S(d, {
|
|
1180
1200
|
formatDate: "YYYY-MM-DD",
|
|
1181
1201
|
formatTime: "HH:mm",
|
|
1182
1202
|
fullWidth: !0,
|
|
1183
1203
|
hideSecond: !0,
|
|
1184
|
-
onChange: (t) => r(e.fieldKey,
|
|
1204
|
+
onChange: (t) => r(e.fieldKey, A(t)),
|
|
1185
1205
|
placeholderLeft: "選擇日期",
|
|
1186
1206
|
placeholderRight: "選擇時間",
|
|
1187
1207
|
readOnly: n,
|
|
1188
|
-
value:
|
|
1208
|
+
value: P(t)
|
|
1189
1209
|
}) : e.type === "number" || e.type === "money" ? /* @__PURE__ */ S(f, {
|
|
1190
1210
|
fullWidth: !0,
|
|
1191
1211
|
max: e.maximum,
|
|
1192
1212
|
min: e.minimum,
|
|
1193
1213
|
size: a,
|
|
1194
|
-
onChange: (t) => r(e.fieldKey,
|
|
1214
|
+
onChange: (t) => r(e.fieldKey, D(ee(t.target.value), {
|
|
1195
1215
|
max: e.maximum,
|
|
1196
1216
|
min: e.minimum
|
|
1197
1217
|
})),
|
|
1198
|
-
placeholder: e.placeholder ??
|
|
1218
|
+
placeholder: e.placeholder ?? Xt(e.type),
|
|
1199
1219
|
...n ? { readonly: !0 } : {},
|
|
1200
1220
|
showSpinner: !0,
|
|
1201
|
-
value:
|
|
1221
|
+
value: Yt(t),
|
|
1202
1222
|
variant: "measure"
|
|
1203
1223
|
}) : /* @__PURE__ */ S(f, {
|
|
1204
1224
|
fullWidth: !0,
|
|
1205
1225
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
1206
|
-
placeholder: e.placeholder ??
|
|
1226
|
+
placeholder: e.placeholder ?? Xt(e.type),
|
|
1207
1227
|
...n ? { readonly: !0 } : {},
|
|
1208
1228
|
size: a,
|
|
1209
|
-
value:
|
|
1229
|
+
value: Jt(t),
|
|
1210
1230
|
variant: "base"
|
|
1211
1231
|
});
|
|
1212
1232
|
}
|
|
1213
|
-
function
|
|
1214
|
-
let c = a.options.map(
|
|
1215
|
-
return e.type === "autocomplete" ?
|
|
1216
|
-
asyncData:
|
|
1233
|
+
function Kt(e, t, n, r, i, a, o = "main") {
|
|
1234
|
+
let c = a.options.map(F), u = ue(t, a.options).map(F), d = a.status === "LOADING", f = d && !a.loadingNextPage, h = a.status === "WAITING_FOR_DEPENDENCIES", g = !!i && !n, _ = n || h, v = n;
|
|
1235
|
+
return e.type === "autocomplete" ? ge(e) === "multiple" ? /* @__PURE__ */ S(s, {
|
|
1236
|
+
asyncData: g,
|
|
1217
1237
|
clearSearchText: !0,
|
|
1218
|
-
disabled:
|
|
1219
|
-
disabledOptionsFilter:
|
|
1238
|
+
disabled: v,
|
|
1239
|
+
disabledOptionsFilter: g,
|
|
1220
1240
|
globalPortal: !0,
|
|
1221
|
-
loading:
|
|
1241
|
+
loading: f,
|
|
1242
|
+
menuMaxHeight: 320,
|
|
1222
1243
|
mode: "multiple",
|
|
1223
1244
|
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
1224
|
-
onReachBottom: a.
|
|
1225
|
-
onSearch:
|
|
1245
|
+
onReachBottom: a.onReachBottom,
|
|
1246
|
+
onSearch: g ? a.onSearch : void 0,
|
|
1247
|
+
onVisibilityChange: (e) => {
|
|
1248
|
+
e && g && a.onOpen();
|
|
1249
|
+
},
|
|
1226
1250
|
options: c,
|
|
1227
1251
|
placeholder: e.placeholder ?? "請輸入或選擇",
|
|
1228
1252
|
readOnly: n,
|
|
@@ -1230,16 +1254,20 @@ function Gt(e, t, n, r, i, a, o = "main") {
|
|
|
1230
1254
|
size: o,
|
|
1231
1255
|
value: u
|
|
1232
1256
|
}) : /* @__PURE__ */ S(s, {
|
|
1233
|
-
asyncData:
|
|
1257
|
+
asyncData: g,
|
|
1234
1258
|
clearSearchText: !0,
|
|
1235
|
-
disabled:
|
|
1236
|
-
disabledOptionsFilter:
|
|
1259
|
+
disabled: v,
|
|
1260
|
+
disabledOptionsFilter: g,
|
|
1237
1261
|
globalPortal: !0,
|
|
1238
|
-
loading:
|
|
1262
|
+
loading: f,
|
|
1263
|
+
menuMaxHeight: 320,
|
|
1239
1264
|
mode: "single",
|
|
1240
1265
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
1241
|
-
onReachBottom: a.
|
|
1242
|
-
onSearch:
|
|
1266
|
+
onReachBottom: a.onReachBottom,
|
|
1267
|
+
onSearch: g ? a.onSearch : void 0,
|
|
1268
|
+
onVisibilityChange: (e) => {
|
|
1269
|
+
e && g && a.onOpen();
|
|
1270
|
+
},
|
|
1243
1271
|
options: c,
|
|
1244
1272
|
placeholder: e.placeholder ?? "請輸入或選擇",
|
|
1245
1273
|
readOnly: n,
|
|
@@ -1247,36 +1275,38 @@ function Gt(e, t, n, r, i, a, o = "main") {
|
|
|
1247
1275
|
size: o,
|
|
1248
1276
|
value: u[0] ?? null
|
|
1249
1277
|
}) : e.type === "radio" ? /* @__PURE__ */ S(p, {
|
|
1250
|
-
disabled:
|
|
1278
|
+
disabled: _,
|
|
1251
1279
|
name: e.fieldKey,
|
|
1252
1280
|
onChange: (t) => r(e.fieldKey, t.target.value || void 0),
|
|
1253
1281
|
options: c,
|
|
1254
|
-
value:
|
|
1282
|
+
value: Jt(t)
|
|
1255
1283
|
}) : e.type === "checkbox" ? /* @__PURE__ */ S(l, {
|
|
1256
|
-
disabled:
|
|
1284
|
+
disabled: _,
|
|
1257
1285
|
name: e.fieldKey,
|
|
1258
1286
|
onChange: (t) => r(e.fieldKey, t.target.values.length ? t.target.values : void 0),
|
|
1259
1287
|
options: c.map((e) => ({
|
|
1260
1288
|
label: e.name,
|
|
1261
1289
|
value: e.id
|
|
1262
1290
|
})),
|
|
1263
|
-
value: [...
|
|
1264
|
-
}) :
|
|
1265
|
-
disabled:
|
|
1291
|
+
value: [...K(t)]
|
|
1292
|
+
}) : ge(e) === "multiple" ? /* @__PURE__ */ S(m, {
|
|
1293
|
+
disabled: _,
|
|
1266
1294
|
loading: d,
|
|
1295
|
+
menuMaxHeight: 320,
|
|
1267
1296
|
mode: "multiple",
|
|
1268
1297
|
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
1269
|
-
onReachBottom: a.
|
|
1298
|
+
onReachBottom: a.onReachBottom,
|
|
1270
1299
|
options: c,
|
|
1271
1300
|
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
1272
1301
|
readOnly: n,
|
|
1273
1302
|
size: o,
|
|
1274
1303
|
value: u
|
|
1275
1304
|
}) : /* @__PURE__ */ S(m, {
|
|
1276
|
-
disabled:
|
|
1305
|
+
disabled: _,
|
|
1277
1306
|
loading: d,
|
|
1307
|
+
menuMaxHeight: 320,
|
|
1278
1308
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
1279
|
-
onReachBottom: a.
|
|
1309
|
+
onReachBottom: a.onReachBottom,
|
|
1280
1310
|
options: c,
|
|
1281
1311
|
placeholder: e.placeholder ?? "請選擇",
|
|
1282
1312
|
readOnly: n,
|
|
@@ -1284,20 +1314,20 @@ function Gt(e, t, n, r, i, a, o = "main") {
|
|
|
1284
1314
|
value: u[0] ?? null
|
|
1285
1315
|
});
|
|
1286
1316
|
}
|
|
1287
|
-
function
|
|
1317
|
+
function qt(e, t) {
|
|
1288
1318
|
return {
|
|
1289
1319
|
FULL: 12,
|
|
1290
1320
|
HALF: 6,
|
|
1291
1321
|
THIRD: 4
|
|
1292
1322
|
}[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
|
|
1293
1323
|
}
|
|
1294
|
-
function
|
|
1324
|
+
function Jt(e) {
|
|
1295
1325
|
return typeof e == "string" ? e : "";
|
|
1296
1326
|
}
|
|
1297
|
-
function
|
|
1327
|
+
function Yt(e) {
|
|
1298
1328
|
return typeof e == "number" ? String(e) : "";
|
|
1299
1329
|
}
|
|
1300
|
-
function
|
|
1330
|
+
function Xt(e) {
|
|
1301
1331
|
return {
|
|
1302
1332
|
boolean: "",
|
|
1303
1333
|
autocomplete: "請輸入或選擇",
|
|
@@ -1316,6 +1346,6 @@ function Yt(e) {
|
|
|
1316
1346
|
textarea: "請輸入多行文字"
|
|
1317
1347
|
}[e];
|
|
1318
1348
|
}
|
|
1319
|
-
export {
|
|
1349
|
+
export { q as a, je as c, Xe as i, Me as l, lt as n, Be as o, Ze as r, G as s, Tt as t, W as u };
|
|
1320
1350
|
|
|
1321
|
-
//# sourceMappingURL=FormRendererView-
|
|
1351
|
+
//# sourceMappingURL=FormRendererView-CAyPXhPq.js.map
|