@rytass/bpm-core-react 0.7.7 → 0.9.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 +121 -0
- package/README.md +18 -2
- package/dist/chunks/FormBuilderView-BPLwAJGv.cjs +3 -0
- package/dist/chunks/FormBuilderView-BPLwAJGv.cjs.map +1 -0
- package/dist/chunks/FormBuilderView-Do9-MIAe.js +1477 -0
- package/dist/chunks/FormBuilderView-Do9-MIAe.js.map +1 -0
- package/dist/chunks/FormRendererView-C5POZbWz.js +492 -0
- package/dist/chunks/FormRendererView-C5POZbWz.js.map +1 -0
- package/dist/chunks/FormRendererView-DNtNodNl.cjs +2 -0
- package/dist/chunks/FormRendererView-DNtNodNl.cjs.map +1 -0
- package/dist/chunks/{approval-instance-list-page-YZcGGDD8.js → approval-instance-list-page-BjX2kaoF.js} +56 -54
- package/dist/chunks/approval-instance-list-page-BjX2kaoF.js.map +1 -0
- package/dist/chunks/approval-instance-list-page-C408vxE2.cjs +2 -0
- package/dist/chunks/approval-instance-list-page-C408vxE2.cjs.map +1 -0
- package/dist/chunks/{categories-DBPoSrsi.js → categories-DGlxuC6X.js} +5 -5
- package/dist/chunks/{categories-DBPoSrsi.js.map → categories-DGlxuC6X.js.map} +1 -1
- package/dist/chunks/{categories-B6QZKZRt.cjs → categories-DUfldZ_9.cjs} +2 -2
- package/dist/chunks/{categories-B6QZKZRt.cjs.map → categories-DUfldZ_9.cjs.map} +1 -1
- package/dist/chunks/compose-CULMDsLS.cjs +2 -0
- package/dist/chunks/compose-CULMDsLS.cjs.map +1 -0
- package/dist/chunks/{compose-B1quUa7y.js → compose-DJBlA5PD.js} +60 -58
- package/dist/chunks/compose-DJBlA5PD.js.map +1 -0
- package/dist/chunks/{delegations-DDEk-WI6.cjs → delegations-CGj-tZNO.cjs} +2 -2
- package/dist/chunks/{delegations-DDEk-WI6.cjs.map → delegations-CGj-tZNO.cjs.map} +1 -1
- package/dist/chunks/{delegations-iVnRi3QE.js → delegations-DLEEFBlH.js} +231 -231
- package/dist/chunks/{delegations-iVnRi3QE.js.map → delegations-DLEEFBlH.js.map} +1 -1
- package/dist/chunks/{delegations-ZNtodFaD.js → delegations-DqMpI_Nk.js} +168 -167
- package/dist/chunks/delegations-DqMpI_Nk.js.map +1 -0
- package/dist/chunks/delegations-kbMOSEif.cjs +2 -0
- package/dist/chunks/delegations-kbMOSEif.cjs.map +1 -0
- package/dist/chunks/designer-BszXJ5RO.js +3038 -0
- package/dist/chunks/designer-BszXJ5RO.js.map +1 -0
- package/dist/chunks/designer-CmqAU92b.cjs +65 -0
- package/dist/chunks/designer-CmqAU92b.cjs.map +1 -0
- package/dist/chunks/detail-CDexqBoU.cjs +2 -0
- package/dist/chunks/detail-CDexqBoU.cjs.map +1 -0
- package/dist/chunks/{detail-fg8MTwuH.js → detail-DAak2OXS.js} +737 -653
- package/dist/chunks/detail-DAak2OXS.js.map +1 -0
- package/dist/chunks/notifications--hwl-DR0.cjs +2 -0
- package/dist/chunks/{notifications-BKs4--96.cjs.map → notifications--hwl-DR0.cjs.map} +1 -1
- package/dist/chunks/{notifications-CSulztkU.js → notifications-DJ5wzCye.js} +7 -7
- package/dist/chunks/{notifications-CSulztkU.js.map → notifications-DJ5wzCye.js.map} +1 -1
- package/dist/chunks/{orgs-CrNxqlwp.js → orgs-DytLvZ_X.js} +243 -241
- package/dist/chunks/{orgs-CrNxqlwp.js.map → orgs-DytLvZ_X.js.map} +1 -1
- package/dist/chunks/orgs-Ni22buHs.cjs +2 -0
- package/dist/chunks/orgs-Ni22buHs.cjs.map +1 -0
- package/dist/chunks/providers-DEqcuXw9.js +506 -0
- package/dist/chunks/providers-DEqcuXw9.js.map +1 -0
- package/dist/chunks/providers-D_zTbkQH.cjs +2 -0
- package/dist/chunks/providers-D_zTbkQH.cjs.map +1 -0
- package/dist/chunks/{users-qghSMtLn.cjs → users-0HqlM_VQ.cjs} +2 -2
- package/dist/chunks/{users-qghSMtLn.cjs.map → users-0HqlM_VQ.cjs.map} +1 -1
- package/dist/chunks/{users-CUY139DF.js → users-FWrb3ehW.js} +5 -5
- package/dist/chunks/{users-CUY139DF.js.map → users-FWrb3ehW.js.map} +1 -1
- package/dist/components/notification-drawer.d.ts +4 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -428
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +16 -15
- package/dist/next/index.js.map +1 -1
- package/dist/pages/admin/delegations/index.cjs +1 -1
- package/dist/pages/admin/delegations/index.js +1 -1
- package/dist/pages/admin/orgs/index.cjs +1 -1
- package/dist/pages/admin/orgs/index.js +1 -1
- package/dist/pages/admin/users/index.cjs +1 -1
- package/dist/pages/admin/users/index.js +1 -1
- package/dist/pages/delegations/index.cjs +1 -1
- package/dist/pages/delegations/index.js +1 -1
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/settings/notifications/index.cjs +1 -1
- package/dist/pages/settings/notifications/index.js +1 -1
- package/dist/pages/templates/categories/index.cjs +1 -1
- package/dist/pages/templates/categories/index.js +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/views/admin/delegations/index.cjs +1 -1
- package/dist/views/admin/delegations/index.js +1 -1
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.js +3 -3
- package/dist/views/admin/orgs/index.cjs +1 -1
- package/dist/views/admin/orgs/index.js +1 -1
- package/dist/views/admin/users/index.cjs +1 -1
- package/dist/views/admin/users/index.js +1 -1
- package/dist/views/cc/index.cjs +1 -1
- package/dist/views/cc/index.js +1 -1
- package/dist/views/delegations/index.cjs +1 -1
- package/dist/views/delegations/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/renderer/FormRendererView.d.ts +7 -2
- package/dist/views/forms/renderer/form-data-source-field.d.ts +34 -0
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.d.ts +1 -0
- package/dist/views/forms/renderer/index.js +2 -2
- 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.ts +4 -1
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +5 -1
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.cjs.map +1 -1
- package/dist/views/instances/new/index.js +105 -86
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/search/index.cjs +1 -1
- package/dist/views/search/index.js +1 -1
- package/dist/views/sent/index.cjs +1 -1
- package/dist/views/sent/index.js +1 -1
- package/dist/views/settings/index.cjs +1 -1
- package/dist/views/settings/index.js +1 -1
- package/dist/views/settings/notifications/index.cjs +1 -1
- package/dist/views/settings/notifications/index.js +1 -1
- package/dist/views/templates/categories/index.cjs +1 -1
- package/dist/views/templates/categories/index.js +1 -1
- package/dist/views/templates/compose/TemplateComposeWizardView.d.ts +3 -2
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/dist/views/templates/index.cjs +1 -1
- package/dist/views/templates/index.cjs.map +1 -1
- package/dist/views/templates/index.js +153 -112
- package/dist/views/templates/index.js.map +1 -1
- package/package.json +41 -5
- package/dist/chunks/FormBuilderView-B_KGPjlp.cjs +0 -3
- package/dist/chunks/FormBuilderView-B_KGPjlp.cjs.map +0 -1
- package/dist/chunks/FormBuilderView-D8DrQOXD.js +0 -1090
- package/dist/chunks/FormBuilderView-D8DrQOXD.js.map +0 -1
- package/dist/chunks/FormRendererView-BwVsH2eX.cjs +0 -2
- package/dist/chunks/FormRendererView-BwVsH2eX.cjs.map +0 -1
- package/dist/chunks/FormRendererView-DrHsuSVo.js +0 -220
- package/dist/chunks/FormRendererView-DrHsuSVo.js.map +0 -1
- package/dist/chunks/approval-instance-list-page-BMUKxzcz.cjs +0 -2
- package/dist/chunks/approval-instance-list-page-BMUKxzcz.cjs.map +0 -1
- package/dist/chunks/approval-instance-list-page-YZcGGDD8.js.map +0 -1
- package/dist/chunks/compose-B1quUa7y.js.map +0 -1
- package/dist/chunks/compose-B6nevcwq.cjs +0 -2
- package/dist/chunks/compose-B6nevcwq.cjs.map +0 -1
- package/dist/chunks/delegations-C2wLWsDQ.cjs +0 -2
- package/dist/chunks/delegations-C2wLWsDQ.cjs.map +0 -1
- package/dist/chunks/delegations-ZNtodFaD.js.map +0 -1
- package/dist/chunks/designer-BLfz5Dk9.js +0 -2594
- package/dist/chunks/designer-BLfz5Dk9.js.map +0 -1
- package/dist/chunks/designer-DP002lt7.cjs +0 -65
- package/dist/chunks/designer-DP002lt7.cjs.map +0 -1
- package/dist/chunks/detail-KEmfpCtt.cjs +0 -2
- package/dist/chunks/detail-KEmfpCtt.cjs.map +0 -1
- package/dist/chunks/detail-fg8MTwuH.js.map +0 -1
- package/dist/chunks/notifications-BKs4--96.cjs +0 -2
- package/dist/chunks/orgs-iNJ0QEcK.cjs +0 -2
- package/dist/chunks/orgs-iNJ0QEcK.cjs.map +0 -1
|
@@ -0,0 +1,3038 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as e } from "./router-adapter-DftlFTOd.js";
|
|
3
|
+
import { r as t } from "./routes-config-RBYQtUd0.js";
|
|
4
|
+
import { t as n } from "./bpm-form-field-Cao0rMol.js";
|
|
5
|
+
import { a as r, n as i, o as a, r as o } from "./admin-pickers-DLlG_1du.js";
|
|
6
|
+
import '../style.css';/* empty css */
|
|
7
|
+
import { t as s } from "./FormBuilderView-Do9-MIAe.js";
|
|
8
|
+
import { Fragment as c, useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
9
|
+
import { AutoComplete as m, Button as h, Icon as g, Input as _, Modal as v, PageHeader as ee, Section as te, SectionGroup as ne, Select as y, Textarea as b, Toggle as x, Typography as S } from "@mezzanine-ui/react";
|
|
10
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
11
|
+
import re from "@mezzanine-ui/react/Drawer";
|
|
12
|
+
import ie from "@mezzanine-ui/react/ContentHeader";
|
|
13
|
+
import { CheckedIcon as ae, DotGridIcon as oe, EyeIcon as se, FilterIcon as ce, MailIcon as le, SaveIcon as ue, TrashIcon as de, UserIcon as fe } from "@mezzanine-ui/icons";
|
|
14
|
+
import { DefaultChatTransport as pe, getToolName as me, isToolUIPart as he, lastAssistantMessageIsCompleteWithToolCalls as ge } from "ai";
|
|
15
|
+
import { WORKFLOW_TOOLSET as _e, applyWorkflowCommand as E, applyWorkflowMacroCommand as ve, executeWorkflowTool as ye, readWorkflowSnapshot as be } from "@rytass/bpm-core-shared";
|
|
16
|
+
import { readFormBuilder as xe, readFormSchemaLintMessage as Se } from "@rytass/bpm-core-client/form";
|
|
17
|
+
import { isFormStaticOptionFieldDefinition as Ce } from "@rytass/bpm-core-shared/form";
|
|
18
|
+
import { readOrganizationDashboard as we } from "@rytass/bpm-core-client/organization";
|
|
19
|
+
import { Background as Te, ConnectionMode as Ee, ControlButton as De, Controls as Oe, Handle as ke, MiniMap as Ae, Panel as je, Position as D, ReactFlow as Me, applyNodeChanges as Ne, getViewportForBounds as Pe } from "@xyflow/react";
|
|
20
|
+
import * as Fe from "dagre";
|
|
21
|
+
import { composeApprovalTemplateWithForm as Ie, dryRunApprovalWorkflow as Le, forkApprovalTemplate as Re, publishApprovalTemplateVersion as ze, readTemplateDesigner as Be, resolveMemberOptions as Ve, searchMemberOptions as He, searchPublishedFormVersionOptions as Ue, updateApprovalTemplateDraft as We } from "@rytass/bpm-core-client/template";
|
|
22
|
+
import { useChat as Ge } from "@ai-sdk/react";
|
|
23
|
+
import { DEFAULT_QUORUM_THRESHOLD as Ke, DEFAULT_SLA_CONFIG as qe, SLA_CALENDAR_MODE_OPTIONS as Je, SLA_DURATION_UNIT_OPTIONS as Ye, SLA_TIMEOUT_ACTION_OPTIONS as Xe, composeQuorumThreshold as Ze, composeSlaDuration as Qe, isDecisionPolicyUnsatisfiable as $e, readDesignTimeApproverCount as et, readSlaDurationParts as tt } from "@rytass/bpm-core-shared/workflow-graph";
|
|
24
|
+
//#region src/views/templates/designer/use-workflow-designer-controller.ts
|
|
25
|
+
function nt({ directory: e, initialState: t, layout: n, onLayout: r }) {
|
|
26
|
+
let [i, a] = p(t), o = f(t), s = f(e);
|
|
27
|
+
s.current = e;
|
|
28
|
+
let c = l((e) => {
|
|
29
|
+
if (!e.changed && !e.error) return e;
|
|
30
|
+
let t = e.effects.layout ? n(e.state.definition) : e.state.definition, i = {
|
|
31
|
+
...e.state,
|
|
32
|
+
definition: t
|
|
33
|
+
};
|
|
34
|
+
return o.current = i, a(i), e.effects.layout && r?.(t), {
|
|
35
|
+
...e,
|
|
36
|
+
state: i
|
|
37
|
+
};
|
|
38
|
+
}, [n, r]), u = l((e) => c(E(o.current, e)), [c]), m = l((e) => c(ve(o.current, e)), [c]), h = l(async (e, t) => {
|
|
39
|
+
let n = await ye(o.current, e, t, { directory: s.current });
|
|
40
|
+
if (n.ok && (n.kind === "mutation" || n.kind === "macro")) {
|
|
41
|
+
let e = c(n.result);
|
|
42
|
+
return {
|
|
43
|
+
...n,
|
|
44
|
+
result: e,
|
|
45
|
+
snapshot: be(e.state)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return n;
|
|
49
|
+
}, [c]), g = l((e) => {
|
|
50
|
+
let t = typeof e == "function" ? e(o.current) : e;
|
|
51
|
+
o.current = t, a(t);
|
|
52
|
+
}, []), _ = l(() => o.current, []), v = d(() => be(i), [i]);
|
|
53
|
+
return d(() => ({
|
|
54
|
+
dispatch: u,
|
|
55
|
+
dispatchMacro: m,
|
|
56
|
+
executeTool: h,
|
|
57
|
+
getState: _,
|
|
58
|
+
replaceState: g,
|
|
59
|
+
snapshot: v,
|
|
60
|
+
state: i,
|
|
61
|
+
tools: _e
|
|
62
|
+
}), [
|
|
63
|
+
u,
|
|
64
|
+
m,
|
|
65
|
+
h,
|
|
66
|
+
_,
|
|
67
|
+
g,
|
|
68
|
+
v,
|
|
69
|
+
i
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/views/templates/designer/use-workflow-chat.ts
|
|
74
|
+
function rt({ controller: e, api: t = "/api/chat" }) {
|
|
75
|
+
let n = Ge({
|
|
76
|
+
transport: d(() => new pe({ api: t }), [t]),
|
|
77
|
+
sendAutomaticallyWhen: ge,
|
|
78
|
+
async onToolCall({ toolCall: t }) {
|
|
79
|
+
let r = await e.executeTool(t.toolName, t.input);
|
|
80
|
+
if (r.ok) {
|
|
81
|
+
n.addToolOutput({
|
|
82
|
+
output: r.kind === "query" ? r.data : r.snapshot,
|
|
83
|
+
tool: t.toolName,
|
|
84
|
+
toolCallId: t.toolCallId
|
|
85
|
+
});
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
n.addToolOutput({
|
|
89
|
+
errorText: r.error,
|
|
90
|
+
state: "output-error",
|
|
91
|
+
tool: t.toolName,
|
|
92
|
+
toolCallId: t.toolCallId
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return n;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/views/templates/designer/chrome-workflow-chat.ts
|
|
100
|
+
var O = 12;
|
|
101
|
+
function k() {
|
|
102
|
+
let e = globalThis.LanguageModel;
|
|
103
|
+
return e && typeof e == "object" ? e : null;
|
|
104
|
+
}
|
|
105
|
+
var A = {
|
|
106
|
+
additionalProperties: !1,
|
|
107
|
+
properties: {
|
|
108
|
+
action: {
|
|
109
|
+
enum: ["tool", "message"],
|
|
110
|
+
type: "string"
|
|
111
|
+
},
|
|
112
|
+
input: { type: "object" },
|
|
113
|
+
text: { type: "string" },
|
|
114
|
+
tool: { type: "string" }
|
|
115
|
+
},
|
|
116
|
+
required: ["action"],
|
|
117
|
+
type: "object"
|
|
118
|
+
};
|
|
119
|
+
function j() {
|
|
120
|
+
return `你是「簽核流程設計器」頁面的離線 AI 助理。只能透過下列工具操作這個流程畫布,其他請求一律婉拒並引導回流程設計。
|
|
121
|
+
|
|
122
|
+
每一步只輸出一個 JSON 決策物件:
|
|
123
|
+
- 呼叫工具:{"action":"tool","tool":"<工具名>","input":{...}}
|
|
124
|
+
- 回覆使用者(完成或詢問):{"action":"message","text":"<繁體中文訊息>"}
|
|
125
|
+
|
|
126
|
+
規則:先用 get_workflow_snapshot 了解現況再規劃;完成後用 validate_workflow 檢查並以 message 說明做了什麼。
|
|
127
|
+
|
|
128
|
+
可用工具:
|
|
129
|
+
${_e.map((e) => `- ${e.name}(${JSON.stringify(e.inputSchema.properties ?? {})}): ${e.description}`).join("\n")}`;
|
|
130
|
+
}
|
|
131
|
+
function it({ controller: e }) {
|
|
132
|
+
let [t, n] = p(!1), [r, i] = p([]), [a, o] = p("ready"), s = f(0);
|
|
133
|
+
u(() => {
|
|
134
|
+
let e = k();
|
|
135
|
+
e && e.availability().then((e) => {
|
|
136
|
+
n(e !== "unavailable");
|
|
137
|
+
}).catch(() => n(!1));
|
|
138
|
+
}, []);
|
|
139
|
+
let c = l((e, t) => {
|
|
140
|
+
s.current += 1, i((n) => [...n, {
|
|
141
|
+
id: `chrome-${s.current}`,
|
|
142
|
+
parts: [{
|
|
143
|
+
text: t,
|
|
144
|
+
type: "text"
|
|
145
|
+
}],
|
|
146
|
+
role: e
|
|
147
|
+
}]);
|
|
148
|
+
}, []);
|
|
149
|
+
return {
|
|
150
|
+
available: t,
|
|
151
|
+
messages: r,
|
|
152
|
+
send: l((t) => {
|
|
153
|
+
let n = k();
|
|
154
|
+
!n || a !== "ready" || (c("user", t), o("submitted"), M({
|
|
155
|
+
appendMessage: c,
|
|
156
|
+
controller: e,
|
|
157
|
+
model: n,
|
|
158
|
+
userText: t
|
|
159
|
+
}).then(() => o("ready")).catch((e) => {
|
|
160
|
+
c("assistant", ot(e)), o("error");
|
|
161
|
+
}));
|
|
162
|
+
}, [
|
|
163
|
+
c,
|
|
164
|
+
e,
|
|
165
|
+
a
|
|
166
|
+
]),
|
|
167
|
+
status: a
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
async function M({ appendMessage: e, controller: t, model: n, userText: r }) {
|
|
171
|
+
let i = await n.create({ initialPrompts: [{
|
|
172
|
+
content: j(),
|
|
173
|
+
role: "system"
|
|
174
|
+
}] });
|
|
175
|
+
try {
|
|
176
|
+
let n = `使用者需求:${r}\n目前流程:${JSON.stringify(t.snapshot)}`;
|
|
177
|
+
for (let r = 0; r < O; r += 1) {
|
|
178
|
+
let r = at(await i.prompt(n, { responseConstraint: A }));
|
|
179
|
+
if (!r || r.action === "message") {
|
|
180
|
+
e("assistant", r?.text ?? "我已完成可處理的部分。");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (!r.tool) {
|
|
184
|
+
e("assistant", "我已完成可處理的部分。");
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
let a = await t.executeTool(r.tool, r.input ?? {});
|
|
188
|
+
if (a.ok) {
|
|
189
|
+
let t = a.kind === "query" ? a.data : a.snapshot;
|
|
190
|
+
e("assistant", `⚙ ${r.tool}`), n = `工具 ${r.tool} 已執行。最新流程:${JSON.stringify(t)}\n請決定下一步。`;
|
|
191
|
+
} else n = `工具 ${r.tool} 失敗:${a.error}\n請改用其他方式或回覆使用者。`;
|
|
192
|
+
}
|
|
193
|
+
e("assistant", "已達到單次操作步數上限,請告訴我下一步。");
|
|
194
|
+
} finally {
|
|
195
|
+
i.destroy();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function at(e) {
|
|
199
|
+
try {
|
|
200
|
+
let t = JSON.parse(e);
|
|
201
|
+
return typeof t == "object" && t && t.action !== void 0 ? t : null;
|
|
202
|
+
} catch {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function ot(e) {
|
|
207
|
+
return e instanceof Error ? `離線模式發生錯誤:${e.message}` : "離線模式發生未知錯誤。";
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/views/templates/designer/workflow-chat-drawer.tsx
|
|
211
|
+
var st = {
|
|
212
|
+
display: "flex",
|
|
213
|
+
flexDirection: "column",
|
|
214
|
+
gap: 12,
|
|
215
|
+
height: "100%"
|
|
216
|
+
}, ct = {
|
|
217
|
+
display: "flex",
|
|
218
|
+
flex: 1,
|
|
219
|
+
flexDirection: "column",
|
|
220
|
+
gap: 12,
|
|
221
|
+
minHeight: 0,
|
|
222
|
+
overflowY: "auto"
|
|
223
|
+
}, lt = {
|
|
224
|
+
display: "flex",
|
|
225
|
+
gap: 8,
|
|
226
|
+
paddingBottom: 4
|
|
227
|
+
}, ut = {
|
|
228
|
+
borderTop: "1px solid var(--mzn-color-border-neutral, #e5e7eb)",
|
|
229
|
+
display: "flex",
|
|
230
|
+
flexDirection: "column",
|
|
231
|
+
gap: 8,
|
|
232
|
+
paddingTop: 12
|
|
233
|
+
}, dt = {
|
|
234
|
+
display: "flex",
|
|
235
|
+
justifyContent: "flex-end"
|
|
236
|
+
}, ft = { width: "100%" }, N = "workflow-chat-input-field", pt = `
|
|
237
|
+
.${N}.mzn-text-field {
|
|
238
|
+
width: 100%;
|
|
239
|
+
}
|
|
240
|
+
`, mt = {
|
|
241
|
+
color: "var(--mzn-color-text-secondary, #6b7280)",
|
|
242
|
+
fontSize: 12,
|
|
243
|
+
padding: "2px 0"
|
|
244
|
+
}, ht = {
|
|
245
|
+
"input-available": "執行中…",
|
|
246
|
+
"input-streaming": "準備中…",
|
|
247
|
+
"output-available": "完成",
|
|
248
|
+
"output-error": "失敗"
|
|
249
|
+
};
|
|
250
|
+
function gt(e) {
|
|
251
|
+
let t = e === "user";
|
|
252
|
+
return {
|
|
253
|
+
alignSelf: t ? "flex-end" : "flex-start",
|
|
254
|
+
background: t ? "var(--mzn-color-primary, #2563eb)" : "var(--mzn-color-surface, #f3f4f6)",
|
|
255
|
+
borderRadius: 10,
|
|
256
|
+
color: t ? "#fff" : "var(--mzn-color-text-primary, #111827)",
|
|
257
|
+
maxWidth: "85%",
|
|
258
|
+
padding: "8px 12px",
|
|
259
|
+
whiteSpace: "pre-wrap",
|
|
260
|
+
wordBreak: "break-word"
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function _t({ api: e, controller: t, onClose: n, open: r }) {
|
|
264
|
+
let i = rt({
|
|
265
|
+
api: e,
|
|
266
|
+
controller: t
|
|
267
|
+
}), a = it({ controller: t }), [o, s] = p("online"), [u, d] = p(""), f = o === "offline" ? {
|
|
268
|
+
messages: a.messages,
|
|
269
|
+
send: a.send,
|
|
270
|
+
status: a.status
|
|
271
|
+
} : {
|
|
272
|
+
messages: i.messages,
|
|
273
|
+
send: (e) => {
|
|
274
|
+
i.sendMessage({ text: e });
|
|
275
|
+
},
|
|
276
|
+
status: i.status
|
|
277
|
+
}, { messages: m, send: g } = f, _ = f.status === "submitted" || f.status === "streaming", v = l(() => {
|
|
278
|
+
let e = u.trim();
|
|
279
|
+
!e || _ || (d(""), g(e));
|
|
280
|
+
}, [
|
|
281
|
+
_,
|
|
282
|
+
u,
|
|
283
|
+
g
|
|
284
|
+
]), ee = l((e) => {
|
|
285
|
+
e.nativeEvent.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), v());
|
|
286
|
+
}, [v]);
|
|
287
|
+
return /* @__PURE__ */ T(re, {
|
|
288
|
+
headerTitle: "AI 流程助理",
|
|
289
|
+
isHeaderDisplay: !0,
|
|
290
|
+
onClose: n,
|
|
291
|
+
open: r,
|
|
292
|
+
size: "medium",
|
|
293
|
+
children: [/* @__PURE__ */ w("style", { children: pt }), /* @__PURE__ */ T("div", {
|
|
294
|
+
style: st,
|
|
295
|
+
children: [
|
|
296
|
+
a.available ? /* @__PURE__ */ T("div", {
|
|
297
|
+
style: lt,
|
|
298
|
+
children: [/* @__PURE__ */ w(h, {
|
|
299
|
+
onClick: () => s("online"),
|
|
300
|
+
variant: o === "online" ? "base-primary" : "base-tertiary",
|
|
301
|
+
children: "線上"
|
|
302
|
+
}), /* @__PURE__ */ w(h, {
|
|
303
|
+
onClick: () => s("offline"),
|
|
304
|
+
variant: o === "offline" ? "base-primary" : "base-tertiary",
|
|
305
|
+
children: "離線(裝置內,實驗)"
|
|
306
|
+
})]
|
|
307
|
+
}) : null,
|
|
308
|
+
/* @__PURE__ */ T("div", {
|
|
309
|
+
role: "log",
|
|
310
|
+
style: ct,
|
|
311
|
+
children: [
|
|
312
|
+
m.length === 0 ? /* @__PURE__ */ w(S, {
|
|
313
|
+
color: "text-neutral",
|
|
314
|
+
variant: "body",
|
|
315
|
+
children: "用一句話描述你想要的流程,例如:「建立三關簽核:部門主管 → 經理 → 財務,金額大於十萬走財務複核」。我會直接在畫布上幫你繪製。"
|
|
316
|
+
}) : null,
|
|
317
|
+
m.map((e) => /* @__PURE__ */ w(c, { children: vt(e) }, e.id)),
|
|
318
|
+
_ ? /* @__PURE__ */ w(S, {
|
|
319
|
+
color: "text-neutral",
|
|
320
|
+
variant: "body",
|
|
321
|
+
children: "思考中…"
|
|
322
|
+
}) : null
|
|
323
|
+
]
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ T("div", {
|
|
326
|
+
style: ut,
|
|
327
|
+
children: [/* @__PURE__ */ w(b, {
|
|
328
|
+
className: N,
|
|
329
|
+
disabled: _,
|
|
330
|
+
maxLength: 2e3,
|
|
331
|
+
onChange: (e) => d(e.target.value),
|
|
332
|
+
onKeyDown: ee,
|
|
333
|
+
placeholder: "描述你想要的流程…(Enter 送出,Shift + Enter 換行)",
|
|
334
|
+
rows: 3,
|
|
335
|
+
style: ft,
|
|
336
|
+
value: u
|
|
337
|
+
}), /* @__PURE__ */ w("div", {
|
|
338
|
+
style: dt,
|
|
339
|
+
children: /* @__PURE__ */ w(h, {
|
|
340
|
+
disabled: _ || u.trim().length === 0,
|
|
341
|
+
loading: _,
|
|
342
|
+
onClick: v,
|
|
343
|
+
type: "button",
|
|
344
|
+
variant: "base-primary",
|
|
345
|
+
children: "送出"
|
|
346
|
+
})
|
|
347
|
+
})]
|
|
348
|
+
})
|
|
349
|
+
]
|
|
350
|
+
})]
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function vt(e) {
|
|
354
|
+
return e.parts.map((t, n) => t.type === "text" ? /* @__PURE__ */ w("div", {
|
|
355
|
+
style: gt(e.role),
|
|
356
|
+
children: t.text
|
|
357
|
+
}, `${e.id}-${n}`) : t.type === "dynamic-tool" || he(t) ? /* @__PURE__ */ w("div", {
|
|
358
|
+
style: mt,
|
|
359
|
+
children: `⚙ ${me(t)} · ${ht[t.state] ?? t.state}`
|
|
360
|
+
}, `${e.id}-${n}`) : null);
|
|
361
|
+
}
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/views/templates/designer/TemplateDesignerView.tsx
|
|
364
|
+
var yt = {
|
|
365
|
+
display: "grid",
|
|
366
|
+
gap: 16
|
|
367
|
+
}, bt = {
|
|
368
|
+
alignItems: "start",
|
|
369
|
+
display: "grid",
|
|
370
|
+
gap: 16,
|
|
371
|
+
gridTemplateColumns: "minmax(0, 1fr) 420px"
|
|
372
|
+
}, xt = {
|
|
373
|
+
border: "1px solid var(--mzn-color-border-neutral)",
|
|
374
|
+
borderRadius: 6,
|
|
375
|
+
height: 620,
|
|
376
|
+
minWidth: 0,
|
|
377
|
+
overflow: "hidden"
|
|
378
|
+
}, St = {
|
|
379
|
+
alignItems: "center",
|
|
380
|
+
boxSizing: "border-box",
|
|
381
|
+
color: "var(--mzn-color-text-error)",
|
|
382
|
+
display: "flex",
|
|
383
|
+
height: 26,
|
|
384
|
+
justifyContent: "center",
|
|
385
|
+
lineHeight: 0,
|
|
386
|
+
padding: 0,
|
|
387
|
+
width: 26
|
|
388
|
+
}, Ct = {
|
|
389
|
+
alignItems: "center",
|
|
390
|
+
display: "flex",
|
|
391
|
+
height: "100%",
|
|
392
|
+
justifyContent: "center",
|
|
393
|
+
width: "100%"
|
|
394
|
+
}, wt = "workflow-designer-side-panel", Tt = 96, Et = `
|
|
395
|
+
.${wt} .mzn-form-field--stretch .mzn-form-field__label-area,
|
|
396
|
+
.${wt} .mzn-form-field--horizontal .mzn-form-field__label-area {
|
|
397
|
+
flex: 0 0 ${Tt}px;
|
|
398
|
+
width: ${Tt}px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.${wt} .mzn-form-field--stretch .mzn-form-field__data-entry,
|
|
402
|
+
.${wt} .mzn-form-field--horizontal .mzn-form-field__data-entry {
|
|
403
|
+
min-width: 0;
|
|
404
|
+
}
|
|
405
|
+
`, Dt = "#2563eb", P = "#64748b", Ot = "var(--mzn-color-text-error, #dc2626)", kt = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", At = `
|
|
406
|
+
.workflow-selection-delete-control.react-flow__controls-button {
|
|
407
|
+
align-items: center !important;
|
|
408
|
+
display: flex !important;
|
|
409
|
+
height: 26px !important;
|
|
410
|
+
justify-content: center !important;
|
|
411
|
+
padding: 0 !important;
|
|
412
|
+
width: 26px !important;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.workflow-selection-delete-control .mzn-icon {
|
|
416
|
+
align-items: center;
|
|
417
|
+
display: flex;
|
|
418
|
+
justify-content: center;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.workflow-selection-delete-control .mzn-icon svg {
|
|
422
|
+
height: 16px !important;
|
|
423
|
+
max-height: none !important;
|
|
424
|
+
max-width: none !important;
|
|
425
|
+
width: 16px !important;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.workflow-edge--selected .react-flow__edge-path,
|
|
429
|
+
.react-flow__edge-path.workflow-edge--selected {
|
|
430
|
+
filter: ${kt};
|
|
431
|
+
opacity: 1 !important;
|
|
432
|
+
stroke: ${P} !important;
|
|
433
|
+
stroke-opacity: 1 !important;
|
|
434
|
+
stroke-width: 1.5px !important;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.workflow-edge--selected {
|
|
438
|
+
--xy-edge-stroke: ${P};
|
|
439
|
+
--xy-edge-stroke-selected: ${P};
|
|
440
|
+
--xy-edge-stroke-width: 1.5px;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
`, jt = {
|
|
444
|
+
display: "grid",
|
|
445
|
+
gap: 12
|
|
446
|
+
}, Mt = {
|
|
447
|
+
display: "grid",
|
|
448
|
+
gap: 12
|
|
449
|
+
}, Nt = {
|
|
450
|
+
border: "1px solid var(--mzn-color-border-neutral)",
|
|
451
|
+
borderRadius: 6,
|
|
452
|
+
display: "grid",
|
|
453
|
+
gap: 8,
|
|
454
|
+
maxHeight: 360,
|
|
455
|
+
overflow: "auto",
|
|
456
|
+
padding: 12
|
|
457
|
+
}, Pt = {
|
|
458
|
+
borderBottom: "1px solid var(--mzn-color-border-neutral)",
|
|
459
|
+
display: "grid",
|
|
460
|
+
gap: 4,
|
|
461
|
+
padding: "0 0 8px"
|
|
462
|
+
}, Ft = {
|
|
463
|
+
display: "flex",
|
|
464
|
+
flexWrap: "wrap",
|
|
465
|
+
gap: 8
|
|
466
|
+
}, It = {
|
|
467
|
+
alignItems: "center",
|
|
468
|
+
display: "flex",
|
|
469
|
+
gap: 8
|
|
470
|
+
}, Lt = {
|
|
471
|
+
flex: "1 1 auto",
|
|
472
|
+
minWidth: 0
|
|
473
|
+
}, Rt = { flex: "0 0 auto" }, zt = {
|
|
474
|
+
display: "grid",
|
|
475
|
+
gap: 8
|
|
476
|
+
}, F = {
|
|
477
|
+
alignContent: "center",
|
|
478
|
+
background: "var(--mzn-color-bg-surface)",
|
|
479
|
+
border: "1px solid var(--mzn-color-border-neutral)",
|
|
480
|
+
borderRadius: 6,
|
|
481
|
+
boxShadow: "0 8px 20px rgba(15, 23, 42, 0.08)",
|
|
482
|
+
boxSizing: "border-box",
|
|
483
|
+
display: "grid",
|
|
484
|
+
gap: 4,
|
|
485
|
+
height: "100%",
|
|
486
|
+
minWidth: 132,
|
|
487
|
+
overflow: "visible",
|
|
488
|
+
padding: "10px 12px",
|
|
489
|
+
textAlign: "center",
|
|
490
|
+
width: "100%"
|
|
491
|
+
}, Bt = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", I = 64, Vt = 160, Ht = 20, L = 64, Ut = 180, Wt = {
|
|
492
|
+
...F,
|
|
493
|
+
display: "grid",
|
|
494
|
+
gap: 8,
|
|
495
|
+
padding: "10px 12px"
|
|
496
|
+
}, Gt = {
|
|
497
|
+
...Wt,
|
|
498
|
+
background: "#eff6ff",
|
|
499
|
+
border: "1px solid #2563eb"
|
|
500
|
+
}, Kt = {
|
|
501
|
+
...Wt,
|
|
502
|
+
background: "#f0fdfa",
|
|
503
|
+
border: "1px solid #0f766e"
|
|
504
|
+
}, R = {
|
|
505
|
+
...F,
|
|
506
|
+
background: "#ffffff"
|
|
507
|
+
}, qt = {
|
|
508
|
+
...F,
|
|
509
|
+
background: "#ecfdf3",
|
|
510
|
+
border: "1px solid #2f855a"
|
|
511
|
+
}, z = {
|
|
512
|
+
...F,
|
|
513
|
+
background: "#fff4ed",
|
|
514
|
+
border: "1px solid #c2410c"
|
|
515
|
+
}, Jt = {
|
|
516
|
+
display: "block",
|
|
517
|
+
maxWidth: "100%",
|
|
518
|
+
minWidth: 0
|
|
519
|
+
}, Yt = {
|
|
520
|
+
display: "grid",
|
|
521
|
+
gap: 2,
|
|
522
|
+
minWidth: 0
|
|
523
|
+
}, Xt = "input", Zt = "output", Qt = {
|
|
524
|
+
endEvent: "結束",
|
|
525
|
+
exclusiveGateway: "條件分流",
|
|
526
|
+
parallelGateway: "並行處理",
|
|
527
|
+
serviceTask: "系統",
|
|
528
|
+
startEvent: "開始",
|
|
529
|
+
userTask: "簽核"
|
|
530
|
+
}, $t = [{
|
|
531
|
+
icon: fe,
|
|
532
|
+
label: "簽核節點",
|
|
533
|
+
type: "userTask"
|
|
534
|
+
}, {
|
|
535
|
+
icon: le,
|
|
536
|
+
label: "知會節點",
|
|
537
|
+
type: "serviceTask"
|
|
538
|
+
}], en = [{
|
|
539
|
+
icon: ce,
|
|
540
|
+
label: "條件分流",
|
|
541
|
+
type: "exclusiveGateway"
|
|
542
|
+
}], tn = [{
|
|
543
|
+
id: "AND",
|
|
544
|
+
name: "全部前置完成"
|
|
545
|
+
}, {
|
|
546
|
+
id: "OR",
|
|
547
|
+
name: "任一前置完成"
|
|
548
|
+
}], nn = [{
|
|
549
|
+
id: "RESTART",
|
|
550
|
+
name: "重新送出後從開始重跑"
|
|
551
|
+
}, {
|
|
552
|
+
id: "FROM_RETURN_POINT",
|
|
553
|
+
name: "重新送出後回到退回節點"
|
|
554
|
+
}], rn = [
|
|
555
|
+
{
|
|
556
|
+
id: "NONE",
|
|
557
|
+
name: "不提醒",
|
|
558
|
+
value: null
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
id: "0.5",
|
|
562
|
+
name: "過半時提醒",
|
|
563
|
+
value: .5
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
id: "0.75",
|
|
567
|
+
name: "剩四分之一時提醒",
|
|
568
|
+
value: .75
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
id: "0.9",
|
|
572
|
+
name: "剩十分之一時提醒",
|
|
573
|
+
value: .9
|
|
574
|
+
}
|
|
575
|
+
], an = [
|
|
576
|
+
{
|
|
577
|
+
id: "DIRECT",
|
|
578
|
+
name: "指定會員"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
id: "ORG_MANAGER",
|
|
582
|
+
name: "發起人主管"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
id: "ORG_UNIT_MANAGER",
|
|
586
|
+
name: "指定組織主管"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
id: "ORG_UNIT_MEMBER",
|
|
590
|
+
name: "組織任一人"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
id: "ORG_UNIT_POSITION",
|
|
594
|
+
name: "組織特定職位"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
id: "POSITION",
|
|
598
|
+
name: "指定職位"
|
|
599
|
+
}
|
|
600
|
+
], on = [
|
|
601
|
+
{
|
|
602
|
+
id: "SINGLE",
|
|
603
|
+
name: "單人簽核"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
id: "PARALLEL_ANY",
|
|
607
|
+
name: "任一人同意"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
id: "PARALLEL_ALL",
|
|
611
|
+
name: "全部同意"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
id: "QUORUM",
|
|
615
|
+
name: "達到指定門檻"
|
|
616
|
+
}
|
|
617
|
+
], sn = [{
|
|
618
|
+
id: "COUNT",
|
|
619
|
+
name: "人數"
|
|
620
|
+
}, {
|
|
621
|
+
id: "PERCENTAGE",
|
|
622
|
+
name: "百分比"
|
|
623
|
+
}], B = [
|
|
624
|
+
{
|
|
625
|
+
id: "1",
|
|
626
|
+
name: "直屬主管",
|
|
627
|
+
value: 1
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
id: "2",
|
|
631
|
+
name: "第二層主管",
|
|
632
|
+
value: 2
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
id: "3",
|
|
636
|
+
name: "第三層主管",
|
|
637
|
+
value: 3
|
|
638
|
+
}
|
|
639
|
+
], cn = [{
|
|
640
|
+
id: "NONE",
|
|
641
|
+
name: "停止流程並提示"
|
|
642
|
+
}, {
|
|
643
|
+
id: "DIRECT",
|
|
644
|
+
name: "固定改派"
|
|
645
|
+
}], ln = [
|
|
646
|
+
{
|
|
647
|
+
id: "EQUALS",
|
|
648
|
+
name: "等於"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
id: "NOT_EQUALS",
|
|
652
|
+
name: "不等於"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
id: "GREATER_THAN",
|
|
656
|
+
name: "大於"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
id: "GREATER_THAN_OR_EQUALS",
|
|
660
|
+
name: "大於等於"
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
id: "LESS_THAN",
|
|
664
|
+
name: "小於"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
id: "LESS_THAN_OR_EQUALS",
|
|
668
|
+
name: "小於等於"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
id: "IS_FILLED",
|
|
672
|
+
name: "已填寫"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
id: "IS_EMPTY",
|
|
676
|
+
name: "未填寫"
|
|
677
|
+
}
|
|
678
|
+
], un = [
|
|
679
|
+
"EQUALS",
|
|
680
|
+
"GREATER_THAN",
|
|
681
|
+
"GREATER_THAN_OR_EQUALS",
|
|
682
|
+
"LESS_THAN",
|
|
683
|
+
"LESS_THAN_OR_EQUALS",
|
|
684
|
+
"NOT_EQUALS"
|
|
685
|
+
], dn = [
|
|
686
|
+
{
|
|
687
|
+
id: "NONE",
|
|
688
|
+
name: "未設定"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
id: "ALL",
|
|
692
|
+
name: "所有人"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
id: "ORG_UNIT",
|
|
696
|
+
name: "指定組織"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
id: "ORG_UNIT_POSITION",
|
|
700
|
+
name: "指定組織職位"
|
|
701
|
+
}
|
|
702
|
+
], fn = {
|
|
703
|
+
id: "CUSTOM",
|
|
704
|
+
name: "既有自訂規則"
|
|
705
|
+
}, pn = "member-001", mn = {
|
|
706
|
+
display: "flex",
|
|
707
|
+
flexDirection: "column",
|
|
708
|
+
height: "100%"
|
|
709
|
+
}, hn = {
|
|
710
|
+
flex: 1,
|
|
711
|
+
minHeight: 0,
|
|
712
|
+
overflowY: "auto"
|
|
713
|
+
}, gn = {
|
|
714
|
+
borderTop: "1px solid var(--mzn-color-border-neutral)",
|
|
715
|
+
display: "flex",
|
|
716
|
+
gap: 8,
|
|
717
|
+
paddingTop: 12
|
|
718
|
+
}, _n = {
|
|
719
|
+
fields: [],
|
|
720
|
+
schemaVersion: 1
|
|
721
|
+
}, vn = {
|
|
722
|
+
layout: [],
|
|
723
|
+
schemaVersion: 1
|
|
724
|
+
}, yn = {
|
|
725
|
+
endEvent: V,
|
|
726
|
+
exclusiveGateway: V,
|
|
727
|
+
parallelGateway: V,
|
|
728
|
+
serviceTask: V,
|
|
729
|
+
startEvent: V,
|
|
730
|
+
userTask: V
|
|
731
|
+
};
|
|
732
|
+
function bn(e, t) {
|
|
733
|
+
return typeof e == "function" ? e(t) : e;
|
|
734
|
+
}
|
|
735
|
+
function xn({ aiAssistantAvailable: r = !0, embedded: a = !1, formSchemaOverride: c, initialInitiatorPolicyCel: oe, initialWorkflowDefinition: ce, onInitiatorPolicyChange: le, onWorkflowChange: fe, showAiAssistant: pe = !1, showDryRun: me = !0, templateId: he }) {
|
|
736
|
+
let ge = e(), _e = t(), [E, ve] = p(null), [ye, be] = p(null), [Se, Ce] = p(""), [ke, je] = p(null), [D, Pe] = p(null), Fe = f(null), [Ge, Ke] = p(void 0), Qe = f([]), rt = f([]), O = nt({
|
|
737
|
+
directory: d(() => ({
|
|
738
|
+
listOrgUnits: async () => Qe.current.map((e) => ({
|
|
739
|
+
id: e.id,
|
|
740
|
+
name: e.name
|
|
741
|
+
})),
|
|
742
|
+
listPositions: async () => rt.current.map((e) => ({
|
|
743
|
+
id: e.id,
|
|
744
|
+
name: e.name
|
|
745
|
+
})),
|
|
746
|
+
searchMembers: async (e) => jr(await He(e)).map((e) => ({
|
|
747
|
+
email: e.email,
|
|
748
|
+
id: e.memberId,
|
|
749
|
+
name: e.name
|
|
750
|
+
}))
|
|
751
|
+
}), []),
|
|
752
|
+
initialState: {
|
|
753
|
+
definition: a && ce != null ? Nn(ce) : Ln(),
|
|
754
|
+
editingEdgeId: null,
|
|
755
|
+
formDefinitionVersionId: null,
|
|
756
|
+
formSchema: null,
|
|
757
|
+
initiatorPolicyCel: a && oe !== void 0 ? oe : null,
|
|
758
|
+
selectedEdgeIds: [],
|
|
759
|
+
selectedNodeId: a && ce != null ? ce.nodes[0]?.id ?? "start" : "start"
|
|
760
|
+
},
|
|
761
|
+
layout: zn,
|
|
762
|
+
onLayout: (e) => {
|
|
763
|
+
let t = Jr(e, Fe.current);
|
|
764
|
+
t && Ke(t);
|
|
765
|
+
}
|
|
766
|
+
}), k = O.state.definition, A = O.state.formDefinitionVersionId, j = O.state.initiatorPolicyCel, it = O.state.selectedNodeId, M = O.state.selectedEdgeIds, at = O.state.editingEdgeId, ot = (e) => O.replaceState((t) => ({
|
|
767
|
+
...t,
|
|
768
|
+
definition: bn(e, t.definition)
|
|
769
|
+
})), st = (e) => O.replaceState((t) => ({
|
|
770
|
+
...t,
|
|
771
|
+
formDefinitionVersionId: bn(e, t.formDefinitionVersionId)
|
|
772
|
+
})), ct = (e) => O.replaceState((t) => ({
|
|
773
|
+
...t,
|
|
774
|
+
initiatorPolicyCel: bn(e, t.initiatorPolicyCel)
|
|
775
|
+
})), lt = (e) => O.replaceState((t) => ({
|
|
776
|
+
...t,
|
|
777
|
+
selectedNodeId: bn(e, t.selectedNodeId)
|
|
778
|
+
})), ut = (e) => O.replaceState((t) => ({
|
|
779
|
+
...t,
|
|
780
|
+
selectedEdgeIds: bn(e, t.selectedEdgeIds)
|
|
781
|
+
})), dt = (e) => O.replaceState((t) => ({
|
|
782
|
+
...t,
|
|
783
|
+
editingEdgeId: bn(e, t.editingEdgeId)
|
|
784
|
+
})), [ft, N] = p(null), [pt, mt] = p(null);
|
|
785
|
+
u(() => {
|
|
786
|
+
mt(null);
|
|
787
|
+
}, [it]);
|
|
788
|
+
let [ht, gt] = p(!0), [vt, Tt] = p(!1), [Dt, P] = p(!1), [kt, F] = p([]), Bt = d(() => JSON.stringify({
|
|
789
|
+
formDefinitionVersionId: A,
|
|
790
|
+
initiatorPolicyCel: j,
|
|
791
|
+
workflowDefinition: k
|
|
792
|
+
}), [
|
|
793
|
+
A,
|
|
794
|
+
j,
|
|
795
|
+
k
|
|
796
|
+
]), I = !!Se && Bt !== Se, [Vt, Ht] = p(!1), [L, Ut] = p([]), [Wt, Gt] = p([]), Kt = f(0), [R, qt] = p([]), [z, Jt] = p([]), [Yt, Xt] = p([]);
|
|
797
|
+
Qe.current = R, rt.current = z;
|
|
798
|
+
let [Zt, ln] = p(!1), [un, xn] = p(!1), [V, Cn] = p("{}"), [wn, Tn] = p(null), [En, H] = p(null), [On, kn] = p(!1), [An, Mn] = p(!1), [U, Pn] = p(null), [Fn, In] = p(!1), [nr, ur] = p(!1), pr = I || Fn ? "保存並發布" : ye ? "發布草稿" : "已發布";
|
|
799
|
+
u(() => {
|
|
800
|
+
a ? qr() : Xr();
|
|
801
|
+
}, [a, he]), u(() => {
|
|
802
|
+
function e(e) {
|
|
803
|
+
I && (e.preventDefault(), e.returnValue = "");
|
|
804
|
+
}
|
|
805
|
+
return window.addEventListener("beforeunload", e), () => {
|
|
806
|
+
window.removeEventListener("beforeunload", e);
|
|
807
|
+
};
|
|
808
|
+
}, [I]), u(() => {
|
|
809
|
+
si(k);
|
|
810
|
+
}, [k, L]), u(() => {
|
|
811
|
+
ot((e) => Nn(e));
|
|
812
|
+
}, [k.edges, k.nodes]);
|
|
813
|
+
function hr() {
|
|
814
|
+
I && !window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?") || ge.push(_e.templates());
|
|
815
|
+
}
|
|
816
|
+
let G = d(() => k.nodes.find((e) => e.id === it) ?? null, [it, k.nodes]), br = G ? yr(G) : !1, xr = M.length > 0 || br, Tr = l(() => {
|
|
817
|
+
O.getState().selectedEdgeIds.forEach((e) => O.dispatch({
|
|
818
|
+
edgeId: e,
|
|
819
|
+
type: "deleteEdge"
|
|
820
|
+
})), G && yr(G) && O.dispatch({
|
|
821
|
+
nodeId: G.id,
|
|
822
|
+
type: "deleteNode"
|
|
823
|
+
});
|
|
824
|
+
}, [O, G]);
|
|
825
|
+
u(() => {
|
|
826
|
+
if (!xr) return;
|
|
827
|
+
function e(e) {
|
|
828
|
+
e.key !== "Delete" && e.key !== "Backspace" || Sr(e.target) || (e.preventDefault(), Tr());
|
|
829
|
+
}
|
|
830
|
+
return window.addEventListener("keydown", e), () => {
|
|
831
|
+
window.removeEventListener("keydown", e);
|
|
832
|
+
};
|
|
833
|
+
}, [xr, Tr]);
|
|
834
|
+
let Dr = d(() => k.edges.find((e) => e.id === at) ?? null, [at, k.edges]), K = d(() => M.length === 1 ? k.edges.find((e) => e.id === M[0]) ?? null : null, [M, k.edges]), q = d(() => M.map((e) => k.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [M, k.edges]), J = d(() => D ?? dr(j, ke), [
|
|
835
|
+
j,
|
|
836
|
+
D,
|
|
837
|
+
ke
|
|
838
|
+
]), Lr = d(() => k.nodes.map((e) => Dn(e, L, R, z, e.id === it, J)), [
|
|
839
|
+
J,
|
|
840
|
+
L,
|
|
841
|
+
R,
|
|
842
|
+
z,
|
|
843
|
+
it,
|
|
844
|
+
k.nodes
|
|
845
|
+
]), Rr = d(() => k.edges.map((e) => jn(e, k.nodes, M.includes(e.id))), [
|
|
846
|
+
M,
|
|
847
|
+
k.edges,
|
|
848
|
+
k.nodes
|
|
849
|
+
]), Y = d(() => W(kt, A) ?? W(Cr(E?.formVersions ?? []), A), [
|
|
850
|
+
A,
|
|
851
|
+
kt,
|
|
852
|
+
E?.formVersions
|
|
853
|
+
]), Br = d(() => Ar(kt, Y), [kt, Y]), Hr = Y?.schema ?? null, Wr = a ? c ?? null : Hr;
|
|
854
|
+
u(() => {
|
|
855
|
+
O.getState().formSchema !== Wr && O.replaceState((e) => ({
|
|
856
|
+
...e,
|
|
857
|
+
formSchema: Wr
|
|
858
|
+
}));
|
|
859
|
+
}, [O, Wr]);
|
|
860
|
+
let Gr = d(() => Yr(k), [k]), X = d(() => Zr(k), [k]), Kr = d(() => fr(J), [J]);
|
|
861
|
+
u(() => {
|
|
862
|
+
a && fe?.(k);
|
|
863
|
+
}, [a, k]), u(() => {
|
|
864
|
+
a && le?.(j);
|
|
865
|
+
}, [a, j]);
|
|
866
|
+
async function qr() {
|
|
867
|
+
gt(!0), N(null);
|
|
868
|
+
try {
|
|
869
|
+
let e = await we();
|
|
870
|
+
qt(e.orgUnits), Jt(e.positions), Xt(e.memberships);
|
|
871
|
+
} catch (e) {
|
|
872
|
+
N(li(e));
|
|
873
|
+
} finally {
|
|
874
|
+
gt(!1);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
async function Xr() {
|
|
878
|
+
gt(!0), N(null), mt(null);
|
|
879
|
+
try {
|
|
880
|
+
let [e, t] = await Promise.all([Be(he), we()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, r = n ?? e.versions[0] ?? null;
|
|
881
|
+
ve(e), be(n), qt(t.orgUnits), Jt(t.positions), Xt(t.memberships), F(Cr(e.formVersions));
|
|
882
|
+
let i = Nn(r?.workflowDefinition ?? Ln()), a = r?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, o = r?.initiatorPolicyCel ?? null;
|
|
883
|
+
ot(i), st(a), ct(o), Ce(JSON.stringify({
|
|
884
|
+
formDefinitionVersionId: a,
|
|
885
|
+
initiatorPolicyCel: o,
|
|
886
|
+
workflowDefinition: i
|
|
887
|
+
})), je(r && !e.template.currentVersionId && !r.initiatorPolicyCel && Rn(r.workflowDefinition) ? "NONE" : null), Pe(null), lt(r?.workflowDefinition.nodes[0]?.id ?? "start"), ut([]), dt(null), Pn(null), In(!1);
|
|
888
|
+
} catch (e) {
|
|
889
|
+
N(li(e));
|
|
890
|
+
} finally {
|
|
891
|
+
gt(!1);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
async function ni(e) {
|
|
895
|
+
P(!0), N(null);
|
|
896
|
+
try {
|
|
897
|
+
F(Ar(Cr(await Ue(e)), Y));
|
|
898
|
+
} catch (e) {
|
|
899
|
+
N(li(e));
|
|
900
|
+
} finally {
|
|
901
|
+
P(!1);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
async function Z(e) {
|
|
905
|
+
Ht(!0), N(null);
|
|
906
|
+
let t = ++Kt.current;
|
|
907
|
+
try {
|
|
908
|
+
let n = jr(await He(e));
|
|
909
|
+
Ut((e) => Vr(e, n)), t === Kt.current && Gt(n);
|
|
910
|
+
} catch (e) {
|
|
911
|
+
t === Kt.current && N(li(e));
|
|
912
|
+
} finally {
|
|
913
|
+
t === Kt.current && Ht(!1);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
async function si(e) {
|
|
917
|
+
let t = Ur(e).filter((e) => !L.some((t) => t.memberId === e && !t.unresolved));
|
|
918
|
+
if (t.length !== 0) try {
|
|
919
|
+
let e = await Ve(t);
|
|
920
|
+
Ut((t) => Vr(t, jr(e)));
|
|
921
|
+
} catch {
|
|
922
|
+
Ut((e) => Vr(e, t.map(Mr)));
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
async function ui(e) {
|
|
926
|
+
Tt(!0), N(null);
|
|
927
|
+
try {
|
|
928
|
+
let t = Yr(k), n = fr(J);
|
|
929
|
+
if (t || n) {
|
|
930
|
+
let e = t ?? n ?? "流程設定未完成";
|
|
931
|
+
throw N(e), Error(e);
|
|
932
|
+
}
|
|
933
|
+
if (Fn && U !== null) await Ie({
|
|
934
|
+
category: E?.template.category ?? null,
|
|
935
|
+
categoryId: E?.template.categoryId ?? null,
|
|
936
|
+
formDefinitionId: Y?.formDefinitionId ?? null,
|
|
937
|
+
formDescription: null,
|
|
938
|
+
formName: Y?.formName ?? E?.template.name ?? "表單",
|
|
939
|
+
initiatorPolicyCel: j,
|
|
940
|
+
notificationConfig: null,
|
|
941
|
+
publish: e,
|
|
942
|
+
schema: U.schema,
|
|
943
|
+
slaDefaults: null,
|
|
944
|
+
templateDescription: null,
|
|
945
|
+
templateId: he ?? null,
|
|
946
|
+
templateName: E?.template.name ?? "模板",
|
|
947
|
+
uiSchema: U.uiSchema,
|
|
948
|
+
workflowDefinition: k
|
|
949
|
+
}), In(!1), Pn(null), await Xr();
|
|
950
|
+
else {
|
|
951
|
+
let t = await We({
|
|
952
|
+
formDefinitionVersionId: A,
|
|
953
|
+
initiatorPolicyCel: j,
|
|
954
|
+
versionId: (ye ?? await Re(he)).id,
|
|
955
|
+
workflowDefinition: k
|
|
956
|
+
});
|
|
957
|
+
be(t), e && await ze(t.id), await Xr();
|
|
958
|
+
}
|
|
959
|
+
} catch (e) {
|
|
960
|
+
throw N(li(e)), e;
|
|
961
|
+
} finally {
|
|
962
|
+
Tt(!1);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
async function di() {
|
|
966
|
+
await ui(!1);
|
|
967
|
+
}
|
|
968
|
+
async function fi() {
|
|
969
|
+
await ui(!0);
|
|
970
|
+
}
|
|
971
|
+
function pi() {
|
|
972
|
+
Cn(JSON.stringify(wr(Y), null, 2)), Tn(null), H(null), ln(!0);
|
|
973
|
+
}
|
|
974
|
+
function mi() {
|
|
975
|
+
un || ln(!1);
|
|
976
|
+
}
|
|
977
|
+
async function hi() {
|
|
978
|
+
xn(!0), H(null), Tn(null);
|
|
979
|
+
try {
|
|
980
|
+
Tn(await Le({
|
|
981
|
+
formData: Er(V),
|
|
982
|
+
initiatorMemberId: pn,
|
|
983
|
+
initiatorMetadataSnapshot: Ir(pn, Yt),
|
|
984
|
+
workflowDefinition: k
|
|
985
|
+
}));
|
|
986
|
+
} catch (e) {
|
|
987
|
+
H(li(e));
|
|
988
|
+
} finally {
|
|
989
|
+
xn(!1);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
async function gi() {
|
|
993
|
+
if (Mn(!0), U !== null) return;
|
|
994
|
+
let e = Y?.formDefinitionId ?? null;
|
|
995
|
+
if (!e) {
|
|
996
|
+
Pn({
|
|
997
|
+
schema: _n,
|
|
998
|
+
uiSchema: vn
|
|
999
|
+
});
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
ur(!0);
|
|
1003
|
+
try {
|
|
1004
|
+
let t = await xe(e), n = t.versions.find((e) => e.status === "DRAFT") ?? t.versions.find((e) => e.id === t.definition.currentVersionId) ?? t.versions[0] ?? null;
|
|
1005
|
+
Pn({
|
|
1006
|
+
schema: n?.schema ?? _n,
|
|
1007
|
+
uiSchema: n?.uiSchema ?? vn
|
|
1008
|
+
});
|
|
1009
|
+
} catch (e) {
|
|
1010
|
+
N(li(e));
|
|
1011
|
+
} finally {
|
|
1012
|
+
ur(!1);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function _i(e) {
|
|
1016
|
+
let t = Ne(e, Lr);
|
|
1017
|
+
ot((e) => ({
|
|
1018
|
+
...e,
|
|
1019
|
+
nodes: e.nodes.map((e) => {
|
|
1020
|
+
let n = t.find((t) => t.id === e.id);
|
|
1021
|
+
return n ? {
|
|
1022
|
+
...e,
|
|
1023
|
+
position: n.position
|
|
1024
|
+
} : e;
|
|
1025
|
+
})
|
|
1026
|
+
}));
|
|
1027
|
+
}
|
|
1028
|
+
function vi(e) {
|
|
1029
|
+
!_r(e, k.nodes) || !e.source || !e.target || O.dispatch({
|
|
1030
|
+
source: e.source,
|
|
1031
|
+
target: e.target,
|
|
1032
|
+
type: "connectEdge"
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
function yi(e, t) {
|
|
1036
|
+
e.stopPropagation(), ut((n) => e.shiftKey || e.metaKey || e.ctrlKey ? vr(n, t.id) : [t.id]), lt(null);
|
|
1037
|
+
}
|
|
1038
|
+
function bi() {
|
|
1039
|
+
dt(null);
|
|
1040
|
+
}
|
|
1041
|
+
function xi(e) {
|
|
1042
|
+
O.dispatch({
|
|
1043
|
+
nodeType: e,
|
|
1044
|
+
type: "addNode"
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
function Si(e) {
|
|
1048
|
+
G && O.dispatch({
|
|
1049
|
+
label: e,
|
|
1050
|
+
nodeId: G.id,
|
|
1051
|
+
type: "renameNode"
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
function Q(e) {
|
|
1055
|
+
if (!G || G.type !== "userTask") return;
|
|
1056
|
+
let t = G.id, n = G.data.decisionPolicy;
|
|
1057
|
+
O.dispatch({
|
|
1058
|
+
approverResolver: e,
|
|
1059
|
+
nodeId: t,
|
|
1060
|
+
type: "setUserTaskApprover"
|
|
1061
|
+
}), mt(null), $e(n, e) && mt({
|
|
1062
|
+
message: `簽核者已變更為 ${et(e)} 位,不足原本設定的 ${n?.type === "QUORUM" ? n.threshold : 0} 位門檻,簽核政策已重設為單人簽核,請重新設定。`,
|
|
1063
|
+
nodeId: t
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
function Ci(e) {
|
|
1067
|
+
!G || G.type !== "userTask" || O.dispatch({
|
|
1068
|
+
nodeId: G.id,
|
|
1069
|
+
resubmitStrategy: e,
|
|
1070
|
+
type: "setUserTaskReturnResubmitStrategy"
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
function wi(e) {
|
|
1074
|
+
!G || G.type !== "userTask" || O.dispatch({
|
|
1075
|
+
nodeId: G.id,
|
|
1076
|
+
requireComment: e,
|
|
1077
|
+
type: "setUserTaskReturnRequireComment"
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
function $(e) {
|
|
1081
|
+
!G || G.type !== "userTask" || O.dispatch({
|
|
1082
|
+
nodeId: G.id,
|
|
1083
|
+
sla: e,
|
|
1084
|
+
type: "setUserTaskSla"
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
function Ti(e) {
|
|
1088
|
+
if (!G || G.type !== "userTask") return;
|
|
1089
|
+
mt(null);
|
|
1090
|
+
let t = e.type === "QUORUM" ? {
|
|
1091
|
+
...e,
|
|
1092
|
+
threshold: Ze(e.threshold, e.thresholdType)
|
|
1093
|
+
} : e;
|
|
1094
|
+
O.dispatch({
|
|
1095
|
+
decisionPolicy: t,
|
|
1096
|
+
nodeId: G.id,
|
|
1097
|
+
type: "setUserTaskDecisionPolicy"
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
function Ei(e) {
|
|
1101
|
+
!G || G.type !== "userTask" || O.dispatch({
|
|
1102
|
+
...e,
|
|
1103
|
+
nodeId: G.id,
|
|
1104
|
+
type: "setUserTaskOptions"
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
function Di(e) {
|
|
1108
|
+
!G || G.type !== "serviceTask" || O.dispatch({
|
|
1109
|
+
action: e,
|
|
1110
|
+
nodeId: G.id,
|
|
1111
|
+
type: "setServiceAction"
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
function Oi(e) {
|
|
1115
|
+
Pe(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), je(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), ct(mr(e, R));
|
|
1116
|
+
}
|
|
1117
|
+
function ki(e) {
|
|
1118
|
+
!G || G.type === "startEvent" || O.dispatch({
|
|
1119
|
+
nodeId: G.id,
|
|
1120
|
+
triggerMode: e,
|
|
1121
|
+
type: "setNodeTriggerMode"
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function Ai(e, t) {
|
|
1125
|
+
O.dispatch({
|
|
1126
|
+
edgeId: e,
|
|
1127
|
+
isDefault: t,
|
|
1128
|
+
type: "setEdgeDefault"
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
function ji({ edgeId: e, fieldKey: t, operator: n, value: r }) {
|
|
1132
|
+
O.dispatch({
|
|
1133
|
+
edgeId: e,
|
|
1134
|
+
fieldKey: t,
|
|
1135
|
+
operator: n,
|
|
1136
|
+
type: "setEdgeCondition",
|
|
1137
|
+
value: r
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
function Mi() {
|
|
1141
|
+
O.dispatch({ type: "autoLayout" });
|
|
1142
|
+
}
|
|
1143
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
1144
|
+
/* @__PURE__ */ w("style", { children: Et }),
|
|
1145
|
+
a ? null : /* @__PURE__ */ w(ee, { children: /* @__PURE__ */ T(ie, {
|
|
1146
|
+
description: `${ye ? `草稿 v${ye.version}` : "尚未建立草稿"} ·${E?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
|
|
1147
|
+
onBackClick: hr,
|
|
1148
|
+
title: E?.template.name ?? "流程設計器",
|
|
1149
|
+
children: [
|
|
1150
|
+
pe ? /* @__PURE__ */ w(h, {
|
|
1151
|
+
disabled: !r,
|
|
1152
|
+
onClick: () => kn((e) => !e),
|
|
1153
|
+
variant: On ? "base-primary" : "base-secondary",
|
|
1154
|
+
children: r ? "AI 助理" : "AI 助理(未設定)"
|
|
1155
|
+
}) : null,
|
|
1156
|
+
/* @__PURE__ */ w(h, {
|
|
1157
|
+
"aria-label": "儲存草稿",
|
|
1158
|
+
disabled: vt || !!Gr || !!Kr,
|
|
1159
|
+
icon: ue,
|
|
1160
|
+
iconType: "icon-only",
|
|
1161
|
+
onClick: () => void di(),
|
|
1162
|
+
variant: "base-secondary",
|
|
1163
|
+
children: "儲存草稿"
|
|
1164
|
+
}),
|
|
1165
|
+
me ? /* @__PURE__ */ w(h, {
|
|
1166
|
+
disabled: ht || !!Gr || !!Kr,
|
|
1167
|
+
icon: se,
|
|
1168
|
+
iconType: "leading",
|
|
1169
|
+
onClick: pi,
|
|
1170
|
+
variant: "base-secondary",
|
|
1171
|
+
children: "試跑流程"
|
|
1172
|
+
}) : null,
|
|
1173
|
+
/* @__PURE__ */ w(h, {
|
|
1174
|
+
disabled: vt || !ye && !I && !Fn || !!Gr || !!Kr,
|
|
1175
|
+
icon: ae,
|
|
1176
|
+
iconType: "leading",
|
|
1177
|
+
onClick: () => void fi(),
|
|
1178
|
+
variant: "base-primary",
|
|
1179
|
+
children: pr
|
|
1180
|
+
})
|
|
1181
|
+
]
|
|
1182
|
+
}) }),
|
|
1183
|
+
/* @__PURE__ */ w(ne, { children: /* @__PURE__ */ w(te, { children: /* @__PURE__ */ T("div", {
|
|
1184
|
+
style: yt,
|
|
1185
|
+
children: [
|
|
1186
|
+
ft ? /* @__PURE__ */ w(S, {
|
|
1187
|
+
color: "text-error",
|
|
1188
|
+
variant: "body",
|
|
1189
|
+
children: ft
|
|
1190
|
+
}) : null,
|
|
1191
|
+
pt && pt.nodeId === G?.id && G.type === "userTask" && (G.data.decisionPolicy?.type ?? "SINGLE") === "SINGLE" ? /* @__PURE__ */ w(S, {
|
|
1192
|
+
color: "text-warning",
|
|
1193
|
+
variant: "body",
|
|
1194
|
+
children: pt.message
|
|
1195
|
+
}) : null,
|
|
1196
|
+
Gr ? /* @__PURE__ */ w(S, {
|
|
1197
|
+
color: "text-error",
|
|
1198
|
+
variant: "body",
|
|
1199
|
+
children: Gr
|
|
1200
|
+
}) : null,
|
|
1201
|
+
Kr ? /* @__PURE__ */ w(S, {
|
|
1202
|
+
color: "text-error",
|
|
1203
|
+
variant: "body",
|
|
1204
|
+
children: Kr
|
|
1205
|
+
}) : null,
|
|
1206
|
+
a ? null : /* @__PURE__ */ w("div", {
|
|
1207
|
+
style: Mt,
|
|
1208
|
+
children: /* @__PURE__ */ w(n, {
|
|
1209
|
+
hintText: X ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
|
|
1210
|
+
label: "綁定表單版本",
|
|
1211
|
+
name: "formDefinitionVersionId",
|
|
1212
|
+
required: !0,
|
|
1213
|
+
children: /* @__PURE__ */ T("div", {
|
|
1214
|
+
style: It,
|
|
1215
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1216
|
+
style: Lt,
|
|
1217
|
+
children: /* @__PURE__ */ w(m, {
|
|
1218
|
+
asyncData: !0,
|
|
1219
|
+
disabled: ht || X,
|
|
1220
|
+
disabledOptionsFilter: !0,
|
|
1221
|
+
emptyText: "沒有符合的已發布表單版本",
|
|
1222
|
+
isForceClearable: !!A && !X,
|
|
1223
|
+
loading: Dt,
|
|
1224
|
+
loadingText: "搜尋表單版本中...",
|
|
1225
|
+
mode: "single",
|
|
1226
|
+
onChange: (e) => {
|
|
1227
|
+
X || st(e?.id ?? null);
|
|
1228
|
+
},
|
|
1229
|
+
onClear: () => {
|
|
1230
|
+
X || st(null);
|
|
1231
|
+
},
|
|
1232
|
+
onSearch: ni,
|
|
1233
|
+
onVisibilityChange: (e) => {
|
|
1234
|
+
e && !X && ni("");
|
|
1235
|
+
},
|
|
1236
|
+
options: [...Br],
|
|
1237
|
+
placeholder: "選擇已發布表單版本",
|
|
1238
|
+
searchDebounceTime: 300,
|
|
1239
|
+
value: Y
|
|
1240
|
+
})
|
|
1241
|
+
}), /* @__PURE__ */ w(h, {
|
|
1242
|
+
disabled: ht,
|
|
1243
|
+
onClick: () => {
|
|
1244
|
+
gi();
|
|
1245
|
+
},
|
|
1246
|
+
style: Rt,
|
|
1247
|
+
variant: "base-secondary",
|
|
1248
|
+
children: "編輯表單"
|
|
1249
|
+
})]
|
|
1250
|
+
})
|
|
1251
|
+
})
|
|
1252
|
+
}),
|
|
1253
|
+
/* @__PURE__ */ T("div", {
|
|
1254
|
+
style: bt,
|
|
1255
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1256
|
+
ref: Fe,
|
|
1257
|
+
style: xt,
|
|
1258
|
+
children: /* @__PURE__ */ T(Me, {
|
|
1259
|
+
connectionMode: Ee.Strict,
|
|
1260
|
+
edges: Rr,
|
|
1261
|
+
fitView: !0,
|
|
1262
|
+
isValidConnection: (e) => _r(e, k.nodes),
|
|
1263
|
+
nodeTypes: yn,
|
|
1264
|
+
nodes: Lr,
|
|
1265
|
+
deleteKeyCode: null,
|
|
1266
|
+
multiSelectionKeyCode: [
|
|
1267
|
+
"Shift",
|
|
1268
|
+
"Meta",
|
|
1269
|
+
"Control"
|
|
1270
|
+
],
|
|
1271
|
+
onConnect: vi,
|
|
1272
|
+
onEdgeClick: yi,
|
|
1273
|
+
onNodeClick: (e, t) => {
|
|
1274
|
+
lt(t.id), ut([]);
|
|
1275
|
+
},
|
|
1276
|
+
onNodesChange: _i,
|
|
1277
|
+
onPaneClick: () => {
|
|
1278
|
+
lt(null), ut([]);
|
|
1279
|
+
},
|
|
1280
|
+
onViewportChange: Ke,
|
|
1281
|
+
viewport: Ge,
|
|
1282
|
+
children: [
|
|
1283
|
+
/* @__PURE__ */ w(Te, {}),
|
|
1284
|
+
/* @__PURE__ */ w("style", { children: At }),
|
|
1285
|
+
/* @__PURE__ */ w(Oe, { children: xr ? /* @__PURE__ */ w(De, {
|
|
1286
|
+
"aria-label": "刪除選取項目",
|
|
1287
|
+
className: "workflow-selection-delete-control",
|
|
1288
|
+
onClick: Tr,
|
|
1289
|
+
style: St,
|
|
1290
|
+
title: "刪除選取項目",
|
|
1291
|
+
children: /* @__PURE__ */ w("span", {
|
|
1292
|
+
style: Ct,
|
|
1293
|
+
children: /* @__PURE__ */ w(g, {
|
|
1294
|
+
color: "error",
|
|
1295
|
+
icon: de,
|
|
1296
|
+
size: 16
|
|
1297
|
+
})
|
|
1298
|
+
})
|
|
1299
|
+
}) : null }),
|
|
1300
|
+
/* @__PURE__ */ w(Sn, { onApplyAutoLayout: Mi }),
|
|
1301
|
+
/* @__PURE__ */ w(Ae, {})
|
|
1302
|
+
]
|
|
1303
|
+
})
|
|
1304
|
+
}), /* @__PURE__ */ T("div", {
|
|
1305
|
+
className: wt,
|
|
1306
|
+
style: jt,
|
|
1307
|
+
children: [
|
|
1308
|
+
/* @__PURE__ */ w(S, {
|
|
1309
|
+
component: "h2",
|
|
1310
|
+
variant: "h3",
|
|
1311
|
+
children: "流程工具"
|
|
1312
|
+
}),
|
|
1313
|
+
a && pe ? /* @__PURE__ */ T("div", {
|
|
1314
|
+
style: zt,
|
|
1315
|
+
children: [/* @__PURE__ */ w(S, {
|
|
1316
|
+
color: "text-neutral",
|
|
1317
|
+
variant: "caption",
|
|
1318
|
+
children: "AI 協助"
|
|
1319
|
+
}), /* @__PURE__ */ w("div", {
|
|
1320
|
+
style: Ft,
|
|
1321
|
+
children: /* @__PURE__ */ w(h, {
|
|
1322
|
+
disabled: !r,
|
|
1323
|
+
onClick: () => kn((e) => !e),
|
|
1324
|
+
size: "sub",
|
|
1325
|
+
variant: On ? "base-primary" : "base-secondary",
|
|
1326
|
+
children: r ? "AI 助理" : "AI 助理(未設定)"
|
|
1327
|
+
})
|
|
1328
|
+
})]
|
|
1329
|
+
}) : null,
|
|
1330
|
+
/* @__PURE__ */ T("div", {
|
|
1331
|
+
style: zt,
|
|
1332
|
+
children: [/* @__PURE__ */ w(S, {
|
|
1333
|
+
color: "text-neutral",
|
|
1334
|
+
variant: "caption",
|
|
1335
|
+
children: "動作節點"
|
|
1336
|
+
}), /* @__PURE__ */ w("div", {
|
|
1337
|
+
style: Ft,
|
|
1338
|
+
children: $t.map((e) => /* @__PURE__ */ w(h, {
|
|
1339
|
+
icon: e.icon,
|
|
1340
|
+
iconType: "leading",
|
|
1341
|
+
onClick: () => xi(e.type),
|
|
1342
|
+
size: "sub",
|
|
1343
|
+
variant: "base-secondary",
|
|
1344
|
+
children: e.label
|
|
1345
|
+
}, e.type))
|
|
1346
|
+
})]
|
|
1347
|
+
}),
|
|
1348
|
+
/* @__PURE__ */ T("div", {
|
|
1349
|
+
style: zt,
|
|
1350
|
+
children: [/* @__PURE__ */ w(S, {
|
|
1351
|
+
color: "text-neutral",
|
|
1352
|
+
variant: "caption",
|
|
1353
|
+
children: "流程控制"
|
|
1354
|
+
}), /* @__PURE__ */ w("div", {
|
|
1355
|
+
style: Ft,
|
|
1356
|
+
children: en.map((e) => /* @__PURE__ */ w(h, {
|
|
1357
|
+
icon: e.icon,
|
|
1358
|
+
iconType: "leading",
|
|
1359
|
+
onClick: () => xi(e.type),
|
|
1360
|
+
size: "sub",
|
|
1361
|
+
variant: "base-secondary",
|
|
1362
|
+
children: e.label
|
|
1363
|
+
}, e.type))
|
|
1364
|
+
})]
|
|
1365
|
+
}),
|
|
1366
|
+
q.length > 1 ? zi(q) : null,
|
|
1367
|
+
q.length === 1 && K ? Bi(K) : null,
|
|
1368
|
+
q.length === 0 && G ? Pi(G) : null
|
|
1369
|
+
]
|
|
1370
|
+
})]
|
|
1371
|
+
})
|
|
1372
|
+
]
|
|
1373
|
+
}) }) }),
|
|
1374
|
+
Vi(Dr),
|
|
1375
|
+
!a && me ? Ni() : null,
|
|
1376
|
+
pe && r ? /* @__PURE__ */ w(_t, {
|
|
1377
|
+
controller: O,
|
|
1378
|
+
onClose: () => kn(!1),
|
|
1379
|
+
open: On
|
|
1380
|
+
}) : null,
|
|
1381
|
+
a ? null : /* @__PURE__ */ w(re, {
|
|
1382
|
+
headerTitle: "編輯表單",
|
|
1383
|
+
isHeaderDisplay: !0,
|
|
1384
|
+
onClose: () => Mn(!1),
|
|
1385
|
+
open: An,
|
|
1386
|
+
size: "wide",
|
|
1387
|
+
children: /* @__PURE__ */ T("div", {
|
|
1388
|
+
style: mn,
|
|
1389
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1390
|
+
style: hn,
|
|
1391
|
+
children: nr ? /* @__PURE__ */ w(S, {
|
|
1392
|
+
color: "text-neutral",
|
|
1393
|
+
variant: "body",
|
|
1394
|
+
children: "載入中…"
|
|
1395
|
+
}) : /* @__PURE__ */ w(s, {
|
|
1396
|
+
onChange: (e) => {
|
|
1397
|
+
Pn(e);
|
|
1398
|
+
},
|
|
1399
|
+
value: U ?? {
|
|
1400
|
+
schema: _n,
|
|
1401
|
+
uiSchema: vn
|
|
1402
|
+
}
|
|
1403
|
+
})
|
|
1404
|
+
}), /* @__PURE__ */ T("div", {
|
|
1405
|
+
style: gn,
|
|
1406
|
+
children: [/* @__PURE__ */ w(h, {
|
|
1407
|
+
disabled: nr,
|
|
1408
|
+
onClick: () => {
|
|
1409
|
+
U !== null && (In(!0), O.replaceState((e) => ({
|
|
1410
|
+
...e,
|
|
1411
|
+
formSchema: U.schema
|
|
1412
|
+
}))), Mn(!1);
|
|
1413
|
+
},
|
|
1414
|
+
variant: "base-primary",
|
|
1415
|
+
children: "套用"
|
|
1416
|
+
}), /* @__PURE__ */ w(h, {
|
|
1417
|
+
onClick: () => Mn(!1),
|
|
1418
|
+
variant: "base-secondary",
|
|
1419
|
+
children: "取消"
|
|
1420
|
+
})]
|
|
1421
|
+
})]
|
|
1422
|
+
})
|
|
1423
|
+
})
|
|
1424
|
+
] });
|
|
1425
|
+
function Ni() {
|
|
1426
|
+
return /* @__PURE__ */ w(v, {
|
|
1427
|
+
cancelText: "關閉",
|
|
1428
|
+
confirmText: "執行試跑",
|
|
1429
|
+
loading: un,
|
|
1430
|
+
modalType: "standard",
|
|
1431
|
+
onCancel: mi,
|
|
1432
|
+
onClose: mi,
|
|
1433
|
+
onConfirm: () => void hi(),
|
|
1434
|
+
open: Zt,
|
|
1435
|
+
showModalFooter: !0,
|
|
1436
|
+
showModalHeader: !0,
|
|
1437
|
+
size: "wide",
|
|
1438
|
+
supportingText: `使用 ${pn} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
|
|
1439
|
+
title: "試跑流程",
|
|
1440
|
+
children: /* @__PURE__ */ T("div", {
|
|
1441
|
+
style: Mt,
|
|
1442
|
+
children: [
|
|
1443
|
+
/* @__PURE__ */ w(n, {
|
|
1444
|
+
label: "表單資料 JSON",
|
|
1445
|
+
name: "dryRunFormDataJson",
|
|
1446
|
+
required: !0,
|
|
1447
|
+
children: /* @__PURE__ */ w(b, {
|
|
1448
|
+
onChange: (e) => Cn(e.target.value),
|
|
1449
|
+
resize: "vertical",
|
|
1450
|
+
rows: 8,
|
|
1451
|
+
value: V
|
|
1452
|
+
})
|
|
1453
|
+
}),
|
|
1454
|
+
En ? /* @__PURE__ */ w(S, {
|
|
1455
|
+
color: "text-error",
|
|
1456
|
+
variant: "body",
|
|
1457
|
+
children: En
|
|
1458
|
+
}) : null,
|
|
1459
|
+
wn ? /* @__PURE__ */ T("div", {
|
|
1460
|
+
style: Nt,
|
|
1461
|
+
children: [
|
|
1462
|
+
/* @__PURE__ */ w(S, {
|
|
1463
|
+
color: wn.valid ? "text-success" : "text-error",
|
|
1464
|
+
variant: "label-primary-highlight",
|
|
1465
|
+
children: wn.valid ? "試跑通過" : "試跑失敗"
|
|
1466
|
+
}),
|
|
1467
|
+
wn.errors.map((e) => /* @__PURE__ */ w(S, {
|
|
1468
|
+
color: "text-error",
|
|
1469
|
+
variant: "body",
|
|
1470
|
+
children: e
|
|
1471
|
+
}, e)),
|
|
1472
|
+
wn.steps.map((e) => /* @__PURE__ */ T("div", {
|
|
1473
|
+
style: Pt,
|
|
1474
|
+
children: [
|
|
1475
|
+
/* @__PURE__ */ T(S, {
|
|
1476
|
+
variant: "label-primary-highlight",
|
|
1477
|
+
children: [
|
|
1478
|
+
e.nodeLabel,
|
|
1479
|
+
" · ",
|
|
1480
|
+
Or(e.status)
|
|
1481
|
+
]
|
|
1482
|
+
}),
|
|
1483
|
+
/* @__PURE__ */ T(S, {
|
|
1484
|
+
color: "text-neutral",
|
|
1485
|
+
variant: "caption",
|
|
1486
|
+
children: [
|
|
1487
|
+
kr(e.nodeType),
|
|
1488
|
+
e.assigneeMemberId ? ` · 處理者:${e.assigneeMemberId}` : "",
|
|
1489
|
+
e.edgeLabel ? ` · 來源線段:${e.edgeLabel}` : ""
|
|
1490
|
+
]
|
|
1491
|
+
}),
|
|
1492
|
+
e.edgeReason ? /* @__PURE__ */ w(S, {
|
|
1493
|
+
color: "text-neutral",
|
|
1494
|
+
variant: "caption",
|
|
1495
|
+
children: e.edgeReason
|
|
1496
|
+
}) : null,
|
|
1497
|
+
e.entryCondition ? /* @__PURE__ */ T(S, {
|
|
1498
|
+
color: "text-neutral",
|
|
1499
|
+
variant: "caption",
|
|
1500
|
+
children: [
|
|
1501
|
+
"進入條件:",
|
|
1502
|
+
e.entryConditionMatched ? "符合" : "不符合",
|
|
1503
|
+
" ·",
|
|
1504
|
+
" ",
|
|
1505
|
+
e.entryCondition
|
|
1506
|
+
]
|
|
1507
|
+
}) : null,
|
|
1508
|
+
/* @__PURE__ */ w(S, {
|
|
1509
|
+
color: "text-neutral",
|
|
1510
|
+
variant: "body",
|
|
1511
|
+
children: e.message
|
|
1512
|
+
})
|
|
1513
|
+
]
|
|
1514
|
+
}, e.id))
|
|
1515
|
+
]
|
|
1516
|
+
}) : null
|
|
1517
|
+
]
|
|
1518
|
+
})
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
function Pi(e) {
|
|
1522
|
+
return /* @__PURE__ */ T("div", {
|
|
1523
|
+
style: Mt,
|
|
1524
|
+
children: [
|
|
1525
|
+
/* @__PURE__ */ w(S, {
|
|
1526
|
+
component: "h2",
|
|
1527
|
+
variant: "h3",
|
|
1528
|
+
children: "節點屬性"
|
|
1529
|
+
}),
|
|
1530
|
+
/* @__PURE__ */ T(S, {
|
|
1531
|
+
color: "text-neutral",
|
|
1532
|
+
variant: "body",
|
|
1533
|
+
children: [
|
|
1534
|
+
Qt[e.type],
|
|
1535
|
+
" · ",
|
|
1536
|
+
e.id
|
|
1537
|
+
]
|
|
1538
|
+
}),
|
|
1539
|
+
/* @__PURE__ */ w(n, {
|
|
1540
|
+
label: "顯示名稱",
|
|
1541
|
+
name: "nodeLabel",
|
|
1542
|
+
required: !0,
|
|
1543
|
+
children: /* @__PURE__ */ w(_, {
|
|
1544
|
+
onChange: (e) => Si(e.target.value),
|
|
1545
|
+
value: e.data.label,
|
|
1546
|
+
variant: "base"
|
|
1547
|
+
})
|
|
1548
|
+
}),
|
|
1549
|
+
e.type === "startEvent" ? Fi() : null,
|
|
1550
|
+
e.type === "startEvent" ? null : Ii(e),
|
|
1551
|
+
e.type === "userTask" ? Li(e) : null,
|
|
1552
|
+
e.type === "serviceTask" ? Ri(e) : null
|
|
1553
|
+
]
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
function Fi() {
|
|
1557
|
+
let e = J.mode === "CUSTOM" ? [...dn, fn] : [...dn], t = J.mode === "ORG_UNIT" || J.mode === "ORG_UNIT_POSITION" ? Pr(R, J.orgUnitId ?? "") : null, r = J.mode === "ORG_UNIT_POSITION" ? Fr(z, J.positionId ?? "") : null, a = J.mode === "ORG_UNIT_POSITION" ? zr({
|
|
1558
|
+
includeDescendants: !!J.includeDescendants,
|
|
1559
|
+
memberships: Yt,
|
|
1560
|
+
orgUnitId: J.orgUnitId ?? "",
|
|
1561
|
+
orgUnits: R,
|
|
1562
|
+
positions: z
|
|
1563
|
+
}) : [];
|
|
1564
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
1565
|
+
/* @__PURE__ */ w(n, {
|
|
1566
|
+
hintText: J.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
|
|
1567
|
+
label: "發起權限",
|
|
1568
|
+
name: "initiatorPolicyMode",
|
|
1569
|
+
required: !0,
|
|
1570
|
+
children: /* @__PURE__ */ w(y, {
|
|
1571
|
+
clearable: !1,
|
|
1572
|
+
onChange: (e) => {
|
|
1573
|
+
if (e?.id === "CUSTOM") {
|
|
1574
|
+
je(null), Pe(null);
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
let t = lr(e?.id ?? null), n = gr(t);
|
|
1578
|
+
je(t === "ALL" ? null : t), Pe(t === "ALL" ? null : n), ct(mr(n, R));
|
|
1579
|
+
},
|
|
1580
|
+
options: e,
|
|
1581
|
+
placeholder: "選擇誰可以發起",
|
|
1582
|
+
value: W(e, J.mode)
|
|
1583
|
+
})
|
|
1584
|
+
}),
|
|
1585
|
+
J.mode === "ORG_UNIT" || J.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
|
|
1586
|
+
label: "組織",
|
|
1587
|
+
name: "initiatorOrgUnitId",
|
|
1588
|
+
required: !0,
|
|
1589
|
+
children: /* @__PURE__ */ w(i, {
|
|
1590
|
+
name: "initiatorOrgUnitId",
|
|
1591
|
+
onChange: (e) => Oi({
|
|
1592
|
+
...J,
|
|
1593
|
+
orgUnitId: e?.id ?? "",
|
|
1594
|
+
positionId: "",
|
|
1595
|
+
value: e?.id ?? ""
|
|
1596
|
+
}),
|
|
1597
|
+
orgUnits: R,
|
|
1598
|
+
placeholder: "選擇組織",
|
|
1599
|
+
value: t
|
|
1600
|
+
})
|
|
1601
|
+
}) : null,
|
|
1602
|
+
J.mode === "ORG_UNIT" || J.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
|
|
1603
|
+
label: "包含下層",
|
|
1604
|
+
name: "initiatorIncludeDescendants",
|
|
1605
|
+
children: /* @__PURE__ */ w(x, {
|
|
1606
|
+
checked: !!J.includeDescendants,
|
|
1607
|
+
onChange: (e) => Oi({
|
|
1608
|
+
...J,
|
|
1609
|
+
includeDescendants: e.target.checked,
|
|
1610
|
+
...J.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
|
|
1611
|
+
})
|
|
1612
|
+
})
|
|
1613
|
+
}) : null,
|
|
1614
|
+
J.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
|
|
1615
|
+
label: "職位",
|
|
1616
|
+
name: "initiatorPositionId",
|
|
1617
|
+
required: !0,
|
|
1618
|
+
children: /* @__PURE__ */ w(o, {
|
|
1619
|
+
disabled: !J.orgUnitId?.trim(),
|
|
1620
|
+
name: "initiatorPositionId",
|
|
1621
|
+
onChange: (e) => Oi({
|
|
1622
|
+
...J,
|
|
1623
|
+
positionId: e?.id ?? ""
|
|
1624
|
+
}),
|
|
1625
|
+
placeholder: J.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
|
|
1626
|
+
positions: a,
|
|
1627
|
+
value: r
|
|
1628
|
+
})
|
|
1629
|
+
}) : null
|
|
1630
|
+
] });
|
|
1631
|
+
}
|
|
1632
|
+
function Ii(e) {
|
|
1633
|
+
let t = k.edges.filter((t) => t.target === e.id).length, r = t < 2, i = r ? "AND" : e.data.triggerMode ?? "AND";
|
|
1634
|
+
return /* @__PURE__ */ w(n, {
|
|
1635
|
+
hintText: r ? "需要至少兩條前置連線,才可切換為任一前置完成。" : t > 1 ? `${t} 條前置連線會依此規則觸發。` : "只有一條前置連線時,兩種設定效果相同。",
|
|
1636
|
+
label: "前置條件",
|
|
1637
|
+
name: "triggerMode",
|
|
1638
|
+
required: !0,
|
|
1639
|
+
children: /* @__PURE__ */ w(y, {
|
|
1640
|
+
clearable: !1,
|
|
1641
|
+
onChange: (e) => r ? void 0 : ki(Bn(e?.id ?? null)),
|
|
1642
|
+
options: [...tn],
|
|
1643
|
+
readOnly: r,
|
|
1644
|
+
value: W(tn, i)
|
|
1645
|
+
})
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
function Li(e) {
|
|
1649
|
+
let t = e.data.approverResolver, r = rr(t.type), a = t.type === "DIRECT" ? t.memberIds.map((e) => Nr(L, e)) : [], s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? Pr(R, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? Fr(z, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? zr({
|
|
1650
|
+
includeDescendants: !!t.includeDescendants,
|
|
1651
|
+
memberships: Yt,
|
|
1652
|
+
orgUnitId: t.orgUnitId,
|
|
1653
|
+
orgUnits: R,
|
|
1654
|
+
positions: z
|
|
1655
|
+
}) : [], u = t.type === "ORG_MANAGER" ? sr(t.levelsUp) : B[0], d = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, f = d.type === "DIRECT" && d.memberId ? Nr(L, d.memberId) : null, p = e.data.returnBehavior.resubmitStrategy ?? "RESTART", h = e.data.sla ?? null, g = h ? tt(h.duration) : null, v = g?.unit ?? "DAY", ee = Zn(h?.warningAt ?? null), te = sr(h?.escalateLevelsUp ?? 1), ne = Un(e.data.decisionPolicy), b = Kn(e.data.decisionPolicy);
|
|
1656
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
1657
|
+
/* @__PURE__ */ w(n, {
|
|
1658
|
+
label: "簽核來源",
|
|
1659
|
+
name: "approverResolverType",
|
|
1660
|
+
required: !0,
|
|
1661
|
+
children: /* @__PURE__ */ w(y, {
|
|
1662
|
+
clearable: !1,
|
|
1663
|
+
onChange: (e) => Q(ir(e?.id ?? null)),
|
|
1664
|
+
options: [...an],
|
|
1665
|
+
value: W(an, r)
|
|
1666
|
+
})
|
|
1667
|
+
}),
|
|
1668
|
+
t.type === "DIRECT" ? /* @__PURE__ */ w(n, {
|
|
1669
|
+
hintText: Hn(e.data.decisionPolicy),
|
|
1670
|
+
label: "簽核者",
|
|
1671
|
+
name: "memberId",
|
|
1672
|
+
required: !0,
|
|
1673
|
+
children: /* @__PURE__ */ w(m, {
|
|
1674
|
+
asyncData: !0,
|
|
1675
|
+
disabledOptionsFilter: !0,
|
|
1676
|
+
emptyText: "沒有符合的成員",
|
|
1677
|
+
inputProps: {
|
|
1678
|
+
autoCapitalize: "none",
|
|
1679
|
+
autoCorrect: "off",
|
|
1680
|
+
name: "workflow-approver-search",
|
|
1681
|
+
spellCheck: !1
|
|
1682
|
+
},
|
|
1683
|
+
loading: Vt,
|
|
1684
|
+
loadingText: "搜尋成員中...",
|
|
1685
|
+
mode: "multiple",
|
|
1686
|
+
onChange: (e) => Q({
|
|
1687
|
+
memberIds: e.map((e) => e.id),
|
|
1688
|
+
type: "DIRECT"
|
|
1689
|
+
}),
|
|
1690
|
+
onSearch: Z,
|
|
1691
|
+
onVisibilityChange: (e) => {
|
|
1692
|
+
e && (Gt([]), Z(""));
|
|
1693
|
+
},
|
|
1694
|
+
options: [...Vr(a, Wt)],
|
|
1695
|
+
placeholder: "搜尋姓名或信箱",
|
|
1696
|
+
searchDebounceTime: 300,
|
|
1697
|
+
value: a
|
|
1698
|
+
})
|
|
1699
|
+
}) : null,
|
|
1700
|
+
t.type === "ORG_MANAGER" ? /* @__PURE__ */ w(n, {
|
|
1701
|
+
hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
|
|
1702
|
+
label: "主管層級",
|
|
1703
|
+
name: "managerLevelsUp",
|
|
1704
|
+
required: !0,
|
|
1705
|
+
children: /* @__PURE__ */ w(y, {
|
|
1706
|
+
clearable: !1,
|
|
1707
|
+
onChange: (e) => Q({
|
|
1708
|
+
baseFromInitiator: !0,
|
|
1709
|
+
levelsUp: cr(e?.id ?? null).value,
|
|
1710
|
+
type: "ORG_MANAGER"
|
|
1711
|
+
}),
|
|
1712
|
+
options: [...B],
|
|
1713
|
+
value: u
|
|
1714
|
+
})
|
|
1715
|
+
}) : null,
|
|
1716
|
+
t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
|
|
1717
|
+
hintText: t.type === "ORG_UNIT_MANAGER" ? "依指定組織或其上層的主管解析規則決定簽核人。" : "依指定組織目前有效會員歸屬建立候選簽核人。",
|
|
1718
|
+
label: "組織",
|
|
1719
|
+
name: "orgUnitId",
|
|
1720
|
+
required: !0,
|
|
1721
|
+
children: /* @__PURE__ */ w(i, {
|
|
1722
|
+
name: "orgUnitId",
|
|
1723
|
+
onChange: (e) => Q(t.type === "ORG_UNIT_MEMBER" ? {
|
|
1724
|
+
includeDescendants: t.includeDescendants,
|
|
1725
|
+
orgUnitId: e?.id ?? "",
|
|
1726
|
+
type: "ORG_UNIT_MEMBER"
|
|
1727
|
+
} : t.type === "ORG_UNIT_POSITION" ? {
|
|
1728
|
+
includeDescendants: t.includeDescendants,
|
|
1729
|
+
orgUnitId: e?.id ?? "",
|
|
1730
|
+
positionId: "",
|
|
1731
|
+
type: "ORG_UNIT_POSITION"
|
|
1732
|
+
} : {
|
|
1733
|
+
fallback: t.fallback,
|
|
1734
|
+
orgUnitId: e?.id ?? "",
|
|
1735
|
+
type: "ORG_UNIT_MANAGER"
|
|
1736
|
+
}),
|
|
1737
|
+
orgUnits: R,
|
|
1738
|
+
placeholder: "選擇組織",
|
|
1739
|
+
value: s
|
|
1740
|
+
})
|
|
1741
|
+
}) : null,
|
|
1742
|
+
t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ T(C, { children: [
|
|
1743
|
+
/* @__PURE__ */ w(n, {
|
|
1744
|
+
hintText: "開啟後只取離該員最近一層的主管規則;掛在上層單位、涵蓋範圍較大的規則不會再一併加入簽核人。",
|
|
1745
|
+
label: "只取最近一層主管",
|
|
1746
|
+
name: "preferClosestOrgUnit",
|
|
1747
|
+
children: /* @__PURE__ */ w(x, {
|
|
1748
|
+
checked: !!t.preferClosestOrgUnit,
|
|
1749
|
+
inputProps: {
|
|
1750
|
+
id: "preferClosestOrgUnit",
|
|
1751
|
+
name: "preferClosestOrgUnit"
|
|
1752
|
+
},
|
|
1753
|
+
onChange: (e) => Q({
|
|
1754
|
+
...t,
|
|
1755
|
+
preferClosestOrgUnit: e.target.checked
|
|
1756
|
+
})
|
|
1757
|
+
})
|
|
1758
|
+
}),
|
|
1759
|
+
/* @__PURE__ */ w(n, {
|
|
1760
|
+
hintText: "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
|
|
1761
|
+
label: "無主管時",
|
|
1762
|
+
name: "approverFallbackMode",
|
|
1763
|
+
required: !0,
|
|
1764
|
+
children: /* @__PURE__ */ w(y, {
|
|
1765
|
+
clearable: !1,
|
|
1766
|
+
onChange: (e) => Q(or(t, ar(e?.id ?? null) === "DIRECT" ? {
|
|
1767
|
+
memberId: "",
|
|
1768
|
+
type: "DIRECT"
|
|
1769
|
+
} : { type: "NONE" })),
|
|
1770
|
+
options: [...cn],
|
|
1771
|
+
value: W(cn, d.type)
|
|
1772
|
+
})
|
|
1773
|
+
}),
|
|
1774
|
+
d.type === "DIRECT" ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
|
|
1775
|
+
label: "改派人員",
|
|
1776
|
+
name: "approverFallbackMemberId",
|
|
1777
|
+
required: !0,
|
|
1778
|
+
children: /* @__PURE__ */ w(m, {
|
|
1779
|
+
asyncData: !0,
|
|
1780
|
+
disabledOptionsFilter: !0,
|
|
1781
|
+
emptyText: "沒有符合的成員",
|
|
1782
|
+
inputProps: {
|
|
1783
|
+
autoCapitalize: "none",
|
|
1784
|
+
autoCorrect: "off",
|
|
1785
|
+
name: "workflow-approver-fallback-search",
|
|
1786
|
+
spellCheck: !1
|
|
1787
|
+
},
|
|
1788
|
+
loading: Vt,
|
|
1789
|
+
loadingText: "搜尋成員中...",
|
|
1790
|
+
mode: "single",
|
|
1791
|
+
onChange: (e) => Q(or(t, {
|
|
1792
|
+
allowInitiatorSelfApproval: d.allowInitiatorSelfApproval,
|
|
1793
|
+
memberId: e?.id ?? "",
|
|
1794
|
+
type: "DIRECT"
|
|
1795
|
+
})),
|
|
1796
|
+
onSearch: Z,
|
|
1797
|
+
onVisibilityChange: (e) => {
|
|
1798
|
+
e && (Gt([]), Z(""));
|
|
1799
|
+
},
|
|
1800
|
+
options: [...Vr(Wt, f ? [f] : [])],
|
|
1801
|
+
placeholder: "搜尋姓名或信箱",
|
|
1802
|
+
searchDebounceTime: 300,
|
|
1803
|
+
value: f
|
|
1804
|
+
})
|
|
1805
|
+
}), /* @__PURE__ */ w(n, {
|
|
1806
|
+
hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
|
|
1807
|
+
label: "允許自簽",
|
|
1808
|
+
name: "allowInitiatorSelfApproval",
|
|
1809
|
+
children: /* @__PURE__ */ w(x, {
|
|
1810
|
+
checked: !!d.allowInitiatorSelfApproval,
|
|
1811
|
+
inputProps: {
|
|
1812
|
+
id: "allowInitiatorSelfApproval",
|
|
1813
|
+
name: "allowInitiatorSelfApproval"
|
|
1814
|
+
},
|
|
1815
|
+
onChange: (e) => Q(or(t, {
|
|
1816
|
+
allowInitiatorSelfApproval: e.target.checked,
|
|
1817
|
+
memberId: d.memberId,
|
|
1818
|
+
type: "DIRECT"
|
|
1819
|
+
}))
|
|
1820
|
+
})
|
|
1821
|
+
})] }) : null
|
|
1822
|
+
] }) : null,
|
|
1823
|
+
t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
|
|
1824
|
+
label: "包含下層",
|
|
1825
|
+
name: "includeDescendants",
|
|
1826
|
+
children: /* @__PURE__ */ w(x, {
|
|
1827
|
+
checked: !!t.includeDescendants,
|
|
1828
|
+
inputProps: {
|
|
1829
|
+
id: "includeDescendants",
|
|
1830
|
+
name: "includeDescendants"
|
|
1831
|
+
},
|
|
1832
|
+
onChange: (e) => Q({
|
|
1833
|
+
...t,
|
|
1834
|
+
includeDescendants: e.target.checked,
|
|
1835
|
+
...t.type === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
|
|
1836
|
+
})
|
|
1837
|
+
})
|
|
1838
|
+
}) : null,
|
|
1839
|
+
t.type === "POSITION" ? /* @__PURE__ */ w(n, {
|
|
1840
|
+
hintText: "指派給目前有效歸屬中擁有此職位的會員;主要歸屬優先。",
|
|
1841
|
+
label: "職位",
|
|
1842
|
+
name: "positionId",
|
|
1843
|
+
required: !0,
|
|
1844
|
+
children: /* @__PURE__ */ w(o, {
|
|
1845
|
+
name: "positionId",
|
|
1846
|
+
onChange: (e) => Q({
|
|
1847
|
+
positionId: e?.id ?? "",
|
|
1848
|
+
type: "POSITION"
|
|
1849
|
+
}),
|
|
1850
|
+
placeholder: "選擇職位",
|
|
1851
|
+
positions: z,
|
|
1852
|
+
value: c
|
|
1853
|
+
})
|
|
1854
|
+
}) : null,
|
|
1855
|
+
t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ w(n, {
|
|
1856
|
+
hintText: "只納入指定組織範圍內擁有此職位的有效會員。",
|
|
1857
|
+
label: "職位",
|
|
1858
|
+
name: "orgUnitPositionId",
|
|
1859
|
+
required: !0,
|
|
1860
|
+
children: /* @__PURE__ */ w(o, {
|
|
1861
|
+
disabled: !t.orgUnitId.trim(),
|
|
1862
|
+
name: "orgUnitPositionId",
|
|
1863
|
+
onChange: (e) => Q({
|
|
1864
|
+
includeDescendants: t.includeDescendants,
|
|
1865
|
+
orgUnitId: t.orgUnitId,
|
|
1866
|
+
positionId: e?.id ?? "",
|
|
1867
|
+
type: "ORG_UNIT_POSITION"
|
|
1868
|
+
}),
|
|
1869
|
+
placeholder: t.orgUnitId.trim() ? "選擇職位" : "請先選擇組織",
|
|
1870
|
+
positions: l,
|
|
1871
|
+
value: c
|
|
1872
|
+
})
|
|
1873
|
+
}) : null,
|
|
1874
|
+
/* @__PURE__ */ w(n, {
|
|
1875
|
+
hintText: "決定這一關要幾位簽核者同意才會通過;單人簽核與任一人同意的效果完全相同,皆為其中一人同意即通過。",
|
|
1876
|
+
label: "決策方式",
|
|
1877
|
+
name: "decisionPolicy",
|
|
1878
|
+
required: !0,
|
|
1879
|
+
children: /* @__PURE__ */ w(y, {
|
|
1880
|
+
clearable: !1,
|
|
1881
|
+
onChange: (t) => Ti(Gn(t?.id ?? null, e.data.decisionPolicy)),
|
|
1882
|
+
options: [...on],
|
|
1883
|
+
value: Wn(ne)
|
|
1884
|
+
})
|
|
1885
|
+
}),
|
|
1886
|
+
ne === "QUORUM" ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
|
|
1887
|
+
label: "門檻計算方式",
|
|
1888
|
+
name: "quorumThresholdType",
|
|
1889
|
+
required: !0,
|
|
1890
|
+
children: /* @__PURE__ */ w(y, {
|
|
1891
|
+
clearable: !1,
|
|
1892
|
+
onChange: (e) => Ti({
|
|
1893
|
+
threshold: b.threshold,
|
|
1894
|
+
thresholdType: qn(e?.id ?? null),
|
|
1895
|
+
type: "QUORUM"
|
|
1896
|
+
}),
|
|
1897
|
+
options: [...sn],
|
|
1898
|
+
value: W(sn, b.thresholdType)
|
|
1899
|
+
})
|
|
1900
|
+
}), /* @__PURE__ */ w(n, {
|
|
1901
|
+
hintText: b.thresholdType === "PERCENTAGE" ? "達到簽核者總數的這個百分比即通過,換算人數時無條件進位;超過 100 的輸入會自動夾至 100。" : "達到這個同意人數即通過;門檻超過實際簽核者人數時,這一關將永遠無法通過,請勿設定超過實際簽核者人數。",
|
|
1902
|
+
label: b.thresholdType === "PERCENTAGE" ? "門檻百分比" : "門檻人數",
|
|
1903
|
+
name: "quorumThreshold",
|
|
1904
|
+
required: !0,
|
|
1905
|
+
children: /* @__PURE__ */ w(_, {
|
|
1906
|
+
id: "quorumThreshold",
|
|
1907
|
+
inputProps: b.thresholdType === "PERCENTAGE" ? {
|
|
1908
|
+
max: 100,
|
|
1909
|
+
min: 1
|
|
1910
|
+
} : { min: 1 },
|
|
1911
|
+
inputType: "number",
|
|
1912
|
+
name: "quorumThreshold",
|
|
1913
|
+
onChange: (e) => Ti({
|
|
1914
|
+
threshold: Ze(Number(e.target.value), b.thresholdType),
|
|
1915
|
+
thresholdType: b.thresholdType,
|
|
1916
|
+
type: "QUORUM"
|
|
1917
|
+
}),
|
|
1918
|
+
value: String(b.threshold),
|
|
1919
|
+
variant: "base"
|
|
1920
|
+
})
|
|
1921
|
+
})] }) : null,
|
|
1922
|
+
e.data.returnBehavior.allowReturn ? /* @__PURE__ */ w(n, {
|
|
1923
|
+
hintText: "退回發起人後,重新送出時要從流程開始重跑,或直接回到退回的簽核節點。",
|
|
1924
|
+
label: "重送策略",
|
|
1925
|
+
name: "returnResubmitStrategy",
|
|
1926
|
+
required: !0,
|
|
1927
|
+
children: /* @__PURE__ */ w(y, {
|
|
1928
|
+
clearable: !1,
|
|
1929
|
+
onChange: (e) => Ci(Vn(e?.id ?? null)),
|
|
1930
|
+
options: [...nn],
|
|
1931
|
+
value: W(nn, p)
|
|
1932
|
+
})
|
|
1933
|
+
}) : null,
|
|
1934
|
+
e.data.returnBehavior.allowReturn ? /* @__PURE__ */ w(n, {
|
|
1935
|
+
hintText: "開啟後,簽核者按下退回時必須填寫意見,未填寫會被擋下。",
|
|
1936
|
+
label: "退回時意見必填",
|
|
1937
|
+
name: "returnRequireComment",
|
|
1938
|
+
children: /* @__PURE__ */ w(x, {
|
|
1939
|
+
checked: e.data.returnBehavior.requireComment === !0,
|
|
1940
|
+
inputProps: {
|
|
1941
|
+
id: "returnRequireComment",
|
|
1942
|
+
name: "returnRequireComment"
|
|
1943
|
+
},
|
|
1944
|
+
onChange: (e) => wi(e.target.checked)
|
|
1945
|
+
})
|
|
1946
|
+
}) : null,
|
|
1947
|
+
/* @__PURE__ */ w(n, {
|
|
1948
|
+
hintText: "開啟後可設定簽核期限,逾時將依下方設定處理。",
|
|
1949
|
+
label: "啟用時效",
|
|
1950
|
+
name: "slaEnabled",
|
|
1951
|
+
children: /* @__PURE__ */ w(x, {
|
|
1952
|
+
checked: !!h,
|
|
1953
|
+
inputProps: {
|
|
1954
|
+
id: "slaEnabled",
|
|
1955
|
+
name: "slaEnabled"
|
|
1956
|
+
},
|
|
1957
|
+
onChange: (e) => $(e.target.checked ? qe : null)
|
|
1958
|
+
})
|
|
1959
|
+
}),
|
|
1960
|
+
h && !g ? /* @__PURE__ */ w(n, {
|
|
1961
|
+
hintText: "此期限混用了日與時,無法在表單中編輯。請改以單一單位設定,或透過 API 維護。",
|
|
1962
|
+
label: "時效期限",
|
|
1963
|
+
name: "slaDurationRaw",
|
|
1964
|
+
children: /* @__PURE__ */ w(_, {
|
|
1965
|
+
disabled: !0,
|
|
1966
|
+
value: h.duration,
|
|
1967
|
+
variant: "base"
|
|
1968
|
+
})
|
|
1969
|
+
}) : null,
|
|
1970
|
+
h && g ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
|
|
1971
|
+
label: "時效期限",
|
|
1972
|
+
name: "slaDurationValue",
|
|
1973
|
+
required: !0,
|
|
1974
|
+
children: /* @__PURE__ */ w(_, {
|
|
1975
|
+
id: "slaDurationValue",
|
|
1976
|
+
inputProps: { min: 1 },
|
|
1977
|
+
inputType: "number",
|
|
1978
|
+
name: "slaDurationValue",
|
|
1979
|
+
onChange: (e) => $($n(h, {
|
|
1980
|
+
unit: v,
|
|
1981
|
+
value: Number(e.target.value)
|
|
1982
|
+
})),
|
|
1983
|
+
value: String(g.value),
|
|
1984
|
+
variant: "base"
|
|
1985
|
+
})
|
|
1986
|
+
}), /* @__PURE__ */ w(n, {
|
|
1987
|
+
label: "期限單位",
|
|
1988
|
+
name: "slaDurationUnit",
|
|
1989
|
+
required: !0,
|
|
1990
|
+
children: /* @__PURE__ */ w(y, {
|
|
1991
|
+
clearable: !1,
|
|
1992
|
+
onChange: (e) => $($n(h, {
|
|
1993
|
+
unit: Jn(e?.id ?? null),
|
|
1994
|
+
value: g.value
|
|
1995
|
+
})),
|
|
1996
|
+
options: [...Ye],
|
|
1997
|
+
value: W(Ye, v)
|
|
1998
|
+
})
|
|
1999
|
+
})] }) : null,
|
|
2000
|
+
h && v === "DAY" ? /* @__PURE__ */ w(n, {
|
|
2001
|
+
hintText: "工作日會跳過週末與行事曆上的假日,補班日仍計為工作日;行事曆由系統管理者設定。",
|
|
2002
|
+
label: "計算方式",
|
|
2003
|
+
name: "slaCalendar",
|
|
2004
|
+
required: !0,
|
|
2005
|
+
children: /* @__PURE__ */ w(y, {
|
|
2006
|
+
clearable: !1,
|
|
2007
|
+
onChange: (e) => $({
|
|
2008
|
+
...h,
|
|
2009
|
+
calendar: Yn(e?.id ?? null)
|
|
2010
|
+
}),
|
|
2011
|
+
options: [...Je],
|
|
2012
|
+
value: W(Je, h.calendar ?? "CALENDAR")
|
|
2013
|
+
})
|
|
2014
|
+
}) : null,
|
|
2015
|
+
h ? /* @__PURE__ */ w(n, {
|
|
2016
|
+
label: "逾時處理",
|
|
2017
|
+
name: "slaOnTimeout",
|
|
2018
|
+
required: !0,
|
|
2019
|
+
children: /* @__PURE__ */ w(y, {
|
|
2020
|
+
clearable: !1,
|
|
2021
|
+
onChange: (e) => $(er(h, Xn(e?.id ?? null))),
|
|
2022
|
+
options: [...Xe],
|
|
2023
|
+
value: W(Xe, h.onTimeout)
|
|
2024
|
+
})
|
|
2025
|
+
}) : null,
|
|
2026
|
+
h?.onTimeout === "ESCALATE" ? /* @__PURE__ */ w(n, {
|
|
2027
|
+
hintText: "逾時後改派給簽核者的上層主管,只會升級一次。",
|
|
2028
|
+
label: "升級層級",
|
|
2029
|
+
name: "slaEscalateLevelsUp",
|
|
2030
|
+
required: !0,
|
|
2031
|
+
children: /* @__PURE__ */ w(y, {
|
|
2032
|
+
clearable: !1,
|
|
2033
|
+
onChange: (e) => $({
|
|
2034
|
+
...h,
|
|
2035
|
+
escalateLevelsUp: cr(e?.id ?? null).value
|
|
2036
|
+
}),
|
|
2037
|
+
options: [...B],
|
|
2038
|
+
value: te
|
|
2039
|
+
})
|
|
2040
|
+
}) : null,
|
|
2041
|
+
h ? /* @__PURE__ */ w(n, {
|
|
2042
|
+
hintText: "在期限到達前先送出一次提醒。",
|
|
2043
|
+
label: "預警提醒",
|
|
2044
|
+
name: "slaWarningAt",
|
|
2045
|
+
children: /* @__PURE__ */ w(y, {
|
|
2046
|
+
clearable: !1,
|
|
2047
|
+
onChange: (e) => $(tr(h, Qn(e?.id ?? null).value)),
|
|
2048
|
+
options: [...rn],
|
|
2049
|
+
value: ee
|
|
2050
|
+
})
|
|
2051
|
+
}) : null,
|
|
2052
|
+
/* @__PURE__ */ w(n, {
|
|
2053
|
+
hintText: "關閉後,簽核者在此關卡看不到「拒絕」按鈕。",
|
|
2054
|
+
label: "允許拒絕",
|
|
2055
|
+
name: "allowReject",
|
|
2056
|
+
children: /* @__PURE__ */ w(x, {
|
|
2057
|
+
checked: e.data.allowReject,
|
|
2058
|
+
inputProps: {
|
|
2059
|
+
id: "allowReject",
|
|
2060
|
+
name: "allowReject"
|
|
2061
|
+
},
|
|
2062
|
+
onChange: (e) => Ei({ allowReject: e.target.checked })
|
|
2063
|
+
})
|
|
2064
|
+
}),
|
|
2065
|
+
/* @__PURE__ */ w(n, {
|
|
2066
|
+
hintText: "關閉後,簽核者無法把此關卡的任務轉派給其他人。",
|
|
2067
|
+
label: "允許轉派",
|
|
2068
|
+
name: "allowTransfer",
|
|
2069
|
+
children: /* @__PURE__ */ w(x, {
|
|
2070
|
+
checked: e.data.allowTransfer,
|
|
2071
|
+
inputProps: {
|
|
2072
|
+
id: "allowTransfer",
|
|
2073
|
+
name: "allowTransfer"
|
|
2074
|
+
},
|
|
2075
|
+
onChange: (e) => Ei({ allowTransfer: e.target.checked })
|
|
2076
|
+
})
|
|
2077
|
+
}),
|
|
2078
|
+
/* @__PURE__ */ w(n, {
|
|
2079
|
+
hintText: "開啟後,簽核者可在此關卡臨時加入其他簽核人;會簽為平行處理,加簽則需等加入者簽完才往下。",
|
|
2080
|
+
label: "允許加簽",
|
|
2081
|
+
name: "allowAddSigner",
|
|
2082
|
+
children: /* @__PURE__ */ w(x, {
|
|
2083
|
+
checked: e.data.allowAddSigner,
|
|
2084
|
+
inputProps: {
|
|
2085
|
+
id: "allowAddSigner",
|
|
2086
|
+
name: "allowAddSigner"
|
|
2087
|
+
},
|
|
2088
|
+
onChange: (e) => Ei({ allowAddSigner: e.target.checked })
|
|
2089
|
+
})
|
|
2090
|
+
})
|
|
2091
|
+
] });
|
|
2092
|
+
}
|
|
2093
|
+
function Ri(e) {
|
|
2094
|
+
let t = ci(e.data.action).map((e) => Nr(L, e));
|
|
2095
|
+
return /* @__PURE__ */ w(n, {
|
|
2096
|
+
label: "知會對象",
|
|
2097
|
+
name: "notifyMemberIds",
|
|
2098
|
+
required: !0,
|
|
2099
|
+
children: /* @__PURE__ */ w(m, {
|
|
2100
|
+
asyncData: !0,
|
|
2101
|
+
disabledOptionsFilter: !0,
|
|
2102
|
+
emptyText: "沒有符合的成員",
|
|
2103
|
+
loading: Vt,
|
|
2104
|
+
loadingText: "搜尋成員中...",
|
|
2105
|
+
mode: "multiple",
|
|
2106
|
+
onChange: (e) => Di({
|
|
2107
|
+
channels: ["IN_APP"],
|
|
2108
|
+
recipients: {
|
|
2109
|
+
memberIds: e.map((e) => e.id),
|
|
2110
|
+
type: "DIRECT"
|
|
2111
|
+
},
|
|
2112
|
+
type: "NOTIFY"
|
|
2113
|
+
}),
|
|
2114
|
+
onSearch: Z,
|
|
2115
|
+
onVisibilityChange: (e) => {
|
|
2116
|
+
e && (Gt([]), Z(""));
|
|
2117
|
+
},
|
|
2118
|
+
options: [...Vr(t, Wt)],
|
|
2119
|
+
overflowStrategy: "wrap",
|
|
2120
|
+
placeholder: "搜尋姓名或信箱",
|
|
2121
|
+
searchDebounceTime: 300,
|
|
2122
|
+
value: [...t]
|
|
2123
|
+
})
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
function zi(e) {
|
|
2127
|
+
return /* @__PURE__ */ T("div", {
|
|
2128
|
+
style: Mt,
|
|
2129
|
+
children: [/* @__PURE__ */ w(S, {
|
|
2130
|
+
component: "h2",
|
|
2131
|
+
variant: "h3",
|
|
2132
|
+
children: "已選取線段"
|
|
2133
|
+
}), /* @__PURE__ */ T(S, {
|
|
2134
|
+
color: "text-neutral",
|
|
2135
|
+
variant: "body",
|
|
2136
|
+
children: [
|
|
2137
|
+
"已選取 ",
|
|
2138
|
+
e.length,
|
|
2139
|
+
" 條線段,可使用 Delete 或控制面板刪除。"
|
|
2140
|
+
]
|
|
2141
|
+
})]
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
function Bi(e) {
|
|
2145
|
+
let t = oi(e, k.nodes);
|
|
2146
|
+
return /* @__PURE__ */ T("div", {
|
|
2147
|
+
style: Mt,
|
|
2148
|
+
children: [
|
|
2149
|
+
/* @__PURE__ */ w(S, {
|
|
2150
|
+
component: "h2",
|
|
2151
|
+
variant: "h3",
|
|
2152
|
+
children: t ? "條件設定" : "線段屬性"
|
|
2153
|
+
}),
|
|
2154
|
+
/* @__PURE__ */ T(S, {
|
|
2155
|
+
color: "text-neutral",
|
|
2156
|
+
variant: "body",
|
|
2157
|
+
children: [
|
|
2158
|
+
e.source,
|
|
2159
|
+
" → ",
|
|
2160
|
+
e.target
|
|
2161
|
+
]
|
|
2162
|
+
}),
|
|
2163
|
+
t ? Hi(e) : /* @__PURE__ */ w(S, {
|
|
2164
|
+
color: "text-neutral",
|
|
2165
|
+
variant: "body",
|
|
2166
|
+
children: "這條線會直接把流程送到下一個節點。"
|
|
2167
|
+
})
|
|
2168
|
+
]
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
function Vi(e) {
|
|
2172
|
+
return !e || !oi(e, k.nodes) ? null : /* @__PURE__ */ w(v, {
|
|
2173
|
+
cancelText: "取消",
|
|
2174
|
+
confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
|
|
2175
|
+
confirmText: "完成",
|
|
2176
|
+
modalType: "standard",
|
|
2177
|
+
onCancel: bi,
|
|
2178
|
+
onClose: bi,
|
|
2179
|
+
onConfirm: bi,
|
|
2180
|
+
open: !!at,
|
|
2181
|
+
showModalFooter: !0,
|
|
2182
|
+
showModalHeader: !0,
|
|
2183
|
+
size: "regular",
|
|
2184
|
+
supportingText: "條件分流的輸出連線需要指定條件,條件會直接顯示在線上。",
|
|
2185
|
+
title: "條件設定",
|
|
2186
|
+
children: Hi(e)
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
function Hi(e) {
|
|
2190
|
+
let t = ai(e, k.nodes), r = Qr(Y?.schema ?? null), i = $r(Y?.schema ?? null, e.data.conditionFieldKey ?? null), a = ei(i), o = ri(i), s = W(a, e.data.conditionOperator ?? null);
|
|
2191
|
+
return /* @__PURE__ */ T("div", {
|
|
2192
|
+
style: Mt,
|
|
2193
|
+
children: [
|
|
2194
|
+
/* @__PURE__ */ T(S, {
|
|
2195
|
+
color: "text-neutral",
|
|
2196
|
+
variant: "body",
|
|
2197
|
+
children: [
|
|
2198
|
+
"畫布上的這條線目前會顯示「",
|
|
2199
|
+
/* @__PURE__ */ w("span", {
|
|
2200
|
+
style: { color: !e.data.isDefault && !e.data.condition ? Ot : void 0 },
|
|
2201
|
+
children: t ?? "請設定條件"
|
|
2202
|
+
}),
|
|
2203
|
+
"」。"
|
|
2204
|
+
]
|
|
2205
|
+
}),
|
|
2206
|
+
/* @__PURE__ */ w(x, {
|
|
2207
|
+
checked: !!e.data.isDefault,
|
|
2208
|
+
label: "其他情況走這條",
|
|
2209
|
+
onChange: (t) => Ai(e.id, t.target.checked)
|
|
2210
|
+
}),
|
|
2211
|
+
e.data.isDefault ? /* @__PURE__ */ w(S, {
|
|
2212
|
+
color: "text-neutral",
|
|
2213
|
+
variant: "body",
|
|
2214
|
+
children: "其他條件都不符合時,流程會走這條線。"
|
|
2215
|
+
}) : /* @__PURE__ */ T(C, { children: [
|
|
2216
|
+
Y ? null : /* @__PURE__ */ w(S, {
|
|
2217
|
+
color: "text-neutral",
|
|
2218
|
+
variant: "body",
|
|
2219
|
+
children: "請先綁定表單版本,才能選擇條件欄位。"
|
|
2220
|
+
}),
|
|
2221
|
+
/* @__PURE__ */ w(n, {
|
|
2222
|
+
label: "條件欄位",
|
|
2223
|
+
name: "edgeConditionField",
|
|
2224
|
+
required: !0,
|
|
2225
|
+
children: /* @__PURE__ */ w(y, {
|
|
2226
|
+
clearable: !1,
|
|
2227
|
+
onChange: (t) => ji({
|
|
2228
|
+
edgeId: e.id,
|
|
2229
|
+
fieldKey: t?.id ?? null,
|
|
2230
|
+
operator: null,
|
|
2231
|
+
value: null
|
|
2232
|
+
}),
|
|
2233
|
+
options: [...r],
|
|
2234
|
+
placeholder: "選擇條件欄位",
|
|
2235
|
+
value: W(r, e.data.conditionFieldKey ?? null)
|
|
2236
|
+
})
|
|
2237
|
+
}),
|
|
2238
|
+
/* @__PURE__ */ w(n, {
|
|
2239
|
+
label: "條件判斷",
|
|
2240
|
+
name: "edgeConditionOperator",
|
|
2241
|
+
required: !0,
|
|
2242
|
+
children: /* @__PURE__ */ w(y, {
|
|
2243
|
+
clearable: !1,
|
|
2244
|
+
onChange: (t) => ji({
|
|
2245
|
+
edgeId: e.id,
|
|
2246
|
+
operator: ti(t?.id ?? null),
|
|
2247
|
+
value: null
|
|
2248
|
+
}),
|
|
2249
|
+
options: [...a],
|
|
2250
|
+
placeholder: "選擇判斷方式",
|
|
2251
|
+
value: s
|
|
2252
|
+
})
|
|
2253
|
+
}),
|
|
2254
|
+
s && ii(s.id) ? /* @__PURE__ */ w(n, {
|
|
2255
|
+
label: "條件值",
|
|
2256
|
+
name: "edgeConditionValue",
|
|
2257
|
+
required: !0,
|
|
2258
|
+
children: o.length > 0 ? /* @__PURE__ */ w(y, {
|
|
2259
|
+
clearable: !1,
|
|
2260
|
+
onChange: (t) => ji({
|
|
2261
|
+
edgeId: e.id,
|
|
2262
|
+
value: t?.id ?? null
|
|
2263
|
+
}),
|
|
2264
|
+
options: [...o],
|
|
2265
|
+
placeholder: "選擇條件值",
|
|
2266
|
+
value: W(o, e.data.conditionValue ?? null)
|
|
2267
|
+
}) : /* @__PURE__ */ w(_, {
|
|
2268
|
+
onChange: (t) => ji({
|
|
2269
|
+
edgeId: e.id,
|
|
2270
|
+
value: t.target.value
|
|
2271
|
+
}),
|
|
2272
|
+
placeholder: "輸入要比對的值",
|
|
2273
|
+
value: e.data.conditionValue ?? "",
|
|
2274
|
+
variant: "base"
|
|
2275
|
+
})
|
|
2276
|
+
}) : null
|
|
2277
|
+
] })
|
|
2278
|
+
]
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
function Sn({ onApplyAutoLayout: e }) {
|
|
2283
|
+
function t() {
|
|
2284
|
+
e();
|
|
2285
|
+
}
|
|
2286
|
+
return /* @__PURE__ */ w(je, {
|
|
2287
|
+
position: "top-right",
|
|
2288
|
+
children: /* @__PURE__ */ w(h, {
|
|
2289
|
+
icon: oe,
|
|
2290
|
+
iconType: "leading",
|
|
2291
|
+
onClick: t,
|
|
2292
|
+
size: "sub",
|
|
2293
|
+
variant: "base-secondary",
|
|
2294
|
+
children: "自動排版"
|
|
2295
|
+
})
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
function V({ data: e, selected: t, type: n }) {
|
|
2299
|
+
let r = e.approverLines ?? [e.approverSummary ?? e.label], i = Cn(e);
|
|
2300
|
+
return /* @__PURE__ */ T("div", {
|
|
2301
|
+
style: wn(n, t),
|
|
2302
|
+
children: [
|
|
2303
|
+
En(e),
|
|
2304
|
+
/* @__PURE__ */ w("div", {
|
|
2305
|
+
style: Yt,
|
|
2306
|
+
children: r.map((e, t) => /* @__PURE__ */ w(S, {
|
|
2307
|
+
component: "span",
|
|
2308
|
+
ellipsis: !0,
|
|
2309
|
+
style: Jt,
|
|
2310
|
+
title: e,
|
|
2311
|
+
variant: "label-primary",
|
|
2312
|
+
children: e
|
|
2313
|
+
}, `${e}_${t}`))
|
|
2314
|
+
}),
|
|
2315
|
+
/* @__PURE__ */ w(S, {
|
|
2316
|
+
color: "text-neutral",
|
|
2317
|
+
component: "span",
|
|
2318
|
+
ellipsis: !0,
|
|
2319
|
+
style: Jt,
|
|
2320
|
+
title: i,
|
|
2321
|
+
variant: "caption",
|
|
2322
|
+
children: i
|
|
2323
|
+
})
|
|
2324
|
+
]
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
function Cn(e) {
|
|
2328
|
+
return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : Qt[e.nodeKind];
|
|
2329
|
+
}
|
|
2330
|
+
function wn(e, t) {
|
|
2331
|
+
let n = Tn(e);
|
|
2332
|
+
return t ? {
|
|
2333
|
+
...n,
|
|
2334
|
+
border: "1px solid var(--mzn-color-primary, #0057ff)",
|
|
2335
|
+
boxShadow: Bt
|
|
2336
|
+
} : n;
|
|
2337
|
+
}
|
|
2338
|
+
function Tn(e) {
|
|
2339
|
+
return e === "exclusiveGateway" ? Gt : e === "parallelGateway" ? Kt : e === "startEvent" ? qt : e === "endEvent" ? z : e === "userTask" ? R : F;
|
|
2340
|
+
}
|
|
2341
|
+
function En(e) {
|
|
2342
|
+
return !e.hasInput && e.hasOutput ? /* @__PURE__ */ w(ke, {
|
|
2343
|
+
id: Zt,
|
|
2344
|
+
position: D.Right,
|
|
2345
|
+
type: "source"
|
|
2346
|
+
}) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ w(ke, {
|
|
2347
|
+
id: Xt,
|
|
2348
|
+
position: D.Left,
|
|
2349
|
+
type: "target"
|
|
2350
|
+
}) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ w(ke, {
|
|
2351
|
+
id: Xt,
|
|
2352
|
+
position: D.Left,
|
|
2353
|
+
type: "target"
|
|
2354
|
+
}, "target"), /* @__PURE__ */ w(ke, {
|
|
2355
|
+
id: Zt,
|
|
2356
|
+
position: D.Right,
|
|
2357
|
+
type: "source"
|
|
2358
|
+
}, "source")];
|
|
2359
|
+
}
|
|
2360
|
+
function Dn(e, t, n, r, i, a) {
|
|
2361
|
+
let o = H(e);
|
|
2362
|
+
return {
|
|
2363
|
+
data: {
|
|
2364
|
+
approverLines: X(e, t),
|
|
2365
|
+
approverSummary: Wr(e, t, n, r),
|
|
2366
|
+
hasInput: G(e),
|
|
2367
|
+
hasOutput: br(e),
|
|
2368
|
+
initiatorPolicySummary: e.type === "startEvent" ? hr(a, n, r) : null,
|
|
2369
|
+
label: e.data.label,
|
|
2370
|
+
nodeKind: e.type
|
|
2371
|
+
},
|
|
2372
|
+
height: o.height,
|
|
2373
|
+
handles: On(e),
|
|
2374
|
+
id: e.id,
|
|
2375
|
+
initialHeight: o.height,
|
|
2376
|
+
initialWidth: o.width,
|
|
2377
|
+
position: e.position,
|
|
2378
|
+
selected: i,
|
|
2379
|
+
sourcePosition: D.Right,
|
|
2380
|
+
targetPosition: D.Left,
|
|
2381
|
+
type: e.type,
|
|
2382
|
+
width: o.width
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
2385
|
+
function H(e) {
|
|
2386
|
+
return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
|
|
2387
|
+
height: L,
|
|
2388
|
+
width: Ut
|
|
2389
|
+
} : e.type === "serviceTask" ? {
|
|
2390
|
+
height: I + (Math.max(1, ci(e.data.action).length) - 1) * Ht,
|
|
2391
|
+
width: Vt
|
|
2392
|
+
} : {
|
|
2393
|
+
height: I,
|
|
2394
|
+
width: Vt
|
|
2395
|
+
};
|
|
2396
|
+
}
|
|
2397
|
+
function On(e) {
|
|
2398
|
+
let t = H(e);
|
|
2399
|
+
return [...G(e) ? [kn(t)] : [], ...br(e) ? [An(t)] : []];
|
|
2400
|
+
}
|
|
2401
|
+
function kn({ height: e }) {
|
|
2402
|
+
let t = e / 2 - 9 / 2;
|
|
2403
|
+
return {
|
|
2404
|
+
height: 9,
|
|
2405
|
+
id: Xt,
|
|
2406
|
+
position: D.Left,
|
|
2407
|
+
type: "target",
|
|
2408
|
+
width: 9,
|
|
2409
|
+
x: -9 / 2,
|
|
2410
|
+
y: t
|
|
2411
|
+
};
|
|
2412
|
+
}
|
|
2413
|
+
function An({ height: e, width: t }) {
|
|
2414
|
+
let n = e / 2 - 9 / 2;
|
|
2415
|
+
return {
|
|
2416
|
+
height: 9,
|
|
2417
|
+
id: Zt,
|
|
2418
|
+
position: D.Right,
|
|
2419
|
+
type: "source",
|
|
2420
|
+
width: 9,
|
|
2421
|
+
x: t - 9 / 2,
|
|
2422
|
+
y: n
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
function jn(e, t, n) {
|
|
2426
|
+
let r = ai(e, t), i = oi(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? Ot : i ? Dt : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? Ot : i ? Dt : P;
|
|
2427
|
+
return {
|
|
2428
|
+
className: n ? "workflow-edge--selected" : void 0,
|
|
2429
|
+
data: e.data,
|
|
2430
|
+
id: e.id,
|
|
2431
|
+
label: r,
|
|
2432
|
+
labelBgBorderRadius: 6,
|
|
2433
|
+
labelBgPadding: [8, 4],
|
|
2434
|
+
labelBgStyle: {
|
|
2435
|
+
fill: s,
|
|
2436
|
+
stroke: c,
|
|
2437
|
+
strokeWidth: 1
|
|
2438
|
+
},
|
|
2439
|
+
labelShowBg: !!r,
|
|
2440
|
+
labelStyle: {
|
|
2441
|
+
fill: o,
|
|
2442
|
+
fontSize: 12,
|
|
2443
|
+
fontWeight: 600
|
|
2444
|
+
},
|
|
2445
|
+
selected: n,
|
|
2446
|
+
source: e.source,
|
|
2447
|
+
sourceHandle: e.sourceHandle,
|
|
2448
|
+
style: {
|
|
2449
|
+
filter: n ? kt : void 0,
|
|
2450
|
+
opacity: 1,
|
|
2451
|
+
stroke: P,
|
|
2452
|
+
strokeOpacity: 1,
|
|
2453
|
+
strokeWidth: 1.5
|
|
2454
|
+
},
|
|
2455
|
+
target: e.target,
|
|
2456
|
+
targetHandle: e.targetHandle,
|
|
2457
|
+
type: e.type ?? "smoothstep"
|
|
2458
|
+
};
|
|
2459
|
+
}
|
|
2460
|
+
function Mn(e, t) {
|
|
2461
|
+
return e.type === "startEvent" ? e : (e.type === "endEvent" || e.type === "userTask" || e.type === "serviceTask" || e.type, {
|
|
2462
|
+
...e,
|
|
2463
|
+
data: {
|
|
2464
|
+
...e.data,
|
|
2465
|
+
triggerMode: t
|
|
2466
|
+
}
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
function Nn(e) {
|
|
2470
|
+
return In(Pn(Fn(U(e))));
|
|
2471
|
+
}
|
|
2472
|
+
function U(e) {
|
|
2473
|
+
let t = e.edges.map((e) => {
|
|
2474
|
+
let t = e.data ?? {};
|
|
2475
|
+
return e.data === t ? e : {
|
|
2476
|
+
...e,
|
|
2477
|
+
data: t
|
|
2478
|
+
};
|
|
2479
|
+
});
|
|
2480
|
+
return t.some((t, n) => t !== e.edges[n]) ? {
|
|
2481
|
+
...e,
|
|
2482
|
+
edges: t
|
|
2483
|
+
} : e;
|
|
2484
|
+
}
|
|
2485
|
+
function Pn(e) {
|
|
2486
|
+
let t = e.nodes.map((e) => {
|
|
2487
|
+
if (e.type !== "userTask") return e;
|
|
2488
|
+
let t = e.data.allowAddSigner ?? !1, n = e.data.allowReject ?? !0, r = e.data.allowTransfer ?? !0, i = !e.data.decisionPolicy;
|
|
2489
|
+
return e.data.allowAddSigner === t && e.data.allowReject === n && e.data.allowTransfer === r && !i ? e : {
|
|
2490
|
+
...e,
|
|
2491
|
+
data: {
|
|
2492
|
+
...e.data,
|
|
2493
|
+
allowAddSigner: t,
|
|
2494
|
+
allowReject: n,
|
|
2495
|
+
allowTransfer: r,
|
|
2496
|
+
decisionPolicy: e.data.decisionPolicy ?? { type: "SINGLE" }
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2499
|
+
});
|
|
2500
|
+
return t.some((t, n) => t !== e.nodes[n]) ? {
|
|
2501
|
+
...e,
|
|
2502
|
+
nodes: t
|
|
2503
|
+
} : e;
|
|
2504
|
+
}
|
|
2505
|
+
function Fn(e) {
|
|
2506
|
+
let t = new Set(e.nodes.filter((e) => xr(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
|
|
2507
|
+
return n.length === e.edges.length ? e : {
|
|
2508
|
+
...e,
|
|
2509
|
+
edges: n
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
function In(e) {
|
|
2513
|
+
let t = e.edges.reduce((e, t) => ({
|
|
2514
|
+
...e,
|
|
2515
|
+
[t.target]: (e[t.target] ?? 0) + 1
|
|
2516
|
+
}), {}), n = e.nodes.map((e) => e.type === "startEvent" ? e : (t[e.id] ?? 0) < 2 && e.data.triggerMode !== "AND" ? Mn(e, "AND") : e);
|
|
2517
|
+
return n.some((t, n) => t !== e.nodes[n]) ? {
|
|
2518
|
+
...e,
|
|
2519
|
+
nodes: n
|
|
2520
|
+
} : e;
|
|
2521
|
+
}
|
|
2522
|
+
function Ln() {
|
|
2523
|
+
return {
|
|
2524
|
+
edges: [],
|
|
2525
|
+
meta: { schemaVersion: 1 },
|
|
2526
|
+
nodes: [{
|
|
2527
|
+
data: { label: "開始" },
|
|
2528
|
+
id: "start",
|
|
2529
|
+
position: {
|
|
2530
|
+
x: 80,
|
|
2531
|
+
y: 160
|
|
2532
|
+
},
|
|
2533
|
+
type: "startEvent"
|
|
2534
|
+
}, {
|
|
2535
|
+
data: {
|
|
2536
|
+
endState: "APPROVED",
|
|
2537
|
+
label: "完成",
|
|
2538
|
+
triggerMode: "AND"
|
|
2539
|
+
},
|
|
2540
|
+
id: "end",
|
|
2541
|
+
position: {
|
|
2542
|
+
x: 560,
|
|
2543
|
+
y: 160
|
|
2544
|
+
},
|
|
2545
|
+
type: "endEvent"
|
|
2546
|
+
}]
|
|
2547
|
+
};
|
|
2548
|
+
}
|
|
2549
|
+
function Rn(e) {
|
|
2550
|
+
return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
|
|
2551
|
+
}
|
|
2552
|
+
function zn(e) {
|
|
2553
|
+
let t = new Fe.graphlib.Graph();
|
|
2554
|
+
return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
|
|
2555
|
+
rankdir: "LR",
|
|
2556
|
+
ranksep: 120
|
|
2557
|
+
}), e.nodes.forEach((e) => {
|
|
2558
|
+
t.setNode(e.id, H(e));
|
|
2559
|
+
}), e.edges.forEach((e) => {
|
|
2560
|
+
t.setEdge(e.source, e.target);
|
|
2561
|
+
}), Fe.layout(t), {
|
|
2562
|
+
...e,
|
|
2563
|
+
nodes: e.nodes.map((e) => {
|
|
2564
|
+
let n = t.node(e.id);
|
|
2565
|
+
return n ? {
|
|
2566
|
+
...e,
|
|
2567
|
+
position: {
|
|
2568
|
+
x: n.x - H(e).width / 2,
|
|
2569
|
+
y: n.y - H(e).height / 2
|
|
2570
|
+
}
|
|
2571
|
+
} : e;
|
|
2572
|
+
})
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
function W(e, t) {
|
|
2576
|
+
return t ? e.find((e) => e.id === t) ?? null : null;
|
|
2577
|
+
}
|
|
2578
|
+
function Bn(e) {
|
|
2579
|
+
return e === "OR" ? "OR" : "AND";
|
|
2580
|
+
}
|
|
2581
|
+
function Vn(e) {
|
|
2582
|
+
return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
|
|
2583
|
+
}
|
|
2584
|
+
function Hn(e) {
|
|
2585
|
+
if (!e || e.type === "SINGLE" || e.type === "PARALLEL_ANY") return "可指定多位;多位時所有人都會收到待辦,任一人同意即可通過。";
|
|
2586
|
+
if (e.type === "PARALLEL_ALL") return "可指定多位;多位時所有人都會收到待辦,全部同意後才會通過。";
|
|
2587
|
+
if (e.type === "SEQUENTIAL") return "可指定多位;所有人會同時收到待辦,需全部同意後才會通過。";
|
|
2588
|
+
let t = e.thresholdType === "PERCENTAGE" ? "%" : " 位簽核者";
|
|
2589
|
+
return `可指定多位;需達到 ${e.threshold}${t} 才會通過。`;
|
|
2590
|
+
}
|
|
2591
|
+
function Un(e) {
|
|
2592
|
+
return e?.type ?? "SINGLE";
|
|
2593
|
+
}
|
|
2594
|
+
function Wn(e) {
|
|
2595
|
+
return on.find((t) => t.id === e) || (e === "SEQUENTIAL" ? {
|
|
2596
|
+
id: e,
|
|
2597
|
+
name: "全部同意(既有設定)"
|
|
2598
|
+
} : {
|
|
2599
|
+
id: e,
|
|
2600
|
+
name: `未知決策方式(${e})`
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
function Gn(e, t) {
|
|
2604
|
+
return e === "QUORUM" ? t?.type === "QUORUM" ? t : {
|
|
2605
|
+
threshold: Ke,
|
|
2606
|
+
thresholdType: "COUNT",
|
|
2607
|
+
type: "QUORUM"
|
|
2608
|
+
} : e === "PARALLEL_ALL" || e === "PARALLEL_ANY" || e === "SEQUENTIAL" ? { type: e } : { type: "SINGLE" };
|
|
2609
|
+
}
|
|
2610
|
+
function Kn(e) {
|
|
2611
|
+
return e?.type === "QUORUM" ? {
|
|
2612
|
+
threshold: Number.isFinite(e.threshold) ? e.threshold : Ke,
|
|
2613
|
+
thresholdType: qn(e.thresholdType ?? null)
|
|
2614
|
+
} : {
|
|
2615
|
+
threshold: Ke,
|
|
2616
|
+
thresholdType: "COUNT"
|
|
2617
|
+
};
|
|
2618
|
+
}
|
|
2619
|
+
function qn(e) {
|
|
2620
|
+
return e === "PERCENTAGE" ? "PERCENTAGE" : "COUNT";
|
|
2621
|
+
}
|
|
2622
|
+
function Jn(e) {
|
|
2623
|
+
return e === "HOUR" ? "HOUR" : "DAY";
|
|
2624
|
+
}
|
|
2625
|
+
function Yn(e) {
|
|
2626
|
+
return e === "BUSINESS_DAY" ? "BUSINESS_DAY" : "CALENDAR";
|
|
2627
|
+
}
|
|
2628
|
+
function Xn(e) {
|
|
2629
|
+
return Xe.find((t) => t.id === e)?.id ?? "REMIND";
|
|
2630
|
+
}
|
|
2631
|
+
function Zn(e) {
|
|
2632
|
+
return rn.find((t) => t.value === e) ?? rn[0];
|
|
2633
|
+
}
|
|
2634
|
+
function Qn(e) {
|
|
2635
|
+
return rn.find((t) => t.id === e) ?? rn[0];
|
|
2636
|
+
}
|
|
2637
|
+
function $n(e, t) {
|
|
2638
|
+
let n = Number.isFinite(t.value) ? Math.trunc(t.value) : 1, r = Qe({
|
|
2639
|
+
unit: t.unit,
|
|
2640
|
+
value: n
|
|
2641
|
+
});
|
|
2642
|
+
return {
|
|
2643
|
+
...e,
|
|
2644
|
+
calendar: t.unit === "DAY" ? e.calendar ?? "CALENDAR" : "CALENDAR",
|
|
2645
|
+
duration: r
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2648
|
+
function er(e, t) {
|
|
2649
|
+
return t === "ESCALATE" ? {
|
|
2650
|
+
...e,
|
|
2651
|
+
escalateLevelsUp: e.escalateLevelsUp ?? 1,
|
|
2652
|
+
onTimeout: t
|
|
2653
|
+
} : {
|
|
2654
|
+
...nr(e, "escalateLevelsUp"),
|
|
2655
|
+
onTimeout: t
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
function tr(e, t) {
|
|
2659
|
+
return t === null ? nr(e, "warningAt") : {
|
|
2660
|
+
...e,
|
|
2661
|
+
warningAt: t
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
function nr(e, t) {
|
|
2665
|
+
return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
|
|
2666
|
+
}
|
|
2667
|
+
function rr(e) {
|
|
2668
|
+
return e === "ORG_MANAGER" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
|
|
2669
|
+
}
|
|
2670
|
+
function ir(e) {
|
|
2671
|
+
let t = rr(e ?? "DIRECT");
|
|
2672
|
+
return t === "ORG_MANAGER" ? {
|
|
2673
|
+
baseFromInitiator: !0,
|
|
2674
|
+
levelsUp: 1,
|
|
2675
|
+
type: "ORG_MANAGER"
|
|
2676
|
+
} : t === "ORG_UNIT_MANAGER" ? {
|
|
2677
|
+
orgUnitId: "",
|
|
2678
|
+
type: "ORG_UNIT_MANAGER"
|
|
2679
|
+
} : t === "ORG_UNIT_MEMBER" ? {
|
|
2680
|
+
includeDescendants: !1,
|
|
2681
|
+
orgUnitId: "",
|
|
2682
|
+
type: "ORG_UNIT_MEMBER"
|
|
2683
|
+
} : t === "ORG_UNIT_POSITION" ? {
|
|
2684
|
+
includeDescendants: !1,
|
|
2685
|
+
orgUnitId: "",
|
|
2686
|
+
positionId: "",
|
|
2687
|
+
type: "ORG_UNIT_POSITION"
|
|
2688
|
+
} : t === "POSITION" ? {
|
|
2689
|
+
positionId: "",
|
|
2690
|
+
type: "POSITION"
|
|
2691
|
+
} : {
|
|
2692
|
+
memberIds: [],
|
|
2693
|
+
type: "DIRECT"
|
|
2694
|
+
};
|
|
2695
|
+
}
|
|
2696
|
+
function ar(e) {
|
|
2697
|
+
return e === "DIRECT" ? "DIRECT" : "NONE";
|
|
2698
|
+
}
|
|
2699
|
+
function or(e, t) {
|
|
2700
|
+
return e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER" ? {
|
|
2701
|
+
...e,
|
|
2702
|
+
fallback: t
|
|
2703
|
+
} : e;
|
|
2704
|
+
}
|
|
2705
|
+
function sr(e) {
|
|
2706
|
+
return B.find((t) => t.value === e) ?? B[0];
|
|
2707
|
+
}
|
|
2708
|
+
function cr(e) {
|
|
2709
|
+
return B.find((t) => t.id === e) ?? B[0];
|
|
2710
|
+
}
|
|
2711
|
+
function lr(e) {
|
|
2712
|
+
return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
|
|
2713
|
+
}
|
|
2714
|
+
function ur(e) {
|
|
2715
|
+
let t = e?.trim();
|
|
2716
|
+
if (!t) return {
|
|
2717
|
+
mode: "ALL",
|
|
2718
|
+
value: ""
|
|
2719
|
+
};
|
|
2720
|
+
let n = pr(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = pr(t, /"([^"]+)" in subject\.positionIds/gu);
|
|
2721
|
+
return n.length > 0 && r.length > 0 ? {
|
|
2722
|
+
includeDescendants: n.length > 1,
|
|
2723
|
+
mode: "ORG_UNIT_POSITION",
|
|
2724
|
+
orgUnitId: n[0],
|
|
2725
|
+
positionId: r[0],
|
|
2726
|
+
value: n[0] ?? ""
|
|
2727
|
+
} : n.length > 0 ? {
|
|
2728
|
+
includeDescendants: n.length > 1,
|
|
2729
|
+
mode: "ORG_UNIT",
|
|
2730
|
+
orgUnitId: n[0],
|
|
2731
|
+
value: n[0] ?? ""
|
|
2732
|
+
} : {
|
|
2733
|
+
mode: "CUSTOM",
|
|
2734
|
+
value: t
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
function dr(e, t) {
|
|
2738
|
+
let n = ur(e);
|
|
2739
|
+
return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
|
|
2740
|
+
mode: t,
|
|
2741
|
+
value: ""
|
|
2742
|
+
} : n : n.mode === t ? n : gr(t);
|
|
2743
|
+
}
|
|
2744
|
+
function fr(e) {
|
|
2745
|
+
return e.mode === "NONE" ? "發起權限需要選擇誰可以發起。" : (e.mode === "ORG_UNIT" || e.mode === "ORG_UNIT_POSITION") && !e.orgUnitId?.trim() ? "指定組織發起時,需要選擇組織。" : e.mode === "ORG_UNIT_POSITION" && !e.positionId?.trim() ? "指定組織職位發起時,需要選擇職位。" : null;
|
|
2746
|
+
}
|
|
2747
|
+
function pr(e, t) {
|
|
2748
|
+
return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
|
|
2749
|
+
}
|
|
2750
|
+
function mr(e, t) {
|
|
2751
|
+
if (e.mode === "ALL" || e.mode === "NONE") return null;
|
|
2752
|
+
let n = e.orgUnitId?.trim() ?? "";
|
|
2753
|
+
if (!n) return null;
|
|
2754
|
+
let r = Br(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
|
|
2755
|
+
if (e.mode === "ORG_UNIT") return r ? `(${r})` : null;
|
|
2756
|
+
let i = e.positionId?.trim() ?? "";
|
|
2757
|
+
return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
|
|
2758
|
+
}
|
|
2759
|
+
function hr(e, t, n) {
|
|
2760
|
+
return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${K(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${K(t, e.orgUnitId)} / ${q(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
|
|
2761
|
+
}
|
|
2762
|
+
function gr(e) {
|
|
2763
|
+
return {
|
|
2764
|
+
includeDescendants: !0,
|
|
2765
|
+
mode: e,
|
|
2766
|
+
orgUnitId: "",
|
|
2767
|
+
positionId: "",
|
|
2768
|
+
value: ""
|
|
2769
|
+
};
|
|
2770
|
+
}
|
|
2771
|
+
function _r(e, t) {
|
|
2772
|
+
let n = e.source ? t.find((t) => t.id === e.source) ?? null : null, r = e.target ? t.find((t) => t.id === e.target) ?? null : null;
|
|
2773
|
+
return !!n && !!r && e.source !== e.target && e.sourceHandle === Zt && e.targetHandle === Xt && !!(n && br(n)) && !!(r && G(r));
|
|
2774
|
+
}
|
|
2775
|
+
function vr(e, t) {
|
|
2776
|
+
return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
|
|
2777
|
+
}
|
|
2778
|
+
function yr(e) {
|
|
2779
|
+
return e.type !== "startEvent" && e.type !== "endEvent";
|
|
2780
|
+
}
|
|
2781
|
+
function G(e) {
|
|
2782
|
+
return e.type !== "startEvent";
|
|
2783
|
+
}
|
|
2784
|
+
function br(e) {
|
|
2785
|
+
return e.type !== "endEvent" && !xr(e);
|
|
2786
|
+
}
|
|
2787
|
+
function xr(e) {
|
|
2788
|
+
return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
|
|
2789
|
+
}
|
|
2790
|
+
function Sr(e) {
|
|
2791
|
+
return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
|
|
2792
|
+
}
|
|
2793
|
+
function Cr(e) {
|
|
2794
|
+
return e.map((e) => ({
|
|
2795
|
+
formDefinitionId: e.formDefinitionId,
|
|
2796
|
+
formName: e.formName,
|
|
2797
|
+
id: e.id,
|
|
2798
|
+
name: `${e.formName} | v${e.version}`,
|
|
2799
|
+
schema: e.schema
|
|
2800
|
+
}));
|
|
2801
|
+
}
|
|
2802
|
+
function wr(e) {
|
|
2803
|
+
return (e?.schema.fields ?? []).reduce((e, t) => ({
|
|
2804
|
+
...e,
|
|
2805
|
+
[t.fieldKey]: Tr(t)
|
|
2806
|
+
}), {});
|
|
2807
|
+
}
|
|
2808
|
+
function Tr(e) {
|
|
2809
|
+
return e.type === "number" ? 1e3 : e.type === "boolean" ? !0 : Ce(e) ? e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.options[0]?.value ?? "" : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
|
|
2810
|
+
}
|
|
2811
|
+
function Er(e) {
|
|
2812
|
+
let t = JSON.parse(e);
|
|
2813
|
+
if (!Dr(t)) throw Error("表單資料 JSON 必須是物件。");
|
|
2814
|
+
return t;
|
|
2815
|
+
}
|
|
2816
|
+
function Dr(e) {
|
|
2817
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2818
|
+
}
|
|
2819
|
+
function Or(e) {
|
|
2820
|
+
return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
|
|
2821
|
+
}
|
|
2822
|
+
function kr(e) {
|
|
2823
|
+
return e in Qt ? Qt[e] : e;
|
|
2824
|
+
}
|
|
2825
|
+
function Ar(e, t) {
|
|
2826
|
+
return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
|
|
2827
|
+
}
|
|
2828
|
+
function jr(e) {
|
|
2829
|
+
return e.map((e) => ({
|
|
2830
|
+
displayName: e.name,
|
|
2831
|
+
email: e.email,
|
|
2832
|
+
id: e.memberId,
|
|
2833
|
+
memberId: e.memberId,
|
|
2834
|
+
name: qr(e.name, e.email)
|
|
2835
|
+
}));
|
|
2836
|
+
}
|
|
2837
|
+
function Mr(e) {
|
|
2838
|
+
return {
|
|
2839
|
+
displayName: "未知會員",
|
|
2840
|
+
email: "",
|
|
2841
|
+
id: e,
|
|
2842
|
+
memberId: e,
|
|
2843
|
+
name: "未知會員",
|
|
2844
|
+
unresolved: !0
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
function Nr(e, t) {
|
|
2848
|
+
return e.find((e) => e.memberId === t) ?? Mr(t);
|
|
2849
|
+
}
|
|
2850
|
+
function Pr(e, t) {
|
|
2851
|
+
let n = e.find((e) => e.id === t);
|
|
2852
|
+
return n ? r(n) : null;
|
|
2853
|
+
}
|
|
2854
|
+
function Fr(e, t) {
|
|
2855
|
+
let n = e.find((e) => e.id === t);
|
|
2856
|
+
return n ? a(n) : null;
|
|
2857
|
+
}
|
|
2858
|
+
function K(e, t) {
|
|
2859
|
+
return Pr(e, t)?.name ?? "未指定組織";
|
|
2860
|
+
}
|
|
2861
|
+
function q(e, t) {
|
|
2862
|
+
return Fr(e, t)?.name ?? "未指定職位";
|
|
2863
|
+
}
|
|
2864
|
+
function Ir(e, t) {
|
|
2865
|
+
let n = J(), r = t.filter((t) => t.memberId === e && Lr(t, n)), i = r.reduce((e, t) => e && Rr(e, t) <= 0 ? e : t, null);
|
|
2866
|
+
return {
|
|
2867
|
+
customFields: {},
|
|
2868
|
+
managerMemberId: "member-002",
|
|
2869
|
+
memberId: e,
|
|
2870
|
+
orgCode: "HQ",
|
|
2871
|
+
orgUnitIds: Y(r.map((e) => e.orgUnitId)),
|
|
2872
|
+
positionId: i?.positionId ?? null,
|
|
2873
|
+
positionIds: Y(r.map((e) => e.positionId)),
|
|
2874
|
+
primaryOrgUnitId: i?.orgUnitId ?? null,
|
|
2875
|
+
roles: ["manager"]
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
function J() {
|
|
2879
|
+
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2880
|
+
}
|
|
2881
|
+
function Lr(e, t) {
|
|
2882
|
+
return e.effectiveFrom <= t && (!e.effectiveTo || e.effectiveTo >= t);
|
|
2883
|
+
}
|
|
2884
|
+
function Rr(e, t) {
|
|
2885
|
+
return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
|
|
2886
|
+
}
|
|
2887
|
+
function Y(e) {
|
|
2888
|
+
return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
|
|
2889
|
+
}
|
|
2890
|
+
function zr({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
|
|
2891
|
+
let a = new Set(Br(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
|
|
2892
|
+
return i.filter((e) => o.has(e.id));
|
|
2893
|
+
}
|
|
2894
|
+
function Br(e, t, n) {
|
|
2895
|
+
let r = e.find((e) => e.id === t);
|
|
2896
|
+
return r ? n ? e.filter((e) => e.id === r.id || e.path.startsWith(`${r.path}.`)).map((e) => e.id) : [r.id] : t.trim() ? [t] : [];
|
|
2897
|
+
}
|
|
2898
|
+
function Vr(e, t) {
|
|
2899
|
+
let n = new Map(t.filter((e) => !e.unresolved).map((e) => [e.memberId, e])), r = new Set(e.map((e) => e.memberId)), i = t.filter((e) => !r.has(e.memberId)), a = e.map((e) => (e.unresolved ? n.get(e.memberId) : null) ?? e);
|
|
2900
|
+
return i.length > 0 || a.some((t, n) => t !== e[n]) ? [...a, ...i] : e;
|
|
2901
|
+
}
|
|
2902
|
+
function Hr(e) {
|
|
2903
|
+
return e.type === "DIRECT" ? e.memberIds : (e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && e.fallback.memberId ? [e.fallback.memberId] : [];
|
|
2904
|
+
}
|
|
2905
|
+
function Ur(e) {
|
|
2906
|
+
return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? Hr(e.data.approverResolver) : e.type === "serviceTask" ? ci(e.data.action) : []))];
|
|
2907
|
+
}
|
|
2908
|
+
function Wr(e, t, n, r) {
|
|
2909
|
+
return e.type === "userTask" ? Gr(e.data.approverResolver, t, n, r) : null;
|
|
2910
|
+
}
|
|
2911
|
+
function Gr(e, t, n, r) {
|
|
2912
|
+
return e.type === "DIRECT" ? Kr(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? sr(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${K(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${K(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${K(n, e.orgUnitId)} / ${q(r, e.positionId)}` : e.type === "POSITION" ? `職位:${q(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
|
|
2913
|
+
}
|
|
2914
|
+
function X(e, t) {
|
|
2915
|
+
if (e.type !== "serviceTask") return null;
|
|
2916
|
+
let n = ci(e.data.action);
|
|
2917
|
+
return n.length === 0 ? ["未指定知會對象"] : n.map((e) => Nr(t, e).name);
|
|
2918
|
+
}
|
|
2919
|
+
function Kr(e, t, n) {
|
|
2920
|
+
let r = e.map((e) => Nr(t, e).name);
|
|
2921
|
+
return r.length === 0 ? n : r.length <= 2 ? r.join("、") : `${r.slice(0, 2).join("、")} 等 ${r.length} 人`;
|
|
2922
|
+
}
|
|
2923
|
+
function qr(e, t) {
|
|
2924
|
+
return `${e} (${t})`;
|
|
2925
|
+
}
|
|
2926
|
+
function Jr(e, t) {
|
|
2927
|
+
let n = t?.getBoundingClientRect();
|
|
2928
|
+
if (!n || e.nodes.length === 0) return null;
|
|
2929
|
+
let r = e.nodes.reduce((e, t) => {
|
|
2930
|
+
let n = H(t);
|
|
2931
|
+
return {
|
|
2932
|
+
maxX: Math.max(e.maxX, t.position.x + n.width),
|
|
2933
|
+
maxY: Math.max(e.maxY, t.position.y + n.height),
|
|
2934
|
+
minX: Math.min(e.minX, t.position.x),
|
|
2935
|
+
minY: Math.min(e.minY, t.position.y)
|
|
2936
|
+
};
|
|
2937
|
+
}, {
|
|
2938
|
+
maxX: -Infinity,
|
|
2939
|
+
maxY: -Infinity,
|
|
2940
|
+
minX: Infinity,
|
|
2941
|
+
minY: Infinity
|
|
2942
|
+
});
|
|
2943
|
+
return Pe({
|
|
2944
|
+
height: r.maxY - r.minY,
|
|
2945
|
+
width: r.maxX - r.minX,
|
|
2946
|
+
x: r.minX,
|
|
2947
|
+
y: r.minY
|
|
2948
|
+
}, n.width, n.height, .1, 1, .2);
|
|
2949
|
+
}
|
|
2950
|
+
function Yr(e) {
|
|
2951
|
+
let t = e.nodes.find((e) => e.type === "userTask" && !!Xr(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "serviceTask" && e.data.action.type === "NOTIFY" && ci(e.data.action).length === 0), r = e.edges.find((t) => oi(t, e.nodes) && !t.data.isDefault && !t.data.condition);
|
|
2952
|
+
return t && t.type === "userTask" ? Xr(t.data.approverResolver) : n ? "知會節點需要至少一位知會對象。" : r ? "條件分流的每條輸出連線都需要先設定條件。" : null;
|
|
2953
|
+
}
|
|
2954
|
+
function Xr(e) {
|
|
2955
|
+
return e.type === "DIRECT" && e.memberIds.length === 0 ? "簽核節點需要指定簽核會員。" : e.type === "ORG_MANAGER" && e.levelsUp < 1 ? "簽核節點需要指定有效的主管層級。" : e.type === "ORG_UNIT_MANAGER" && !e.orgUnitId.trim() || e.type === "ORG_UNIT_MEMBER" && !e.orgUnitId.trim() ? "簽核節點需要指定組織。" : e.type === "ORG_UNIT_POSITION" && (!e.orgUnitId.trim() || !e.positionId.trim()) ? "簽核節點需要指定組織與職位。" : (e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && !e.fallback.memberId.trim() ? "簽核節點需要指定改派固定人。" : e.type === "POSITION" && !e.positionId.trim() ? "簽核節點需要指定職位。" : null;
|
|
2956
|
+
}
|
|
2957
|
+
function Zr(e) {
|
|
2958
|
+
return e.edges.some((t) => oi(t, e.nodes) && !!(t.data.condition || t.data.conditionFieldKey || t.data.conditionOperator || t.data.conditionValue));
|
|
2959
|
+
}
|
|
2960
|
+
function Qr(e) {
|
|
2961
|
+
return e?.fields.map((e) => ({
|
|
2962
|
+
fieldType: e.type,
|
|
2963
|
+
id: e.fieldKey,
|
|
2964
|
+
name: `${e.label} (${e.fieldKey})`
|
|
2965
|
+
})) ?? [];
|
|
2966
|
+
}
|
|
2967
|
+
function $r(e, t) {
|
|
2968
|
+
return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
|
|
2969
|
+
}
|
|
2970
|
+
function ei(e) {
|
|
2971
|
+
if (!e) return [];
|
|
2972
|
+
let t = ni(e);
|
|
2973
|
+
return ln.filter((e) => t.includes(e.id));
|
|
2974
|
+
}
|
|
2975
|
+
function ti(e) {
|
|
2976
|
+
return ln.some((t) => t.id === e) ? e : null;
|
|
2977
|
+
}
|
|
2978
|
+
function ni(e) {
|
|
2979
|
+
return e.type === "file_upload" ? ["IS_FILLED", "IS_EMPTY"] : e.type === "boolean" ? [
|
|
2980
|
+
"EQUALS",
|
|
2981
|
+
"NOT_EQUALS",
|
|
2982
|
+
"IS_FILLED",
|
|
2983
|
+
"IS_EMPTY"
|
|
2984
|
+
] : e.type === "date" || e.type === "datetime" || e.type === "money" || e.type === "number" ? [
|
|
2985
|
+
"EQUALS",
|
|
2986
|
+
"NOT_EQUALS",
|
|
2987
|
+
"GREATER_THAN",
|
|
2988
|
+
"GREATER_THAN_OR_EQUALS",
|
|
2989
|
+
"LESS_THAN",
|
|
2990
|
+
"LESS_THAN_OR_EQUALS",
|
|
2991
|
+
"IS_FILLED",
|
|
2992
|
+
"IS_EMPTY"
|
|
2993
|
+
] : [
|
|
2994
|
+
"EQUALS",
|
|
2995
|
+
"NOT_EQUALS",
|
|
2996
|
+
"IS_FILLED",
|
|
2997
|
+
"IS_EMPTY"
|
|
2998
|
+
];
|
|
2999
|
+
}
|
|
3000
|
+
function ri(e) {
|
|
3001
|
+
return e ? e.type === "boolean" ? [{
|
|
3002
|
+
id: "true",
|
|
3003
|
+
name: "是"
|
|
3004
|
+
}, {
|
|
3005
|
+
id: "false",
|
|
3006
|
+
name: "否"
|
|
3007
|
+
}] : Ce(e) ? e.options.map((e) => ({
|
|
3008
|
+
id: e.value,
|
|
3009
|
+
name: e.label
|
|
3010
|
+
})) : [] : [];
|
|
3011
|
+
}
|
|
3012
|
+
function ii(e) {
|
|
3013
|
+
return un.includes(e);
|
|
3014
|
+
}
|
|
3015
|
+
function ai(e, t) {
|
|
3016
|
+
if (e.data.label) return e.data.label;
|
|
3017
|
+
if (oi(e, t)) return Z(e);
|
|
3018
|
+
if (si(e, t)) return "同時進行";
|
|
3019
|
+
}
|
|
3020
|
+
function Z(e) {
|
|
3021
|
+
return e.data.isDefault ? "其他情況" : "請設定條件";
|
|
3022
|
+
}
|
|
3023
|
+
function oi(e, t) {
|
|
3024
|
+
return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
|
|
3025
|
+
}
|
|
3026
|
+
function si(e, t) {
|
|
3027
|
+
return t.some((t) => t.id === e.source && t.type === "parallelGateway");
|
|
3028
|
+
}
|
|
3029
|
+
function ci(e) {
|
|
3030
|
+
return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
|
|
3031
|
+
}
|
|
3032
|
+
function li(e) {
|
|
3033
|
+
return e instanceof Error ? Se(e.message) : "發生未知錯誤";
|
|
3034
|
+
}
|
|
3035
|
+
//#endregion
|
|
3036
|
+
export { xn as t };
|
|
3037
|
+
|
|
3038
|
+
//# sourceMappingURL=designer-BszXJ5RO.js.map
|