@qfei-design/make-app-approval 0.2.1 → 0.2.3

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,25 +1,25 @@
1
- import { jsx as s, jsxs as T } from "react/jsx-runtime";
2
- import { useRef as M, useState as V, useEffect as j, useMemo as ie, useId as ce } from "react";
3
- import { getApprovalStatusDisplay as pe } from "./index.mjs";
4
- const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).label, I = (e, a) => {
1
+ import { jsx as s, jsxs as z } from "react/jsx-runtime";
2
+ import { useRef as M, useState as V, useEffect as j, useMemo as le, useId as ie } from "react";
3
+ import { getApprovalStatusDisplay as ce } from "./index.mjs";
4
+ const A = (e, a) => {
5
5
  try {
6
6
  e ? e(a) : a.phase === "error" ? console.warn("[make-app-approval]", a) : console.info("[make-app-approval]", a);
7
7
  } catch {
8
8
  console.warn("[make-app-approval] diagnostic sink failed");
9
9
  }
10
- }, oe = (e) => typeof e == "object" && e !== null, de = (e) => oe(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, Q = (e, a) => {
11
- if (!oe(e) || !Array.isArray(e.rows) || !e.rows.every(de) || 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)
10
+ }, pe = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : ce(e).label, re = (e) => typeof e == "object" && e !== null, de = (e) => re(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, Q = (e, a) => {
11
+ if (!re(e) || !Array.isArray(e.rows) || !e.rows.every(de) || 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((g) => g.id)).size !== e.rows.length)
12
12
  throw new Error("Invalid approval page contract");
13
13
  return { rows: e.rows, total: e.total };
14
- }, ue = ({ table: e, query: a, initialPage: h, loadPage: F, onChange: W, retryViewport: B, onReload: O, logger: z }) => {
15
- const d = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set();
16
- let R = [];
14
+ }, ue = ({ table: e, query: a, initialPage: g, loadPage: F, onChange: $, retryViewport: B, onReload: O, logger: C }) => {
15
+ const d = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
16
+ let P = [];
17
17
  const i = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set();
18
- let v = h, f = h.total, c = 0, k = !1, S = !1, P;
19
- const L = (r) => Number.isSafeInteger(r) && r >= 0 && r * a.pageSize < f, m = (r, t, p) => I(z, { operation: "list", phase: t, tab: a.tab, page: r + 1, pageSize: a.pageSize, rowCount: p }), g = () => {
20
- k || W({ total: f, rows: R, failed: S || u.size > 0, loading: d.size > 0 });
18
+ let m = g, v = g.total, c = 0, k = !1, S = !1, T;
19
+ const L = (r) => Number.isSafeInteger(r) && r >= 0 && r * a.pageSize < v, h = (r, t, p) => A(C, { operation: "list", phase: t, tab: a.tab, page: r + 1, pageSize: a.pageSize, rowCount: p }), f = () => {
20
+ k || $({ total: v, rows: P, failed: S || u.size > 0, loading: d.size > 0 });
21
21
  }, N = (r) => {
22
- r.finished || (r.finished = !0, r.removeAbort(), d.get(r.page) === r && d.delete(r.page), e.markPageLoadFailed(r.page, r.request), r.controller.abort(), m(r.page, "cancel"));
22
+ r.finished || (r.finished = !0, r.removeAbort(), d.get(r.page) === r && d.delete(r.page), e.markPageLoadFailed(r.page, r.request), r.controller.abort(), h(r.page, "cancel"));
23
23
  }, l = (r) => {
24
24
  c = r;
25
25
  const t = e.getPagesInView() ?? [], p = new Set([c, ...t].flatMap((n) => [n - 1, n, n + 1]).filter(L));
@@ -27,77 +27,77 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
27
27
  for (const n of u) p.has(n) || u.delete(n);
28
28
  }, D = (r, t, p) => {
29
29
  const n = t.rows.map((b) => {
30
- const o = { ...b, statusLabel: re(b.processStatus) };
30
+ const o = { ...b, statusLabel: pe(b.processStatus) };
31
31
  return i.set(o, b), o;
32
32
  });
33
33
  if (!e.setVirtualPageData(n, r, t.total, p)) {
34
- m(r, "skip");
34
+ h(r, "skip");
35
35
  return;
36
36
  }
37
- f = t.total;
37
+ v = t.total;
38
38
  try {
39
- R = Q({ rows: e.getTableData() ?? [], total: f }, Number.MAX_SAFE_INTEGER).rows.map((b) => i.get(b) ?? b);
39
+ P = Q({ rows: e.getTableData() ?? [], total: v }, Number.MAX_SAFE_INTEGER).rows.map((b) => i.get(b) ?? b);
40
40
  } catch (b) {
41
- S = !0, R = [], v = void 0, P && clearTimeout(P), P = void 0;
41
+ S = !0, P = [], m = void 0, T && clearTimeout(T), T = void 0;
42
42
  for (const o of d.values()) N(o);
43
43
  throw b;
44
44
  }
45
- v && v.total !== f && (v = void 0), u.delete(r);
45
+ m && m.total !== v && (m = void 0), u.delete(r);
46
46
  for (const b of d.values()) L(b.page) || N(b);
47
- !L(r) && r > 0 && e.scrollToRow(Math.max(0, f - 1)), m(r, "success", t.rows.length);
48
- }, $ = () => {
49
- if (k || P) return;
47
+ !L(r) && r > 0 && e.scrollToRow(Math.max(0, v - 1)), h(r, "success", t.rows.length);
48
+ }, x = () => {
49
+ if (k || T) return;
50
50
  const r = [...d.values()].filter((t) => !t.running && !t.finished).sort((t, p) => Math.abs(t.page - c) - Math.abs(p.page - c) || t.page - p.page);
51
51
  for (const t of r) {
52
- if (A.size >= 2) break;
53
- t.running = !0, A.add(t), m(t.page, "start"), (async () => {
52
+ if (I.size >= 2) break;
53
+ t.running = !0, I.add(t), h(t.page, "start"), (async () => {
54
54
  try {
55
55
  const p = await F({ ...a, page: t.page + 1 }, { signal: t.controller.signal });
56
56
  if (k || t.finished || t.controller.signal.aborted) return;
57
57
  const n = Q(p, a.pageSize);
58
58
  t.finished = !0, t.removeAbort(), d.delete(t.page), D(t.page, n, t.request);
59
59
  } catch {
60
- !k && !t.controller.signal.aborted && (u.add(t.page), m(t.page, "error"), e.markPageLoadFailed(t.page, t.request));
60
+ !k && !t.controller.signal.aborted && (u.add(t.page), h(t.page, "error"), e.markPageLoadFailed(t.page, t.request));
61
61
  } finally {
62
- t.finished || (t.finished = !0, t.removeAbort(), d.get(t.page) === t && d.delete(t.page)), A.delete(t), g(), $();
62
+ t.finished || (t.finished = !0, t.removeAbort(), d.get(t.page) === t && d.delete(t.page)), I.delete(t), f(), x();
63
63
  }
64
64
  })();
65
65
  }
66
- g();
67
- }, x = () => {
68
- P && clearTimeout(P), P = setTimeout(() => {
69
- P = void 0, $();
66
+ f();
67
+ }, K = () => {
68
+ T && clearTimeout(T), T = setTimeout(() => {
69
+ T = void 0, x();
70
70
  }, 120);
71
71
  };
72
72
  return {
73
73
  load(r, t) {
74
74
  if (t.useRequestIdentity(), k || S || t.signal.aborted || !L(r)) {
75
- e.markPageLoadFailed(r, t), m(r, "skip");
75
+ e.markPageLoadFailed(r, t), h(r, "skip");
76
76
  return;
77
77
  }
78
78
  const p = d.get(r);
79
79
  if (p?.request === t && !p.finished) return;
80
- if (p && N(p), l(r), r === 0 && v) {
81
- const b = v;
82
- v = void 0;
80
+ if (p && N(p), l(r), r === 0 && m) {
81
+ const b = m;
82
+ m = void 0;
83
83
  try {
84
84
  D(0, b, t);
85
85
  } catch {
86
- u.add(r), e.markPageLoadFailed(r, t), m(r, "error");
86
+ u.add(r), e.markPageLoadFailed(r, t), h(r, "error");
87
87
  }
88
- g();
88
+ f();
89
89
  return;
90
90
  }
91
91
  const n = { page: r, request: t, controller: new AbortController(), running: !1, finished: !1, removeAbort: () => {
92
- } }, K = () => {
93
- N(n), g();
92
+ } }, W = () => {
93
+ N(n), f();
94
94
  };
95
- t.signal.addEventListener("abort", K, { once: !0 }), n.removeAbort = () => t.signal.removeEventListener("abort", K), d.set(r, n), x(), g();
95
+ t.signal.addEventListener("abort", W, { once: !0 }), n.removeAbort = () => t.signal.removeEventListener("abort", W), d.set(r, n), K(), f();
96
96
  },
97
97
  viewportChanged() {
98
98
  if (k) return;
99
99
  const r = e.getPagesInView();
100
- r?.length && (l(r[0]), d.size && x(), g());
100
+ r?.length && (l(r[0]), d.size && K(), f());
101
101
  },
102
102
  retry() {
103
103
  if (!k) {
@@ -105,21 +105,20 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
105
105
  O();
106
106
  return;
107
107
  }
108
- u.size !== 0 && (u.clear(), B(), g());
108
+ u.size !== 0 && (u.clear(), B(), f());
109
109
  }
110
110
  },
111
111
  dispose() {
112
- k = !0, P && clearTimeout(P), P = void 0;
112
+ k = !0, T && clearTimeout(T), T = void 0;
113
113
  for (const r of d.values()) N(r);
114
- R = [], u.clear(), v = void 0;
114
+ P = [], u.clear(), m = void 0;
115
115
  }
116
116
  };
117
117
  }, fe = [
118
- { key: "applicationNo", title: "申请单编号", width: 260 },
119
- { key: "applicationType", title: "申请单类型", width: 180 },
118
+ { key: "applicationNo", title: "申请单ID", width: 260 },
119
+ { key: "applicationType", title: "业务表单", width: 180 },
120
120
  { key: "applicantName", title: "申请人", width: 170 },
121
- { key: "applicationTime", title: "申请时间", width: 220 },
122
- { key: "statusLabel", title: "流程状态", width: 140 }
121
+ { key: "applicationTime", title: "申请时间", width: 220 }
123
122
  ].map((e) => ({ ...e, showEllipsis: !0, sortable: !1 })), te = 40, ge = (e) => {
124
123
  const a = M(void 0);
125
124
  return e.initialPage ? /* @__PURE__ */ s(
@@ -128,27 +127,27 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
128
127
  ...e,
129
128
  initialPage: e.initialPage,
130
129
  restoreScroll: a.current?.query === e.query ? a.current.position : void 0,
131
- rememberScroll: (h) => {
132
- a.current = { query: e.query, position: h };
130
+ rememberScroll: (g) => {
131
+ a.current = { query: e.query, position: g };
133
132
  }
134
133
  }
135
134
  ) : /* @__PURE__ */ s("div", { className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" });
136
- }, he = ({ components: { Button: e }, initialPage: a, query: h, provider: F, themeKey: W, onOpen: B, onReload: O, logger: z, restoreScroll: d, rememberScroll: A }) => {
137
- const R = M(null), i = M(null), u = M(null), [v, f] = V(!1), [c, k] = V(0), [S, P] = V({ ...a, failed: !1, loading: !1 }), L = M(a.rows), m = M(d), g = M({ provider: F, onOpen: B, onReload: O, logger: z, rememberScroll: A });
138
- g.current = { provider: F, onOpen: B, onReload: O, logger: z, rememberScroll: A };
135
+ }, he = ({ components: { Button: e }, initialPage: a, query: g, provider: F, themeKey: $, onOpen: B, onReload: O, logger: C, restoreScroll: d, rememberScroll: I }) => {
136
+ const P = M(null), i = M(null), u = M(null), [m, v] = V(!1), [c, k] = V(0), [S, T] = V({ ...a, failed: !1, loading: !1 }), L = M(a.rows), h = M(d), f = M({ provider: F, onOpen: B, onReload: O, logger: C, rememberScroll: I });
137
+ f.current = { provider: F, onOpen: B, onReload: O, logger: C, rememberScroll: I };
139
138
  const N = M(() => {
140
139
  });
141
140
  return j(() => {
142
- const l = R.current;
141
+ const l = P.current;
143
142
  if (!l) return;
144
- let D = !1, $, x, r, t = a.total;
145
- I(g.current.logger, { operation: "table", phase: "start" });
143
+ let D = !1, x, K, r, t = a.total;
144
+ A(f.current.logger, { operation: "table", phase: "start" });
146
145
  const p = () => {
147
- D || (f(!0), I(g.current.logger, { operation: "table", phase: "error" }));
146
+ D || (v(!0), A(f.current.logger, { operation: "table", phase: "error" }));
148
147
  };
149
148
  return import("@qfei-design/canvas-table").then((n) => {
150
149
  if (D) return;
151
- const K = () => {
150
+ const W = () => {
152
151
  const o = i.current, y = o?.getScrollState();
153
152
  o && y && n.globalEventBus.emitWithNamespace("scroll:change", o.tableId, y);
154
153
  }, b = () => {
@@ -165,9 +164,9 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
165
164
  ...E.getPropertyValue("--make-approval-bg").trim() ? { rowBgColor: E.getPropertyValue("--make-approval-bg").trim() } : {},
166
165
  ...E.getPropertyValue("--make-approval-header").trim() ? { headerBgColor: E.getPropertyValue("--make-approval-header").trim() } : {},
167
166
  ...E.getPropertyValue("--make-approval-border").trim() ? { borderColor: E.getPropertyValue("--make-approval-border").trim() } : {}
168
- }, ne = Math.max(Math.ceil(300 / h.pageSize), Math.ceil(y * 3 / te / h.pageSize) + 2) * h.pageSize, q = { enabled: !0, totalRowCount: t, pageSize: h.pageSize, maxCachedRows: ne };
167
+ }, oe = Math.max(Math.ceil(300 / g.pageSize), Math.ceil(y * 3 / te / g.pageSize) + 2) * g.pageSize, q = { enabled: !0, totalRowCount: t, pageSize: g.pageSize, maxCachedRows: oe };
169
168
  if (i.current) {
170
- i.current.updateProps({ canvasWidth: o, canvasHeight: y, style: Z, virtualOptions: q }), i.current.updateCanvasSize(o, y, !0), K();
169
+ i.current.updateProps({ canvasWidth: o, canvasHeight: y, style: Z, virtualOptions: q }), i.current.updateCanvasSize(o, y, !0), W();
171
170
  return;
172
171
  }
173
172
  i.current = new n.CanvasTableComponent(l, {
@@ -176,7 +175,7 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
176
175
  canvasHeight: y,
177
176
  style: Z,
178
177
  rowKey: "id",
179
- showSN: { enabled: !0, width: 64, formatter: (w, C) => C + 1 },
178
+ showSN: { enabled: !0, width: 64, formatter: (w, R) => R + 1 },
180
179
  virtualOptions: q,
181
180
  selectable: { enabled: !1 },
182
181
  rowSortable: { enabled: !1 },
@@ -188,65 +187,65 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
188
187
  bodyRowHeadSuffixOptions: {
189
188
  enabled: !0,
190
189
  width: 20,
191
- render: ({ group: w, x: C, height: Y, rowData: G }) => {
192
- const se = G?.id, _ = new n.RectShape({ name: "approval-open", x: C, y: Y / 2 - 10, cursor: "pointer", tooltip: "查看审批详情", attrs: { width: 20, height: 20, fill: "transparent", stroke: "transparent" } });
190
+ render: ({ group: w, x: R, height: Y, rowData: G }) => {
191
+ const ne = G?.id, _ = new n.RectShape({ name: "approval-open", x: R, y: Y / 2 - 10, cursor: "pointer", tooltip: "查看审批详情", attrs: { width: 20, height: 20, fill: "transparent", stroke: "transparent" } });
193
192
  _.addChild(new n.ImgShape({ name: "approval-open-icon", x: 3, y: 3, attrs: {
194
193
  width: 14,
195
194
  height: 14,
196
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="${E.color || "#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)
197
196
  } })), _.on("mousedown", (J) => J.stopPropagation?.()), _.on("click", (J) => {
198
197
  J.stopPropagation?.();
199
- const ee = L.current.find((le) => le.id === se);
200
- ee && g.current.onOpen(ee);
198
+ const ee = L.current.find((se) => se.id === ne);
199
+ ee && f.current.onOpen(ee);
201
200
  }), w.addChild(_);
202
201
  }
203
202
  }
204
203
  });
205
204
  const H = i.current, X = ue({
206
205
  table: H,
207
- query: h,
206
+ query: g,
208
207
  initialPage: a,
209
208
  // 公开滚动同步事件会重新检测缺页,不移动视口,也不复用失败身份。
210
- retryViewport: K,
211
- onReload: () => g.current.onReload(),
212
- loadPage: (w, C) => g.current.provider.loadPage(w, C),
213
- logger: (w) => I(g.current.logger, w),
209
+ retryViewport: W,
210
+ onReload: () => f.current.onReload(),
211
+ loadPage: (w, R) => f.current.provider.loadPage(w, R),
212
+ logger: (w) => A(f.current.logger, w),
214
213
  onChange: (w) => {
215
- D || (t = w.total, L.current = w.rows, P((C) => C.total === w.total && C.failed === w.failed && C.loading === w.loading && C.rows.length === w.rows.length && C.rows.every((Y, G) => Y === w.rows[G]) ? C : w));
214
+ D || (t = w.total, L.current = w.rows, T((R) => R.total === w.total && R.failed === w.failed && R.loading === w.loading && R.rows.length === w.rows.length && R.rows.every((Y, G) => Y === w.rows[G]) ? R : w));
216
215
  }
217
216
  });
218
- u.current = X, x = n.globalEventBus.onWithNamespace("data:load", H.tableId, (w, C) => X.load(w, C)), r = n.globalEventBus.onWithNamespace("scroll:change", H.tableId, () => X.viewportChanged()), m.current && H.scrollTo(m.current.scrollX, m.current.scrollY), f(!1), I(g.current.logger, { operation: "table", phase: "success" });
217
+ u.current = X, K = n.globalEventBus.onWithNamespace("data:load", H.tableId, (w, R) => X.load(w, R)), r = n.globalEventBus.onWithNamespace("scroll:change", H.tableId, () => X.viewportChanged()), h.current && H.scrollTo(h.current.scrollX, h.current.scrollY), v(!1), A(f.current.logger, { operation: "table", phase: "success" });
219
218
  } catch {
220
219
  p();
221
220
  }
222
221
  };
223
- N.current = b, $ = new ResizeObserver(b), $.observe(l), b();
222
+ N.current = b, x = new ResizeObserver(b), x.observe(l), b();
224
223
  }).catch(p), () => {
225
- D = !0, $?.disconnect(), N.current = () => {
226
- }, i.current && (m.current = i.current.getScrollState(), m.current && g.current.rememberScroll(m.current)), x?.(), r?.(), u.current?.dispose(), u.current = null, i.current?.destroy(), i.current = null, I(g.current.logger, { operation: "table", phase: "destroy" });
224
+ D = !0, x?.disconnect(), N.current = () => {
225
+ }, i.current && (h.current = i.current.getScrollState(), h.current && f.current.rememberScroll(h.current)), K?.(), r?.(), u.current?.dispose(), u.current = null, i.current?.destroy(), i.current = null, A(f.current.logger, { operation: "table", phase: "destroy" });
227
226
  };
228
- }, [a, h, c]), j(() => {
227
+ }, [a, g, c]), j(() => {
229
228
  N.current();
230
- }, [W]), /* @__PURE__ */ T("div", { className: "make-app-approval-table-frame", "aria-busy": S.loading, children: [
231
- /* @__PURE__ */ s("div", { ref: R, className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" }),
232
- v && /* @__PURE__ */ T("div", { className: "make-app-approval-overlay", role: "alert", children: [
229
+ }, [$]), /* @__PURE__ */ z("div", { className: "make-app-approval-table-frame", "aria-busy": S.loading, children: [
230
+ /* @__PURE__ */ s("div", { ref: P, className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" }),
231
+ m && /* @__PURE__ */ z("div", { className: "make-app-approval-overlay", role: "alert", children: [
233
232
  "表格加载失败 ",
234
233
  /* @__PURE__ */ s(e, { htmlType: "button", variant: "default", onClick: () => {
235
- f(!1), k((l) => l + 1);
234
+ v(!1), k((l) => l + 1);
236
235
  }, children: "重新加载表格" })
237
236
  ] }),
238
- !v && S.failed && /* @__PURE__ */ T("div", { className: "make-app-approval-table-feedback", role: "alert", children: [
237
+ !m && S.failed && /* @__PURE__ */ z("div", { className: "make-app-approval-table-feedback", role: "alert", children: [
239
238
  "部分审批记录加载失败 ",
240
239
  /* @__PURE__ */ s(e, { htmlType: "button", variant: "default", onClick: () => u.current?.retry(), children: "重试加载" })
241
240
  ] }),
242
- !v && !S.failed && S.loading && /* @__PURE__ */ T("div", { className: "make-app-approval-table-loading", role: "status", "aria-label": "正在加载审批记录", "aria-live": "polite", children: [
241
+ !m && !S.failed && S.loading && /* @__PURE__ */ z("div", { className: "make-app-approval-table-loading", role: "status", "aria-label": "正在加载审批记录", "aria-live": "polite", children: [
243
242
  /* @__PURE__ */ s("span", { className: "make-app-approval-loading-spinner", "aria-hidden": "true" }),
244
243
  /* @__PURE__ */ s("span", { children: "加载中" })
245
244
  ] }),
246
- /* @__PURE__ */ T("ul", { className: "make-app-approval-accessible-rows", "aria-label": "审批记录文字视图", children: [
245
+ /* @__PURE__ */ z("ul", { className: "make-app-approval-accessible-rows", "aria-label": "审批记录文字视图", children: [
247
246
  S.total === 0 && /* @__PURE__ */ s("li", { children: "暂无审批记录" }),
248
- S.rows.map((l) => /* @__PURE__ */ T("li", { children: [
249
- /* @__PURE__ */ T("span", { children: [
247
+ S.rows.map((l) => /* @__PURE__ */ z("li", { children: [
248
+ /* @__PURE__ */ z("span", { children: [
250
249
  l.applicationNo,
251
250
  ",",
252
251
  l.applicationType,
@@ -254,11 +253,9 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
254
253
  l.applicantName,
255
254
  ",",
256
255
  l.applicationTime,
257
- ",",
258
- re(l.processStatus),
259
256
  "。"
260
257
  ] }),
261
- /* @__PURE__ */ T(e, { htmlType: "button", variant: "text", onClick: () => B(l), children: [
258
+ /* @__PURE__ */ z(e, { htmlType: "button", variant: "text", onClick: () => B(l), children: [
262
259
  "打开 ",
263
260
  l.applicationNo || l.applicationType,
264
261
  " 的审批详情"
@@ -266,13 +263,13 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
266
263
  ] }, l.id))
267
264
  ] })
268
265
  ] });
269
- }, me = [], ve = (e, a, h, F) => {
270
- const [W, B] = V(0), [O, z] = V(), d = M({ provider: e, logger: F });
266
+ }, me = [], ve = (e, a, g, F) => {
267
+ const [$, B] = V(0), [O, C] = V(), d = M({ provider: e, logger: F });
271
268
  d.current = { provider: e, logger: F };
272
- const A = ie(() => ({}), [a, h, W]);
269
+ const I = le(() => ({}), [a, g, $]);
273
270
  j(() => {
274
- const i = new AbortController(), { provider: u, logger: v } = d.current, f = { operation: "list", tab: a.tab, page: a.page, pageSize: a.pageSize };
275
- I(v, { ...f, phase: "start" });
271
+ const i = new AbortController(), { provider: u, logger: m } = d.current, v = { operation: "list", tab: a.tab, page: a.page, pageSize: a.pageSize };
272
+ A(m, { ...v, phase: "start" });
276
273
  let c = !1;
277
274
  return (async () => {
278
275
  try {
@@ -280,96 +277,97 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
280
277
  const k = await u.loadPage(a, { signal: i.signal });
281
278
  if (i.signal.aborted) return;
282
279
  const S = Q(k, a.pageSize);
283
- c = !0, z({ ...S, token: A, status: "success" }), I(v, { ...f, phase: "success", rowCount: S.rows.length });
280
+ c = !0, C({ ...S, token: I, status: "success" }), A(m, { ...v, phase: "success", rowCount: S.rows.length });
284
281
  } catch {
285
282
  if (i.signal.aborted) return;
286
- c = !0, z({ token: A, status: "error", rows: me, total: 0 }), I(v, { ...f, phase: "error" });
283
+ c = !0, C({ token: I, status: "error", rows: me, total: 0 }), A(m, { ...v, phase: "error" });
287
284
  }
288
285
  })(), () => {
289
- i.abort(), c || I(v, { ...f, phase: "cancel" });
286
+ i.abort(), c || A(m, { ...v, phase: "cancel" });
290
287
  };
291
- }, [a, A]);
292
- const R = O?.token === A ? O : void 0;
288
+ }, [a, I]);
289
+ const P = O?.token === I ? O : void 0;
293
290
  return {
294
- initialPage: R?.status === "success" ? R : void 0,
295
- total: R?.total ?? 0,
296
- status: R?.status ?? "loading",
291
+ initialPage: P?.status === "success" ? P : void 0,
292
+ total: P?.total ?? 0,
293
+ status: P?.status ?? "loading",
297
294
  reload: () => B((i) => i + 1)
298
295
  };
299
- }, U = { keyword: "", processStatus: "", startDate: "", endDate: "" }, be = [{ value: "pending", label: "待我处理" }, { value: "approved", label: "已审批" }], ae = (e) => {
296
+ }, U = { keyword: "", applicantId: "", processStatus: "", startDate: "", endDate: "" }, be = [{ value: "pending", label: "待处理" }, { value: "approved", label: "已完成" }], ae = (e) => {
300
297
  if (e === "") return !0;
301
298
  if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
302
299
  const a = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
303
300
  return Number.isFinite(a.getTime()) && a.toISOString().slice(0, 10) === e;
304
- }, we = ({ components: e, provider: a, onOpenApproval: h, statusOptions: F = [], pageSize: W = 20, refreshKey: B, themeKey: O, logger: z, className: d }) => {
305
- const { Input: A, Select: R, DateRangePicker: i, Button: u, Tabs: v } = e, f = ce(), [c, k] = V(U), [S, P] = V(0), [L, m] = V(""), [g, N] = V(""), [l, D] = V({ ...U, tab: "pending", page: 1, pageSize: W }), { initialPage: $, status: x, reload: r } = ve(a, l, B, z), t = M(!1), p = M(!0);
301
+ }, we = ({ components: e, provider: a, onOpenApproval: g, applicantOptions: F = [], pageSize: $ = 20, refreshKey: B, themeKey: O, logger: C, className: d }) => {
302
+ const { Input: I, Select: P, DateRangePicker: i, Button: u, Tabs: m } = e, v = ie(), [c, k] = V(U), [S, T] = V(0), [L, h] = V(""), [f, N] = V(""), [l, D] = V({ ...U, tab: "pending", page: 1, pageSize: $ }), { initialPage: x, status: K, reload: r } = ve(a, l, B, C), t = M(!1), p = M(!0);
306
303
  j(() => (p.current = !0, () => {
307
304
  p.current = !1;
308
305
  }), []);
309
- const n = x === "loading", K = async (o) => {
306
+ const n = K === "loading", W = async (o) => {
310
307
  if (!t.current) {
311
- t.current = !0, N(""), I(z, { operation: "open", phase: "start" });
308
+ t.current = !0, N(""), A(C, { operation: "open", phase: "start" });
312
309
  try {
313
- await h(o), I(z, { operation: "open", phase: "success" });
310
+ await g(o), A(C, { operation: "open", phase: "success" });
314
311
  } catch {
315
- p.current && N("审批详情打开失败,请重试"), I(z, { operation: "open", phase: "error" });
312
+ p.current && N("审批详情打开失败,请重试"), A(C, { operation: "open", phase: "error" });
316
313
  } finally {
317
314
  t.current = !1;
318
315
  }
319
316
  }
320
317
  }, b = (o) => {
321
- o !== l.tab && (m(""), N(""), D((y) => ({ ...y, tab: o, page: 1 })));
318
+ o !== l.tab && (h(""), N(""), D((y) => ({ ...y, tab: o, page: 1 })));
322
319
  };
323
- return /* @__PURE__ */ s("section", { className: ["make-app-approval", d].filter(Boolean).join(" "), "aria-label": "我的审批", children: /* @__PURE__ */ T(v, { items: be, value: l.tab, onChange: b, ariaLabel: "审批分类", children: [
324
- /* @__PURE__ */ T("form", { className: "make-app-approval-filters", onSubmit: (o) => {
320
+ return /* @__PURE__ */ s("section", { className: ["make-app-approval", d].filter(Boolean).join(" "), "aria-label": "我的审批", children: /* @__PURE__ */ z(m, { items: be, value: l.tab, onChange: b, ariaLabel: "审批分类", children: [
321
+ /* @__PURE__ */ z("form", { className: "make-app-approval-filters", onSubmit: (o) => {
325
322
  if (o.preventDefault(), !ae(c.startDate) || !ae(c.endDate)) {
326
- m("请选择有效日期");
323
+ h("请选择有效日期");
327
324
  return;
328
325
  }
329
326
  if (c.startDate && c.endDate && c.startDate > c.endDate) {
330
- m("开始日期不能晚于结束日期");
327
+ h("开始日期不能晚于结束日期");
331
328
  return;
332
329
  }
333
- m(""), N(""), D((y) => ({ ...y, ...c, keyword: c.keyword.trim(), page: 1 }));
330
+ h(""), N(""), D((y) => ({ ...y, ...c, keyword: c.keyword.trim(), page: 1 }));
334
331
  }, children: [
335
- /* @__PURE__ */ T("div", { className: "make-app-approval-filter-field", children: [
336
- /* @__PURE__ */ s("label", { htmlFor: `${f}-keyword`, children: "申请单编号" }),
337
- /* @__PURE__ */ s(A, { id: `${f}-keyword`, ariaLabel: "申请单编号", placeholder: "搜索申请单编号", value: c.keyword, onChange: (o) => k((y) => ({ ...y, keyword: o })) })
338
- ] }),
339
- /* @__PURE__ */ T("div", { className: "make-app-approval-filter-field", children: [
340
- /* @__PURE__ */ s("label", { htmlFor: `${f}-status`, children: "流程状态" }),
341
- /* @__PURE__ */ s(R, { id: `${f}-status`, ariaLabel: "流程状态", value: c.processStatus, options: [{ value: "", label: "全部流程状态" }, ...F], onChange: (o) => k((y) => ({ ...y, processStatus: o })) })
342
- ] }),
343
- /* @__PURE__ */ T("fieldset", { className: "make-app-approval-date-field", children: [
344
- /* @__PURE__ */ s("legend", { children: "申请时间" }),
345
- /* @__PURE__ */ s("div", { className: "make-app-approval-date-control", children: /* @__PURE__ */ s(
346
- i,
347
- {
348
- id: `${f}-period`,
349
- ariaLabel: "申请时间",
350
- placeholder: ["开始日期", "结束日期"],
351
- value: [c.startDate, c.endDate],
352
- onChange: ([o, y]) => k((E) => ({ ...E, startDate: o, endDate: y }))
353
- },
354
- S
355
- ) })
356
- ] }),
357
- /* @__PURE__ */ T("div", { className: "make-app-approval-filter-actions", children: [
332
+ /* @__PURE__ */ s("div", { className: "make-app-approval-filter-field", children: /* @__PURE__ */ s(I, { id: `${v}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: c.keyword, onChange: (o) => k((y) => ({ ...y, keyword: o })) }) }),
333
+ /* @__PURE__ */ s("div", { className: "make-app-approval-date-control", children: /* @__PURE__ */ s(
334
+ i,
335
+ {
336
+ id: `${v}-period`,
337
+ ariaLabel: "申请时间",
338
+ placeholder: ["开始日期", "结束日期"],
339
+ value: [c.startDate, c.endDate],
340
+ onChange: ([o, y]) => k((E) => ({ ...E, startDate: o, endDate: y }))
341
+ },
342
+ S
343
+ ) }),
344
+ /* @__PURE__ */ s("div", { className: "make-app-approval-filter-field", children: /* @__PURE__ */ s(
345
+ P,
346
+ {
347
+ id: `${v}-applicant`,
348
+ ariaLabel: "申请人",
349
+ purpose: "applicant",
350
+ value: c.applicantId ?? "",
351
+ options: [{ value: "", label: "全部申请人" }, ...F.filter((o) => o.value !== "")],
352
+ onChange: (o) => k((y) => ({ ...y, applicantId: o }))
353
+ }
354
+ ) }),
355
+ /* @__PURE__ */ z("div", { className: "make-app-approval-filter-actions", children: [
358
356
  /* @__PURE__ */ s(u, { htmlType: "submit", variant: "primary", children: "查询" }),
359
357
  /* @__PURE__ */ s(u, { htmlType: "button", variant: "default", onClick: () => {
360
- k(U), P((o) => o + 1), m(""), N(""), D((o) => ({ ...o, ...U, page: 1 }));
358
+ k(U), T((o) => o + 1), h(""), N(""), D((o) => ({ ...o, ...U, page: 1 }));
361
359
  }, children: "重置" }),
362
360
  /* @__PURE__ */ s(u, { htmlType: "button", variant: "default", disabled: n, loading: n, onClick: r, children: "刷新" })
363
361
  ] })
364
362
  ] }),
365
363
  L && /* @__PURE__ */ s("p", { role: "alert", className: "make-app-approval-error", children: L }),
366
- g && /* @__PURE__ */ s("p", { role: "alert", className: "make-app-approval-error", children: g }),
367
- /* @__PURE__ */ T("div", { className: "make-app-approval-results", "aria-busy": n, children: [
368
- /* @__PURE__ */ s(ge, { components: e, initialPage: $, query: l, provider: a, onOpen: (o) => {
369
- K(o);
370
- }, onReload: r, themeKey: O, logger: z }),
364
+ f && /* @__PURE__ */ s("p", { role: "alert", className: "make-app-approval-error", children: f }),
365
+ /* @__PURE__ */ z("div", { className: "make-app-approval-results", "aria-busy": n, children: [
366
+ /* @__PURE__ */ s(ge, { components: e, initialPage: x, query: l, provider: a, onOpen: (o) => {
367
+ W(o);
368
+ }, onReload: r, themeKey: O, logger: C }),
371
369
  n && /* @__PURE__ */ s("div", { className: "make-app-approval-overlay", role: "status", children: "正在加载审批记录…" }),
372
- x === "error" && /* @__PURE__ */ T("div", { className: "make-app-approval-overlay", role: "alert", children: [
370
+ K === "error" && /* @__PURE__ */ z("div", { className: "make-app-approval-overlay", role: "alert", children: [
373
371
  /* @__PURE__ */ s("span", { children: "审批列表加载失败,请重试" }),
374
372
  /* @__PURE__ */ s(u, { htmlType: "button", variant: "default", onClick: r, children: "重试" })
375
373
  ] })
@@ -378,8 +376,8 @@ const re = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : pe(e).labe
378
376
  }, Ne = (e) => {
379
377
  const a = e.pageSize ?? 20;
380
378
  if (!e.scopeKey.trim()) throw new Error("MyApprovalsPage requires scopeKey");
381
- for (const h of ["Input", "Select", "DateRangePicker", "Button", "Tabs"])
382
- if (!e.components?.[h]) throw new Error(`MyApprovalsPage requires components.${h}`);
379
+ for (const g of ["Input", "Select", "DateRangePicker", "Button", "Tabs"])
380
+ if (!e.components?.[g]) throw new Error(`MyApprovalsPage requires components.${g}`);
383
381
  if (!Number.isSafeInteger(a) || a < 1 || a > 200) throw new Error("pageSize must be an integer from 1 to 200");
384
382
  return /* @__PURE__ */ s(we, { ...e, pageSize: a }, JSON.stringify([e.scopeKey, a]));
385
383
  };
package/dist/styles.css CHANGED
@@ -38,12 +38,9 @@
38
38
  min-width: 0;
39
39
  box-sizing: border-box;
40
40
  }
41
- /* 为宿主控件的聚焦外框预留空间,避免被列表的 overflow 裁切。 */
42
- .make-app-approval-filters { display: flex; flex: none; align-items: end; flex-wrap: wrap; gap: 14px; padding: 0 4px 12px; }
41
+ /* 页签下方留白;为宿主控件的聚焦外框预留空间,避免被列表的 overflow 裁切。 */
42
+ .make-app-approval-filters { display: flex; flex: none; align-items: end; flex-wrap: wrap; gap: 14px; margin-top: 12px; padding: 0 4px 12px; }
43
43
  .make-app-approval-filter-field { display: flex; flex-direction: column; gap: 6px; width: 200px; min-width: 0; }
44
- .make-app-approval-filter-field > label { color: var(--make-approval-muted); font-size: 14px; }
45
- .make-app-approval-date-field { border: 0; padding: 0; margin: 0; min-width: 0; }
46
- .make-app-approval-date-field > legend { padding: 0; margin-bottom: 6px; color: var(--make-approval-muted); font-size: 14px; }
47
44
  .make-app-approval-filter-actions { display: flex; align-items: center; gap: 8px; }
48
45
  .make-app-approval-date-control { min-width: 0; width: 200px; max-width: 100%; }
49
46
  .make-app-approval-results, .make-app-approval-table-frame { position: relative; }
@@ -107,10 +104,6 @@
107
104
  .make-app-approval-detail-opinion { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #f0f0f0; }
108
105
  .make-app-approval-detail-opinion textarea { background: #fff; }
109
106
  .make-app-approval-detail-opinion > label { font-size: 14px; font-weight: 600; }
110
- .make-app-approval-action-confirm { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
111
- .make-app-approval-action-confirm h3 { font-size: 14px; margin: 0; }
112
- .make-app-approval-action-confirm > .make-app-approval-detail-actions { justify-content: flex-end; }
113
- .make-app-approval-detail-target { display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
114
107
  @container make-approval-detail (max-width: 640px) {
115
108
  .make-app-approval-detail-fields { grid-template-columns: minmax(0, 1fr); }
116
109
  }
@@ -1,6 +1,5 @@
1
1
  /** 宿主提供业务记录定位,App 范围由 Service 注入;后端最终校验发起人和流程状态。 */
2
2
  export type ApprovalWithdrawalInput = Readonly<{
3
- bpmKey: string;
4
3
  comment: string;
5
4
  }>;
6
5
  export type ApprovalWithdrawalResult = Readonly<{