win-chart 2.13.0 → 3.0.0
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/README.md +55 -7
- package/dist/cjs/components/ChartWrapper.cjs +39 -0
- package/dist/cjs/components/EarthChart.cjs +168 -0
- package/dist/cjs/components/GanttChart.cjs +302 -0
- package/dist/cjs/components/WinChart.cjs +125 -0
- package/dist/cjs/index.cjs +58 -0
- package/dist/cjs/types/index.cjs +51 -0
- package/dist/cjs/utils/const.cjs +68 -0
- package/dist/cjs/utils/data.cjs +9382 -0
- package/dist/cjs/utils/earthMockData.cjs +6017 -0
- package/dist/cjs/utils/getAreaSpec.cjs +143 -0
- package/dist/cjs/utils/getBarSpec.cjs +171 -0
- package/dist/cjs/utils/getChartOptions.cjs +78 -0
- package/dist/cjs/utils/getColumnSpec.cjs +127 -0
- package/dist/cjs/utils/getDualSpec.cjs +171 -0
- package/dist/cjs/utils/getFunnelSpec.cjs +89 -0
- package/dist/cjs/utils/getLineSpec.cjs +72 -0
- package/dist/cjs/utils/getPieSpec.cjs +140 -0
- package/dist/cjs/utils/getRadarSpec.cjs +100 -0
- package/dist/cjs/utils/tool.cjs +240 -0
- package/dist/esm/components/ChartWrapper.js +5 -0
- package/dist/esm/components/EarthChart.js +134 -0
- package/dist/esm/components/GanttChart.js +268 -0
- package/dist/esm/components/WinChart.js +79 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/types/index.js +17 -0
- package/dist/esm/utils/const.js +31 -0
- package/dist/esm/utils/data.js +9342 -0
- package/dist/esm/utils/earthMockData.js +5983 -0
- package/dist/esm/utils/getAreaSpec.js +106 -0
- package/dist/esm/utils/getBarSpec.js +134 -0
- package/dist/esm/utils/getChartOptions.js +44 -0
- package/dist/esm/utils/getColumnSpec.js +90 -0
- package/dist/esm/utils/getDualSpec.js +134 -0
- package/dist/esm/utils/getFunnelSpec.js +55 -0
- package/dist/esm/utils/getLineSpec.js +38 -0
- package/dist/esm/utils/getPieSpec.js +103 -0
- package/dist/esm/utils/getRadarSpec.js +66 -0
- package/dist/esm/utils/tool.js +146 -0
- package/dist/index.js +1219 -0
- package/dist/types/components/GanttChart.d.ts +0 -1
- package/dist/types/demos/DualSystemComparisonChart.d.ts +1 -0
- package/dist/types/demos/EastWestResourceComparisonChart.d.ts +1 -0
- package/dist/types/demos/PolicyGrowthChart.d.ts +1 -0
- package/dist/types/demos/PolicyOpennessChart.d.ts +1 -0
- package/dist/types/demos/PracticalUsageTrendChart.d.ts +1 -0
- package/dist/types/demos/index.d.ts +5 -0
- package/dist/types/types/index.d.ts +14 -14
- package/dist/types/utils/getAreaSpec.d.ts +1 -1
- package/dist/types/utils/getBarSpec.d.ts +1 -1
- package/dist/types/utils/getChartOptions.d.ts +1 -1
- package/dist/types/utils/getColumnSpec.d.ts +1 -1
- package/dist/types/utils/getDualSpec.d.ts +1 -1
- package/dist/types/utils/getFunnelSpec.d.ts +1 -1
- package/dist/types/utils/getLineSpec.d.ts +1 -1
- package/dist/types/utils/getPieSpec.d.ts +1 -1
- package/dist/types/utils/getRadarSpec.d.ts +1 -1
- package/dist/types/utils/tool.d.ts +59 -3
- package/package.json +33 -32
- package/dist/bundle.esm.js +0 -22
- package/dist/index.d.ts +0 -147
- package/dist/types/app.d.ts +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
WinChart: ()=>WinChart
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const external_ChartWrapper_cjs_namespaceObject = require("./ChartWrapper.cjs");
|
|
40
|
+
const external_react_namespaceObject = require("react");
|
|
41
|
+
const getChartOptions_cjs_namespaceObject = require("../utils/getChartOptions.cjs");
|
|
42
|
+
const external_echarts_namespaceObject = require("echarts");
|
|
43
|
+
const const_cjs_namespaceObject = require("../utils/const.cjs");
|
|
44
|
+
const tool_cjs_namespaceObject = require("../utils/tool.cjs");
|
|
45
|
+
const win_light_cjs_namespaceObject = require("../theme/win-light.cjs");
|
|
46
|
+
var win_light_cjs_default = /*#__PURE__*/ __webpack_require__.n(win_light_cjs_namespaceObject);
|
|
47
|
+
const win_dark_cjs_namespaceObject = require("../theme/win-dark.cjs");
|
|
48
|
+
var win_dark_cjs_default = /*#__PURE__*/ __webpack_require__.n(win_dark_cjs_namespaceObject);
|
|
49
|
+
const external_deepmerge_namespaceObject = require("deepmerge");
|
|
50
|
+
var external_deepmerge_default = /*#__PURE__*/ __webpack_require__.n(external_deepmerge_namespaceObject);
|
|
51
|
+
const index_cjs_namespaceObject = require("../types/index.cjs");
|
|
52
|
+
external_echarts_namespaceObject.registerTheme('light', external_deepmerge_default()(win_light_cjs_default(), const_cjs_namespaceObject.commonOpt));
|
|
53
|
+
external_echarts_namespaceObject.registerTheme('dark', external_deepmerge_default()(win_dark_cjs_default(), const_cjs_namespaceObject.commonOpt));
|
|
54
|
+
const mergeOption = {
|
|
55
|
+
arrayMerge: (_destinationArray, sourceArray)=>sourceArray
|
|
56
|
+
};
|
|
57
|
+
const WinChart = (props)=>{
|
|
58
|
+
const boxRef = (0, external_react_namespaceObject.useRef)(null);
|
|
59
|
+
const [instance, setInstance] = (0, external_react_namespaceObject.useState)();
|
|
60
|
+
const [refreshTag, setRefreshTag] = (0, external_react_namespaceObject.useState)(1);
|
|
61
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
62
|
+
const chart = external_echarts_namespaceObject.init(boxRef.current, props.theme ?? 'light');
|
|
63
|
+
setInstance(chart);
|
|
64
|
+
const resize = (0, tool_cjs_namespaceObject.debounce)(chart.resize, 500);
|
|
65
|
+
const handlerResize = ()=>resize();
|
|
66
|
+
globalThis.addEventListener('resize', handlerResize);
|
|
67
|
+
return ()=>{
|
|
68
|
+
globalThis.removeEventListener('resize', handlerResize);
|
|
69
|
+
};
|
|
70
|
+
}, [
|
|
71
|
+
props.theme
|
|
72
|
+
]);
|
|
73
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
74
|
+
if (instance && refreshTag) {
|
|
75
|
+
const actualChartHeight = instance.getHeight() - 48;
|
|
76
|
+
const newProps = {
|
|
77
|
+
...props,
|
|
78
|
+
...props.chartType === index_cjs_namespaceObject.WinChartType.CYCLE && !props.cycleCenterConfig && {
|
|
79
|
+
cycleCenterConfig: {
|
|
80
|
+
title: {
|
|
81
|
+
top: actualChartHeight / 2 + 24
|
|
82
|
+
},
|
|
83
|
+
content: {
|
|
84
|
+
top: actualChartHeight / 2 - 8
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const { extraOption = {}, extraSeriesOption } = newProps;
|
|
90
|
+
instance.clear();
|
|
91
|
+
const option = external_deepmerge_default()((0, tool_cjs_namespaceObject.mergeSeriesOption)((0, getChartOptions_cjs_namespaceObject.getEChartOptions)(newProps), extraSeriesOption), extraOption, mergeOption);
|
|
92
|
+
instance.setOption(option);
|
|
93
|
+
newProps.onLoad?.(instance);
|
|
94
|
+
const timer = setTimeout(()=>{
|
|
95
|
+
instance.resize();
|
|
96
|
+
}, 500);
|
|
97
|
+
return ()=>{
|
|
98
|
+
clearTimeout(timer);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}, [
|
|
102
|
+
instance,
|
|
103
|
+
props,
|
|
104
|
+
refreshTag
|
|
105
|
+
]);
|
|
106
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
107
|
+
if (instance) instance.on('refresh', ()=>{
|
|
108
|
+
setRefreshTag((refreshTag)=>refreshTag + 1);
|
|
109
|
+
});
|
|
110
|
+
}, [
|
|
111
|
+
instance
|
|
112
|
+
]);
|
|
113
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ChartWrapper_cjs_namespaceObject.ChartWrapper, {
|
|
114
|
+
ref: boxRef,
|
|
115
|
+
className: props.className,
|
|
116
|
+
style: props.style
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
exports.WinChart = __webpack_exports__.WinChart;
|
|
120
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
121
|
+
"WinChart"
|
|
122
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
123
|
+
Object.defineProperty(exports, '__esModule', {
|
|
124
|
+
value: true
|
|
125
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EarthChart: ()=>EarthChart_cjs_namespaceObject.EarthChart,
|
|
28
|
+
default: ()=>src,
|
|
29
|
+
echarts: ()=>external_echarts_namespaceObject,
|
|
30
|
+
IWinChartProps: ()=>index_cjs_namespaceObject.IWinChartProps,
|
|
31
|
+
IChartInfo: ()=>index_cjs_namespaceObject.IChartInfo,
|
|
32
|
+
WinChart: ()=>WinChart_cjs_namespaceObject.WinChart,
|
|
33
|
+
WinChartType: ()=>index_cjs_namespaceObject.WinChartType
|
|
34
|
+
});
|
|
35
|
+
const external_echarts_namespaceObject = require("echarts");
|
|
36
|
+
const WinChart_cjs_namespaceObject = require("./components/WinChart.cjs");
|
|
37
|
+
const index_cjs_namespaceObject = require("./types/index.cjs");
|
|
38
|
+
const EarthChart_cjs_namespaceObject = require("./components/EarthChart.cjs");
|
|
39
|
+
const src = WinChart_cjs_namespaceObject.WinChart;
|
|
40
|
+
exports.EarthChart = __webpack_exports__.EarthChart;
|
|
41
|
+
exports.IChartInfo = __webpack_exports__.IChartInfo;
|
|
42
|
+
exports.IWinChartProps = __webpack_exports__.IWinChartProps;
|
|
43
|
+
exports.WinChart = __webpack_exports__.WinChart;
|
|
44
|
+
exports.WinChartType = __webpack_exports__.WinChartType;
|
|
45
|
+
exports["default"] = __webpack_exports__["default"];
|
|
46
|
+
exports.echarts = __webpack_exports__.echarts;
|
|
47
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
48
|
+
"EarthChart",
|
|
49
|
+
"IChartInfo",
|
|
50
|
+
"IWinChartProps",
|
|
51
|
+
"WinChart",
|
|
52
|
+
"WinChartType",
|
|
53
|
+
"default",
|
|
54
|
+
"echarts"
|
|
55
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
56
|
+
Object.defineProperty(exports, '__esModule', {
|
|
57
|
+
value: true
|
|
58
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
WinChartType: ()=>WinChartType
|
|
28
|
+
});
|
|
29
|
+
var WinChartType = /*#__PURE__*/ function(WinChartType) {
|
|
30
|
+
WinChartType["MINI_AREA"] = "mini-area";
|
|
31
|
+
WinChartType["AREA"] = "area";
|
|
32
|
+
WinChartType["DUAL_LINE_BAR"] = "dual-line-bar";
|
|
33
|
+
WinChartType["STACK_DUAL_LINE_BAR"] = "stack-dual-line-bar";
|
|
34
|
+
WinChartType["COLUMN"] = "column";
|
|
35
|
+
WinChartType["STACK_COLUMN"] = "stack-column";
|
|
36
|
+
WinChartType["LINE"] = "line";
|
|
37
|
+
WinChartType["BAR"] = "bar";
|
|
38
|
+
WinChartType["STACK_BAR"] = "stack-bar";
|
|
39
|
+
WinChartType["FUNNEL"] = "funnel";
|
|
40
|
+
WinChartType["PIE"] = "pie";
|
|
41
|
+
WinChartType["CYCLE"] = "cycle";
|
|
42
|
+
WinChartType["RADAR"] = "radar";
|
|
43
|
+
return WinChartType;
|
|
44
|
+
}({});
|
|
45
|
+
exports.WinChartType = __webpack_exports__.WinChartType;
|
|
46
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
47
|
+
"WinChartType"
|
|
48
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
49
|
+
Object.defineProperty(exports, '__esModule', {
|
|
50
|
+
value: true
|
|
51
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
COLOR_LIST: ()=>COLOR_LIST,
|
|
28
|
+
commonOpt: ()=>commonOpt
|
|
29
|
+
});
|
|
30
|
+
const COLOR_LIST = [
|
|
31
|
+
'#3D84FF',
|
|
32
|
+
'#00DCF0',
|
|
33
|
+
'#FCBC26',
|
|
34
|
+
'#00DB75',
|
|
35
|
+
'#BDB8FF',
|
|
36
|
+
'#40B4FF',
|
|
37
|
+
'#FFA101',
|
|
38
|
+
'#90ABE0',
|
|
39
|
+
'#6EE67A',
|
|
40
|
+
'#6B84FF',
|
|
41
|
+
'#FA6B69'
|
|
42
|
+
];
|
|
43
|
+
const commonOpt = {
|
|
44
|
+
grid: {
|
|
45
|
+
top: 24,
|
|
46
|
+
left: 0,
|
|
47
|
+
right: 12,
|
|
48
|
+
bottom: 32,
|
|
49
|
+
containLabel: true
|
|
50
|
+
},
|
|
51
|
+
color: COLOR_LIST,
|
|
52
|
+
legend: {
|
|
53
|
+
itemWidth: 10,
|
|
54
|
+
itemHeight: 10,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
type: 'scroll',
|
|
57
|
+
icon: 'circle'
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.COLOR_LIST = __webpack_exports__.COLOR_LIST;
|
|
61
|
+
exports.commonOpt = __webpack_exports__.commonOpt;
|
|
62
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
63
|
+
"COLOR_LIST",
|
|
64
|
+
"commonOpt"
|
|
65
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
66
|
+
Object.defineProperty(exports, '__esModule', {
|
|
67
|
+
value: true
|
|
68
|
+
});
|