@baishuyun/ui-business 5.1.5 → 5.1.6

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.
@@ -19,9 +19,10 @@ function l(e, t, n, r, i) {
19
19
  return t && t.trim() || e.textFont || e.font;
20
20
  }
21
21
  function f(e, t) {
22
- t.fontSize = parseInt(t.fontSize), t.fontFamily = t.fontFamily || "verdana";
23
- let n = d(t), r = document.createElement("canvas").getContext("2d") || {};
24
- return r.font = n, r?.measureText(e)?.width || 0;
22
+ let n = { ...t };
23
+ n.fontSize = parseInt(n.fontSize), n.fontFamily = n.fontFamily || "verdana";
24
+ let r = d(n), i = document.createElement("canvas").getContext("2d") || {};
25
+ return i.font = r, i?.measureText(e)?.width || 0;
25
26
  }
26
27
  function p(e, t) {
27
28
  if (Array.isArray(e)) for (let n = 0, r = e.length; n < r && t.apply(e[n], [n, e[n]]) !== !1; n++);
@@ -74,52 +75,53 @@ function l(e, t, n, r, i) {
74
75
  return n > 10 ? e = 20 : n > 5 && (e = 10), e;
75
76
  }
76
77
  if (e.legend.type === "scroll") return s + 10 + m() + h() + g();
78
+ let _ = e.legend.itemWidth || 25, v = e.legend.itemGap ?? 10;
77
79
  p(t, (e, t) => {
78
80
  let i = f(t, r || {
79
81
  fontFamily: "verdana",
80
82
  fontSize: 10,
81
83
  fontStyle: "normal",
82
84
  fontWeight: "normal"
83
- });
84
- o += i + 10 + 14 + 5, o > n && (a++, o = i + 10 + 14 + 5);
85
+ }) + v + _ + 5;
86
+ o > 0 && o + i > n ? (a++, o = i) : o += i;
85
87
  });
86
- function _(e, t, n, r) {
87
- let i = r.legend;
88
- if (!i.show) return 0;
89
- let a = n.itemHeight + n.padding, o = i.itemWidth || 12, s = e.map((e) => e.name || e), c = (e) => {
90
- let t = (e.match(/[\u4e00-\u9fa5]/g) || []).length, n = e.length - t;
91
- return t * 12 + n * 7;
92
- };
93
- if (r.legend.left === "left" || r.legend.right === "right") {
94
- let n = Math.max(...s.map((e) => c(e))), r = o + 5 + n;
95
- return Math.ceil(a * e.length / t) * (r + 10) + 20;
88
+ function y(e, t, n, i) {
89
+ let a = i.legend;
90
+ if (!a.show) return 0;
91
+ let o = n.itemHeight || 25, s = n.itemGap ?? 10, c = a.itemWidth || 25, l = e.map((e) => e.name || e), u = n.textStyle || r || {
92
+ fontSize: 12,
93
+ fontFamily: "verdana"
94
+ }, d = (e) => f(e, u);
95
+ if (i.legend.left === "left" || i.legend.right === "right") {
96
+ let n = Math.max(0, ...l.map((e) => d(e))), r = c + 5 + n;
97
+ return Math.ceil(o * e.length / t) * (r + s) + 20;
96
98
  }
97
99
  return 0;
98
100
  }
99
- let v = _(u, i, e.legend, e), y = (a + 1) * (s + 10), b = m(), x = h(), S = -5, C = -5, w = -5, T = -5;
101
+ let b = y(u, i, e.legend, e), x = e.legend.itemHeight || 25, S = e.legend.itemGap ?? 10, C = typeof e.legend.padding == "number" ? e.legend.padding : Array.isArray(e.legend.padding) ? e.legend.padding[0] ?? 5 : 5, w = (a + 1) * x + a * S + C * 2, T = m(), E = h(), D = -5, O = -5, k = -5, A = -5;
100
102
  return {
101
103
  grid: {
102
104
  top: (() => {
103
105
  let t = 20;
104
- return e.xAxis.position === "top" && (t += b + 10), e.legend.show && e.legend.top === "top" && (C += y, t += y), e.xAxis.title !== "" && e.xAxis.position === "top" && (t += 30), t;
106
+ return e.xAxis.position === "top" && (t += T + 10), e.legend.show && (e.legend.top === "top" || e.legend.top === "") && (O += w, t += w), e.xAxis.title !== "" && e.xAxis.position === "top" && (t += 30), t;
105
107
  })(),
106
108
  bottom: (() => {
107
109
  let t = 20;
108
- return e.xAxis.position === "bottom" && (t += b + 10), e.legend.show && (e.legend.top === "bottom" || e.legend.top === "") && (S += y, t += y), e.xAxis.title !== "" && e.xAxis.position === "bottom" && (t += 30), t;
110
+ return e.xAxis.position === "bottom" && (t += T + 10), e.legend.show && e.legend.top === "bottom" && (D += w, t += w), e.xAxis.title !== "" && e.xAxis.position === "bottom" && (t += 30), t;
109
111
  })(),
110
112
  left: (() => {
111
113
  let t = 20;
112
- return e.yAxis.position === "left" && (t += x), e.legend.show && e.legend.left === "left" && (w += v, t += v), e.yAxis.title !== "" && e.yAxis.position === "left" && (t += 10), t;
114
+ return e.yAxis.position === "left" && (t += E), e.legend.show && e.legend.left === "left" && (k += b, t += b), e.yAxis.title !== "" && e.yAxis.position === "left" && (t += 10), t;
113
115
  })(),
114
116
  right: (() => {
115
- let t = 20 + x;
116
- return e.yAxis.position === "right" && (t += 10), e.legend.show && e.legend.left === "right" && (T += v, t += v), e.yAxis.title !== "" && e.yAxis.position === "right" && (t += 30), t;
117
+ let t = 20;
118
+ return e.yAxis.position === "right" && (t += E + 10), e.legend.show && e.legend.left === "right" && (A += b, t += b), e.yAxis.title !== "" && e.yAxis.position === "right" && (t += 30), t;
117
119
  })()
118
120
  },
119
- titleBottomHeight: S,
120
- titleTopHeight: C,
121
- titleLeftHeight: w,
122
- titleRightHeight: T
121
+ titleBottomHeight: D,
122
+ titleTopHeight: O,
123
+ titleLeftHeight: k,
124
+ titleRightHeight: A
123
125
  };
124
126
  }
125
127
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { n as e } from "../vendors/echarts.js";
2
- import { t } from "./AutoGridEChart-B2a7zGgi.js";
2
+ import { t } from "./AutoGridEChart-nA3DwlqB.js";
3
3
  import { forwardRef as n, useImperativeHandle as r, useRef as i } from "react";
4
4
  import { jsx as a } from "react/jsx-runtime";
5
5
  var o = n((n, o) => {
@@ -80,6 +80,7 @@ var o = n((n, o) => {
80
80
  padding: 10,
81
81
  itemWidth: 12,
82
82
  itemHeight: 14,
83
+ type: n.options.legend.type || "plain",
83
84
  textStyle: { fontStyle: "normal" }
84
85
  },
85
86
  graphic: n.options.guideline?.map((e) => ({
@@ -125,7 +126,7 @@ var o = n((n, o) => {
125
126
  distance: 5
126
127
  }
127
128
  };
128
- return e.type === "fixed" && (e.field === n.options.xFields[0].tag && (t.xAxis = e.value || 0), e.field === n.options.yFields[0].tag && (t.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === n.options.xFields[0].tag && (e.aggregate === "max" && (t.xAxis = d.max), e.aggregate === "min" && (t.xAxis = d.min), e.aggregate === "avg" && (t.xAxis = d.avg)), e.field === n.options.yFields[0].tag && (e.aggregate === "max" && (t.yAxis = f.max), e.aggregate === "min" && (t.yAxis = f.min), e.aggregate === "avg" && (t.yAxis = f.avg)), t.type = e.aggregate), t;
129
+ return e.type === "fixed" && (e.field === n.options.xFields[0].tag && (t.xAxis = e.value || 0), (e.field === n.options.yFields[0].tag || e.field === "") && (t.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === n.options.xFields[0].tag && (e.aggregate === "max" && (t.xAxis = d.max), e.aggregate === "min" && (t.xAxis = d.min), e.aggregate === "avg" && (t.xAxis = d.avg)), e.field === n.options.yFields[0].tag && (e.aggregate === "max" && (t.yAxis = f.max), e.aggregate === "min" && (t.yAxis = f.min), e.aggregate === "avg" && (t.yAxis = f.avg)), t.type = e.aggregate), t;
129
130
  })
130
131
  },
131
132
  color: p.find((e) => e.title === t.name) ? p.find((e) => e.title === t.name).color : "",
@@ -1,6 +1,6 @@
1
1
  import "../vendors/echarts.js";
2
- import "./AutoGridEChart-B2a7zGgi.js";
3
- import { t as e } from "./BubbleChart-BPIsaE-C.js";
2
+ import "./AutoGridEChart-nA3DwlqB.js";
3
+ import { t as e } from "./BubbleChart-Bq-qzSTk.js";
4
4
  //#region src/components/BubbleChart/index.ts
5
5
  var t = e;
6
6
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as e } from "../BubbleChart/AutoGridEChart-B2a7zGgi.js";
1
+ import { t as e } from "../BubbleChart/AutoGridEChart-nA3DwlqB.js";
2
2
  import { forwardRef as t, useImperativeHandle as n, useRef as r } from "react";
3
3
  import { jsx as i } from "react/jsx-runtime";
4
4
  var a = t((t, a) => {
@@ -73,6 +73,7 @@ var a = t((t, a) => {
73
73
  padding: 10,
74
74
  itemWidth: 12,
75
75
  itemHeight: 14,
76
+ type: t.options.legend.type || "plain",
76
77
  textStyle: { fontStyle: "normal" }
77
78
  },
78
79
  graphic: t.options.guideline?.map((e) => ({
@@ -117,7 +118,7 @@ var a = t((t, a) => {
117
118
  color: e.color
118
119
  }
119
120
  };
120
- return e.type === "fixed" && (e.field === t.options.xFields[0].tag && (n.xAxis = e.value || 0), e.field === t.options.yFields[0].tag && (n.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === t.options.xFields[0].tag && (e.aggregate === "max" && (n.xAxis = u.max), e.aggregate === "min" && (n.xAxis = u.min), e.aggregate === "avg" && (n.xAxis = u.avg)), e.field === t.options.yFields[0].tag && (e.aggregate === "max" && (n.yAxis = d.max), e.aggregate === "min" && (n.yAxis = d.min), e.aggregate === "avg" && (n.yAxis = d.avg)), n.type = e.aggregate), n;
121
+ return e.type === "fixed" && (e.field === t.options.xFields[0].tag && (n.xAxis = e.value || 0), (e.field === t.options.yFields[0].tag || e.field === "") && (n.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === t.options.xFields[0].tag && (e.aggregate === "max" && (n.xAxis = u.max), e.aggregate === "min" && (n.xAxis = u.min), e.aggregate === "avg" && (n.xAxis = u.avg)), e.field === t.options.yFields[0].tag && (e.aggregate === "max" && (n.yAxis = d.max), e.aggregate === "min" && (n.yAxis = d.min), e.aggregate === "avg" && (n.yAxis = d.avg)), n.type = e.aggregate), n;
121
122
  })
122
123
  },
123
124
  color: f.find((t) => t.title === e.name) ? f.find((t) => t.title === e.name).color : "",
@@ -1,6 +1,6 @@
1
1
  import "../vendors/echarts.js";
2
- import "../BubbleChart/AutoGridEChart-B2a7zGgi.js";
3
- import { t as e } from "./Scatterplot-C1XSsAKR.js";
2
+ import "../BubbleChart/AutoGridEChart-nA3DwlqB.js";
3
+ import { t as e } from "./Scatterplot-COVrzURp.js";
4
4
  //#region src/components/Scatterplot/index.ts
5
5
  var t = e;
6
6
  //#endregion
@@ -48,6 +48,7 @@ type BubbleChartConfig = {
48
48
  legend: {
49
49
  enable: boolean;
50
50
  position: string;
51
+ type?: string;
51
52
  };
52
53
  guideline?: Array<{
53
54
  label: string;
@@ -41,6 +41,7 @@ type ScatterplotConfig = {
41
41
  legend: {
42
42
  enable: boolean;
43
43
  position: string;
44
+ type?: string;
44
45
  };
45
46
  guideline?: Array<{
46
47
  label: string;
package/dist/index.js CHANGED
@@ -15,9 +15,9 @@ import "./DeptsMemberSelector/Member-B4tEHksu.js";
15
15
  import "./DeptsMemberSelector/Department-12ftZfXD.js";
16
16
  import { t as s } from "./ConfigProvider/ConfigProvider-C0c1mKeR.js";
17
17
  import { t as c } from "./vendors/echarts.js";
18
- import "./BubbleChart/AutoGridEChart-B2a7zGgi.js";
19
- import { t as l } from "./BubbleChart/BubbleChart-BPIsaE-C.js";
20
- import { t as u } from "./Scatterplot/Scatterplot-C1XSsAKR.js";
18
+ import "./BubbleChart/AutoGridEChart-nA3DwlqB.js";
19
+ import { t as l } from "./BubbleChart/BubbleChart-Bq-qzSTk.js";
20
+ import { t as u } from "./Scatterplot/Scatterplot-COVrzURp.js";
21
21
  import { forwardRef as d, useEffect as f, useImperativeHandle as p, useRef as m } from "react";
22
22
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
23
23
  //#region src/components/ProgressChart/ProgressChart.module.scss
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ui-business",
3
- "version": "5.1.5",
3
+ "version": "5.1.6",
4
4
  "description": "百数云业务组件库",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "author": "BSY Team",
44
44
  "license": "MIT",
45
45
  "peerDependencies": {
46
- "@baishuyun/ui-base": ">=2.3.3",
46
+ "@baishuyun/ui-base": ">=2.3.4",
47
47
  "ahooks": ">=3.7.0",
48
48
  "antd": ">=5.1.2",
49
49
  "immer": "^10.0.0",
@@ -67,7 +67,7 @@
67
67
  "sass": "^1.90.0",
68
68
  "vite": "^8.0.0",
69
69
  "vite-plugin-dts": "^4.5.4",
70
- "@baishuyun/ui-base": "2.3.3"
70
+ "@baishuyun/ui-base": "2.3.4"
71
71
  },
72
72
  "dependencies": {
73
73
  "autoprefixer": "^10.4.21",