@baishuyun/ui-business 5.0.0 → 5.0.1

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.
@@ -0,0 +1,212 @@
1
+ import { jsxs as G, jsx as A } from "react/jsx-runtime";
2
+ import { forwardRef as P, useRef as z, useState as X, useImperativeHandle as Y, useEffect as _ } from "react";
3
+ import { i as $ } from "../vendors/echarts.js";
4
+ import { c as S } from "../vendors/clsx.js";
5
+ function E(e, c, l, r) {
6
+ let x = 0, f = 0;
7
+ const y = parseInt(r.fontSize) || 10, u = e.series.map((t) => t.data[0][0].toString()), d = e.series.map((t) => t.data[0][1].toString());
8
+ function h(t) {
9
+ let i = "";
10
+ if (t.fontSize || t.fontFamily || t.fontWeight) {
11
+ let n = "";
12
+ typeof t.fontSize == "string" && (t.fontSize.indexOf("px") !== -1 || t.fontSize.indexOf("rem") !== -1 || t.fontSize.indexOf("em") !== -1) ? n = t.fontSize : isNaN(+t.fontSize) ? n = "12px" : n = t.fontSize + "px", i = [t.fontStyle, t.fontWeight, n, t.fontFamily || "sans-serif"].join(
13
+ " "
14
+ );
15
+ }
16
+ return i && i.trim() || t.textFont || t.font;
17
+ }
18
+ function g(t, i) {
19
+ i.fontSize = parseInt(i.fontSize), i.fontFamily = i.fontFamily || "verdana";
20
+ const n = h(i), a = document.createElement("canvas").getContext("2d") || {};
21
+ return a.font = n, a?.measureText(t)?.width || 0;
22
+ }
23
+ function m(t, i) {
24
+ if (Array.isArray(t))
25
+ for (let n = 0, s = t.length; n < s && i.apply(t[n], [n, t[n]]) !== !1; n++) ;
26
+ else if (t && typeof t == "object") {
27
+ for (const n in t)
28
+ if (Object.prototype.hasOwnProperty.call(t, n) && i.apply(t[n], [n, t[n]]) === !1) break;
29
+ }
30
+ }
31
+ function L() {
32
+ let t = 0;
33
+ if (e.xAxis && e.xAxis.axisLabel) {
34
+ const i = e.xAxis.axisLabel.rotate;
35
+ if (i && i !== 0) {
36
+ let n = 0, s = "";
37
+ if (u && Array.isArray(u) && u.forEach((a) => {
38
+ const o = a;
39
+ o.length > n && (n = o.length, s = o);
40
+ }), n > 0) {
41
+ const a = g(s, e.xAxis.axisLabel), o = Math.abs(i) * Math.PI / 180;
42
+ t = a * Math.sin(o);
43
+ }
44
+ }
45
+ }
46
+ return t;
47
+ }
48
+ function w() {
49
+ let t = 0;
50
+ if (e.yAxis && e.yAxis.axisLabel) {
51
+ const i = e.yAxis.axisLabel.rotate;
52
+ if (i && i !== 0) {
53
+ let n = 0, s = "";
54
+ if (d && Array.isArray(d) && d.forEach((a) => {
55
+ const o = a;
56
+ o.length > n && (n = o.length, s = o);
57
+ }), n > 0) {
58
+ const a = g(s, e.yAxis.axisLabel);
59
+ if (i === 0)
60
+ t = a;
61
+ else if (i === 90)
62
+ t = parseInt(e.yAxis.axisLabel.fontSize) || 12;
63
+ else {
64
+ const o = Math.abs(i) * Math.PI / 180;
65
+ t = a * Math.cos(o);
66
+ }
67
+ t += 10;
68
+ }
69
+ }
70
+ }
71
+ return t;
72
+ }
73
+ function F() {
74
+ let t = 0;
75
+ const i = Array.isArray(c) ? c.length : Object.keys(c || {}).length;
76
+ return i > 10 ? t = 20 : i > 5 && (t = 10), t;
77
+ }
78
+ if (e.legend.type === "scroll")
79
+ return y + 10 + L() + w() + F();
80
+ m(c, (t, i) => {
81
+ const n = g(
82
+ i,
83
+ r || {
84
+ fontFamily: "verdana",
85
+ fontSize: 10,
86
+ fontStyle: "normal",
87
+ fontWeight: "normal"
88
+ }
89
+ );
90
+ f += n + 10 + 14 + 5, f > l && (x++, f = n + 10 + 14 + 5);
91
+ });
92
+ function j() {
93
+ let t = 0;
94
+ if (e.legend.show && e.legend.orient === "vertical") {
95
+ let i = 0;
96
+ m(c, (n, s) => {
97
+ const a = g(
98
+ s,
99
+ r || {
100
+ fontFamily: "verdana",
101
+ fontSize: 10,
102
+ fontStyle: "normal",
103
+ fontWeight: "normal"
104
+ }
105
+ ) + 25;
106
+ i = Math.max(i, a);
107
+ }), (e.legend.left === "left" || e.legend.left === "right" || e.legend.right === "left" || e.legend.right === "right") && (t = i + 20);
108
+ }
109
+ return t;
110
+ }
111
+ const b = j(), H = (x + 1) * (y + 10), O = L(), W = w();
112
+ let R = -5, C = -5, T = -5, I = -5;
113
+ const M = () => {
114
+ let t = 20;
115
+ return e.xAxis.position === "bottom" && (t += O + 10), e.legend.show && (e.legend.top === "bottom" || e.legend.top === "") && (R += H, t += H), e.xAxis.title !== "" && e.xAxis.position === "bottom" && (t = t + 30), t;
116
+ }, k = () => {
117
+ let t = 20;
118
+ return e.xAxis.position === "top" && (t += O + 10), e.legend.show && e.legend.top === "top" && (C += H, t += H), e.xAxis.title !== "" && e.xAxis.position === "top" && (t = t + 30), t;
119
+ }, N = () => {
120
+ let t = 20;
121
+ return e.yAxis.position === "left" && (t += W), e.legend.show && e.legend.left === "left" && (T += b, t += b), e.yAxis.title !== "" && e.yAxis.position === "left" && (t = t + 10), t;
122
+ }, B = () => {
123
+ let t = 20 + W;
124
+ return e.yAxis.position === "right" && (t += 10), e.legend.show && e.legend.left === "right" && (I += b, t += b), e.yAxis.title !== "" && e.yAxis.position === "right" && (t = t + 30), t;
125
+ };
126
+ return {
127
+ grid: {
128
+ top: k(),
129
+ bottom: M(),
130
+ left: N(),
131
+ right: B()
132
+ },
133
+ titleBottomHeight: R,
134
+ titleTopHeight: C,
135
+ titleLeftHeight: T,
136
+ titleRightHeight: I
137
+ };
138
+ }
139
+ const v = {
140
+ "auto-grid-echart": "_auto-grid-echart_w04s7_1",
141
+ "xAxis-title": "_xAxis-title_w04s7_6",
142
+ "yAxis-title": "_yAxis-title_w04s7_11"
143
+ }, q = (e, c) => {
144
+ const l = z(null), r = z(null), x = z(null), [f, y] = X({}), u = e.dataList.map((h) => h.name), d = () => l.current ? (y(
145
+ E(
146
+ e.option,
147
+ u,
148
+ l.current.offsetWidth,
149
+ e.option.legend.textStyle
150
+ )
151
+ ), {
152
+ ...e.option,
153
+ grid: E(
154
+ e.option,
155
+ u,
156
+ l.current.offsetWidth,
157
+ e.option.legend.textStyle
158
+ ).grid
159
+ }) : {
160
+ ...e.option
161
+ };
162
+ return Y(c, () => ({
163
+ resizeEchart: () => {
164
+ r.current?.resize();
165
+ }
166
+ })), _(() => {
167
+ if (!l.current) return;
168
+ r.current = $(l.current);
169
+ const h = d();
170
+ r.current.setOption(h, !0), r.current.on("click", function(m) {
171
+ e.onChartClick && e.onChartClick(m, e.options, e.dataList);
172
+ });
173
+ const g = () => {
174
+ if (r.current) {
175
+ const m = d();
176
+ r.current.setOption(m, !1);
177
+ }
178
+ };
179
+ return setTimeout(g, 100), e.onChartReady && e.onChartReady(r.current), x.current = new ResizeObserver(() => {
180
+ r.current?.resize(), setTimeout(g, 50);
181
+ }), l.current && x.current.observe(l.current), () => {
182
+ x.current?.disconnect(), r.current?.dispose();
183
+ };
184
+ }, []), _(() => {
185
+ if (!r.current) return;
186
+ const h = d();
187
+ r.current.setOption(h, !0);
188
+ }, [e.option]), /* @__PURE__ */ G("div", { className: S(e.className, v["auto-grid-echart"]), children: [
189
+ /* @__PURE__ */ A("div", { ref: l, style: { width: "100%", height: "100%", ...e.style } }),
190
+ /* @__PURE__ */ A(
191
+ "div",
192
+ {
193
+ className: S(v["xAxis-title"]),
194
+ style: e.option.xAxis?.position === "bottom" ? {
195
+ bottom: f.titleBottomHeight + 20
196
+ } : e.option.xAxis?.position === "top" ? { top: f.titleTopHeight + 20 } : void 0,
197
+ children: /* @__PURE__ */ A("span", { children: e.option.xAxis?.title })
198
+ }
199
+ ),
200
+ /* @__PURE__ */ A(
201
+ "div",
202
+ {
203
+ className: S(v["yAxis-title"]),
204
+ style: e.option.yAxis?.position === "left" ? { left: f.titleLeftHeight } : e.option.yAxis?.position === "right" ? { right: f.titleRightHeight + 20 } : void 0,
205
+ children: /* @__PURE__ */ A("span", { children: e.option.yAxis?.title })
206
+ }
207
+ )
208
+ ] });
209
+ }, U = P(q);
210
+ export {
211
+ U as A
212
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as h } from "react/jsx-runtime";
2
2
  import { forwardRef as y, useRef as v, useImperativeHandle as m } from "react";
3
3
  import { R as A } from "../vendors/echarts.js";
4
- import { A as S } from "./AutoGridEChart-DubWMmib.js";
4
+ import { A as S } from "./AutoGridEChart-vNNqSiqF.js";
5
5
  const w = (t, g) => {
6
6
  const r = v(null), c = (o) => {
7
7
  const n = {
@@ -22,7 +22,7 @@ const w = (t, g) => {
22
22
  color: "#666666",
23
23
  fontSize: 10,
24
24
  show: !0,
25
- rotate: t.options.xAxis?.label?.rotation || 45
25
+ rotate: t.options.xAxis?.label?.rotation + " " || 45
26
26
  // 文字顺时针旋转 90°(完全竖向)
27
27
  },
28
28
  min: t.options.xAxis?.min || void 0,
@@ -37,7 +37,7 @@ const w = (t, g) => {
37
37
  color: "#666666",
38
38
  fontSize: 10,
39
39
  show: !0,
40
- rotate: t.options.yAxis?.label?.rotation || 45
40
+ rotate: t.options.yAxis?.label?.rotation + " " || 45
41
41
  // 文字顺时针旋转 90°(完全竖向)
42
42
  },
43
43
  min: t.options.yAxis?.min || void 0,
@@ -151,8 +151,8 @@ const w = (t, g) => {
151
151
  },
152
152
  label: {
153
153
  show: !0,
154
- position: "end",
155
- // 标签位置:start/middle/end
154
+ position: "insideEndTop",
155
+ // 标签位置:insideStartTop/insideEndTop/insideStartBottom/insideEndBottom
156
156
  formatter: (a) => {
157
157
  if (e.is_label_visible && e.is_value_visible)
158
158
  return e.label + ":" + a.value;
@@ -163,7 +163,9 @@ const w = (t, g) => {
163
163
  },
164
164
  // 格式化文本({b}名称,{c}数值)
165
165
  fontSize: 12,
166
- color: e.color
166
+ color: e.color,
167
+ distance: 5
168
+ // 标签与线的距离
167
169
  }
168
170
  };
169
171
  return e.type === "fixed" && (e.field === t.options.xFields[0].tag && (i.xAxis = e.value || 0), e.field === t.options.yFields[0].tag && (i.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === t.options.xFields[0].tag && (e.aggregate === "max" && (i.xAxis = l.max), e.aggregate === "min" && (i.xAxis = l.min), e.aggregate === "avg" && (i.xAxis = l.avg)), e.field === t.options.yFields[0].tag && (e.aggregate === "max" && (i.yAxis = s.max), e.aggregate === "min" && (i.yAxis = s.min), e.aggregate === "avg" && (i.yAxis = s.avg)), i.type = e.aggregate), i;
@@ -172,10 +174,9 @@ const w = (t, g) => {
172
174
  color: f.find((e) => e.title === o.name) ? f.find((e) => e.title === o.name).color : "",
173
175
  label: {
174
176
  show: t.options.chart_label.enable,
175
- position: "top",
176
- // 文本在气泡上方
177
177
  distance: 5,
178
178
  // 与气泡的距离(避免紧贴)
179
+ position: "top",
179
180
  formatter: () => `${t.options.chart_label.dimension?.enable ? o.name : ""} ${t.options.chart_label.value?.enable ? "(" + o.data[0] + "," + o.data[1] + ")" : ""}`,
180
181
  textStyle: {
181
182
  fontSize: 11,
@@ -1,4 +1,4 @@
1
- import { B as r } from "./BubbleChart-BdkNCriz.js";
1
+ import { B as r } from "./BubbleChart-B0AuH-ma.js";
2
2
  export {
3
3
  r as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as y } from "react/jsx-runtime";
2
2
  import { forwardRef as b, useRef as v, useImperativeHandle as m } from "react";
3
- import { A } from "../BubbleChart/AutoGridEChart-DubWMmib.js";
3
+ import { A } from "../BubbleChart/AutoGridEChart-vNNqSiqF.js";
4
4
  const S = (t, c) => {
5
5
  const d = v(null), f = (i) => {
6
6
  const n = {
@@ -144,8 +144,8 @@ const S = (t, c) => {
144
144
  },
145
145
  label: {
146
146
  show: !0,
147
- position: "end",
148
- // 标签位置:start/middle/end
147
+ position: "insideEndTop",
148
+ // 标签位置:insideStartTop/insideEndTop/insideStartBottom/insideEndBottom
149
149
  formatter: (a) => {
150
150
  if (e.is_label_visible && e.is_value_visible)
151
151
  return e.label + ":" + a.value;
@@ -1,4 +1,4 @@
1
- import { S as a } from "./Scatterplot-Dgn4nPTN.js";
1
+ import { S as a } from "./Scatterplot-D8AUUxhA.js";
2
2
  export {
3
3
  a as default
4
4
  };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "./vendors/simplebar-react.js";
2
2
  import { D as B, g as I } from "./DeptsMember/DeptsMember-BNuoQ8y4.js";
3
3
  import { C as k } from "./ConfigProvider/ConfigProvider-CAq3dN6-.js";
4
- import { B as D } from "./BubbleChart/BubbleChart-BdkNCriz.js";
5
- import { S as H } from "./Scatterplot/Scatterplot-Dgn4nPTN.js";
4
+ import { B as D } from "./BubbleChart/BubbleChart-B0AuH-ma.js";
5
+ import { S as H } from "./Scatterplot/Scatterplot-D8AUUxhA.js";
6
6
  import { jsxs as r, jsx as o } from "react/jsx-runtime";
7
7
  import { i as _ } from "./vendors/echarts.js";
8
8
  import { forwardRef as v, useRef as b, useEffect as L, useImperativeHandle as y } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ui-business",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "百数云业务组件库",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "author": "BSY Team",
40
40
  "license": "MIT",
41
41
  "peerDependencies": {
42
- "@baishuyun/ui-base": ">=2.3.0",
42
+ "@baishuyun/ui-base": ">=3.0.0",
43
43
  "ahooks": ">=3.7.0",
44
44
  "antd": ">=5.1.2",
45
45
  "immer": "^10.0.0",
@@ -63,7 +63,7 @@
63
63
  "sass": "^1.90.0",
64
64
  "vite": "^7.0.0",
65
65
  "vite-plugin-dts": "^4.5.4",
66
- "@baishuyun/ui-base": "2.3.0"
66
+ "@baishuyun/ui-base": "2.3.1"
67
67
  },
68
68
  "dependencies": {
69
69
  "autoprefixer": "^10.4.21",
@@ -1,126 +0,0 @@
1
- import { jsxs as y, jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as O, useRef as h, useState as S, useImperativeHandle as w, useEffect as p } from "react";
3
- import { i as C } from "../vendors/echarts.js";
4
- import { c as m } from "../vendors/clsx.js";
5
- function v(t, x, s, o) {
6
- let c = 0, a = 0;
7
- const f = parseInt(o.fontSize) || 10;
8
- function u(e) {
9
- let n = "";
10
- if (e.fontSize || e.fontFamily || e.fontWeight) {
11
- let i = "";
12
- typeof e.fontSize == "string" && (e.fontSize.indexOf("px") !== -1 || e.fontSize.indexOf("rem") !== -1 || e.fontSize.indexOf("em") !== -1) ? i = e.fontSize : isNaN(+e.fontSize) ? i = "12px" : i = e.fontSize + "px", n = [e.fontStyle, e.fontWeight, i, e.fontFamily || "sans-serif"].join(
13
- " "
14
- );
15
- }
16
- return n && n.trim() || e.textFont || e.font;
17
- }
18
- function l(e, n) {
19
- n.fontSize = parseInt(n.fontSize), n.fontFamily = n.fontFamily || "verdana";
20
- const i = u(n), z = document.createElement("canvas").getContext("2d") || {};
21
- return z.font = i, z?.measureText(e)?.width || 0;
22
- }
23
- function r(e, n) {
24
- if (Array.isArray(e))
25
- for (let i = 0, A = e.length; i < A && n.apply(e[i], [i, e[i]]) !== !1; i++) ;
26
- else if (e && typeof e == "object") {
27
- for (const i in e)
28
- if (Object.prototype.hasOwnProperty.call(e, i) && n.apply(e[i], [i, e[i]]) === !1) break;
29
- }
30
- }
31
- return t.legend.type === "scroll" ? f + 10 : (r(x, (e, n) => {
32
- const i = l(
33
- n,
34
- o || {
35
- fontFamily: "verdana",
36
- fontSize: 10,
37
- fontStyle: "normal",
38
- fontWeight: "normal"
39
- }
40
- );
41
- a += i + 10 + 14 + 5, a > s && (c++, a = i + 10 + 14 + 5);
42
- }), (c + 1) * (f + 10));
43
- }
44
- const g = {
45
- "auto-grid-echart": "_auto-grid-echart_w04s7_1",
46
- "xAxis-title": "_xAxis-title_w04s7_6",
47
- "yAxis-title": "_yAxis-title_w04s7_11"
48
- }, b = (t, x) => {
49
- const s = h(null), o = h(null), c = h(null), [a, f] = S("10px"), u = t.dataList.map((r) => r.name), l = () => {
50
- if (s.current) {
51
- let r = v(
52
- t.option,
53
- u,
54
- s.current.offsetWidth,
55
- t.option.legend.textStyle
56
- ) + 30;
57
- return t.options.legend.position === t.options.xAxis.position ? f(
58
- v(
59
- t.option,
60
- u,
61
- s.current.offsetWidth,
62
- t.option.legend.textStyle
63
- ) + 10
64
- ) : f("0"), t.options.xAxis?.title.text && t.options.xAxis?.title.text.length > 0 && t.options.legend.position === t.options.xAxis.position && (r += 30), {
65
- ...t.option,
66
- grid: {
67
- top: t.options.legend.position === "top" ? r : 40,
68
- bottom: t.options.legend.position === "bottom" ? r : 40,
69
- left: t.options.legend.position === "left" ? r : 40,
70
- right: t.options.legend.position === "right" ? r : 40
71
- }
72
- };
73
- }
74
- return {
75
- ...t.option
76
- };
77
- };
78
- return w(x, () => ({
79
- resizeEchart: () => {
80
- o.current?.resize();
81
- }
82
- })), p(() => {
83
- if (!s.current) return;
84
- o.current = C(s.current);
85
- const r = l();
86
- o.current.setOption(r, !0), o.current.on("click", function(n) {
87
- t.onChartClick && t.onChartClick(n, t.options, t.dataList);
88
- });
89
- const e = () => {
90
- if (o.current) {
91
- const n = l();
92
- o.current.setOption(n, !1);
93
- }
94
- };
95
- return setTimeout(e, 100), t.onChartReady && t.onChartReady(o.current), c.current = new ResizeObserver(() => {
96
- o.current?.resize(), setTimeout(e, 50);
97
- }), s.current && c.current.observe(s.current), () => {
98
- c.current?.disconnect(), o.current?.dispose();
99
- };
100
- }, []), p(() => {
101
- if (!o.current) return;
102
- const r = l();
103
- o.current.setOption(r, !0);
104
- }, [t.option]), /* @__PURE__ */ y("div", { className: m(t.className, g["auto-grid-echart"]), children: [
105
- /* @__PURE__ */ d("div", { ref: s, style: { width: "100%", height: "100%", ...t.style } }),
106
- /* @__PURE__ */ d(
107
- "div",
108
- {
109
- className: m(g["xAxis-title"]),
110
- style: t.option.xAxis?.position === "bottom" ? { bottom: a } : t.option.xAxis?.position === "top" ? { top: a } : void 0,
111
- children: /* @__PURE__ */ d("span", { children: t.option.xAxis?.title })
112
- }
113
- ),
114
- /* @__PURE__ */ d(
115
- "div",
116
- {
117
- className: m(g["yAxis-title"]),
118
- style: t.option.yAxis?.position === "left" ? { left: "20px" } : t.option.yAxis?.position === "right" ? { right: "20px" } : void 0,
119
- children: /* @__PURE__ */ d("span", { children: t.option.yAxis?.title })
120
- }
121
- )
122
- ] });
123
- }, R = O(b);
124
- export {
125
- R as A
126
- };