hfn-components 0.2.7 → 0.2.8
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.
- package/dist/index.css +1 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/component.d.ts +3 -0
- package/es/component.mjs +12 -0
- package/es/components/chart/index.d.ts +171 -0
- package/es/components/chart/index.mjs +7 -0
- package/es/components/chart/src/HtChart.d.ts +65 -0
- package/es/components/chart/src/HtChart.mjs +77 -0
- package/es/components/chart/src/HtChart.vue.d.ts +177 -0
- package/es/components/chart/src/HtChart.vue.mjs +90 -0
- package/es/components/chart/src/HtChart.vue2.mjs +109 -0
- package/es/components/chart/src/chartConfig.d.ts +7 -0
- package/es/components/chart/src/chartConfig.mjs +88 -0
- package/es/components/chart/style/index.d.ts +1 -0
- package/es/components/chart/style/index.mjs +1 -0
- package/es/components/elTable/index.d.ts +771 -0
- package/es/components/elTable/index.mjs +7 -0
- package/es/components/elTable/src/columnDeal.vue.d.ts +39 -0
- package/es/components/elTable/src/columnDeal.vue.mjs +35 -0
- package/es/components/elTable/src/columnDeal.vue2.mjs +20 -0
- package/es/components/elTable/src/elTable.d.ts +38 -0
- package/es/components/elTable/src/elTable.mjs +30 -0
- package/es/components/elTable/src/elTable.vue.d.ts +770 -0
- package/es/components/elTable/src/elTable.vue.mjs +56 -0
- package/es/components/elTable/src/elTable.vue2.mjs +30 -0
- package/es/components/htTarget/index.d.ts +1979 -0
- package/es/components/htTarget/index.mjs +6 -0
- package/es/components/htTarget/src/htTarget.d.ts +1 -0
- package/es/components/htTarget/src/htTarget.mjs +3 -0
- package/es/components/htTarget/src/htTarget.vue.d.ts +1978 -0
- package/es/components/htTarget/src/htTarget.vue.mjs +204 -0
- package/es/components/htTarget/src/htTarget.vue2.mjs +108 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.mjs +7 -0
- package/es/components/pieChart/index.d.ts +107 -0
- package/es/components/pieChart/index.mjs +7 -0
- package/es/components/pieChart/src/HtPieChart.d.ts +40 -0
- package/es/components/pieChart/src/HtPieChart.mjs +47 -0
- package/es/components/pieChart/src/HtPieChart.vue.d.ts +106 -0
- package/es/components/pieChart/src/HtPieChart.vue.mjs +23 -0
- package/es/components/pieChart/src/HtPieChart.vue2.mjs +84 -0
- package/es/components/pieChart/style/index.d.ts +1 -0
- package/es/components/pieChart/style/index.mjs +1 -0
- package/es/components/table/HtTable.d.ts +142 -0
- package/es/components/table/HtTable.mjs +136 -0
- package/es/components/table/HtTable.vue.d.ts +1847 -0
- package/es/components/table/HtTable.vue.mjs +449 -0
- package/es/components/table/HtTable.vue2.mjs +124 -0
- package/es/components/table/index.d.ts +1845 -0
- package/es/components/table/index.mjs +7 -0
- package/es/constants/chartConfig.d.ts +8 -0
- package/es/constants/chartConfig.mjs +110 -0
- package/es/constants/index.d.ts +4 -0
- package/es/constants/index.mjs +4 -0
- package/es/constants/key.d.ts +1 -0
- package/es/constants/key.mjs +3 -0
- package/es/constants/table.d.ts +118 -0
- package/es/constants/table.mjs +144 -0
- package/es/constants/target.d.ts +20 -0
- package/es/constants/target.mjs +54 -0
- package/es/defaults.d.ts +4 -0
- package/es/defaults.mjs +7 -0
- package/es/index.d.ts +5 -0
- package/es/index.mjs +13 -0
- package/es/make-installer.d.ts +4 -0
- package/es/make-installer.mjs +15 -0
- package/es/plugin.d.ts +2 -0
- package/es/plugin.mjs +3 -0
- package/es/utils/chart.d.ts +7 -0
- package/es/utils/chart.mjs +172 -0
- package/es/utils/common.d.ts +3 -0
- package/es/utils/common.mjs +15 -0
- package/es/utils/index.d.ts +4 -0
- package/es/utils/index.mjs +4 -0
- package/es/utils/table.d.ts +2 -0
- package/es/utils/table.mjs +31 -0
- package/es/utils/tool.d.ts +2 -0
- package/es/utils/tool.mjs +42 -0
- package/global.d.ts +14 -0
- package/package.json +1 -1
- package/theme-chalk/ht-chart.css +1 -0
- package/theme-chalk/index.css +1 -0
- package/theme-chalk/src/chart.scss +58 -0
- package/theme-chalk/src/index.scss +1 -0
- package/component.ts +0 -13
- package/defaults.ts +0 -5
- package/index.ts +0 -6
- package/make-installer.ts +0 -17
- package/plugin.ts +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defineComponent, shallowRef, ref, reactive, watch } from 'vue';
|
|
2
|
+
import { BASIC_CHART_CONFIG } from '../../../constants/chartConfig.mjs';
|
|
3
|
+
import { chartProps } from './HtChart.mjs';
|
|
4
|
+
import cloneDeep from 'lodash.clonedeep';
|
|
5
|
+
import { setEchartXAxis, setEchartYAxis, setEchartTooltip, legendEnterOperate, legendLeaveOperate } from '../../../utils/chart.mjs';
|
|
6
|
+
import * as echarts from 'echarts/core';
|
|
7
|
+
|
|
8
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "HtChart",
|
|
10
|
+
props: chartProps,
|
|
11
|
+
setup(__props, { expose: __expose }) {
|
|
12
|
+
__expose();
|
|
13
|
+
const props = __props;
|
|
14
|
+
const myChart = shallowRef();
|
|
15
|
+
const isEmpty = ref(false);
|
|
16
|
+
const echartOptions = reactive(cloneDeep(BASIC_CHART_CONFIG));
|
|
17
|
+
watch(
|
|
18
|
+
() => props.chartData,
|
|
19
|
+
(val) => {
|
|
20
|
+
echartOptions.series = cloneDeep(val);
|
|
21
|
+
drawGraph();
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
deep: true
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
watch(
|
|
28
|
+
() => props.watchResize,
|
|
29
|
+
() => {
|
|
30
|
+
chartResize();
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
watch(
|
|
34
|
+
() => props.lineColor,
|
|
35
|
+
(val) => {
|
|
36
|
+
if (val && val.length > 0) {
|
|
37
|
+
echartOptions.color = props.lineColor;
|
|
38
|
+
console.log(props.lineColor);
|
|
39
|
+
if (myChart.value) {
|
|
40
|
+
echartInit();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{ deep: true, immediate: true }
|
|
45
|
+
);
|
|
46
|
+
const drawGraph = () => {
|
|
47
|
+
if (props.lineColor && props.lineColor.length > 0) {
|
|
48
|
+
echartOptions.color = props.lineColor;
|
|
49
|
+
}
|
|
50
|
+
setEchartXAxis(echartOptions, props.chartType, props.xAxisData);
|
|
51
|
+
setEchartYAxis(echartOptions, props);
|
|
52
|
+
setEchartTooltip(echartOptions, props);
|
|
53
|
+
lengedDeal();
|
|
54
|
+
echartInit();
|
|
55
|
+
};
|
|
56
|
+
const lengedDeal = () => {
|
|
57
|
+
allLegend.value = [];
|
|
58
|
+
props.chartData.forEach((item, index) => {
|
|
59
|
+
const data = {
|
|
60
|
+
name: item.name,
|
|
61
|
+
isShow: true,
|
|
62
|
+
lineType: item.type,
|
|
63
|
+
color: echartOptions.color[index % echartOptions.color.length]
|
|
64
|
+
};
|
|
65
|
+
allLegend.value.push(data);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const echartInit = () => {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
if (!myChart.value) {
|
|
71
|
+
const ele = document.getElementById(props.chartId);
|
|
72
|
+
myChart.value = echarts.init(ele, null, { devicePixelRatio: 2, locale: "ZH" });
|
|
73
|
+
}
|
|
74
|
+
myChart.value.setOption(echartOptions, true);
|
|
75
|
+
}, 200);
|
|
76
|
+
};
|
|
77
|
+
const chartResize = () => {
|
|
78
|
+
myChart.value.resize();
|
|
79
|
+
};
|
|
80
|
+
const allLegend = ref([]);
|
|
81
|
+
const noData = ref(false);
|
|
82
|
+
const legendStatus = (item, index) => {
|
|
83
|
+
const status = !item.isShow;
|
|
84
|
+
allLegend.value[index].isShow = status;
|
|
85
|
+
if (allLegend.value.every((item2) => item2.isShow === false)) {
|
|
86
|
+
noData.value = true;
|
|
87
|
+
} else {
|
|
88
|
+
noData.value = false;
|
|
89
|
+
}
|
|
90
|
+
myChart.value.dispatchAction({
|
|
91
|
+
type: "legendToggleSelect",
|
|
92
|
+
name: item.name
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const legendEnter = (index) => {
|
|
96
|
+
legendEnterOperate(echartOptions, allLegend.value[index].name);
|
|
97
|
+
myChart.value.setOption(echartOptions);
|
|
98
|
+
};
|
|
99
|
+
const legendLeave = () => {
|
|
100
|
+
legendLeaveOperate(echartOptions);
|
|
101
|
+
myChart.value.setOption(echartOptions);
|
|
102
|
+
};
|
|
103
|
+
const __returned__ = { props, myChart, isEmpty, echartOptions, drawGraph, lengedDeal, echartInit, chartResize, allLegend, noData, legendStatus, legendEnter, legendLeave };
|
|
104
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
105
|
+
return __returned__;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as echarts from 'echarts/core';
|
|
2
|
+
import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
|
3
|
+
import type { TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';
|
|
4
|
+
import type { ComposeOption } from 'echarts/core';
|
|
5
|
+
export type ECOption = ComposeOption<BarSeriesOption | LineSeriesOption | TitleComponentOption | TooltipComponentOption | GridComponentOption | DatasetComponentOption>;
|
|
6
|
+
export default echarts;
|
|
7
|
+
export declare const BASIC_CHART_CONFIG: any;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as echarts from 'echarts/core';
|
|
2
|
+
export { echarts as default };
|
|
3
|
+
import { BarChart, LineChart } from 'echarts/charts';
|
|
4
|
+
import { TitleComponent, TooltipComponent, GridComponent, LegendComponent, DatasetComponent, TransformComponent } from 'echarts/components';
|
|
5
|
+
import { LabelLayout, UniversalTransition } from 'echarts/features';
|
|
6
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
7
|
+
|
|
8
|
+
echarts.use([
|
|
9
|
+
TitleComponent,
|
|
10
|
+
TooltipComponent,
|
|
11
|
+
GridComponent,
|
|
12
|
+
LegendComponent,
|
|
13
|
+
DatasetComponent,
|
|
14
|
+
TransformComponent,
|
|
15
|
+
BarChart,
|
|
16
|
+
LineChart,
|
|
17
|
+
LabelLayout,
|
|
18
|
+
UniversalTransition,
|
|
19
|
+
CanvasRenderer
|
|
20
|
+
]);
|
|
21
|
+
const BASIC_CHART_CONFIG = {
|
|
22
|
+
title: {
|
|
23
|
+
text: "",
|
|
24
|
+
// top: '5%',
|
|
25
|
+
left: "0%",
|
|
26
|
+
textStyle: {
|
|
27
|
+
fontSize: 12,
|
|
28
|
+
color: "rgba(0,0,0,0.7)",
|
|
29
|
+
fontWeight: "normal"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
// 图例
|
|
33
|
+
legend: {
|
|
34
|
+
left: "0%",
|
|
35
|
+
show: false
|
|
36
|
+
},
|
|
37
|
+
xAxis: {},
|
|
38
|
+
yAxis: {},
|
|
39
|
+
grid: {
|
|
40
|
+
// top: '12%',
|
|
41
|
+
top: "8%",
|
|
42
|
+
left: "3%",
|
|
43
|
+
right: "3%",
|
|
44
|
+
bottom: "1%",
|
|
45
|
+
containLabel: true
|
|
46
|
+
},
|
|
47
|
+
// 线条颜色
|
|
48
|
+
color: [
|
|
49
|
+
"#C13431",
|
|
50
|
+
"#1E85D2",
|
|
51
|
+
"#FD984F",
|
|
52
|
+
"#63B9BB",
|
|
53
|
+
"#BBB162",
|
|
54
|
+
"#AE76C1",
|
|
55
|
+
"#5E92F6",
|
|
56
|
+
"#F5BC32",
|
|
57
|
+
"#DA8484",
|
|
58
|
+
"#41982E",
|
|
59
|
+
"#437095",
|
|
60
|
+
"#8060A7",
|
|
61
|
+
"#7D0A0D",
|
|
62
|
+
"#572AFF",
|
|
63
|
+
"#2BE8F8",
|
|
64
|
+
"#FF1493",
|
|
65
|
+
"#E066FF",
|
|
66
|
+
"#27408B",
|
|
67
|
+
"#5191A3",
|
|
68
|
+
"#D5634C",
|
|
69
|
+
"#92d6fd",
|
|
70
|
+
"#b92e2d",
|
|
71
|
+
"#187bc9",
|
|
72
|
+
"#90bae0",
|
|
73
|
+
"#187bc9",
|
|
74
|
+
"#0070C9",
|
|
75
|
+
"#5470c6",
|
|
76
|
+
"#91cc75",
|
|
77
|
+
"#fac858",
|
|
78
|
+
"#ee6666",
|
|
79
|
+
"#73c0de",
|
|
80
|
+
"#3ba272",
|
|
81
|
+
"#fc8452",
|
|
82
|
+
"#9a60b4",
|
|
83
|
+
"#ea7ccc"
|
|
84
|
+
],
|
|
85
|
+
series: []
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { BASIC_CHART_CONFIG };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'hfn-components/theme-chalk/src/chart.scss';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'hfn-components/theme-chalk/src/chart.scss';
|