hfn-components 0.1.3 → 0.1.5

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,6 +35,10 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
35
35
  readonly type: StringConstructor;
36
36
  readonly default: "";
37
37
  };
38
+ readonly yAxisUnit: {
39
+ readonly type: StringConstructor;
40
+ readonly default: "";
41
+ };
38
42
  readonly tooltipUnit: {
39
43
  readonly type: StringConstructor;
40
44
  readonly default: "";
@@ -62,6 +66,7 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
62
66
  readonly isPercent: boolean;
63
67
  readonly floatNumber: number;
64
68
  readonly titleText: string;
69
+ readonly yAxisUnit: string;
65
70
  readonly tooltipUnit: string;
66
71
  readonly watchResize: boolean;
67
72
  readonly showLegend: boolean;
@@ -116,6 +121,10 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
116
121
  readonly type: StringConstructor;
117
122
  readonly default: "";
118
123
  };
124
+ readonly yAxisUnit: {
125
+ readonly type: StringConstructor;
126
+ readonly default: "";
127
+ };
119
128
  readonly tooltipUnit: {
120
129
  readonly type: StringConstructor;
121
130
  readonly default: "";
@@ -142,6 +151,7 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
142
151
  readonly isPercent: boolean;
143
152
  readonly floatNumber: number;
144
153
  readonly titleText: string;
154
+ readonly yAxisUnit: string;
145
155
  readonly tooltipUnit: string;
146
156
  readonly watchResize: boolean;
147
157
  readonly showLegend: boolean;
@@ -37,6 +37,10 @@ export declare const chartProps: {
37
37
  readonly type: StringConstructor;
38
38
  readonly default: "";
39
39
  };
40
+ readonly yAxisUnit: {
41
+ readonly type: StringConstructor;
42
+ readonly default: "";
43
+ };
40
44
  readonly tooltipUnit: {
41
45
  readonly type: StringConstructor;
42
46
  readonly default: "";
@@ -53,6 +53,11 @@ const chartProps = {
53
53
  type: String,
54
54
  default: ""
55
55
  },
56
+ //Y轴单位
57
+ yAxisUnit: {
58
+ type: String,
59
+ default: ""
60
+ },
56
61
  //tooltip单位
57
62
  tooltipUnit: {
58
63
  type: String,
@@ -42,6 +42,10 @@ declare const _default: import("vue").DefineComponent<{
42
42
  readonly type: StringConstructor;
43
43
  readonly default: "";
44
44
  };
45
+ readonly yAxisUnit: {
46
+ readonly type: StringConstructor;
47
+ readonly default: "";
48
+ };
45
49
  readonly tooltipUnit: {
46
50
  readonly type: StringConstructor;
47
51
  readonly default: "";
@@ -69,6 +73,7 @@ declare const _default: import("vue").DefineComponent<{
69
73
  readonly isPercent: boolean;
70
74
  readonly floatNumber: number;
71
75
  readonly titleText: string;
76
+ readonly yAxisUnit: string;
72
77
  readonly tooltipUnit: string;
73
78
  readonly watchResize: boolean;
74
79
  readonly showLegend: boolean;
@@ -123,6 +128,10 @@ declare const _default: import("vue").DefineComponent<{
123
128
  readonly type: StringConstructor;
124
129
  readonly default: "";
125
130
  };
131
+ readonly yAxisUnit: {
132
+ readonly type: StringConstructor;
133
+ readonly default: "";
134
+ };
126
135
  readonly tooltipUnit: {
127
136
  readonly type: StringConstructor;
128
137
  readonly default: "";
@@ -149,6 +158,7 @@ declare const _default: import("vue").DefineComponent<{
149
158
  readonly isPercent: boolean;
150
159
  readonly floatNumber: number;
151
160
  readonly titleText: string;
161
+ readonly yAxisUnit: string;
152
162
  readonly tooltipUnit: string;
153
163
  readonly watchResize: boolean;
154
164
  readonly showLegend: boolean;
@@ -11,11 +11,16 @@ export declare const HtElTable: import("hfn-components/es/utils").SFCWithInstall
11
11
  readonly type: BooleanConstructor;
12
12
  readonly default: false;
13
13
  };
14
+ readonly headerColor: {
15
+ readonly type: StringConstructor;
16
+ readonly default: "#f0f0f0";
17
+ };
14
18
  }, {
15
19
  props: import("@vue/shared").LooseRequired<{
16
20
  readonly loading: boolean;
17
21
  readonly dataSource: unknown[];
18
22
  readonly tableColumn: import("./src/elTable").ElTableColumns[];
23
+ readonly headerColor: string;
19
24
  } & {}>;
20
25
  readonly ElTable: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
21
26
  data: {
@@ -632,6 +637,7 @@ export declare const HtElTable: import("hfn-components/es/utils").SFCWithInstall
632
637
  readonly MonthlyPositiveRatio: "月胜率";
633
638
  readonly all_year: "全年";
634
639
  };
640
+ readonly convertKey: (data: any, key: string) => any;
635
641
  ColumnDeal: import("vue").DefineComponent<{
636
642
  readonly dealType: {
637
643
  readonly type: import("vue").PropType<"basicText4" | "colorText" | "colorPercentage" | "percentage" | "notProcessed">;
@@ -679,10 +685,15 @@ export declare const HtElTable: import("hfn-components/es/utils").SFCWithInstall
679
685
  readonly type: BooleanConstructor;
680
686
  readonly default: false;
681
687
  };
688
+ readonly headerColor: {
689
+ readonly type: StringConstructor;
690
+ readonly default: "#f0f0f0";
691
+ };
682
692
  }>>, {
683
693
  readonly loading: boolean;
684
694
  readonly dataSource: unknown[];
685
695
  readonly tableColumn: import("./src/elTable").ElTableColumns[];
696
+ readonly headerColor: string;
686
697
  }, {}>> & Record<string, any>;
687
698
  export default HtElTable;
688
699
  export * from './src/elTable';
@@ -18,6 +18,10 @@ export declare const elTableProps: {
18
18
  readonly type: BooleanConstructor;
19
19
  readonly default: false;
20
20
  };
21
+ readonly headerColor: {
22
+ readonly type: StringConstructor;
23
+ readonly default: "#f0f0f0";
24
+ };
21
25
  };
22
26
  export declare const columnDealProps: {
23
27
  readonly dealType: {
@@ -10,6 +10,10 @@ const elTableProps = {
10
10
  loading: {
11
11
  type: Boolean,
12
12
  default: false
13
+ },
14
+ headerColor: {
15
+ type: String,
16
+ default: "#f0f0f0"
13
17
  }
14
18
  };
15
19
  const columnDealProps = {
@@ -11,11 +11,16 @@ declare const _default: import("vue").DefineComponent<{
11
11
  readonly type: BooleanConstructor;
12
12
  readonly default: false;
13
13
  };
14
+ readonly headerColor: {
15
+ readonly type: StringConstructor;
16
+ readonly default: "#f0f0f0";
17
+ };
14
18
  }, {
15
19
  props: import("@vue/shared").LooseRequired<{
16
20
  readonly loading: boolean;
17
21
  readonly dataSource: unknown[];
18
22
  readonly tableColumn: import("./elTable").ElTableColumns[];
23
+ readonly headerColor: string;
19
24
  } & {}>;
20
25
  readonly ElTable: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
21
26
  data: {
@@ -632,6 +637,7 @@ declare const _default: import("vue").DefineComponent<{
632
637
  readonly MonthlyPositiveRatio: "月胜率";
633
638
  readonly all_year: "全年";
634
639
  };
640
+ readonly convertKey: (data: any, key: string) => any;
635
641
  ColumnDeal: import("vue").DefineComponent<{
636
642
  readonly dealType: {
637
643
  readonly type: import("vue").PropType<"basicText4" | "colorText" | "colorPercentage" | "percentage" | "notProcessed">;
@@ -679,9 +685,14 @@ declare const _default: import("vue").DefineComponent<{
679
685
  readonly type: BooleanConstructor;
680
686
  readonly default: false;
681
687
  };
688
+ readonly headerColor: {
689
+ readonly type: StringConstructor;
690
+ readonly default: "#f0f0f0";
691
+ };
682
692
  }>>, {
683
693
  readonly loading: boolean;
684
694
  readonly dataSource: unknown[];
685
695
  readonly tableColumn: import("./elTable").ElTableColumns[];
696
+ readonly headerColor: string;
686
697
  }, {}>;
687
698
  export default _default;
@@ -8,7 +8,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
8
8
  style: { "width": "100%" },
9
9
  height: "100%",
10
10
  "header-cell-style": {
11
- background: "#f0f0f0",
11
+ background: $setup.props.headerColor,
12
12
  color: "#000",
13
13
  "font-weight": 500,
14
14
  "font-size": "12px"
@@ -28,7 +28,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
28
28
  default: withCtx((scope) => [
29
29
  createVNode($setup["ColumnDeal"], {
30
30
  dealType: item.dealType,
31
- text: scope.row[item.key]
31
+ text: $setup.convertKey(scope.row, item.key)
32
32
  }, null, 8, ["dealType", "text"])
33
33
  ]),
34
34
  _: 2
@@ -41,7 +41,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
41
41
  ]),
42
42
  _: 1
43
43
  /* STABLE */
44
- }, 8, ["data"])), [
44
+ }, 8, ["data", "header-cell-style"])), [
45
45
  [$setup["vLoading"], $setup.props.loading]
46
46
  ]);
47
47
  }
@@ -1,6 +1,6 @@
1
1
  import { defineComponent } from 'vue';
2
2
  import { ElTable, ElTableColumn, vLoading } from 'element-plus';
3
- import { TABLE_KEY } from '../../../constants/table.mjs';
3
+ import { TABLE_KEY, convertKey } from '../../../constants/table.mjs';
4
4
  import ColumnDeal from './columnDeal.vue.mjs';
5
5
  import { elTableProps } from './elTable.mjs';
6
6
 
@@ -18,6 +18,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  return vLoading;
19
19
  }, get TABLE_KEY() {
20
20
  return TABLE_KEY;
21
+ }, get convertKey() {
22
+ return convertKey;
21
23
  }, ColumnDeal };
22
24
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
23
25
  return __returned__;
@@ -1,2 +1,2 @@
1
1
  export { INSTALLED_KEY } from './key.mjs';
2
- export { CLOUMN_DEAL, TABLE_KEY } from './table.mjs';
2
+ export { CLOUMN_DEAL, TABLE_KEY, convertKey } from './table.mjs';
@@ -41,5 +41,6 @@ export declare const CLOUMN_DEAL: {
41
41
  percentage: (val: number | string | undefined) => string;
42
42
  notProcessed: null;
43
43
  };
44
+ export declare const convertKey: (data: any, key: string) => any;
44
45
  export type clounmKyeType = keyof typeof TABLE_KEY;
45
46
  export type dealKeyType = keyof typeof CLOUMN_DEAL;
@@ -47,5 +47,9 @@ const CLOUMN_DEAL = {
47
47
  percentage,
48
48
  notProcessed: null
49
49
  };
50
+ const convertKey = (data, key) => {
51
+ const newKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
52
+ return data[key] || data[newKey];
53
+ };
50
54
 
51
- export { CLOUMN_DEAL, TABLE_KEY };
55
+ export { CLOUMN_DEAL, TABLE_KEY, convertKey };
@@ -87,7 +87,7 @@ const setEchartYAxis = (options, props) => {
87
87
  show: true,
88
88
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
89
  formatter: function(val) {
90
- return (props.isReturn ? val > 0 ? "+" : "" : "") + parseFloat(val.toFixed(props.floatNumber)) + `${props.isReturn ? "%" : ""}`;
90
+ return (props.yAxisUnit === "%" ? val > 0 ? "+" : "" : "") + parseFloat(val.toFixed(props.floatNumber)) + props.yAxisUnit;
91
91
  }
92
92
  }
93
93
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfn-components",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "module": "es/index.mjs",