@zgfe/business-lib 1.0.0-beta.3 → 1.0.0-beta.4
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 +3 -1
- package/es/analysisLayout/index.less +8 -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 -70
- 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} +74 -3
- 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/select/demo/index.js +2 -1
- package/es/select/index.js +2 -1
- package/es/targetConditionGroup/data/operates.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataProps } from '../type';
|
|
2
|
+
export declare const formatPieData: (data: DataProps, showAll: boolean, showMap: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, showList?: any[] | undefined) => {
|
|
5
|
+
name: string;
|
|
6
|
+
value: number;
|
|
7
|
+
}[];
|
|
8
|
+
export declare const formatChartData: (data: DataProps, reverseXAxis: boolean, showMap: {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, showList?: any[] | undefined) => {
|
|
11
|
+
x_axis: string[];
|
|
12
|
+
series: any;
|
|
13
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { chartColors } from './color';
|
|
2
|
+
export var formatPieData = function formatPieData(data, showAll, showMap, showList) {
|
|
3
|
+
var list = [];
|
|
4
|
+
var other = {
|
|
5
|
+
name: '其它',
|
|
6
|
+
value: 0
|
|
7
|
+
};
|
|
8
|
+
data.series.forEach(function (item) {
|
|
9
|
+
var series = {
|
|
10
|
+
name: item.names.join('-'),
|
|
11
|
+
value: item.values[0]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
if (showAll) {
|
|
15
|
+
list.push(series);
|
|
16
|
+
} else {
|
|
17
|
+
if (showList && showMap[series.name] || !showList && list.length < 10) {
|
|
18
|
+
// 数据被showList命中,或者没定义showList,但位于前十的记录
|
|
19
|
+
list.push(series);
|
|
20
|
+
} else {
|
|
21
|
+
other.value += item.values[0];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (!showAll && other.value > 0) list.push(other);
|
|
26
|
+
return list;
|
|
27
|
+
};
|
|
28
|
+
export var formatChartData = function formatChartData(data, reverseXAxis, showMap, showList) {
|
|
29
|
+
if (reverseXAxis) {
|
|
30
|
+
var x_axis = [];
|
|
31
|
+
var sData = [];
|
|
32
|
+
data.series.forEach(function (seriesItem, index) {
|
|
33
|
+
x_axis.push(seriesItem.names.join('-'));
|
|
34
|
+
|
|
35
|
+
if (reverseXAxis && showList && !showMap[data.series[index].names.join('-')]) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
sData.push({
|
|
40
|
+
name: x_axis[index],
|
|
41
|
+
value: seriesItem.values[0],
|
|
42
|
+
itemStyle: {
|
|
43
|
+
normal: {
|
|
44
|
+
color: chartColors[sData.length]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
x_axis: x_axis,
|
|
51
|
+
series: sData
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const tooltipFormatterDefault: (params: any) => string;
|
|
2
2
|
declare const yAxisFormatterDefault: (value: number) => string;
|
|
3
3
|
declare const xAxisFormatterDefault: (value: string) => string;
|
|
4
|
-
|
|
4
|
+
declare const mapTooltipFormatter: (params: any) => string | undefined;
|
|
5
|
+
export { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter, };
|
|
@@ -58,4 +58,34 @@ var xAxisFormatterDefault = function xAxisFormatterDefault(value) {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
var mapTooltipFormatter = function mapTooltipFormatter(params) {
|
|
62
|
+
console.log('t00l>>', params);
|
|
63
|
+
if (params.data === null || params.data === undefined) return;
|
|
64
|
+
var data = params.data;
|
|
65
|
+
|
|
66
|
+
if (data.childrenOptions && data.childrenOptions.length) {
|
|
67
|
+
var series = [];
|
|
68
|
+
var childrenOptions = data.childrenOptions;
|
|
69
|
+
childrenOptions.forEach(function (option) {
|
|
70
|
+
var label = option.name || option.names.join('-');
|
|
71
|
+
var value = option.value || option.values;
|
|
72
|
+
|
|
73
|
+
if (util.isArray(value)) {
|
|
74
|
+
value = value[value.length - 1];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
series.push("<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(label, ": </span><span class=\"biz-chart-tooltip-value\" style=\"color:#66ccff;\">").concat(util.toThousands(value), "</span></div>"));
|
|
78
|
+
});
|
|
79
|
+
return "".concat(series.join('<br/>'));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var dataValue = data.value || data.values;
|
|
83
|
+
|
|
84
|
+
if (util.isArray(dataValue)) {
|
|
85
|
+
dataValue = dataValue[dataValue.length - 1];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return "<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(data.name || data.names.join('-'), ": </span><span style=\"color:#66ccff;\">").concat(util.toThousands(dataValue), "</span></div>");
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataProps, ItemDataProps } from '../type';
|
|
2
|
+
declare const citySeries: (mapStore: DataProps, haveUserGroup: boolean) => ItemDataProps[];
|
|
3
|
+
declare const provinceSeries: (data: DataProps, haveUserGroup?: boolean | undefined) => any;
|
|
4
|
+
declare const maxMinValue: (series: ItemDataProps) => {
|
|
5
|
+
max: number;
|
|
6
|
+
min: number;
|
|
7
|
+
};
|
|
8
|
+
export { provinceSeries, citySeries, maxMinValue };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
import util from '../../utils/util';
|
|
22
|
+
import cityGeoCoord from './data/cityGeoCoord';
|
|
23
|
+
import provinceGeoCoord from './data/provinceGeoCoord';
|
|
24
|
+
|
|
25
|
+
var citySeries = function citySeries(mapStore, haveUserGroup) {
|
|
26
|
+
var backGroundMapSeries = {
|
|
27
|
+
type: 'map',
|
|
28
|
+
map: 'china',
|
|
29
|
+
showLegendSymbol: false,
|
|
30
|
+
top: 20,
|
|
31
|
+
bottom: 20,
|
|
32
|
+
data: [] // 省份着色背景地图数据
|
|
33
|
+
|
|
34
|
+
};
|
|
35
|
+
var scatterSeries = {
|
|
36
|
+
name: '',
|
|
37
|
+
type: 'scatter',
|
|
38
|
+
coordinateSystem: 'geo',
|
|
39
|
+
symbolSize: 8,
|
|
40
|
+
data: [] // 城市散点图数据
|
|
41
|
+
|
|
42
|
+
};
|
|
43
|
+
var provinceMapData = {};
|
|
44
|
+
mapStore.x_axis.forEach(function (xItem, i) {
|
|
45
|
+
scatterSeries.name = xItem;
|
|
46
|
+
mapStore.series.forEach(function (cityItem) {
|
|
47
|
+
var cityName = cityItem.names[cityItem.names.length - 1];
|
|
48
|
+
cityName = cityName.replace(/(市|省|自治区)$/, '');
|
|
49
|
+
var cityCoordObj = cityGeoCoord[cityName]; // 城市坐标对象
|
|
50
|
+
|
|
51
|
+
if (cityCoordObj) {
|
|
52
|
+
var cityValue = cityItem.values[i];
|
|
53
|
+
var scatterItem = {
|
|
54
|
+
name: cityCoordObj.name,
|
|
55
|
+
isCity: true,
|
|
56
|
+
value: [cityCoordObj.log, cityCoordObj.lat, cityValue],
|
|
57
|
+
childrenOptions: cityItem.userGroupCompareData
|
|
58
|
+
};
|
|
59
|
+
scatterSeries.data.push(scatterItem); // 计算省份数据,注有用户群对比时,因无法去重,导致省份数据不准,目前省份数据只做颜色区分,不做数据展示,后续产品方案会修改
|
|
60
|
+
|
|
61
|
+
var provinceObj = cityCoordObj.province; // 省份坐标对象
|
|
62
|
+
|
|
63
|
+
var provinceName = provinceObj ? provinceObj.name.replace(/(省|市)$/, '') : '';
|
|
64
|
+
var currentMapData = provinceMapData[provinceName];
|
|
65
|
+
var currentMapOptions = currentMapData ? currentMapData.childrenOptions : [];
|
|
66
|
+
provinceMapData[provinceName] = {
|
|
67
|
+
name: provinceName,
|
|
68
|
+
isProvince: true,
|
|
69
|
+
value: currentMapData ? currentMapData.value + cityValue : cityValue,
|
|
70
|
+
childrenOptions: currentMapOptions.concat(haveUserGroup ? cityItem.userGroupCompareData : [cityItem])
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
for (var j in provinceMapData) {
|
|
77
|
+
backGroundMapSeries.data.push(_objectSpread({
|
|
78
|
+
itemStyle: {
|
|
79
|
+
color: '#ccccef',
|
|
80
|
+
opacity: 0.5
|
|
81
|
+
}
|
|
82
|
+
}, provinceMapData[j]));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return [scatterSeries, backGroundMapSeries];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var provinceSeries = function provinceSeries(data, haveUserGroup) {
|
|
89
|
+
var series = [];
|
|
90
|
+
var mapStore = formatData(data, haveUserGroup);
|
|
91
|
+
mapStore.x_axis.forEach(function (xItem, i) {
|
|
92
|
+
var item = {
|
|
93
|
+
name: xItem,
|
|
94
|
+
type: 'map',
|
|
95
|
+
map: 'china',
|
|
96
|
+
roam: false,
|
|
97
|
+
top: 20,
|
|
98
|
+
bottom: 20,
|
|
99
|
+
label: {
|
|
100
|
+
show: true,
|
|
101
|
+
color: '#565656' // formatter: (params: { name: string }) => {
|
|
102
|
+
// return params.name.replace(/(市|省|自治区|维吾尔自治区|特别行政区|壮族自治区|回族自治区)$/, '')
|
|
103
|
+
// }
|
|
104
|
+
|
|
105
|
+
},
|
|
106
|
+
showLegendSymbol: false,
|
|
107
|
+
data: []
|
|
108
|
+
};
|
|
109
|
+
mapStore.series.forEach(function (provinceItem) {
|
|
110
|
+
var name = provinceItem.name || provinceItem.names;
|
|
111
|
+
var provinceName = _typeof(name) === 'object' ? name[name.length - 1] : name;
|
|
112
|
+
provinceName = provinceName.replace(/(市|省|自治区)$/, '');
|
|
113
|
+
var provinceCoordObj = provinceGeoCoord[provinceName];
|
|
114
|
+
name = _typeof(name) === 'object' ? name.join('-') : name;
|
|
115
|
+
name = name.replace(/(市|省|自治区)$/, '');
|
|
116
|
+
|
|
117
|
+
if (provinceCoordObj) {
|
|
118
|
+
// 过滤json库中不存在的省
|
|
119
|
+
item.data.push({
|
|
120
|
+
name: name,
|
|
121
|
+
isProvince: true,
|
|
122
|
+
value: provinceItem.values[i],
|
|
123
|
+
childrenOptions: provinceItem.userGroupCompareData
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
series.push(item);
|
|
128
|
+
});
|
|
129
|
+
return series;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var maxMinValue = function maxMinValue(series) {
|
|
133
|
+
var max = 100;
|
|
134
|
+
var min = 0;
|
|
135
|
+
var valueArr = [];
|
|
136
|
+
series.data.forEach(function (item) {
|
|
137
|
+
var value = item.hasOwnProperty('value') ? item.value : item.values;
|
|
138
|
+
|
|
139
|
+
if (util.isArray(value)) {
|
|
140
|
+
value = value[value.length - 1];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
valueArr = valueArr.concat([value]);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (valueArr.length) {
|
|
147
|
+
max = Math.max.apply(Math, _toConsumableArray(valueArr));
|
|
148
|
+
min = Math.min.apply(Math, _toConsumableArray(valueArr));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (max <= min) {
|
|
152
|
+
max = min + 1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
max: max,
|
|
157
|
+
min: min
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
var formatData = function formatData(seriesData, haveUserGroup) {
|
|
162
|
+
if (haveUserGroup) {
|
|
163
|
+
// 有用户群时增加userGroupCompareData
|
|
164
|
+
var store = {
|
|
165
|
+
x_axis: seriesData.x_axis,
|
|
166
|
+
series: []
|
|
167
|
+
};
|
|
168
|
+
var areaObjMap = {};
|
|
169
|
+
seriesData.series.forEach(function (item) {
|
|
170
|
+
var areaName = item.names[item.names.length - 1];
|
|
171
|
+
|
|
172
|
+
if (!areaObjMap[areaName]) {
|
|
173
|
+
areaObjMap[areaName] = {
|
|
174
|
+
names: [areaName],
|
|
175
|
+
values: item.values,
|
|
176
|
+
userGroupCompareData: [item]
|
|
177
|
+
};
|
|
178
|
+
} else {
|
|
179
|
+
// 注:当有用户群对比时,此区域的values粗略计算为各用户群相加之和(此处未去重,因数据不准目前只做颜色展示,后续产品会修改)
|
|
180
|
+
areaObjMap[areaName].values = [areaObjMap[areaName].values[0] + item.values[0]];
|
|
181
|
+
areaObjMap[areaName].userGroupCompareData.push(item);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
for (var area in areaObjMap) {
|
|
186
|
+
store.series.push(areaObjMap[area]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return store;
|
|
190
|
+
} else {
|
|
191
|
+
return seriesData;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export { provinceSeries, citySeries, maxMinValue };
|
package/es/select/demo/index.js
CHANGED
package/es/select/index.js
CHANGED
|
@@ -146,7 +146,8 @@ var BizSelect = function BizSelect(props) {
|
|
|
146
146
|
}), currentOption.map(function (item) {
|
|
147
147
|
return /*#__PURE__*/React.createElement(Option, {
|
|
148
148
|
value: item[fieldNames.value] || item,
|
|
149
|
-
key: item[fieldNames.value] || item
|
|
149
|
+
key: item[fieldNames.value] || item,
|
|
150
|
+
disabled: item.disabled
|
|
150
151
|
}, item.icon && /*#__PURE__*/React.createElement(IconFont, {
|
|
151
152
|
style: {
|
|
152
153
|
marginRight: '7px',
|
|
@@ -72,13 +72,13 @@ export var dimensionOperate = [{
|
|
|
72
72
|
value: 'number'
|
|
73
73
|
}, {
|
|
74
74
|
name: '次数',
|
|
75
|
-
value: '
|
|
75
|
+
value: 'times'
|
|
76
76
|
}, {
|
|
77
77
|
name: '活跃比',
|
|
78
|
-
value: '
|
|
78
|
+
value: 'active_ratio'
|
|
79
79
|
}, {
|
|
80
80
|
name: '人均次数',
|
|
81
|
-
value: '
|
|
81
|
+
value: 'per'
|
|
82
82
|
}, {
|
|
83
83
|
name: '金额',
|
|
84
84
|
value: 'money',
|
|
@@ -87,10 +87,10 @@ export var dimensionOperate = [{
|
|
|
87
87
|
value: 'sum'
|
|
88
88
|
}, {
|
|
89
89
|
name: '均值',
|
|
90
|
-
value: '
|
|
90
|
+
value: 'avg'
|
|
91
91
|
}, {
|
|
92
92
|
name: '分布',
|
|
93
|
-
value: '
|
|
93
|
+
value: 'duration_times'
|
|
94
94
|
}, {
|
|
95
95
|
name: '中位数',
|
|
96
96
|
value: 'median'
|