hfn-components 0.6.1 → 0.6.2
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 +14 -0
- package/es/components/chart/index.d.ts +201 -0
- package/es/components/chart/index.mjs +7 -0
- package/es/components/chart/src/HtChart.d.ts +77 -0
- package/es/components/chart/src/HtChart.mjs +93 -0
- package/es/components/chart/src/HtChart.vue.d.ts +207 -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 +821 -0
- package/es/components/elTable/index.mjs +7 -0
- package/es/components/elTable/src/columnDeal.vue.d.ts +65 -0
- package/es/components/elTable/src/columnDeal.vue.mjs +42 -0
- package/es/components/elTable/src/columnDeal.vue2.mjs +19 -0
- package/es/components/elTable/src/elTable.d.ts +56 -0
- package/es/components/elTable/src/elTable.mjs +49 -0
- package/es/components/elTable/src/elTable.vue.d.ts +820 -0
- package/es/components/elTable/src/elTable.vue.mjs +114 -0
- package/es/components/elTable/src/elTable.vue2.mjs +51 -0
- package/es/components/htTarget/index.d.ts +2028 -0
- package/es/components/htTarget/index.mjs +6 -0
- package/es/components/htTarget/src/htTarget.d.ts +25 -0
- package/es/components/htTarget/src/htTarget.mjs +20 -0
- package/es/components/htTarget/src/htTarget.vue.d.ts +2027 -0
- package/es/components/htTarget/src/htTarget.vue.mjs +240 -0
- package/es/components/htTarget/src/htTarget.vue2.mjs +158 -0
- package/es/components/htTarget/style/index.d.ts +1 -0
- package/es/components/htTarget/style/index.mjs +1 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.mjs +7 -0
- package/es/components/pieChart/index.d.ts +104 -0
- package/es/components/pieChart/index.mjs +7 -0
- package/es/components/pieChart/src/HtPieChart.d.ts +36 -0
- package/es/components/pieChart/src/HtPieChart.mjs +42 -0
- package/es/components/pieChart/src/HtPieChart.vue.d.ts +109 -0
- package/es/components/pieChart/src/HtPieChart.vue.mjs +61 -0
- package/es/components/pieChart/src/HtPieChart.vue2.mjs +103 -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 +148 -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 +125 -0
- package/es/constants/table.mjs +156 -0
- package/es/constants/target.d.ts +15 -0
- package/es/constants/target.mjs +59 -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 +8 -0
- package/es/utils/chart.mjs +197 -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/ht-table.css +1 -0
- package/theme-chalk/ht-target.css +1 -0
- package/theme-chalk/index.css +1 -0
- package/theme-chalk/src/chart.scss +58 -0
- package/theme-chalk/src/index.scss +3 -0
- package/theme-chalk/src/table.scss +45 -0
- package/theme-chalk/src/target.scss +39 -0
- package/component.ts +0 -15
- package/defaults.ts +0 -5
- package/index.ts +0 -6
- package/make-installer.ts +0 -17
- package/plugin.ts +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import _sfc_main from './HtChart.vue2.mjs';
|
|
2
|
+
import { openBlock, createElementBlock, Fragment, renderList, normalizeStyle, createCommentVNode, createElementVNode, toDisplayString } from 'vue';
|
|
3
|
+
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
|
|
4
|
+
|
|
5
|
+
const _hoisted_1 = { class: "echart-box" };
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "echart-lenged"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_3 = ["onClick", "onMouseover"];
|
|
11
|
+
const _hoisted_4 = ["id"];
|
|
12
|
+
const _hoisted_5 = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "noData"
|
|
15
|
+
};
|
|
16
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
17
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
18
|
+
_ctx.showLegend && !$setup.isEmpty ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
19
|
+
(openBlock(true), createElementBlock(
|
|
20
|
+
Fragment,
|
|
21
|
+
null,
|
|
22
|
+
renderList($setup.allLegend, (item, index) => {
|
|
23
|
+
return openBlock(), createElementBlock("div", {
|
|
24
|
+
class: "span-box mb10",
|
|
25
|
+
key: index,
|
|
26
|
+
onClick: ($event) => $setup.legendStatus(item, index),
|
|
27
|
+
onMouseover: ($event) => $setup.legendEnter(index),
|
|
28
|
+
onMouseleave: _cache[0] || (_cache[0] = ($event) => $setup.legendLeave())
|
|
29
|
+
}, [
|
|
30
|
+
item.lineType === "line" ? (openBlock(), createElementBlock(
|
|
31
|
+
"span",
|
|
32
|
+
{
|
|
33
|
+
key: 0,
|
|
34
|
+
class: "bg-span",
|
|
35
|
+
style: normalizeStyle({ background: item.isShow ? item.color : "#ccc" })
|
|
36
|
+
},
|
|
37
|
+
null,
|
|
38
|
+
4
|
|
39
|
+
/* STYLE */
|
|
40
|
+
)) : createCommentVNode("v-if", true),
|
|
41
|
+
item.lineType === "bar" ? (openBlock(), createElementBlock(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
key: 1,
|
|
45
|
+
class: "bg-span-bar",
|
|
46
|
+
style: normalizeStyle({ background: item.isShow ? item.color : "#ccc" })
|
|
47
|
+
},
|
|
48
|
+
null,
|
|
49
|
+
4
|
|
50
|
+
/* STYLE */
|
|
51
|
+
)) : createCommentVNode("v-if", true),
|
|
52
|
+
createElementVNode(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
style: normalizeStyle({ color: item.isShow ? "#000" : "#ccc" })
|
|
56
|
+
},
|
|
57
|
+
toDisplayString(item.name),
|
|
58
|
+
5
|
|
59
|
+
/* TEXT, STYLE */
|
|
60
|
+
),
|
|
61
|
+
createCommentVNode(` <span
|
|
62
|
+
v-if="isLegend"
|
|
63
|
+
class="returnRatio"
|
|
64
|
+
:style="{ color: item.isShow ? (item.returnRatio > 0 ? 'red' : item.returnRatio < 0 ? 'green' : '#000') : '#ccc' }"
|
|
65
|
+
>
|
|
66
|
+
{{
|
|
67
|
+
item.name !== '\u57FA\u91D1\u89C4\u6A21' && item.name !== '\u603B\u5E02\u503C' && item.name !== '\u6D41\u901A\u5E02\u503C'
|
|
68
|
+
? item.returnRatio === ''
|
|
69
|
+
? ''
|
|
70
|
+
: item.returnRatio.toFixed(2) + (isPercent || specialPercent ? '%' : '')
|
|
71
|
+
: \`\${item.returnRatio}\${props.tooltipUnit}\`
|
|
72
|
+
}}
|
|
73
|
+
</span> `)
|
|
74
|
+
], 40, _hoisted_3);
|
|
75
|
+
}),
|
|
76
|
+
128
|
|
77
|
+
/* KEYED_FRAGMENT */
|
|
78
|
+
))
|
|
79
|
+
])) : createCommentVNode("v-if", true),
|
|
80
|
+
createElementVNode("div", {
|
|
81
|
+
class: "echart-content",
|
|
82
|
+
id: _ctx.chartId
|
|
83
|
+
}, null, 8, _hoisted_4),
|
|
84
|
+
createCommentVNode(" \u56FE\u4F8B\u5168\u7F6E\u7070\u76D2\u5B50 "),
|
|
85
|
+
$setup.noData ? (openBlock(), createElementBlock("div", _hoisted_5, "\u6682\u65E0\u6570\u636E")) : createCommentVNode("v-if", true)
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
var chart = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/libiluo/Desktop/company/component-library/packages/components/chart/src/HtChart.vue"]]);
|
|
89
|
+
|
|
90
|
+
export { chart as default };
|
|
@@ -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 { setEchartTitle, 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
|
+
if (myChart.value) {
|
|
39
|
+
echartInit();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{ deep: true, immediate: true }
|
|
44
|
+
);
|
|
45
|
+
const drawGraph = () => {
|
|
46
|
+
if (props.lineColor && props.lineColor.length > 0) {
|
|
47
|
+
echartOptions.color = props.lineColor;
|
|
48
|
+
}
|
|
49
|
+
setEchartTitle(echartOptions, props);
|
|
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';
|