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