@zgfe/business-lib 1.0.0-beta.2 → 1.0.0-beta.5
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/es/analysisLayout/index.d.ts +28 -0
- package/es/analysisLayout/index.js +6 -2
- package/es/analysisLayout/index.less +10 -3
- package/es/chart/demo/bar.js +0 -1
- package/es/chart/demo/data/data2.d.ts +8 -0
- package/es/chart/demo/data/data2.js +7 -0
- package/es/chart/demo/data/data3.d.ts +10 -0
- package/es/chart/demo/data/data3.js +584 -0
- package/es/chart/demo/map.d.ts +2 -0
- package/es/chart/demo/map.js +11 -0
- package/es/chart/index.d.ts +13 -9
- package/es/chart/index.js +17 -71
- package/es/chart/type.d.ts +22 -0
- package/es/chart/type.js +1 -0
- package/es/chart/{chartConfig.d.ts → util/chartConfig.d.ts} +67 -2
- package/es/chart/{chartConfig.js → util/chartConfig.js} +76 -5
- package/es/chart/{color.d.ts → util/color.d.ts} +0 -0
- package/es/chart/{color.js → util/color.js} +0 -0
- package/es/chart/util/data/china.js +530 -0
- package/es/chart/util/data/cityGeoCoord.d.ts +22553 -0
- package/es/chart/util/data/cityGeoCoord.js +22552 -0
- package/es/chart/util/data/provinceGeoCoord.d.ts +343 -0
- package/es/chart/util/data/provinceGeoCoord.js +9258 -0
- package/es/chart/util/formatData.d.ts +13 -0
- package/es/chart/util/formatData.js +56 -0
- package/es/chart/util/{format.d.ts → formatOption.d.ts} +2 -1
- package/es/chart/util/{format.js → formatOption.js} +31 -1
- package/es/chart/util/mapUtil.d.ts +8 -0
- package/es/chart/util/mapUtil.js +195 -0
- package/es/dialog/components/selectToInput.d.ts +10 -3
- package/es/dialog/components/selectToInput.js +75 -12
- package/es/dialog/demo/index.js +27 -20
- package/es/dialog/index.d.ts +34 -2
- package/es/dialog/index.js +123 -53
- package/es/dialog/style/index.less +8 -0
- package/es/select/demo/index.js +2 -1
- package/es/select/index.d.ts +9 -1
- package/es/select/index.js +4 -2
- package/es/table/demo/index2.js +45 -3
- package/es/table/demo/index3.d.ts +2 -0
- package/es/table/demo/index3.js +227 -0
- package/es/table/index.d.ts +1 -1
- package/es/targetConditionGroup/data/operates.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BizChart } from '@zgfe/business-lib';
|
|
3
|
+
import chartData from './data/data3';
|
|
4
|
+
export default (function () {
|
|
5
|
+
return /*#__PURE__*/React.createElement(BizChart, {
|
|
6
|
+
data: chartData,
|
|
7
|
+
type: "map",
|
|
8
|
+
isCity: false,
|
|
9
|
+
useGroup: "1"
|
|
10
|
+
});
|
|
11
|
+
});
|
package/es/chart/index.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
values: Array<number>;
|
|
5
|
-
}
|
|
6
|
-
interface DataProps {
|
|
7
|
-
x_axis?: Array<string>;
|
|
8
|
-
series: Array<ChartItmProps>;
|
|
9
|
-
}
|
|
2
|
+
import './util/data/china.js';
|
|
3
|
+
import { DataProps } from './type';
|
|
10
4
|
interface BizChartProps {
|
|
11
5
|
/**
|
|
12
6
|
* @description 图形类型
|
|
13
7
|
* @default line
|
|
14
8
|
*/
|
|
15
|
-
type
|
|
9
|
+
type: 'bar' | 'pie' | 'line' | 'map';
|
|
16
10
|
/**
|
|
17
11
|
* @description 数据(x轴和series数据)
|
|
18
12
|
* @default -
|
|
@@ -23,6 +17,16 @@ interface BizChartProps {
|
|
|
23
17
|
* @default true
|
|
24
18
|
*/
|
|
25
19
|
sameColor?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description 是否是城市
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
isCity?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @description 用户群,以,隔开
|
|
27
|
+
* @default -
|
|
28
|
+
*/
|
|
29
|
+
userGroup?: string;
|
|
26
30
|
/**
|
|
27
31
|
* @description 提示格式
|
|
28
32
|
* @default -
|
package/es/chart/index.js
CHANGED
|
@@ -19,21 +19,25 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
19
19
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
20
20
|
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
|
21
21
|
import * as echarts from 'echarts';
|
|
22
|
-
import { getChartOption,
|
|
22
|
+
import { getChartOption, getPieOption, getMapOption } from './util/chartConfig';
|
|
23
|
+
import { provinceSeries, citySeries, maxMinValue } from './util/mapUtil';
|
|
24
|
+
import { formatPieData, formatChartData } from './util/formatData';
|
|
25
|
+
import './util/data/china.js';
|
|
23
26
|
import util from '../utils/util';
|
|
24
|
-
import { chartColors } from './color';
|
|
25
27
|
|
|
26
28
|
var BizChart = function BizChart(props) {
|
|
27
|
-
var
|
|
28
|
-
type = _props$type === void 0 ? 'line' : _props$type,
|
|
29
|
+
var type = props.type,
|
|
29
30
|
data = props.data,
|
|
30
31
|
showList = props.showList,
|
|
32
|
+
userGroup = props.userGroup,
|
|
31
33
|
_props$showAll = props.showAll,
|
|
32
34
|
showAll = _props$showAll === void 0 ? true : _props$showAll,
|
|
33
35
|
_props$sameColor = props.sameColor,
|
|
34
36
|
sameColor = _props$sameColor === void 0 ? true : _props$sameColor,
|
|
35
37
|
_props$reverseXAxis = props.reverseXAxis,
|
|
36
38
|
reverseXAxis = _props$reverseXAxis === void 0 ? false : _props$reverseXAxis,
|
|
39
|
+
_props$isCity = props.isCity,
|
|
40
|
+
isCity = _props$isCity === void 0 ? true : _props$isCity,
|
|
37
41
|
seriesName = props.seriesName,
|
|
38
42
|
tooltipFormatter = props.tooltipFormatter,
|
|
39
43
|
xAxisFormatter = props.xAxisFormatter,
|
|
@@ -62,81 +66,23 @@ var BizChart = function BizChart(props) {
|
|
|
62
66
|
|
|
63
67
|
return data;
|
|
64
68
|
}, [showList]);
|
|
65
|
-
|
|
66
|
-
var formatPieData = function formatPieData(data) {
|
|
67
|
-
var list = [];
|
|
68
|
-
var other = {
|
|
69
|
-
name: '其它',
|
|
70
|
-
value: 0
|
|
71
|
-
};
|
|
72
|
-
data.series.forEach(function (item) {
|
|
73
|
-
var series = {
|
|
74
|
-
name: item.names.join('-'),
|
|
75
|
-
value: item.values[0]
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
if (showAll) {
|
|
79
|
-
list.push(series);
|
|
80
|
-
} else {
|
|
81
|
-
if (showList && showMap[series.name] || !showList && list.length < 10) {
|
|
82
|
-
// 数据被showList命中,或者没定义showList,但位于前十的记录
|
|
83
|
-
list.push(series);
|
|
84
|
-
} else {
|
|
85
|
-
other.value += item.values[0];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
if (!showAll && other.value > 0) list.push(other);
|
|
90
|
-
return list;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
var formatChartData = function formatChartData(data) {
|
|
94
|
-
if (reverseXAxis) {
|
|
95
|
-
var series = {
|
|
96
|
-
names: [seriesName || ''],
|
|
97
|
-
values: []
|
|
98
|
-
};
|
|
99
|
-
var x_axis = [];
|
|
100
|
-
var sData = [];
|
|
101
|
-
data.series.forEach(function (seriesItem, index) {
|
|
102
|
-
x_axis.push(seriesItem.names.join('-'));
|
|
103
|
-
|
|
104
|
-
if (reverseXAxis && showList && !showMap[data.series[index].names.join('-')]) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
sData.push({
|
|
109
|
-
name: x_axis[index],
|
|
110
|
-
value: seriesItem.values[0],
|
|
111
|
-
itemStyle: {
|
|
112
|
-
normal: {
|
|
113
|
-
color: chartColors[sData.length]
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
return {
|
|
119
|
-
x_axis: x_axis,
|
|
120
|
-
series: sData
|
|
121
|
-
};
|
|
122
|
-
} else {
|
|
123
|
-
return data;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
69
|
useEffect(function () {
|
|
128
70
|
var eOption = {};
|
|
129
71
|
|
|
130
72
|
if (type === 'pie') {
|
|
131
|
-
var rData = formatPieData(data);
|
|
132
|
-
eOption =
|
|
133
|
-
} else {
|
|
134
|
-
var _rData = formatChartData(data);
|
|
73
|
+
var rData = formatPieData(data, showAll, showMap, showList);
|
|
74
|
+
eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
|
|
75
|
+
} else if (type === 'line' || type === 'bar') {
|
|
76
|
+
var _rData = formatChartData(data, reverseXAxis, showMap, showList);
|
|
135
77
|
|
|
136
78
|
eOption = getChartOption(type, reverseXAxis && showList ? showList : _rData.x_axis, _rData.series, sameColor, legendPosition, legendOrient, valueUnit, tooltipFormatter, xAxisFormatter, yAxisFormatter, reverseXAxis, seriesName);
|
|
79
|
+
} else if (type === 'map') {
|
|
80
|
+
var series = isCity ? citySeries(data, !!userGroup) : provinceSeries(data, !!userGroup);
|
|
81
|
+
var maxMin = maxMinValue(series[0]);
|
|
82
|
+
var showVisualMap = !(userGroup && userGroup.split(',').length > 1);
|
|
83
|
+
eOption = getMapOption(series, maxMin, showVisualMap, tooltipFormatter);
|
|
137
84
|
}
|
|
138
85
|
|
|
139
|
-
console.log(type, ' >>> ', eOption);
|
|
140
86
|
setChartOption(function () {
|
|
141
87
|
return _objectSpread({}, eOption);
|
|
142
88
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ChartItmProps {
|
|
2
|
+
names: Array<string>;
|
|
3
|
+
values: Array<number>;
|
|
4
|
+
userGroupCompareData?: object;
|
|
5
|
+
}
|
|
6
|
+
export interface DataProps {
|
|
7
|
+
x_axis: Array<string>;
|
|
8
|
+
series: Array<ChartItmProps>;
|
|
9
|
+
}
|
|
10
|
+
export interface ItemDataProps {
|
|
11
|
+
data: Array<object>;
|
|
12
|
+
[prop: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export interface ProvinceDataProps {
|
|
15
|
+
name: string;
|
|
16
|
+
value: number;
|
|
17
|
+
childrenOptions: Array<any>;
|
|
18
|
+
isProvince?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ProvinceMapDataProps {
|
|
21
|
+
[prop: string]: ProvinceDataProps;
|
|
22
|
+
}
|
package/es/chart/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridComponentOption, TitleComponentOption, TooltipComponentOption } from 'echarts/types/dist/echarts';
|
|
2
2
|
import { BarSeriesOption, LegendComponentOption, LineSeriesOption, PieSeriesOption, ToolboxComponentOption, XAXisOption, YAXisOption } from 'echarts/types/dist/shared';
|
|
3
|
-
import '
|
|
3
|
+
import '../index.less';
|
|
4
4
|
export declare const baseConfig: EChartsOption;
|
|
5
5
|
export declare const seriesConfig: any;
|
|
6
6
|
export declare type EChartsOption = echarts.ComposeOption<TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GridComponentOption | LegendComponentOption | LineSeriesOption | BarSeriesOption | PieSeriesOption>;
|
|
@@ -40,4 +40,69 @@ export declare const getChartOption: (chartType: string, xData?: string[] | unde
|
|
|
40
40
|
* @param tooltipFormatter tooltip 自定义显示
|
|
41
41
|
* @returns
|
|
42
42
|
*/
|
|
43
|
-
export declare const
|
|
43
|
+
export declare const getPieOption: (seriesData?: object[], legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', tooltipFormatter?: ((value: any) => string) | undefined) => EChartsOption;
|
|
44
|
+
/**
|
|
45
|
+
* 地图
|
|
46
|
+
* @param seriesData 数据
|
|
47
|
+
* @param maxMinValue 最大最小值
|
|
48
|
+
* @param showVisualMap 是否显示
|
|
49
|
+
* @param tooltipFormat 提示formatter
|
|
50
|
+
* @returns option
|
|
51
|
+
*/
|
|
52
|
+
export declare const getMapOption: (seriesData: object[] | undefined, maxMinValue: {
|
|
53
|
+
min: number;
|
|
54
|
+
max: number;
|
|
55
|
+
}, showVisualMap?: boolean, tooltipFormat?: ((value: any) => string) | undefined) => {
|
|
56
|
+
geo: {
|
|
57
|
+
map: string;
|
|
58
|
+
roam: boolean;
|
|
59
|
+
layoutCenter: string[];
|
|
60
|
+
top: number;
|
|
61
|
+
bottom: number;
|
|
62
|
+
};
|
|
63
|
+
backgroundColor: string;
|
|
64
|
+
tooltip: {
|
|
65
|
+
trigger: string;
|
|
66
|
+
textStyle: {
|
|
67
|
+
fontSize: number;
|
|
68
|
+
};
|
|
69
|
+
backgroundColor: string;
|
|
70
|
+
borderColor: string;
|
|
71
|
+
padding: number;
|
|
72
|
+
extraCssText: string;
|
|
73
|
+
className: string;
|
|
74
|
+
confine: boolean;
|
|
75
|
+
formatter: (params: any) => string | undefined;
|
|
76
|
+
};
|
|
77
|
+
legend: {
|
|
78
|
+
show: boolean;
|
|
79
|
+
};
|
|
80
|
+
visualMap: {
|
|
81
|
+
type: string;
|
|
82
|
+
min: number;
|
|
83
|
+
max: number;
|
|
84
|
+
left: string;
|
|
85
|
+
top: string;
|
|
86
|
+
text: string[];
|
|
87
|
+
realtime: boolean;
|
|
88
|
+
calculable: boolean;
|
|
89
|
+
seriesIndex: number;
|
|
90
|
+
inRange: {
|
|
91
|
+
color: string[];
|
|
92
|
+
};
|
|
93
|
+
show: boolean;
|
|
94
|
+
};
|
|
95
|
+
toolbox: {
|
|
96
|
+
show: boolean;
|
|
97
|
+
orient: string;
|
|
98
|
+
right: string;
|
|
99
|
+
bottom: string;
|
|
100
|
+
feature: {
|
|
101
|
+
saveAsImage: {
|
|
102
|
+
show: boolean;
|
|
103
|
+
title: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
series: object[];
|
|
108
|
+
};
|
|
@@ -16,9 +16,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
|
|
17
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
18
|
|
|
19
|
+
import { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter } from './formatOption';
|
|
19
20
|
import { chartColors } from './color';
|
|
20
|
-
import
|
|
21
|
-
import './index.less';
|
|
21
|
+
import '../index.less';
|
|
22
22
|
export var baseConfig = {
|
|
23
23
|
color: chartColors,
|
|
24
24
|
textStyle: {
|
|
@@ -225,9 +225,9 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
225
225
|
|
|
226
226
|
|
|
227
227
|
if (legendPosition === 'top') {
|
|
228
|
-
grid.top = series.length > 1 ||
|
|
228
|
+
grid.top = series.length > 1 || series[0].name ? 45 : 10;
|
|
229
229
|
} else if (legendPosition === 'bottom') {
|
|
230
|
-
grid.bottom = series.length > 1 ? 45 : 0;
|
|
230
|
+
grid.bottom = series.length > 1 || series[0].name ? 45 : 0;
|
|
231
231
|
} // 图例配置
|
|
232
232
|
|
|
233
233
|
|
|
@@ -259,7 +259,7 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
259
259
|
* @returns
|
|
260
260
|
*/
|
|
261
261
|
|
|
262
|
-
export var
|
|
262
|
+
export var getPieOption = function getPieOption() {
|
|
263
263
|
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
264
264
|
var legendPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
|
265
265
|
var legendOrient = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'horizontal';
|
|
@@ -305,4 +305,75 @@ export var getPieConfig = function getPieConfig() {
|
|
|
305
305
|
grid: grid,
|
|
306
306
|
series: series
|
|
307
307
|
});
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* 地图
|
|
311
|
+
* @param seriesData 数据
|
|
312
|
+
* @param maxMinValue 最大最小值
|
|
313
|
+
* @param showVisualMap 是否显示
|
|
314
|
+
* @param tooltipFormat 提示formatter
|
|
315
|
+
* @returns option
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
export var getMapOption = function getMapOption() {
|
|
319
|
+
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
320
|
+
var maxMinValue = arguments.length > 1 ? arguments[1] : undefined;
|
|
321
|
+
var showVisualMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
322
|
+
var tooltipFormat = arguments.length > 3 ? arguments[3] : undefined;
|
|
323
|
+
var option = {
|
|
324
|
+
geo: {
|
|
325
|
+
map: 'china',
|
|
326
|
+
roam: false,
|
|
327
|
+
layoutCenter: ['30%', '30%'],
|
|
328
|
+
top: 20,
|
|
329
|
+
bottom: 20
|
|
330
|
+
},
|
|
331
|
+
backgroundColor: '#fff',
|
|
332
|
+
tooltip: {
|
|
333
|
+
trigger: 'item',
|
|
334
|
+
textStyle: {
|
|
335
|
+
fontSize: 12
|
|
336
|
+
},
|
|
337
|
+
backgroundColor: 'rgba(250, 251, 253, 0.8)',
|
|
338
|
+
borderColor: 'transparent',
|
|
339
|
+
padding: 8,
|
|
340
|
+
extraCssText: '0px 4px 10px rgba(0, 0, 0, 0.1)',
|
|
341
|
+
className: 'biz-chart-tooltip',
|
|
342
|
+
confine: true,
|
|
343
|
+
formatter: tooltipFormat || mapTooltipFormatter
|
|
344
|
+
},
|
|
345
|
+
legend: {
|
|
346
|
+
show: false
|
|
347
|
+
},
|
|
348
|
+
visualMap: {
|
|
349
|
+
type: 'continuous',
|
|
350
|
+
min: maxMinValue.min,
|
|
351
|
+
max: maxMinValue.max,
|
|
352
|
+
left: 'left',
|
|
353
|
+
top: 'bottom',
|
|
354
|
+
text: ['高', '低'],
|
|
355
|
+
realtime: true,
|
|
356
|
+
calculable: true,
|
|
357
|
+
seriesIndex: 0,
|
|
358
|
+
inRange: {
|
|
359
|
+
color: ['lightskyblue', 'yellow', 'orangered']
|
|
360
|
+
},
|
|
361
|
+
show: showVisualMap // 用户群对比不支持
|
|
362
|
+
|
|
363
|
+
},
|
|
364
|
+
toolbox: {
|
|
365
|
+
show: true,
|
|
366
|
+
orient: 'horizontal',
|
|
367
|
+
right: '20',
|
|
368
|
+
bottom: '20',
|
|
369
|
+
feature: {
|
|
370
|
+
saveAsImage: {
|
|
371
|
+
show: true,
|
|
372
|
+
title: '保存为图片'
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
series: seriesData
|
|
377
|
+
};
|
|
378
|
+
return option;
|
|
308
379
|
};
|
|
File without changes
|
|
File without changes
|