@zgfe/business-lib 1.0.0-beta.3 → 1.0.0-beta.6

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 (72) hide show
  1. package/es/analysisLayout/index.d.ts +28 -0
  2. package/es/analysisLayout/index.js +6 -2
  3. package/es/analysisLayout/index.less +10 -3
  4. package/es/attributeSelector/index.d.ts +4 -2
  5. package/es/attributeSelector/index.js +30 -15
  6. package/es/chart/demo/bar.js +2 -2
  7. package/es/chart/demo/data/data2.d.ts +8 -0
  8. package/es/chart/demo/data/data2.js +7 -0
  9. package/es/chart/demo/data/data3.d.ts +10 -0
  10. package/es/chart/demo/data/data3.js +584 -0
  11. package/es/chart/demo/map.d.ts +2 -0
  12. package/es/chart/demo/map.js +11 -0
  13. package/es/chart/index.d.ts +29 -9
  14. package/es/chart/index.js +30 -71
  15. package/es/chart/type.d.ts +22 -0
  16. package/es/chart/type.js +1 -0
  17. package/es/chart/{chartConfig.d.ts → util/chartConfig.d.ts} +68 -3
  18. package/es/chart/{chartConfig.js → util/chartConfig.js} +85 -11
  19. package/es/chart/{color.d.ts → util/color.d.ts} +0 -0
  20. package/es/chart/{color.js → util/color.js} +0 -0
  21. package/es/chart/util/data/china.js +530 -0
  22. package/es/chart/util/data/cityGeoCoord.d.ts +22553 -0
  23. package/es/chart/util/data/cityGeoCoord.js +22552 -0
  24. package/es/chart/util/data/provinceGeoCoord.d.ts +343 -0
  25. package/es/chart/util/data/provinceGeoCoord.js +9258 -0
  26. package/es/chart/util/formatData.d.ts +13 -0
  27. package/es/chart/util/formatData.js +56 -0
  28. package/es/chart/util/{format.d.ts → formatOption.d.ts} +2 -1
  29. package/es/chart/util/{format.js → formatOption.js} +31 -1
  30. package/es/chart/util/mapUtil.d.ts +8 -0
  31. package/es/chart/util/mapUtil.js +195 -0
  32. package/es/commonStyle/icon.less +19 -3
  33. package/es/commonStyle/theme.less +5 -2
  34. package/es/dialog/components/selectToInput.d.ts +10 -3
  35. package/es/dialog/components/selectToInput.js +75 -12
  36. package/es/dialog/demo/index.js +27 -20
  37. package/es/dialog/index.d.ts +34 -2
  38. package/es/dialog/index.js +129 -55
  39. package/es/dialog/style/index.less +11 -1
  40. package/es/eventSelector/index.d.ts +5 -0
  41. package/es/eventSelector/index.js +111 -32
  42. package/es/globalAttributes/index.d.ts +3 -2
  43. package/es/globalAttributes/index.js +18 -23
  44. package/es/index.d.ts +2 -1
  45. package/es/index.js +2 -1
  46. package/es/multipleSelector/index.js +32 -4
  47. package/es/select/demo/index.js +2 -1
  48. package/es/select/index.d.ts +9 -1
  49. package/es/select/index.js +4 -2
  50. package/es/table/demo/index2.js +45 -3
  51. package/es/table/demo/index3.d.ts +2 -0
  52. package/es/table/demo/index3.js +227 -0
  53. package/es/table/index.d.ts +1 -1
  54. package/es/targetConditionGroup/components/conditionGroup.d.ts +4 -4
  55. package/es/targetConditionGroup/components/conditionGroup.js +27 -26
  56. package/es/targetConditionGroup/components/conditionItem.d.ts +4 -4
  57. package/es/targetConditionGroup/components/conditionItem.js +81 -108
  58. package/es/targetConditionGroup/data/operates.js +5 -5
  59. package/es/targetConditionGroup/demo/group.d.ts +2 -0
  60. package/es/targetConditionGroup/demo/group.js +42 -0
  61. package/es/targetConditionGroup/demo/index.js +15 -25
  62. package/es/targetConditionGroup/group.d.ts +56 -0
  63. package/es/targetConditionGroup/group.js +204 -0
  64. package/es/targetConditionGroup/index.d.ts +6 -0
  65. package/es/targetConditionGroup/index.js +148 -83
  66. package/es/targetConditionGroup/index.less +12 -0
  67. package/es/targetConditionGroup/type.d.ts +47 -2
  68. package/es/targetSelector/demo/form.js +1 -1
  69. package/es/targetSelector/demo/index.js +1 -1
  70. package/es/targetSelector/index.d.ts +17 -1
  71. package/es/targetSelector/index.js +56 -10
  72. package/package.json +1 -1
package/es/chart/index.js CHANGED
@@ -19,21 +19,30 @@ 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, getPieConfig } from './chartConfig';
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 _props$type = props.type,
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
+ option = props.option,
33
+ userGroup = props.userGroup,
31
34
  _props$showAll = props.showAll,
32
35
  showAll = _props$showAll === void 0 ? true : _props$showAll,
33
36
  _props$sameColor = props.sameColor,
34
37
  sameColor = _props$sameColor === void 0 ? true : _props$sameColor,
35
38
  _props$reverseXAxis = props.reverseXAxis,
36
39
  reverseXAxis = _props$reverseXAxis === void 0 ? false : _props$reverseXAxis,
40
+ _props$isCity = props.isCity,
41
+ isCity = _props$isCity === void 0 ? true : _props$isCity,
42
+ _props$xRotate = props.xRotate,
43
+ xRotate = _props$xRotate === void 0 ? 0 : _props$xRotate,
44
+ _props$yRotate = props.yRotate,
45
+ yRotate = _props$yRotate === void 0 ? 0 : _props$yRotate,
37
46
  seriesName = props.seriesName,
38
47
  tooltipFormatter = props.tooltipFormatter,
39
48
  xAxisFormatter = props.xAxisFormatter,
@@ -62,84 +71,34 @@ var BizChart = function BizChart(props) {
62
71
 
63
72
  return data;
64
73
  }, [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
- });
74
+ useEffect(function () {
75
+ if (option) {
76
+ setChartOption(function () {
77
+ return _objectSpread({}, option);
117
78
  });
118
- return {
119
- x_axis: x_axis,
120
- series: sData
121
- };
122
- } else {
123
- return data;
79
+ return;
124
80
  }
125
- };
126
81
 
127
- useEffect(function () {
128
82
  var eOption = {};
129
83
 
130
84
  if (type === 'pie') {
131
- var rData = formatPieData(data);
132
- eOption = getPieConfig(rData, legendPosition, legendOrient, tooltipFormatter);
133
- } else {
134
- var _rData = formatChartData(data);
135
-
136
- eOption = getChartOption(type, reverseXAxis && showList ? showList : _rData.x_axis, _rData.series, sameColor, legendPosition, legendOrient, valueUnit, tooltipFormatter, xAxisFormatter, yAxisFormatter, reverseXAxis, seriesName);
85
+ var rData = formatPieData(data, showAll, showMap, showList);
86
+ eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
87
+ } else if (type === 'line' || type === 'bar') {
88
+ var _rData = formatChartData(data, reverseXAxis, showMap, showList);
89
+
90
+ eOption = getChartOption(type, reverseXAxis && showList ? showList : _rData.x_axis, _rData.series, sameColor, legendPosition, legendOrient, valueUnit, xRotate, yRotate, tooltipFormatter, xAxisFormatter, yAxisFormatter, reverseXAxis, seriesName);
91
+ } else if (type === 'map') {
92
+ var series = isCity ? citySeries(data, !!userGroup) : provinceSeries(data, !!userGroup);
93
+ var maxMin = maxMinValue(series[0]);
94
+ var showVisualMap = !(userGroup && userGroup.split(',').length > 1);
95
+ eOption = getMapOption(series, maxMin, showVisualMap, tooltipFormatter);
137
96
  }
138
97
 
139
98
  setChartOption(function () {
140
99
  return _objectSpread({}, eOption);
141
100
  });
142
- }, [data, type, reverseXAxis]);
101
+ }, [option, data, type, reverseXAxis]);
143
102
  return /*#__PURE__*/React.createElement(ReactEChartsCore, {
144
103
  echarts: echarts,
145
104
  option: chartOption,
@@ -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
+ }
@@ -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 './index.less';
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>;
@@ -31,7 +31,7 @@ export declare const tooltipConfig: TooltipComponentOption;
31
31
  * @param seriesName 系列名称
32
32
  *
33
33
  */
34
- export declare const getChartOption: (chartType: string, xData?: string[] | undefined, seriesData?: object[], sameColor?: boolean, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string | undefined, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean | undefined, seriesName?: string | undefined) => EChartsOption;
34
+ export declare const getChartOption: (chartType: string, xData?: string[] | undefined, seriesData?: object[], sameColor?: boolean, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string | undefined, xRotate?: number, yRotate?: number, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean | undefined, seriesName?: string | undefined) => EChartsOption;
35
35
  /**
36
36
  * 饼图配置
37
37
  * @param seriesData 数据 [{name:'',value:''}]
@@ -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 getPieConfig: (seriesData?: object[], legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', tooltipFormatter?: ((value: any) => string) | undefined) => EChartsOption;
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 { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault } from './util/format';
21
- import './index.less';
21
+ import '../index.less';
22
22
  export var baseConfig = {
23
23
  color: chartColors,
24
24
  textStyle: {
@@ -132,11 +132,13 @@ export var getChartOption = function getChartOption(chartType, xData) {
132
132
  var legendPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'top';
133
133
  var legendOrient = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'horizontal';
134
134
  var unit = arguments.length > 6 ? arguments[6] : undefined;
135
- var tooltipFormatter = arguments.length > 7 ? arguments[7] : undefined;
136
- var xAxisFormatter = arguments.length > 8 ? arguments[8] : undefined;
137
- var yAxisFormatter = arguments.length > 9 ? arguments[9] : undefined;
138
- var reverseXAxis = arguments.length > 10 ? arguments[10] : undefined;
139
- var seriesName = arguments.length > 11 ? arguments[11] : undefined;
135
+ var xRotate = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
136
+ var yRotate = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
137
+ var tooltipFormatter = arguments.length > 9 ? arguments[9] : undefined;
138
+ var xAxisFormatter = arguments.length > 10 ? arguments[10] : undefined;
139
+ var yAxisFormatter = arguments.length > 11 ? arguments[11] : undefined;
140
+ var reverseXAxis = arguments.length > 12 ? arguments[12] : undefined;
141
+ var seriesName = arguments.length > 13 ? arguments[13] : undefined;
140
142
 
141
143
  var xAxis = JSON.parse(JSON.stringify(xAxisConfig)),
142
144
  tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
@@ -154,7 +156,7 @@ export var getChartOption = function getChartOption(chartType, xData) {
154
156
  xAxis.axisLabel = xAxis.axisLabel || {
155
157
  rotate: 0
156
158
  };
157
- xAxis.axisLabel.rotate = chartType === 'bar' ? 45 : 0;
159
+ xAxis.axisLabel.rotate = xRotate;
158
160
 
159
161
  if (xAxisFormatter) {
160
162
  xAxis.axisLabel.formatter = xAxisFormatter;
@@ -164,6 +166,7 @@ export var getChartOption = function getChartOption(chartType, xData) {
164
166
 
165
167
 
166
168
  yAxis.axisLabel = yAxis.axisLabel || {};
169
+ yAxis.axisLabel.rotate = yRotate;
167
170
 
168
171
  if (yAxisFormatter) {
169
172
  yAxis.axisLabel.formatter = yAxisFormatter;
@@ -225,9 +228,9 @@ export var getChartOption = function getChartOption(chartType, xData) {
225
228
 
226
229
 
227
230
  if (legendPosition === 'top') {
228
- grid.top = series.length > 1 || series[0].name ? 45 : 10;
231
+ grid.top = series.length > 1 || series.length > 0 && series[0].name ? 45 : 10;
229
232
  } else if (legendPosition === 'bottom') {
230
- grid.bottom = series.length > 1 || series[0].name ? 45 : 0;
233
+ grid.bottom = series.length > 1 || series.length > 0 && series[0].name ? 45 : 0;
231
234
  } // 图例配置
232
235
 
233
236
 
@@ -259,7 +262,7 @@ export var getChartOption = function getChartOption(chartType, xData) {
259
262
  * @returns
260
263
  */
261
264
 
262
- export var getPieConfig = function getPieConfig() {
265
+ export var getPieOption = function getPieOption() {
263
266
  var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
264
267
  var legendPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
265
268
  var legendOrient = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'horizontal';
@@ -305,4 +308,75 @@ export var getPieConfig = function getPieConfig() {
305
308
  grid: grid,
306
309
  series: series
307
310
  });
311
+ };
312
+ /**
313
+ * 地图
314
+ * @param seriesData 数据
315
+ * @param maxMinValue 最大最小值
316
+ * @param showVisualMap 是否显示
317
+ * @param tooltipFormat 提示formatter
318
+ * @returns option
319
+ */
320
+
321
+ export var getMapOption = function getMapOption() {
322
+ var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
323
+ var maxMinValue = arguments.length > 1 ? arguments[1] : undefined;
324
+ var showVisualMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
325
+ var tooltipFormat = arguments.length > 3 ? arguments[3] : undefined;
326
+ var option = {
327
+ geo: {
328
+ map: 'china',
329
+ roam: false,
330
+ layoutCenter: ['30%', '30%'],
331
+ top: 20,
332
+ bottom: 20
333
+ },
334
+ backgroundColor: '#fff',
335
+ tooltip: {
336
+ trigger: 'item',
337
+ textStyle: {
338
+ fontSize: 12
339
+ },
340
+ backgroundColor: 'rgba(250, 251, 253, 0.8)',
341
+ borderColor: 'transparent',
342
+ padding: 8,
343
+ extraCssText: '0px 4px 10px rgba(0, 0, 0, 0.1)',
344
+ className: 'biz-chart-tooltip',
345
+ confine: true,
346
+ formatter: tooltipFormat || mapTooltipFormatter
347
+ },
348
+ legend: {
349
+ show: false
350
+ },
351
+ visualMap: {
352
+ type: 'continuous',
353
+ min: maxMinValue.min,
354
+ max: maxMinValue.max,
355
+ left: 'left',
356
+ top: 'bottom',
357
+ text: ['高', '低'],
358
+ realtime: true,
359
+ calculable: true,
360
+ seriesIndex: 0,
361
+ inRange: {
362
+ color: ['lightskyblue', 'yellow', 'orangered']
363
+ },
364
+ show: showVisualMap // 用户群对比不支持
365
+
366
+ },
367
+ toolbox: {
368
+ show: true,
369
+ orient: 'horizontal',
370
+ right: '20',
371
+ bottom: '20',
372
+ feature: {
373
+ saveAsImage: {
374
+ show: true,
375
+ title: '保存为图片'
376
+ }
377
+ }
378
+ },
379
+ series: seriesData
380
+ };
381
+ return option;
308
382
  };
File without changes
File without changes