@qfei-design/make-app-approval 0.2.6 → 0.2.8

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