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.
Files changed (62) hide show
  1. package/README.md +55 -7
  2. package/dist/cjs/components/ChartWrapper.cjs +39 -0
  3. package/dist/cjs/components/EarthChart.cjs +168 -0
  4. package/dist/cjs/components/GanttChart.cjs +302 -0
  5. package/dist/cjs/components/WinChart.cjs +125 -0
  6. package/dist/cjs/index.cjs +58 -0
  7. package/dist/cjs/types/index.cjs +51 -0
  8. package/dist/cjs/utils/const.cjs +68 -0
  9. package/dist/cjs/utils/data.cjs +9382 -0
  10. package/dist/cjs/utils/earthMockData.cjs +6017 -0
  11. package/dist/cjs/utils/getAreaSpec.cjs +143 -0
  12. package/dist/cjs/utils/getBarSpec.cjs +171 -0
  13. package/dist/cjs/utils/getChartOptions.cjs +78 -0
  14. package/dist/cjs/utils/getColumnSpec.cjs +127 -0
  15. package/dist/cjs/utils/getDualSpec.cjs +171 -0
  16. package/dist/cjs/utils/getFunnelSpec.cjs +89 -0
  17. package/dist/cjs/utils/getLineSpec.cjs +72 -0
  18. package/dist/cjs/utils/getPieSpec.cjs +140 -0
  19. package/dist/cjs/utils/getRadarSpec.cjs +100 -0
  20. package/dist/cjs/utils/tool.cjs +240 -0
  21. package/dist/esm/components/ChartWrapper.js +5 -0
  22. package/dist/esm/components/EarthChart.js +134 -0
  23. package/dist/esm/components/GanttChart.js +268 -0
  24. package/dist/esm/components/WinChart.js +79 -0
  25. package/dist/esm/index.js +6 -0
  26. package/dist/esm/types/index.js +17 -0
  27. package/dist/esm/utils/const.js +31 -0
  28. package/dist/esm/utils/data.js +9342 -0
  29. package/dist/esm/utils/earthMockData.js +5983 -0
  30. package/dist/esm/utils/getAreaSpec.js +106 -0
  31. package/dist/esm/utils/getBarSpec.js +134 -0
  32. package/dist/esm/utils/getChartOptions.js +44 -0
  33. package/dist/esm/utils/getColumnSpec.js +90 -0
  34. package/dist/esm/utils/getDualSpec.js +134 -0
  35. package/dist/esm/utils/getFunnelSpec.js +55 -0
  36. package/dist/esm/utils/getLineSpec.js +38 -0
  37. package/dist/esm/utils/getPieSpec.js +103 -0
  38. package/dist/esm/utils/getRadarSpec.js +66 -0
  39. package/dist/esm/utils/tool.js +146 -0
  40. package/dist/index.js +1219 -0
  41. package/dist/types/components/GanttChart.d.ts +0 -1
  42. package/dist/types/demos/DualSystemComparisonChart.d.ts +1 -0
  43. package/dist/types/demos/EastWestResourceComparisonChart.d.ts +1 -0
  44. package/dist/types/demos/PolicyGrowthChart.d.ts +1 -0
  45. package/dist/types/demos/PolicyOpennessChart.d.ts +1 -0
  46. package/dist/types/demos/PracticalUsageTrendChart.d.ts +1 -0
  47. package/dist/types/demos/index.d.ts +5 -0
  48. package/dist/types/types/index.d.ts +14 -14
  49. package/dist/types/utils/getAreaSpec.d.ts +1 -1
  50. package/dist/types/utils/getBarSpec.d.ts +1 -1
  51. package/dist/types/utils/getChartOptions.d.ts +1 -1
  52. package/dist/types/utils/getColumnSpec.d.ts +1 -1
  53. package/dist/types/utils/getDualSpec.d.ts +1 -1
  54. package/dist/types/utils/getFunnelSpec.d.ts +1 -1
  55. package/dist/types/utils/getLineSpec.d.ts +1 -1
  56. package/dist/types/utils/getPieSpec.d.ts +1 -1
  57. package/dist/types/utils/getRadarSpec.d.ts +1 -1
  58. package/dist/types/utils/tool.d.ts +59 -3
  59. package/package.json +33 -32
  60. package/dist/bundle.esm.js +0 -22
  61. package/dist/index.d.ts +0 -147
  62. package/dist/types/app.d.ts +0 -1
@@ -1,5 +1,4 @@
1
1
  import * as echarts from 'echarts';
2
- import React from 'react';
3
2
  interface IProps {
4
3
  className: string;
5
4
  style: React.CSSProperties;
@@ -0,0 +1 @@
1
+ export declare const DualSystemComparisonChart: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const EastWestResourceComparisonChart: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PolicyGrowthChart: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PolicyOpennessChart: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PracticalUsageTrendChart: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export * from './PolicyGrowthChart';
2
+ export * from './DualSystemComparisonChart';
3
+ export * from './EastWestResourceComparisonChart';
4
+ export * from './PracticalUsageTrendChart';
5
+ export * from './PolicyOpennessChart';
@@ -2,7 +2,7 @@
2
2
  * 标准图表数据
3
3
  */
4
4
  export interface IChartInfo {
5
- label?: string;
5
+ label: string;
6
6
  value: number;
7
7
  type?: string;
8
8
  }
@@ -74,54 +74,54 @@ export declare enum WinChartType {
74
74
  /**
75
75
  * MINI面积图
76
76
  */
77
- MINI_AREA = 0,
77
+ MINI_AREA = "mini-area",
78
78
  /**
79
79
  * 面积图
80
80
  */
81
- AREA = 1,
81
+ AREA = "area",
82
82
  /**
83
83
  * 双轴图
84
84
  */
85
- DUAL_LINE_BAR = 2,
85
+ DUAL_LINE_BAR = "dual-line-bar",
86
86
  /**
87
87
  * 堆叠双轴图
88
88
  */
89
- STACK_DUAL_LINE_BAR = 3,
89
+ STACK_DUAL_LINE_BAR = "stack-dual-line-bar",
90
90
  /**
91
91
  * 柱状图
92
92
  */
93
- COLUMN = 4,
93
+ COLUMN = "column",
94
94
  /**
95
95
  * 堆叠柱状图
96
96
  */
97
- STACK_COLUMN = 5,
97
+ STACK_COLUMN = "stack-column",
98
98
  /**
99
99
  * 折线图
100
100
  */
101
- LINE = 6,
101
+ LINE = "line",
102
102
  /**
103
103
  * 条形图
104
104
  */
105
- BAR = 7,
105
+ BAR = "bar",
106
106
  /**
107
107
  * 堆叠条形图
108
108
  */
109
- STACK_BAR = 8,
109
+ STACK_BAR = "stack-bar",
110
110
  /**
111
111
  * 漏斗图
112
112
  */
113
- FUNNEL = 9,
113
+ FUNNEL = "funnel",
114
114
  /**
115
115
  * 饼图
116
116
  */
117
- PIE = 10,
117
+ PIE = "pie",
118
118
  /**
119
119
  * 环形图
120
120
  */
121
- CYCLE = 11,
121
+ CYCLE = "cycle",
122
122
  /**
123
123
  * 雷达图
124
124
  */
125
- RADAR = 12
125
+ RADAR = "radar"
126
126
  }
127
127
  export {};
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  import * as echarts from 'echarts';
3
3
  /**
4
4
  * Mini 面积图
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  import * as echarts from 'echarts';
3
3
  /**
4
4
  * 条形图
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  /**
3
3
  * 获取图表配置
4
4
  * @returns
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  import * as echarts from 'echarts';
3
3
  /**
4
4
  * 柱状图
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  /**
3
3
  * 双轴图(分组柱状 折线)
4
4
  * @param winChartProps
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  import * as echarts from 'echarts';
3
3
  /**
4
4
  * 漏斗图
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  import * as echarts from 'echarts';
3
3
  /**
4
4
  * 折线图
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  /**
3
3
  * 饼图
4
4
  * @param winChartProps
@@ -1,4 +1,4 @@
1
- import { IWinChartProps } from '@/types';
1
+ import { IWinChartProps } from '../types';
2
2
  /**
3
3
  * 雷达图
4
4
  * @param winChartProps
@@ -1,4 +1,5 @@
1
- import { IChartInfo, IWinChartProps } from '@/types';
1
+ import { IChartInfo, IWinChartProps } from '../types';
2
+ import { graphic } from 'echarts';
2
3
  /**
3
4
  * 判断是否为一个非空数组
4
5
  * @param data 任意类型的数据
@@ -34,13 +35,68 @@ export declare const checkEntityArr: (data: unknown) => boolean;
34
35
  * @param order
35
36
  * @returns
36
37
  */
37
- export declare const dataDescOrder: (data?: IChartInfo[], order?: "asc" | "desc") => IChartInfo[];
38
+ export declare const dataDescOrder: (data?: IChartInfo[], order?: "asc" | "desc") => IChartInfo[] | undefined;
39
+ /**
40
+ * 获取 X 轴刻度
41
+ * @param winChartProps
42
+ * @returns
43
+ */
44
+ export declare const getMainAxisLabels: (winChartProps: IWinChartProps) => string[];
45
+ /**
46
+ * 获取 type 数组
47
+ * @param winChartProps
48
+ * @returns
49
+ */
50
+ export declare const getDataTypes: (winChartProps: IWinChartProps) => string[];
51
+ /**
52
+ * 获取 extra type 数组
53
+ * @param winChartProps
54
+ * @returns
55
+ */
56
+ export declare const getExtraDataTypes: (winChartProps: IWinChartProps) => string[];
57
+ /**
58
+ * 获取 series 数据
59
+ * @param winChartProps
60
+ * @param type
61
+ * @param label
62
+ * @returns
63
+ */
64
+ export declare const getSeriesDataByType: (winChartProps: IWinChartProps, type: string) => number[];
65
+ /**
66
+ * 获取 series 标签
67
+ * @returns
68
+ */
69
+ export declare const getSeriesLabelConfig: (winChartProps: IWinChartProps) => {
70
+ show: boolean;
71
+ formatter: string;
72
+ position: any;
73
+ showSymbol: boolean;
74
+ } | {
75
+ show: boolean;
76
+ formatter?: undefined;
77
+ position?: undefined;
78
+ showSymbol?: undefined;
79
+ };
80
+ /**
81
+ * 处理主轴标签
82
+ * @param winChartProps
83
+ * @param name
84
+ * @returns
85
+ */
86
+ export declare const handleMainAxisLabel: (winChartProps: IWinChartProps, name: string) => string;
38
87
  /**
39
88
  * 获取 X 轴配置
40
89
  * @param winChartProps
41
90
  * @returns
42
91
  */
43
- export declare const getAxisOpt: (winChartProps: IWinChartProps) => echarts.XAXisComponentOption;
92
+ export declare const getXAxisOpt: (winChartProps: IWinChartProps) => echarts.XAXisComponentOption;
93
+ /**
94
+ * 获取渐变颜色
95
+ * @param winChartProps
96
+ * @param color
97
+ * @returns
98
+ */
99
+ export declare const getGradientColor: (winChartProps: IWinChartProps, color: string) => graphic.LinearGradient;
44
100
  /**
45
101
  * 根据 value 排序
46
102
  * @param arr
package/package.json CHANGED
@@ -1,17 +1,25 @@
1
1
  {
2
2
  "name": "win-chart",
3
- "version": "2.13.0",
3
+ "version": "3.0.0",
4
4
  "description": "菜鸟地网统一图表组件",
5
+ "sideEffects": false,
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/esm/index.d.ts",
9
+ "import": "./dist/esm/index.js",
10
+ "require": "./dist/cjs/index.js"
11
+ }
12
+ },
5
13
  "files": [
6
14
  "dist"
7
15
  ],
8
- "main": "dist/bundle.esm.js",
9
- "module": "dist/bundle.esm.js",
10
- "types": "dist/index.d.ts",
16
+ "main": "dist/cjs/index.js",
17
+ "module": "dist/esm/index.js",
18
+ "types": "dist/esm/index.d.ts",
11
19
  "type": "module",
12
20
  "scripts": {
13
21
  "dev": "rsbuild dev",
14
- "build": "rollup -c"
22
+ "build": "rslib build"
15
23
  },
16
24
  "keywords": [
17
25
  "chart",
@@ -19,40 +27,33 @@
19
27
  "component"
20
28
  ],
21
29
  "dependencies": {
22
- "dayjs": "^1.11.13",
30
+ "dayjs": "^1.11.19",
23
31
  "deepmerge": "^4.3.1",
24
- "echarts": "^5.6.0",
25
32
  "echarts-gl": "^2.0.9",
26
- "polished": "^4.3.1",
33
+ "polished": "^4.3.1"
34
+ },
35
+ "peerDependencies": {
36
+ "echarts": "^6.0.0",
27
37
  "react": "^18.3.1",
28
38
  "react-dom": "^18.3.1",
29
- "styled-components": "^6.1.14"
39
+ "styled-components": "^6.1.19"
30
40
  },
31
41
  "devDependencies": {
32
- "@eslint/js": "^9.18.0",
33
- "@rollup/plugin-alias": "^5.1.1",
34
- "@rollup/plugin-commonjs": "^25.0.8",
35
- "@rollup/plugin-image": "^3.0.3",
36
- "@rollup/plugin-json": "^6.1.0",
37
- "@rollup/plugin-node-resolve": "^15.3.1",
38
- "@rollup/plugin-terser": "^0.4.4",
39
- "@rollup/plugin-typescript": "^11.1.6",
40
- "@rsbuild/core": "^1.1.13",
41
- "@rsbuild/plugin-react": "^1.1.0",
42
- "@types/node": "^20.17.14",
43
- "@types/react": "^18.3.18",
44
- "@types/react-dom": "^18.3.5",
45
- "eslint": "^9.18.0",
46
- "eslint-plugin-react": "^7.37.4",
47
- "eslint-plugin-react-hooks": "^5.1.0",
48
- "globals": "^15.14.0",
49
- "prettier": "^3.4.2",
50
- "rollup": "^4.31.0",
51
- "rollup-plugin-dts": "^6.1.1",
52
- "rollup-plugin-postcss": "^4.0.2",
42
+ "@eslint/js": "^9.39.1",
43
+ "@rsbuild/core": "~1.6.9",
44
+ "@rsbuild/plugin-react": "^1.4.2",
45
+ "@rslib/core": "^0.18.2",
46
+ "@types/node": "^20.19.25",
47
+ "@types/react": "^18.3.27",
48
+ "@types/react-dom": "^18.3.7",
49
+ "eslint": "^9.39.1",
50
+ "eslint-plugin-react": "^7.37.5",
51
+ "eslint-plugin-react-hooks": "^5.2.0",
52
+ "globals": "^15.15.0",
53
+ "prettier": "^3.7.1",
53
54
  "tslib": "^2.8.1",
54
- "typescript": "^5.7.3",
55
- "typescript-eslint": "^8.20.0"
55
+ "typescript": "^5.9.3",
56
+ "typescript-eslint": "^8.48.0"
56
57
  },
57
58
  "publishConfig": {
58
59
  "access": "public"