hfn-components 0.2.8 → 0.2.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.
@@ -35,7 +35,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
35
35
  (val) => {
36
36
  if (val && val.length > 0) {
37
37
  echartOptions.color = props.lineColor;
38
- console.log(props.lineColor);
39
38
  if (myChart.value) {
40
39
  echartInit();
41
40
  }
@@ -15,10 +15,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
15
15
  readonly type: StringConstructor;
16
16
  readonly default: "";
17
17
  };
18
- readonly customizePercentage: {
19
- readonly type: BooleanConstructor;
20
- readonly default: false;
21
- };
22
18
  readonly floatNumber: {
23
19
  readonly type: NumberConstructor;
24
20
  readonly default: 2;
@@ -44,7 +40,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
44
40
  readonly lineColor: string[];
45
41
  readonly legendData: Record<string, any>;
46
42
  readonly legendType: string;
47
- readonly customizePercentage: boolean;
48
43
  readonly legendFormatter: Function;
49
44
  } & {}>;
50
45
  myChart: import("vue").ShallowRef<any>;
@@ -72,10 +67,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
72
67
  readonly type: StringConstructor;
73
68
  readonly default: "";
74
69
  };
75
- readonly customizePercentage: {
76
- readonly type: BooleanConstructor;
77
- readonly default: false;
78
- };
79
70
  readonly floatNumber: {
80
71
  readonly type: NumberConstructor;
81
72
  readonly default: 2;
@@ -100,7 +91,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
100
91
  readonly lineColor: string[];
101
92
  readonly legendData: Record<string, any>;
102
93
  readonly legendType: string;
103
- readonly customizePercentage: boolean;
104
94
  readonly legendFormatter: Function;
105
95
  }, {}>> & Record<string, any>;
106
96
  export default HtPieChart;
@@ -16,10 +16,6 @@ export declare const pieProps: {
16
16
  readonly type: StringConstructor;
17
17
  readonly default: "";
18
18
  };
19
- readonly customizePercentage: {
20
- readonly type: BooleanConstructor;
21
- readonly default: false;
22
- };
23
19
  readonly floatNumber: {
24
20
  readonly type: NumberConstructor;
25
21
  readonly default: 2;
@@ -19,11 +19,6 @@ const pieProps = {
19
19
  type: String,
20
20
  default: ""
21
21
  },
22
- //是否自定义百分比
23
- customizePercentage: {
24
- type: Boolean,
25
- default: false
26
- },
27
22
  //保留几位小数
28
23
  floatNumber: {
29
24
  type: Number,
@@ -15,10 +15,6 @@ declare const _default: import("vue").DefineComponent<{
15
15
  readonly type: StringConstructor;
16
16
  readonly default: "";
17
17
  };
18
- readonly customizePercentage: {
19
- readonly type: BooleanConstructor;
20
- readonly default: false;
21
- };
22
18
  readonly floatNumber: {
23
19
  readonly type: NumberConstructor;
24
20
  readonly default: 2;
@@ -44,7 +40,6 @@ declare const _default: import("vue").DefineComponent<{
44
40
  readonly lineColor: string[];
45
41
  readonly legendData: Record<string, any>;
46
42
  readonly legendType: string;
47
- readonly customizePercentage: boolean;
48
43
  readonly legendFormatter: Function;
49
44
  } & {}>;
50
45
  myChart: import("vue").ShallowRef<any>;
@@ -72,10 +67,6 @@ declare const _default: import("vue").DefineComponent<{
72
67
  readonly type: StringConstructor;
73
68
  readonly default: "";
74
69
  };
75
- readonly customizePercentage: {
76
- readonly type: BooleanConstructor;
77
- readonly default: false;
78
- };
79
70
  readonly floatNumber: {
80
71
  readonly type: NumberConstructor;
81
72
  readonly default: 2;
@@ -100,7 +91,6 @@ declare const _default: import("vue").DefineComponent<{
100
91
  readonly lineColor: string[];
101
92
  readonly legendData: Record<string, any>;
102
93
  readonly legendType: string;
103
- readonly customizePercentage: boolean;
104
94
  readonly legendFormatter: Function;
105
95
  }, {}>;
106
96
  export default _default;
@@ -26,6 +26,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
26
26
  chartResize();
27
27
  }
28
28
  );
29
+ watch(
30
+ () => props.lineColor,
31
+ (val) => {
32
+ if (val && val.length > 0) {
33
+ echartOptions.color = props.lineColor;
34
+ if (myChart.value) {
35
+ echartInit();
36
+ }
37
+ }
38
+ },
39
+ { deep: true, immediate: true }
40
+ );
29
41
  const chartResize = () => {
30
42
  myChart.value.resize();
31
43
  };
@@ -60,7 +72,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
60
72
  let html;
61
73
  html = `<div>${params.seriesName}</div>`;
62
74
  html += `<span> ${params.name}:
63
- ${props.customizePercentage ? params.data.value : params.percent.toFixed(props.floatNumber)}%<span>`;
75
+ ${params.data.percent ? (params.data.percent * 100).toFixed(props.floatNumber) : params.percent.toFixed(props.floatNumber)}%<span>`;
64
76
  return html;
65
77
  }
66
78
  };
@@ -95,8 +95,7 @@ const BASIC_PIE_CONFIG = {
95
95
  label: {
96
96
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
97
  formatter: function(params) {
98
- console.log(params);
99
- const val = params.percent.toFixed(2);
98
+ const val = params.data.percent ? (params.data.percent * 100).toFixed(2) : params.percent.toFixed(2);
100
99
  return ` ${params.name}: ${val}%`;
101
100
  },
102
101
  fontWeight: "bolder",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfn-components",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "module": "es/index.mjs",