mrxy-yk 1.9.7 → 1.9.9
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,15 +0,0 @@
|
|
|
1
|
-
import { TableColumnCtx } from 'element-plus';
|
|
2
|
-
export namespace TableSlot {
|
|
3
|
-
export type Default<T> = {
|
|
4
|
-
row: T,
|
|
5
|
-
column: TableColumnCtx<T>,
|
|
6
|
-
$index: number
|
|
7
|
-
}
|
|
8
|
-
export type D<T> = TableSlot.Default<Partial<T>>
|
|
9
|
-
|
|
10
|
-
export type Header<T> = {
|
|
11
|
-
column: TableColumnCtx<T>,
|
|
12
|
-
$index: number
|
|
13
|
-
}
|
|
14
|
-
export type H<T> = TableSlot.Header<Partial<T>>
|
|
15
|
-
}
|
|
@@ -5,13 +5,22 @@ import { PieSeriesOption } from 'echarts';
|
|
|
5
5
|
* 饼图配置
|
|
6
6
|
*/
|
|
7
7
|
export declare class EcPieOption extends EcBasicOption {
|
|
8
|
+
/**
|
|
9
|
+
* 单位
|
|
10
|
+
*/
|
|
8
11
|
unit?: string;
|
|
9
12
|
/**
|
|
10
13
|
* 格式化图例
|
|
11
14
|
* {name}{unit}{value}{percent}
|
|
12
15
|
*/
|
|
13
16
|
lengthFormatter?: PieModule.ConstructorOption['lengthFormatter'];
|
|
17
|
+
/**
|
|
18
|
+
* 是否显示中心标签数据
|
|
19
|
+
*/
|
|
14
20
|
showCenterLabelData?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 中心标签数据
|
|
23
|
+
*/
|
|
15
24
|
centerLabelData: number;
|
|
16
25
|
constructor(option?: PieModule.ConstructorOption);
|
|
17
26
|
/**
|
|
@@ -9,13 +9,22 @@ import "echarts";
|
|
|
9
9
|
* 饼图配置
|
|
10
10
|
*/
|
|
11
11
|
var EcPieOption = class extends EcBasicOption {
|
|
12
|
+
/**
|
|
13
|
+
* 单位
|
|
14
|
+
*/
|
|
12
15
|
unit = void 0;
|
|
13
16
|
/**
|
|
14
17
|
* 格式化图例
|
|
15
18
|
* {name}{unit}{value}{percent}
|
|
16
19
|
*/
|
|
17
20
|
lengthFormatter = void 0;
|
|
21
|
+
/**
|
|
22
|
+
* 是否显示中心标签数据
|
|
23
|
+
*/
|
|
18
24
|
showCenterLabelData = false;
|
|
25
|
+
/**
|
|
26
|
+
* 中心标签数据
|
|
27
|
+
*/
|
|
19
28
|
centerLabelData = 0;
|
|
20
29
|
constructor(option) {
|
|
21
30
|
const { unit, name, lengthFormatter, showCenterLabelData, labelDataFractionDigits = 2, labelFormatter, series: seriesOption = {}, option: ecOptionBasicOption } = option || {};
|
|
@@ -38,7 +47,7 @@ var EcPieOption = class extends EcBasicOption {
|
|
|
38
47
|
show: true,
|
|
39
48
|
position: "center",
|
|
40
49
|
formatter: (e) => {
|
|
41
|
-
let ret = `{total|${this.centerLabelData}}`;
|
|
50
|
+
let ret = `{total|${this.centerLabelData.toFixed(labelDataFractionDigits)}}`;
|
|
42
51
|
if (unit) ret += `\n{unit|${unit}}`;
|
|
43
52
|
if (name) ret += `\n{name|${name}}`;
|
|
44
53
|
return ret;
|
|
@@ -57,10 +66,15 @@ var EcPieOption = class extends EcBasicOption {
|
|
|
57
66
|
seriesOption.label = ObjectUtil.assignDeep(seriesLabel, seriesOption.label || {});
|
|
58
67
|
const series = [new EcPieSeries({
|
|
59
68
|
unit,
|
|
60
|
-
series:
|
|
69
|
+
series: {
|
|
70
|
+
center: option.center,
|
|
71
|
+
radius: option.radius,
|
|
72
|
+
...seriesOption
|
|
73
|
+
}
|
|
61
74
|
})];
|
|
62
75
|
delete option?.option?.series;
|
|
63
76
|
const defaultOption = assignEcOptionBasicOption({
|
|
77
|
+
color: option.color,
|
|
64
78
|
legend: [{
|
|
65
79
|
right: 15,
|
|
66
80
|
top: "center",
|
|
@@ -81,7 +95,11 @@ var EcPieOption = class extends EcBasicOption {
|
|
|
81
95
|
*/
|
|
82
96
|
setSeriesData(data) {
|
|
83
97
|
if (this.ec) {
|
|
84
|
-
const
|
|
98
|
+
const series = this.currentOption.series[0];
|
|
99
|
+
const option = { series: [{
|
|
100
|
+
data,
|
|
101
|
+
label: series instanceof EcPieSeries ? series.seriesOption?.label : series?.label
|
|
102
|
+
}] };
|
|
85
103
|
const sum = data.reduce((ret, item) => {
|
|
86
104
|
const value = Number(item.value);
|
|
87
105
|
return ret + (Number.isNaN(value) ? 0 : value);
|
|
@@ -100,8 +118,8 @@ var EcPieOption = class extends EcBasicOption {
|
|
|
100
118
|
return this.lengthFormatter.replace(/\{name}/g, name).replace(/\{unit}/g, this.unit || "").replace(/\{value}/g, dataDic[name].value).replace(/\{percent}/g, percent);
|
|
101
119
|
} };
|
|
102
120
|
}
|
|
103
|
-
this.ec.setOption(option);
|
|
104
121
|
this.centerLabelData = sum;
|
|
122
|
+
this.ec.setOption(option);
|
|
105
123
|
return sum;
|
|
106
124
|
}
|
|
107
125
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BarSeriesOption, EChartsOption, LineSeriesOption, PictorialBarSeriesOption, SeriesOption, RadarSeriesOption } from 'echarts';
|
|
1
|
+
import { BarSeriesOption, EChartsOption, LineSeriesOption, PieSeriesOption, PictorialBarSeriesOption, SeriesOption, RadarSeriesOption } from 'echarts';
|
|
2
2
|
import { EcBasicSeries } from '.';
|
|
3
3
|
// region 根配置
|
|
4
4
|
export type EcOptionBasicOption = Omit<EChartsOption, 'series'> & {
|
|
@@ -75,6 +75,12 @@ export namespace PieModule {
|
|
|
75
75
|
export type ConstructorOption = SeriesConstructorOption & {
|
|
76
76
|
// 单位
|
|
77
77
|
unit?: string
|
|
78
|
+
// 颜色
|
|
79
|
+
color?: string[]
|
|
80
|
+
// 环形饼图内外圆心半径
|
|
81
|
+
radius?: [string, string]
|
|
82
|
+
// 圆心位置
|
|
83
|
+
center?: [string, string]
|
|
78
84
|
/**
|
|
79
85
|
* 格式化图例
|
|
80
86
|
* @example
|