@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.
package/dist/index.js CHANGED
@@ -1,57 +1,57 @@
1
- import { C as xe, D as we, E as Ie, a as ke, b as Ce, F as be, G as Re, L as ve, P as ze, c as Me, R as Le, S as Ee, d as Oe, e as Be, T as je, f as Te, g as Ke, h as $e, l as De, n as Pe, p as qe, r as Fe, s as He, i as We } from "./PagedTable-DyjNokXN.js";
1
+ import { C as be, a as we, D as ke, E as Ie, b as Ce, F as Re, G as ve, L as ze, P as Me, c as Be, R as Le, S as Oe, d as je, e as Ee, T as Te, f as $e, g as Ke, h as De, l as Pe, n as qe, p as Fe, r as He, s as We, i as Ne } from "./ComponentDoc-C4XFElke.js";
2
2
  import { jsxs as h, jsx as r } from "react/jsx-runtime";
3
- import { Layout as I, Spin as B, Menu as j, Dropdown as T, Avatar as K, Button as k, Tooltip as $, Card as D, Alert as P, Form as S, Input as v, message as p, Tag as q, Result as F } from "antd";
4
- import { MenuUnfoldOutlined as H, MenuFoldOutlined as W, DownOutlined as N, LoginOutlined as G, UserOutlined as J, LockOutlined as Q } from "@ant-design/icons";
3
+ import { Layout as k, Spin as E, Menu as T, Dropdown as $, Avatar as K, Button as I, Tooltip as D, Card as P, Alert as q, Form as x, Input as z, message as S, Tag as F, Result as H } from "antd";
4
+ import { MenuUnfoldOutlined as W, MenuFoldOutlined as N, DownOutlined as G, LoginOutlined as J, UserOutlined as Q, LockOutlined as V } from "@ant-design/icons";
5
5
  import { useNavigate as X, useLocation as Y, Outlet as Z } from "react-router-dom";
6
- import { useState as z, Component as _ } from "react";
6
+ import { useState as B, Component as _ } from "react";
7
7
  import U from "axios";
8
- const { Header: V, Sider: A, Content: ee } = I;
9
- function te(t, e = 0.85) {
10
- const o = /^#?([0-9a-f]{6})$/i.exec(t || "");
11
- if (!o) return t;
12
- const d = parseInt(o[1], 16), u = Math.max(0, Math.min(255, Math.round((d >> 16 & 255) * e))), n = Math.max(0, Math.min(255, Math.round((d >> 8 & 255) * e))), a = Math.max(0, Math.min(255, Math.round((d & 255) * e)));
13
- return "#" + (u << 16 | n << 8 | a).toString(16).padStart(6, "0");
8
+ const { Header: A, Sider: ee, Content: te } = k;
9
+ function re(e, t = 0.85) {
10
+ const s = /^#?([0-9a-f]{6})$/i.exec(e || "");
11
+ if (!s) return e;
12
+ const d = parseInt(s[1], 16), f = Math.max(0, Math.min(255, Math.round((d >> 16 & 255) * t))), n = Math.max(0, Math.min(255, Math.round((d >> 8 & 255) * t))), i = Math.max(0, Math.min(255, Math.round((d & 255) * t)));
13
+ return "#" + (f << 16 | n << 8 | i).toString(16).padStart(6, "0");
14
14
  }
15
- function re({
16
- menuItems: t = [],
17
- appTitle: e = "One Company",
18
- appShort: o = "OC",
15
+ function ne({
16
+ menuItems: e = [],
17
+ appTitle: t = "One Company",
18
+ appShort: s = "OC",
19
19
  appVersion: d,
20
- appIcon: u,
20
+ appIcon: f,
21
21
  appUser: n,
22
- loginPath: a,
23
- headerExtra: g,
24
- loading: x = !1
22
+ loginPath: i,
23
+ headerExtra: p,
24
+ loading: m = !1
25
25
  }) {
26
- const [i, m] = z(!1), y = X(), c = Y(), E = ({ key: f }) => {
27
- y(f);
28
- }, b = () => {
29
- if (a) return a;
30
- const f = t && t[0], l = f && f.key;
26
+ const [o, g] = B(!1), y = X(), c = Y(), O = ({ key: u }) => {
27
+ y(u);
28
+ }, R = () => {
29
+ if (i) return i;
30
+ const u = e && e[0], l = u && u.key;
31
31
  return typeof l == "string" && l.endsWith("/home") ? l.slice(0, -4) + "login" : "/login";
32
- }, R = (f, l = []) => {
33
- for (const s of f || [])
34
- s != null && s.key && l.push(s.key), s != null && s.children && R(s.children, l);
32
+ }, v = (u, l = []) => {
33
+ for (const a of u || [])
34
+ a != null && a.key && l.push(a.key), a != null && a.children && v(a.children, l);
35
35
  return l;
36
- }, O = (() => {
37
- const f = R(t), l = c.pathname;
38
- return f.filter((s) => l === s || l.startsWith(s + "/")).sort((s, w) => w.length - s.length)[0] || l;
36
+ }, j = (() => {
37
+ const u = v(e), l = c.pathname;
38
+ return u.filter((a) => l === a || l.startsWith(a + "/")).sort((a, w) => w.length - a.length)[0] || l;
39
39
  })();
40
- return /* @__PURE__ */ h(I, { style: { minHeight: "100vh" }, children: [
41
- /* @__PURE__ */ h(A, { trigger: null, collapsible: !0, collapsed: i, children: [
40
+ return /* @__PURE__ */ h(k, { style: { minHeight: "100vh" }, children: [
41
+ /* @__PURE__ */ h(ee, { trigger: null, collapsible: !0, collapsed: o, children: [
42
42
  /* @__PURE__ */ r("div", { style: {
43
43
  height: 64,
44
44
  display: "flex",
45
45
  alignItems: "center",
46
46
  justifyContent: "center"
47
47
  }, children: (() => {
48
- if (i) {
49
- if (u) {
50
- const { icon: f, color: l = "#7c3aed", label: s = e } = u, w = /* @__PURE__ */ r("div", { style: {
48
+ if (o) {
49
+ if (f) {
50
+ const { icon: u, color: l = "#7c3aed", label: a = t } = f, w = /* @__PURE__ */ r("div", { style: {
51
51
  width: 36,
52
52
  height: 36,
53
53
  borderRadius: 9,
54
- background: `linear-gradient(135deg, ${l}, ${te(l, 0.7)})`,
54
+ background: `linear-gradient(135deg, ${l}, ${re(l, 0.7)})`,
55
55
  display: "flex",
56
56
  alignItems: "center",
57
57
  justifyContent: "center",
@@ -59,13 +59,13 @@ function re({
59
59
  fontSize: 20,
60
60
  boxShadow: "0 2px 6px rgba(0,0,0,0.25)",
61
61
  overflow: "hidden"
62
- }, children: f });
63
- return /* @__PURE__ */ r($, { title: s, placement: "right", children: w });
62
+ }, children: u });
63
+ return /* @__PURE__ */ r(D, { title: a, placement: "right", children: w });
64
64
  }
65
- return o;
65
+ return s;
66
66
  }
67
67
  return /* @__PURE__ */ h("span", { style: { color: "#fff", fontWeight: 600, fontSize: 16, whiteSpace: "nowrap" }, children: [
68
- e,
68
+ t,
69
69
  d && /* @__PURE__ */ h("span", { style: {
70
70
  color: "rgba(255,255,255,0.55)",
71
71
  fontWeight: 400,
@@ -77,19 +77,19 @@ function re({
77
77
  ] })
78
78
  ] });
79
79
  })() }),
80
- x ? /* @__PURE__ */ r("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ r(B, { size: "small" }) }) : /* @__PURE__ */ r(
81
- j,
80
+ m ? /* @__PURE__ */ r("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ r(E, { size: "small" }) }) : /* @__PURE__ */ r(
81
+ T,
82
82
  {
83
83
  theme: "dark",
84
84
  mode: "inline",
85
- selectedKeys: [O],
86
- items: t,
87
- onClick: E
85
+ selectedKeys: [j],
86
+ items: e,
87
+ onClick: O
88
88
  }
89
89
  )
90
90
  ] }),
91
- /* @__PURE__ */ h(I, { children: [
92
- /* @__PURE__ */ h(V, { style: {
91
+ /* @__PURE__ */ h(k, { children: [
92
+ /* @__PURE__ */ h(A, { style: {
93
93
  height: 48,
94
94
  lineHeight: "48px",
95
95
  padding: "0 16px",
@@ -99,10 +99,10 @@ function re({
99
99
  justifyContent: "space-between",
100
100
  borderBottom: "1px solid #f1f5f9"
101
101
  }, children: [
102
- /* @__PURE__ */ r("span", { onClick: () => m(!i), style: { fontSize: 18, cursor: "pointer" }, children: i ? /* @__PURE__ */ r(H, {}) : /* @__PURE__ */ r(W, {}) }),
102
+ /* @__PURE__ */ r("span", { onClick: () => g(!o), style: { fontSize: 18, cursor: "pointer" }, children: o ? /* @__PURE__ */ r(W, {}) : /* @__PURE__ */ r(N, {}) }),
103
103
  /* @__PURE__ */ h("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
104
104
  n && /* @__PURE__ */ r(
105
- T,
105
+ $,
106
106
  {
107
107
  menu: {
108
108
  items: [
@@ -112,7 +112,7 @@ function re({
112
112
  key: "logout",
113
113
  label: "退出登录",
114
114
  onClick: () => {
115
- localStorage.removeItem("token"), localStorage.removeItem("userInfo"), window.location.href = b();
115
+ localStorage.removeItem("token"), localStorage.removeItem("userInfo"), window.location.href = R();
116
116
  }
117
117
  }
118
118
  ]
@@ -121,85 +121,89 @@ function re({
121
121
  children: /* @__PURE__ */ h("span", { style: { cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 6 }, children: [
122
122
  /* @__PURE__ */ r(K, { size: 28, style: { background: "#7c3aed" }, children: (n.name || "?").slice(0, 1).toUpperCase() }),
123
123
  /* @__PURE__ */ r("span", { style: { fontSize: 13, color: "#0f172a" }, children: n.name }),
124
- /* @__PURE__ */ r(N, { style: { fontSize: 10, color: "#94a3b8" } })
124
+ /* @__PURE__ */ r(G, { style: { fontSize: 10, color: "#94a3b8" } })
125
125
  ] })
126
126
  }
127
127
  ),
128
128
  !n && /* @__PURE__ */ r(
129
- k,
129
+ I,
130
130
  {
131
131
  type: "primary",
132
132
  size: "small",
133
- icon: /* @__PURE__ */ r(G, {}),
133
+ icon: /* @__PURE__ */ r(J, {}),
134
134
  onClick: () => {
135
- window.location.href = b();
135
+ window.location.href = R();
136
136
  },
137
137
  children: "登录"
138
138
  }
139
139
  ),
140
- g
140
+ p
141
141
  ] })
142
142
  ] }),
143
- /* @__PURE__ */ r(ee, { style: { margin: 16, padding: 24, background: "#fff", minHeight: 280 }, children: /* @__PURE__ */ r(Z, {}) })
143
+ /* @__PURE__ */ r(te, { style: { margin: 16, padding: 24, background: "#fff", minHeight: 280 }, children: /* @__PURE__ */ r(Z, {}) })
144
144
  ] })
145
145
  ] });
146
146
  }
147
- function ne(t) {
148
- return t && typeof t == "object" && "code" in t && "data" in t ? t.code !== 200 ? Promise.reject(new Error(t.message || "请求失败")) : t.data : t;
147
+ function oe(e) {
148
+ return e && typeof e == "object" && "code" in e && "data" in e ? e.code !== 200 ? Promise.reject(new Error(e.message || "请求失败")) : e.data : e;
149
149
  }
150
- function oe(t, e = {}) {
150
+ function se(e, t = {}) {
151
151
  const {
152
- tokenKey: o = "token",
152
+ tokenKey: s = "token",
153
153
  userInfoKey: d = "userInfo",
154
- unauthorizedRedirect: u = "/login"
155
- } = e;
156
- return t.interceptors.request.use((n) => {
157
- const a = localStorage.getItem(o);
158
- return a && (n.headers.Authorization = `Bearer ${a}`), n;
159
- }), t.interceptors.response.use(
160
- (n) => ne(n.data),
154
+ unauthorizedRedirect: f = "/login"
155
+ } = t;
156
+ return e.interceptors.request.use((n) => {
157
+ const i = localStorage.getItem(s);
158
+ return i && (n.headers.Authorization = `Bearer ${i}`), n;
159
+ }), e.interceptors.response.use(
160
+ (n) => oe(n.data),
161
161
  (n) => {
162
- var g;
163
- const a = (g = n.response) == null ? void 0 : g.status;
164
- return a === 401 ? (localStorage.removeItem(o), localStorage.removeItem(d), window.location.href = u) : a === 403 ? console.error("没有权限访问该资源") : a === 500 && console.error("服务器内部错误"), Promise.reject(n);
162
+ var p, m, o;
163
+ const i = (p = n.response) == null ? void 0 : p.status;
164
+ if (i === 401) {
165
+ const g = (m = n.response) == null ? void 0 : m.data;
166
+ !!(g && typeof g == "object" && g.errorCode) ? console.warn(`[401] 业务鉴权失败(不是会话过期,不跳登录): ${(o = n.config) == null ? void 0 : o.url} → ${g.errorCode}`) : (localStorage.removeItem(s), localStorage.removeItem(d), window.location.href = f);
167
+ } else i === 403 ? console.error("没有权限访问该资源") : i === 500 && console.error("服务器内部错误");
168
+ return Promise.reject(n);
165
169
  }
166
- ), t;
170
+ ), e;
167
171
  }
168
- function C(t = {}) {
169
- const e = U.create({
170
- baseURL: t.baseURL ?? "/api",
171
- timeout: t.timeout ?? 1e4
172
+ function C(e = {}) {
173
+ const t = U.create({
174
+ baseURL: e.baseURL ?? "/api",
175
+ timeout: e.timeout ?? 1e4
172
176
  });
173
- return oe(e, {
174
- tokenKey: t.tokenKey,
175
- userInfoKey: t.userInfoKey,
176
- unauthorizedRedirect: t.unauthorizedRedirect
177
+ return se(t, {
178
+ tokenKey: e.tokenKey,
179
+ userInfoKey: e.userInfoKey,
180
+ unauthorizedRedirect: e.unauthorizedRedirect
177
181
  });
178
182
  }
179
- const M = C(), se = C();
180
- function ae({
181
- title: t = "统一管理平台",
182
- mockAuth: e,
183
- loginApi: o = "/auth/login",
183
+ const b = C(), ae = C();
184
+ function ie({
185
+ title: e = "统一管理平台",
186
+ mockAuth: t,
187
+ loginApi: s = "/auth/login",
184
188
  redirectUrl: d = "/",
185
- onSuccess: u
189
+ onSuccess: f
186
190
  }) {
187
- const [n, a] = z(!1), g = (i) => {
188
- localStorage.setItem("token", e ? "mock-" + e.username : (i == null ? void 0 : i.token) || "token"), localStorage.setItem("userInfo", JSON.stringify(i || {})), p.success("登录成功" + (e ? "(mock 模式,待 CTC/SSO 接入)" : "")), u ? u(i) : window.location.href = d;
189
- }, x = async (i) => {
190
- var m, y;
191
- a(!0);
191
+ const [n, i] = B(!1), p = (o) => {
192
+ localStorage.setItem("token", t ? "mock-" + t.username : (o == null ? void 0 : o.token) || "token"), localStorage.setItem("userInfo", JSON.stringify(o || {})), S.success("登录成功" + (t ? "(mock 模式,待 CTC/SSO 接入)" : "")), f ? f(o) : window.location.href = d;
193
+ }, m = async (o) => {
194
+ var g, y;
195
+ i(!0);
192
196
  try {
193
- if (e) {
194
- i.username === e.username && i.password === e.password ? g(e.user) : p.error("用户名或密码错误");
197
+ if (t) {
198
+ o.username === t.username && o.password === t.password ? p(t.user) : S.error("用户名或密码错误");
195
199
  return;
196
200
  }
197
- const c = await M.post(o, i);
198
- c != null && c.token ? (localStorage.setItem("token", c.token), localStorage.setItem("userInfo", JSON.stringify(c.user || c)), p.success("登录成功"), u ? u(c) : window.location.href = d) : p.error("登录失败:未获取到 token");
201
+ const c = await b.post(s, o);
202
+ c != null && c.token ? (localStorage.setItem("token", c.token), localStorage.setItem("userInfo", JSON.stringify(c.user || c)), S.success("登录成功"), f ? f(c) : window.location.href = d) : S.error("登录失败:未获取到 token");
199
203
  } catch (c) {
200
- p.error(((y = (m = c.response) == null ? void 0 : m.data) == null ? void 0 : y.message) || c.message || "登录失败");
204
+ S.error(((y = (g = c.response) == null ? void 0 : g.data) == null ? void 0 : y.message) || c.message || "登录失败");
201
205
  } finally {
202
- a(!1);
206
+ i(!1);
203
207
  }
204
208
  };
205
209
  return /* @__PURE__ */ r("div", { style: {
@@ -208,20 +212,20 @@ function ae({
208
212
  justifyContent: "center",
209
213
  alignItems: "center",
210
214
  background: "#f0f2f5"
211
- }, children: /* @__PURE__ */ h(D, { title: t, style: { width: 400 }, children: [
212
- e && /* @__PURE__ */ r(
213
- P,
215
+ }, children: /* @__PURE__ */ h(P, { title: e, style: { width: 400 }, children: [
216
+ t && /* @__PURE__ */ r(
217
+ q,
214
218
  {
215
219
  type: "info",
216
220
  showIcon: !0,
217
221
  style: { marginBottom: 16 },
218
- message: `Mock 模式:用户名 ${e.username} / 密码 ${e.password}`
222
+ message: `Mock 模式:用户名 ${t.username} / 密码 ${t.password}`
219
223
  }
220
224
  ),
221
- /* @__PURE__ */ h(S, { onFinish: x, size: "large", children: [
222
- /* @__PURE__ */ r(S.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ r(v, { prefix: /* @__PURE__ */ r(J, {}), placeholder: "用户名" }) }),
223
- /* @__PURE__ */ r(S.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ r(v.Password, { prefix: /* @__PURE__ */ r(Q, {}), placeholder: "密码" }) }),
224
- /* @__PURE__ */ r(S.Item, { children: /* @__PURE__ */ r(k, { type: "primary", htmlType: "submit", loading: n, block: !0, children: "登 录" }) })
225
+ /* @__PURE__ */ h(x, { onFinish: m, size: "large", children: [
226
+ /* @__PURE__ */ r(x.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ r(z, { prefix: /* @__PURE__ */ r(Q, {}), placeholder: "用户名" }) }),
227
+ /* @__PURE__ */ r(x.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ r(z.Password, { prefix: /* @__PURE__ */ r(V, {}), placeholder: "密码" }) }),
228
+ /* @__PURE__ */ r(x.Item, { children: /* @__PURE__ */ r(I, { type: "primary", htmlType: "submit", loading: n, block: !0, children: "登 录" }) })
225
229
  ] })
226
230
  ] }) });
227
231
  }
@@ -232,79 +236,81 @@ const L = {
232
236
  approved: { color: "blue", text: "已通过" },
233
237
  rejected: { color: "red", text: "已拒绝" }
234
238
  };
235
- function ie({ status: t, map: e }) {
236
- const o = (e == null ? void 0 : e[t]) || L[t] || { color: "default", text: String(t) };
237
- return /* @__PURE__ */ r(q, { color: o.color, children: o.text });
239
+ function le({ status: e, map: t }) {
240
+ const s = (t == null ? void 0 : t[e]) || L[e] || { color: "default", text: String(e) };
241
+ return /* @__PURE__ */ r(F, { color: s.color, children: s.text });
238
242
  }
239
- class le extends _ {
240
- constructor(e) {
241
- super(e), this.state = { hasError: !1, error: null, errorInfo: null }, this.handleReset = () => {
243
+ class ce extends _ {
244
+ constructor(t) {
245
+ super(t), this.state = { hasError: !1, error: null, errorInfo: null }, this.handleReset = () => {
242
246
  this.setState({ hasError: !1, error: null, errorInfo: null }), typeof this.props.onReset == "function" && this.props.onReset();
243
247
  };
244
248
  }
245
- static getDerivedStateFromError(e) {
246
- return { hasError: !0, error: e };
249
+ static getDerivedStateFromError(t) {
250
+ return { hasError: !0, error: t };
247
251
  }
248
- componentDidCatch(e, o) {
249
- console.error("[ErrorBoundary] caught error:", e, o), this.setState({ errorInfo: o });
252
+ componentDidCatch(t, s) {
253
+ console.error("[ErrorBoundary] caught error:", t, s), this.setState({ errorInfo: s });
250
254
  }
251
255
  render() {
252
- var e;
256
+ var t;
253
257
  return this.state.hasError ? /* @__PURE__ */ r(
254
- F,
258
+ H,
255
259
  {
256
260
  status: "error",
257
261
  title: "页面出错了",
258
- subTitle: String(((e = this.state.error) == null ? void 0 : e.message) || this.state.error),
259
- extra: /* @__PURE__ */ r(k, { type: "primary", onClick: this.handleReset, children: "重试" })
262
+ subTitle: String(((t = this.state.error) == null ? void 0 : t.message) || this.state.error),
263
+ extra: /* @__PURE__ */ r(I, { type: "primary", onClick: this.handleReset, children: "重试" })
260
264
  }
261
265
  ) : this.props.children;
262
266
  }
263
267
  }
264
- const me = {
265
- AppLayout: re,
266
- StatusTag: ie,
268
+ const de = ["get", "post", "put", "patch", "delete", "head", "options"], M = {
269
+ AppLayout: ne,
270
+ StatusTag: le,
267
271
  defaultStatusMap: L,
268
- LoginPage: ae,
269
- ErrorBoundary: le,
270
- request: M,
271
- authRequest: se,
272
+ LoginPage: ie,
273
+ ErrorBoundary: ce,
274
+ request: b,
275
+ authRequest: ae,
272
276
  createRequest: C
273
277
  };
278
+ for (const e of de)
279
+ typeof b[e] == "function" && !(e in M) && (M[e] = (...t) => b[e](...t));
274
280
  export {
275
- re as AppLayout,
276
- xe as CategoryDot,
277
- we as DarkBanner,
278
- Ie as EChartsChart,
279
- ke as EmptyState,
280
- le as ErrorBoundary,
281
+ ne as AppLayout,
282
+ be as CategoryDot,
283
+ we as ComponentDoc,
284
+ ke as DarkBanner,
285
+ Ie as EmptyState,
286
+ ce as ErrorBoundary,
281
287
  Ce as ErrorState,
282
- be as FeatureCard,
283
- Re as GradientStatCard,
284
- ve as LoadingState,
285
- ae as LoginPage,
286
- ze as PageHeader,
287
- Me as PagedTable,
288
+ Re as FeatureCard,
289
+ ve as GradientStatCard,
290
+ ze as LoadingState,
291
+ ie as LoginPage,
292
+ Me as PageHeader,
293
+ Be as PagedTable,
288
294
  Le as RefreshButton,
289
- Ee as SearchInput,
290
- Oe as SectionHeader,
291
- Be as StatusBadge,
292
- ie as StatusTag,
293
- je as TableToolbar,
294
- Te as antdTheme,
295
- se as authRequest,
295
+ Oe as SearchInput,
296
+ je as SectionHeader,
297
+ Ee as StatusBadge,
298
+ le as StatusTag,
299
+ Te as TableToolbar,
300
+ $e as antdTheme,
301
+ ae as authRequest,
296
302
  Ke as brand,
297
303
  C as createRequest,
298
- me as default,
304
+ M as default,
299
305
  L as defaultStatusMap,
300
- $e as fontSize,
301
- De as lift,
302
- Pe as neutral,
303
- qe as palette,
304
- Fe as radius,
305
- M as request,
306
- oe as setupInterceptors,
307
- He as shadow,
308
- We as space,
309
- ne as unwrapResponse
306
+ De as fontSize,
307
+ Pe as lift,
308
+ qe as neutral,
309
+ Fe as palette,
310
+ He as radius,
311
+ b as request,
312
+ se as setupInterceptors,
313
+ We as shadow,
314
+ Ne as space,
315
+ oe as unwrapResponse
310
316
  };
@@ -0,0 +1,54 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { useRef as s, useEffect as u } from "react";
3
+ import * as c from "echarts/core";
4
+ import { LineChart as d, PieChart as p, BarChart as v } from "echarts/charts";
5
+ import { GridComponent as C, TooltipComponent as h, LegendComponent as z, TitleComponent as R } from "echarts/components";
6
+ import { CanvasRenderer as w } from "echarts/renderers";
7
+ c.use([
8
+ d,
9
+ p,
10
+ v,
11
+ C,
12
+ h,
13
+ z,
14
+ R,
15
+ w
16
+ ]);
17
+ function x({
18
+ option: t,
19
+ height: f = 300,
20
+ className: a,
21
+ style: m
22
+ }) {
23
+ const r = s(null), e = s(null);
24
+ return u(() => {
25
+ if (!r.current) return;
26
+ e.current = c.init(r.current, null, { renderer: "canvas" });
27
+ let n;
28
+ const i = () => {
29
+ var o;
30
+ return (o = e.current) == null ? void 0 : o.resize();
31
+ };
32
+ return typeof ResizeObserver < "u" ? (n = new ResizeObserver(i), n.observe(r.current)) : window.addEventListener("resize", i), () => {
33
+ n ? n.disconnect() : window.removeEventListener("resize", i), e.current && (e.current.dispose(), e.current = null);
34
+ };
35
+ }, []), u(() => {
36
+ e.current && t && e.current.setOption(t, { notMerge: !0 });
37
+ }, [t]), /* @__PURE__ */ l(
38
+ "div",
39
+ {
40
+ ref: r,
41
+ className: a,
42
+ role: "img",
43
+ "aria-label": "数据可视化图表",
44
+ style: {
45
+ width: "100%",
46
+ height: f,
47
+ ...m
48
+ }
49
+ }
50
+ );
51
+ }
52
+ export {
53
+ x as EChartsChart
54
+ };
package/dist/ui.js CHANGED
@@ -1,27 +1,27 @@
1
- import { C as e, D as t, E as r, a as d, b as n, F as o, G as S, L as h, P as i, c as l, R as g, S as p, d as u, e as C, T as b, f, g as T, h as c, l as E, n as m, p as B, r as D, s as P, i as y } from "./PagedTable-DyjNokXN.js";
1
+ import { C as s, a as t, D as r, E as o, b as n, F as d, G as S, L as i, P as l, c as p, R as g, S as u, d as b, e as c, T as f, f as h, g as C, h as T, l as m, n as D, p as B, r as E, s as P, i as y } from "./ComponentDoc-C4XFElke.js";
2
2
  export {
3
- e as CategoryDot,
4
- t as DarkBanner,
5
- r as EChartsChart,
6
- d as EmptyState,
3
+ s as CategoryDot,
4
+ t as ComponentDoc,
5
+ r as DarkBanner,
6
+ o as EmptyState,
7
7
  n as ErrorState,
8
- o as FeatureCard,
8
+ d as FeatureCard,
9
9
  S as GradientStatCard,
10
- h as LoadingState,
11
- i as PageHeader,
12
- l as PagedTable,
10
+ i as LoadingState,
11
+ l as PageHeader,
12
+ p as PagedTable,
13
13
  g as RefreshButton,
14
- p as SearchInput,
15
- u as SectionHeader,
16
- C as StatusBadge,
17
- b as TableToolbar,
18
- f as antdTheme,
19
- T as brand,
20
- c as fontSize,
21
- E as lift,
22
- m as neutral,
14
+ u as SearchInput,
15
+ b as SectionHeader,
16
+ c as StatusBadge,
17
+ f as TableToolbar,
18
+ h as antdTheme,
19
+ C as brand,
20
+ T as fontSize,
21
+ m as lift,
22
+ D as neutral,
23
23
  B as palette,
24
- D as radius,
24
+ E as radius,
25
25
  P as shadow,
26
26
  y as space
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuku123/z-frontend-common",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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",
@@ -11,6 +11,9 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "default": "./dist/index.js"
13
13
  },
14
+ "./ui/echarts": {
15
+ "default": "./dist/ui-echarts.js"
16
+ },
14
17
  "./ui": {
15
18
  "default": "./dist/ui.js"
16
19
  }
@@ -22,7 +25,8 @@
22
25
  "scripts": {
23
26
  "build": "vite build",
24
27
  "dev": "vite build --watch",
25
- "prepublishOnly": "vite build"
28
+ "prepublishOnly": "vite build",
29
+ "test": "node --test test/"
26
30
  },
27
31
  "dependencies": {
28
32
  "axios": "^1.16.1"