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