@yuku123/z-frontend-common 1.1.3 → 1.1.5

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/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  |------|-----|
16
16
  | 仓 | `z-opc-foundation/z-frontend-common`(本仓) |
17
17
  | npm 包 | `@yuku123/z-frontend-common`(scope 沿用 yuku123,与 0.1.x/0.2.x 旧线连续) |
18
- | 当前版本 | `1.1.3` —— 1.0 语义:§1-§16 规范化起点;1.1.x 在其上追加扁平 ui 组件桶。0.1.x 是 pre-§16 形态;0.2.x 内嵌 react-dom 已废弃 |
18
+ | 当前版本 | `1.1.5` —— 1.0 语义:§1-§16 规范化起点;1.1.x 在其上追加扁平 ui 组件桶。0.1.x 是 pre-§16 形态;0.2.x 内嵌 react-dom 已废弃 |
19
19
  | 技术栈 | React 19 + antd 6 + react-router-dom 7 + Vite 6(lead 005 §3.0 版本线单一尺子) |
20
20
  | 产物 | ESM **3 入口**(`formats: ['es']`):`dist/index.js`(主桶)+ `dist/ui.js`(扁平 ui 桶)+ `dist/ui-echarts.js`(`ui/echarts` 子路径) |
21
21
  | 打包策略 | external 精确 **9** 个包 + **1** 条前缀规则(`echarts/*`):react / react-dom / react-dom/client / react/jsx-runtime / react-router-dom / antd / @ant-design/icons / axios / echarts |
@@ -82,4 +82,6 @@ const MOCK_AUTH = { username: 'admin', password: '123456', user: { name: 'admin'
82
82
  - `1.0.0`:独立仓首版 —— 源码自 vendoring 迁入,API 契约兼容 0.1.1,AppLayout/LoginPage 升级 §1-§16 规范版
83
83
  - `1.1.1`:在 1.0.0 之上追加扁平 ui 组件桶(13 个 UI 组件 + design token)与 `ui/echarts` 子路径
84
84
  - `1.1.2`:ui 桶追加 `ComponentDoc`(§7 组件文档页:240px TOC + 正文两栏、滚动联动、锚点跳转、自带零依赖 markdown 引擎,宿主可注册 react-markdown 三件套升级为 GFM + Prism 高亮)
85
+ - `1.1.4`:ui 桶的 `ListTable` 支持 `cardExtra`(Card 动作按钮)与 `searchKeys`(过滤框)**并排**渲染 —— 原实现二选一,会把其中一个静默吞掉(页面同时有「搜索」和「新增」按钮时按钮消失)。
86
+ - `1.1.5`:`PagedTable`(**服务端分页**变体)补上 `pageSizeOptions` —— §2 强制规则 2 要求分页凑齐 `pageSize` + `showSizeChanger` + `pageSizeOptions` + `showTotal` 四件套,而 `PagedTable` 的分页参数是内联在组件里的(不走 `DEFAULT_PAGINATION`),此前漏了 `pageSizeOptions` ⇒ 全库 §2 元素级普查把 **8 个仓**的 `PagedTable` 拷贝一起判红(根因是这一处漏项被复制了 8 遍)。同版把 `showTotal` 的两支文案提成纯函数 `PAGED_TOTAL_TEXT` 并加 `test/paged-table.test.mjs`(含变异必须真红)—— antd Table 在空数据时整个分页块不渲染,闭包式文案没法被测到。
85
87
  - `1.1.3`:ui 桶追加 `useListFilter` / `filterRows`(§2 强制规则 3 的客户端过滤口径统一收在基座:大小写不敏感、多字段「或」匹配、null 字段不参与匹配、空关键字原样返回)与 `ListTable`(§2 规则 2/3/4 的成品件:分页三件套 + Card extra 过滤框 + EmptyState 空态一次到位)
@@ -1,8 +1,8 @@
1
- import { jsxs as m, jsx as t, Fragment as Ce } from "react/jsx-runtime";
2
- import { useState as z, useRef as H, useEffect as D, useMemo as q, useCallback as be, useLayoutEffect as Re, createElement as ae, Fragment as O } from "react";
3
- import { Button as V, Skeleton as _, Input as Te, Card as me, Table as ye, Breadcrumb as Ee, Space as se, Tag as ce } from "antd";
4
- import { InboxOutlined as Ae, ExclamationCircleOutlined as Ie, ReloadOutlined as re, SearchOutlined as ze, ReadOutlined as Be } from "@ant-design/icons";
5
- import { useNavigate as xe, useInRouterContext as De } from "react-router-dom";
1
+ import { jsxs as m, jsx as t, Fragment as Re } from "react/jsx-runtime";
2
+ import { useState as B, useRef as P, useEffect as L, useMemo as q, useCallback as me, useLayoutEffect as Te, createElement as ae, Fragment as O } from "react";
3
+ import { Button as V, Skeleton as N, Input as Ee, Card as ye, Table as xe, Breadcrumb as Ae, Space as se, Tag as ce } from "antd";
4
+ import { InboxOutlined as Ie, ExclamationCircleOutlined as ze, ReloadOutlined as re, SearchOutlined as Be, ReadOutlined as De } from "@ant-design/icons";
5
+ import { useNavigate as ve, useInRouterContext as Le } from "react-router-dom";
6
6
  const T = {
7
7
  // 主色 (蓝紫) - 顶导/重点按钮/链接
8
8
  primary: "#7c3aed",
@@ -83,15 +83,15 @@ const T = {
83
83
  lg: 16,
84
84
  xl: 20,
85
85
  pill: 999
86
- }, B = {
86
+ }, D = {
87
87
  sm: "0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.06)",
88
88
  md: "0 2px 4px -1px rgba(15, 23, 42, 0.04), 0 4px 8px -1px rgba(15, 23, 42, 0.08)",
89
89
  lg: "0 4px 6px -2px rgba(15, 23, 42, 0.05), 0 12px 16px -4px rgba(15, 23, 42, 0.10)",
90
90
  xl: "0 8px 24px -6px rgba(15, 23, 42, 0.10), 0 24px 48px -12px rgba(15, 23, 42, 0.18)"
91
- }, at = {
92
- rest: B.md,
91
+ }, st = {
92
+ rest: D.md,
93
93
  hover: "0 8px 16px -4px rgba(15, 23, 42, 0.08), 0 20px 32px -8px rgba(15, 23, 42, 0.14)"
94
- }, N = {
94
+ }, _ = {
95
95
  1: 4,
96
96
  2: 8,
97
97
  3: 12,
@@ -112,7 +112,7 @@ const T = {
112
112
  "2xl": 24,
113
113
  "3xl": 30,
114
114
  "4xl": 36
115
- }, M = {
115
+ }, H = {
116
116
  token: {
117
117
  // 主色
118
118
  colorPrimary: T.primary,
@@ -144,8 +144,8 @@ const T = {
144
144
  fontSize: de.base,
145
145
  fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif",
146
146
  // 阴影
147
- boxShadow: B.md,
148
- boxShadowSecondary: B.lg
147
+ boxShadow: D.md,
148
+ boxShadowSecondary: D.lg
149
149
  },
150
150
  components: {
151
151
  // Layout: 顶导白底更现代
@@ -169,7 +169,7 @@ const T = {
169
169
  // Card: 更柔和
170
170
  Card: {
171
171
  borderRadiusLG: C.lg,
172
- boxShadowTertiary: B.sm
172
+ boxShadowTertiary: D.sm
173
173
  },
174
174
  // Button: 主按钮圆角统一
175
175
  Button: {
@@ -189,7 +189,7 @@ const T = {
189
189
  }
190
190
  }
191
191
  };
192
- function st({
192
+ function ct({
193
193
  icon: e,
194
194
  label: n,
195
195
  value: s,
@@ -200,21 +200,21 @@ function st({
200
200
  loading: l = !1,
201
201
  precision: i = 0
202
202
  }) {
203
- const d = E[c] || E.blue, [f, g] = z(0), p = H(0);
204
- D(() => {
203
+ const d = E[c] || E.blue, [f, g] = B(0), p = P(0);
204
+ L(() => {
205
205
  if (l || s == null) return;
206
206
  const b = p.current, S = Number(s) || 0;
207
207
  if (b === S) {
208
208
  g(S);
209
209
  return;
210
210
  }
211
- const w = 600, L = performance.now();
212
- let P;
211
+ const w = 600, I = performance.now();
212
+ let $;
213
213
  const G = (U) => {
214
- const j = Math.min(1, (U - L) / w), J = 1 - Math.pow(1 - j, 3), u = b + (S - b) * J;
215
- g(u), j < 1 ? P = requestAnimationFrame(G) : p.current = S;
214
+ const j = Math.min(1, (U - I) / w), J = 1 - Math.pow(1 - j, 3), u = b + (S - b) * J;
215
+ g(u), j < 1 ? $ = requestAnimationFrame(G) : p.current = S;
216
216
  };
217
- return P = requestAnimationFrame(G), () => P && cancelAnimationFrame(P);
217
+ return $ = requestAnimationFrame(G), () => $ && cancelAnimationFrame($);
218
218
  }, [s, l]);
219
219
  const h = () => {
220
220
  r && typeof window < "u" && (window.location.href = r);
@@ -230,10 +230,10 @@ function st({
230
230
  position: "relative",
231
231
  background: d.gradient,
232
232
  borderRadius: C.lg,
233
- padding: N[5],
233
+ padding: _[5],
234
234
  color: d.fg,
235
235
  cursor: r ? "pointer" : "default",
236
- boxShadow: B.md,
236
+ boxShadow: D.md,
237
237
  overflow: "hidden",
238
238
  transition: "transform 200ms ease, box-shadow 200ms ease",
239
239
  minHeight: 110,
@@ -242,10 +242,10 @@ function st({
242
242
  justifyContent: "space-between"
243
243
  },
244
244
  onMouseEnter: (b) => {
245
- b.currentTarget.style.transform = "translateY(-2px)", b.currentTarget.style.boxShadow = B.lg;
245
+ b.currentTarget.style.transform = "translateY(-2px)", b.currentTarget.style.boxShadow = D.lg;
246
246
  },
247
247
  onMouseLeave: (b) => {
248
- b.currentTarget.style.transform = "translateY(0)", b.currentTarget.style.boxShadow = B.md;
248
+ b.currentTarget.style.transform = "translateY(0)", b.currentTarget.style.boxShadow = D.md;
249
249
  },
250
250
  children: [
251
251
  /* @__PURE__ */ t(
@@ -266,7 +266,7 @@ function st({
266
266
  /* @__PURE__ */ m("div", { style: {
267
267
  display: "flex",
268
268
  alignItems: "center",
269
- gap: N[2],
269
+ gap: _[2],
270
270
  position: "relative"
271
271
  }, children: [
272
272
  /* @__PURE__ */ t("div", { style: {
@@ -289,9 +289,9 @@ function st({
289
289
  /* @__PURE__ */ m("div", { style: {
290
290
  display: "flex",
291
291
  alignItems: "baseline",
292
- gap: N[2],
292
+ gap: _[2],
293
293
  position: "relative",
294
- marginTop: N[3]
294
+ marginTop: _[3]
295
295
  }, children: [
296
296
  /* @__PURE__ */ t("div", { style: {
297
297
  fontSize: 30,
@@ -321,7 +321,7 @@ function st({
321
321
  }
322
322
  );
323
323
  }
324
- function Le({ color: e = "blue", label: n, size: s = 8 }) {
324
+ function $e({ color: e = "blue", label: n, size: s = 8 }) {
325
325
  const o = E[e] || E.blue;
326
326
  return /* @__PURE__ */ m("span", { style: {
327
327
  display: "inline-flex",
@@ -342,7 +342,7 @@ function Le({ color: e = "blue", label: n, size: s = 8 }) {
342
342
  n && /* @__PURE__ */ t("span", { children: n })
343
343
  ] });
344
344
  }
345
- function ct({
345
+ function dt({
346
346
  color: e = "blue",
347
347
  title: n,
348
348
  subtitle: s,
@@ -357,7 +357,7 @@ function ct({
357
357
  marginBottom: 16
358
358
  }, children: [
359
359
  /* @__PURE__ */ m("div", { style: { display: "flex", alignItems: "baseline", gap: 12 }, children: [
360
- /* @__PURE__ */ t(Le, { color: e, label: n, size: 10 }),
360
+ /* @__PURE__ */ t($e, { color: e, label: n, size: 10 }),
361
361
  s && /* @__PURE__ */ t("span", { style: {
362
362
  fontSize: 13,
363
363
  color: "#6b7280",
@@ -395,7 +395,7 @@ function ct({
395
395
  )
396
396
  ] });
397
397
  }
398
- function dt({
398
+ function ft({
399
399
  title: e,
400
400
  description: n,
401
401
  icon: s,
@@ -406,7 +406,7 @@ function dt({
406
406
  href: l,
407
407
  extra: i
408
408
  }) {
409
- const d = E[c] || E.violet, [f, g] = z(!1);
409
+ const d = E[c] || E.violet, [f, g] = B(!1);
410
410
  return /* @__PURE__ */ m(
411
411
  "div",
412
412
  {
@@ -420,7 +420,7 @@ function dt({
420
420
  borderRadius: C.lg,
421
421
  overflow: "hidden",
422
422
  cursor: l ? "pointer" : "default",
423
- boxShadow: f ? B.lg : B.sm,
423
+ boxShadow: f ? D.lg : D.sm,
424
424
  transform: f ? "translateY(-2px)" : "translateY(0)",
425
425
  transition: "transform 200ms ease, box-shadow 200ms ease",
426
426
  border: "1px solid #f1f5f9",
@@ -469,10 +469,10 @@ function dt({
469
469
  }, children: i })
470
470
  ] }),
471
471
  /* @__PURE__ */ m("div", { style: {
472
- padding: N[4],
472
+ padding: _[4],
473
473
  display: "flex",
474
474
  flexDirection: "column",
475
- gap: N[2],
475
+ gap: _[2],
476
476
  flex: 1
477
477
  }, children: [
478
478
  a.length > 0 && /* @__PURE__ */ t("div", { style: {
@@ -523,7 +523,7 @@ function dt({
523
523
  fontSize: 11,
524
524
  color: "#9ca3af",
525
525
  marginTop: "auto",
526
- paddingTop: N[2],
526
+ paddingTop: _[2],
527
527
  borderTop: "1px dashed #f1f5f9"
528
528
  }, children: r })
529
529
  ] })
@@ -531,7 +531,7 @@ function dt({
531
531
  }
532
532
  );
533
533
  }
534
- function ft({
534
+ function gt({
535
535
  tag: e,
536
536
  title: n,
537
537
  description: s,
@@ -546,7 +546,7 @@ function ft({
546
546
  background: "linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%)",
547
547
  color: "#ffffff",
548
548
  overflow: "hidden",
549
- boxShadow: B.lg
549
+ boxShadow: D.lg
550
550
  }, children: [
551
551
  /* @__PURE__ */ t("div", { style: {
552
552
  position: "absolute",
@@ -670,7 +670,7 @@ function ne({
670
670
  marginBottom: 16,
671
671
  fontSize: 28,
672
672
  color: "#9ca3af"
673
- }, children: e || /* @__PURE__ */ t(Ae, {}) }),
673
+ }, children: e || /* @__PURE__ */ t(Ie, {}) }),
674
674
  /* @__PURE__ */ t("div", { style: {
675
675
  fontSize: i[a],
676
676
  fontWeight: 600,
@@ -701,7 +701,7 @@ function ne({
701
701
  }
702
702
  );
703
703
  }
704
- function $e({
704
+ function We({
705
705
  error: e,
706
706
  title: n = "加载失败",
707
707
  description: s,
@@ -741,7 +741,7 @@ function $e({
741
741
  color: "#dc2626",
742
742
  fontSize: l ? 28 : 18,
743
743
  flexShrink: 0
744
- }, children: /* @__PURE__ */ t(Ie, {}) }),
744
+ }, children: /* @__PURE__ */ t(ze, {}) }),
745
745
  /* @__PURE__ */ m("div", { style: { flex: 1, minWidth: 0 }, children: [
746
746
  /* @__PURE__ */ t("div", { style: {
747
747
  fontSize: l ? 16 : 14,
@@ -772,7 +772,7 @@ function $e({
772
772
  }
773
773
  );
774
774
  }
775
- function gt({
775
+ function ut({
776
776
  variant: e = "cards",
777
777
  rows: n = 4,
778
778
  active: s = !0,
@@ -801,13 +801,13 @@ function gt({
801
801
  },
802
802
  children: [
803
803
  /* @__PURE__ */ t(
804
- _.Image,
804
+ N.Image,
805
805
  {
806
806
  active: s,
807
807
  style: { width: "100%", height: 140, borderRadius: 0 }
808
808
  }
809
809
  ),
810
- /* @__PURE__ */ t("div", { style: { padding: 16 }, children: /* @__PURE__ */ t(_, { active: s, paragraph: { rows: 2 }, title: { width: "60%" } }) })
810
+ /* @__PURE__ */ t("div", { style: { padding: 16 }, children: /* @__PURE__ */ t(N, { active: s, paragraph: { rows: 2 }, title: { width: "60%" } }) })
811
811
  ]
812
812
  },
813
813
  a
@@ -825,7 +825,7 @@ function gt({
825
825
  borderRadius: C.md,
826
826
  ...o
827
827
  },
828
- children: /* @__PURE__ */ t(_, { active: s, paragraph: { rows: n } })
828
+ children: /* @__PURE__ */ t(N, { active: s, paragraph: { rows: n } })
829
829
  }
830
830
  ) : e === "list" ? /* @__PURE__ */ t("div", { role: "status", "aria-busy": "true", "aria-label": "加载中", style: o, children: Array.from({ length: n }).map((c, a) => /* @__PURE__ */ m(
831
831
  "div",
@@ -838,8 +838,8 @@ function gt({
838
838
  borderBottom: a < n - 1 ? "1px solid #f1f5f9" : "none"
839
839
  },
840
840
  children: [
841
- /* @__PURE__ */ t(_.Avatar, { active: s, size: "default" }),
842
- /* @__PURE__ */ t(_, { active: s, paragraph: { rows: 1 }, title: { width: 120 }, style: { flex: 1 } })
841
+ /* @__PURE__ */ t(N.Avatar, { active: s, size: "default" }),
842
+ /* @__PURE__ */ t(N, { active: s, paragraph: { rows: 1 }, title: { width: 120 }, style: { flex: 1 } })
843
843
  ]
844
844
  },
845
845
  a
@@ -855,11 +855,11 @@ function gt({
855
855
  borderRadius: C.md,
856
856
  ...o
857
857
  },
858
- children: /* @__PURE__ */ t(_, { active: s, title: { width: "40%" }, paragraph: { rows: n } })
858
+ children: /* @__PURE__ */ t(N, { active: s, title: { width: "40%" }, paragraph: { rows: n } })
859
859
  }
860
860
  );
861
861
  }
862
- function We({
862
+ function Me({
863
863
  value: e,
864
864
  onChange: n,
865
865
  onSearch: s,
@@ -872,10 +872,10 @@ function We({
872
872
  enterButton: l,
873
873
  ...i
874
874
  }) {
875
- const [d, f] = z(e || ""), g = H(null), p = H(e || "");
876
- D(() => {
875
+ const [d, f] = B(e || ""), g = P(null), p = P(e || "");
876
+ L(() => {
877
877
  e !== void 0 && e !== d && (f(e || ""), p.current = e || "");
878
- }, [e]), D(() => () => {
878
+ }, [e]), L(() => () => {
879
879
  g.current && clearTimeout(g.current);
880
880
  }, []);
881
881
  const h = (S) => {
@@ -891,7 +891,7 @@ function We({
891
891
  g.current && clearTimeout(g.current), h(S), s && s(S);
892
892
  };
893
893
  return /* @__PURE__ */ t(
894
- Te,
894
+ Ee,
895
895
  {
896
896
  ...i,
897
897
  value: d,
@@ -904,7 +904,7 @@ function We({
904
904
  allowClear: r ? { clearIcon: /* @__PURE__ */ t("span", { onClick: () => {
905
905
  f(""), v("");
906
906
  }, children: "×" }) } : !1,
907
- prefix: /* @__PURE__ */ t(ze, { style: { color: "#9ca3af" } }),
907
+ prefix: /* @__PURE__ */ t(Be, { style: { color: "#9ca3af" } }),
908
908
  style: {
909
909
  width: a,
910
910
  borderRadius: C.md,
@@ -913,7 +913,7 @@ function We({
913
913
  }
914
914
  );
915
915
  }
916
- function Me(e, n, s) {
916
+ function He(e, n, s) {
917
917
  const o = Array.isArray(e) ? e : [], c = String(s ?? "").trim().toLowerCase();
918
918
  if (!c) return o;
919
919
  const a = (Array.isArray(n) ? n : String(n || "").split(",")).map((r) => String(r || "").trim()).filter(Boolean);
@@ -922,20 +922,20 @@ function Me(e, n, s) {
922
922
  return i == null ? !1 : String(i).toLowerCase().includes(c);
923
923
  })) : o;
924
924
  }
925
- function He(e, n) {
926
- const [s, o] = z(""), c = (Array.isArray(n) ? n.join(",") : String(n || "")).trim(), a = q(
927
- () => Me(e, c, s),
925
+ function Pe(e, n) {
926
+ const [s, o] = B(""), c = (Array.isArray(n) ? n.join(",") : String(n || "")).trim(), a = q(
927
+ () => He(e, c, s),
928
928
  [e, c, s]
929
- ), r = be(() => o(""), []);
929
+ ), r = me(() => o(""), []);
930
930
  return { keyword: s, setKeyword: o, filtered: a, reset: r };
931
931
  }
932
- const Ne = {
932
+ const _e = {
933
933
  pageSize: 10,
934
934
  showSizeChanger: !0,
935
935
  pageSizeOptions: ["10", "20", "50", "100"],
936
936
  showTotal: (e) => `共 ${e} 条`
937
937
  };
938
- function ut({
938
+ function pt({
939
939
  rows: e,
940
940
  columns: n,
941
941
  rowKey: s,
@@ -949,14 +949,13 @@ function ut({
949
949
  emptyDescription: f,
950
950
  emptyActionText: g,
951
951
  emptyOnAction: p,
952
- pagination: h = Ne,
952
+ pagination: h = _e,
953
953
  cardProps: k = {},
954
954
  tableProps: v = {},
955
955
  ...A
956
956
  }) {
957
- const { keyword: b, setKeyword: S, filtered: w } = He(e, c);
958
- return /* @__PURE__ */ t(me, { title: l, extra: (c ? /* @__PURE__ */ t(
959
- We,
957
+ const { keyword: b, setKeyword: S, filtered: w } = Pe(e, c), I = c ? /* @__PURE__ */ t(
958
+ Me,
960
959
  {
961
960
  allowClear: !0,
962
961
  width: r,
@@ -964,8 +963,12 @@ function ut({
964
963
  value: b,
965
964
  onChange: S
966
965
  }
967
- ) : null) || i, ...k, children: /* @__PURE__ */ t(
968
- ye,
966
+ ) : null;
967
+ return /* @__PURE__ */ t(ye, { title: l, extra: I && i ? /* @__PURE__ */ m("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [
968
+ I,
969
+ i
970
+ ] }) : I || i, ...k, children: /* @__PURE__ */ t(
971
+ xe,
969
972
  {
970
973
  rowKey: s,
971
974
  columns: n,
@@ -989,7 +992,7 @@ function ut({
989
992
  }
990
993
  ) });
991
994
  }
992
- function ve({
995
+ function Se({
993
996
  title: e,
994
997
  subtitle: n,
995
998
  breadcrumb: s,
@@ -997,7 +1000,7 @@ function ve({
997
1000
  back: c,
998
1001
  onBack: a
999
1002
  }) {
1000
- const r = xe();
1003
+ const r = ve();
1001
1004
  return /* @__PURE__ */ t("div", { style: {
1002
1005
  marginBottom: 12,
1003
1006
  paddingBottom: 10,
@@ -1048,7 +1051,7 @@ function ve({
1048
1051
  }
1049
1052
  ),
1050
1053
  s && s.length > 0 ? /* @__PURE__ */ t(
1051
- Ee,
1054
+ Ae,
1052
1055
  {
1053
1056
  items: s.map((i, d) => {
1054
1057
  const f = d === s.length - 1;
@@ -1085,7 +1088,7 @@ function ve({
1085
1088
  }, children: o })
1086
1089
  ] }) });
1087
1090
  }
1088
- function pt({ left: e, right: n, extra: s }) {
1091
+ function ht({ left: e, right: n, extra: s }) {
1089
1092
  return /* @__PURE__ */ m(
1090
1093
  "div",
1091
1094
  {
@@ -1107,57 +1110,64 @@ function pt({ left: e, right: n, extra: s }) {
1107
1110
  }
1108
1111
  );
1109
1112
  }
1110
- function ht({ onClick: e, loading: n, title: s = "刷新" }) {
1113
+ function bt({ onClick: e, loading: n, title: s = "刷新" }) {
1111
1114
  return /* @__PURE__ */ t(V, { icon: /* @__PURE__ */ t(re, {}), onClick: e, loading: n, title: s, children: s });
1112
1115
  }
1113
- const Pe = {
1116
+ const Ne = {
1114
1117
  0: { label: "待办", color: "default" },
1115
1118
  1: { label: "进行中", color: "blue" },
1116
1119
  2: { label: "已完成", color: "green" }
1117
- }, _e = {
1120
+ }, Oe = {
1118
1121
  ACTIVE: { label: "正常", color: "green" },
1119
1122
  INACTIVE: { label: "禁用", color: "red" },
1120
1123
  ENABLED: { label: "启用", color: "green" },
1121
1124
  DISABLED: { label: "禁用", color: "red" }
1122
- }, Oe = {
1125
+ }, Fe = {
1123
1126
  low: { label: "低", color: "default" },
1124
1127
  medium: { label: "中", color: "orange" },
1125
1128
  high: { label: "高", color: "red" },
1126
1129
  1: { label: "低", color: "default" },
1127
1130
  2: { label: "中", color: "orange" },
1128
1131
  3: { label: "高", color: "red" }
1129
- }, Fe = {
1132
+ }, je = {
1130
1133
  PENDING: { label: "待审批", color: "orange" },
1131
1134
  APPROVED: { label: "已通过", color: "green" },
1132
1135
  REJECTED: { label: "已拒绝", color: "red" },
1133
1136
  CANCELLED: { label: "已撤回", color: "default" }
1134
- }, je = {
1137
+ }, qe = {
1135
1138
  RUNNING: { label: "运行中", color: "green" },
1136
1139
  PAUSED: { label: "已暂停", color: "orange" },
1137
1140
  STOPPED: { label: "已停止", color: "default" },
1138
1141
  FAILED: { label: "失败", color: "red" },
1139
1142
  SUCCESS: { label: "成功", color: "green" }
1140
- }, qe = {
1141
- task: Pe,
1142
- model: _e,
1143
- priority: Oe,
1144
- approval: Fe,
1145
- schedule: je
1143
+ }, Ge = {
1144
+ task: Ne,
1145
+ model: Oe,
1146
+ priority: Fe,
1147
+ approval: je,
1148
+ schedule: qe
1146
1149
  };
1147
- function bt({ status: e, type: n = "task", mapping: s, ...o }) {
1148
- const a = (s || qe[n] || {})[e];
1150
+ function mt({ status: e, type: n = "task", mapping: s, ...o }) {
1151
+ const a = (s || Ge[n] || {})[e];
1149
1152
  return a ? /* @__PURE__ */ t(ce, { color: a.color, ...o, children: a.label }) : /* @__PURE__ */ t(ce, { ...o, children: String(e) });
1150
1153
  }
1151
- function mt({ title: e, description: n, load: s, columns: o, rowKey: c = "id", extra: a, expandable: r }) {
1152
- const [l, i] = z([]), [d, f] = z({ current: 1, size: 10, total: null }), [g, p] = z(!1), [h, k] = z(null), v = be(async (b = d.current, S = d.size) => {
1154
+ const fe = {
1155
+ // total 有效 ⇒ 标准口径
1156
+ known: (e) => `共 ${e} 条`,
1157
+ // total 缺失/为 0 —— 后端 z-meta 的分页 count 有缺陷(records 有值但 total 返回 "0"),
1158
+ // 这时不能显示「共 0 条」(页面上会出现"有数据却说没有数据"的假象)
1159
+ unknown: (e) => `本页 ${e} 条(接口 total 未返回有效值)`
1160
+ };
1161
+ function yt({ title: e, description: n, load: s, columns: o, rowKey: c = "id", extra: a, expandable: r }) {
1162
+ const [l, i] = B([]), [d, f] = B({ current: 1, size: 10, total: null }), [g, p] = B(!1), [h, k] = B(null), v = me(async (b = d.current, S = d.size) => {
1153
1163
  p(!0), k(null);
1154
1164
  try {
1155
1165
  const w = await s(b, S);
1156
1166
  if (Array.isArray(w))
1157
1167
  i(w || []), f({ current: b, size: S, total: w.length });
1158
1168
  else {
1159
- const L = (w == null ? void 0 : w.records) || [];
1160
- i(L), f({ current: b, size: S, total: (w == null ? void 0 : w.total) == null ? null : Number(w.total) });
1169
+ const I = (w == null ? void 0 : w.records) || [];
1170
+ i(I), f({ current: b, size: S, total: (w == null ? void 0 : w.total) == null ? null : Number(w.total) });
1161
1171
  }
1162
1172
  } catch (w) {
1163
1173
  i([]), k(w);
@@ -1165,14 +1175,14 @@ function mt({ title: e, description: n, load: s, columns: o, rowKey: c = "id", e
1165
1175
  p(!1);
1166
1176
  }
1167
1177
  }, [s, d.current, d.size]);
1168
- D(() => {
1178
+ L(() => {
1169
1179
  v(1);
1170
1180
  }, []);
1171
1181
  const A = d.total != null && d.total > 0;
1172
1182
  return /* @__PURE__ */ m("div", { children: [
1173
- /* @__PURE__ */ t(ve, { title: e, subtitle: n }),
1183
+ /* @__PURE__ */ t(Se, { title: e, subtitle: n }),
1174
1184
  /* @__PURE__ */ m(
1175
- me,
1185
+ ye,
1176
1186
  {
1177
1187
  extra: /* @__PURE__ */ t(
1178
1188
  V,
@@ -1185,8 +1195,8 @@ function mt({ title: e, description: n, load: s, columns: o, rowKey: c = "id", e
1185
1195
  ),
1186
1196
  children: [
1187
1197
  a,
1188
- h ? /* @__PURE__ */ t($e, { error: h, onRetry: () => v(d.current, d.size), type: "inline" }) : /* @__PURE__ */ t(
1189
- ye,
1198
+ h ? /* @__PURE__ */ t(We, { error: h, onRetry: () => v(d.current, d.size), type: "inline" }) : /* @__PURE__ */ t(
1199
+ xe,
1190
1200
  {
1191
1201
  size: "small",
1192
1202
  columns: o,
@@ -1198,7 +1208,15 @@ function mt({ title: e, description: n, load: s, columns: o, rowKey: c = "id", e
1198
1208
  pageSize: d.size,
1199
1209
  total: A ? d.total : l.length,
1200
1210
  showSizeChanger: !0,
1201
- showTotal: () => A ? `共 ${d.total} 条` : `本页 ${l.length} 条(接口 total 未返回有效值)`
1211
+ // §2 强制规则 2:分页必须凑齐 pageSize + showSizeChanger
1212
+ // + pageSizeOptions + showTotal 四件套。只给 showSizeChanger
1213
+ // 而不给 pageSizeOptions,antd 会用默认的 ['10','20','50','100']
1214
+ // 之外的行为渲染(实际 antd 默认也是这组,但那是**默认值**不是
1215
+ // **声明值**)—— 规范要的是声明,不是碰巧对。
1216
+ // 少这一项时,全库尺子(lead 008 §2 元素级普查)会把本页判成
1217
+ // 「分页参数不全」⇒ 8 个仓的 PagedTable 拷贝全部误红。
1218
+ pageSizeOptions: ["10", "20", "50", "100"],
1219
+ showTotal: () => A ? fe.known(d.total) : fe.unknown(l.length)
1202
1220
  },
1203
1221
  onChange: (b) => v(b.current, b.pageSize),
1204
1222
  expandable: r,
@@ -1210,19 +1228,19 @@ function mt({ title: e, description: n, load: s, columns: o, rowKey: c = "id", e
1210
1228
  )
1211
1229
  ] });
1212
1230
  }
1213
- const Ge = 240, fe = 96, Ue = { behavior: "smooth", block: "start" }, Ye = `
1231
+ const Ue = 240, ge = 96, Ye = { behavior: "smooth", block: "start" }, Ke = `
1214
1232
  .zfc-doc-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
1215
1233
  @media (max-width: 800px) { .zfc-doc-table-wrap > table { min-width: 520px; } }
1216
- `, Ke = (e) => String(e || "").trim().toLowerCase().replace(/\s+/g, "-").replace(/[^\p{L}\p{N}\p{M}\p{Pc}-]/gu, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), ie = (e) => String(e || "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/`([^`]*)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/__([^_]+)__/g, "$1").replace(/\*([^*]+)\*/g, "$1").trim(), Se = () => {
1234
+ `, Ve = (e) => String(e || "").trim().toLowerCase().replace(/\s+/g, "-").replace(/[^\p{L}\p{N}\p{M}\p{Pc}-]/gu, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), ie = (e) => String(e || "").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/`([^`]*)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/__([^_]+)__/g, "$1").replace(/\*([^*]+)\*/g, "$1").trim(), we = () => {
1217
1235
  const e = /* @__PURE__ */ new Map();
1218
1236
  let n = 0;
1219
1237
  return (s) => {
1220
1238
  n += 1;
1221
- const o = Ke(s) || `section-${n}`, c = e.get(o) || 0;
1239
+ const o = Ve(s) || `section-${n}`, c = e.get(o) || 0;
1222
1240
  return e.set(o, c + 1), c > 0 ? `${o}-${c}` : o;
1223
1241
  };
1224
- }, Ve = (e) => {
1225
- const n = [], s = Se();
1242
+ }, Je = (e) => {
1243
+ const n = [], s = we();
1226
1244
  let o = !1;
1227
1245
  for (const c of String(e || "").split(`
1228
1246
  `)) {
@@ -1240,17 +1258,17 @@ const Ge = 240, fe = 96, Ue = { behavior: "smooth", block: "start" }, Ye = `
1240
1258
  i && n.push({ level: l, text: i, id: s(i) });
1241
1259
  }
1242
1260
  return n;
1243
- }, X = (e) => e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(X).join("") : e.props ? X(e.props.children) : "", ge = (e) => String(e).replace(/["\\]/g, "\\$&"), ue = (e, n = Ue) => !e || typeof e.scrollIntoView != "function" ? !1 : (e.scrollIntoView(n), !0), Z = /^\s*(`{3,}|~{3,})\s*([\w+#-]*)\s*$/, ee = /^(#{1,6})\s+(.*?)\s*#*$/, te = /^\s*([-*_])\s*(\1\s*){2,}$/, F = /^(\s*)([-*+]|\d+[.)])(\s+)(.*)$/, Y = /^\s*>\s?(.*)$/, Je = /(!?\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)|`([^`]+)`|\*\*([^*]+)\*\*|__([^_]+)__|~~([^~]+)~~|\*([^*\n]+)\*|<((?:https?:\/\/|mailto:)[^>\s]+)>)/g, K = (e) => {
1261
+ }, Q = (e) => e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(Q).join("") : e.props ? Q(e.props.children) : "", ue = (e) => String(e).replace(/["\\]/g, "\\$&"), pe = (e, n = Ye) => !e || typeof e.scrollIntoView != "function" ? !1 : (e.scrollIntoView(n), !0), Z = /^\s*(`{3,}|~{3,})\s*([\w+#-]*)\s*$/, ee = /^(#{1,6})\s+(.*?)\s*#*$/, te = /^\s*([-*_])\s*(\1\s*){2,}$/, F = /^(\s*)([-*+]|\d+[.)])(\s+)(.*)$/, Y = /^\s*>\s?(.*)$/, Xe = /(!?\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)|`([^`]+)`|\*\*([^*]+)\*\*|__([^_]+)__|~~([^~]+)~~|\*([^*\n]+)\*|<((?:https?:\/\/|mailto:)[^>\s]+)>)/g, K = (e) => {
1244
1262
  let n = String(e).trim();
1245
1263
  return n.startsWith("|") && (n = n.slice(1)), n.endsWith("|") && (n = n.slice(0, -1)), n.split("|").map((s) => s.trim());
1246
1264
  }, Qe = (e) => {
1247
1265
  if (!String(e).includes("-")) return !1;
1248
1266
  const n = K(e);
1249
1267
  return n.length > 0 && n.every((s) => /^:?-+:?$/.test(s));
1250
- }, Xe = (e) => {
1268
+ }, Ze = (e) => {
1251
1269
  const n = e.startsWith(":"), s = e.endsWith(":");
1252
1270
  return n && s ? "center" : s ? "right" : "left";
1253
- }, Ze = (e, n) => {
1271
+ }, et = (e, n) => {
1254
1272
  const s = F.exec(e[n]), o = /\d/.test(s[2]), c = [];
1255
1273
  let a = n;
1256
1274
  for (; a < e.length; ) {
@@ -1285,11 +1303,11 @@ const Ge = 240, fe = 96, Ue = { behavior: "smooth", block: "start" }, Ye = `
1285
1303
  }
1286
1304
  break;
1287
1305
  }
1288
- c.push({ blocks: we(d, !0) });
1306
+ c.push({ blocks: ke(d, !0) });
1289
1307
  }
1290
1308
  return { block: { type: "list", ordered: o, items: c }, next: a };
1291
1309
  };
1292
- function we(e, n = !1) {
1310
+ function ke(e, n = !1) {
1293
1311
  const s = [];
1294
1312
  let o = 0;
1295
1313
  for (; o < e.length; ) {
@@ -1324,7 +1342,7 @@ function we(e, n = !1) {
1324
1342
  continue;
1325
1343
  }
1326
1344
  if (c.includes("|") && o + 1 < e.length && Qe(e[o + 1])) {
1327
- const i = K(c), d = K(e[o + 1]).map(Xe);
1345
+ const i = K(c), d = K(e[o + 1]).map(Ze);
1328
1346
  o += 2;
1329
1347
  const f = [];
1330
1348
  for (; o < e.length && e[o].trim() && e[o].includes("|"); )
@@ -1343,7 +1361,7 @@ function we(e, n = !1) {
1343
1361
  continue;
1344
1362
  }
1345
1363
  if (F.test(c)) {
1346
- const i = Ze(e, o);
1364
+ const i = et(e, o);
1347
1365
  s.push(i.block), o = i.next;
1348
1366
  continue;
1349
1367
  }
@@ -1357,62 +1375,62 @@ function we(e, n = !1) {
1357
1375
  }
1358
1376
  return s;
1359
1377
  }
1360
- const I = (e, n) => {
1378
+ const z = (e, n) => {
1361
1379
  const s = [];
1362
1380
  let o = 0, c = 0;
1363
1381
  const a = (r) => s.push(/* @__PURE__ */ t(O, { children: r }, `i${c++}`));
1364
- for (const r of e.matchAll(Je)) {
1382
+ for (const r of e.matchAll(Xe)) {
1365
1383
  if (r.index > o && a(e.slice(o, r.index)), r[1] !== void 0)
1366
1384
  if (r[0].startsWith("!"))
1367
1385
  a(n.img ? n.img({ src: r[3], alt: r[2] }) : /* @__PURE__ */ t("img", { src: r[3], alt: r[2] || "" }));
1368
1386
  else {
1369
- const l = I(r[2], n);
1387
+ const l = z(r[2], n);
1370
1388
  a(n.a ? n.a({ href: r[3], children: l }) : /* @__PURE__ */ t("a", { href: r[3], children: l }));
1371
1389
  }
1372
- else r[4] !== void 0 ? a(n.code ? n.code({ children: r[4] }) : /* @__PURE__ */ t("code", { children: r[4] })) : r[5] !== void 0 ? a(/* @__PURE__ */ t("strong", { children: I(r[5], n) })) : r[6] !== void 0 ? a(/* @__PURE__ */ t("strong", { children: I(r[6], n) })) : r[7] !== void 0 ? a(/* @__PURE__ */ t("del", { children: I(r[7], n) })) : r[8] !== void 0 ? a(/* @__PURE__ */ t("em", { children: I(r[8], n) })) : r[9] !== void 0 && a(n.a ? n.a({ href: r[9], children: r[9] }) : /* @__PURE__ */ t("a", { href: r[9], children: r[9] }));
1390
+ else r[4] !== void 0 ? a(n.code ? n.code({ children: r[4] }) : /* @__PURE__ */ t("code", { children: r[4] })) : r[5] !== void 0 ? a(/* @__PURE__ */ t("strong", { children: z(r[5], n) })) : r[6] !== void 0 ? a(/* @__PURE__ */ t("strong", { children: z(r[6], n) })) : r[7] !== void 0 ? a(/* @__PURE__ */ t("del", { children: z(r[7], n) })) : r[8] !== void 0 ? a(/* @__PURE__ */ t("em", { children: z(r[8], n) })) : r[9] !== void 0 && a(n.a ? n.a({ href: r[9], children: r[9] }) : /* @__PURE__ */ t("a", { href: r[9], children: r[9] }));
1373
1391
  o = r.index + r[0].length;
1374
1392
  }
1375
1393
  return o < e.length && a(e.slice(o)), s;
1376
- }, ke = (e, n, s) => {
1394
+ }, Ce = (e, n, s) => {
1377
1395
  const o = [];
1378
1396
  return e.forEach((c, a) => {
1379
1397
  const r = `b${a}`, l = (i) => o.push(/* @__PURE__ */ t(O, { children: i }, r));
1380
1398
  if (c.type === "heading") {
1381
- const i = Math.min(c.level, 6), d = `h${i}`, f = n[d], g = I(c.text, n), p = i <= 3 ? s(ie(c.text)) : void 0;
1399
+ const i = Math.min(c.level, 6), d = `h${i}`, f = n[d], g = z(c.text, n), p = i <= 3 ? s(ie(c.text)) : void 0;
1382
1400
  l(f ? f({ children: g, id: p }) : ae(d, { id: p }, g));
1383
1401
  } else if (c.type === "paragraph") {
1384
- const i = I(c.text, n);
1402
+ const i = z(c.text, n);
1385
1403
  l(n.p ? n.p({ children: i }) : /* @__PURE__ */ t("p", { children: i }));
1386
1404
  } else if (c.type === "code") {
1387
1405
  const i = /* @__PURE__ */ t("code", { className: c.lang ? `language-${c.lang}` : void 0, children: c.text });
1388
1406
  l(n.pre ? n.pre({ children: i }) : /* @__PURE__ */ t("pre", { children: i }));
1389
1407
  } else if (c.type === "list") {
1390
1408
  const i = c.ordered ? "ol" : "ul", d = n[i], f = c.items.map((g, p) => {
1391
- const h = ke(g.blocks, n, s), k = n.li ? n.li({ children: h }) : /* @__PURE__ */ t("li", { children: h });
1409
+ const h = Ce(g.blocks, n, s), k = n.li ? n.li({ children: h }) : /* @__PURE__ */ t("li", { children: h });
1392
1410
  return /* @__PURE__ */ t(O, { children: k }, `li${p}`);
1393
1411
  });
1394
1412
  l(d ? d({ children: f }) : ae(i, null, f));
1395
1413
  } else if (c.type === "table") {
1396
1414
  const i = /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { children: c.header.map((g, p) => {
1397
- const h = n.th ? n.th({ children: I(g, n), align: c.aligns[p] }) : /* @__PURE__ */ t("th", { children: g });
1415
+ const h = n.th ? n.th({ children: z(g, n), align: c.aligns[p] }) : /* @__PURE__ */ t("th", { children: g });
1398
1416
  return /* @__PURE__ */ t(O, { children: h }, `th${p}`);
1399
1417
  }) }) }, "thead"), d = /* @__PURE__ */ t("tbody", { children: c.rows.map((g, p) => /* @__PURE__ */ t("tr", { children: g.map((h, k) => {
1400
- const v = n.td ? n.td({ children: I(h, n), align: c.aligns[k] }) : /* @__PURE__ */ t("td", { children: h });
1418
+ const v = n.td ? n.td({ children: z(h, n), align: c.aligns[k] }) : /* @__PURE__ */ t("td", { children: h });
1401
1419
  return /* @__PURE__ */ t(O, { children: v }, `td${k}`);
1402
1420
  }) }, `tr${p}`)) }, "tbody"), f = n.table ? n.table({ children: [i, d] }) : /* @__PURE__ */ t("table", { children: [i, d] });
1403
1421
  l(f);
1404
1422
  } else if (c.type === "quote") {
1405
1423
  const i = c.lines.filter((d) => d.trim()).map((d, f) => {
1406
- const g = n.p ? n.p({ children: I(d, n) }) : /* @__PURE__ */ t("p", { children: d });
1424
+ const g = n.p ? n.p({ children: z(d, n) }) : /* @__PURE__ */ t("p", { children: d });
1407
1425
  return /* @__PURE__ */ t(O, { children: g }, `q${f}`);
1408
1426
  });
1409
1427
  l(n.blockquote ? n.blockquote({ children: i }) : /* @__PURE__ */ t("blockquote", { children: i }));
1410
1428
  } else c.type === "hr" && l(n.hr ? n.hr({}) : /* @__PURE__ */ t("hr", {}));
1411
1429
  }), o;
1412
- }, et = (e, n = {}) => ke(we(String(e || "").split(`
1413
- `)), n, Se());
1414
- let pe = null;
1415
- const he = /* @__PURE__ */ new Set(), tt = ({ navigate: e, Prism: n, oneDark: s, onAnchorClick: o }) => {
1430
+ }, tt = (e, n = {}) => Ce(ke(String(e || "").split(`
1431
+ `)), n, we());
1432
+ let he = null;
1433
+ const be = /* @__PURE__ */ new Set(), rt = ({ navigate: e, Prism: n, oneDark: s, onAnchorClick: o }) => {
1416
1434
  const c = {
1417
1435
  background: T.primarySoft,
1418
1436
  color: T.primary,
@@ -1451,7 +1469,7 @@ const he = /* @__PURE__ */ new Set(), tt = ({ navigate: e, Prism: n, oneDark: s,
1451
1469
  blockquote: ({ node: a, children: r, ...l }) => /* @__PURE__ */ t("blockquote", { ...l, style: {
1452
1470
  margin: "12px 0",
1453
1471
  padding: "8px 14px",
1454
- borderLeft: `3px solid ${M.token.colorPrimary}`,
1472
+ borderLeft: `3px solid ${H.token.colorPrimary}`,
1455
1473
  background: T.primarySoft,
1456
1474
  color: "#475569",
1457
1475
  borderRadius: 4
@@ -1479,7 +1497,7 @@ const he = /* @__PURE__ */ new Set(), tt = ({ navigate: e, Prism: n, oneDark: s,
1479
1497
  pre: ({ node: a, children: r }) => {
1480
1498
  const l = Array.isArray(r) ? r[0] : r;
1481
1499
  l && l.props && l.props.className;
1482
- const i = X(l).replace(/\n$/, "");
1500
+ const i = Q(l).replace(/\n$/, "");
1483
1501
  return /* @__PURE__ */ t("pre", { style: {
1484
1502
  margin: "12px 0",
1485
1503
  padding: "12px 14px",
@@ -1500,7 +1518,7 @@ const he = /* @__PURE__ */ new Set(), tt = ({ navigate: e, Prism: n, oneDark: s,
1500
1518
  href: d,
1501
1519
  target: "_blank",
1502
1520
  rel: "noopener noreferrer",
1503
- style: { color: M.token.colorPrimary },
1521
+ style: { color: H.token.colorPrimary },
1504
1522
  children: l
1505
1523
  }
1506
1524
  ) : d.startsWith("#") ? /* @__PURE__ */ t(
@@ -1508,7 +1526,7 @@ const he = /* @__PURE__ */ new Set(), tt = ({ navigate: e, Prism: n, oneDark: s,
1508
1526
  {
1509
1527
  ...i,
1510
1528
  href: d,
1511
- style: { color: M.token.colorPrimary },
1529
+ style: { color: H.token.colorPrimary },
1512
1530
  onClick: (g) => o(g, d.slice(1)),
1513
1531
  children: l
1514
1532
  }
@@ -1517,33 +1535,33 @@ const he = /* @__PURE__ */ new Set(), tt = ({ navigate: e, Prism: n, oneDark: s,
1517
1535
  {
1518
1536
  ...i,
1519
1537
  href: d,
1520
- style: { color: M.token.colorPrimary },
1538
+ style: { color: H.token.colorPrimary },
1521
1539
  onClick: (g) => {
1522
1540
  g.preventDefault(), e ? e(d) : typeof window < "u" && (window.location.href = d);
1523
1541
  },
1524
1542
  children: l
1525
1543
  }
1526
- ) : /* @__PURE__ */ t("a", { ...i, href: d, style: { color: M.token.colorPrimary }, children: l });
1544
+ ) : /* @__PURE__ */ t("a", { ...i, href: d, style: { color: H.token.colorPrimary }, children: l });
1527
1545
  }
1528
1546
  };
1529
1547
  };
1530
- function yt({
1548
+ function xt({
1531
1549
  markdown: e,
1532
1550
  title: n,
1533
- tocWidth: s = Ge,
1551
+ tocWidth: s = Ue,
1534
1552
  tocLevels: o = [2],
1535
1553
  height: c = "calc(100vh - 120px)",
1536
1554
  markdownComponents: a,
1537
1555
  renderMarkdown: r
1538
1556
  }) {
1539
- const i = De() ? xe() : null, d = H(null), f = H(null), g = H(""), p = H(null), [h, k] = z(""), [v, A] = z(0), b = q(() => Ve(e), [e]), S = q(
1557
+ const i = Le() ? ve() : null, d = P(null), f = P(null), g = P(""), p = P(null), [h, k] = B(""), [v, A] = B(0), b = q(() => Je(e), [e]), S = q(
1540
1558
  () => b.filter((u) => o.includes(u.level)),
1541
1559
  [b, o]
1542
1560
  );
1543
- D(() => {
1561
+ L(() => {
1544
1562
  const u = () => A((y) => y + 1);
1545
- return he.add(u), () => {
1546
- he.delete(u);
1563
+ return be.add(u), () => {
1564
+ be.delete(u);
1547
1565
  };
1548
1566
  }, []);
1549
1567
  const w = (u) => {
@@ -1551,60 +1569,60 @@ function yt({
1551
1569
  g.current = "";
1552
1570
  }, 700);
1553
1571
  };
1554
- D(() => () => {
1572
+ L(() => () => {
1555
1573
  p.current && clearTimeout(p.current);
1556
- }, []), Re(() => {
1574
+ }, []), Te(() => {
1557
1575
  const u = d.current;
1558
1576
  if (!u) return;
1559
1577
  const y = Array.from(u.querySelectorAll("h1, h2, h3"));
1560
- b.forEach((R, $) => {
1561
- const W = y[$];
1562
- W && (W.id !== R.id && (W.id = R.id), W.setAttribute("data-anchor", R.id));
1578
+ b.forEach((R, W) => {
1579
+ const M = y[W];
1580
+ M && (M.id !== R.id && (M.id = R.id), M.setAttribute("data-anchor", R.id));
1563
1581
  });
1564
- }, [b, v, r]), D(() => {
1582
+ }, [b, v, r]), L(() => {
1565
1583
  const u = d.current;
1566
1584
  if (!u) return;
1567
1585
  const y = Array.from(u.querySelectorAll("h1, h2, h3"));
1568
1586
  if (!y.length) return;
1569
1587
  const R = () => {
1570
- const Q = u.getBoundingClientRect().top;
1588
+ const X = u.getBoundingClientRect().top;
1571
1589
  let oe = y[0];
1572
1590
  for (const le of y)
1573
- if (le.getBoundingClientRect().top - Q <= fe) oe = le;
1591
+ if (le.getBoundingClientRect().top - X <= ge) oe = le;
1574
1592
  else break;
1575
1593
  g.current || k(oe.id);
1576
- }, $ = new IntersectionObserver(R, {
1594
+ }, W = new IntersectionObserver(R, {
1577
1595
  root: u,
1578
- rootMargin: `-${fe}px 0px 0px 0px`,
1596
+ rootMargin: `-${ge}px 0px 0px 0px`,
1579
1597
  threshold: 0
1580
1598
  });
1581
- y.forEach((Q) => $.observe(Q)), R();
1582
- const W = () => {
1599
+ y.forEach((X) => W.observe(X)), R();
1600
+ const M = () => {
1583
1601
  g.current = "";
1584
1602
  };
1585
- return u.addEventListener("scrollend", W), () => {
1586
- $.disconnect(), u.removeEventListener("scrollend", W);
1603
+ return u.addEventListener("scrollend", M), () => {
1604
+ W.disconnect(), u.removeEventListener("scrollend", M);
1587
1605
  };
1588
- }, [b, v, r]), D(() => {
1606
+ }, [b, v, r]), L(() => {
1589
1607
  const u = f.current;
1590
1608
  if (!u || !h) return;
1591
- const y = u.querySelector(`[data-toc-id="${ge(h)}"]`);
1609
+ const y = u.querySelector(`[data-toc-id="${ue(h)}"]`);
1592
1610
  if (!y) return;
1593
- const R = u.getBoundingClientRect(), $ = y.getBoundingClientRect();
1594
- ($.top < R.top + 24 || $.bottom > R.bottom - 24) && y.scrollIntoView({ block: "nearest", behavior: "smooth" });
1611
+ const R = u.getBoundingClientRect(), W = y.getBoundingClientRect();
1612
+ (W.top < R.top + 24 || W.bottom > R.bottom - 24) && y.scrollIntoView({ block: "nearest", behavior: "smooth" });
1595
1613
  }, [h]);
1596
- const L = (u) => {
1614
+ const I = (u) => {
1597
1615
  const y = d.current;
1598
- return y && y.querySelector(`[data-anchor="${ge(u)}"]`) || (typeof document < "u" ? document.getElementById(u) : null);
1599
- }, P = (u, y) => {
1600
- u.preventDefault(), w(y), ue(L(y)), k(y);
1616
+ return y && y.querySelector(`[data-anchor="${ue(u)}"]`) || (typeof document < "u" ? document.getElementById(u) : null);
1617
+ }, $ = (u, y) => {
1618
+ u.preventDefault(), w(y), pe(I(y)), k(y);
1601
1619
  }, G = (u, y) => {
1602
- u.preventDefault(), w(y), ue(L(y)), k(y);
1620
+ u.preventDefault(), w(y), pe(I(y)), k(y);
1603
1621
  }, U = q(
1604
- () => tt({
1622
+ () => rt({
1605
1623
  navigate: i,
1606
- Prism: pe,
1607
- oneDark: pe,
1624
+ Prism: he,
1625
+ oneDark: he,
1608
1626
  onAnchorClick: G
1609
1627
  }),
1610
1628
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1618,10 +1636,10 @@ function yt({
1618
1636
  title: "暂无文档",
1619
1637
  description: "把组件说明写成 DOC.md,用编译期 import 的字符串传给 ComponentDoc 即可"
1620
1638
  }
1621
- ) : r ? r({ markdown: e, components: j }) : /* @__PURE__ */ t(Ce, { children: et(e, j) });
1639
+ ) : r ? r({ markdown: e, components: j }) : /* @__PURE__ */ t(Re, { children: tt(e, j) });
1622
1640
  return /* @__PURE__ */ m("div", { style: { display: "flex", flexDirection: "column", minHeight: 0, flex: 1 }, children: [
1623
- /* @__PURE__ */ t("style", { children: Ye }),
1624
- n ? /* @__PURE__ */ t(ve, { title: n }) : null,
1641
+ /* @__PURE__ */ t("style", { children: Ke }),
1642
+ n ? /* @__PURE__ */ t(Se, { title: n }) : null,
1625
1643
  /* @__PURE__ */ m("div", { style: { display: "flex", gap: 16, alignItems: "flex-start", minHeight: 0 }, children: [
1626
1644
  /* @__PURE__ */ m(
1627
1645
  "aside",
@@ -1650,7 +1668,7 @@ function yt({
1650
1668
  marginBottom: 8,
1651
1669
  padding: "0 4px"
1652
1670
  }, children: [
1653
- /* @__PURE__ */ t(Be, {}),
1671
+ /* @__PURE__ */ t(De, {}),
1654
1672
  /* @__PURE__ */ t("span", { style: { fontWeight: 600 }, children: "本文目录" })
1655
1673
  ] }),
1656
1674
  /* @__PURE__ */ t("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: S.map((u) => {
@@ -1659,13 +1677,13 @@ function yt({
1659
1677
  "a",
1660
1678
  {
1661
1679
  href: "#" + u.id,
1662
- onClick: (R) => P(R, u.id),
1680
+ onClick: (R) => $(R, u.id),
1663
1681
  style: {
1664
1682
  display: "block",
1665
1683
  padding: "6px 10px",
1666
- borderLeft: `3px solid ${y ? M.token.colorPrimary : "transparent"}`,
1684
+ borderLeft: `3px solid ${y ? H.token.colorPrimary : "transparent"}`,
1667
1685
  background: y ? T.primarySoft : "transparent",
1668
- color: y ? M.token.colorPrimary : "#475569",
1686
+ color: y ? H.token.colorPrimary : "#475569",
1669
1687
  fontWeight: y ? 600 : 400,
1670
1688
  fontSize: 13,
1671
1689
  lineHeight: 1.5,
@@ -1706,32 +1724,32 @@ function yt({
1706
1724
  ] });
1707
1725
  }
1708
1726
  export {
1709
- Le as C,
1710
- Ne as D,
1727
+ $e as C,
1728
+ _e as D,
1711
1729
  ne as E,
1712
- dt as F,
1713
- st as G,
1714
- ut as L,
1715
- ve as P,
1716
- ht as R,
1717
- We as S,
1718
- pt as T,
1719
- yt as a,
1720
- ft as b,
1721
- $e as c,
1722
- gt as d,
1723
- mt as e,
1724
- ct as f,
1725
- bt as g,
1726
- M as h,
1730
+ ft as F,
1731
+ ct as G,
1732
+ pt as L,
1733
+ Se as P,
1734
+ bt as R,
1735
+ Me as S,
1736
+ ht as T,
1737
+ xt as a,
1738
+ gt as b,
1739
+ We as c,
1740
+ ut as d,
1741
+ yt as e,
1742
+ dt as f,
1743
+ mt as g,
1744
+ H as h,
1727
1745
  T as i,
1728
- Me as j,
1746
+ He as j,
1729
1747
  de as k,
1730
- at as l,
1731
- N as m,
1748
+ st as l,
1749
+ _ as m,
1732
1750
  x as n,
1733
1751
  E as p,
1734
1752
  C as r,
1735
- B as s,
1736
- He as u
1753
+ D as s,
1754
+ Pe as u
1737
1755
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as be, a as we, D as Ie, b as ke, E as Ce, c as Re, F as ve, G as Le, L as ze, d as Me, P as Be, e as Oe, R as Te, S as je, f as Ee, g as $e, T as De, h as Ke, i as Fe, j as Pe, k as qe, l as He, n as Ne, p as We, r as Ge, s as Je, m as _e, u as Ae } from "./ComponentDoc-CJL2TB6b.js";
1
+ import { C as be, a as we, D as Ie, b as ke, E as Ce, c as Re, F as ve, G as Le, L as ze, d as Me, P as Be, e as Oe, R as Te, S as je, f as Ee, g as $e, T as De, h as Ke, i as Fe, j as Pe, k as qe, l as He, n as Ne, p as We, r as Ge, s as Je, m as _e, u as Ae } from "./ComponentDoc-rk9VdFSV.js";
2
2
  import { jsxs as h, jsx as r } from "react/jsx-runtime";
3
3
  import { Layout as I, Spin as j, Menu as E, Dropdown as $, Avatar as D, Button as k, Tooltip as K, Card as F, Alert as P, Form as x, Input as L, message as S, Tag as q, Result as H } from "antd";
4
4
  import { MenuUnfoldOutlined as N, MenuFoldOutlined as W, DownOutlined as G, LoginOutlined as J, UserOutlined as _, LockOutlined as A } from "@ant-design/icons";
package/dist/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as e, a as t, D as r, b as o, E as n, c as d, F as i, G as l, L as S, d as u, P as T, e as p, R as b, S as f, f as g, g as c, T as h, h as m, i as C, j as D, k as L, l as E, n as F, p as P, r as A, s as B, m as G, u as I } from "./ComponentDoc-CJL2TB6b.js";
1
+ import { C as e, a as t, D as r, b as o, E as n, c as d, F as i, G as l, L as S, d as u, P as T, e as p, R as b, S as f, f as g, g as c, T as h, h as m, i as C, j as D, k as L, l as E, n as F, p as P, r as A, s as B, m as G, u as I } from "./ComponentDoc-rk9VdFSV.js";
2
2
  export {
3
3
  e as CategoryDot,
4
4
  t as ComponentDoc,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuku123/z-frontend-common",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "z-opc 全仓共享前端基座 — AppLayout(§1/§11/§12/§15/§16) + LoginPage(mockAuth 双模式) + EmptyState/StatusTag/ErrorBoundary + createRequest 工厂。lead 008 前端开发规范唯一承载仓",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,6 +21,8 @@ import useListFilter from './useListFilter'
21
21
  *
22
22
  * 透传约定:
23
23
  * - `cardProps` → 传给外层 `<Card>`(如 `style` / `size` / `title`)
24
+ * - `cardExtra` → 传给外层 `<Card>` 的 `extra`(动作按钮)。若同时给了 `searchKeys`,
25
+ * 过滤框与 extra **并排**渲染,不会二选一吞掉另一个。
24
26
  * - `tableProps` → 传给内层 `<Table>`(如 `scroll` / `columns` 之外的表级属性)
25
27
  * - 其余 props → 直接给 `<Table>`(与 antd 一致)
26
28
  * - `pagination={false}` 仍然允许显式传(用于「数据已知 ≤10 行且不变」的豁免场景,
@@ -67,8 +69,19 @@ export default function ListTable({
67
69
  )
68
70
  : null
69
71
 
72
+ // Card 的 extra 可以同时挂「过滤框」和「动作按钮」(例如「关系」表既有搜索又有「新增」)。
73
+ // 二选一会把其中一个静默吞掉,所以这里两个都有就并排渲染。
74
+ const extra = (search && cardExtra)
75
+ ? (
76
+ <span style={{display: 'inline-flex', alignItems: 'center', gap: 8}}>
77
+ {search}
78
+ {cardExtra}
79
+ </span>
80
+ )
81
+ : (search || cardExtra)
82
+
70
83
  return (
71
- <Card title={cardTitle} extra={search || cardExtra} {...cardProps}>
84
+ <Card title={cardTitle} extra={extra} {...cardProps}>
72
85
  <Table
73
86
  rowKey={rowKey}
74
87
  columns={columns}
@@ -10,6 +10,22 @@ import {EmptyState, ErrorState, PageHeader} from './index'
10
10
  * 后端 z-meta 的分页 count 有缺陷(records 有值但 total 返回 "0"),这里不把 0 当"共 0 条"显示,
11
11
  * 而是显式标出接口给的总数,避免页面上出现"有数据却说没有数据"的假象。
12
12
  */
13
+ /**
14
+ * 分页总数文案 —— 提成导出是为了让它**可单测**。
15
+ *
16
+ * 为什么必须提成导出:antd 的 Table 在**数据为空**时不渲染整个分页块
17
+ * (实测 SSR 空数据产物里连 `ant-pagination` 容器都没有)⇒
18
+ * `showTotal` 那个闭包在 SSR 下**永远不会被执行**,任何针对文案本身的断言都无从下手。
19
+ * 提成纯函数后,文案口径就能被直接测到,而不用去构造「有数据」的场景。
20
+ */
21
+ export const PAGED_TOTAL_TEXT = {
22
+ // total 有效 ⇒ 标准口径
23
+ known: (total) => `共 ${total} 条`,
24
+ // total 缺失/为 0 —— 后端 z-meta 的分页 count 有缺陷(records 有值但 total 返回 "0"),
25
+ // 这时不能显示「共 0 条」(页面上会出现"有数据却说没有数据"的假象)
26
+ unknown: (rowsLength) => `本页 ${rowsLength} 条(接口 total 未返回有效值)`,
27
+ }
28
+
13
29
  export default function PagedTable({title, description, load, columns, rowKey = 'id', extra, expandable}) {
14
30
  const [rows, setRows] = useState([])
15
31
  const [page, setPage] = useState({current: 1, size: 10, total: null})
@@ -67,10 +83,18 @@ export default function PagedTable({title, description, load, columns, rowKey =
67
83
  pageSize: page.size,
68
84
  total: totalKnown ? page.total : rows.length,
69
85
  showSizeChanger: true,
86
+ // §2 强制规则 2:分页必须凑齐 pageSize + showSizeChanger
87
+ // + pageSizeOptions + showTotal 四件套。只给 showSizeChanger
88
+ // 而不给 pageSizeOptions,antd 会用默认的 ['10','20','50','100']
89
+ // 之外的行为渲染(实际 antd 默认也是这组,但那是**默认值**不是
90
+ // **声明值**)—— 规范要的是声明,不是碰巧对。
91
+ // 少这一项时,全库尺子(lead 008 §2 元素级普查)会把本页判成
92
+ // 「分页参数不全」⇒ 8 个仓的 PagedTable 拷贝全部误红。
93
+ pageSizeOptions: ['10', '20', '50', '100'],
70
94
  showTotal: () =>
71
95
  totalKnown
72
- ? `共 ${page.total} 条`
73
- : `本页 ${rows.length} 条(接口 total 未返回有效值)`,
96
+ ? PAGED_TOTAL_TEXT.known(page.total)
97
+ : PAGED_TOTAL_TEXT.unknown(rows.length),
74
98
  }}
75
99
  onChange={(p) => fetch(p.current, p.pageSize)}
76
100
  expandable={expandable}