@yuku123/z-frontend-common 1.1.0 → 1.1.2

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.
@@ -1,1211 +0,0 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
- import { useState as R, useRef as D, useEffect as B, useCallback as K } from "react";
3
- import { Button as W, Skeleton as I, Input as $, Breadcrumb as _, Space as P, Tag as N, Card as q, Table as J } from "antd";
4
- import { InboxOutlined as Q, ExclamationCircleOutlined as X, ReloadOutlined as M, SearchOutlined as Z } from "@ant-design/icons";
5
- import * as j from "echarts/core";
6
- import { LineChart as V, PieChart as ee, BarChart as te } from "echarts/charts";
7
- import { GridComponent as re, TooltipComponent as ne, LegendComponent as ie, TitleComponent as ae } from "echarts/components";
8
- import { CanvasRenderer as oe } from "echarts/renderers";
9
- import { useNavigate as le } from "react-router-dom";
10
- const T = {
11
- // 主色 (蓝紫) - 顶导/重点按钮/链接
12
- primary: "#7c3aed",
13
- // violet-600
14
- primaryHover: "#8b5cf6",
15
- // violet-500
16
- primaryActive: "#6d28d9",
17
- // violet-700
18
- primarySoft: "#ede9fe"
19
- // violet-100 (淡背景)
20
- }, w = {
21
- pink: {
22
- bg: "#ec4899",
23
- fg: "#ffffff",
24
- soft: "#fce7f3",
25
- gradient: "linear-gradient(135deg, #ec4899 0%, #be185d 100%)"
26
- },
27
- blue: {
28
- bg: "#3b82f6",
29
- fg: "#ffffff",
30
- soft: "#dbeafe",
31
- gradient: "linear-gradient(135deg, #3b82f6 0%, #1e40af 100%)"
32
- },
33
- green: {
34
- bg: "#10b981",
35
- fg: "#ffffff",
36
- soft: "#d1fae5",
37
- gradient: "linear-gradient(135deg, #10b981 0%, #047857 100%)"
38
- },
39
- orange: {
40
- bg: "#f97316",
41
- fg: "#ffffff",
42
- soft: "#ffedd5",
43
- gradient: "linear-gradient(135deg, #f97316 0%, #c2410c 100%)"
44
- },
45
- violet: {
46
- bg: "#8b5cf6",
47
- fg: "#ffffff",
48
- soft: "#ede9fe",
49
- gradient: "linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%)"
50
- },
51
- cyan: {
52
- bg: "#06b6d4",
53
- fg: "#ffffff",
54
- soft: "#cffafe",
55
- gradient: "linear-gradient(135deg, #06b6d4 0%, #0e7490 100%)"
56
- },
57
- red: {
58
- bg: "#ef4444",
59
- fg: "#ffffff",
60
- soft: "#fee2e2",
61
- gradient: "linear-gradient(135deg, #ef4444 0%, #b91c1c 100%)"
62
- },
63
- yellow: {
64
- bg: "#eab308",
65
- fg: "#1f2937",
66
- soft: "#fef3c7",
67
- gradient: "linear-gradient(135deg, #eab308 0%, #a16207 100%)"
68
- }
69
- }, x = {
70
- bg: "#f8fafc",
71
- // 页面底色 (比 antd 默认 #f5f5f5 更冷一点, 更现代)
72
- surface: "#ffffff",
73
- // 卡片表面
74
- surfaceAlt: "#fafbfc",
75
- // 次级表面 (表格 hover 等)
76
- border: "#e5e7eb",
77
- // 默认边框 (比 antd 默认淡, 更现代)
78
- borderStrong: "#d1d5db",
79
- text: "#111827",
80
- // 主文本
81
- textMuted: "#6b7280",
82
- // 次文本
83
- textDisabled: "#9ca3af"
84
- }, y = {
85
- sm: 8,
86
- md: 12,
87
- lg: 16,
88
- xl: 20,
89
- pill: 999
90
- }, k = {
91
- sm: "0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.06)",
92
- md: "0 2px 4px -1px rgba(15, 23, 42, 0.04), 0 4px 8px -1px rgba(15, 23, 42, 0.08)",
93
- lg: "0 4px 6px -2px rgba(15, 23, 42, 0.05), 0 12px 16px -4px rgba(15, 23, 42, 0.10)",
94
- xl: "0 8px 24px -6px rgba(15, 23, 42, 0.10), 0 24px 48px -12px rgba(15, 23, 42, 0.18)"
95
- }, Re = {
96
- rest: k.md,
97
- hover: "0 8px 16px -4px rgba(15, 23, 42, 0.08), 0 20px 32px -8px rgba(15, 23, 42, 0.14)"
98
- }, z = {
99
- 1: 4,
100
- 2: 8,
101
- 3: 12,
102
- 4: 16,
103
- 5: 20,
104
- 6: 24,
105
- 8: 32,
106
- 10: 40,
107
- 12: 48,
108
- 16: 64
109
- }, F = {
110
- xs: 11,
111
- sm: 12,
112
- base: 14,
113
- md: 16,
114
- lg: 18,
115
- xl: 20,
116
- "2xl": 24,
117
- "3xl": 30,
118
- "4xl": 36
119
- }, ze = {
120
- token: {
121
- // 主色
122
- colorPrimary: T.primary,
123
- colorInfo: T.primary,
124
- colorSuccess: w.green.bg,
125
- colorWarning: w.orange.bg,
126
- colorError: w.red.bg,
127
- // 链接
128
- colorLink: T.primary,
129
- colorLinkHover: T.primaryHover,
130
- colorLinkActive: T.primaryActive,
131
- // 文本
132
- colorText: x.text,
133
- colorTextSecondary: x.textMuted,
134
- colorTextTertiary: x.textDisabled,
135
- // 背景
136
- colorBgBase: x.surface,
137
- colorBgLayout: x.bg,
138
- colorBgContainer: x.surface,
139
- colorBgElevated: x.surface,
140
- // 边框
141
- colorBorder: x.border,
142
- colorBorderSecondary: x.surfaceAlt,
143
- // 圆角
144
- borderRadius: y.md,
145
- borderRadiusLG: y.lg,
146
- borderRadiusSM: y.sm,
147
- // 字体
148
- fontSize: F.base,
149
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif",
150
- // 阴影
151
- boxShadow: k.md,
152
- boxShadowSecondary: k.lg
153
- },
154
- components: {
155
- // Layout: 顶导白底更现代
156
- Layout: {
157
- headerBg: x.surface,
158
- headerHeight: 64,
159
- headerPadding: "0 24px",
160
- siderBg: "#0f172a"
161
- // 深色侧栏 (slate-900), 比纯黑更有质感
162
- },
163
- // Menu: 深色侧栏菜单
164
- Menu: {
165
- darkItemBg: "transparent",
166
- darkSubMenuItemBg: "transparent",
167
- darkItemSelectedBg: T.primary,
168
- darkItemHoverBg: "rgba(255, 255, 255, 0.06)",
169
- darkItemColor: "rgba(255, 255, 255, 0.75)",
170
- itemBorderRadius: 8,
171
- itemMarginInline: 8
172
- },
173
- // Card: 更柔和
174
- Card: {
175
- borderRadiusLG: y.lg,
176
- boxShadowTertiary: k.sm
177
- },
178
- // Button: 主按钮圆角统一
179
- Button: {
180
- borderRadius: y.md,
181
- borderRadiusLG: y.lg,
182
- fontWeight: 500
183
- },
184
- // Tabs: 现代化下划线
185
- Tabs: {
186
- itemSelectedColor: T.primary,
187
- inkBarColor: T.primary,
188
- titleFontSize: F.base
189
- },
190
- // Tag: 更小巧
191
- Tag: {
192
- borderRadiusSM: 6
193
- }
194
- }
195
- };
196
- function Ee({
197
- icon: t,
198
- label: i,
199
- value: r,
200
- suffix: a,
201
- color: c = "blue",
202
- trend: n,
203
- href: l,
204
- loading: s = !1,
205
- precision: o = 0
206
- }) {
207
- const d = w[c] || w.blue, [b, u] = R(0), v = D(0);
208
- B(() => {
209
- if (s || r == null) return;
210
- const g = v.current, p = Number(r) || 0;
211
- if (g === p) {
212
- u(p);
213
- return;
214
- }
215
- const h = 600, A = performance.now();
216
- let L;
217
- const H = (G) => {
218
- const O = Math.min(1, (G - A) / h), U = 1 - Math.pow(1 - O, 3), Y = g + (p - g) * U;
219
- u(Y), O < 1 ? L = requestAnimationFrame(H) : v.current = p;
220
- };
221
- return L = requestAnimationFrame(H), () => L && cancelAnimationFrame(L);
222
- }, [r, s]);
223
- const S = () => {
224
- l && typeof window < "u" && (window.location.href = l);
225
- }, C = s ? "--" : Number(b).toLocaleString("zh-CN", {
226
- minimumFractionDigits: o,
227
- maximumFractionDigits: o
228
- }), m = n != null ? Number(n) : null, E = m != null && m >= 0;
229
- return /* @__PURE__ */ f(
230
- "div",
231
- {
232
- onClick: S,
233
- style: {
234
- position: "relative",
235
- background: d.gradient,
236
- borderRadius: y.lg,
237
- padding: z[5],
238
- color: d.fg,
239
- cursor: l ? "pointer" : "default",
240
- boxShadow: k.md,
241
- overflow: "hidden",
242
- transition: "transform 200ms ease, box-shadow 200ms ease",
243
- minHeight: 110,
244
- display: "flex",
245
- flexDirection: "column",
246
- justifyContent: "space-between"
247
- },
248
- onMouseEnter: (g) => {
249
- g.currentTarget.style.transform = "translateY(-2px)", g.currentTarget.style.boxShadow = k.lg;
250
- },
251
- onMouseLeave: (g) => {
252
- g.currentTarget.style.transform = "translateY(0)", g.currentTarget.style.boxShadow = k.md;
253
- },
254
- children: [
255
- /* @__PURE__ */ e(
256
- "div",
257
- {
258
- style: {
259
- position: "absolute",
260
- top: -32,
261
- right: -32,
262
- width: 96,
263
- height: 96,
264
- borderRadius: "50%",
265
- background: "rgba(255, 255, 255, 0.15)",
266
- pointerEvents: "none"
267
- }
268
- }
269
- ),
270
- /* @__PURE__ */ f("div", { style: {
271
- display: "flex",
272
- alignItems: "center",
273
- gap: z[2],
274
- position: "relative"
275
- }, children: [
276
- /* @__PURE__ */ e("div", { style: {
277
- width: 36,
278
- height: 36,
279
- borderRadius: y.sm,
280
- background: "rgba(255, 255, 255, 0.20)",
281
- backdropFilter: "blur(8px)",
282
- display: "flex",
283
- alignItems: "center",
284
- justifyContent: "center",
285
- fontSize: 18
286
- }, children: t }),
287
- /* @__PURE__ */ e("div", { style: {
288
- fontSize: 13,
289
- fontWeight: 500,
290
- opacity: 0.92
291
- }, children: i })
292
- ] }),
293
- /* @__PURE__ */ f("div", { style: {
294
- display: "flex",
295
- alignItems: "baseline",
296
- gap: z[2],
297
- position: "relative",
298
- marginTop: z[3]
299
- }, children: [
300
- /* @__PURE__ */ e("div", { style: {
301
- fontSize: 30,
302
- fontWeight: 700,
303
- lineHeight: 1.1,
304
- letterSpacing: "-0.02em",
305
- fontVariantNumeric: "tabular-nums"
306
- }, children: C }),
307
- a && /* @__PURE__ */ e("div", { style: { fontSize: 14, opacity: 0.85, fontWeight: 500 }, children: a }),
308
- m != null && /* @__PURE__ */ f("div", { style: {
309
- marginLeft: "auto",
310
- fontSize: 12,
311
- fontWeight: 600,
312
- padding: "2px 8px",
313
- borderRadius: 999,
314
- background: E ? "rgba(255, 255, 255, 0.22)" : "rgba(0, 0, 0, 0.18)",
315
- display: "flex",
316
- alignItems: "center",
317
- gap: 2
318
- }, children: [
319
- /* @__PURE__ */ e("span", { style: { fontSize: 10 }, children: E ? "▲" : "▼" }),
320
- Math.abs(m).toFixed(1),
321
- "%"
322
- ] })
323
- ] })
324
- ]
325
- }
326
- );
327
- }
328
- function se({ color: t = "blue", label: i, size: r = 8 }) {
329
- const a = w[t] || w.blue;
330
- return /* @__PURE__ */ f("span", { style: {
331
- display: "inline-flex",
332
- alignItems: "center",
333
- gap: 8,
334
- fontSize: 14,
335
- fontWeight: 600,
336
- color: "#111827"
337
- }, children: [
338
- /* @__PURE__ */ e("span", { style: {
339
- width: r,
340
- height: r,
341
- borderRadius: "50%",
342
- background: a.bg,
343
- boxShadow: `0 0 0 3px ${a.soft}`,
344
- flexShrink: 0
345
- } }),
346
- i && /* @__PURE__ */ e("span", { children: i })
347
- ] });
348
- }
349
- function Ie({
350
- color: t = "blue",
351
- title: i,
352
- subtitle: r,
353
- moreText: a = "全部",
354
- moreHref: c,
355
- onMore: n
356
- }) {
357
- return /* @__PURE__ */ f("div", { style: {
358
- display: "flex",
359
- alignItems: "center",
360
- justifyContent: "space-between",
361
- marginBottom: 16
362
- }, children: [
363
- /* @__PURE__ */ f("div", { style: { display: "flex", alignItems: "baseline", gap: 12 }, children: [
364
- /* @__PURE__ */ e(se, { color: t, label: i, size: 10 }),
365
- r && /* @__PURE__ */ e("span", { style: {
366
- fontSize: 13,
367
- color: "#6b7280",
368
- fontWeight: 400
369
- }, children: r })
370
- ] }),
371
- (c || n) && /* @__PURE__ */ f(
372
- "a",
373
- {
374
- href: c,
375
- onClick: (l) => {
376
- n && (l.preventDefault(), n());
377
- },
378
- style: {
379
- fontSize: 13,
380
- color: "#6b7280",
381
- textDecoration: "none",
382
- display: "inline-flex",
383
- alignItems: "center",
384
- gap: 4,
385
- cursor: "pointer",
386
- transition: "color 150ms ease"
387
- },
388
- onMouseEnter: (l) => {
389
- l.currentTarget.style.color = "#7c3aed";
390
- },
391
- onMouseLeave: (l) => {
392
- l.currentTarget.style.color = "#6b7280";
393
- },
394
- children: [
395
- a,
396
- /* @__PURE__ */ e("span", { style: { fontSize: 12 }, children: "›" })
397
- ]
398
- }
399
- )
400
- ] });
401
- }
402
- function Be({
403
- title: t,
404
- description: i,
405
- icon: r,
406
- cover: a,
407
- color: c = "violet",
408
- tags: n = [],
409
- meta: l,
410
- href: s,
411
- extra: o
412
- }) {
413
- const d = w[c] || w.violet, [b, u] = R(!1);
414
- return /* @__PURE__ */ f(
415
- "div",
416
- {
417
- onClick: () => {
418
- s && typeof window < "u" && (window.location.href = s);
419
- },
420
- onMouseEnter: () => u(!0),
421
- onMouseLeave: () => u(!1),
422
- style: {
423
- background: "#ffffff",
424
- borderRadius: y.lg,
425
- overflow: "hidden",
426
- cursor: s ? "pointer" : "default",
427
- boxShadow: b ? k.lg : k.sm,
428
- transform: b ? "translateY(-2px)" : "translateY(0)",
429
- transition: "transform 200ms ease, box-shadow 200ms ease",
430
- border: "1px solid #f1f5f9",
431
- display: "flex",
432
- flexDirection: "column"
433
- },
434
- children: [
435
- /* @__PURE__ */ f("div", { style: {
436
- position: "relative",
437
- aspectRatio: "16 / 9",
438
- background: a ? "#f1f5f9" : d.gradient,
439
- display: "flex",
440
- alignItems: "center",
441
- justifyContent: "center",
442
- overflow: "hidden"
443
- }, children: [
444
- a ? /* @__PURE__ */ e(
445
- "img",
446
- {
447
- src: a,
448
- alt: t,
449
- style: {
450
- width: "100%",
451
- height: "100%",
452
- objectFit: "cover"
453
- }
454
- }
455
- ) : /* @__PURE__ */ e("div", { style: {
456
- fontSize: 48,
457
- color: "rgba(255, 255, 255, 0.9)",
458
- display: "flex"
459
- }, children: r }),
460
- !a && /* @__PURE__ */ e("div", { style: {
461
- position: "absolute",
462
- top: -24,
463
- right: -24,
464
- width: 80,
465
- height: 80,
466
- borderRadius: "50%",
467
- background: "rgba(255, 255, 255, 0.15)"
468
- } }),
469
- o && /* @__PURE__ */ e("div", { style: {
470
- position: "absolute",
471
- top: 8,
472
- right: 8
473
- }, children: o })
474
- ] }),
475
- /* @__PURE__ */ f("div", { style: {
476
- padding: z[4],
477
- display: "flex",
478
- flexDirection: "column",
479
- gap: z[2],
480
- flex: 1
481
- }, children: [
482
- n.length > 0 && /* @__PURE__ */ e("div", { style: {
483
- display: "flex",
484
- flexWrap: "wrap",
485
- gap: 6
486
- }, children: n.slice(0, 3).map((S, C) => {
487
- const m = w[S.color] || w.blue;
488
- return /* @__PURE__ */ e(
489
- "span",
490
- {
491
- style: {
492
- fontSize: 11,
493
- fontWeight: 500,
494
- padding: "2px 8px",
495
- borderRadius: 999,
496
- background: m.soft,
497
- color: m.bg
498
- },
499
- children: S.label
500
- },
501
- C
502
- );
503
- }) }),
504
- /* @__PURE__ */ e("div", { style: {
505
- fontSize: 15,
506
- fontWeight: 600,
507
- color: "#111827",
508
- lineHeight: 1.3,
509
- overflow: "hidden",
510
- textOverflow: "ellipsis",
511
- display: "-webkit-box",
512
- WebkitLineClamp: 1,
513
- WebkitBoxOrient: "vertical"
514
- }, children: t }),
515
- i && /* @__PURE__ */ e("div", { style: {
516
- fontSize: 12,
517
- color: "#6b7280",
518
- lineHeight: 1.5,
519
- overflow: "hidden",
520
- textOverflow: "ellipsis",
521
- display: "-webkit-box",
522
- WebkitLineClamp: 2,
523
- WebkitBoxOrient: "vertical",
524
- minHeight: 36
525
- }, children: i }),
526
- l && /* @__PURE__ */ e("div", { style: {
527
- fontSize: 11,
528
- color: "#9ca3af",
529
- marginTop: "auto",
530
- paddingTop: z[2],
531
- borderTop: "1px dashed #f1f5f9"
532
- }, children: l })
533
- ] })
534
- ]
535
- }
536
- );
537
- }
538
- function De({
539
- tag: t,
540
- title: i,
541
- description: r,
542
- buttonText: a,
543
- buttonHref: c,
544
- onButtonClick: n
545
- }) {
546
- return /* @__PURE__ */ f("div", { style: {
547
- position: "relative",
548
- borderRadius: y.lg,
549
- padding: "40px 48px",
550
- background: "linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%)",
551
- color: "#ffffff",
552
- overflow: "hidden",
553
- boxShadow: k.lg
554
- }, children: [
555
- /* @__PURE__ */ e("div", { style: {
556
- position: "absolute",
557
- top: -64,
558
- right: -64,
559
- width: 200,
560
- height: 200,
561
- borderRadius: "50%",
562
- background: "radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%)",
563
- pointerEvents: "none"
564
- } }),
565
- /* @__PURE__ */ e("div", { style: {
566
- position: "absolute",
567
- bottom: -48,
568
- left: "30%",
569
- width: 160,
570
- height: 160,
571
- borderRadius: "50%",
572
- background: "radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%)",
573
- pointerEvents: "none"
574
- } }),
575
- /* @__PURE__ */ f("div", { style: {
576
- position: "relative",
577
- display: "flex",
578
- alignItems: "center",
579
- justifyContent: "space-between",
580
- gap: 32,
581
- flexWrap: "wrap"
582
- }, children: [
583
- /* @__PURE__ */ f("div", { style: { flex: 1, minWidth: 240 }, children: [
584
- t && /* @__PURE__ */ e("div", { style: {
585
- fontSize: 11,
586
- fontWeight: 600,
587
- letterSpacing: "0.12em",
588
- color: "#a5b4fc",
589
- textTransform: "uppercase",
590
- marginBottom: 12
591
- }, children: t }),
592
- /* @__PURE__ */ e("div", { style: {
593
- fontSize: 24,
594
- fontWeight: 700,
595
- lineHeight: 1.3,
596
- marginBottom: 8
597
- }, children: i }),
598
- r && /* @__PURE__ */ e("div", { style: {
599
- fontSize: 14,
600
- color: "rgba(255, 255, 255, 0.7)",
601
- lineHeight: 1.6,
602
- maxWidth: 540
603
- }, children: r })
604
- ] }),
605
- a && (c || n) && /* @__PURE__ */ f(
606
- "a",
607
- {
608
- href: c || "#",
609
- onClick: (l) => {
610
- n && (l.preventDefault(), n());
611
- },
612
- style: {
613
- display: "inline-flex",
614
- alignItems: "center",
615
- gap: 8,
616
- padding: "12px 24px",
617
- background: "linear-gradient(135deg, #10b981 0%, #059669 100%)",
618
- color: "#ffffff",
619
- borderRadius: 999,
620
- fontSize: 14,
621
- fontWeight: 600,
622
- textDecoration: "none",
623
- boxShadow: "0 4px 12px rgba(16, 185, 129, 0.4)",
624
- transition: "transform 150ms ease, box-shadow 150ms ease",
625
- whiteSpace: "nowrap"
626
- },
627
- onMouseEnter: (l) => {
628
- l.currentTarget.style.transform = "translateY(-1px)", l.currentTarget.style.boxShadow = "0 6px 16px rgba(16, 185, 129, 0.5)";
629
- },
630
- onMouseLeave: (l) => {
631
- l.currentTarget.style.transform = "translateY(0)", l.currentTarget.style.boxShadow = "0 4px 12px rgba(16, 185, 129, 0.4)";
632
- },
633
- children: [
634
- a,
635
- /* @__PURE__ */ e("span", { children: "→" })
636
- ]
637
- }
638
- )
639
- ] })
640
- ] });
641
- }
642
- function de({
643
- icon: t,
644
- title: i = "暂无数据",
645
- description: r,
646
- actionText: a,
647
- onAction: c,
648
- size: n = "md",
649
- style: l
650
- }) {
651
- const s = { sm: 24, md: 40, lg: 64 }, o = { sm: 14, md: 16, lg: 20 };
652
- return /* @__PURE__ */ f(
653
- "div",
654
- {
655
- role: "status",
656
- "aria-live": "polite",
657
- style: {
658
- padding: s[n] || s.md,
659
- textAlign: "center",
660
- background: "#ffffff",
661
- borderRadius: y.md,
662
- border: "1px dashed #e5e7eb",
663
- ...l
664
- },
665
- children: [
666
- /* @__PURE__ */ e("div", { style: {
667
- display: "inline-flex",
668
- alignItems: "center",
669
- justifyContent: "center",
670
- width: 56,
671
- height: 56,
672
- borderRadius: "50%",
673
- background: x.surfaceAlt,
674
- marginBottom: 16,
675
- fontSize: 28,
676
- color: "#9ca3af"
677
- }, children: t || /* @__PURE__ */ e(Q, {}) }),
678
- /* @__PURE__ */ e("div", { style: {
679
- fontSize: o[n],
680
- fontWeight: 600,
681
- color: x.text,
682
- marginBottom: r ? 6 : 16
683
- }, children: i }),
684
- r && /* @__PURE__ */ e("div", { style: {
685
- fontSize: 13,
686
- color: x.textMuted,
687
- lineHeight: 1.6,
688
- maxWidth: 360,
689
- margin: "0 auto 16px"
690
- }, children: r }),
691
- a && c && /* @__PURE__ */ e(
692
- W,
693
- {
694
- type: "primary",
695
- onClick: c,
696
- style: {
697
- background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)",
698
- border: "none",
699
- minHeight: 36
700
- },
701
- children: a
702
- }
703
- )
704
- ]
705
- }
706
- );
707
- }
708
- function ce({
709
- error: t,
710
- title: i = "加载失败",
711
- description: r,
712
- onRetry: a,
713
- retryText: c = "重新加载",
714
- variant: n = "inline",
715
- style: l
716
- }) {
717
- var v;
718
- const s = n === "full", o = (v = t == null ? void 0 : t.response) == null ? void 0 : v.data, d = o && typeof o == "object" && (typeof o.message == "string" && o.message || typeof o.msg == "string" && o.msg) || null, b = d || (typeof t == "string" ? t : (t == null ? void 0 : t.message) || (t == null ? void 0 : t.msg) || (t ? String(t) : null)), u = r || (d ? `原因: ${d}` : b ? `原因: ${b}。请检查网络或稍后重试。` : "请检查网络或稍后重试。");
719
- return /* @__PURE__ */ f(
720
- "div",
721
- {
722
- role: "alert",
723
- "aria-live": "assertive",
724
- style: {
725
- padding: s ? "48px 24px" : "20px 24px",
726
- background: s ? "#ffffff" : "#fef2f2",
727
- border: s ? `1px dashed ${x.border}` : "1px solid #fecaca",
728
- borderRadius: y.md,
729
- textAlign: s ? "center" : "left",
730
- display: "flex",
731
- flexDirection: s ? "column" : "row",
732
- alignItems: s ? "center" : "flex-start",
733
- gap: s ? 12 : 16,
734
- ...l
735
- },
736
- children: [
737
- /* @__PURE__ */ e("div", { style: {
738
- display: "inline-flex",
739
- alignItems: "center",
740
- justifyContent: "center",
741
- width: s ? 56 : 36,
742
- height: s ? 56 : 36,
743
- borderRadius: "50%",
744
- background: s ? "#fef2f2" : "#ffffff",
745
- color: "#dc2626",
746
- fontSize: s ? 28 : 18,
747
- flexShrink: 0
748
- }, children: /* @__PURE__ */ e(X, {}) }),
749
- /* @__PURE__ */ f("div", { style: { flex: 1, minWidth: 0 }, children: [
750
- /* @__PURE__ */ e("div", { style: {
751
- fontSize: s ? 16 : 14,
752
- fontWeight: 600,
753
- color: "#991b1b",
754
- marginBottom: 4
755
- }, children: i }),
756
- /* @__PURE__ */ e("div", { style: {
757
- fontSize: 13,
758
- color: "#7f1d1d",
759
- lineHeight: 1.6,
760
- wordBreak: "break-word"
761
- }, children: u }),
762
- a && /* @__PURE__ */ e(
763
- W,
764
- {
765
- type: "primary",
766
- danger: !0,
767
- icon: /* @__PURE__ */ e(M, {}),
768
- onClick: a,
769
- size: s ? "middle" : "small",
770
- style: { marginTop: 12 },
771
- children: c
772
- }
773
- )
774
- ] })
775
- ]
776
- }
777
- );
778
- }
779
- function Le({
780
- variant: t = "cards",
781
- rows: i = 4,
782
- active: r = !0,
783
- style: a
784
- }) {
785
- return t === "cards" ? /* @__PURE__ */ e(
786
- "div",
787
- {
788
- role: "status",
789
- "aria-busy": "true",
790
- "aria-label": "加载中",
791
- style: {
792
- display: "grid",
793
- gridTemplateColumns: "repeat(auto-fill, minmax(220px, 1fr))",
794
- gap: 16,
795
- ...a
796
- },
797
- children: Array.from({ length: i }).map((c, n) => /* @__PURE__ */ f(
798
- "div",
799
- {
800
- style: {
801
- background: "#ffffff",
802
- borderRadius: y.lg,
803
- overflow: "hidden",
804
- border: "1px solid #f1f5f9"
805
- },
806
- children: [
807
- /* @__PURE__ */ e(
808
- I.Image,
809
- {
810
- active: r,
811
- style: { width: "100%", height: 140, borderRadius: 0 }
812
- }
813
- ),
814
- /* @__PURE__ */ e("div", { style: { padding: 16 }, children: /* @__PURE__ */ e(I, { active: r, paragraph: { rows: 2 }, title: { width: "60%" } }) })
815
- ]
816
- },
817
- n
818
- ))
819
- }
820
- ) : t === "table" ? /* @__PURE__ */ e(
821
- "div",
822
- {
823
- role: "status",
824
- "aria-busy": "true",
825
- "aria-label": "加载中",
826
- style: {
827
- background: "#ffffff",
828
- padding: 24,
829
- borderRadius: y.md,
830
- ...a
831
- },
832
- children: /* @__PURE__ */ e(I, { active: r, paragraph: { rows: i } })
833
- }
834
- ) : t === "list" ? /* @__PURE__ */ e("div", { role: "status", "aria-busy": "true", "aria-label": "加载中", style: a, children: Array.from({ length: i }).map((c, n) => /* @__PURE__ */ f(
835
- "div",
836
- {
837
- style: {
838
- display: "flex",
839
- alignItems: "center",
840
- gap: 12,
841
- padding: "12px 0",
842
- borderBottom: n < i - 1 ? "1px solid #f1f5f9" : "none"
843
- },
844
- children: [
845
- /* @__PURE__ */ e(I.Avatar, { active: r, size: "default" }),
846
- /* @__PURE__ */ e(I, { active: r, paragraph: { rows: 1 }, title: { width: 120 }, style: { flex: 1 } })
847
- ]
848
- },
849
- n
850
- )) }) : /* @__PURE__ */ e(
851
- "div",
852
- {
853
- role: "status",
854
- "aria-busy": "true",
855
- "aria-label": "加载中",
856
- style: {
857
- background: "#ffffff",
858
- padding: 32,
859
- borderRadius: y.md,
860
- ...a
861
- },
862
- children: /* @__PURE__ */ e(I, { active: r, title: { width: "40%" }, paragraph: { rows: i } })
863
- }
864
- );
865
- }
866
- function We({
867
- value: t,
868
- onChange: i,
869
- onSearch: r,
870
- placeholder: a = "搜索...",
871
- debounceMs: c = 300,
872
- width: n = 280,
873
- allowClear: l = !0,
874
- // antd v6: enterButton 已被废弃,SearchInput 已通过 onKeyDown 自行处理 Enter 键,
875
- // 所以从 rest 里过滤掉,避免透传到原生 <input> 报 React 警告。
876
- enterButton: s,
877
- ...o
878
- }) {
879
- const [d, b] = R(t || ""), u = D(null), v = D(t || "");
880
- B(() => {
881
- t !== void 0 && t !== d && (b(t || ""), v.current = t || "");
882
- }, [t]), B(() => () => {
883
- u.current && clearTimeout(u.current);
884
- }, []);
885
- const S = (p) => {
886
- v.current = p, i && i(p);
887
- }, C = (p) => {
888
- const h = p.target.value;
889
- if (b(h), u.current && clearTimeout(u.current), h === "") {
890
- S("");
891
- return;
892
- }
893
- u.current = setTimeout(() => S(h), c);
894
- }, m = (p) => {
895
- u.current && clearTimeout(u.current), S(p), r && r(p);
896
- };
897
- return /* @__PURE__ */ e(
898
- $,
899
- {
900
- ...o,
901
- value: d,
902
- onChange: C,
903
- onPressEnter: m,
904
- onKeyDown: (p) => {
905
- p.key === "Enter" ? (p.preventDefault(), m(d)) : p.key === "Escape" && (b(""), m(""));
906
- },
907
- placeholder: a,
908
- allowClear: l ? { clearIcon: /* @__PURE__ */ e("span", { onClick: () => {
909
- b(""), m("");
910
- }, children: "×" }) } : !1,
911
- prefix: /* @__PURE__ */ e(Z, { style: { color: "#9ca3af" } }),
912
- style: {
913
- width: n,
914
- borderRadius: y.md,
915
- ...o.style || {}
916
- }
917
- }
918
- );
919
- }
920
- j.use([
921
- V,
922
- ee,
923
- te,
924
- re,
925
- ne,
926
- ie,
927
- ae,
928
- oe
929
- ]);
930
- function Ae({
931
- option: t,
932
- height: i = 300,
933
- className: r,
934
- style: a
935
- }) {
936
- const c = D(null), n = D(null);
937
- return B(() => {
938
- if (!c.current) return;
939
- n.current = j.init(c.current, null, { renderer: "canvas" });
940
- let l;
941
- const s = () => {
942
- var o;
943
- return (o = n.current) == null ? void 0 : o.resize();
944
- };
945
- return typeof ResizeObserver < "u" ? (l = new ResizeObserver(s), l.observe(c.current)) : window.addEventListener("resize", s), () => {
946
- l ? l.disconnect() : window.removeEventListener("resize", s), n.current && (n.current.dispose(), n.current = null);
947
- };
948
- }, []), B(() => {
949
- n.current && t && n.current.setOption(t, { notMerge: !0 });
950
- }, [t]), /* @__PURE__ */ e(
951
- "div",
952
- {
953
- ref: c,
954
- className: r,
955
- role: "img",
956
- "aria-label": "数据可视化图表",
957
- style: {
958
- width: "100%",
959
- height: i,
960
- ...a
961
- }
962
- }
963
- );
964
- }
965
- function fe({
966
- title: t,
967
- subtitle: i,
968
- breadcrumb: r,
969
- extra: a,
970
- back: c,
971
- onBack: n
972
- }) {
973
- const l = le();
974
- return /* @__PURE__ */ e("div", { style: {
975
- marginBottom: 12,
976
- paddingBottom: 10,
977
- borderBottom: "1px solid #f1f5f9"
978
- }, children: /* @__PURE__ */ f("div", { style: {
979
- display: "flex",
980
- alignItems: "center",
981
- justifyContent: "space-between",
982
- gap: 12,
983
- flexWrap: "wrap"
984
- }, children: [
985
- /* @__PURE__ */ f("div", { style: {
986
- display: "flex",
987
- alignItems: "center",
988
- gap: 10,
989
- minWidth: 0,
990
- flexWrap: "wrap"
991
- }, children: [
992
- c && /* @__PURE__ */ e(
993
- "button",
994
- {
995
- onClick: () => {
996
- n ? n() : l(-1);
997
- },
998
- "aria-label": "返回上一页",
999
- style: {
1000
- width: 28,
1001
- height: 28,
1002
- borderRadius: 6,
1003
- border: "1px solid #e5e7eb",
1004
- background: "#ffffff",
1005
- color: "#6b7280",
1006
- cursor: "pointer",
1007
- display: "inline-flex",
1008
- alignItems: "center",
1009
- justifyContent: "center",
1010
- fontSize: 13,
1011
- transition: "all 150ms ease",
1012
- flexShrink: 0
1013
- },
1014
- onMouseEnter: (o) => {
1015
- o.currentTarget.style.background = "#f8fafc", o.currentTarget.style.color = "#111827", o.currentTarget.style.borderColor = "#7c3aed";
1016
- },
1017
- onMouseLeave: (o) => {
1018
- o.currentTarget.style.background = "#ffffff", o.currentTarget.style.color = "#6b7280", o.currentTarget.style.borderColor = "#e5e7eb";
1019
- },
1020
- children: "←"
1021
- }
1022
- ),
1023
- r && r.length > 0 ? /* @__PURE__ */ e(
1024
- _,
1025
- {
1026
- items: r.map((o, d) => {
1027
- const b = d === r.length - 1;
1028
- return {
1029
- title: o.href && !b ? /* @__PURE__ */ e("a", { onClick: (u) => {
1030
- u.preventDefault(), l(o.href);
1031
- }, children: o.label }) : /* @__PURE__ */ e("span", { style: b ? {
1032
- fontWeight: 600,
1033
- color: "#111827"
1034
- } : void 0, children: o.label })
1035
- };
1036
- })
1037
- }
1038
- ) : t && /* @__PURE__ */ e("span", { role: "heading", "aria-level": 1, style: {
1039
- fontSize: 15,
1040
- fontWeight: 600,
1041
- color: "#111827",
1042
- lineHeight: 1.4
1043
- }, children: t }),
1044
- i && /* @__PURE__ */ e("span", { title: i, style: {
1045
- fontSize: 12,
1046
- color: "#94a3b8",
1047
- lineHeight: 1.4,
1048
- whiteSpace: "nowrap",
1049
- overflow: "hidden",
1050
- textOverflow: "ellipsis",
1051
- maxWidth: 360
1052
- }, children: i })
1053
- ] }),
1054
- a && /* @__PURE__ */ e("div", { style: {
1055
- display: "flex",
1056
- gap: 8,
1057
- flexShrink: 0
1058
- }, children: a })
1059
- ] }) });
1060
- }
1061
- function Me({ left: t, right: i, extra: r }) {
1062
- return /* @__PURE__ */ f(
1063
- "div",
1064
- {
1065
- style: {
1066
- display: "flex",
1067
- alignItems: "center",
1068
- justifyContent: "space-between",
1069
- gap: 12,
1070
- marginBottom: 12,
1071
- flexWrap: "wrap"
1072
- },
1073
- children: [
1074
- /* @__PURE__ */ e(P, { size: 8, wrap: !0, children: t }),
1075
- /* @__PURE__ */ f(P, { size: 8, wrap: !0, children: [
1076
- i,
1077
- r
1078
- ] })
1079
- ]
1080
- }
1081
- );
1082
- }
1083
- function He({ onClick: t, loading: i, title: r = "刷新" }) {
1084
- return /* @__PURE__ */ e(W, { icon: /* @__PURE__ */ e(M, {}), onClick: t, loading: i, title: r, children: r });
1085
- }
1086
- const ge = {
1087
- 0: { label: "待办", color: "default" },
1088
- 1: { label: "进行中", color: "blue" },
1089
- 2: { label: "已完成", color: "green" }
1090
- }, ue = {
1091
- ACTIVE: { label: "正常", color: "green" },
1092
- INACTIVE: { label: "禁用", color: "red" },
1093
- ENABLED: { label: "启用", color: "green" },
1094
- DISABLED: { label: "禁用", color: "red" }
1095
- }, pe = {
1096
- low: { label: "低", color: "default" },
1097
- medium: { label: "中", color: "orange" },
1098
- high: { label: "高", color: "red" },
1099
- 1: { label: "低", color: "default" },
1100
- 2: { label: "中", color: "orange" },
1101
- 3: { label: "高", color: "red" }
1102
- }, be = {
1103
- PENDING: { label: "待审批", color: "orange" },
1104
- APPROVED: { label: "已通过", color: "green" },
1105
- REJECTED: { label: "已拒绝", color: "red" },
1106
- CANCELLED: { label: "已撤回", color: "default" }
1107
- }, he = {
1108
- RUNNING: { label: "运行中", color: "green" },
1109
- PAUSED: { label: "已暂停", color: "orange" },
1110
- STOPPED: { label: "已停止", color: "default" },
1111
- FAILED: { label: "失败", color: "red" },
1112
- SUCCESS: { label: "成功", color: "green" }
1113
- }, me = {
1114
- task: ge,
1115
- model: ue,
1116
- priority: pe,
1117
- approval: be,
1118
- schedule: he
1119
- };
1120
- function Oe({ status: t, type: i = "task", mapping: r, ...a }) {
1121
- const n = (r || me[i] || {})[t];
1122
- return n ? /* @__PURE__ */ e(N, { color: n.color, ...a, children: n.label }) : /* @__PURE__ */ e(N, { ...a, children: String(t) });
1123
- }
1124
- function Pe({ title: t, description: i, load: r, columns: a, rowKey: c = "id", extra: n, expandable: l }) {
1125
- const [s, o] = R([]), [d, b] = R({ current: 1, size: 10, total: null }), [u, v] = R(!1), [S, C] = R(null), m = K(async (g = d.current, p = d.size) => {
1126
- v(!0), C(null);
1127
- try {
1128
- const h = await r(g, p);
1129
- if (Array.isArray(h))
1130
- o(h || []), b({ current: g, size: p, total: h.length });
1131
- else {
1132
- const A = (h == null ? void 0 : h.records) || [];
1133
- o(A), b({ current: g, size: p, total: (h == null ? void 0 : h.total) == null ? null : Number(h.total) });
1134
- }
1135
- } catch (h) {
1136
- o([]), C(h);
1137
- } finally {
1138
- v(!1);
1139
- }
1140
- }, [r, d.current, d.size]);
1141
- B(() => {
1142
- m(1);
1143
- }, []);
1144
- const E = d.total != null && d.total > 0;
1145
- return /* @__PURE__ */ f("div", { children: [
1146
- /* @__PURE__ */ e(fe, { title: t, subtitle: i }),
1147
- /* @__PURE__ */ f(
1148
- q,
1149
- {
1150
- extra: /* @__PURE__ */ e(
1151
- W,
1152
- {
1153
- icon: /* @__PURE__ */ e(M, {}),
1154
- loading: u,
1155
- onClick: () => m(d.current, d.size),
1156
- children: "刷新"
1157
- }
1158
- ),
1159
- children: [
1160
- n,
1161
- S ? /* @__PURE__ */ e(ce, { error: S, onRetry: () => m(d.current, d.size), type: "inline" }) : /* @__PURE__ */ e(
1162
- J,
1163
- {
1164
- size: "small",
1165
- columns: a,
1166
- dataSource: s,
1167
- loading: u,
1168
- rowKey: (g) => (g == null ? void 0 : g[c]) ?? (g == null ? void 0 : g.key) ?? JSON.stringify(g).slice(0, 32),
1169
- pagination: {
1170
- current: d.current,
1171
- pageSize: d.size,
1172
- total: E ? d.total : s.length,
1173
- showSizeChanger: !0,
1174
- showTotal: () => E ? `共 ${d.total} 条` : `本页 ${s.length} 条(接口 total 未返回有效值)`
1175
- },
1176
- onChange: (g) => m(g.current, g.pageSize),
1177
- expandable: l,
1178
- locale: { emptyText: /* @__PURE__ */ e(de, { title: "暂无数据", description: "接口返回空列表" }) }
1179
- }
1180
- )
1181
- ]
1182
- }
1183
- )
1184
- ] });
1185
- }
1186
- export {
1187
- se as C,
1188
- De as D,
1189
- Ae as E,
1190
- Be as F,
1191
- Ee as G,
1192
- Le as L,
1193
- fe as P,
1194
- He as R,
1195
- We as S,
1196
- Me as T,
1197
- de as a,
1198
- ce as b,
1199
- Pe as c,
1200
- Ie as d,
1201
- Oe as e,
1202
- ze as f,
1203
- T as g,
1204
- F as h,
1205
- z as i,
1206
- Re as l,
1207
- x as n,
1208
- w as p,
1209
- y as r,
1210
- k as s
1211
- };