@rytass/bpm-core-react 0.21.4 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/dist/chunks/{FormBuilderView-DbfbLZCI.js → FormBuilderView-D_bN9gzT.js} +675 -614
- package/dist/chunks/FormBuilderView-D_bN9gzT.js.map +1 -0
- package/dist/chunks/FormBuilderView-bm8P55hp.cjs +4 -0
- package/dist/chunks/FormBuilderView-bm8P55hp.cjs.map +1 -0
- package/dist/chunks/FormRendererView-BlQgJOkI.cjs +6 -0
- package/dist/chunks/FormRendererView-BlQgJOkI.cjs.map +1 -0
- package/dist/chunks/{FormRendererView-CAyPXhPq.js → FormRendererView-CemHvfAT.js} +298 -290
- package/dist/chunks/FormRendererView-CemHvfAT.js.map +1 -0
- package/dist/chunks/compose-CdKVQfjB.cjs +2 -0
- package/dist/chunks/compose-CdKVQfjB.cjs.map +1 -0
- package/dist/chunks/{compose-U1zs3Yof.js → compose-N9657E5u.js} +161 -147
- package/dist/chunks/compose-N9657E5u.js.map +1 -0
- package/dist/chunks/{designer-DPG7R_WP.js → designer-CKwG_vM5.js} +1913 -1715
- package/dist/chunks/designer-CKwG_vM5.js.map +1 -0
- package/dist/chunks/designer-JPs7EijM.cjs +69 -0
- package/dist/chunks/designer-JPs7EijM.cjs.map +1 -0
- package/dist/chunks/detail-Dqu0K9QM.cjs +5 -0
- package/dist/chunks/detail-Dqu0K9QM.cjs.map +1 -0
- package/dist/chunks/{detail-CHZDNNM6.js → detail-fW0vJudE.js} +902 -895
- package/dist/chunks/detail-fW0vJudE.js.map +1 -0
- package/dist/chunks/instance-error-message-BKt07-Bo.js +270 -0
- package/dist/chunks/instance-error-message-BKt07-Bo.js.map +1 -0
- package/dist/chunks/instance-error-message-BL_X7Af8.cjs +2 -0
- package/dist/chunks/instance-error-message-BL_X7Af8.cjs.map +1 -0
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/renderer/FormRendererView.d.cts +26 -1
- package/dist/views/forms/renderer/FormRendererView.d.ts +26 -1
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.js +1 -1
- package/dist/views/inbox/index.cjs +1 -1
- package/dist/views/inbox/index.cjs.map +1 -1
- package/dist/views/inbox/index.js +185 -94
- package/dist/views/inbox/index.js.map +1 -1
- package/dist/views/instances/approver-filled-form.d.cts +56 -20
- package/dist/views/instances/approver-filled-form.d.ts +56 -20
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +7 -0
- package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +7 -0
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +1 -1
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +1 -1
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.js +2 -2
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/compose/steps/ComposeReviewStep.d.cts +3 -1
- package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +3 -1
- package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.cts +4 -1
- package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +4 -1
- package/dist/views/templates/compose/use-template-compose-wizard.d.cts +3 -1
- package/dist/views/templates/compose/use-template-compose-wizard.d.ts +3 -1
- package/dist/views/templates/designer/TemplateDesignerView.d.cts +10 -1
- package/dist/views/templates/designer/TemplateDesignerView.d.ts +10 -1
- package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +3 -1
- package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +3 -1
- package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +3 -2
- package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +3 -2
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/dist/views/templates/designer/launch-mode.d.cts +19 -0
- package/dist/views/templates/designer/launch-mode.d.ts +19 -0
- package/dist/views/templates/designer/publish-default-value-check.d.cts +36 -0
- package/dist/views/templates/designer/publish-default-value-check.d.ts +36 -0
- package/package.json +3 -3
- package/dist/chunks/FormBuilderView-Bok4Y59D.cjs +0 -4
- package/dist/chunks/FormBuilderView-Bok4Y59D.cjs.map +0 -1
- package/dist/chunks/FormBuilderView-DbfbLZCI.js.map +0 -1
- package/dist/chunks/FormRendererView-CAyPXhPq.js.map +0 -1
- package/dist/chunks/FormRendererView-iLlHFIUR.cjs +0 -6
- package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +0 -1
- package/dist/chunks/compose-DP1N4twA.cjs +0 -2
- package/dist/chunks/compose-DP1N4twA.cjs.map +0 -1
- package/dist/chunks/compose-U1zs3Yof.js.map +0 -1
- package/dist/chunks/designer-CWL-dCQ_.cjs +0 -69
- package/dist/chunks/designer-CWL-dCQ_.cjs.map +0 -1
- package/dist/chunks/designer-DPG7R_WP.js.map +0 -1
- package/dist/chunks/detail-BUfsSal0.cjs +0 -5
- package/dist/chunks/detail-BUfsSal0.cjs.map +0 -1
- package/dist/chunks/detail-CHZDNNM6.js.map +0 -1
- package/dist/chunks/instance-error-message-BEM4O_Kj.js +0 -208
- package/dist/chunks/instance-error-message-BEM4O_Kj.js.map +0 -1
- package/dist/chunks/instance-error-message-BpCLCOjp.cjs +0 -2
- package/dist/chunks/instance-error-message-BpCLCOjp.cjs.map +0 -1
|
@@ -6,12 +6,12 @@ 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 { 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
|
|
10
|
-
import { PlusIcon as
|
|
11
|
-
import { isFormDataSourceFieldDefinition as pe, isFormStaticOptionFieldDefinition as me, isFormTableCellValue as he, isTableFieldDefinition as H, readFormFieldSelectionMode as
|
|
12
|
-
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 P, previewFormFieldOptions as ee, previewResolveFormFieldOptions as te, readDatePickerValue as F, readFieldOptionAsSelectOption as I, readFormDataSourceErrorCode as ne, readFormDataSourceErrorMessage as re, readFormDataSourceSelectedValues as ie, readFormDataSourceValueSignature as L, readFormFieldOptions as ae, readFormTableCellPath as oe, readFormTableRowBounds as se, readFormTableRows as ce, readMissingFormDataSourceDependencies as le, readMissingFormDataSourceOptionValues as ue, readSelectOption as R, readSelectedFormDataSourceOptions as de, readVisibleFormRendererFields as z, resolveFormFieldOptions as fe } from "@rytass/bpm-core-client/form";
|
|
10
|
+
import { PlusIcon as B, TrashIcon as V } from "@mezzanine-ui/icons";
|
|
11
|
+
import { isFormDataSourceFieldDefinition as pe, isFormStaticOptionFieldDefinition as me, isFormTableCellValue as he, isTableFieldDefinition as H, readFormFieldSelectionMode as U, readFormMemberIds as ge } from "@rytass/bpm-core-shared/form";
|
|
12
|
+
import { resolveOrgUnitOptions as _e, searchOrgUnitOptions as ve } from "@rytass/bpm-core-client/organization";
|
|
13
13
|
// src/views/forms/renderer/form-data-source-field.ts
|
|
14
|
-
var
|
|
14
|
+
var ye = {
|
|
15
15
|
canRetry: !1,
|
|
16
16
|
error: null,
|
|
17
17
|
hasValue: !1,
|
|
@@ -24,16 +24,16 @@ var be = {
|
|
|
24
24
|
options: [],
|
|
25
25
|
retry: () => void 0,
|
|
26
26
|
status: "IDLE"
|
|
27
|
-
},
|
|
28
|
-
function
|
|
27
|
+
}, W = [], be = 10, xe = 300, Se = ["FORM_DATA_SOURCE_SEARCH_NOT_SUPPORTED", "FORM_DATA_SOURCE_SEARCH_TOO_SHORT"];
|
|
28
|
+
function Ce(e, t) {
|
|
29
29
|
if (!t.row) return e;
|
|
30
30
|
let n = t.fieldPath?.indexOf(".") ?? -1;
|
|
31
31
|
return t.fieldPath && n > 0 ? t.fieldPath.slice(0, n) : null;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function we(e, t) {
|
|
34
34
|
return t === null ? e : Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function Te(e, t) {
|
|
37
37
|
let n = e.from;
|
|
38
38
|
switch (n.kind) {
|
|
39
39
|
case "FIELD": return {
|
|
@@ -47,32 +47,32 @@ function De(e, t) {
|
|
|
47
47
|
};
|
|
48
48
|
case "EXPRESSION": return {
|
|
49
49
|
expression: n.expression,
|
|
50
|
-
form:
|
|
51
|
-
row: t.rowValues ?
|
|
50
|
+
form: we(t.formData, t.ownFormKey),
|
|
51
|
+
row: t.rowValues ? we(t.rowValues, t.ownRowKey) : null
|
|
52
52
|
};
|
|
53
|
-
default: return
|
|
53
|
+
default: return Ee(n);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Ee(e) {
|
|
57
57
|
return { unsupported: !0 };
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
return JSON.stringify(
|
|
59
|
+
function De(e) {
|
|
60
|
+
return JSON.stringify(G(e)) ?? "null";
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
return Array.isArray(e) ? e.map(
|
|
62
|
+
function G(e) {
|
|
63
|
+
return Array.isArray(e) ? e.map(G) : 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, G(t)])) : e;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Oe(e) {
|
|
66
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({
|
|
67
67
|
dataSource: t.dataSource,
|
|
68
68
|
fieldKey: t.fieldKey,
|
|
69
69
|
type: t.type
|
|
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 =
|
|
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 = L(x), C = i(() => ie(x), [S]), w = C.length > 0, T = t ? JSON.stringify(t.dataSource.bindings.map((n) => Te(n, {
|
|
71
71
|
formData: e.formData,
|
|
72
|
-
ownFormKey:
|
|
72
|
+
ownFormKey: Ce(t.fieldKey, e),
|
|
73
73
|
ownRowKey: e.row ? t.fieldKey : null,
|
|
74
74
|
rowValues: e.row?.values
|
|
75
|
-
}))) : "", D = t ? JSON.stringify(e.initialFormData !== void 0 || e.initialValue !== void 0 ? x ?? null : null) : "", O = t ? `${T}\u0000${D}` : "", k =
|
|
75
|
+
}))) : "", D = t ? JSON.stringify(e.initialFormData !== void 0 || e.initialValue !== void 0 ? x ?? null : null) : "", O = t ? `${T}\u0000${D}` : "", k = ke(T, t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION") ? xe : 0), A = k !== T, j = i(() => {
|
|
76
76
|
if (g === "preview") return { kind: "preview" };
|
|
77
77
|
if (g === "runtime" && !e.readonly) return {
|
|
78
78
|
instanceId: _,
|
|
@@ -84,85 +84,85 @@ function W(e) {
|
|
|
84
84
|
g,
|
|
85
85
|
v,
|
|
86
86
|
e.readonly
|
|
87
|
-
]), M = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) &&
|
|
88
|
-
if (n.from.kind === "FIELD") return
|
|
89
|
-
if (n.from.kind === "ROW_FIELD" && e.row?.initialValues) return
|
|
87
|
+
]), M = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && L(e.initialValue) !== S : !1, P = t ? e.initialFormData !== void 0 && t.dataSource.bindings.some((n) => {
|
|
88
|
+
if (n.from.kind === "FIELD") return L(e.initialFormData?.[n.from.fieldKey]) !== L(e.formData[n.from.fieldKey]);
|
|
89
|
+
if (n.from.kind === "ROW_FIELD" && e.row?.initialValues) return L(e.row.initialValues[n.from.columnKey]) !== L(e.row.values[n.from.columnKey]);
|
|
90
90
|
if (n.from.kind === "EXPRESSION") {
|
|
91
91
|
if (!j) return !1;
|
|
92
92
|
let r = {
|
|
93
|
-
ownFormKey:
|
|
93
|
+
ownFormKey: Ce(t.fieldKey, e),
|
|
94
94
|
ownRowKey: e.row ? t.fieldKey : null
|
|
95
95
|
};
|
|
96
|
-
return
|
|
96
|
+
return De(Te(n, {
|
|
97
97
|
...r,
|
|
98
98
|
formData: E(e.schema.fields, e.initialFormData ?? {}),
|
|
99
99
|
rowValues: e.row?.initialValues ?? e.row?.values
|
|
100
|
-
})) !==
|
|
100
|
+
})) !== De(Te(n, {
|
|
101
101
|
...r,
|
|
102
102
|
formData: E(e.schema.fields, e.formData),
|
|
103
103
|
rowValues: e.row?.values
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
return !1;
|
|
107
|
-
}) : !1,
|
|
107
|
+
}) : !1, F = !!t?.dataSource.bindings.some((e) => e.from.kind === "EXPRESSION"), [I, oe] = o(() => ({
|
|
108
108
|
bindings: k,
|
|
109
109
|
value: S
|
|
110
110
|
}));
|
|
111
|
-
|
|
111
|
+
I.value !== S && oe({
|
|
112
112
|
bindings: k,
|
|
113
113
|
value: S
|
|
114
114
|
});
|
|
115
|
-
let
|
|
115
|
+
let se = !!(F && j && w && I.value === S && I.bindings !== k), ce = !(!t || c || e.initialFormData !== void 0 || e.initialValue !== void 0 || t.defaultValue === void 0 || S !== L(t.defaultValue)), ue = !!((c || w) && (M || P || se || ce)), R = !!(t && j && ue && w), z = Ne({
|
|
116
116
|
hasSnapshot: !!c,
|
|
117
117
|
hasValue: w,
|
|
118
|
-
isStale:
|
|
118
|
+
isStale: ue,
|
|
119
119
|
readonly: e.readonly
|
|
120
|
-
}), B = !!(t && j && t.type !== "autocomplete"), V =
|
|
121
|
-
|
|
122
|
-
let [
|
|
120
|
+
}), B = !!(t && j && t.type !== "autocomplete"), V = Pe(ue, B && t !== null && le(t, e.formData, e.row?.values).length > 0), me = a(z);
|
|
121
|
+
me.current = z;
|
|
122
|
+
let [he, H] = o([]), [U, ge] = o(""), [_e, ve] = o(null), [W, we] = o(null), [Ee, G] = o(() => t ? B ? V : z : "IDLE"), [Oe, K] = o(null), [Ae, je] = o(!1), q = a(0), J = a(0), Y = a(0), ze = a(null), Be = a(null), Ve = a(!1), He = a({
|
|
123
123
|
cursor: null,
|
|
124
124
|
searchText: ""
|
|
125
|
-
}),
|
|
125
|
+
}), X = i(() => Re(e.formData), [f]), Z = i(() => e.row ? Re(e.row.values) : void 0, [y]), Ue = i(() => N(d, he), [he, d]), We = W && W.signature === O && W.valueSignature === S ? W : null, Ge = R && !We, Ke = !!(se && We && We.unresolvedValues.length > 0), qe = Me({
|
|
126
126
|
options: Ue,
|
|
127
127
|
resolution: We,
|
|
128
128
|
resolvePending: Ge,
|
|
129
129
|
value: x
|
|
130
|
-
}),
|
|
130
|
+
}), Q = n((n, r) => {
|
|
131
131
|
if (!t || !j) return;
|
|
132
|
-
let i =
|
|
133
|
-
|
|
132
|
+
let i = J.current + 1;
|
|
133
|
+
J.current = i, Ve.current = !0, He.current = {
|
|
134
134
|
cursor: r,
|
|
135
135
|
searchText: n
|
|
136
|
-
},
|
|
136
|
+
}, ze.current?.abort();
|
|
137
137
|
let a = new AbortController();
|
|
138
|
-
|
|
138
|
+
ze.current = a, G(V), je(r !== null), K(null), (j.kind === "preview" ? ee({
|
|
139
139
|
cursor: r,
|
|
140
140
|
fieldKey: s,
|
|
141
|
-
formData:
|
|
142
|
-
rowValues:
|
|
141
|
+
formData: X,
|
|
142
|
+
rowValues: Z,
|
|
143
143
|
schema: e.schema,
|
|
144
144
|
searchText: n,
|
|
145
145
|
signal: a.signal,
|
|
146
146
|
uiSchema: e.uiSchema
|
|
147
|
-
}) :
|
|
147
|
+
}) : ae({
|
|
148
148
|
cursor: r,
|
|
149
149
|
fieldKey: s,
|
|
150
|
-
formData:
|
|
150
|
+
formData: X,
|
|
151
151
|
instanceId: j.instanceId ?? null,
|
|
152
|
-
rowValues:
|
|
152
|
+
rowValues: Z,
|
|
153
153
|
searchText: n,
|
|
154
154
|
signal: a.signal,
|
|
155
155
|
templateId: j.templateId ?? null
|
|
156
156
|
})).then((e) => {
|
|
157
|
-
|
|
158
|
-
let n =
|
|
157
|
+
Le(a, J, i) || (je(!1), H((t) => {
|
|
158
|
+
let n = de(x, t);
|
|
159
159
|
return N(n, r ? t : [], e.options);
|
|
160
|
-
}), ve(e.nextCursor),
|
|
160
|
+
}), ve(e.nextCursor), K(null), q.current = r ? q.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && q.current < be && Je.current(n, e.nextCursor), G(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
|
|
161
161
|
}).catch((e) => {
|
|
162
|
-
if (
|
|
163
|
-
r === null && (
|
|
164
|
-
let t =
|
|
165
|
-
|
|
162
|
+
if (Le(a, J, i)) return;
|
|
163
|
+
r === null && (Ve.current = !1), je(!1);
|
|
164
|
+
let t = re(e) ?? "選項來源暫時無法使用。", n = ne(e);
|
|
165
|
+
K(t), G(Fe(!!(n && Se.includes(n)), w));
|
|
166
166
|
});
|
|
167
167
|
}, [
|
|
168
168
|
S,
|
|
@@ -171,41 +171,41 @@ function W(e) {
|
|
|
171
171
|
w,
|
|
172
172
|
V,
|
|
173
173
|
s,
|
|
174
|
-
Y,
|
|
175
174
|
X,
|
|
175
|
+
Z,
|
|
176
176
|
m,
|
|
177
177
|
h
|
|
178
|
-
]),
|
|
179
|
-
|
|
180
|
-
let
|
|
178
|
+
]), Je = a(Q);
|
|
179
|
+
Je.current = Q;
|
|
180
|
+
let Ye = n(() => {
|
|
181
181
|
if (!t || !j || C.length === 0) return;
|
|
182
|
-
let n = O, r = S, i =
|
|
183
|
-
|
|
182
|
+
let n = O, r = S, i = Y.current + 1;
|
|
183
|
+
Y.current = i, Be.current?.abort();
|
|
184
184
|
let a = new AbortController();
|
|
185
|
-
|
|
185
|
+
Be.current = a, K(null), (j.kind === "preview" ? te({
|
|
186
186
|
fieldKey: s,
|
|
187
|
-
formData:
|
|
188
|
-
rowValues:
|
|
187
|
+
formData: X,
|
|
188
|
+
rowValues: Z,
|
|
189
189
|
schema: e.schema,
|
|
190
190
|
signal: a.signal,
|
|
191
191
|
uiSchema: e.uiSchema,
|
|
192
192
|
values: C
|
|
193
|
-
}) :
|
|
193
|
+
}) : fe({
|
|
194
194
|
fieldKey: s,
|
|
195
|
-
formData:
|
|
195
|
+
formData: X,
|
|
196
196
|
instanceId: j.instanceId ?? null,
|
|
197
|
-
rowValues:
|
|
197
|
+
rowValues: Z,
|
|
198
198
|
signal: a.signal,
|
|
199
199
|
templateId: j.templateId ?? null,
|
|
200
200
|
values: C
|
|
201
201
|
})).then((e) => {
|
|
202
|
-
|
|
202
|
+
Le(a, Y, i) || (e.waitingForFieldKeys.length ? G("WAITING_FOR_DEPENDENCIES") : (H((t) => N(t, e.options)), we({
|
|
203
203
|
signature: n,
|
|
204
204
|
unresolvedValues: e.unresolvedValues,
|
|
205
205
|
valueSignature: r
|
|
206
|
-
}),
|
|
206
|
+
}), G("VALID")));
|
|
207
207
|
}).catch((e) => {
|
|
208
|
-
|
|
208
|
+
Le(a, Y, i) || (G("UNAVAILABLE"), K(re(e) ?? "選項來源暫時無法使用。"));
|
|
209
209
|
});
|
|
210
210
|
}, [
|
|
211
211
|
S,
|
|
@@ -213,14 +213,14 @@ function W(e) {
|
|
|
213
213
|
l,
|
|
214
214
|
j,
|
|
215
215
|
s,
|
|
216
|
-
Y,
|
|
217
216
|
X,
|
|
217
|
+
Z,
|
|
218
218
|
m,
|
|
219
219
|
C,
|
|
220
220
|
h
|
|
221
|
-
]),
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
]), Xe = a(Ye);
|
|
222
|
+
Xe.current = Ye, r(() => {
|
|
223
|
+
J.current += 1, Ve.current = !1, ze.current?.abort(), je(!1), H((e) => de(x, e)), ve((e) => e === null ? e : null), ge((e) => e && ""), K((e) => e && null), t ? B ? Je.current("", null) : G(me.current) : G("IDLE");
|
|
224
224
|
}, [
|
|
225
225
|
B,
|
|
226
226
|
l,
|
|
@@ -232,13 +232,13 @@ function W(e) {
|
|
|
232
232
|
e.readonly,
|
|
233
233
|
u
|
|
234
234
|
]), r(() => {
|
|
235
|
-
t && !B &&
|
|
235
|
+
t && !B && G(z);
|
|
236
236
|
}, [
|
|
237
237
|
B,
|
|
238
238
|
l,
|
|
239
239
|
z
|
|
240
240
|
]), r(() => {
|
|
241
|
-
R && !A &&
|
|
241
|
+
R && !A && Xe.current();
|
|
242
242
|
}, [
|
|
243
243
|
j,
|
|
244
244
|
R,
|
|
@@ -246,57 +246,57 @@ function W(e) {
|
|
|
246
246
|
k,
|
|
247
247
|
D
|
|
248
248
|
]), r(() => () => {
|
|
249
|
-
|
|
249
|
+
ze.current?.abort(), Be.current?.abort();
|
|
250
250
|
}, []);
|
|
251
|
-
let
|
|
252
|
-
ge(e),
|
|
253
|
-
}, [
|
|
254
|
-
B || !j || e.readonly ||
|
|
251
|
+
let Ze = n((e) => {
|
|
252
|
+
ge(e), H((e) => de(x, e)), ve(null), Q(e, null);
|
|
253
|
+
}, [Q]), Qe = n(() => {
|
|
254
|
+
B || !j || e.readonly || Ve.current && U === "" || Ze("");
|
|
255
255
|
}, [
|
|
256
256
|
B,
|
|
257
257
|
j,
|
|
258
258
|
e.readonly,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
]),
|
|
259
|
+
Ze,
|
|
260
|
+
U
|
|
261
|
+
]), $e = a({
|
|
262
262
|
cursor: _e,
|
|
263
|
-
searchText:
|
|
263
|
+
searchText: U
|
|
264
264
|
});
|
|
265
|
-
|
|
265
|
+
$e.current = {
|
|
266
266
|
cursor: _e,
|
|
267
|
-
searchText:
|
|
267
|
+
searchText: U
|
|
268
268
|
};
|
|
269
|
-
let
|
|
270
|
-
let { cursor: e, searchText: t } =
|
|
271
|
-
e &&
|
|
272
|
-
}, []),
|
|
273
|
-
j && (
|
|
269
|
+
let et = n(() => {
|
|
270
|
+
let { cursor: e, searchText: t } = $e.current;
|
|
271
|
+
e && Je.current(t, e);
|
|
272
|
+
}, []), tt = n(() => {
|
|
273
|
+
j && (Q(He.current.searchText, He.current.cursor), R && Xe.current());
|
|
274
274
|
}, [
|
|
275
275
|
j,
|
|
276
|
-
|
|
276
|
+
Q,
|
|
277
277
|
R
|
|
278
278
|
]);
|
|
279
279
|
return t ? {
|
|
280
280
|
canRetry: !!j,
|
|
281
|
-
error:
|
|
281
|
+
error: Oe,
|
|
282
282
|
hasValue: w,
|
|
283
283
|
hasNextPage: !!_e,
|
|
284
|
-
loadingNextPage:
|
|
284
|
+
loadingNextPage: Ae,
|
|
285
285
|
invalidValues: qe,
|
|
286
|
-
onOpen:
|
|
287
|
-
onReachBottom:
|
|
288
|
-
onSearch:
|
|
286
|
+
onOpen: Qe,
|
|
287
|
+
onReachBottom: et,
|
|
288
|
+
onSearch: Ze,
|
|
289
289
|
options: Ue,
|
|
290
|
-
retry:
|
|
290
|
+
retry: tt,
|
|
291
291
|
selectionExpired: Ke,
|
|
292
|
-
status: A && j && (B || w) ? B ? V : "STALE" :
|
|
292
|
+
status: A && j && (B || w) ? B ? V : "STALE" : Ie({
|
|
293
293
|
invalidValues: qe,
|
|
294
294
|
resolvePending: Ge,
|
|
295
295
|
status: Ee
|
|
296
296
|
})
|
|
297
|
-
} :
|
|
297
|
+
} : ye;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function ke(e, t) {
|
|
300
300
|
let [n, i] = o(e);
|
|
301
301
|
return r(() => {
|
|
302
302
|
if (t <= 0) return;
|
|
@@ -308,70 +308,70 @@ function Ae(e, t) {
|
|
|
308
308
|
};
|
|
309
309
|
}, [t, e]), t > 0 ? n : e;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function K(e) {
|
|
312
312
|
switch (e.status) {
|
|
313
313
|
case "WAITING_FOR_DEPENDENCIES": return "請先填寫相依欄位。";
|
|
314
314
|
case "STALE": return "選項需要重新載入或驗證。";
|
|
315
|
-
case "INVALID": return e.selectionExpired ?
|
|
315
|
+
case "INVALID": return e.selectionExpired ? re("FORM_DATA_SOURCE_VALUE_NOT_RESOLVED") : e.invalidValues.length ? `無法辨識選項:${e.invalidValues.join("、")}` : "目前選項已失效,請重新選擇。";
|
|
316
316
|
case "UNAVAILABLE": return e.error ?? "選項來源暫時無法使用。";
|
|
317
317
|
case "VALID": return e.error ?? (e.options.length ? null : "目前沒有可用選項。");
|
|
318
318
|
default: return e.error;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Ae(e) {
|
|
322
322
|
return e.hasValue && e.status !== "VALID";
|
|
323
323
|
}
|
|
324
|
+
function je(e) {
|
|
325
|
+
let t = e.filter(Ae);
|
|
326
|
+
return t.length === 0 ? null : t.some((e) => e.status === "INVALID" && e.selectionExpired === !0) ? re("FORM_DATA_SOURCE_VALUE_NOT_RESOLVED") : t.every((e) => e.status === "LOADING" || e.status === "STALE") ? "選項驗證中,請稍候再送出。" : "請先完成動態選項驗證。";
|
|
327
|
+
}
|
|
324
328
|
function Me(e) {
|
|
325
|
-
|
|
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") ? "選項驗證中,請稍候再送出。" : "請先完成動態選項驗證。";
|
|
329
|
+
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? W : ue(e.value, e.options);
|
|
327
330
|
}
|
|
328
331
|
function Ne(e) {
|
|
329
|
-
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? xe : R(e.value, e.options);
|
|
330
|
-
}
|
|
331
|
-
function Pe(e) {
|
|
332
332
|
return e.isStale ? "STALE" : e.hasSnapshot ? "VALID" : e.readonly && e.hasValue ? "UNAVAILABLE" : "IDLE";
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function Pe(e, t) {
|
|
335
335
|
return t ? "WAITING_FOR_DEPENDENCIES" : e ? "STALE" : "LOADING";
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function Fe(e, t) {
|
|
338
338
|
return e ? t ? "VALID" : "IDLE" : "UNAVAILABLE";
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function Ie(e) {
|
|
341
341
|
return e.status === "LOADING" || e.status === "UNAVAILABLE" || e.status === "WAITING_FOR_DEPENDENCIES" ? e.status : e.invalidValues.length ? "INVALID" : e.resolvePending ? "STALE" : e.status;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Le(e, t, n) {
|
|
344
344
|
return e.signal.aborted || t.current !== n;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Re(e) {
|
|
347
347
|
return Object.entries(e).reduce((e, [t, n]) => n === void 0 ? e : {
|
|
348
348
|
...e,
|
|
349
349
|
[t]: n
|
|
350
350
|
}, {});
|
|
351
351
|
}
|
|
352
352
|
// src/views/forms/renderer/form-value-readers.ts
|
|
353
|
-
function
|
|
353
|
+
function q(e) {
|
|
354
354
|
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
355
355
|
}
|
|
356
356
|
// src/views/forms/renderer/file-upload-field.tsx
|
|
357
|
-
function
|
|
357
|
+
function J(e) {
|
|
358
358
|
return e.some((e) => e.pendingCount > 0) ? "附件仍在上傳中,請稍候再送出。" : e.some((e) => e.failedCount > 0) ? "有附件上傳失敗,請重試或移除後再送出。" : null;
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Y() {
|
|
361
361
|
let [e, t] = o({}), r = n((e, n) => t((t) => ({
|
|
362
362
|
...t,
|
|
363
363
|
[e]: n
|
|
364
364
|
})), []);
|
|
365
365
|
return {
|
|
366
|
-
blockMessage:
|
|
366
|
+
blockMessage: J(Object.values(e)),
|
|
367
367
|
onFileUploadStateChange: r
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
var
|
|
371
|
-
function
|
|
372
|
-
let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b =
|
|
370
|
+
var ze = "無法讀取檔名的附件", Be = "此處無法上傳附件";
|
|
371
|
+
function Ve({ 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 = q(f), x = b.join("\n"), C = i(() => new Map((e ?? []).map((e) => [e.id, e])), [e]), w = i(() => {
|
|
373
373
|
let e = new Map(_.map((e, t) => [e, t]));
|
|
374
|
-
return [...b.map((e) => h.get(e) ??
|
|
374
|
+
return [...b.map((e) => h.get(e) ?? He(e, C.get(e))), ...p].sort((t, n) => (e.get(t.id) ?? -1) - (e.get(n.id) ?? -1));
|
|
375
375
|
}, [
|
|
376
376
|
C,
|
|
377
377
|
_,
|
|
@@ -400,7 +400,7 @@ function He({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
|
|
|
400
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);
|
|
401
401
|
}
|
|
402
402
|
async function N(e) {
|
|
403
|
-
if (!u) throw Error(
|
|
403
|
+
if (!u) throw Error(Be);
|
|
404
404
|
return {
|
|
405
405
|
file: e,
|
|
406
406
|
id: (await u(t, e)).id,
|
|
@@ -408,20 +408,20 @@ function He({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
|
|
|
408
408
|
status: "done"
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
|
-
async function
|
|
411
|
+
async function P(e, t) {
|
|
412
412
|
let n = await N(t).catch((n) => ({
|
|
413
|
-
errorMessage:
|
|
413
|
+
errorMessage: Z(n),
|
|
414
414
|
file: t,
|
|
415
415
|
id: e,
|
|
416
416
|
status: "error"
|
|
417
417
|
}));
|
|
418
418
|
D.current(T.current.map((t) => t.id === e ? n : t));
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
h.has(e) ?
|
|
420
|
+
function ee(e, t) {
|
|
421
|
+
h.has(e) ? Ue(t) : c?.(e);
|
|
422
422
|
}
|
|
423
|
-
let
|
|
424
|
-
label:
|
|
423
|
+
let te = !!u && !d, F = [...!d && !u ? [{
|
|
424
|
+
label: Be,
|
|
425
425
|
type: "info"
|
|
426
426
|
}] : [], ...p.filter((e) => e.status === "error").map((e) => ({
|
|
427
427
|
label: `${e.file?.name ?? "檔案"}:${e.errorMessage ?? "上傳失敗"},未附加。請重試或刪除。`,
|
|
@@ -429,19 +429,19 @@ function He({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
|
|
|
429
429
|
}))];
|
|
430
430
|
return /* @__PURE__ */ S(y, {
|
|
431
431
|
accept: t.acceptedMimeTypes?.join(","),
|
|
432
|
-
disabled: !
|
|
432
|
+
disabled: !te,
|
|
433
433
|
files: w,
|
|
434
|
-
...
|
|
434
|
+
...F.length > 0 ? { hints: F } : {},
|
|
435
435
|
maxFiles: t.maxFiles,
|
|
436
436
|
mode: "button-list",
|
|
437
437
|
...(t.maxFiles ?? 1) > 1 ? { multiple: !0 } : {},
|
|
438
438
|
onChange: O,
|
|
439
|
-
onDownload:
|
|
439
|
+
onDownload: ee,
|
|
440
440
|
onReload: (e, t) => {
|
|
441
|
-
|
|
441
|
+
P(e, t);
|
|
442
442
|
},
|
|
443
443
|
onUpload: async (e) => Promise.all(e.map(async (e) => N(e).catch((t) => ({
|
|
444
|
-
errorMessage:
|
|
444
|
+
errorMessage: Z(t),
|
|
445
445
|
file: e,
|
|
446
446
|
id: `failed-${e.name}-${e.lastModified}-${Math.random()}`,
|
|
447
447
|
status: "error"
|
|
@@ -449,7 +449,7 @@ function He({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, on
|
|
|
449
449
|
size: "sub"
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function He(e, t) {
|
|
453
453
|
return t ? {
|
|
454
454
|
file: X(t),
|
|
455
455
|
id: e,
|
|
@@ -459,34 +459,34 @@ function Y(e, t) {
|
|
|
459
459
|
id: e,
|
|
460
460
|
progress: 100,
|
|
461
461
|
status: "done",
|
|
462
|
-
url:
|
|
462
|
+
url: ze
|
|
463
463
|
};
|
|
464
464
|
}
|
|
465
465
|
function X(e) {
|
|
466
466
|
let t = new File([], e.filename), n = Number(e.sizeBytes);
|
|
467
467
|
return Number.isFinite(n) && n >= 0 && Object.defineProperty(t, "size", { value: n }), t;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Z(e) {
|
|
470
470
|
return e instanceof Error && e.message ? `上傳失敗:${e.message}` : "上傳失敗,請重試。";
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Ue(e) {
|
|
473
473
|
let t = URL.createObjectURL(e), n = document.createElement("a");
|
|
474
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);
|
|
475
475
|
}
|
|
476
476
|
// src/views/forms/renderer/form-field-link.ts
|
|
477
|
-
var
|
|
478
|
-
function
|
|
477
|
+
var We = /\s/u;
|
|
478
|
+
function Ge(e) {
|
|
479
479
|
return [...e].some((e) => {
|
|
480
480
|
let t = e.codePointAt(0) ?? 0;
|
|
481
|
-
return t <= 32 || t >= 127 && t <= 160 ||
|
|
481
|
+
return t <= 32 || t >= 127 && t <= 160 || We.test(e);
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
|
-
var
|
|
485
|
-
function
|
|
486
|
-
return typeof e != "string" || !e || e.includes("\\") ||
|
|
484
|
+
var Ke = /^https?:\/\//iu;
|
|
485
|
+
function qe(e) {
|
|
486
|
+
return typeof e != "string" || !e || e.includes("\\") || Ge(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Je(e) ? {
|
|
487
487
|
external: !1,
|
|
488
488
|
href: e
|
|
489
|
-
} : null :
|
|
489
|
+
} : null : Ke.test(e) && Ye(e) ? {
|
|
490
490
|
external: !0,
|
|
491
491
|
href: e
|
|
492
492
|
} : null;
|
|
@@ -570,10 +570,10 @@ function nt(e, t) {
|
|
|
570
570
|
}
|
|
571
571
|
function rt(e, t) {
|
|
572
572
|
let n = new Set(t.filter((e) => !e.unresolved).map((e) => e.id));
|
|
573
|
-
return
|
|
573
|
+
return ge(e).filter((e) => !n.has(e));
|
|
574
574
|
}
|
|
575
575
|
function it(e, t) {
|
|
576
|
-
return
|
|
576
|
+
return ge(e).map((e) => t.find((t) => t.id === e) ?? tt(e));
|
|
577
577
|
}
|
|
578
578
|
function at(e, t) {
|
|
579
579
|
if (e.length !== 0) return t ? e.map((e) => e.id) : e[0]?.id;
|
|
@@ -693,7 +693,7 @@ function yt({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
693
693
|
let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b = ht(l, u);
|
|
694
694
|
r(() => {
|
|
695
695
|
let e = !1;
|
|
696
|
-
return b === null ? () => void 0 : (
|
|
696
|
+
return b === null ? () => void 0 : (_e([b]).then((e) => {
|
|
697
697
|
let t = e.map(lt);
|
|
698
698
|
return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t, dt(b)];
|
|
699
699
|
}).catch(() => [dt(b)]).then((t) => {
|
|
@@ -706,7 +706,7 @@ function yt({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
|
|
|
706
706
|
let t = y.current + 1;
|
|
707
707
|
y.current = t, h(!0);
|
|
708
708
|
try {
|
|
709
|
-
let n = (await
|
|
709
|
+
let n = (await ve(e)).map(lt);
|
|
710
710
|
y.current === t && (p(n), _(!1), d((e) => gt(e, n)));
|
|
711
711
|
} catch {
|
|
712
712
|
y.current === t && (p([]), _(!0));
|
|
@@ -767,8 +767,8 @@ var bt = {
|
|
|
767
767
|
function wt(e) {
|
|
768
768
|
e && (e.style.width = "100%");
|
|
769
769
|
}
|
|
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,
|
|
771
|
-
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, tableAccess: C, uiSchema: w, value: T }) {
|
|
771
|
+
let D = i(() => ({
|
|
772
772
|
attachments: e,
|
|
773
773
|
onDownloadAttachment: m,
|
|
774
774
|
onStateChange: h,
|
|
@@ -778,34 +778,34 @@ function Tt({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
|
|
|
778
778
|
m,
|
|
779
779
|
h,
|
|
780
780
|
g
|
|
781
|
-
]), [
|
|
782
|
-
|
|
781
|
+
]), [O, k] = o(() => E(b.fields, T ?? {})), A = i(() => E(b.fields, T ?? O), [
|
|
782
|
+
O,
|
|
783
783
|
b.fields,
|
|
784
|
-
|
|
785
|
-
]),
|
|
784
|
+
T
|
|
785
|
+
]), j = a(A), M = i(() => z(b, w, A).filter((e) => Et(l, e.fieldKey)?.visible !== !1), [
|
|
786
786
|
l,
|
|
787
787
|
b,
|
|
788
|
-
|
|
789
|
-
|
|
788
|
+
w,
|
|
789
|
+
A
|
|
790
790
|
]);
|
|
791
791
|
r(() => {
|
|
792
|
-
|
|
793
|
-
}, [
|
|
794
|
-
|
|
795
|
-
}, [b.fields,
|
|
796
|
-
function
|
|
792
|
+
j.current = A;
|
|
793
|
+
}, [A]), r(() => {
|
|
794
|
+
k((e) => E(b.fields, T ?? e));
|
|
795
|
+
}, [b.fields, T]);
|
|
796
|
+
function N(e, t) {
|
|
797
797
|
let n = {
|
|
798
|
-
...
|
|
798
|
+
...j.current,
|
|
799
799
|
[e]: t
|
|
800
800
|
};
|
|
801
|
-
|
|
801
|
+
j.current = n, T || k(n), f?.(n);
|
|
802
802
|
}
|
|
803
|
-
return
|
|
803
|
+
return M.length ? /* @__PURE__ */ S("div", {
|
|
804
804
|
style: {
|
|
805
805
|
...bt,
|
|
806
806
|
...x ? { width: "100%" } : {}
|
|
807
807
|
},
|
|
808
|
-
children:
|
|
808
|
+
children: M.map((e) => /* @__PURE__ */ S(At, {
|
|
809
809
|
dataSourceContext: t,
|
|
810
810
|
dataSourceInitialValues: n,
|
|
811
811
|
field: e,
|
|
@@ -813,20 +813,21 @@ function Tt({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
|
|
|
813
813
|
errors: c,
|
|
814
814
|
fields: b.fields,
|
|
815
815
|
labelMarker: u !== void 0 && Object.prototype.hasOwnProperty.call(u, e.fieldKey) ? u[e.fieldKey] : void 0,
|
|
816
|
-
onChange:
|
|
817
|
-
fileUpload:
|
|
816
|
+
onChange: N,
|
|
817
|
+
fileUpload: D,
|
|
818
818
|
onDataSourceStateChange: p,
|
|
819
819
|
optionSnapshots: _,
|
|
820
|
-
readonly:
|
|
820
|
+
readonly: kt(e, Et(l, e.fieldKey), Ot(C, e.fieldKey), y),
|
|
821
821
|
schema: b,
|
|
822
|
+
tableAccess: Ot(C, e.fieldKey),
|
|
822
823
|
style: {
|
|
823
824
|
...St,
|
|
824
|
-
gridColumn: `span ${x ? 12 :
|
|
825
|
+
gridColumn: `span ${x ? 12 : Yt(e, w)}`,
|
|
825
826
|
...x && !H(e) ? { maxWidth: d } : {}
|
|
826
827
|
},
|
|
827
|
-
value:
|
|
828
|
-
values:
|
|
829
|
-
uiSchema:
|
|
828
|
+
value: A[e.fieldKey],
|
|
829
|
+
values: A,
|
|
830
|
+
uiSchema: w
|
|
830
831
|
}, e.fieldKey))
|
|
831
832
|
}) : /* @__PURE__ */ S("div", {
|
|
832
833
|
style: bt,
|
|
@@ -844,32 +845,38 @@ function Et(e, t) {
|
|
|
844
845
|
function Dt(e, t) {
|
|
845
846
|
return e === void 0 ? t : !e.editable;
|
|
846
847
|
}
|
|
847
|
-
function Ot(
|
|
848
|
-
|
|
848
|
+
function Ot(e, t) {
|
|
849
|
+
return e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
850
|
+
}
|
|
851
|
+
function kt(e, t, n, r) {
|
|
852
|
+
return n !== void 0 && H(e) ? r : Dt(t, r);
|
|
853
|
+
}
|
|
854
|
+
function At({ 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, tableAccess: _, value: y, values: b, uiSchema: x }) {
|
|
855
|
+
let w = M(o, s, b), T = m || j(o, s, b), E = Oe({
|
|
849
856
|
context: t,
|
|
850
857
|
field: o,
|
|
851
|
-
formData:
|
|
858
|
+
formData: b,
|
|
852
859
|
initialFormData: n,
|
|
853
860
|
initialValue: n?.[o.fieldKey],
|
|
854
861
|
optionSnapshots: p,
|
|
855
|
-
readonly:
|
|
862
|
+
readonly: T,
|
|
856
863
|
schema: h,
|
|
857
|
-
uiSchema:
|
|
858
|
-
}),
|
|
859
|
-
hasValue:
|
|
860
|
-
invalidValues:
|
|
861
|
-
selectionExpired:
|
|
862
|
-
status:
|
|
864
|
+
uiSchema: x
|
|
865
|
+
}), D = K(E), O = JSON.stringify({
|
|
866
|
+
hasValue: E.hasValue,
|
|
867
|
+
invalidValues: E.invalidValues,
|
|
868
|
+
selectionExpired: E.selectionExpired === !0,
|
|
869
|
+
status: E.status
|
|
863
870
|
});
|
|
864
871
|
return r(() => {
|
|
865
872
|
pe(o) && f?.(o.fieldKey, {
|
|
866
|
-
hasValue:
|
|
867
|
-
invalidValues:
|
|
868
|
-
selectionExpired:
|
|
869
|
-
status:
|
|
873
|
+
hasValue: E.hasValue,
|
|
874
|
+
invalidValues: E.invalidValues,
|
|
875
|
+
selectionExpired: E.selectionExpired === !0,
|
|
876
|
+
status: E.status
|
|
870
877
|
});
|
|
871
878
|
}, [
|
|
872
|
-
|
|
879
|
+
O,
|
|
873
880
|
o.fieldKey,
|
|
874
881
|
f
|
|
875
882
|
]), /* @__PURE__ */ C("div", {
|
|
@@ -879,10 +886,10 @@ function Ot({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
879
886
|
/* @__PURE__ */ S(e, {
|
|
880
887
|
label: o.label,
|
|
881
888
|
...u ? { labelOptionalMarker: u } : {},
|
|
882
|
-
...H(o) ?
|
|
889
|
+
...H(o) ? Rt : {},
|
|
883
890
|
name: o.fieldKey,
|
|
884
|
-
required:
|
|
885
|
-
children: H(o) ? /* @__PURE__ */ S(
|
|
891
|
+
required: w,
|
|
892
|
+
children: H(o) ? /* @__PURE__ */ S(Bt, {
|
|
886
893
|
dataSourceContext: t,
|
|
887
894
|
dataSourceInitialValues: n,
|
|
888
895
|
errors: a,
|
|
@@ -890,26 +897,27 @@ function Ot({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
890
897
|
onChange: d,
|
|
891
898
|
onDataSourceStateChange: f,
|
|
892
899
|
optionSnapshots: p,
|
|
893
|
-
readonly:
|
|
900
|
+
readonly: T,
|
|
894
901
|
schema: h,
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
902
|
+
tableAccess: _,
|
|
903
|
+
uiSchema: x,
|
|
904
|
+
value: y,
|
|
905
|
+
values: b
|
|
906
|
+
}) : Kt(o, y, T, d, l, t, E)
|
|
899
907
|
}),
|
|
900
908
|
i ? /* @__PURE__ */ S(v, {
|
|
901
909
|
color: "text-error",
|
|
902
910
|
variant: "caption",
|
|
903
911
|
children: i
|
|
904
912
|
}) : null,
|
|
905
|
-
|
|
906
|
-
style:
|
|
913
|
+
D ? /* @__PURE__ */ C("div", {
|
|
914
|
+
style: Pt,
|
|
907
915
|
children: [/* @__PURE__ */ S(v, {
|
|
908
|
-
color:
|
|
916
|
+
color: E.status === "INVALID" || E.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
909
917
|
variant: "caption",
|
|
910
|
-
children:
|
|
911
|
-
}),
|
|
912
|
-
onClick:
|
|
918
|
+
children: D
|
|
919
|
+
}), E.status === "UNAVAILABLE" && E.canRetry ? /* @__PURE__ */ S(c, {
|
|
920
|
+
onClick: E.retry,
|
|
913
921
|
size: "sub",
|
|
914
922
|
type: "button",
|
|
915
923
|
variant: "base-ghost",
|
|
@@ -919,100 +927,100 @@ function Ot({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
|
|
|
919
927
|
]
|
|
920
928
|
});
|
|
921
929
|
}
|
|
922
|
-
var
|
|
930
|
+
var jt = "(另開新分頁)", Mt = "另開新分頁", Nt = {
|
|
923
931
|
color: "inherit",
|
|
924
932
|
textDecoration: "underline",
|
|
925
933
|
wordBreak: "break-all"
|
|
926
|
-
},
|
|
934
|
+
}, Pt = {
|
|
927
935
|
alignItems: "center",
|
|
928
936
|
display: "flex",
|
|
929
937
|
gap: 8
|
|
930
|
-
},
|
|
938
|
+
}, Ft = {
|
|
931
939
|
display: "grid",
|
|
932
940
|
gap: 8,
|
|
933
941
|
minWidth: 0,
|
|
934
942
|
width: "100%"
|
|
935
|
-
},
|
|
943
|
+
}, It = {
|
|
936
944
|
display: "flex",
|
|
937
945
|
justifyContent: "flex-start"
|
|
938
|
-
},
|
|
946
|
+
}, Lt = 160, Rt = {
|
|
939
947
|
density: w.BASE,
|
|
940
948
|
layout: T.STRETCH
|
|
941
|
-
},
|
|
949
|
+
}, zt = {
|
|
942
950
|
display: "grid",
|
|
943
951
|
gap: 4,
|
|
944
952
|
minWidth: 0
|
|
945
953
|
};
|
|
946
|
-
function
|
|
947
|
-
let
|
|
954
|
+
function Bt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, tableAccess: p, uiSchema: m, value: g, values: _ }) {
|
|
955
|
+
let v = ce(g), y = se(i), b = p?.lockRows === !0, x = (e) => p === void 0 || p.editableColumns.includes(e), w = a(0), [T, E] = o(() => v.map(() => Ut(w)));
|
|
948
956
|
r(() => {
|
|
949
|
-
|
|
950
|
-
}, [
|
|
951
|
-
function
|
|
957
|
+
T.length !== v.length && E(v.map(() => Ut(w)));
|
|
958
|
+
}, [T.length, v.length]);
|
|
959
|
+
function D(e) {
|
|
952
960
|
s(i.fieldKey, e);
|
|
953
961
|
}
|
|
954
|
-
function
|
|
955
|
-
|
|
962
|
+
function k() {
|
|
963
|
+
E([...T, Ut(w)]), D([...v, O(i.columns)]);
|
|
956
964
|
}
|
|
957
|
-
function
|
|
958
|
-
|
|
965
|
+
function A(e) {
|
|
966
|
+
E(T.filter((t, n) => n !== e)), D(v.filter((t, n) => n !== e));
|
|
959
967
|
}
|
|
960
|
-
function
|
|
961
|
-
|
|
968
|
+
function j(e, t, n) {
|
|
969
|
+
D(v.map((r, i) => i === e ? Wt(r, t, n) : r));
|
|
962
970
|
}
|
|
963
|
-
let
|
|
971
|
+
let M = v.map((e, t) => ({
|
|
964
972
|
...e,
|
|
965
973
|
index: t,
|
|
966
|
-
key:
|
|
967
|
-
})),
|
|
974
|
+
key: T[t] ?? `row-${t}`
|
|
975
|
+
})), N = i.columns.map((r) => ({
|
|
968
976
|
key: r.fieldKey,
|
|
969
|
-
minWidth:
|
|
970
|
-
render: (a) => /* @__PURE__ */ S(
|
|
977
|
+
minWidth: Lt,
|
|
978
|
+
render: (a) => /* @__PURE__ */ S(Vt, {
|
|
971
979
|
column: r,
|
|
972
980
|
dataSourceContext: e,
|
|
973
|
-
error: n[
|
|
981
|
+
error: n[oe(i.fieldKey, a.index, r.fieldKey)] ?? null,
|
|
974
982
|
fieldPath: `${i.fieldKey}.${r.fieldKey}`,
|
|
975
|
-
formData:
|
|
983
|
+
formData: _,
|
|
976
984
|
initialFormData: t,
|
|
977
|
-
initialRowValues:
|
|
978
|
-
onChange: (e) =>
|
|
985
|
+
initialRowValues: Ht(t?.[i.fieldKey], a.index),
|
|
986
|
+
onChange: (e) => j(a.index, r.fieldKey, e),
|
|
979
987
|
onDataSourceStateChange: l,
|
|
980
988
|
optionSnapshots: u,
|
|
981
|
-
path:
|
|
982
|
-
readonly: d,
|
|
983
|
-
rowValues:
|
|
989
|
+
path: oe(i.fieldKey, a.index, r.fieldKey),
|
|
990
|
+
readonly: d || !x(r.fieldKey),
|
|
991
|
+
rowValues: v[a.index] ?? {},
|
|
984
992
|
schema: f,
|
|
985
|
-
uiSchema:
|
|
986
|
-
}, `${
|
|
993
|
+
uiSchema: m
|
|
994
|
+
}, `${T[a.index] ?? a.index}-${r.fieldKey}`),
|
|
987
995
|
title: r.label || r.fieldKey
|
|
988
|
-
})),
|
|
996
|
+
})), P = d || b ? void 0 : {
|
|
989
997
|
render: (e) => [{
|
|
990
|
-
disabled: () =>
|
|
991
|
-
icon:
|
|
998
|
+
disabled: () => v.length <= y.minRows,
|
|
999
|
+
icon: V,
|
|
992
1000
|
iconType: "icon-only",
|
|
993
1001
|
name: "刪除此列",
|
|
994
|
-
onClick: () =>
|
|
1002
|
+
onClick: () => A(e.index),
|
|
995
1003
|
variant: "destructive-ghost"
|
|
996
1004
|
}],
|
|
997
1005
|
fixed: "end",
|
|
998
1006
|
width: 56
|
|
999
1007
|
};
|
|
1000
1008
|
return /* @__PURE__ */ C("div", {
|
|
1001
|
-
style:
|
|
1009
|
+
style: Ft,
|
|
1002
1010
|
children: [/* @__PURE__ */ S(h, {
|
|
1003
|
-
...
|
|
1004
|
-
columns:
|
|
1005
|
-
dataSource: [...
|
|
1011
|
+
...P ? { actions: P } : {},
|
|
1012
|
+
columns: N,
|
|
1013
|
+
dataSource: [...M],
|
|
1006
1014
|
rowHeightPreset: "roomy",
|
|
1007
1015
|
showHeader: !0,
|
|
1008
1016
|
size: "sub"
|
|
1009
|
-
}), d ? null : /* @__PURE__ */ S("div", {
|
|
1010
|
-
style:
|
|
1017
|
+
}), d || b ? null : /* @__PURE__ */ S("div", {
|
|
1018
|
+
style: It,
|
|
1011
1019
|
children: /* @__PURE__ */ S(c, {
|
|
1012
|
-
disabled:
|
|
1013
|
-
icon:
|
|
1020
|
+
disabled: v.length >= y.maxRows,
|
|
1021
|
+
icon: B,
|
|
1014
1022
|
iconType: "leading",
|
|
1015
|
-
onClick:
|
|
1023
|
+
onClick: k,
|
|
1016
1024
|
size: "sub",
|
|
1017
1025
|
type: "button",
|
|
1018
1026
|
variant: "base-secondary",
|
|
@@ -1021,14 +1029,14 @@ function Rt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
|
|
|
1021
1029
|
})]
|
|
1022
1030
|
});
|
|
1023
1031
|
}
|
|
1024
|
-
function
|
|
1025
|
-
let _ =
|
|
1032
|
+
function Vt({ 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 }) {
|
|
1033
|
+
let _ = Gt(m, e.fieldKey), y = Oe({
|
|
1026
1034
|
context: t,
|
|
1027
1035
|
field: e,
|
|
1028
1036
|
fieldPath: i,
|
|
1029
1037
|
formData: a,
|
|
1030
1038
|
initialFormData: o,
|
|
1031
|
-
initialValue: s ?
|
|
1039
|
+
initialValue: s ? Gt(s, e.fieldKey) : void 0,
|
|
1032
1040
|
optionSnapshots: d,
|
|
1033
1041
|
readonly: p,
|
|
1034
1042
|
row: {
|
|
@@ -1038,7 +1046,7 @@ function zt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
1038
1046
|
schema: h,
|
|
1039
1047
|
snapshotKey: f,
|
|
1040
1048
|
uiSchema: g
|
|
1041
|
-
}), b =
|
|
1049
|
+
}), b = K(y), x = JSON.stringify({
|
|
1042
1050
|
hasValue: y.hasValue,
|
|
1043
1051
|
invalidValues: y.invalidValues,
|
|
1044
1052
|
selectionExpired: y.selectionExpired === !0,
|
|
@@ -1063,16 +1071,16 @@ function zt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
1063
1071
|
x
|
|
1064
1072
|
]), /* @__PURE__ */ C("div", {
|
|
1065
1073
|
"data-form-field-key": f,
|
|
1066
|
-
style:
|
|
1074
|
+
style: zt,
|
|
1067
1075
|
children: [
|
|
1068
|
-
|
|
1076
|
+
Kt(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
|
|
1069
1077
|
n ? /* @__PURE__ */ S(v, {
|
|
1070
1078
|
color: "text-error",
|
|
1071
1079
|
variant: "caption",
|
|
1072
1080
|
children: n
|
|
1073
1081
|
}) : null,
|
|
1074
1082
|
b ? /* @__PURE__ */ C("div", {
|
|
1075
|
-
style:
|
|
1083
|
+
style: Pt,
|
|
1076
1084
|
children: [/* @__PURE__ */ S(v, {
|
|
1077
1085
|
color: y.status === "INVALID" || y.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
1078
1086
|
variant: "caption",
|
|
@@ -1088,38 +1096,38 @@ function zt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
|
|
|
1088
1096
|
]
|
|
1089
1097
|
});
|
|
1090
1098
|
}
|
|
1091
|
-
function
|
|
1092
|
-
return
|
|
1099
|
+
function Ht(e, t) {
|
|
1100
|
+
return ce(e)[t];
|
|
1093
1101
|
}
|
|
1094
|
-
function
|
|
1102
|
+
function Ut(e) {
|
|
1095
1103
|
return e.current += 1, `table-row-${e.current}`;
|
|
1096
1104
|
}
|
|
1097
|
-
function
|
|
1105
|
+
function Wt(e, t, n) {
|
|
1098
1106
|
return n === void 0 || !he(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
|
|
1099
1107
|
...e,
|
|
1100
1108
|
[t]: n
|
|
1101
1109
|
};
|
|
1102
1110
|
}
|
|
1103
|
-
function
|
|
1111
|
+
function Gt(e, t) {
|
|
1104
1112
|
if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
1105
1113
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return pe(e) ?
|
|
1114
|
+
function Kt(e, t, n, r, i, a, o, s = "main") {
|
|
1115
|
+
return pe(e) ? Jt(e, t, n, r, a, o, s) : qt(e, t, n, r, i, s);
|
|
1108
1116
|
}
|
|
1109
|
-
function
|
|
1110
|
-
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ?
|
|
1117
|
+
function qt(e, t, n, r, i, a = "main") {
|
|
1118
|
+
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? qe(t) : null;
|
|
1111
1119
|
if (o) return /* @__PURE__ */ S(v, {
|
|
1112
1120
|
color: "text-brand",
|
|
1113
1121
|
component: "span",
|
|
1114
1122
|
variant: "body",
|
|
1115
1123
|
children: /* @__PURE__ */ S("a", {
|
|
1116
1124
|
href: o.href,
|
|
1117
|
-
style:
|
|
1125
|
+
style: Nt,
|
|
1118
1126
|
...o.external ? {
|
|
1119
|
-
"aria-label": `${o.href}${
|
|
1127
|
+
"aria-label": `${o.href}${jt}`,
|
|
1120
1128
|
rel: "noopener noreferrer",
|
|
1121
1129
|
target: "_blank",
|
|
1122
|
-
title:
|
|
1130
|
+
title: Mt
|
|
1123
1131
|
} : {},
|
|
1124
1132
|
children: o.href
|
|
1125
1133
|
})
|
|
@@ -1131,7 +1139,7 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1131
1139
|
ref: wt,
|
|
1132
1140
|
rows: 3,
|
|
1133
1141
|
style: Ct,
|
|
1134
|
-
value:
|
|
1142
|
+
value: Xt(t)
|
|
1135
1143
|
});
|
|
1136
1144
|
if (e.type === "boolean") return /* @__PURE__ */ S(_, {
|
|
1137
1145
|
checked: t === !0,
|
|
@@ -1141,7 +1149,7 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1141
1149
|
size: a
|
|
1142
1150
|
});
|
|
1143
1151
|
if (me(e) && e.type === "checkbox") {
|
|
1144
|
-
let i = e.options.map(
|
|
1152
|
+
let i = e.options.map(I);
|
|
1145
1153
|
return /* @__PURE__ */ S(m, {
|
|
1146
1154
|
menuMaxHeight: 320,
|
|
1147
1155
|
mode: "multiple",
|
|
@@ -1150,11 +1158,11 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1150
1158
|
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
1151
1159
|
readOnly: n,
|
|
1152
1160
|
size: a,
|
|
1153
|
-
value: i.filter((e) =>
|
|
1161
|
+
value: i.filter((e) => q(t).includes(e.id))
|
|
1154
1162
|
});
|
|
1155
1163
|
}
|
|
1156
1164
|
if (me(e)) {
|
|
1157
|
-
let i = e.options.map(
|
|
1165
|
+
let i = e.options.map(I);
|
|
1158
1166
|
return /* @__PURE__ */ S(m, {
|
|
1159
1167
|
menuMaxHeight: 320,
|
|
1160
1168
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
@@ -1162,7 +1170,7 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1162
1170
|
placeholder: e.placeholder ?? "請選擇",
|
|
1163
1171
|
readOnly: n,
|
|
1164
1172
|
size: a,
|
|
1165
|
-
value:
|
|
1173
|
+
value: R(i, Xt(t))
|
|
1166
1174
|
});
|
|
1167
1175
|
}
|
|
1168
1176
|
return e.type === "member" ? /* @__PURE__ */ S(ot, {
|
|
@@ -1176,11 +1184,11 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1176
1184
|
}) : e.type === "org_unit" ? /* @__PURE__ */ S(yt, {
|
|
1177
1185
|
name: e.fieldKey,
|
|
1178
1186
|
onChange: (t) => r(e.fieldKey, t),
|
|
1179
|
-
placeholder: e.placeholder ??
|
|
1187
|
+
placeholder: e.placeholder ?? Qt(e.type),
|
|
1180
1188
|
readonly: n,
|
|
1181
1189
|
size: a,
|
|
1182
1190
|
value: t
|
|
1183
|
-
}) : e.type === "file_upload" ? /* @__PURE__ */ S(
|
|
1191
|
+
}) : e.type === "file_upload" ? /* @__PURE__ */ S(Ve, {
|
|
1184
1192
|
attachments: i?.attachments,
|
|
1185
1193
|
field: e,
|
|
1186
1194
|
onChange: (t) => r(e.fieldKey, t),
|
|
@@ -1193,9 +1201,9 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1193
1201
|
format: "YYYY-MM-DD",
|
|
1194
1202
|
fullWidth: !0,
|
|
1195
1203
|
onChange: (t) => r(e.fieldKey, k(t)),
|
|
1196
|
-
placeholder: e.placeholder ??
|
|
1204
|
+
placeholder: e.placeholder ?? Qt(e.type),
|
|
1197
1205
|
readOnly: n,
|
|
1198
|
-
value:
|
|
1206
|
+
value: F(t)
|
|
1199
1207
|
}) : e.type === "datetime" ? /* @__PURE__ */ S(d, {
|
|
1200
1208
|
formatDate: "YYYY-MM-DD",
|
|
1201
1209
|
formatTime: "HH:mm",
|
|
@@ -1205,34 +1213,34 @@ function Gt(e, t, n, r, i, a = "main") {
|
|
|
1205
1213
|
placeholderLeft: "選擇日期",
|
|
1206
1214
|
placeholderRight: "選擇時間",
|
|
1207
1215
|
readOnly: n,
|
|
1208
|
-
value:
|
|
1216
|
+
value: F(t)
|
|
1209
1217
|
}) : e.type === "number" || e.type === "money" ? /* @__PURE__ */ S(f, {
|
|
1210
1218
|
fullWidth: !0,
|
|
1211
1219
|
max: e.maximum,
|
|
1212
1220
|
min: e.minimum,
|
|
1213
1221
|
size: a,
|
|
1214
|
-
onChange: (t) => r(e.fieldKey, D(
|
|
1222
|
+
onChange: (t) => r(e.fieldKey, D(P(t.target.value), {
|
|
1215
1223
|
max: e.maximum,
|
|
1216
1224
|
min: e.minimum
|
|
1217
1225
|
})),
|
|
1218
|
-
placeholder: e.placeholder ??
|
|
1226
|
+
placeholder: e.placeholder ?? Qt(e.type),
|
|
1219
1227
|
...n ? { readonly: !0 } : {},
|
|
1220
1228
|
showSpinner: !0,
|
|
1221
|
-
value:
|
|
1229
|
+
value: Zt(t),
|
|
1222
1230
|
variant: "measure"
|
|
1223
1231
|
}) : /* @__PURE__ */ S(f, {
|
|
1224
1232
|
fullWidth: !0,
|
|
1225
1233
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
1226
|
-
placeholder: e.placeholder ??
|
|
1234
|
+
placeholder: e.placeholder ?? Qt(e.type),
|
|
1227
1235
|
...n ? { readonly: !0 } : {},
|
|
1228
1236
|
size: a,
|
|
1229
|
-
value:
|
|
1237
|
+
value: Xt(t),
|
|
1230
1238
|
variant: "base"
|
|
1231
1239
|
});
|
|
1232
1240
|
}
|
|
1233
|
-
function
|
|
1234
|
-
let c = a.options.map(
|
|
1235
|
-
return e.type === "autocomplete" ?
|
|
1241
|
+
function Jt(e, t, n, r, i, a, o = "main") {
|
|
1242
|
+
let c = a.options.map(I), u = de(t, a.options).map(I), d = a.status === "LOADING", f = d && !a.loadingNextPage, h = a.status === "WAITING_FOR_DEPENDENCIES", g = !!i && !n, _ = n || h, v = n;
|
|
1243
|
+
return e.type === "autocomplete" ? U(e) === "multiple" ? /* @__PURE__ */ S(s, {
|
|
1236
1244
|
asyncData: g,
|
|
1237
1245
|
clearSearchText: !0,
|
|
1238
1246
|
disabled: v,
|
|
@@ -1279,7 +1287,7 @@ function Kt(e, t, n, r, i, a, o = "main") {
|
|
|
1279
1287
|
name: e.fieldKey,
|
|
1280
1288
|
onChange: (t) => r(e.fieldKey, t.target.value || void 0),
|
|
1281
1289
|
options: c,
|
|
1282
|
-
value:
|
|
1290
|
+
value: Xt(t)
|
|
1283
1291
|
}) : e.type === "checkbox" ? /* @__PURE__ */ S(l, {
|
|
1284
1292
|
disabled: _,
|
|
1285
1293
|
name: e.fieldKey,
|
|
@@ -1288,8 +1296,8 @@ function Kt(e, t, n, r, i, a, o = "main") {
|
|
|
1288
1296
|
label: e.name,
|
|
1289
1297
|
value: e.id
|
|
1290
1298
|
})),
|
|
1291
|
-
value: [...
|
|
1292
|
-
}) :
|
|
1299
|
+
value: [...q(t)]
|
|
1300
|
+
}) : U(e) === "multiple" ? /* @__PURE__ */ S(m, {
|
|
1293
1301
|
disabled: _,
|
|
1294
1302
|
loading: d,
|
|
1295
1303
|
menuMaxHeight: 320,
|
|
@@ -1314,20 +1322,20 @@ function Kt(e, t, n, r, i, a, o = "main") {
|
|
|
1314
1322
|
value: u[0] ?? null
|
|
1315
1323
|
});
|
|
1316
1324
|
}
|
|
1317
|
-
function
|
|
1325
|
+
function Yt(e, t) {
|
|
1318
1326
|
return {
|
|
1319
1327
|
FULL: 12,
|
|
1320
1328
|
HALF: 6,
|
|
1321
1329
|
THIRD: 4
|
|
1322
1330
|
}[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
|
|
1323
1331
|
}
|
|
1324
|
-
function
|
|
1332
|
+
function Xt(e) {
|
|
1325
1333
|
return typeof e == "string" ? e : "";
|
|
1326
1334
|
}
|
|
1327
|
-
function
|
|
1335
|
+
function Zt(e) {
|
|
1328
1336
|
return typeof e == "number" ? String(e) : "";
|
|
1329
1337
|
}
|
|
1330
|
-
function
|
|
1338
|
+
function Qt(e) {
|
|
1331
1339
|
return {
|
|
1332
1340
|
boolean: "",
|
|
1333
1341
|
autocomplete: "請輸入或選擇",
|
|
@@ -1346,6 +1354,6 @@ function Xt(e) {
|
|
|
1346
1354
|
textarea: "請輸入多行文字"
|
|
1347
1355
|
}[e];
|
|
1348
1356
|
}
|
|
1349
|
-
export {
|
|
1357
|
+
export { J as a, K as c, Xe as i, je as l, lt as n, Y as o, Ze as r, Ae as s, Tt as t, Oe as u };
|
|
1350
1358
|
|
|
1351
|
-
//# sourceMappingURL=FormRendererView-
|
|
1359
|
+
//# sourceMappingURL=FormRendererView-CemHvfAT.js.map
|