hfn-components 0.0.9 → 0.1.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.
Files changed (57) hide show
  1. package/dist/index.css +1 -0
  2. package/es/component.mjs +2 -0
  3. package/es/components/chart/index.d.ts +151 -0
  4. package/es/components/chart/index.mjs +7 -0
  5. package/es/components/chart/src/HtChart.d.ts +57 -0
  6. package/es/components/chart/src/HtChart.mjs +77 -0
  7. package/es/components/chart/src/HtChart.vue.d.ts +157 -0
  8. package/es/components/chart/src/HtChart.vue.mjs +88 -0
  9. package/es/components/chart/src/HtChart.vue2.mjs +94 -0
  10. package/es/components/chart/src/chartConfig.d.ts +7 -0
  11. package/es/components/chart/src/chartConfig.mjs +88 -0
  12. package/es/components/chart/style/index.d.ts +1 -0
  13. package/es/components/elTable/index.d.ts +93 -35
  14. package/es/components/elTable/index.mjs +1 -1
  15. package/es/components/elTable/src/columnDeal.vue.d.ts +27 -15
  16. package/es/components/elTable/src/columnDeal.vue.mjs +2 -2
  17. package/es/components/elTable/src/columnDeal.vue2.mjs +2 -4
  18. package/es/components/elTable/src/elTable.d.ts +18 -2
  19. package/es/components/elTable/src/elTable.mjs +15 -1
  20. package/es/components/elTable/src/elTable.vue.d.ts +93 -35
  21. package/es/components/elTable/src/elTable.vue.mjs +15 -6
  22. package/es/components/elTable/src/elTable.vue2.mjs +6 -4
  23. package/es/components/index.d.ts +1 -0
  24. package/es/components/index.mjs +3 -1
  25. package/es/components/table/HtTable.d.ts +1 -1
  26. package/es/components/table/HtTable.vue.d.ts +6 -6
  27. package/es/components/table/HtTable.vue.mjs +8 -2
  28. package/es/components/table/HtTable.vue2.mjs +11 -15
  29. package/es/components/table/index.d.ts +6 -6
  30. package/es/constants/table.d.ts +45 -2
  31. package/es/constants/table.mjs +29 -4
  32. package/es/css/index.css +59 -0
  33. package/es/index.mjs +3 -1
  34. package/es/utils/chart.d.ts +7 -0
  35. package/es/utils/chart.mjs +163 -0
  36. package/es/utils/common.d.ts +1 -1
  37. package/es/utils/index.d.ts +1 -0
  38. package/es/utils/index.mjs +1 -0
  39. package/es/utils/tool.mjs +1 -1
  40. package/global.d.ts +8 -9
  41. package/package.json +4 -2
  42. package/theme-chalk/ht-chart.css +1 -0
  43. package/theme-chalk/index.css +1 -0
  44. package/theme-chalk/src/chart.scss +53 -0
  45. package/theme-chalk/src/index.scss +1 -0
  46. package/es/components/button/HtButton.vue.d.ts +0 -19
  47. package/es/components/button/HtButton.vue.mjs +0 -16
  48. package/es/components/button/HtButton.vue2.mjs +0 -42
  49. package/es/components/button/index.d.ts +0 -20
  50. package/es/components/button/index.mjs +0 -6
  51. package/es/components/button/instance.d.ts +0 -2
  52. package/es/components/button/instance.mjs +0 -1
  53. package/es/components/eleTable/index.d.ts +0 -0
  54. package/es/components/eleTable/src/eleTable.d.ts +0 -0
  55. package/es/components/eleTable/src/eleTable.mjs +0 -1
  56. package/es/components/eleTable/src/eleTable.vue.mjs +0 -10
  57. /package/es/components/{eleTable → chart/style}/index.mjs +0 -0
@@ -0,0 +1,59 @@
1
+ .echart-box {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ position: relative;
7
+ }
8
+
9
+ .echart-content {
10
+ flex: auto;
11
+ }
12
+
13
+ .echart-lenged {
14
+ width: 100%;
15
+ height: auto;
16
+ margin-top: 6px;
17
+ padding-right: 22px;
18
+ box-sizing: border-box;
19
+ display: flex;
20
+ flex-wrap: wrap;
21
+ font-size: 12px;
22
+ position: relative;
23
+ z-index: 999;
24
+ }
25
+
26
+ .bg-span {
27
+ display: inline-block;
28
+ width: 14px;
29
+ height: 2px;
30
+ margin-right: 6px;
31
+ }
32
+
33
+ .bg-span-bar {
34
+ display: inline-block;
35
+ width: 16px;
36
+ height: 10px;
37
+ border-radius: 2px;
38
+ margin-right: 6px;
39
+ }
40
+
41
+ .span-box {
42
+ margin-left: 5px;
43
+ margin-right: 6px;
44
+ cursor: pointer;
45
+ display: flex;
46
+ align-items: center;
47
+ }
48
+
49
+ .noData {
50
+ width: 100%;
51
+ height: 100%;
52
+ font-size: 16px;
53
+ display: flex;
54
+ justify-content: center;
55
+ align-items: center;
56
+ position: absolute;
57
+ bottom: 0px;
58
+ color: #ccc;
59
+ }
package/es/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  import installer from './defaults.mjs';
2
2
  export { makeInstaller } from './make-installer.mjs';
3
3
  export { HtElTable } from './components/elTable/index.mjs';
4
- export { elTableProps } from './components/elTable/src/elTable.mjs';
4
+ export { HtChart } from './components/chart/index.mjs';
5
+ export { columnDealProps, elTableProps } from './components/elTable/src/elTable.mjs';
6
+ export { chartProps } from './components/chart/src/HtChart.mjs';
5
7
 
6
8
  const install = installer.install;
7
9
 
@@ -0,0 +1,7 @@
1
+ import type { chartProp } from 'hfn-components/es/components/chart';
2
+ export type chartType = 'category' | 'time';
3
+ export declare const legendEnterOperate: (options: any, name: string) => void;
4
+ export declare const legendLeaveOperate: (options: any) => void;
5
+ export declare const setEchartXAxis: (options: any, type: chartType, xAxisData: string[]) => void;
6
+ export declare const setEchartYAxis: (options: any) => void;
7
+ export declare const setEchartTooltip: (options: any, props: chartProp) => void;
@@ -0,0 +1,163 @@
1
+ const legendEnterOperate = (options, name) => {
2
+ options.series.forEach((series) => {
3
+ if (series.name === name) {
4
+ if (series.type === "line") {
5
+ if (series.lineStyle) {
6
+ series.lineStyle.opacity = 1;
7
+ } else {
8
+ series.lineStyle = {
9
+ opacity: 1
10
+ };
11
+ }
12
+ } else if (series.type === "bar") {
13
+ if (series.itemStyle) {
14
+ series.itemStyle.opacity = 1;
15
+ } else {
16
+ series.itemStyle = {
17
+ opacity: 1
18
+ };
19
+ }
20
+ }
21
+ } else {
22
+ if (series.type === "line") {
23
+ if (series.lineStyle) {
24
+ series.lineStyle.opacity = 0.1;
25
+ } else {
26
+ series.lineStyle = {
27
+ opacity: 0.1
28
+ };
29
+ }
30
+ } else if (series.type === "bar") {
31
+ if (series.itemStyle) {
32
+ series.itemStyle.opacity = 0.1;
33
+ } else {
34
+ series.itemStyle = {
35
+ opacity: 0.1
36
+ };
37
+ }
38
+ }
39
+ }
40
+ });
41
+ };
42
+ const legendLeaveOperate = (options) => {
43
+ options.series.forEach((series) => {
44
+ if (series.type === "line") {
45
+ if (series.lineStyle) {
46
+ series.lineStyle.opacity = 1;
47
+ } else {
48
+ series.lineStyle = {
49
+ opacity: 1
50
+ };
51
+ }
52
+ } else if (series.type === "bar") {
53
+ if (series.itemStyle) {
54
+ series.itemStyle.opacity = 1;
55
+ } else {
56
+ series.itemStyle = {
57
+ opacity: 1
58
+ };
59
+ }
60
+ }
61
+ });
62
+ };
63
+ const setEchartXAxis = (options, type, xAxisData) => {
64
+ if (type === "category") {
65
+ const xAxis = [...xAxisData];
66
+ options.xAxis = {
67
+ type,
68
+ data: xAxis,
69
+ axisTick: {
70
+ alignWithLabel: true
71
+ }
72
+ };
73
+ } else if (type === "time") {
74
+ options.xAxis = {
75
+ type,
76
+ minInterval: 24 * 60 * 60 * 1e3,
77
+ axisLine: {
78
+ onZero: false
79
+ }
80
+ };
81
+ }
82
+ };
83
+ const setEchartYAxis = (options) => {
84
+ options.yAxis = {
85
+ type: "value",
86
+ axisLabel: {
87
+ show: true,
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ formatter: function(val) {
90
+ return "" + val;
91
+ }
92
+ }
93
+ };
94
+ };
95
+ const setEchartTooltip = (options, props) => {
96
+ options.tooltip = {
97
+ trigger: "axis",
98
+ // tooltip提示框格式自定义
99
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
+ formatter: function(paramItems) {
101
+ let html = "";
102
+ if (Array.isArray(paramItems)) {
103
+ const params = paramItems.filter((item) => item.data !== void 0 && item.data !== null);
104
+ if (params.length === 0) return "";
105
+ if (props.chartType === "category") {
106
+ params.sort((a, b) => b.value - a.value);
107
+ } else {
108
+ params.sort((a, b) => {
109
+ if (Array.isArray(a.value) && Array.isArray(b.value)) {
110
+ return props.collation === "des" ? b.value[1] - a.value[1] : a.value[1] - b.value[1];
111
+ } else {
112
+ return 0;
113
+ }
114
+ });
115
+ }
116
+ html += `<div>${props.chartType === "category" ? params[0].name : Array.isArray(params[0].value) ? params[0].value[0] : ""}</div>`;
117
+ if (params.length > 30) html += '<div style="display: flex;">';
118
+ const len = Math.ceil(params.length / 3);
119
+ for (let i = 0; i < params.length; i++) {
120
+ if ((i + 1) % len === 1 && params.length > 30) {
121
+ html += '<div style="display: flex; flex-direction: column;">';
122
+ }
123
+ if (params[i].value === void 0 || params[i].value === null) ; else {
124
+ html += '<div style="display: flex;align-items:center">';
125
+ html += `<span
126
+ style="display:inline-block;
127
+ margin-right:5px;
128
+ border-radius:10px;
129
+ width:10px;height:10px;
130
+ background-color:${params[i].color};
131
+ ">
132
+ </span>`;
133
+ if (props.isReturn) {
134
+ html += `<span style='color:${params[i].color}'>${params[i].seriesName}</span>\uFF1A${params[i].value[2]?.toFixed(props.floatNumber)}\uFF08${params[i].value[1] > 0 ? "+" : ""}${params[i].value[1].toFixed(2)}%\uFF09`;
135
+ } else {
136
+ if (props.chartType === "category") {
137
+ html += `<span style='color:${params[i].color}'>
138
+ ${params[i].seriesName.includes("series") ? params[i].name : params[i].seriesName}
139
+ </span>\uFF1A
140
+ ${params[i].value.toFixed(props.floatNumber)}${props.tooltipUnit}
141
+ `;
142
+ } else {
143
+ html += `<span style='color:${params[i].color}'>${params[i].seriesName}</span>\uFF1A${params[i].value[1]?.toFixed(props.floatNumber)}${props.tooltipUnit}`;
144
+ }
145
+ }
146
+ html += "</div>";
147
+ }
148
+ if ((i + 1) % len === 0 && params.length > 30) {
149
+ html += "</div>";
150
+ }
151
+ }
152
+ if (params.length > 30) html += "</div>";
153
+ }
154
+ return html;
155
+ },
156
+ textStyle: {
157
+ color: "rgba(0,0,0,0.7)"
158
+ // 设置文字颜色
159
+ }
160
+ };
161
+ };
162
+
163
+ export { legendEnterOperate, legendLeaveOperate, setEchartTooltip, setEchartXAxis, setEchartYAxis };
@@ -1,3 +1,3 @@
1
- import type { Plugin } from "vue";
1
+ import type { Plugin } from 'vue';
2
2
  export type SFCWithInstall<T> = T & Plugin;
3
3
  export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => SFCWithInstall<T> & E;
@@ -1,3 +1,4 @@
1
1
  export * from './common';
2
2
  export * from './table';
3
3
  export * from './tool';
4
+ export * from './chart';
@@ -1,3 +1,4 @@
1
1
  export { withInstall } from './common.mjs';
2
2
  export { handleData, handleText } from './table.mjs';
3
3
  export { dataHandle, splitK } from './tool.mjs';
4
+ export { legendEnterOperate, legendLeaveOperate, setEchartTooltip, setEchartXAxis, setEchartYAxis } from './chart.mjs';
package/es/utils/tool.mjs CHANGED
@@ -27,7 +27,7 @@ function splitK(num) {
27
27
  }
28
28
  for (const i in revNumArr) {
29
29
  tempArr.push(revNumArr[i]);
30
- let index = parseFloat(i);
30
+ const index = parseFloat(i);
31
31
  if ((index + 1) % 3 === 0 && Number(i) !== revNumArr.length - 1) {
32
32
  tempArr.push(",");
33
33
  }
package/global.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  // declare module '*.vue' {
2
2
  // import { defineComponent } from 'vue'
3
- // const componentOptions:ReturnType<typeof defineComponent>
3
+ // const componentOptions:ReturnType<typeof defineComponent>
4
4
  // export default componentOptions
5
5
  // }
6
6
 
7
-
8
7
  declare module '@vue/runtime-core' {
9
- export interface GlobalComponents {
10
- HtTable: typeof import('hfn-components')['HtTable']
11
- }
12
- interface ComponentCustomProperties {
13
- // 你可以在这里添加自定义属性
14
- }
15
- }
8
+ export interface GlobalComponents {
9
+ HtTable: (typeof import('hfn-components'))['HtTable']
10
+ }
11
+ interface ComponentCustomProperties {
12
+ // 你可以在这里添加自定义属性
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfn-components",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "module": "es/index.mjs",
@@ -17,6 +17,8 @@
17
17
  "element-plus": "^2.7.7"
18
18
  },
19
19
  "peerDependencies": {
20
- "vue": "^3.2.0"
20
+ "vue": "^3.2.0",
21
+ "echarts": "^5.5.1",
22
+ "lodash.clonedeep": "^4.5.0"
21
23
  }
22
24
  }
@@ -0,0 +1 @@
1
+ .echart-box{display:flex;flex-direction:column;height:100%;position:relative;width:100%}.echart-content{flex:auto}.echart-lenged{box-sizing:border-box;display:flex;flex-wrap:wrap;font-size:12px;height:auto;margin-top:6px;padding-right:22px;position:relative;width:100%;z-index:999}.bg-span{height:2px;width:14px}.bg-span,.bg-span-bar{display:inline-block;margin-right:6px}.bg-span-bar{border-radius:2px;height:10px;width:16px}.span-box{cursor:pointer;margin-left:5px;margin-right:6px}.noData,.span-box{align-items:center;display:flex}.noData{bottom:0;color:#ccc;font-size:16px;height:100%;justify-content:center;position:absolute;width:100%}
@@ -0,0 +1 @@
1
+ .echart-box{display:flex;flex-direction:column;height:100%;position:relative;width:100%}.echart-content{flex:auto}.echart-lenged{box-sizing:border-box;display:flex;flex-wrap:wrap;font-size:12px;height:auto;margin-top:6px;padding-right:22px;position:relative;width:100%;z-index:999}.bg-span{height:2px;width:14px}.bg-span,.bg-span-bar{display:inline-block;margin-right:6px}.bg-span-bar{border-radius:2px;height:10px;width:16px}.span-box{cursor:pointer;margin-left:5px;margin-right:6px}.noData,.span-box{align-items:center;display:flex}.noData{bottom:0;color:#ccc;font-size:16px;height:100%;justify-content:center;position:absolute;width:100%}
@@ -0,0 +1,53 @@
1
+ .echart-box {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ position: relative;
7
+ }
8
+ .echart-content {
9
+ flex: auto;
10
+ }
11
+ .echart-lenged {
12
+ width: 100%;
13
+ height: auto;
14
+ margin-top: 6px;
15
+ padding-right: 22px;
16
+ box-sizing: border-box;
17
+ display: flex;
18
+ flex-wrap: wrap;
19
+ font-size: 12px;
20
+ position: relative;
21
+ z-index: 999;
22
+ }
23
+ .bg-span {
24
+ display: inline-block;
25
+ width: 14px;
26
+ height: 2px;
27
+ margin-right: 6px;
28
+ }
29
+ .bg-span-bar {
30
+ display: inline-block;
31
+ width: 16px;
32
+ height: 10px;
33
+ border-radius: 2px;
34
+ margin-right: 6px;
35
+ }
36
+ .span-box {
37
+ margin-left: 5px;
38
+ margin-right: 6px;
39
+ cursor: pointer;
40
+ display: flex;
41
+ align-items: center;
42
+ }
43
+ .noData {
44
+ width: 100%;
45
+ height: 100%;
46
+ font-size: 16px;
47
+ display: flex;
48
+ justify-content: center;
49
+ align-items: center;
50
+ position: absolute;
51
+ bottom: 0px;
52
+ color: #ccc;
53
+ }
@@ -0,0 +1 @@
1
+ @use './chart.scss';
@@ -1,19 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {
2
- columns: ({
3
- name: string;
4
- dataIndex: string;
5
- key: string;
6
- title?: undefined;
7
- } | {
8
- title: string;
9
- dataIndex: string;
10
- key: string;
11
- name?: undefined;
12
- } | {
13
- title: string;
14
- key: string;
15
- name?: undefined;
16
- dataIndex?: undefined;
17
- })[];
18
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
19
- export default _default;
@@ -1,16 +0,0 @@
1
- import _sfc_main from './HtButton.vue2.mjs';
2
- import { openBlock, createElementBlock, toDisplayString } from 'vue';
3
- import _export_sfc from '../../_virtual/_plugin-vue_export-helper.mjs';
4
-
5
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6
- return openBlock(), createElementBlock(
7
- "button",
8
- null,
9
- "\u6D4B\u8BD5\u6309\u94AElibiluo" + toDisplayString($setup.columns[1].name),
10
- 1
11
- /* TEXT */
12
- );
13
- }
14
- var button = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/libiluo/Desktop/company/component-library/packages/components/button/HtButton.vue"]]);
15
-
16
- export { button as default };
@@ -1,42 +0,0 @@
1
- import { defineComponent } from 'vue';
2
-
3
- var _sfc_main = /* @__PURE__ */ defineComponent({
4
- ...{
5
- name: "HtButton"
6
- },
7
- __name: "HtButton",
8
- setup(__props, { expose: __expose }) {
9
- __expose();
10
- const columns = [
11
- {
12
- name: "Name",
13
- dataIndex: "name",
14
- key: "name"
15
- },
16
- {
17
- title: "Age",
18
- dataIndex: "age",
19
- key: "age"
20
- },
21
- {
22
- title: "Address",
23
- dataIndex: "address",
24
- key: "address"
25
- },
26
- {
27
- title: "Tags",
28
- key: "tags",
29
- dataIndex: "tags"
30
- },
31
- {
32
- title: "Action",
33
- key: "action"
34
- }
35
- ];
36
- const __returned__ = { columns };
37
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
38
- return __returned__;
39
- }
40
- });
41
-
42
- export { _sfc_main as default };
@@ -1,20 +0,0 @@
1
- export declare const HtButton: import("hfn-components/es/utils").SFCWithInstall<import("vue").DefineComponent<{}, {
2
- columns: ({
3
- name: string;
4
- dataIndex: string;
5
- key: string;
6
- title?: undefined;
7
- } | {
8
- title: string;
9
- dataIndex: string;
10
- key: string;
11
- name?: undefined;
12
- } | {
13
- title: string;
14
- key: string;
15
- name?: undefined;
16
- dataIndex?: undefined;
17
- })[];
18
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>> & Record<string, any>;
19
- export default HtButton;
20
- export type { ButtonInstance } from './instance';
@@ -1,6 +0,0 @@
1
- import button from './HtButton.vue.mjs';
2
- import { withInstall } from '../../utils/common.mjs';
3
-
4
- const HtButton = withInstall(button);
5
-
6
- export { HtButton, HtButton as default };
@@ -1,2 +0,0 @@
1
- import type HtButton from './HtButton.vue';
2
- export type ButtonInstance = InstanceType<typeof HtButton>;
@@ -1 +0,0 @@
1
-
File without changes
File without changes
@@ -1,10 +0,0 @@
1
- import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
2
-
3
- const _sfc_main = {};
4
-
5
- function _sfc_render(_ctx, _cache) {
6
- return null
7
- }
8
- var eleTable = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"/Users/libiluo/Desktop/company/component-library/packages/components/eleTable/src/eleTable.vue"]]);
9
-
10
- export { eleTable as default };