@rytass/bpm-core-react 0.15.0 → 0.17.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 +86 -0
- package/README.md +54 -6
- package/dist/chunks/{FormBuilderView-CLg-JYmu.js → FormBuilderView-BYL42M0d.js} +13 -33
- package/dist/chunks/FormBuilderView-BYL42M0d.js.map +1 -0
- package/dist/chunks/FormBuilderView-aBcA-_tt.cjs +3 -0
- package/dist/chunks/FormBuilderView-aBcA-_tt.cjs.map +1 -0
- package/dist/chunks/FormRendererView-DRFi_IH7.cjs +4 -0
- package/dist/chunks/FormRendererView-DRFi_IH7.cjs.map +1 -0
- package/dist/chunks/{FormRendererView-DU9LLrOF.js → FormRendererView-cZGOOjU5.js} +319 -332
- package/dist/chunks/FormRendererView-cZGOOjU5.js.map +1 -0
- package/dist/chunks/{admin-pickers-DLlG_1du.js → admin-pickers-DxhzECkD.js} +52 -51
- package/dist/chunks/admin-pickers-DxhzECkD.js.map +1 -0
- package/dist/chunks/admin-pickers-qe3j--gX.cjs +2 -0
- package/dist/chunks/admin-pickers-qe3j--gX.cjs.map +1 -0
- package/dist/chunks/approval-instance-list-page-CPXMP3PL.js.map +1 -1
- package/dist/chunks/approval-instance-list-page-ax0pm8bt.cjs.map +1 -1
- package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
- package/dist/chunks/auth-provider-B5oPmvk2.js.map +1 -1
- package/dist/chunks/bpm-form-field-Bc6k4ZEO.cjs.map +1 -1
- package/dist/chunks/bpm-form-field-Cao0rMol.js.map +1 -1
- package/dist/chunks/{categories-DGlxuC6X.js → categories-1gKxeEqw.js} +4 -10
- package/dist/chunks/categories-1gKxeEqw.js.map +1 -0
- package/dist/chunks/{categories-Yid05WAX.cjs → categories-DjENouRm.cjs} +2 -2
- package/dist/chunks/categories-DjENouRm.cjs.map +1 -0
- package/dist/chunks/{compose-BtQPBd1Q.js → compose-Crklayzy.js} +4 -4
- package/dist/chunks/compose-Crklayzy.js.map +1 -0
- package/dist/chunks/{compose-DZhTQOt4.cjs → compose-DZ7RKvUp.cjs} +2 -2
- package/dist/chunks/compose-DZ7RKvUp.cjs.map +1 -0
- package/dist/chunks/dashboard-page-BWQBSGDq.cjs +2 -0
- package/dist/chunks/dashboard-page-BWQBSGDq.cjs.map +1 -0
- package/dist/chunks/{dashboard-page-CeCLV1tp.js → dashboard-page-DdBvV6YI.js} +15 -16
- package/dist/chunks/dashboard-page-DdBvV6YI.js.map +1 -0
- package/dist/chunks/delegations-Ckf03icM.cjs +2 -0
- package/dist/chunks/delegations-Ckf03icM.cjs.map +1 -0
- package/dist/chunks/{delegations-DRupxJ4_.js → delegations-MxF3uJGW.js} +205 -215
- package/dist/chunks/delegations-MxF3uJGW.js.map +1 -0
- package/dist/chunks/delegations-V9HIe3_P.cjs +2 -0
- package/dist/chunks/delegations-V9HIe3_P.cjs.map +1 -0
- package/dist/chunks/{delegations-B8gLSt0i.js → delegations-xUt1tj8d.js} +168 -173
- package/dist/chunks/delegations-xUt1tj8d.js.map +1 -0
- package/dist/chunks/{designer-CrbBRPUU.js → designer-D9eFma1W.js} +1180 -1134
- package/dist/chunks/designer-D9eFma1W.js.map +1 -0
- package/dist/chunks/designer-sJGTGYOf.cjs +65 -0
- package/dist/chunks/designer-sJGTGYOf.cjs.map +1 -0
- package/dist/chunks/detail-DRCTnuKm.cjs +2 -0
- package/dist/chunks/detail-DRCTnuKm.cjs.map +1 -0
- package/dist/chunks/{detail-_c21WQla.js → detail-DScLf42P.js} +849 -836
- package/dist/chunks/detail-DScLf42P.js.map +1 -0
- package/dist/chunks/format-date-time-CB-LxzqT.js.map +1 -1
- package/dist/chunks/format-date-time-D-cx5M8z.cjs.map +1 -1
- package/dist/chunks/format-member-label-DudVI55w.js +13 -0
- package/dist/chunks/format-member-label-DudVI55w.js.map +1 -0
- package/dist/chunks/format-member-label-t7ANTF62.cjs +2 -0
- package/dist/chunks/format-member-label-t7ANTF62.cjs.map +1 -0
- package/dist/chunks/login-AtVxZBsC.cjs.map +1 -1
- package/dist/chunks/login-C6qlTC6F.js.map +1 -1
- package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
- package/dist/chunks/notifications-DJ5wzCye.js.map +1 -1
- package/dist/chunks/{orgs-BpqVu5ka.js → orgs-CY0i1fie.js} +787 -766
- package/dist/chunks/orgs-CY0i1fie.js.map +1 -0
- package/dist/chunks/orgs-Dr0FFoZo.cjs +2 -0
- package/dist/chunks/orgs-Dr0FFoZo.cjs.map +1 -0
- package/dist/chunks/providers-DHtDZFNA.cjs.map +1 -1
- package/dist/chunks/providers-J5eyByQj.js.map +1 -1
- package/dist/chunks/router-adapter--gYs13E8.cjs.map +1 -1
- package/dist/chunks/router-adapter-DftlFTOd.js.map +1 -1
- package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
- package/dist/chunks/routes-config-yZbESPlw.js.map +1 -1
- package/dist/chunks/task-node-label-BF6UllxP.cjs.map +1 -1
- package/dist/chunks/task-node-label-CWZgOBj0.js.map +1 -1
- package/dist/chunks/use-bpm-member-D57LKe_u.js.map +1 -1
- package/dist/chunks/use-bpm-member-DpNAQtNC.cjs.map +1 -1
- package/dist/chunks/users-BCyePbwB.js +422 -0
- package/dist/chunks/users-BCyePbwB.js.map +1 -0
- package/dist/chunks/users-DVBJluFR.cjs +2 -0
- package/dist/chunks/users-DVBJluFR.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/format-member-label.d.ts +12 -0
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js.map +1 -1
- package/dist/next/workflow-chat-route.cjs.map +1 -1
- 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.cjs.map +1 -1
- package/dist/pages/admin/delegations/index.js +1 -1
- package/dist/pages/admin/delegations/index.js.map +1 -1
- package/dist/pages/admin/orgs/index.cjs +1 -1
- package/dist/pages/admin/orgs/index.cjs.map +1 -1
- package/dist/pages/admin/orgs/index.js +1 -1
- package/dist/pages/admin/orgs/index.js.map +1 -1
- package/dist/pages/admin/users/index.cjs +1 -1
- package/dist/pages/admin/users/index.cjs.map +1 -1
- package/dist/pages/admin/users/index.js +1 -1
- package/dist/pages/admin/users/index.js.map +1 -1
- package/dist/pages/admin/webhook-endpoints/index.cjs.map +1 -1
- package/dist/pages/admin/webhook-endpoints/index.js.map +1 -1
- package/dist/pages/cc/index.cjs.map +1 -1
- package/dist/pages/cc/index.js.map +1 -1
- package/dist/pages/dashboard/index.cjs.map +1 -1
- package/dist/pages/dashboard/index.js.map +1 -1
- package/dist/pages/delegations/index.cjs +1 -1
- package/dist/pages/delegations/index.cjs.map +1 -1
- package/dist/pages/delegations/index.js +1 -1
- package/dist/pages/delegations/index.js.map +1 -1
- package/dist/pages/inbox/index.cjs.map +1 -1
- package/dist/pages/inbox/index.js.map +1 -1
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.cjs.map +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/instances/detail/index.js.map +1 -1
- package/dist/pages/instances/new/index.cjs.map +1 -1
- package/dist/pages/instances/new/index.js.map +1 -1
- package/dist/pages/login/index.cjs.map +1 -1
- package/dist/pages/login/index.js.map +1 -1
- package/dist/pages/root/index.cjs.map +1 -1
- package/dist/pages/root/index.js.map +1 -1
- package/dist/pages/search/index.cjs.map +1 -1
- package/dist/pages/search/index.js.map +1 -1
- package/dist/pages/sent/index.cjs.map +1 -1
- package/dist/pages/sent/index.js.map +1 -1
- package/dist/pages/settings/notifications/index.cjs.map +1 -1
- package/dist/pages/settings/notifications/index.js.map +1 -1
- package/dist/pages/templates/categories/index.cjs +1 -1
- package/dist/pages/templates/categories/index.cjs.map +1 -1
- package/dist/pages/templates/categories/index.js +1 -1
- package/dist/pages/templates/categories/index.js.map +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.cjs.map +1 -1
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/compose/index.js.map +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.cjs.map +1 -1
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/pages/templates/designer/index.js.map +1 -1
- package/dist/pages/templates/index.cjs.map +1 -1
- package/dist/pages/templates/index.js.map +1 -1
- package/dist/pages/templates/versions/index.cjs.map +1 -1
- package/dist/pages/templates/versions/index.js.map +1 -1
- package/dist/views/admin/delegations/index.cjs +1 -1
- package/dist/views/admin/delegations/index.js +1 -2
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.js +3 -3
- package/dist/views/admin/orgs/index.cjs +1 -1
- package/dist/views/admin/orgs/index.js +1 -2
- package/dist/views/admin/users/MemberTaskReassignModal.d.ts +13 -0
- package/dist/views/admin/users/index.cjs +1 -1
- package/dist/views/admin/users/index.js +1 -2
- package/dist/views/admin/webhook-endpoints/index.cjs.map +1 -1
- package/dist/views/admin/webhook-endpoints/index.js.map +1 -1
- package/dist/views/cc/index.cjs.map +1 -1
- package/dist/views/cc/index.js.map +1 -1
- package/dist/views/dashboard/index.cjs +1 -1
- package/dist/views/dashboard/index.cjs.map +1 -1
- package/dist/views/dashboard/index.js +1 -1
- package/dist/views/dashboard/index.js.map +1 -1
- package/dist/views/delegations/index.cjs +1 -1
- package/dist/views/delegations/index.js +1 -2
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -2
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.js +1 -2
- package/dist/views/inbox/index.cjs +1 -1
- package/dist/views/inbox/index.cjs.map +1 -1
- package/dist/views/inbox/index.js +1 -5
- package/dist/views/inbox/index.js.map +1 -1
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -2
- package/dist/views/instances/index.js +1 -2
- 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 +4 -11
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/login/index.js +1 -2
- package/dist/views/search/index.cjs.map +1 -1
- package/dist/views/search/index.js.map +1 -1
- package/dist/views/sent/index.cjs.map +1 -1
- package/dist/views/sent/index.js.map +1 -1
- package/dist/views/settings/index.js +1 -2
- package/dist/views/settings/notifications/index.js +1 -2
- package/dist/views/templates/categories/index.cjs +1 -1
- package/dist/views/templates/categories/index.js +1 -2
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -2
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -2
- package/dist/views/templates/index.cjs +1 -1
- package/dist/views/templates/index.cjs.map +1 -1
- package/dist/views/templates/index.js +1 -1
- package/dist/views/templates/index.js.map +1 -1
- package/dist/views/templates/versions/index.cjs.map +1 -1
- package/dist/views/templates/versions/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunks/FormBuilderView-6bCbIkz6.cjs +0 -3
- package/dist/chunks/FormBuilderView-6bCbIkz6.cjs.map +0 -1
- package/dist/chunks/FormBuilderView-CLg-JYmu.js.map +0 -1
- package/dist/chunks/FormRendererView-DU9LLrOF.js.map +0 -1
- package/dist/chunks/FormRendererView-gctFIqwC.cjs +0 -4
- package/dist/chunks/FormRendererView-gctFIqwC.cjs.map +0 -1
- package/dist/chunks/admin-pickers-Btvij1at.cjs +0 -2
- package/dist/chunks/admin-pickers-Btvij1at.cjs.map +0 -1
- package/dist/chunks/admin-pickers-DLlG_1du.js.map +0 -1
- package/dist/chunks/categories-DGlxuC6X.js.map +0 -1
- package/dist/chunks/categories-Yid05WAX.cjs.map +0 -1
- package/dist/chunks/compose-BtQPBd1Q.js.map +0 -1
- package/dist/chunks/compose-DZhTQOt4.cjs.map +0 -1
- package/dist/chunks/dashboard-page-CeCLV1tp.js.map +0 -1
- package/dist/chunks/dashboard-page-DooFJsxM.cjs +0 -2
- package/dist/chunks/dashboard-page-DooFJsxM.cjs.map +0 -1
- package/dist/chunks/delegations-8LsxcQM4.cjs +0 -2
- package/dist/chunks/delegations-8LsxcQM4.cjs.map +0 -1
- package/dist/chunks/delegations-B8gLSt0i.js.map +0 -1
- package/dist/chunks/delegations-DRupxJ4_.js.map +0 -1
- package/dist/chunks/delegations-DlYwMiAW.cjs +0 -2
- package/dist/chunks/delegations-DlYwMiAW.cjs.map +0 -1
- package/dist/chunks/designer-CrbBRPUU.js.map +0 -1
- package/dist/chunks/designer-D3_lWmfa.cjs +0 -65
- package/dist/chunks/designer-D3_lWmfa.cjs.map +0 -1
- package/dist/chunks/detail-CVXb5Vy8.cjs +0 -2
- package/dist/chunks/detail-CVXb5Vy8.cjs.map +0 -1
- package/dist/chunks/detail-_c21WQla.js.map +0 -1
- package/dist/chunks/orgs-BpqVu5ka.js.map +0 -1
- package/dist/chunks/orgs-D0-5BaHT.cjs +0 -2
- package/dist/chunks/orgs-D0-5BaHT.cjs.map +0 -1
- package/dist/chunks/users-C9LA-Rd7.cjs +0 -2
- package/dist/chunks/users-C9LA-Rd7.cjs.map +0 -1
- package/dist/chunks/users-FWrb3ehW.js +0 -214
- package/dist/chunks/users-FWrb3ehW.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as e } from "./bpm-form-field-Cao0rMol.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { t } from "./format-member-label-DudVI55w.js";
|
|
4
|
+
import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import { AutoComplete as s, Button as c, CheckboxGroup as l, DatePicker as u, DateTimePicker as d, Input as f, RadioGroup as p, Select as m, Table as h, Textarea as g, Toggle as _, Typography as v, Upload as y } from "@mezzanine-ui/react";
|
|
6
|
+
import { resolveMembers as b, searchMembers as x } from "@rytass/bpm-core-client";
|
|
7
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
8
|
+
import { PlusIcon as w, TrashIcon as T } from "@mezzanine-ui/icons";
|
|
9
|
+
import { buildFormRendererValues as E, clampOptionalNumber as ee, createFormTableRow as te, formatDatePickerValue as D, formatDateTimePickerValue as O, isFormRendererFieldReadonly as k, isFormRendererFieldRequired as A, mergeFormDataSourceOptions as j, parseOptionalNumberInput as M, previewFormFieldOptions as ne, previewResolveFormFieldOptions as re, readDatePickerValue as ie, readFieldOptionAsSelectOption as N, readFormDataSourceErrorCode as ae, readFormDataSourceErrorMessage as oe, readFormDataSourceSelectedValues as se, readFormDataSourceValueSignature as P, readFormFieldOptions as ce, readFormTableCellPath as F, readFormTableRowBounds as le, readFormTableRows as I, readMissingFormDataSourceDependencies as ue, readMissingFormDataSourceOptionValues as L, readSelectOption as R, readSelectedFormDataSourceOptions as z, readVisibleFormRendererFields as de, resolveFormFieldOptions as fe } from "@rytass/bpm-core-client/form";
|
|
10
|
+
import { isFormDataSourceFieldDefinition as B, isFormStaticOptionFieldDefinition as pe, isFormTableCellValue as V, isTableFieldDefinition as me, readFormFieldSelectionMode as H, readFormMemberIds as U } from "@rytass/bpm-core-shared/form";
|
|
10
11
|
//#region src/views/forms/renderer/form-data-source-field.ts
|
|
11
|
-
var
|
|
12
|
+
var he = {
|
|
12
13
|
canRetry: !1,
|
|
13
14
|
error: null,
|
|
14
15
|
hasValue: !1,
|
|
@@ -19,14 +20,14 @@ var ge = {
|
|
|
19
20
|
options: [],
|
|
20
21
|
retry: () => void 0,
|
|
21
22
|
status: "IDLE"
|
|
22
|
-
},
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
dataSource:
|
|
26
|
-
fieldKey:
|
|
27
|
-
type:
|
|
28
|
-
}) : "", u = JSON.stringify(c ?? null), d =
|
|
29
|
-
bindings:
|
|
23
|
+
}, W = [], ge = 10, _e = ["FORM_DATA_SOURCE_SEARCH_NOT_SUPPORTED", "FORM_DATA_SOURCE_SEARCH_TOO_SHORT"];
|
|
24
|
+
function G(e) {
|
|
25
|
+
let t = B(e.field) ? e.field : null, s = e.fieldPath ?? t?.fieldKey ?? "", c = t ? e.optionSnapshots?.[e.snapshotKey ?? t.fieldKey] : void 0, l = t ? JSON.stringify({
|
|
26
|
+
dataSource: t.dataSource,
|
|
27
|
+
fieldKey: t.fieldKey,
|
|
28
|
+
type: t.type
|
|
29
|
+
}) : "", 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 = P(x), C = i(() => se(x), [S]), w = C.length > 0, T = t ? JSON.stringify({
|
|
30
|
+
bindings: t.dataSource.bindings.map((t) => t.from.kind === "FIELD" ? {
|
|
30
31
|
fieldKey: t.from.fieldKey,
|
|
31
32
|
value: e.formData[t.from.fieldKey]
|
|
32
33
|
} : t.from.kind === "CONSTANT" ? { value: t.from.value } : {
|
|
@@ -34,7 +35,7 @@ function U(e) {
|
|
|
34
35
|
value: e.row?.values[t.from.columnKey]
|
|
35
36
|
}),
|
|
36
37
|
value: e.initialFormData !== void 0 || e.initialValue !== void 0 ? x : void 0
|
|
37
|
-
}) : "", E =
|
|
38
|
+
}) : "", E = i(() => {
|
|
38
39
|
if (g === "preview") return { kind: "preview" };
|
|
39
40
|
if (g === "runtime" && !e.readonly) return {
|
|
40
41
|
instanceId: _,
|
|
@@ -46,54 +47,54 @@ function U(e) {
|
|
|
46
47
|
g,
|
|
47
48
|
v,
|
|
48
49
|
e.readonly
|
|
49
|
-
]), ee =
|
|
50
|
+
]), ee = t ? (e.initialFormData !== void 0 || e.initialValue !== void 0) && P(e.initialValue) !== S : !1, te = t ? e.initialFormData !== void 0 && t.dataSource.bindings.some((t) => t.from.kind === "FIELD" ? P(e.initialFormData?.[t.from.fieldKey]) !== P(e.formData[t.from.fieldKey]) : t.from.kind === "ROW_FIELD" && e.row?.initialValues ? P(e.row.initialValues[t.from.columnKey]) !== P(e.row.values[t.from.columnKey]) : !1) : !1, D = !(!c && !w || !ee && !te), O = !!(t && E && D && w), k = ye({
|
|
50
51
|
hasSnapshot: !!c,
|
|
51
52
|
hasValue: w,
|
|
52
53
|
isStale: D,
|
|
53
54
|
readonly: e.readonly
|
|
54
|
-
}),
|
|
55
|
+
}), A = !!(t && E && t.type !== "autocomplete"), M = be(D, A && t !== null && ue(t, e.formData, e.row?.values).length > 0), [ie, N] = o([]), [F, le] = o(""), [I, L] = o(null), [R, de] = o(null), [pe, V] = o(() => t ? A ? M : k : "IDLE"), [me, H] = o(null), U = a(0), W = a(0), G = a(0), K = a(null), q = a(null), J = a({
|
|
55
56
|
cursor: null,
|
|
56
57
|
searchText: ""
|
|
57
|
-
}), Y =
|
|
58
|
+
}), Y = i(() => we(e.formData), [f]), X = i(() => e.row ? we(e.row.values) : void 0, [y]), Te = i(() => j(d, ie), [ie, d]), Ee = R && R.signature === T ? R : null, De = O && !Ee, Oe = ve({
|
|
58
59
|
options: Te,
|
|
59
|
-
resolution:
|
|
60
|
-
resolvePending:
|
|
60
|
+
resolution: Ee,
|
|
61
|
+
resolvePending: De,
|
|
61
62
|
value: x
|
|
62
|
-
}),
|
|
63
|
-
if (!
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
cursor:
|
|
67
|
-
searchText:
|
|
68
|
-
},
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
cursor:
|
|
63
|
+
}), Z = n((n, r) => {
|
|
64
|
+
if (!t || !E) return;
|
|
65
|
+
let i = W.current + 1;
|
|
66
|
+
W.current = i, J.current = {
|
|
67
|
+
cursor: r,
|
|
68
|
+
searchText: n
|
|
69
|
+
}, K.current?.abort();
|
|
70
|
+
let a = new AbortController();
|
|
71
|
+
K.current = a, V(M), H(null), (E.kind === "preview" ? ne({
|
|
72
|
+
cursor: r,
|
|
72
73
|
fieldKey: s,
|
|
73
74
|
formData: Y,
|
|
74
75
|
rowValues: X,
|
|
75
76
|
schema: e.schema,
|
|
76
|
-
searchText:
|
|
77
|
-
signal:
|
|
77
|
+
searchText: n,
|
|
78
|
+
signal: a.signal,
|
|
78
79
|
uiSchema: e.uiSchema
|
|
79
|
-
}) :
|
|
80
|
-
cursor:
|
|
80
|
+
}) : ce({
|
|
81
|
+
cursor: r,
|
|
81
82
|
fieldKey: s,
|
|
82
83
|
formData: Y,
|
|
83
84
|
instanceId: E.instanceId ?? null,
|
|
84
85
|
rowValues: X,
|
|
85
|
-
searchText:
|
|
86
|
-
signal:
|
|
86
|
+
searchText: n,
|
|
87
|
+
signal: a.signal,
|
|
87
88
|
templateId: E.templateId ?? null
|
|
88
89
|
})).then((e) => {
|
|
89
|
-
|
|
90
|
-
let
|
|
91
|
-
return
|
|
92
|
-
}),
|
|
90
|
+
Ce(a, W, i) || (N((t) => {
|
|
91
|
+
let n = z(x, t);
|
|
92
|
+
return j(n, r ? t : [], e.options);
|
|
93
|
+
}), L(e.nextCursor), H(null), U.current = r ? U.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && U.current < ge && Q.current(n, e.nextCursor), V(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
|
|
93
94
|
}).catch((e) => {
|
|
94
|
-
if (
|
|
95
|
-
let t =
|
|
96
|
-
|
|
95
|
+
if (Ce(a, W, i)) return;
|
|
96
|
+
let t = oe(e) ?? "選項來源暫時無法使用。", n = ae(e);
|
|
97
|
+
H(t), V(xe(!!(n && _e.includes(n)), w));
|
|
97
98
|
});
|
|
98
99
|
}, [
|
|
99
100
|
S,
|
|
@@ -106,19 +107,19 @@ function U(e) {
|
|
|
106
107
|
X,
|
|
107
108
|
m,
|
|
108
109
|
h
|
|
109
|
-
]),
|
|
110
|
-
|
|
111
|
-
let
|
|
112
|
-
if (!
|
|
113
|
-
let
|
|
114
|
-
|
|
115
|
-
let
|
|
116
|
-
|
|
110
|
+
]), Q = a(Z);
|
|
111
|
+
Q.current = Z;
|
|
112
|
+
let ke = n(() => {
|
|
113
|
+
if (!t || !E || C.length === 0) return;
|
|
114
|
+
let n = T, r = G.current + 1;
|
|
115
|
+
G.current = r, q.current?.abort();
|
|
116
|
+
let i = new AbortController();
|
|
117
|
+
q.current = i, H(null), (E.kind === "preview" ? re({
|
|
117
118
|
fieldKey: s,
|
|
118
119
|
formData: Y,
|
|
119
120
|
rowValues: X,
|
|
120
121
|
schema: e.schema,
|
|
121
|
-
signal:
|
|
122
|
+
signal: i.signal,
|
|
122
123
|
uiSchema: e.uiSchema,
|
|
123
124
|
values: C
|
|
124
125
|
}) : fe({
|
|
@@ -126,22 +127,16 @@ function U(e) {
|
|
|
126
127
|
formData: Y,
|
|
127
128
|
instanceId: E.instanceId ?? null,
|
|
128
129
|
rowValues: X,
|
|
129
|
-
signal:
|
|
130
|
+
signal: i.signal,
|
|
130
131
|
templateId: E.templateId ?? null,
|
|
131
132
|
values: C
|
|
132
133
|
})).then((e) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
F((t) => A(t, e.options)), pe({
|
|
139
|
-
signature: t,
|
|
140
|
-
unresolvedValues: e.unresolvedValues
|
|
141
|
-
}), B("VALID");
|
|
142
|
-
}
|
|
134
|
+
Ce(i, G, r) || (e.waitingForFieldKeys.length ? V("WAITING_FOR_DEPENDENCIES") : (N((t) => j(t, e.options)), de({
|
|
135
|
+
signature: n,
|
|
136
|
+
unresolvedValues: e.unresolvedValues
|
|
137
|
+
}), V("VALID")));
|
|
143
138
|
}).catch((e) => {
|
|
144
|
-
|
|
139
|
+
Ce(i, G, r) || (V("UNAVAILABLE"), H(oe(e) ?? "選項來源暫時無法使用。"));
|
|
145
140
|
});
|
|
146
141
|
}, [
|
|
147
142
|
T,
|
|
@@ -153,19 +148,11 @@ function U(e) {
|
|
|
153
148
|
m,
|
|
154
149
|
C,
|
|
155
150
|
h
|
|
156
|
-
]),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
B("IDLE");
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (!j) {
|
|
163
|
-
B(k);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
$.current("", null);
|
|
151
|
+
]), Ae = a(ke);
|
|
152
|
+
Ae.current = ke, r(() => {
|
|
153
|
+
W.current += 1, K.current?.abort(), N((e) => z(x, e)), L((e) => e === null ? e : null), le((e) => e && ""), H((e) => e && null), t ? A ? Q.current("", null) : V(k) : V("IDLE");
|
|
167
154
|
}, [
|
|
168
|
-
|
|
155
|
+
A,
|
|
169
156
|
l,
|
|
170
157
|
E,
|
|
171
158
|
T,
|
|
@@ -175,48 +162,48 @@ function U(e) {
|
|
|
175
162
|
M,
|
|
176
163
|
k,
|
|
177
164
|
u
|
|
178
|
-
]),
|
|
179
|
-
O &&
|
|
165
|
+
]), r(() => {
|
|
166
|
+
O && Ae.current();
|
|
180
167
|
}, [
|
|
181
168
|
T,
|
|
182
169
|
E,
|
|
183
170
|
O
|
|
184
|
-
]),
|
|
185
|
-
|
|
171
|
+
]), r(() => () => {
|
|
172
|
+
K.current?.abort(), q.current?.abort();
|
|
186
173
|
}, []);
|
|
187
|
-
let
|
|
188
|
-
|
|
189
|
-
}, [
|
|
190
|
-
|
|
174
|
+
let je = n((e) => {
|
|
175
|
+
le(e), N((e) => z(x, e)), L(null), Z(e, null);
|
|
176
|
+
}, [Z]), Me = n(() => {
|
|
177
|
+
I && Z(F, I);
|
|
191
178
|
}, [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
]),
|
|
196
|
-
E && (
|
|
179
|
+
Z,
|
|
180
|
+
I,
|
|
181
|
+
F
|
|
182
|
+
]), Ne = n(() => {
|
|
183
|
+
E && (Z(J.current.searchText, J.current.cursor), O && Ae.current());
|
|
197
184
|
}, [
|
|
198
185
|
E,
|
|
199
|
-
|
|
186
|
+
Z,
|
|
200
187
|
O
|
|
201
188
|
]);
|
|
202
|
-
return
|
|
189
|
+
return t ? {
|
|
203
190
|
canRetry: !!E,
|
|
204
|
-
error:
|
|
191
|
+
error: me,
|
|
205
192
|
hasValue: w,
|
|
206
|
-
hasNextPage: !!
|
|
207
|
-
invalidValues:
|
|
208
|
-
onReachBottom:
|
|
209
|
-
onSearch:
|
|
193
|
+
hasNextPage: !!I,
|
|
194
|
+
invalidValues: Oe,
|
|
195
|
+
onReachBottom: Me,
|
|
196
|
+
onSearch: je,
|
|
210
197
|
options: Te,
|
|
211
|
-
retry:
|
|
212
|
-
status:
|
|
213
|
-
invalidValues:
|
|
214
|
-
resolvePending:
|
|
215
|
-
status:
|
|
198
|
+
retry: Ne,
|
|
199
|
+
status: Se({
|
|
200
|
+
invalidValues: Oe,
|
|
201
|
+
resolvePending: De,
|
|
202
|
+
status: pe
|
|
216
203
|
})
|
|
217
|
-
} :
|
|
204
|
+
} : he;
|
|
218
205
|
}
|
|
219
|
-
function
|
|
206
|
+
function K(e) {
|
|
220
207
|
switch (e.status) {
|
|
221
208
|
case "WAITING_FOR_DEPENDENCIES": return "請先填寫相依欄位。";
|
|
222
209
|
case "STALE": return "選項需要重新載入或驗證。";
|
|
@@ -226,29 +213,29 @@ function W(e) {
|
|
|
226
213
|
default: return e.error;
|
|
227
214
|
}
|
|
228
215
|
}
|
|
229
|
-
function
|
|
216
|
+
function q(e) {
|
|
230
217
|
return e.hasValue && e.status !== "VALID";
|
|
231
218
|
}
|
|
232
|
-
function
|
|
233
|
-
let t = e.filter(
|
|
219
|
+
function J(e) {
|
|
220
|
+
let t = e.filter(q);
|
|
234
221
|
return t.length === 0 ? null : t.every((e) => e.status === "LOADING" || e.status === "STALE") ? "選項驗證中,請稍候再送出。" : "請先完成動態選項驗證。";
|
|
235
222
|
}
|
|
236
|
-
function
|
|
237
|
-
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ?
|
|
223
|
+
function ve(e) {
|
|
224
|
+
return e.resolution ? e.resolution.unresolvedValues : e.resolvePending ? W : L(e.value, e.options);
|
|
238
225
|
}
|
|
239
|
-
function
|
|
226
|
+
function ye(e) {
|
|
240
227
|
return e.isStale ? "STALE" : e.hasSnapshot ? "VALID" : e.readonly && e.hasValue ? "UNAVAILABLE" : "IDLE";
|
|
241
228
|
}
|
|
242
|
-
function
|
|
229
|
+
function be(e, t) {
|
|
243
230
|
return t ? "WAITING_FOR_DEPENDENCIES" : e ? "STALE" : "LOADING";
|
|
244
231
|
}
|
|
245
|
-
function
|
|
232
|
+
function xe(e, t) {
|
|
246
233
|
return e ? t ? "VALID" : "IDLE" : "UNAVAILABLE";
|
|
247
234
|
}
|
|
248
|
-
function
|
|
235
|
+
function Se(e) {
|
|
249
236
|
return e.status === "LOADING" || e.status === "UNAVAILABLE" || e.status === "WAITING_FOR_DEPENDENCIES" ? e.status : e.invalidValues.length ? "INVALID" : e.resolvePending ? "STALE" : e.status;
|
|
250
237
|
}
|
|
251
|
-
function
|
|
238
|
+
function Ce(e, t, n) {
|
|
252
239
|
return e.signal.aborted || t.current !== n;
|
|
253
240
|
}
|
|
254
241
|
function we(e) {
|
|
@@ -259,33 +246,33 @@ function we(e) {
|
|
|
259
246
|
}
|
|
260
247
|
//#endregion
|
|
261
248
|
//#region src/views/forms/renderer/form-field-link.ts
|
|
262
|
-
var
|
|
263
|
-
function
|
|
249
|
+
var Y = /\s/u;
|
|
250
|
+
function X(e) {
|
|
264
251
|
return [...e].some((e) => {
|
|
265
252
|
let t = e.codePointAt(0) ?? 0;
|
|
266
|
-
return t <= 32 || t >= 127 && t <= 160 ||
|
|
253
|
+
return t <= 32 || t >= 127 && t <= 160 || Y.test(e);
|
|
267
254
|
});
|
|
268
255
|
}
|
|
269
|
-
var
|
|
270
|
-
function
|
|
271
|
-
return typeof e != "string" || !e || e.includes("\\") ||
|
|
256
|
+
var Te = /^https?:\/\//iu;
|
|
257
|
+
function Ee(e) {
|
|
258
|
+
return typeof e != "string" || !e || e.includes("\\") || X(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Oe(e) ? {
|
|
272
259
|
external: !1,
|
|
273
260
|
href: e
|
|
274
|
-
} : null :
|
|
261
|
+
} : null : Te.test(e) && Z(e) ? {
|
|
275
262
|
external: !0,
|
|
276
263
|
href: e
|
|
277
264
|
} : null;
|
|
278
265
|
}
|
|
279
|
-
var
|
|
280
|
-
function
|
|
266
|
+
var De = "http://placeholder.invalid";
|
|
267
|
+
function Oe(e) {
|
|
281
268
|
try {
|
|
282
|
-
let t = new URL(e,
|
|
283
|
-
return t.origin ===
|
|
269
|
+
let t = new URL(e, De);
|
|
270
|
+
return t.origin === De && !t.pathname.startsWith("//");
|
|
284
271
|
} catch {
|
|
285
272
|
return !1;
|
|
286
273
|
}
|
|
287
274
|
}
|
|
288
|
-
function
|
|
275
|
+
function Z(e) {
|
|
289
276
|
try {
|
|
290
277
|
let t = new URL(e);
|
|
291
278
|
return (t.protocol === "http:" || t.protocol === "https:") && !!t.hostname && !t.username && !t.password;
|
|
@@ -308,17 +295,17 @@ async function Q(e, t, n = {}) {
|
|
|
308
295
|
skippedIds: []
|
|
309
296
|
};
|
|
310
297
|
}
|
|
311
|
-
let a = e.slice(0, r), o = await
|
|
298
|
+
let a = e.slice(0, r), o = await Ae(a, i, (e) => t([e]));
|
|
312
299
|
return {
|
|
313
300
|
failedIds: a.filter((e, t) => o[t].status === "rejected"),
|
|
314
301
|
profiles: o.flatMap((e) => e.status === "fulfilled" ? e.value : []),
|
|
315
302
|
skippedIds: e.slice(r)
|
|
316
303
|
};
|
|
317
304
|
}
|
|
318
|
-
function
|
|
305
|
+
function ke(e, t) {
|
|
319
306
|
return e.filter((e) => !t.has(e));
|
|
320
307
|
}
|
|
321
|
-
async function
|
|
308
|
+
async function Ae(e, t, n) {
|
|
322
309
|
let r = [], i = 0;
|
|
323
310
|
async function a() {
|
|
324
311
|
for (; i < e.length;) {
|
|
@@ -336,61 +323,61 @@ async function Oe(e, t, n) {
|
|
|
336
323
|
}
|
|
337
324
|
//#endregion
|
|
338
325
|
//#region src/views/forms/renderer/member-field-options.ts
|
|
339
|
-
var
|
|
340
|
-
function
|
|
326
|
+
var je = "未知會員";
|
|
327
|
+
function Me(e) {
|
|
341
328
|
return {
|
|
342
329
|
id: e.memberId,
|
|
343
|
-
name: e.
|
|
330
|
+
name: t(e.name, e.email)
|
|
344
331
|
};
|
|
345
332
|
}
|
|
346
|
-
function
|
|
333
|
+
function Ne(e) {
|
|
347
334
|
return {
|
|
348
335
|
id: e,
|
|
349
|
-
name:
|
|
336
|
+
name: je,
|
|
350
337
|
unresolved: !0
|
|
351
338
|
};
|
|
352
339
|
}
|
|
353
|
-
function
|
|
340
|
+
function Pe(e, t) {
|
|
354
341
|
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);
|
|
355
342
|
return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
|
|
356
343
|
}
|
|
357
|
-
function
|
|
344
|
+
function Fe(e, t) {
|
|
358
345
|
let n = new Set(t.filter((e) => !e.unresolved).map((e) => e.id));
|
|
359
|
-
return
|
|
346
|
+
return U(e).filter((e) => !n.has(e));
|
|
360
347
|
}
|
|
361
|
-
function
|
|
362
|
-
return
|
|
348
|
+
function Ie(e, t) {
|
|
349
|
+
return U(e).map((e) => t.find((t) => t.id === e) ?? Ne(e));
|
|
363
350
|
}
|
|
364
|
-
function
|
|
351
|
+
function Le(e, t) {
|
|
365
352
|
if (e.length !== 0) return t ? e.map((e) => e.id) : e[0]?.id;
|
|
366
353
|
}
|
|
367
354
|
//#endregion
|
|
368
355
|
//#region src/views/forms/renderer/member-field.tsx
|
|
369
|
-
function
|
|
370
|
-
let [d, f] =
|
|
371
|
-
|
|
372
|
-
let e =
|
|
373
|
-
return e.length === 0 ? () => void 0 : (Q(e,
|
|
356
|
+
function Re({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, size: l, value: u }) {
|
|
357
|
+
let [d, f] = o([]), [p, m] = o([]), [h, g] = o(!1), _ = a(0), v = a(/* @__PURE__ */ new Set()), y = Fe(u, d).join("\n");
|
|
358
|
+
r(() => {
|
|
359
|
+
let e = ke(y ? y.split("\n") : [], v.current), t = !1;
|
|
360
|
+
return e.length === 0 ? () => void 0 : (Q(e, b).then(({ profiles: n, skippedIds: r }) => {
|
|
374
361
|
if (t) return;
|
|
375
|
-
let i = n.map(
|
|
376
|
-
a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) =>
|
|
362
|
+
let i = n.map(Me), a = e.filter((e) => !i.some((t) => t.id === e)).map(Ne);
|
|
363
|
+
a.filter((e) => !r.includes(e.id)).forEach((e) => v.current.add(e.id)), f((e) => Pe(e, [...i, ...a]));
|
|
377
364
|
}), () => {
|
|
378
365
|
t = !0;
|
|
379
366
|
});
|
|
380
|
-
}, [
|
|
367
|
+
}, [y]);
|
|
381
368
|
async function C(e) {
|
|
382
369
|
let t = _.current + 1;
|
|
383
370
|
_.current = t, g(!0);
|
|
384
371
|
try {
|
|
385
|
-
let n = (await
|
|
386
|
-
_.current === t && (m(n), f((e) =>
|
|
372
|
+
let n = (await x(e)).map(Me);
|
|
373
|
+
_.current === t && (m(n), f((e) => Pe(e, n)));
|
|
387
374
|
} catch {
|
|
388
375
|
_.current === t && m([]);
|
|
389
376
|
} finally {
|
|
390
377
|
_.current === t && g(!1);
|
|
391
378
|
}
|
|
392
379
|
}
|
|
393
|
-
let w =
|
|
380
|
+
let w = Ie(u, d), T = [...Pe(w, p)], E = {
|
|
394
381
|
asyncData: !0,
|
|
395
382
|
clearSearchText: !0,
|
|
396
383
|
disabled: c,
|
|
@@ -410,119 +397,119 @@ function Ie({ multiple: e, name: t, onChange: r, placeholder: s, readonly: c, si
|
|
|
410
397
|
e && (m([]), C(""));
|
|
411
398
|
},
|
|
412
399
|
options: T,
|
|
413
|
-
placeholder:
|
|
400
|
+
placeholder: i ?? "搜尋姓名或信箱",
|
|
414
401
|
readOnly: c,
|
|
415
402
|
searchDebounceTime: 300,
|
|
416
403
|
size: l
|
|
417
404
|
};
|
|
418
|
-
return e ? /* @__PURE__ */
|
|
405
|
+
return e ? /* @__PURE__ */ S(s, {
|
|
419
406
|
...E,
|
|
420
407
|
mode: "multiple",
|
|
421
|
-
onChange: (e) =>
|
|
408
|
+
onChange: (e) => n(Le(e, !0)),
|
|
422
409
|
value: [...w]
|
|
423
|
-
}) : /* @__PURE__ */
|
|
410
|
+
}) : /* @__PURE__ */ S(s, {
|
|
424
411
|
...E,
|
|
425
412
|
mode: "single",
|
|
426
|
-
onChange: (e) =>
|
|
413
|
+
onChange: (e) => n(Le(e ? [e] : [], !1)),
|
|
427
414
|
value: w[0] ?? null
|
|
428
415
|
});
|
|
429
416
|
}
|
|
430
417
|
//#endregion
|
|
431
418
|
//#region src/views/forms/renderer/FormRendererView.tsx
|
|
432
|
-
var
|
|
419
|
+
var ze = {
|
|
433
420
|
alignItems: "start",
|
|
434
421
|
display: "grid",
|
|
435
422
|
gap: 12,
|
|
436
423
|
gridTemplateColumns: "repeat(12, minmax(0, 1fr))"
|
|
437
|
-
},
|
|
424
|
+
}, Be = { gridColumn: "1 / -1" }, Ve = {
|
|
438
425
|
alignItems: "start",
|
|
439
426
|
display: "grid",
|
|
440
427
|
gap: 8,
|
|
441
428
|
minWidth: 0
|
|
442
|
-
},
|
|
429
|
+
}, He = {
|
|
443
430
|
minWidth: "100%",
|
|
444
431
|
width: "100%"
|
|
445
432
|
};
|
|
446
|
-
function
|
|
433
|
+
function Ue(e) {
|
|
447
434
|
e && (e.style.width = "100%");
|
|
448
435
|
}
|
|
449
|
-
function
|
|
450
|
-
let [y, b] =
|
|
436
|
+
function We({ dataSourceContext: e, dataSourceInitialValues: t, emptyText: n = "尚未建立欄位。", errors: s = {}, maxWidth: c, onChange: l, onDataSourceStateChange: u, onUploadAttachment: d, optionSnapshots: f, readonly: p = !1, schema: m, singleColumn: h = !1, uiSchema: g, value: _ }) {
|
|
437
|
+
let [y, b] = o(() => E(m.fields, _ ?? {})), x = i(() => E(m.fields, _ ?? y), [
|
|
451
438
|
y,
|
|
452
439
|
m.fields,
|
|
453
|
-
|
|
454
|
-
]), C =
|
|
440
|
+
_
|
|
441
|
+
]), C = a(x), w = i(() => de(m, g, x), [
|
|
455
442
|
m,
|
|
456
443
|
g,
|
|
457
|
-
|
|
444
|
+
x
|
|
458
445
|
]);
|
|
459
|
-
|
|
460
|
-
C.current =
|
|
461
|
-
}, [
|
|
462
|
-
b((e) =>
|
|
463
|
-
}, [m.fields,
|
|
464
|
-
function
|
|
446
|
+
r(() => {
|
|
447
|
+
C.current = x;
|
|
448
|
+
}, [x]), r(() => {
|
|
449
|
+
b((e) => E(m.fields, _ ?? e));
|
|
450
|
+
}, [m.fields, _]);
|
|
451
|
+
function T(e, t) {
|
|
465
452
|
let n = {
|
|
466
453
|
...C.current,
|
|
467
454
|
[e]: t
|
|
468
455
|
};
|
|
469
|
-
C.current = n,
|
|
456
|
+
C.current = n, _ || b(n), l?.(n);
|
|
470
457
|
}
|
|
471
|
-
return w.length ? /* @__PURE__ */
|
|
458
|
+
return w.length ? /* @__PURE__ */ S("div", {
|
|
472
459
|
style: {
|
|
473
|
-
...
|
|
460
|
+
...ze,
|
|
474
461
|
...h ? { width: "100%" } : {}
|
|
475
462
|
},
|
|
476
|
-
children: w.map((n) => /* @__PURE__ */
|
|
463
|
+
children: w.map((n) => /* @__PURE__ */ S(Ge, {
|
|
477
464
|
dataSourceContext: e,
|
|
478
465
|
dataSourceInitialValues: t,
|
|
479
466
|
field: n,
|
|
480
467
|
error: s[n.fieldKey] ?? null,
|
|
481
468
|
errors: s,
|
|
482
469
|
fields: m.fields,
|
|
483
|
-
onChange:
|
|
470
|
+
onChange: T,
|
|
484
471
|
onDataSourceStateChange: u,
|
|
485
472
|
onUploadAttachment: d,
|
|
486
473
|
optionSnapshots: f,
|
|
487
474
|
readonly: p,
|
|
488
475
|
schema: m,
|
|
489
476
|
style: {
|
|
490
|
-
...
|
|
491
|
-
gridColumn: `span ${h ? 12 :
|
|
492
|
-
...h && !
|
|
477
|
+
...Ve,
|
|
478
|
+
gridColumn: `span ${h ? 12 : dt(n, g)}`,
|
|
479
|
+
...h && !me(n) ? { maxWidth: c } : {}
|
|
493
480
|
},
|
|
494
|
-
value:
|
|
495
|
-
values:
|
|
481
|
+
value: x[n.fieldKey],
|
|
482
|
+
values: x,
|
|
496
483
|
uiSchema: g
|
|
497
484
|
}, n.fieldKey))
|
|
498
|
-
}) : /* @__PURE__ */
|
|
499
|
-
style:
|
|
500
|
-
children: /* @__PURE__ */
|
|
485
|
+
}) : /* @__PURE__ */ S("div", {
|
|
486
|
+
style: ze,
|
|
487
|
+
children: /* @__PURE__ */ S(v, {
|
|
501
488
|
color: "text-neutral",
|
|
502
|
-
style:
|
|
489
|
+
style: Be,
|
|
503
490
|
variant: "body",
|
|
504
|
-
children: m.fields.length > 0 ? "目前條件下沒有可填寫欄位。" :
|
|
491
|
+
children: m.fields.length > 0 ? "目前條件下沒有可填寫欄位。" : n
|
|
505
492
|
})
|
|
506
493
|
});
|
|
507
494
|
}
|
|
508
|
-
function
|
|
509
|
-
let b =
|
|
495
|
+
function Ge({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors: a, field: o, fields: s, onChange: l, onDataSourceStateChange: u, onUploadAttachment: d, optionSnapshots: f, readonly: p, schema: m, style: h, value: g, values: _, uiSchema: y }) {
|
|
496
|
+
let b = A(o, s, _), x = p || k(o, s, _), w = G({
|
|
510
497
|
context: t,
|
|
511
498
|
field: o,
|
|
512
|
-
formData:
|
|
513
|
-
initialFormData:
|
|
514
|
-
initialValue:
|
|
499
|
+
formData: _,
|
|
500
|
+
initialFormData: n,
|
|
501
|
+
initialValue: n?.[o.fieldKey],
|
|
515
502
|
optionSnapshots: f,
|
|
516
|
-
readonly:
|
|
503
|
+
readonly: x,
|
|
517
504
|
schema: m,
|
|
518
505
|
uiSchema: y
|
|
519
|
-
}), T =
|
|
506
|
+
}), T = K(w), E = JSON.stringify({
|
|
520
507
|
hasValue: w.hasValue,
|
|
521
508
|
invalidValues: w.invalidValues,
|
|
522
509
|
status: w.status
|
|
523
510
|
});
|
|
524
|
-
return
|
|
525
|
-
|
|
511
|
+
return r(() => {
|
|
512
|
+
B(o) && u?.(o.fieldKey, {
|
|
526
513
|
hasValue: w.hasValue,
|
|
527
514
|
invalidValues: w.invalidValues,
|
|
528
515
|
status: w.status
|
|
@@ -531,41 +518,41 @@ function Ue({ dataSourceContext: t, dataSourceInitialValues: r, error: i, errors
|
|
|
531
518
|
E,
|
|
532
519
|
o.fieldKey,
|
|
533
520
|
u
|
|
534
|
-
]), /* @__PURE__ */
|
|
521
|
+
]), /* @__PURE__ */ C("div", {
|
|
535
522
|
"data-form-field-key": o.fieldKey,
|
|
536
523
|
style: h,
|
|
537
524
|
children: [
|
|
538
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ S(e, {
|
|
539
526
|
label: o.label,
|
|
540
527
|
name: o.fieldKey,
|
|
541
528
|
required: b,
|
|
542
|
-
children:
|
|
529
|
+
children: me(o) ? /* @__PURE__ */ S(nt, {
|
|
543
530
|
dataSourceContext: t,
|
|
544
|
-
dataSourceInitialValues:
|
|
531
|
+
dataSourceInitialValues: n,
|
|
545
532
|
errors: a,
|
|
546
533
|
field: o,
|
|
547
534
|
onChange: l,
|
|
548
535
|
onDataSourceStateChange: u,
|
|
549
536
|
optionSnapshots: f,
|
|
550
|
-
readonly:
|
|
537
|
+
readonly: x,
|
|
551
538
|
schema: m,
|
|
552
539
|
uiSchema: y,
|
|
553
540
|
value: g,
|
|
554
|
-
values:
|
|
555
|
-
}) :
|
|
541
|
+
values: _
|
|
542
|
+
}) : ct(o, g, x, l, d, t, w)
|
|
556
543
|
}),
|
|
557
|
-
i ? /* @__PURE__ */
|
|
544
|
+
i ? /* @__PURE__ */ S(v, {
|
|
558
545
|
color: "text-error",
|
|
559
546
|
variant: "caption",
|
|
560
547
|
children: i
|
|
561
548
|
}) : null,
|
|
562
|
-
T ? /* @__PURE__ */
|
|
563
|
-
style:
|
|
564
|
-
children: [/* @__PURE__ */
|
|
549
|
+
T ? /* @__PURE__ */ C("div", {
|
|
550
|
+
style: Ye,
|
|
551
|
+
children: [/* @__PURE__ */ S(v, {
|
|
565
552
|
color: w.status === "INVALID" || w.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
566
553
|
variant: "caption",
|
|
567
554
|
children: T
|
|
568
|
-
}), w.status === "UNAVAILABLE" && w.canRetry ? /* @__PURE__ */
|
|
555
|
+
}), w.status === "UNAVAILABLE" && w.canRetry ? /* @__PURE__ */ S(c, {
|
|
569
556
|
onClick: w.retry,
|
|
570
557
|
size: "sub",
|
|
571
558
|
type: "button",
|
|
@@ -576,75 +563,75 @@ function Ue({ dataSourceContext: t, dataSourceInitialValues: r, error: i, errors
|
|
|
576
563
|
]
|
|
577
564
|
});
|
|
578
565
|
}
|
|
579
|
-
var
|
|
566
|
+
var Ke = "(另開新分頁)", qe = "另開新分頁", Je = {
|
|
580
567
|
color: "inherit",
|
|
581
568
|
textDecoration: "underline",
|
|
582
569
|
wordBreak: "break-all"
|
|
583
|
-
},
|
|
570
|
+
}, Ye = {
|
|
584
571
|
alignItems: "center",
|
|
585
572
|
display: "flex",
|
|
586
573
|
gap: 8
|
|
587
|
-
},
|
|
574
|
+
}, Xe = {
|
|
588
575
|
display: "grid",
|
|
589
576
|
gap: 8,
|
|
590
577
|
minWidth: 0,
|
|
591
578
|
width: "100%"
|
|
592
|
-
},
|
|
579
|
+
}, Ze = {
|
|
593
580
|
display: "flex",
|
|
594
581
|
justifyContent: "flex-start"
|
|
595
|
-
},
|
|
582
|
+
}, Qe = {
|
|
596
583
|
maxWidth: "100%",
|
|
597
584
|
overflowX: "auto"
|
|
598
|
-
},
|
|
585
|
+
}, $e = 160, et = 56, tt = {
|
|
599
586
|
display: "grid",
|
|
600
587
|
gap: 4,
|
|
601
588
|
minWidth: 0
|
|
602
589
|
};
|
|
603
|
-
function
|
|
604
|
-
let _ = I(
|
|
605
|
-
|
|
606
|
-
b.length !== _.length &&
|
|
590
|
+
function nt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
|
|
591
|
+
let _ = I(m), v = le(i), y = a(0), [b, x] = o(() => _.map(() => at(y)));
|
|
592
|
+
r(() => {
|
|
593
|
+
b.length !== _.length && x(_.map(() => at(y)));
|
|
607
594
|
}, [b.length, _.length]);
|
|
608
595
|
function E(e) {
|
|
609
|
-
|
|
596
|
+
s(i.fieldKey, e);
|
|
610
597
|
}
|
|
611
|
-
function
|
|
612
|
-
|
|
598
|
+
function ee() {
|
|
599
|
+
x([...b, at(y)]), E([..._, te(i.columns)]);
|
|
613
600
|
}
|
|
614
601
|
function D(e) {
|
|
615
|
-
|
|
602
|
+
x(b.filter((t, n) => n !== e)), E(_.filter((t, n) => n !== e));
|
|
616
603
|
}
|
|
617
604
|
function O(e, t, n) {
|
|
618
|
-
E(_.map((r, i) => i === e ?
|
|
605
|
+
E(_.map((r, i) => i === e ? ot(r, t, n) : r));
|
|
619
606
|
}
|
|
620
607
|
let k = _.map((e, t) => ({
|
|
621
608
|
...e,
|
|
622
609
|
index: t,
|
|
623
610
|
key: b[t] ?? `row-${t}`
|
|
624
|
-
})), A =
|
|
625
|
-
key:
|
|
626
|
-
render: (
|
|
627
|
-
column:
|
|
611
|
+
})), A = i.columns.map((r) => ({
|
|
612
|
+
key: r.fieldKey,
|
|
613
|
+
render: (a) => /* @__PURE__ */ S(rt, {
|
|
614
|
+
column: r,
|
|
628
615
|
dataSourceContext: e,
|
|
629
|
-
error:
|
|
630
|
-
fieldPath: `${
|
|
616
|
+
error: n[F(i.fieldKey, a.index, r.fieldKey)] ?? null,
|
|
617
|
+
fieldPath: `${i.fieldKey}.${r.fieldKey}`,
|
|
631
618
|
formData: g,
|
|
632
619
|
initialFormData: t,
|
|
633
|
-
initialRowValues:
|
|
634
|
-
onChange: (e) => O(
|
|
620
|
+
initialRowValues: it(t?.[i.fieldKey], a.index),
|
|
621
|
+
onChange: (e) => O(a.index, r.fieldKey, e),
|
|
635
622
|
onDataSourceStateChange: l,
|
|
636
623
|
optionSnapshots: u,
|
|
637
|
-
path: F(
|
|
624
|
+
path: F(i.fieldKey, a.index, r.fieldKey),
|
|
638
625
|
readonly: d,
|
|
639
|
-
rowValues: _[
|
|
626
|
+
rowValues: _[a.index] ?? {},
|
|
640
627
|
schema: f,
|
|
641
628
|
uiSchema: p
|
|
642
|
-
}, `${b[
|
|
643
|
-
title:
|
|
629
|
+
}, `${b[a.index] ?? a.index}-${r.fieldKey}`),
|
|
630
|
+
title: r.label || r.fieldKey
|
|
644
631
|
})), j = d ? void 0 : {
|
|
645
632
|
render: (e) => [{
|
|
646
633
|
disabled: () => _.length <= v.minRows,
|
|
647
|
-
icon:
|
|
634
|
+
icon: T,
|
|
648
635
|
iconType: "icon-only",
|
|
649
636
|
name: "刪除此列",
|
|
650
637
|
onClick: () => D(e.index),
|
|
@@ -652,13 +639,13 @@ function et({ dataSourceContext: e, dataSourceInitialValues: t, errors: r, field
|
|
|
652
639
|
}],
|
|
653
640
|
width: 56
|
|
654
641
|
};
|
|
655
|
-
return /* @__PURE__ */
|
|
656
|
-
style:
|
|
657
|
-
children: [/* @__PURE__ */
|
|
658
|
-
style:
|
|
659
|
-
children: /* @__PURE__ */
|
|
660
|
-
style: { minWidth:
|
|
661
|
-
children: /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ C("div", {
|
|
643
|
+
style: Xe,
|
|
644
|
+
children: [/* @__PURE__ */ S("div", {
|
|
645
|
+
style: Qe,
|
|
646
|
+
children: /* @__PURE__ */ S("div", {
|
|
647
|
+
style: { minWidth: i.columns.length * $e + (j ? et : 0) },
|
|
648
|
+
children: /* @__PURE__ */ S(h, {
|
|
662
649
|
...j ? { actions: j } : {},
|
|
663
650
|
columns: A,
|
|
664
651
|
dataSource: [...k],
|
|
@@ -667,45 +654,45 @@ function et({ dataSourceContext: e, dataSourceInitialValues: t, errors: r, field
|
|
|
667
654
|
size: "sub"
|
|
668
655
|
})
|
|
669
656
|
})
|
|
670
|
-
}), d ? null : /* @__PURE__ */
|
|
671
|
-
style:
|
|
672
|
-
children: /* @__PURE__ */
|
|
657
|
+
}), d ? null : /* @__PURE__ */ S("div", {
|
|
658
|
+
style: Ze,
|
|
659
|
+
children: /* @__PURE__ */ S(c, {
|
|
673
660
|
disabled: _.length >= v.maxRows,
|
|
674
|
-
icon:
|
|
661
|
+
icon: w,
|
|
675
662
|
iconType: "leading",
|
|
676
|
-
onClick:
|
|
663
|
+
onClick: ee,
|
|
677
664
|
size: "sub",
|
|
678
665
|
type: "button",
|
|
679
666
|
variant: "base-secondary",
|
|
680
|
-
children:
|
|
667
|
+
children: i.addRowLabel || "新增一列"
|
|
681
668
|
})
|
|
682
669
|
})]
|
|
683
670
|
});
|
|
684
671
|
}
|
|
685
|
-
function
|
|
686
|
-
let
|
|
672
|
+
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 }) {
|
|
673
|
+
let _ = st(m, e.fieldKey), y = G({
|
|
687
674
|
context: t,
|
|
688
675
|
field: e,
|
|
689
676
|
fieldPath: i,
|
|
690
677
|
formData: a,
|
|
691
678
|
initialFormData: o,
|
|
692
|
-
initialValue:
|
|
679
|
+
initialValue: s ? st(s, e.fieldKey) : void 0,
|
|
693
680
|
optionSnapshots: d,
|
|
694
681
|
readonly: p,
|
|
695
682
|
row: {
|
|
696
|
-
initialValues:
|
|
683
|
+
initialValues: s,
|
|
697
684
|
values: m
|
|
698
685
|
},
|
|
699
686
|
schema: h,
|
|
700
687
|
snapshotKey: f,
|
|
701
688
|
uiSchema: g
|
|
702
|
-
}), b =
|
|
689
|
+
}), b = K(y), x = JSON.stringify({
|
|
703
690
|
hasValue: y.hasValue,
|
|
704
691
|
invalidValues: y.invalidValues,
|
|
705
692
|
status: y.status
|
|
706
693
|
});
|
|
707
|
-
return
|
|
708
|
-
if (
|
|
694
|
+
return r(() => {
|
|
695
|
+
if (B(e)) return u?.(f, {
|
|
709
696
|
hasValue: y.hasValue,
|
|
710
697
|
invalidValues: y.invalidValues,
|
|
711
698
|
status: y.status
|
|
@@ -719,24 +706,24 @@ function tt({ column: e, dataSourceContext: t, error: r, fieldPath: i, formData:
|
|
|
719
706
|
}, [
|
|
720
707
|
u,
|
|
721
708
|
f,
|
|
722
|
-
|
|
723
|
-
]), /* @__PURE__ */
|
|
709
|
+
x
|
|
710
|
+
]), /* @__PURE__ */ C("div", {
|
|
724
711
|
"data-form-field-key": f,
|
|
725
|
-
style:
|
|
712
|
+
style: tt,
|
|
726
713
|
children: [
|
|
727
|
-
|
|
728
|
-
|
|
714
|
+
ct(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
|
|
715
|
+
n ? /* @__PURE__ */ S(v, {
|
|
729
716
|
color: "text-error",
|
|
730
717
|
variant: "caption",
|
|
731
|
-
children:
|
|
718
|
+
children: n
|
|
732
719
|
}) : null,
|
|
733
|
-
b ? /* @__PURE__ */
|
|
734
|
-
style:
|
|
735
|
-
children: [/* @__PURE__ */
|
|
720
|
+
b ? /* @__PURE__ */ C("div", {
|
|
721
|
+
style: Ye,
|
|
722
|
+
children: [/* @__PURE__ */ S(v, {
|
|
736
723
|
color: y.status === "INVALID" || y.status === "UNAVAILABLE" ? "text-error" : "text-neutral",
|
|
737
724
|
variant: "caption",
|
|
738
725
|
children: b
|
|
739
|
-
}), y.status === "UNAVAILABLE" && y.canRetry ? /* @__PURE__ */
|
|
726
|
+
}), y.status === "UNAVAILABLE" && y.canRetry ? /* @__PURE__ */ S(c, {
|
|
740
727
|
onClick: y.retry,
|
|
741
728
|
size: "sub",
|
|
742
729
|
type: "button",
|
|
@@ -747,52 +734,52 @@ function tt({ column: e, dataSourceContext: t, error: r, fieldPath: i, formData:
|
|
|
747
734
|
]
|
|
748
735
|
});
|
|
749
736
|
}
|
|
750
|
-
function
|
|
737
|
+
function it(e, t) {
|
|
751
738
|
return I(e)[t];
|
|
752
739
|
}
|
|
753
|
-
function
|
|
740
|
+
function at(e) {
|
|
754
741
|
return e.current += 1, `table-row-${e.current}`;
|
|
755
742
|
}
|
|
756
|
-
function
|
|
757
|
-
return n === void 0 || !
|
|
743
|
+
function ot(e, t, n) {
|
|
744
|
+
return n === void 0 || !V(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
|
|
758
745
|
...e,
|
|
759
746
|
[t]: n
|
|
760
747
|
};
|
|
761
748
|
}
|
|
762
|
-
function
|
|
749
|
+
function st(e, t) {
|
|
763
750
|
if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
764
751
|
}
|
|
765
|
-
function
|
|
766
|
-
return
|
|
752
|
+
function ct(e, t, n, r, i, a, o, s = "main") {
|
|
753
|
+
return B(e) ? ut(e, t, n, r, a, o, s) : lt(e, t, n, r, i, s);
|
|
767
754
|
}
|
|
768
|
-
function
|
|
769
|
-
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ?
|
|
770
|
-
if (o) return /* @__PURE__ */
|
|
755
|
+
function lt(e, t, n, r, i, a = "main") {
|
|
756
|
+
let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? Ee(t) : null;
|
|
757
|
+
if (o) return /* @__PURE__ */ S(v, {
|
|
771
758
|
color: "text-brand",
|
|
772
759
|
component: "span",
|
|
773
760
|
variant: "body",
|
|
774
|
-
children: /* @__PURE__ */
|
|
761
|
+
children: /* @__PURE__ */ S("a", {
|
|
775
762
|
href: o.href,
|
|
776
|
-
style:
|
|
763
|
+
style: Je,
|
|
777
764
|
...o.external ? {
|
|
778
|
-
"aria-label": `${o.href}${
|
|
765
|
+
"aria-label": `${o.href}${Ke}`,
|
|
779
766
|
rel: "noopener noreferrer",
|
|
780
767
|
target: "_blank",
|
|
781
|
-
title:
|
|
768
|
+
title: qe
|
|
782
769
|
} : {},
|
|
783
770
|
children: o.href
|
|
784
771
|
})
|
|
785
772
|
});
|
|
786
|
-
if (e.type === "textarea") return /* @__PURE__ */
|
|
773
|
+
if (e.type === "textarea") return /* @__PURE__ */ S(g, {
|
|
787
774
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
788
775
|
placeholder: e.placeholder ?? "請輸入多行文字",
|
|
789
776
|
readOnly: n,
|
|
790
|
-
ref:
|
|
777
|
+
ref: Ue,
|
|
791
778
|
rows: 3,
|
|
792
|
-
style:
|
|
793
|
-
value:
|
|
779
|
+
style: He,
|
|
780
|
+
value: $(t)
|
|
794
781
|
});
|
|
795
|
-
if (e.type === "boolean") return /* @__PURE__ */
|
|
782
|
+
if (e.type === "boolean") return /* @__PURE__ */ S(_, {
|
|
796
783
|
checked: t === !0,
|
|
797
784
|
disabled: n,
|
|
798
785
|
label: "啟用",
|
|
@@ -801,28 +788,28 @@ function st(e, t, n, r, i, a = "main") {
|
|
|
801
788
|
});
|
|
802
789
|
if (pe(e) && e.type === "checkbox") {
|
|
803
790
|
let i = e.options.map(N);
|
|
804
|
-
return /* @__PURE__ */
|
|
791
|
+
return /* @__PURE__ */ S(m, {
|
|
805
792
|
mode: "multiple",
|
|
806
793
|
onChange: (t) => r(e.fieldKey, t?.length ? t.map((e) => e.id) : void 0),
|
|
807
794
|
options: i,
|
|
808
795
|
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
809
796
|
readOnly: n,
|
|
810
797
|
size: a,
|
|
811
|
-
value: i.filter((e) =>
|
|
798
|
+
value: i.filter((e) => ft(t).includes(e.id))
|
|
812
799
|
});
|
|
813
800
|
}
|
|
814
801
|
if (pe(e)) {
|
|
815
802
|
let i = e.options.map(N);
|
|
816
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ S(m, {
|
|
817
804
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
818
805
|
options: i,
|
|
819
806
|
placeholder: e.placeholder ?? "請選擇",
|
|
820
807
|
readOnly: n,
|
|
821
808
|
size: a,
|
|
822
|
-
value:
|
|
809
|
+
value: R(i, $(t))
|
|
823
810
|
});
|
|
824
811
|
}
|
|
825
|
-
return e.type === "member" ? /* @__PURE__ */
|
|
812
|
+
return e.type === "member" ? /* @__PURE__ */ S(Re, {
|
|
826
813
|
multiple: e.multiple === !0,
|
|
827
814
|
name: e.fieldKey,
|
|
828
815
|
onChange: (t) => r(e.fieldKey, t),
|
|
@@ -830,7 +817,7 @@ function st(e, t, n, r, i, a = "main") {
|
|
|
830
817
|
readonly: n,
|
|
831
818
|
size: a,
|
|
832
819
|
value: t
|
|
833
|
-
}) : e.type === "file_upload" ? /* @__PURE__ */
|
|
820
|
+
}) : e.type === "file_upload" ? /* @__PURE__ */ S(y, {
|
|
834
821
|
accept: e.acceptedMimeTypes?.join(","),
|
|
835
822
|
disabled: n,
|
|
836
823
|
maxFiles: e.maxFiles,
|
|
@@ -844,50 +831,50 @@ function st(e, t, n, r, i, a = "main") {
|
|
|
844
831
|
status: "done"
|
|
845
832
|
}))),
|
|
846
833
|
size: "sub"
|
|
847
|
-
}) : e.type === "date" ? /* @__PURE__ */
|
|
834
|
+
}) : e.type === "date" ? /* @__PURE__ */ S(u, {
|
|
848
835
|
format: "YYYY-MM-DD",
|
|
849
836
|
fullWidth: !0,
|
|
850
|
-
onChange: (t) => r(e.fieldKey,
|
|
851
|
-
placeholder: e.placeholder ??
|
|
837
|
+
onChange: (t) => r(e.fieldKey, D(t)),
|
|
838
|
+
placeholder: e.placeholder ?? mt(e.type),
|
|
852
839
|
readOnly: n,
|
|
853
|
-
value:
|
|
854
|
-
}) : e.type === "datetime" ? /* @__PURE__ */
|
|
840
|
+
value: ie(t)
|
|
841
|
+
}) : e.type === "datetime" ? /* @__PURE__ */ S(d, {
|
|
855
842
|
formatDate: "YYYY-MM-DD",
|
|
856
843
|
formatTime: "HH:mm",
|
|
857
844
|
fullWidth: !0,
|
|
858
845
|
hideSecond: !0,
|
|
859
|
-
onChange: (t) => r(e.fieldKey,
|
|
846
|
+
onChange: (t) => r(e.fieldKey, O(t)),
|
|
860
847
|
placeholderLeft: "選擇日期",
|
|
861
848
|
placeholderRight: "選擇時間",
|
|
862
849
|
readOnly: n,
|
|
863
|
-
value:
|
|
864
|
-
}) : e.type === "number" || e.type === "money" ? /* @__PURE__ */
|
|
850
|
+
value: ie(t)
|
|
851
|
+
}) : e.type === "number" || e.type === "money" ? /* @__PURE__ */ S(f, {
|
|
865
852
|
fullWidth: !0,
|
|
866
853
|
max: e.maximum,
|
|
867
854
|
min: e.minimum,
|
|
868
855
|
size: a,
|
|
869
|
-
onChange: (t) => r(e.fieldKey,
|
|
856
|
+
onChange: (t) => r(e.fieldKey, ee(M(t.target.value), {
|
|
870
857
|
max: e.maximum,
|
|
871
858
|
min: e.minimum
|
|
872
859
|
})),
|
|
873
|
-
placeholder: e.placeholder ??
|
|
860
|
+
placeholder: e.placeholder ?? mt(e.type),
|
|
874
861
|
...n ? { readonly: !0 } : {},
|
|
875
862
|
showSpinner: !0,
|
|
876
|
-
value:
|
|
863
|
+
value: pt(t),
|
|
877
864
|
variant: "measure"
|
|
878
|
-
}) : /* @__PURE__ */
|
|
865
|
+
}) : /* @__PURE__ */ S(f, {
|
|
879
866
|
fullWidth: !0,
|
|
880
867
|
onChange: (t) => r(e.fieldKey, t.target.value),
|
|
881
|
-
placeholder: e.placeholder ??
|
|
868
|
+
placeholder: e.placeholder ?? mt(e.type),
|
|
882
869
|
...n ? { readonly: !0 } : {},
|
|
883
870
|
size: a,
|
|
884
|
-
value:
|
|
871
|
+
value: $(t),
|
|
885
872
|
variant: "base"
|
|
886
873
|
});
|
|
887
874
|
}
|
|
888
|
-
function
|
|
889
|
-
let
|
|
890
|
-
return e.type === "autocomplete" ?
|
|
875
|
+
function ut(e, t, n, r, i, a, o = "main") {
|
|
876
|
+
let c = a.options.map(N), u = z(t, a.options).map(N), d = a.status === "LOADING", f = a.status === "WAITING_FOR_DEPENDENCIES", h = !!i && !n, g = n || f, _ = n;
|
|
877
|
+
return e.type === "autocomplete" ? H(e) === "multiple" ? /* @__PURE__ */ S(s, {
|
|
891
878
|
asyncData: h,
|
|
892
879
|
clearSearchText: !0,
|
|
893
880
|
disabled: _,
|
|
@@ -898,13 +885,13 @@ function ct(e, t, n, r, i, a, s = "main") {
|
|
|
898
885
|
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
899
886
|
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
900
887
|
onSearch: h ? a.onSearch : void 0,
|
|
901
|
-
options:
|
|
888
|
+
options: c,
|
|
902
889
|
placeholder: e.placeholder ?? "請輸入或選擇",
|
|
903
890
|
readOnly: n,
|
|
904
891
|
searchDebounceTime: 300,
|
|
905
|
-
size:
|
|
892
|
+
size: o,
|
|
906
893
|
value: u
|
|
907
|
-
}) : /* @__PURE__ */
|
|
894
|
+
}) : /* @__PURE__ */ S(s, {
|
|
908
895
|
asyncData: h,
|
|
909
896
|
clearSearchText: !0,
|
|
910
897
|
disabled: _,
|
|
@@ -915,67 +902,67 @@ function ct(e, t, n, r, i, a, s = "main") {
|
|
|
915
902
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
916
903
|
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
917
904
|
onSearch: h ? a.onSearch : void 0,
|
|
918
|
-
options:
|
|
905
|
+
options: c,
|
|
919
906
|
placeholder: e.placeholder ?? "請輸入或選擇",
|
|
920
907
|
readOnly: n,
|
|
921
908
|
searchDebounceTime: 300,
|
|
922
|
-
size:
|
|
909
|
+
size: o,
|
|
923
910
|
value: u[0] ?? null
|
|
924
|
-
}) : e.type === "radio" ? /* @__PURE__ */
|
|
911
|
+
}) : e.type === "radio" ? /* @__PURE__ */ S(p, {
|
|
925
912
|
disabled: g,
|
|
926
913
|
name: e.fieldKey,
|
|
927
914
|
onChange: (t) => r(e.fieldKey, t.target.value || void 0),
|
|
928
|
-
options:
|
|
929
|
-
value:
|
|
930
|
-
}) : e.type === "checkbox" ? /* @__PURE__ */
|
|
915
|
+
options: c,
|
|
916
|
+
value: $(t)
|
|
917
|
+
}) : e.type === "checkbox" ? /* @__PURE__ */ S(l, {
|
|
931
918
|
disabled: g,
|
|
932
919
|
name: e.fieldKey,
|
|
933
920
|
onChange: (t) => r(e.fieldKey, t.target.values.length ? t.target.values : void 0),
|
|
934
|
-
options:
|
|
921
|
+
options: c.map((e) => ({
|
|
935
922
|
label: e.name,
|
|
936
923
|
value: e.id
|
|
937
924
|
})),
|
|
938
|
-
value: [...
|
|
939
|
-
}) :
|
|
925
|
+
value: [...ft(t)]
|
|
926
|
+
}) : H(e) === "multiple" ? /* @__PURE__ */ S(m, {
|
|
940
927
|
disabled: g,
|
|
941
928
|
loading: d,
|
|
942
929
|
mode: "multiple",
|
|
943
930
|
onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
|
|
944
931
|
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
945
|
-
options:
|
|
932
|
+
options: c,
|
|
946
933
|
placeholder: e.placeholder ?? "請選擇一或多個選項",
|
|
947
934
|
readOnly: n,
|
|
948
|
-
size:
|
|
935
|
+
size: o,
|
|
949
936
|
value: u
|
|
950
|
-
}) : /* @__PURE__ */
|
|
937
|
+
}) : /* @__PURE__ */ S(m, {
|
|
951
938
|
disabled: g,
|
|
952
939
|
loading: d,
|
|
953
940
|
onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
|
|
954
941
|
onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
|
|
955
|
-
options:
|
|
942
|
+
options: c,
|
|
956
943
|
placeholder: e.placeholder ?? "請選擇",
|
|
957
944
|
readOnly: n,
|
|
958
|
-
size:
|
|
945
|
+
size: o,
|
|
959
946
|
value: u[0] ?? null
|
|
960
947
|
});
|
|
961
948
|
}
|
|
962
|
-
function
|
|
949
|
+
function dt(e, t) {
|
|
963
950
|
return {
|
|
964
951
|
FULL: 12,
|
|
965
952
|
HALF: 6,
|
|
966
953
|
THIRD: 4
|
|
967
954
|
}[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
|
|
968
955
|
}
|
|
969
|
-
function
|
|
956
|
+
function $(e) {
|
|
970
957
|
return typeof e == "string" ? e : "";
|
|
971
958
|
}
|
|
972
|
-
function
|
|
959
|
+
function ft(e) {
|
|
973
960
|
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
974
961
|
}
|
|
975
|
-
function
|
|
962
|
+
function pt(e) {
|
|
976
963
|
return typeof e == "number" ? String(e) : "";
|
|
977
964
|
}
|
|
978
|
-
function
|
|
965
|
+
function mt(e) {
|
|
979
966
|
return {
|
|
980
967
|
boolean: "",
|
|
981
968
|
autocomplete: "請輸入或選擇",
|
|
@@ -994,6 +981,6 @@ function pt(e) {
|
|
|
994
981
|
}[e];
|
|
995
982
|
}
|
|
996
983
|
//#endregion
|
|
997
|
-
export {
|
|
984
|
+
export { K as a, q as i, ke as n, J as o, Q as r, G as s, We as t };
|
|
998
985
|
|
|
999
|
-
//# sourceMappingURL=FormRendererView-
|
|
986
|
+
//# sourceMappingURL=FormRendererView-cZGOOjU5.js.map
|