@qfei-design/make-app-approval 0.2.15 → 0.2.17
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/PUBLIC_API.md +103 -1
- package/README.md +5 -0
- package/capabilities.json +14 -0
- package/dist/detail/instance-types.d.ts +4 -1
- package/dist/detail/types.d.ts +4 -1
- package/dist/detail.cjs +1 -1
- package/dist/detail.mjs +308 -298
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +37 -14
- package/dist/list/approval-canvas-theme.d.ts +7 -0
- package/dist/list/approval-columns.d.ts +1 -1
- package/dist/list/approval-header-icons.d.ts +2 -0
- package/dist/list/types.d.ts +4 -0
- package/dist/list/ui-components.d.ts +5 -1
- package/dist/list.cjs +1 -1
- package/dist/list.mjs +380 -348
- package/dist/mobile/index.d.ts +2 -0
- package/dist/mobile/mobile-components.d.ts +4 -0
- package/dist/mobile/types.d.ts +67 -0
- package/dist/mobile.cjs +1 -0
- package/dist/mobile.mjs +111 -0
- package/dist/react/index.d.ts +6 -1
- package/dist/react/theme.d.ts +59 -0
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +12 -6
- package/dist/styles.css +159 -3
- package/dist/theme-pzn9q1zq.cjs +1 -0
- package/dist/theme-qxOS-jIA.js +15 -0
- package/dist/theme.d.ts +52 -0
- package/docs/host-integration.md +2 -0
- package/examples/antd-components.tsx +4 -2
- package/package.ai.json +7 -1
- package/package.json +6 -1
- package/recipes.json +8 -0
package/dist/list.mjs
CHANGED
|
@@ -1,297 +1,326 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsxs as T, jsx as o, Fragment as Ie } from "react/jsx-runtime";
|
|
2
|
+
import { u as Se } from "./theme-qxOS-jIA.js";
|
|
3
|
+
import { useState as D, useRef as H, useEffect as ae, useMemo as Pe, useId as ze } from "react";
|
|
4
|
+
import { getApprovalStatusDisplay as Ee, toMakeApprovalThemeStyle as Be } from "./index.mjs";
|
|
5
|
+
const Ce = (e) => typeof e == "object" && e !== null, Le = (e) => Ce(e) ? ["id", "entityKey", "recordId"].every((a) => typeof e[a] == "string" && e[a].trim().length > 0) && ["applicationNo", "applicationType", "applicantName", "applicationTime"].every((a) => typeof e[a] == "string") && ["taskId", "processInstanceId"].every((a) => e[a] === void 0 || typeof e[a] == "string" && e[a].trim().length > 0) && ["completionTime", "completionResult"].every((a) => e[a] === void 0 || typeof e[a] == "string") && (e.referenceType === void 0 || e.referenceType === "task" || e.referenceType === "instance") && (e.referenceType !== "instance" || typeof e.processInstanceId == "string" && e.processInstanceId.trim().length > 0) && (typeof e.processStatus == "string" || e.processStatus === null) : !1, ce = (e, a) => {
|
|
6
|
+
if (!Ce(e) || !Array.isArray(e.rows) || !e.rows.every(Le) || typeof e.total != "number" || !Number.isSafeInteger(e.total) || e.total < 0 || e.rows.length > a || e.rows.length > e.total || new Set(e.rows.map((n) => n.id)).size !== e.rows.length)
|
|
6
7
|
throw new Error("Invalid approval page contract");
|
|
7
8
|
return { rows: e.rows, total: e.total };
|
|
8
|
-
},
|
|
9
|
+
}, E = (e, a) => {
|
|
9
10
|
try {
|
|
10
|
-
e ? e(
|
|
11
|
+
e ? e(a) : a.phase === "error" ? console.warn("[make-app-approval]", a) : console.info("[make-app-approval]", a);
|
|
11
12
|
} catch {
|
|
12
13
|
console.warn("[make-app-approval] diagnostic sink failed");
|
|
13
14
|
}
|
|
14
|
-
},
|
|
15
|
-
const [
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
}, ue = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : Ee(e).label, Oe = ({ initialPage: e, query: a, provider: n, components: w, onOpen: F, onReload: S, logger: m }) => {
|
|
16
|
+
const [c, v] = D(e), [s, C] = D(2), [y, N] = D("idle"), f = H(void 0), [I, x] = D(!1), d = H(void 0);
|
|
17
|
+
ae(() => () => {
|
|
18
|
+
d.current?.abort();
|
|
18
19
|
}, []);
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
20
|
+
const M = async () => {
|
|
21
|
+
if (d.current || c.rows.length >= c.total) return;
|
|
22
|
+
const l = new AbortController();
|
|
23
|
+
d.current = l, N("loading");
|
|
24
|
+
const A = { operation: "list", tab: a.tab, page: s, pageSize: a.pageSize };
|
|
25
|
+
E(m, { ...A, phase: "start" });
|
|
25
26
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
|
|
27
|
+
const b = ce(await n.loadPage({ ...a, page: s }, { signal: l.signal }), a.pageSize);
|
|
28
|
+
if (l.signal.aborted) return;
|
|
29
|
+
if (b.total < c.total) {
|
|
30
|
+
E(m, { ...A, phase: "skip", rowCount: b.rows.length }), S();
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
|
|
33
|
+
const W = new Set(c.rows.map((V) => V.id));
|
|
34
|
+
if (!b.rows.length || b.rows.some((V) => W.has(V.id))) throw new Error("Invalid append page");
|
|
35
|
+
v({ rows: [...c.rows, ...b.rows], total: b.total }), C((V) => V + 1), N("idle"), E(m, { ...A, phase: "success", rowCount: b.rows.length });
|
|
35
36
|
} catch {
|
|
36
|
-
|
|
37
|
+
l.signal.aborted || (N("error"), E(m, { ...A, phase: "error" }));
|
|
37
38
|
} finally {
|
|
38
|
-
|
|
39
|
+
d.current === l && (d.current = void 0);
|
|
39
40
|
}
|
|
40
|
-
},
|
|
41
|
-
const { scrollHeight:
|
|
42
|
-
|
|
43
|
-
}, { Button:
|
|
44
|
-
return /* @__PURE__ */
|
|
41
|
+
}, p = (l) => {
|
|
42
|
+
const { scrollHeight: A, scrollTop: b, clientHeight: W } = l.currentTarget;
|
|
43
|
+
y === "idle" && A - b - W < 120 && M();
|
|
44
|
+
}, { Button: B } = w;
|
|
45
|
+
return /* @__PURE__ */ T(
|
|
45
46
|
"div",
|
|
46
47
|
{
|
|
47
48
|
className: "make-app-approval-mobile-list",
|
|
48
|
-
onScroll:
|
|
49
|
-
onTouchStart: (
|
|
50
|
-
|
|
49
|
+
onScroll: p,
|
|
50
|
+
onTouchStart: (l) => {
|
|
51
|
+
f.current = l.currentTarget.scrollTop <= 0 && l.touches.length === 1 && y !== "loading" ? { start: l.touches[0].clientY, distance: 0 } : void 0;
|
|
51
52
|
},
|
|
52
|
-
onTouchMove: (
|
|
53
|
-
!
|
|
53
|
+
onTouchMove: (l) => {
|
|
54
|
+
!f.current || l.touches.length !== 1 || (f.current.distance = l.touches[0].clientY - f.current.start, x(f.current.distance >= 60));
|
|
54
55
|
},
|
|
55
56
|
onTouchEnd: () => {
|
|
56
|
-
const
|
|
57
|
-
|
|
57
|
+
const l = (f.current?.distance ?? 0) >= 60;
|
|
58
|
+
f.current = void 0, x(!1), l && S();
|
|
58
59
|
},
|
|
59
60
|
onTouchCancel: () => {
|
|
60
|
-
|
|
61
|
+
f.current = void 0, x(!1);
|
|
61
62
|
},
|
|
62
63
|
"aria-label": "审批卡片列表",
|
|
63
|
-
"aria-busy":
|
|
64
|
+
"aria-busy": y === "loading",
|
|
64
65
|
children: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
66
|
+
I && /* @__PURE__ */ o("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "松开刷新" }),
|
|
67
|
+
c.rows.map((l) => /* @__PURE__ */ T("button", { type: "button", className: "make-app-approval-mobile-card", onClick: () => F(l), "aria-label": `打开 ${l.applicationNo} 的审批详情`, children: [
|
|
68
|
+
/* @__PURE__ */ o("strong", { children: l.applicationType || "审批申请" }),
|
|
69
|
+
/* @__PURE__ */ T("span", { className: "make-app-approval-mobile-card-line", children: [
|
|
70
|
+
/* @__PURE__ */ o("span", { children: "申请单ID:" }),
|
|
71
|
+
/* @__PURE__ */ o("span", { children: l.applicationNo })
|
|
71
72
|
] }),
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
73
|
+
a.tab === "approved" && /* @__PURE__ */ T("span", { className: "make-app-approval-mobile-card-line", children: [
|
|
74
|
+
/* @__PURE__ */ o("span", { children: "审批结果:" }),
|
|
75
|
+
/* @__PURE__ */ o("span", { children: l.completionResult || "—" })
|
|
75
76
|
] }),
|
|
76
|
-
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
77
|
+
a.tab === "initiated" && /* @__PURE__ */ T("span", { className: "make-app-approval-mobile-card-line", children: [
|
|
78
|
+
/* @__PURE__ */ o("span", { children: "流程状态:" }),
|
|
79
|
+
/* @__PURE__ */ o("span", { children: ue(l.processStatus) })
|
|
79
80
|
] }),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ T("span", { className: "make-app-approval-mobile-card-footer", children: [
|
|
82
|
+
/* @__PURE__ */ T("span", { className: "make-app-approval-mobile-person", children: [
|
|
83
|
+
/* @__PURE__ */ o("span", { className: "make-app-approval-mobile-avatar", "aria-hidden": "true", children: l.applicantName.slice(-2) }),
|
|
84
|
+
/* @__PURE__ */ o("span", { children: l.applicantName || "—" })
|
|
84
85
|
] }),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ o("span", { children: a.tab === "approved" ? `完成于 ${l.completionTime || "—"}` : `申请于 ${l.applicationTime || "—"}` })
|
|
86
87
|
] })
|
|
87
|
-
] },
|
|
88
|
-
!
|
|
89
|
-
|
|
88
|
+
] }, l.id)),
|
|
89
|
+
!c.rows.length && /* @__PURE__ */ o("p", { className: "make-app-approval-mobile-feedback", children: "暂无审批记录" }),
|
|
90
|
+
y === "error" ? /* @__PURE__ */ T("div", { role: "alert", className: "make-app-approval-mobile-feedback", children: [
|
|
90
91
|
"部分审批记录加载失败",
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
92
|
+
/* @__PURE__ */ o(B, { htmlType: "button", variant: "text", onClick: () => {
|
|
93
|
+
M();
|
|
93
94
|
}, children: "重试加载" })
|
|
94
|
-
] }) :
|
|
95
|
-
|
|
96
|
-
}, children: "加载更多" }) :
|
|
95
|
+
] }) : y === "loading" ? /* @__PURE__ */ o("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "加载中" }) : c.rows.length < c.total ? /* @__PURE__ */ o(B, { htmlType: "button", variant: "text", onClick: () => {
|
|
96
|
+
M();
|
|
97
|
+
}, children: "加载更多" }) : c.rows.length > 0 && /* @__PURE__ */ o("p", { className: "make-app-approval-mobile-feedback", children: "没有更多了" })
|
|
97
98
|
]
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
|
-
},
|
|
101
|
+
}, He = (e) => {
|
|
102
|
+
const a = Be(e), n = {}, w = (S, m) => {
|
|
103
|
+
const c = a[`--make-approval-theme-${m}`];
|
|
104
|
+
c !== void 0 && (n[S] = c);
|
|
105
|
+
}, F = (S, m) => {
|
|
106
|
+
const c = a[`--make-approval-theme-${m}`];
|
|
107
|
+
c !== void 0 && (n[S] = Number.parseFloat(c));
|
|
108
|
+
};
|
|
109
|
+
for (const [S, m] of Object.entries({ primaryColor: "primary", onPrimaryColor: "on-primary", textColor: "text", headerTextColor: "heading-text", rowBgColor: "surface", canvasBgColor: "page", headerBgColor: "subtle-surface", borderColor: "border-color", hoverColor: "hover-surface", selectedBgColor: "selected-surface", activeBgColor: "active-surface", activeBorderColor: "focus-ring", secondaryTextColor: "secondary-text", placeholderTextColor: "placeholder-text", tooltipBgColor: "elevated-surface", tooltipTextColor: "text", fontFamily: "font-family" })) w(S, m);
|
|
110
|
+
for (const [S, m] of Object.entries({ fontSize: "font-size-body", fontWeight: "font-weight-body", headerFontSize: "font-size-field-label", headerFontWeight: "font-weight-heading", secondaryFontSize: "font-size-meta", rowHeight: "row-height", headerHeight: "header-height", cellPadding: "spacing-table-cell", headerCellPadding: "spacing-table-header", tooltipFontSize: "font-size-meta", tooltipBorderRadius: "radius-popup" })) F(S, m);
|
|
111
|
+
return n.headerTextColor === void 0 && n.textColor !== void 0 && (n.headerTextColor = n.textColor), n;
|
|
112
|
+
}, De = (e, a) => a === "canvas-table/semantic-theme/v1" ? e : {}, Te = {
|
|
101
113
|
applicationNo: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-fingerprint-pattern" aria-hidden="true"><path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"></path><path d="M14 13.12c0 2.38 0 6.38-1 8.88"></path><path d="M17.29 21.02c.12-.6.43-2.3.5-3.02"></path><path d="M2 12a10 10 0 0 1 18-6"></path><path d="M2 16h.01"></path><path d="M21.8 16c.2-2 .131-5.354 0-6"></path><path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"></path><path d="M8.65 22c.21-.66.45-1.32.57-2"></path><path d="M9 6.8a6 6 0 0 1 9 5.2v2"></path></svg>',
|
|
102
114
|
applicationType: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type" aria-hidden="true"><path d="M12 4v16"></path><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"></path><path d="M9 20h6"></path></svg>',
|
|
103
115
|
applicantName: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round" aria-hidden="true"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 0 0-16 0"></path></svg>',
|
|
104
116
|
applicationTime: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-calendar-clock" aria-hidden="true"><path d="M16 14v2.2l1.6 1"></path><path d="M16 2v3"></path><path d="M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338"></path><path d="M3 9h5.859"></path><path d="M8 2v3"></path><circle cx="16" cy="16" r="6"></circle></svg>'
|
|
105
|
-
},
|
|
106
|
-
Object.entries(
|
|
107
|
-
),
|
|
117
|
+
}, ve = Object.fromEntries(
|
|
118
|
+
Object.entries(Te).map(([e, a]) => [e, `data:image/svg+xml;charset=utf-8,${encodeURIComponent(a)}`])
|
|
119
|
+
), Fe = (e) => {
|
|
120
|
+
const a = e.replace(/[&<>"']/g, (n) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[n]);
|
|
121
|
+
return Object.fromEntries(Object.entries(Te).map(([n, w]) => [n, `data:image/svg+xml;charset=utf-8,${encodeURIComponent(w.replaceAll("#1d212a", a))}`]));
|
|
122
|
+
}, he = 64, be = [
|
|
108
123
|
{ key: "applicationNo", title: "申请单ID", width: 260 },
|
|
109
124
|
{ key: "applicationType", title: "业务表单", width: 180 },
|
|
110
125
|
{ key: "applicantName", title: "申请人", width: 170 },
|
|
111
126
|
{ key: "applicationTime", title: "申请时间", width: 220 }
|
|
112
|
-
],
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
], we = (e, a, n) => {
|
|
128
|
+
let w, F = ve;
|
|
129
|
+
const S = () => {
|
|
130
|
+
const s = typeof n == "function" ? n() : n;
|
|
131
|
+
return s !== w && (w = s, F = s ? Fe(s) : ve), F;
|
|
132
|
+
}, m = a === "initiated" ? [...be, { key: "statusLabel", title: "流程状态", width: 140 }] : be, c = m.reduce((s, C) => s + C.width, he), v = Math.max(0, e - c) / m.length;
|
|
133
|
+
return m.map((s) => ({
|
|
134
|
+
...s,
|
|
135
|
+
width: s.width + v,
|
|
117
136
|
showEllipsis: !0,
|
|
118
137
|
sortable: !1,
|
|
119
|
-
prefixRender: () =>
|
|
138
|
+
prefixRender: () => {
|
|
139
|
+
const C = S();
|
|
140
|
+
return { icon: C[s.key] ?? C.applicationType };
|
|
141
|
+
}
|
|
120
142
|
}));
|
|
121
|
-
},
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
const
|
|
125
|
-
let
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
r.finished || (r.finished = !0, r.removeAbort(),
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
for (const
|
|
134
|
-
for (const
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
return
|
|
143
|
+
}, Ve = ({ table: e, query: a, initialPage: n, loadPage: w, onChange: F, retryViewport: S, onReload: m, logger: c }) => {
|
|
144
|
+
const v = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
145
|
+
let C = [];
|
|
146
|
+
const y = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new Set();
|
|
147
|
+
let f = n, I = n.total, x = 0, d = !1, M = !1, p;
|
|
148
|
+
const B = (r) => Number.isSafeInteger(r) && r >= 0 && r * a.pageSize < I, l = (r, t, h) => E(c, { operation: "list", phase: t, tab: a.tab, page: r + 1, pageSize: a.pageSize, rowCount: h }), A = () => {
|
|
149
|
+
d || F({ total: I, rows: C, failed: M || N.size > 0, loading: v.size > 0 });
|
|
150
|
+
}, b = (r) => {
|
|
151
|
+
r.finished || (r.finished = !0, r.removeAbort(), v.get(r.page) === r && v.delete(r.page), e.markPageLoadFailed(r.page, r.request), r.controller.abort(), l(r.page, "cancel"));
|
|
152
|
+
}, W = (r) => {
|
|
153
|
+
x = r;
|
|
154
|
+
const t = e.getPagesInView() ?? [], h = new Set([x, ...t].flatMap((g) => [g - 1, g, g + 1]).filter(B));
|
|
155
|
+
for (const g of v.values()) h.has(g.page) || b(g);
|
|
156
|
+
for (const g of N) h.has(g) || N.delete(g);
|
|
157
|
+
}, V = (r, t, h) => {
|
|
158
|
+
const g = t.rows.map((R) => {
|
|
159
|
+
const $ = { ...R, statusLabel: ue(R.processStatus) };
|
|
160
|
+
return y.set($, R), $;
|
|
139
161
|
});
|
|
140
|
-
if (!e.setVirtualPageData(
|
|
141
|
-
|
|
162
|
+
if (!e.setVirtualPageData(g, r, t.total, h)) {
|
|
163
|
+
l(r, "skip");
|
|
142
164
|
return;
|
|
143
165
|
}
|
|
144
|
-
|
|
166
|
+
I = t.total;
|
|
145
167
|
try {
|
|
146
|
-
|
|
147
|
-
} catch (
|
|
148
|
-
|
|
149
|
-
for (const
|
|
150
|
-
throw
|
|
168
|
+
C = ce({ rows: e.getTableData() ?? [], total: I }, Number.MAX_SAFE_INTEGER).rows.map((R) => y.get(R) ?? R);
|
|
169
|
+
} catch (R) {
|
|
170
|
+
M = !0, C = [], f = void 0, p && clearTimeout(p), p = void 0;
|
|
171
|
+
for (const $ of v.values()) b($);
|
|
172
|
+
throw R;
|
|
151
173
|
}
|
|
152
|
-
|
|
153
|
-
for (const
|
|
154
|
-
!
|
|
155
|
-
},
|
|
156
|
-
if (
|
|
157
|
-
const r = [...
|
|
158
|
-
for (const
|
|
159
|
-
if (
|
|
160
|
-
|
|
174
|
+
f && f.total !== I && (f = void 0), N.delete(r);
|
|
175
|
+
for (const R of v.values()) B(R.page) || b(R);
|
|
176
|
+
!B(r) && r > 0 && e.scrollToRow(Math.max(0, I - 1)), l(r, "success", t.rows.length);
|
|
177
|
+
}, P = () => {
|
|
178
|
+
if (d || p) return;
|
|
179
|
+
const r = [...v.values()].filter((t) => !t.running && !t.finished).sort((t, h) => Math.abs(t.page - x) - Math.abs(h.page - x) || t.page - h.page);
|
|
180
|
+
for (const t of r) {
|
|
181
|
+
if (s.size >= 2) break;
|
|
182
|
+
t.running = !0, s.add(t), l(t.page, "start"), (async () => {
|
|
161
183
|
try {
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
|
|
184
|
+
const h = await w({ ...a, page: t.page + 1 }, { signal: t.controller.signal });
|
|
185
|
+
if (d || t.finished || t.controller.signal.aborted) return;
|
|
186
|
+
const g = ce(h, a.pageSize);
|
|
187
|
+
t.finished = !0, t.removeAbort(), v.delete(t.page), V(t.page, g, t.request);
|
|
166
188
|
} catch {
|
|
167
|
-
!
|
|
189
|
+
!d && !t.controller.signal.aborted && (N.add(t.page), l(t.page, "error"), e.markPageLoadFailed(t.page, t.request));
|
|
168
190
|
} finally {
|
|
169
|
-
|
|
191
|
+
t.finished || (t.finished = !0, t.removeAbort(), v.get(t.page) === t && v.delete(t.page)), s.delete(t), A(), P();
|
|
170
192
|
}
|
|
171
193
|
})();
|
|
172
194
|
}
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
|
|
195
|
+
A();
|
|
196
|
+
}, L = () => {
|
|
197
|
+
p && clearTimeout(p), p = setTimeout(() => {
|
|
198
|
+
p = void 0, P();
|
|
177
199
|
}, 120);
|
|
178
200
|
};
|
|
179
201
|
return {
|
|
180
|
-
load(r,
|
|
181
|
-
if (
|
|
182
|
-
e.markPageLoadFailed(r,
|
|
202
|
+
load(r, t) {
|
|
203
|
+
if (t.useRequestIdentity(), d || M || t.signal.aborted || !B(r)) {
|
|
204
|
+
e.markPageLoadFailed(r, t), l(r, "skip");
|
|
183
205
|
return;
|
|
184
206
|
}
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
|
|
207
|
+
const h = v.get(r);
|
|
208
|
+
if (h?.request === t && !h.finished) return;
|
|
209
|
+
if (h && b(h), W(r), r === 0 && f) {
|
|
210
|
+
const R = f;
|
|
211
|
+
f = void 0;
|
|
190
212
|
try {
|
|
191
|
-
|
|
213
|
+
V(0, R, t);
|
|
192
214
|
} catch {
|
|
193
|
-
|
|
215
|
+
N.add(r), e.markPageLoadFailed(r, t), l(r, "error");
|
|
194
216
|
}
|
|
195
|
-
|
|
217
|
+
A();
|
|
196
218
|
return;
|
|
197
219
|
}
|
|
198
|
-
const
|
|
199
|
-
} },
|
|
200
|
-
|
|
220
|
+
const g = { page: r, request: t, controller: new AbortController(), running: !1, finished: !1, removeAbort: () => {
|
|
221
|
+
} }, K = () => {
|
|
222
|
+
b(g), A();
|
|
201
223
|
};
|
|
202
|
-
|
|
224
|
+
t.signal.addEventListener("abort", K, { once: !0 }), g.removeAbort = () => t.signal.removeEventListener("abort", K), v.set(r, g), L(), A();
|
|
203
225
|
},
|
|
204
226
|
viewportChanged() {
|
|
205
|
-
if (
|
|
227
|
+
if (d) return;
|
|
206
228
|
const r = e.getPagesInView();
|
|
207
|
-
r?.length && (
|
|
229
|
+
r?.length && (W(r[0]), v.size && L(), A());
|
|
208
230
|
},
|
|
209
231
|
retry() {
|
|
210
|
-
if (!
|
|
211
|
-
if (
|
|
212
|
-
|
|
232
|
+
if (!d) {
|
|
233
|
+
if (M) {
|
|
234
|
+
m();
|
|
213
235
|
return;
|
|
214
236
|
}
|
|
215
|
-
|
|
237
|
+
N.size !== 0 && (N.clear(), S(), A());
|
|
216
238
|
}
|
|
217
239
|
},
|
|
218
240
|
dispose() {
|
|
219
|
-
|
|
220
|
-
for (const r of
|
|
221
|
-
|
|
241
|
+
d = !0, p && clearTimeout(p), p = void 0;
|
|
242
|
+
for (const r of v.values()) b(r);
|
|
243
|
+
C = [], N.clear(), f = void 0;
|
|
222
244
|
}
|
|
223
245
|
};
|
|
224
|
-
},
|
|
225
|
-
const
|
|
226
|
-
return e.initialPage ? /* @__PURE__ */
|
|
227
|
-
|
|
246
|
+
}, ye = 40, $e = (e) => {
|
|
247
|
+
const a = H(void 0);
|
|
248
|
+
return e.initialPage ? /* @__PURE__ */ o(
|
|
249
|
+
je,
|
|
228
250
|
{
|
|
229
251
|
...e,
|
|
230
252
|
initialPage: e.initialPage,
|
|
231
|
-
restoreScroll:
|
|
232
|
-
rememberScroll: (
|
|
233
|
-
|
|
253
|
+
restoreScroll: a.current?.query === e.query ? a.current.position : void 0,
|
|
254
|
+
rememberScroll: (n) => {
|
|
255
|
+
a.current = { query: e.query, position: n };
|
|
234
256
|
}
|
|
235
257
|
}
|
|
236
|
-
) : /* @__PURE__ */
|
|
237
|
-
},
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const d =
|
|
258
|
+
) : /* @__PURE__ */ o("div", { className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" });
|
|
259
|
+
}, je = ({ components: { Button: e }, initialPage: a, query: n, provider: w, themeKey: F, onOpen: S, onReload: m, logger: c, restoreScroll: v, rememberScroll: s }) => {
|
|
260
|
+
const C = Se("desktop"), y = He(C.theme), N = H(y);
|
|
261
|
+
N.current = y;
|
|
262
|
+
const f = JSON.stringify(y), I = H({}), x = H(null), d = H(null), M = H(null), [p, B] = D(!1), [l, A] = D(0), [b, W] = D({ ...a, failed: !1, loading: !1 }), V = H(a.rows), P = H(v), L = H({ provider: w, onOpen: S, onReload: m, logger: c, rememberScroll: s });
|
|
263
|
+
L.current = { provider: w, onOpen: S, onReload: m, logger: c, rememberScroll: s };
|
|
264
|
+
const r = H(() => {
|
|
241
265
|
});
|
|
242
|
-
return
|
|
243
|
-
const
|
|
244
|
-
if (!
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
266
|
+
return ae(() => {
|
|
267
|
+
const t = x.current;
|
|
268
|
+
if (!t) return;
|
|
269
|
+
let h = !1, g, K, R, $, U, X = a.total, Z = !1;
|
|
270
|
+
E(L.current.logger, { operation: "table", phase: "start" });
|
|
271
|
+
const re = () => {
|
|
272
|
+
h || (B(!0), E(L.current.logger, { operation: "table", phase: "error" }));
|
|
249
273
|
};
|
|
250
|
-
return import("@qfei-design/canvas-table").then((
|
|
251
|
-
if (
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
},
|
|
256
|
-
if (!
|
|
274
|
+
return import("@qfei-design/canvas-table").then((j) => {
|
|
275
|
+
if (h) return;
|
|
276
|
+
const q = "CANVAS_TABLE_THEME_CONTRACT" in j ? j.CANVAS_TABLE_THEME_CONTRACT : void 0, G = () => {
|
|
277
|
+
const _ = d.current, O = _?.getScrollState();
|
|
278
|
+
_ && O && j.globalEventBus.emitWithNamespace("scroll:change", _.tableId, O);
|
|
279
|
+
}, i = (_ = !1) => {
|
|
280
|
+
if (!h)
|
|
257
281
|
try {
|
|
258
|
-
const { width:
|
|
259
|
-
if (
|
|
260
|
-
const
|
|
261
|
-
|
|
282
|
+
const { width: O, height: J } = t.getBoundingClientRect();
|
|
283
|
+
if (O <= 0 || J <= 0 || !_ && U?.width === O && U.height === J) return;
|
|
284
|
+
const Y = getComputedStyle(t);
|
|
285
|
+
q !== "canvas-table/semantic-theme/v1" && Object.keys(N.current).length > 0 && !Z && (Z = !0, E(L.current.logger, { operation: "table", phase: "skip", reason: "canvas-theme-contract-unavailable" }));
|
|
286
|
+
const oe = {
|
|
287
|
+
rowHeight: ye,
|
|
262
288
|
headerHeight: 40,
|
|
263
289
|
fontSize: 14,
|
|
264
|
-
fontFamily:
|
|
265
|
-
...
|
|
266
|
-
...
|
|
267
|
-
...
|
|
268
|
-
...
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
290
|
+
fontFamily: Y.fontFamily || "Arial, sans-serif",
|
|
291
|
+
...Y.color ? { textColor: Y.color } : {},
|
|
292
|
+
...Y.getPropertyValue("--make-approval-bg").trim() ? { rowBgColor: Y.getPropertyValue("--make-approval-bg").trim() } : {},
|
|
293
|
+
...Y.getPropertyValue("--make-approval-header").trim() ? { headerBgColor: Y.getPropertyValue("--make-approval-header").trim() } : {},
|
|
294
|
+
...Y.getPropertyValue("--make-approval-border").trim() ? { borderColor: Y.getPropertyValue("--make-approval-border").trim() } : {},
|
|
295
|
+
...De(N.current, q)
|
|
296
|
+
};
|
|
297
|
+
I.current = oe;
|
|
298
|
+
const Re = oe.rowHeight ?? ye, me = () => I.current.headerTextColor, Me = Math.max(Math.ceil(300 / n.pageSize), Math.ceil(J * 3 / Re / n.pageSize) + 2) * n.pageSize, fe = { enabled: !0, totalRowCount: X, pageSize: n.pageSize, maxCachedRows: Me };
|
|
299
|
+
if (d.current) {
|
|
300
|
+
const k = U?.width !== O ? we(O, n.tab, me) : void 0;
|
|
301
|
+
if (d.current.updateProps({
|
|
302
|
+
canvasWidth: O,
|
|
303
|
+
canvasHeight: J,
|
|
304
|
+
style: oe,
|
|
305
|
+
virtualOptions: fe,
|
|
277
306
|
...k ? { columns: k } : {}
|
|
278
307
|
}), k) {
|
|
279
|
-
const z =
|
|
280
|
-
z && z.scrollX >
|
|
308
|
+
const z = d.current.getScrollState(), Q = Math.max(0, k.reduce((ee, de) => ee + de.width, he) - O);
|
|
309
|
+
z && z.scrollX > Q && d.current.scrollTo(Q, z.scrollY, !1);
|
|
281
310
|
}
|
|
282
|
-
|
|
311
|
+
U = { width: O, height: J }, G();
|
|
283
312
|
return;
|
|
284
313
|
}
|
|
285
|
-
|
|
286
|
-
columns:
|
|
287
|
-
canvasWidth:
|
|
288
|
-
canvasHeight:
|
|
289
|
-
style:
|
|
314
|
+
d.current = new j.CanvasTableComponent(t, {
|
|
315
|
+
columns: we(O, n.tab, me),
|
|
316
|
+
canvasWidth: O,
|
|
317
|
+
canvasHeight: J,
|
|
318
|
+
style: oe,
|
|
290
319
|
rowKey: "id",
|
|
291
320
|
minCanvasWidth: 0,
|
|
292
321
|
minCanvasHeight: 0,
|
|
293
|
-
showSN: { enabled: !0, width:
|
|
294
|
-
virtualOptions:
|
|
322
|
+
showSN: { enabled: !0, width: he, formatter: (k, z) => z + 1 },
|
|
323
|
+
virtualOptions: fe,
|
|
295
324
|
selectable: { enabled: !1 },
|
|
296
325
|
rowSortable: { enabled: !1 },
|
|
297
326
|
editApplyMode: "controlled",
|
|
@@ -302,232 +331,235 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
|
|
|
302
331
|
bodyRowHeadSuffixOptions: {
|
|
303
332
|
enabled: !0,
|
|
304
333
|
width: 20,
|
|
305
|
-
render: ({ group: k, x: z, height:
|
|
306
|
-
const
|
|
307
|
-
|
|
334
|
+
render: ({ group: k, x: z, height: Q, rowData: ee }) => {
|
|
335
|
+
const de = ee?.id, ie = new j.RectShape({ name: "approval-open", x: z, y: Q / 2 - 10, cursor: "pointer", tooltip: "查看审批详情", attrs: { width: 20, height: 20, fill: "transparent", stroke: "transparent" } });
|
|
336
|
+
ie.addChild(new j.ImgShape({ name: "approval-open-icon", x: 3, y: 3, attrs: {
|
|
308
337
|
width: 14,
|
|
309
338
|
height: 14,
|
|
310
|
-
img: "data:image/svg+xml;charset=utf-8," + encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${
|
|
311
|
-
} })),
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
}), k.addChild(
|
|
339
|
+
img: "data:image/svg+xml;charset=utf-8," + encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${String(I.current.textColor || "#64748b").replace(/[&<>"']/g, (te) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[te])}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)
|
|
340
|
+
} })), ie.on("mousedown", (te) => te.stopPropagation?.()), ie.on("click", (te) => {
|
|
341
|
+
te.stopPropagation?.();
|
|
342
|
+
const ge = V.current.find((Ae) => Ae.id === de);
|
|
343
|
+
ge && L.current.onOpen(ge);
|
|
344
|
+
}), k.addChild(ie);
|
|
316
345
|
}
|
|
317
346
|
}
|
|
318
347
|
});
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
table:
|
|
323
|
-
query:
|
|
324
|
-
initialPage:
|
|
348
|
+
const ne = d.current;
|
|
349
|
+
U = { width: O, height: J };
|
|
350
|
+
const pe = Ve({
|
|
351
|
+
table: ne,
|
|
352
|
+
query: n,
|
|
353
|
+
initialPage: a,
|
|
325
354
|
// 公开滚动同步事件会重新检测缺页,不移动视口,也不复用失败身份。
|
|
326
|
-
retryViewport:
|
|
327
|
-
onReload: () =>
|
|
328
|
-
loadPage: (k, z) =>
|
|
329
|
-
logger: (k) =>
|
|
355
|
+
retryViewport: G,
|
|
356
|
+
onReload: () => L.current.onReload(),
|
|
357
|
+
loadPage: (k, z) => L.current.provider.loadPage(k, z),
|
|
358
|
+
logger: (k) => E(L.current.logger, k),
|
|
330
359
|
onChange: (k) => {
|
|
331
|
-
|
|
360
|
+
h || (X = k.total, V.current = k.rows, W((z) => z.total === k.total && z.failed === k.failed && z.loading === k.loading && z.rows.length === k.rows.length && z.rows.every((Q, ee) => Q === k.rows[ee]) ? z : k));
|
|
332
361
|
}
|
|
333
362
|
});
|
|
334
|
-
|
|
363
|
+
M.current = pe, K = j.globalEventBus.onWithNamespace("data:load", ne.tableId, (k, z) => pe.load(k, z)), R = j.globalEventBus.onWithNamespace("scroll:change", ne.tableId, () => pe.viewportChanged()), P.current && ne.scrollTo(P.current.scrollX, P.current.scrollY), B(!1), E(L.current.logger, { operation: "table", phase: "success" });
|
|
335
364
|
} catch {
|
|
336
|
-
|
|
365
|
+
re();
|
|
337
366
|
}
|
|
338
367
|
};
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
}).catch(
|
|
343
|
-
|
|
344
|
-
},
|
|
368
|
+
r.current = () => i(!0);
|
|
369
|
+
const u = () => i();
|
|
370
|
+
g = new ResizeObserver(u), g.observe(t), window.addEventListener("resize", u), $ = () => window.removeEventListener("resize", u), i();
|
|
371
|
+
}).catch(re), () => {
|
|
372
|
+
h = !0, g?.disconnect(), $?.(), r.current = () => {
|
|
373
|
+
}, d.current && (P.current = d.current.getScrollState(), P.current && L.current.rememberScroll(P.current)), K?.(), R?.(), M.current?.dispose(), M.current = null, d.current?.destroy(), d.current = null, E(L.current.logger, { operation: "table", phase: "destroy" });
|
|
345
374
|
};
|
|
346
|
-
}, [
|
|
347
|
-
|
|
348
|
-
}, [
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
|
|
375
|
+
}, [a, n, l]), ae(() => {
|
|
376
|
+
r.current();
|
|
377
|
+
}, [F, f]), /* @__PURE__ */ T("div", { className: "make-app-approval-table-frame", "aria-busy": b.loading, children: [
|
|
378
|
+
/* @__PURE__ */ o("div", { ref: x, className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" }),
|
|
379
|
+
p && /* @__PURE__ */ T("div", { className: "make-app-approval-overlay", role: "alert", children: [
|
|
351
380
|
"表格加载失败 ",
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
|
|
381
|
+
/* @__PURE__ */ o(e, { htmlType: "button", variant: "default", onClick: () => {
|
|
382
|
+
B(!1), A((t) => t + 1);
|
|
354
383
|
}, children: "重新加载表格" })
|
|
355
384
|
] }),
|
|
356
|
-
!
|
|
385
|
+
!p && b.failed && /* @__PURE__ */ T("div", { className: "make-app-approval-table-feedback", role: "alert", children: [
|
|
357
386
|
"部分审批记录加载失败 ",
|
|
358
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ o(e, { htmlType: "button", variant: "default", onClick: () => M.current?.retry(), children: "重试加载" })
|
|
359
388
|
] }),
|
|
360
|
-
!
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
389
|
+
!p && !b.failed && b.loading && /* @__PURE__ */ T("div", { className: "make-app-approval-table-loading", role: "status", "aria-label": "正在加载审批记录", "aria-live": "polite", children: [
|
|
390
|
+
/* @__PURE__ */ o("span", { className: "make-app-approval-loading-spinner", "aria-hidden": "true" }),
|
|
391
|
+
/* @__PURE__ */ o("span", { children: "加载中" })
|
|
363
392
|
] }),
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
|
|
393
|
+
/* @__PURE__ */ T("ul", { className: "make-app-approval-accessible-rows", "aria-label": "审批记录文字视图", children: [
|
|
394
|
+
b.total === 0 && /* @__PURE__ */ o("li", { children: "暂无审批记录" }),
|
|
395
|
+
b.rows.map((t) => /* @__PURE__ */ T("li", { children: [
|
|
396
|
+
/* @__PURE__ */ T("span", { children: [
|
|
397
|
+
t.applicationNo,
|
|
369
398
|
",",
|
|
370
|
-
|
|
399
|
+
t.applicationType,
|
|
371
400
|
",",
|
|
372
|
-
|
|
401
|
+
t.applicantName,
|
|
373
402
|
",",
|
|
374
|
-
|
|
375
|
-
|
|
403
|
+
t.applicationTime,
|
|
404
|
+
n.tab === "initiated" ? `,${ue(t.processStatus)}` : "",
|
|
376
405
|
"。"
|
|
377
406
|
] }),
|
|
378
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ T(e, { htmlType: "button", variant: "text", onClick: () => S(t), children: [
|
|
379
408
|
"打开 ",
|
|
380
|
-
|
|
409
|
+
t.applicationNo || t.applicationType,
|
|
381
410
|
" 的审批详情"
|
|
382
411
|
] })
|
|
383
|
-
] },
|
|
412
|
+
] }, t.id))
|
|
384
413
|
] })
|
|
385
414
|
] });
|
|
386
|
-
},
|
|
387
|
-
const [
|
|
388
|
-
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
let
|
|
415
|
+
}, We = [], _e = (e, a, n, w) => {
|
|
416
|
+
const [F, S] = D(0), [m, c] = D(), v = H({ provider: e, logger: w });
|
|
417
|
+
v.current = { provider: e, logger: w };
|
|
418
|
+
const s = Pe(() => ({}), [a, n, F]);
|
|
419
|
+
ae(() => {
|
|
420
|
+
const y = new AbortController(), { provider: N, logger: f } = v.current, I = { operation: "list", tab: a.tab, page: a.page, pageSize: a.pageSize };
|
|
421
|
+
E(f, { ...I, phase: "start" });
|
|
422
|
+
let x = !1;
|
|
394
423
|
return (async () => {
|
|
395
424
|
try {
|
|
396
|
-
if (await Promise.resolve(),
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const
|
|
400
|
-
|
|
425
|
+
if (await Promise.resolve(), y.signal.aborted) return;
|
|
426
|
+
const d = await N.loadPage(a, { signal: y.signal });
|
|
427
|
+
if (y.signal.aborted) return;
|
|
428
|
+
const M = ce(d, a.pageSize);
|
|
429
|
+
x = !0, c({ ...M, token: s, status: "success" }), E(f, { ...I, phase: "success", rowCount: M.rows.length });
|
|
401
430
|
} catch {
|
|
402
|
-
if (
|
|
403
|
-
|
|
431
|
+
if (y.signal.aborted) return;
|
|
432
|
+
x = !0, c({ token: s, status: "error", rows: We, total: 0 }), E(f, { ...I, phase: "error" });
|
|
404
433
|
}
|
|
405
434
|
})(), () => {
|
|
406
|
-
|
|
435
|
+
y.abort(), x || E(f, { ...I, phase: "cancel" });
|
|
407
436
|
};
|
|
408
|
-
}, [
|
|
409
|
-
const
|
|
437
|
+
}, [a, s]);
|
|
438
|
+
const C = m?.token === s ? m : void 0;
|
|
410
439
|
return {
|
|
411
|
-
initialPage:
|
|
412
|
-
total:
|
|
413
|
-
status:
|
|
414
|
-
reload: () =>
|
|
440
|
+
initialPage: C?.status === "success" ? C : void 0,
|
|
441
|
+
total: C?.total ?? 0,
|
|
442
|
+
status: C?.status ?? "loading",
|
|
443
|
+
reload: () => S((y) => y + 1)
|
|
415
444
|
};
|
|
416
|
-
},
|
|
445
|
+
}, le = { keyword: "", applicantId: "", processStatus: "", startDate: "", endDate: "" }, Ne = ["pending", "approved"], xe = { pending: "待处理", approved: "已完成", initiated: "已发起" }, ke = /* @__PURE__ */ T("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
446
|
+
/* @__PURE__ */ o("circle", { cx: "10.5", cy: "10.5", r: "6.5" }),
|
|
447
|
+
/* @__PURE__ */ o("path", { d: "m16 16 5 5" })
|
|
448
|
+
] }), se = (e) => {
|
|
417
449
|
if (e === "") return !0;
|
|
418
450
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
|
|
419
|
-
const
|
|
420
|
-
return Number.isFinite(
|
|
421
|
-
},
|
|
422
|
-
const { Input:
|
|
423
|
-
|
|
424
|
-
|
|
451
|
+
const a = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
452
|
+
return Number.isFinite(a.getTime()) && a.toISOString().slice(0, 10) === e;
|
|
453
|
+
}, Ke = ({ components: e, provider: a, onOpenApproval: n, applicantOptions: w = [], pageSize: F = 20, refreshKey: S, themeKey: m, logger: c, className: v, presentation: s = "desktop", spacing: C = "host", tabs: y = Ne }) => {
|
|
454
|
+
const { Input: N, Select: f, DateRangePicker: I, Button: x, Tabs: d } = e, M = ze(), [p, B] = D(le), [l, A] = D(), [b, W] = D(0), [V, P] = D(""), [L, r] = D(""), [t, h] = D({ ...le, tab: y[0], page: 1, pageSize: F }), { initialPage: g, status: K, reload: R } = _e(a, t, S, c), $ = H(!1), U = H(!0);
|
|
455
|
+
ae(() => (U.current = !0, () => {
|
|
456
|
+
U.current = !1;
|
|
425
457
|
}), []);
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
428
|
-
|
|
458
|
+
const X = K === "loading", Z = async (i) => {
|
|
459
|
+
if (!$.current) {
|
|
460
|
+
$.current = !0, r(""), E(c, { operation: "open", phase: "start" });
|
|
429
461
|
try {
|
|
430
|
-
await
|
|
462
|
+
await n(i), E(c, { operation: "open", phase: "success" });
|
|
431
463
|
} catch {
|
|
432
|
-
|
|
464
|
+
U.current && r("审批详情打开失败,请重试"), E(c, { operation: "open", phase: "error" });
|
|
433
465
|
} finally {
|
|
434
|
-
|
|
466
|
+
$.current = !1;
|
|
435
467
|
}
|
|
436
468
|
}
|
|
437
|
-
},
|
|
438
|
-
i ===
|
|
439
|
-
},
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
d(""), M(""), H((s) => ({ ...s, keyword: c.keyword.trim(), page: 1 }));
|
|
469
|
+
}, re = (i) => {
|
|
470
|
+
i === t.tab || !y.includes(i) || (P(""), r(""), i === "initiated" && (B((u) => ({ ...u, keyword: "", applicantId: "", processStatus: "" })), A(void 0)), h((u) => ({ ...u, ...i === "initiated" ? { keyword: "", applicantId: "", processStatus: "" } : {}, tab: i, page: 1 })));
|
|
471
|
+
}, j = (i) => {
|
|
472
|
+
B((u) => ({ ...u, ...i })), s === "mobile" && (P(""), r(""), h((u) => ({ ...u, ...i, page: 1 })));
|
|
473
|
+
}, q = /* @__PURE__ */ T(Ie, { children: [
|
|
474
|
+
/* @__PURE__ */ T("form", { className: "make-app-approval-filters", onSubmit: (i) => {
|
|
475
|
+
if (i.preventDefault(), s === "mobile") {
|
|
476
|
+
P(""), r(""), h((u) => ({ ...u, keyword: p.keyword.trim(), page: 1 }));
|
|
446
477
|
return;
|
|
447
478
|
}
|
|
448
|
-
if (!
|
|
449
|
-
|
|
479
|
+
if (!se(p.startDate) || !se(p.endDate)) {
|
|
480
|
+
P("请选择有效日期");
|
|
450
481
|
return;
|
|
451
482
|
}
|
|
452
|
-
if (
|
|
453
|
-
|
|
483
|
+
if (p.startDate && p.endDate && p.startDate > p.endDate) {
|
|
484
|
+
P("开始日期不能晚于结束日期");
|
|
454
485
|
return;
|
|
455
486
|
}
|
|
456
|
-
|
|
487
|
+
P(""), r(""), h((u) => ({ ...u, ...p, keyword: p.keyword.trim(), page: 1 }));
|
|
457
488
|
}, children: [
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
] }) }),
|
|
463
|
-
/* @__PURE__ */ n(p, { id: `${C}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: c.keyword, onChange: (i) => {
|
|
464
|
-
R((s) => ({ ...s, keyword: i })), b === "mobile" && !i && H((s) => ({ ...s, keyword: "", page: 1 }));
|
|
489
|
+
t.tab !== "initiated" && /* @__PURE__ */ T("div", { className: "make-app-approval-filter-field", children: [
|
|
490
|
+
s === "mobile" && (C === "standard" ? /* @__PURE__ */ o("button", { type: "submit", className: "make-app-approval-mobile-search-button", "aria-label": "搜索申请单ID", children: ke }) : /* @__PURE__ */ o(x, { htmlType: "submit", variant: "text", ariaLabel: "搜索申请单ID", children: ke })),
|
|
491
|
+
/* @__PURE__ */ o(N, { id: `${M}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: p.keyword, onChange: (i) => {
|
|
492
|
+
B((u) => ({ ...u, keyword: i })), s === "mobile" && !i && h((u) => ({ ...u, keyword: "", page: 1 }));
|
|
465
493
|
} })
|
|
466
494
|
] }),
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
|
|
495
|
+
/* @__PURE__ */ o("div", { className: "make-app-approval-date-control", children: /* @__PURE__ */ o(
|
|
496
|
+
I,
|
|
469
497
|
{
|
|
470
|
-
id: `${
|
|
498
|
+
id: `${M}-period`,
|
|
471
499
|
ariaLabel: "申请时间",
|
|
472
500
|
placeholder: ["开始日期", "结束日期"],
|
|
473
|
-
value: [
|
|
474
|
-
onChange: ([i,
|
|
475
|
-
if (
|
|
476
|
-
|
|
501
|
+
value: [p.startDate, p.endDate],
|
|
502
|
+
onChange: ([i, u]) => {
|
|
503
|
+
if (s === "mobile" && (!se(i) || !se(u) || i && u && i > u)) {
|
|
504
|
+
P("请选择有效日期范围");
|
|
477
505
|
return;
|
|
478
506
|
}
|
|
479
|
-
if (
|
|
480
|
-
|
|
507
|
+
if (s === "mobile" && !!i != !!u) {
|
|
508
|
+
B((_) => ({ ..._, startDate: i, endDate: u }));
|
|
481
509
|
return;
|
|
482
510
|
}
|
|
483
|
-
|
|
511
|
+
j({ startDate: i, endDate: u });
|
|
484
512
|
}
|
|
485
513
|
},
|
|
486
|
-
|
|
514
|
+
b
|
|
487
515
|
) }),
|
|
488
|
-
|
|
489
|
-
|
|
516
|
+
t.tab !== "initiated" && /* @__PURE__ */ o("div", { className: "make-app-approval-filter-field", children: /* @__PURE__ */ o(
|
|
517
|
+
f,
|
|
490
518
|
{
|
|
491
|
-
id: `${
|
|
519
|
+
id: `${M}-applicant`,
|
|
492
520
|
ariaLabel: "申请人",
|
|
493
521
|
purpose: "applicant",
|
|
494
|
-
value:
|
|
495
|
-
|
|
496
|
-
|
|
522
|
+
value: p.applicantId ?? "",
|
|
523
|
+
...C === "standard" && l?.value === p.applicantId ? { selectedOption: l } : {},
|
|
524
|
+
options: [{ value: "", label: "全部申请人" }, ...w.filter((i) => i.value !== "")],
|
|
525
|
+
onChange: (i, u) => {
|
|
526
|
+
A((_) => i ? u?.value === i ? u : w.find((O) => O.value === i) ?? (_?.value === i ? _ : void 0) : void 0), j({ applicantId: i });
|
|
527
|
+
}
|
|
497
528
|
}
|
|
498
529
|
) }),
|
|
499
|
-
|
|
500
|
-
/* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
|
|
530
|
+
s !== "mobile" && /* @__PURE__ */ T("div", { className: "make-app-approval-filter-actions", children: [
|
|
531
|
+
/* @__PURE__ */ o(x, { htmlType: "submit", variant: "primary", children: "查询" }),
|
|
532
|
+
/* @__PURE__ */ o(x, { htmlType: "button", variant: "default", onClick: () => {
|
|
533
|
+
B(le), A(void 0), W((i) => i + 1), P(""), r(""), h((i) => ({ ...i, ...le, page: 1 }));
|
|
503
534
|
}, children: "重置" }),
|
|
504
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ o(x, { htmlType: "button", variant: "default", disabled: X, loading: X, onClick: R, children: "刷新" })
|
|
505
536
|
] })
|
|
506
537
|
] }),
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}, logger:
|
|
513
|
-
|
|
514
|
-
}, onReload:
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */
|
|
538
|
+
V && /* @__PURE__ */ o("p", { role: "alert", className: "make-app-approval-error", children: V }),
|
|
539
|
+
L && /* @__PURE__ */ o("p", { role: "alert", className: "make-app-approval-error", children: L }),
|
|
540
|
+
/* @__PURE__ */ T("div", { className: "make-app-approval-results", "aria-busy": X, children: [
|
|
541
|
+
s === "mobile" ? g && /* @__PURE__ */ o(Oe, { initialPage: g, query: t, provider: a, onReload: R, components: e, onOpen: (i) => {
|
|
542
|
+
Z(i);
|
|
543
|
+
}, logger: c }, JSON.stringify([t, S, g])) : /* @__PURE__ */ o($e, { components: e, initialPage: g, query: t, provider: a, onOpen: (i) => {
|
|
544
|
+
Z(i);
|
|
545
|
+
}, onReload: R, themeKey: m, logger: c }),
|
|
546
|
+
X && /* @__PURE__ */ o("div", { className: "make-app-approval-overlay", role: "status", children: "正在加载审批记录…" }),
|
|
547
|
+
K === "error" && /* @__PURE__ */ T("div", { className: "make-app-approval-overlay", role: "alert", children: [
|
|
548
|
+
/* @__PURE__ */ o("span", { children: "审批列表加载失败,请重试" }),
|
|
549
|
+
/* @__PURE__ */ o(x, { htmlType: "button", variant: "default", onClick: R, children: "重试" })
|
|
519
550
|
] })
|
|
520
551
|
] })
|
|
521
|
-
] })
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
552
|
+
] }), G = Se(s);
|
|
553
|
+
return /* @__PURE__ */ o("section", { className: ["make-app-approval", s === "mobile" && "make-app-approval--mobile", C === "standard" && "make-app-approval--standard", v].filter(Boolean).join(" "), "aria-label": "我的审批", style: G.style, "data-make-approval-theme": G.style ? G.presentation : void 0, "data-make-approval-presentation": s === "mobile" ? "mobile" : void 0, children: /* @__PURE__ */ o(d, { items: y.map((i) => ({ value: i, label: xe[i] })), value: t.tab, onChange: re, ariaLabel: "审批分类", children: C === "standard" ? /* @__PURE__ */ o("div", { className: "make-app-approval-panel", children: q }) : q }) });
|
|
554
|
+
}, Ge = (e) => {
|
|
555
|
+
const a = e.pageSize ?? 20, n = e.tabs ?? Ne;
|
|
556
|
+
if (!n.length || new Set(n).size !== n.length || n.some((w) => !Object.hasOwn(xe, w))) throw new Error("MyApprovalsPage requires valid unique tabs");
|
|
525
557
|
if (!e.scopeKey.trim()) throw new Error("MyApprovalsPage requires scopeKey");
|
|
526
|
-
for (const
|
|
527
|
-
if (!e.components?.[
|
|
528
|
-
if (!Number.isSafeInteger(
|
|
529
|
-
return /* @__PURE__ */
|
|
558
|
+
for (const w of ["Input", "Select", "DateRangePicker", "Button", "Tabs"])
|
|
559
|
+
if (!e.components?.[w]) throw new Error(`MyApprovalsPage requires components.${w}`);
|
|
560
|
+
if (!Number.isSafeInteger(a) || a < 1 || a > 200) throw new Error("pageSize must be an integer from 1 to 200");
|
|
561
|
+
return /* @__PURE__ */ o(Ke, { ...e, tabs: n, pageSize: a }, JSON.stringify([e.scopeKey, a, n]));
|
|
530
562
|
};
|
|
531
563
|
export {
|
|
532
|
-
|
|
564
|
+
Ge as MyApprovalsPage
|
|
533
565
|
};
|