@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,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 };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectProps } from 'antd';
|
|
3
3
|
import '../style/index.less';
|
|
4
|
+
interface ValueType {
|
|
5
|
+
[prop: string]: any;
|
|
6
|
+
}
|
|
4
7
|
interface fieldNamesProps {
|
|
5
8
|
label: string;
|
|
6
9
|
value: string;
|
|
@@ -12,6 +15,11 @@ interface SelectInputProps extends SelectProps {
|
|
|
12
15
|
* @default false
|
|
13
16
|
*/
|
|
14
17
|
name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @description 扩展名称
|
|
20
|
+
* @default -
|
|
21
|
+
*/
|
|
22
|
+
extendName?: string;
|
|
15
23
|
/**
|
|
16
24
|
* @description 创建option回调
|
|
17
25
|
* @default false
|
|
@@ -31,13 +39,12 @@ interface SelectInputProps extends SelectProps {
|
|
|
31
39
|
* @description 默认值
|
|
32
40
|
* @default false
|
|
33
41
|
*/
|
|
34
|
-
value?:
|
|
42
|
+
value?: ValueType;
|
|
35
43
|
/**
|
|
36
44
|
* @description 值改变回调
|
|
37
45
|
* @default -
|
|
38
46
|
*/
|
|
39
|
-
onChange?: (value?:
|
|
40
|
-
onChangeType?: (type: boolean) => void;
|
|
47
|
+
onChange?: (value?: ValueType) => void;
|
|
41
48
|
}
|
|
42
49
|
declare const BizSelectToInput: React.FC<SelectInputProps>;
|
|
43
50
|
export default BizSelectToInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["options", "search", "create", "name", "
|
|
1
|
+
var _excluded = ["options", "search", "create", "name", "extendName", "fieldNames", "value", "onChange"];
|
|
2
2
|
|
|
3
3
|
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; }
|
|
4
4
|
|
|
@@ -25,8 +25,19 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
25
25
|
import React, { useEffect, useState } from 'react';
|
|
26
26
|
import { BizSelect } from '../..';
|
|
27
27
|
import IconFont from '../../components/iconFont';
|
|
28
|
-
import { Input } from 'antd';
|
|
28
|
+
import { Input, Radio, Space, Tooltip } from 'antd';
|
|
29
29
|
import '../style/index.less';
|
|
30
|
+
var inputOptions = [{
|
|
31
|
+
label: '公开',
|
|
32
|
+
value: 1
|
|
33
|
+
}, {
|
|
34
|
+
label: '指定人员明显',
|
|
35
|
+
value: 2,
|
|
36
|
+
title: '通过看板的共享功能指定可见成员'
|
|
37
|
+
}, {
|
|
38
|
+
label: '仅自己可见',
|
|
39
|
+
value: 3
|
|
40
|
+
}];
|
|
30
41
|
|
|
31
42
|
var BizSelectToInput = function BizSelectToInput(props) {
|
|
32
43
|
var options = props.options,
|
|
@@ -36,9 +47,14 @@ var BizSelectToInput = function BizSelectToInput(props) {
|
|
|
36
47
|
create = _props$create === void 0 ? true : _props$create,
|
|
37
48
|
_props$name = props.name,
|
|
38
49
|
name = _props$name === void 0 ? '' : _props$name,
|
|
50
|
+
extendName = props.extendName,
|
|
51
|
+
_props$fieldNames = props.fieldNames,
|
|
52
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
|
53
|
+
label: 'label',
|
|
54
|
+
value: 'value'
|
|
55
|
+
} : _props$fieldNames,
|
|
39
56
|
value = props.value,
|
|
40
57
|
_onChange = props.onChange,
|
|
41
|
-
onChangeType = props.onChangeType,
|
|
42
58
|
res = _objectWithoutProperties(props, _excluded);
|
|
43
59
|
|
|
44
60
|
var _useState = useState(true),
|
|
@@ -56,26 +72,53 @@ var BizSelectToInput = function BizSelectToInput(props) {
|
|
|
56
72
|
isFirst = _useState6[0],
|
|
57
73
|
setIsFirst = _useState6[1];
|
|
58
74
|
|
|
75
|
+
var _useState7 = useState(3),
|
|
76
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
77
|
+
radioData = _useState8[0],
|
|
78
|
+
setRadioData = _useState8[1];
|
|
79
|
+
|
|
80
|
+
var _useState9 = useState(''),
|
|
81
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
82
|
+
inputData = _useState10[0],
|
|
83
|
+
setInputData = _useState10[1];
|
|
84
|
+
|
|
59
85
|
useEffect(function () {
|
|
60
86
|
if (isFirst) {
|
|
61
87
|
setIsFirst(false);
|
|
62
88
|
return;
|
|
63
89
|
}
|
|
64
90
|
|
|
65
|
-
onChangeType && onChangeType(isSelect);
|
|
66
|
-
|
|
67
91
|
if (isSelect) {
|
|
68
92
|
_onChange && _onChange(selectValue);
|
|
69
93
|
} else {
|
|
70
94
|
_onChange && _onChange();
|
|
71
95
|
}
|
|
72
96
|
}, [isSelect]);
|
|
97
|
+
useEffect(function () {
|
|
98
|
+
if (isFirst) return;
|
|
99
|
+
var data = null;
|
|
100
|
+
|
|
101
|
+
if (inputData) {
|
|
102
|
+
if (extendName) {
|
|
103
|
+
var _data;
|
|
104
|
+
|
|
105
|
+
data = (_data = {}, _defineProperty(_data, fieldNames.value, 0), _defineProperty(_data, fieldNames.label, inputData), _defineProperty(_data, extendName, radioData), _data);
|
|
106
|
+
} else {
|
|
107
|
+
var _data2;
|
|
108
|
+
|
|
109
|
+
data = (_data2 = {}, _defineProperty(_data2, fieldNames.value, 0), _defineProperty(_data2, fieldNames.label, value), _data2);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
_onChange && _onChange(data);
|
|
114
|
+
}, [radioData, inputData]);
|
|
73
115
|
return /*#__PURE__*/React.createElement("div", null, isSelect ? /*#__PURE__*/React.createElement(BizSelect, _objectSpread(_objectSpread({
|
|
74
116
|
options: options,
|
|
75
117
|
search: search,
|
|
76
118
|
create: create,
|
|
77
119
|
size: "middle",
|
|
78
|
-
|
|
120
|
+
fieldNames: fieldNames,
|
|
121
|
+
value: selectValue && selectValue[fieldNames.value],
|
|
79
122
|
name: name
|
|
80
123
|
}, res), {}, {
|
|
81
124
|
createOption: function createOption() {
|
|
@@ -83,13 +126,13 @@ var BizSelectToInput = function BizSelectToInput(props) {
|
|
|
83
126
|
return false;
|
|
84
127
|
});
|
|
85
128
|
},
|
|
86
|
-
onChange: function onChange(value) {
|
|
87
|
-
_onChange && _onChange(
|
|
129
|
+
onChange: function onChange(value, data) {
|
|
130
|
+
_onChange && _onChange(data);
|
|
88
131
|
setSelectValue(function () {
|
|
89
|
-
return
|
|
132
|
+
return data;
|
|
90
133
|
});
|
|
91
134
|
}
|
|
92
|
-
})) : /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
})) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
93
136
|
className: "biz-flex"
|
|
94
137
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
95
138
|
className: "biz-input",
|
|
@@ -102,7 +145,9 @@ var BizSelectToInput = function BizSelectToInput(props) {
|
|
|
102
145
|
})
|
|
103
146
|
},
|
|
104
147
|
onBlur: function onBlur(e) {
|
|
105
|
-
|
|
148
|
+
setInputData(function () {
|
|
149
|
+
return e.target.value;
|
|
150
|
+
});
|
|
106
151
|
}
|
|
107
152
|
}), /*#__PURE__*/React.createElement(IconFont, {
|
|
108
153
|
className: "biz-icon biz-icon-switch",
|
|
@@ -112,7 +157,25 @@ var BizSelectToInput = function BizSelectToInput(props) {
|
|
|
112
157
|
return true;
|
|
113
158
|
});
|
|
114
159
|
}
|
|
115
|
-
}))
|
|
160
|
+
})), extendName && /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: "biz-form-radio"
|
|
162
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, {
|
|
163
|
+
value: radioData,
|
|
164
|
+
onChange: function onChange(e) {
|
|
165
|
+
setRadioData(function () {
|
|
166
|
+
return e.target.value;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
170
|
+
direction: "horizontal"
|
|
171
|
+
}, inputOptions.map(function (item) {
|
|
172
|
+
return /*#__PURE__*/React.createElement(Radio, {
|
|
173
|
+
key: item.value,
|
|
174
|
+
value: item.value
|
|
175
|
+
}, item.title ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
176
|
+
title: item.title
|
|
177
|
+
}, item.label) : item.label);
|
|
178
|
+
}))))));
|
|
116
179
|
};
|
|
117
180
|
|
|
118
181
|
export default BizSelectToInput;
|
package/es/dialog/demo/index.js
CHANGED
|
@@ -19,34 +19,35 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
19
19
|
import React, { useState } from 'react';
|
|
20
20
|
import { BizDialog } from '@zgfe/business-lib';
|
|
21
21
|
import { Button } from 'antd';
|
|
22
|
-
var options = [
|
|
22
|
+
var options = [{
|
|
23
|
+
id: 11,
|
|
24
|
+
name: '分类一'
|
|
25
|
+
}, {
|
|
26
|
+
id: 22,
|
|
27
|
+
name: '分类二'
|
|
28
|
+
}, {
|
|
29
|
+
id: 33,
|
|
30
|
+
name: '分分类三一'
|
|
31
|
+
}];
|
|
23
32
|
var chartTypes = ['趋势图', '汇总图', '地图'];
|
|
24
33
|
var fields = [{
|
|
25
34
|
label: '分类',
|
|
26
35
|
name: 'class',
|
|
36
|
+
extendName: 'range',
|
|
27
37
|
type: 'selectToInput',
|
|
28
38
|
options: options,
|
|
29
39
|
children: ['range'],
|
|
40
|
+
fieldNames: {
|
|
41
|
+
label: 'name',
|
|
42
|
+
value: 'id'
|
|
43
|
+
},
|
|
30
44
|
rules: [{
|
|
31
45
|
required: true,
|
|
32
46
|
message: '请选择分类'
|
|
33
|
-
}]
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
type: 'radio',
|
|
38
|
-
dependencies: 'class',
|
|
39
|
-
hidden: true,
|
|
40
|
-
options: [{
|
|
41
|
-
label: '公开',
|
|
42
|
-
value: 'public'
|
|
43
|
-
}, {
|
|
44
|
-
label: '指定人员明显',
|
|
45
|
-
value: 'appoint'
|
|
46
|
-
}, {
|
|
47
|
-
label: '仅自己可见',
|
|
48
|
-
value: 'own'
|
|
49
|
-
}]
|
|
47
|
+
}],
|
|
48
|
+
onChange: function onChange(val) {
|
|
49
|
+
console.log('select>>>', val);
|
|
50
|
+
}
|
|
50
51
|
}, {
|
|
51
52
|
label: '名称',
|
|
52
53
|
name: 'name',
|
|
@@ -69,8 +70,11 @@ var fields = [{
|
|
|
69
70
|
name: 'show',
|
|
70
71
|
type: 'radio',
|
|
71
72
|
direction: 'vertical',
|
|
73
|
+
dependenceFields: {
|
|
74
|
+
chart: 'line'
|
|
75
|
+
},
|
|
72
76
|
options: [{
|
|
73
|
-
label: '动态显示数据最多的
|
|
77
|
+
label: '动态显示数据最多的10个分组',
|
|
74
78
|
value: 'dynamic'
|
|
75
79
|
}, {
|
|
76
80
|
label: '固定显示当前选择的分组',
|
|
@@ -82,7 +86,10 @@ var fields = [{
|
|
|
82
86
|
}]
|
|
83
87
|
}];
|
|
84
88
|
var formData = {
|
|
85
|
-
class:
|
|
89
|
+
class: {
|
|
90
|
+
id: 11,
|
|
91
|
+
name: '分类一'
|
|
92
|
+
},
|
|
86
93
|
range: 'public',
|
|
87
94
|
show: 'dynamic'
|
|
88
95
|
};
|
package/es/dialog/index.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { FormItemProps, ModalProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
interface BizObjectDefaultProps {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
interface fieldNamesProps {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
3
10
|
interface FieldProps {
|
|
11
|
+
/**
|
|
12
|
+
* @description form.item名称
|
|
13
|
+
* @default -
|
|
14
|
+
*/
|
|
15
|
+
label?: string;
|
|
4
16
|
/**
|
|
5
17
|
* @description form.item类型
|
|
6
18
|
* @default input
|
|
@@ -11,13 +23,18 @@ interface FieldProps {
|
|
|
11
23
|
* @default -
|
|
12
24
|
*/
|
|
13
25
|
value?: string | number;
|
|
26
|
+
/**
|
|
27
|
+
* @description form.item 依赖项及其值 {age:20}
|
|
28
|
+
* @default -
|
|
29
|
+
*/
|
|
30
|
+
dependenceFields?: BizObjectDefaultProps;
|
|
14
31
|
/**
|
|
15
32
|
* @description 提示
|
|
16
33
|
* @default -
|
|
17
34
|
*/
|
|
18
35
|
placeholder?: string;
|
|
19
36
|
/**
|
|
20
|
-
* @description form.item
|
|
37
|
+
* @description form.item 排列方向 'horizontal' | 'vertical'
|
|
21
38
|
* @default horizontal
|
|
22
39
|
*/
|
|
23
40
|
direction?: 'horizontal' | 'vertical';
|
|
@@ -26,11 +43,26 @@ interface FieldProps {
|
|
|
26
43
|
* @default -
|
|
27
44
|
*/
|
|
28
45
|
options?: Array<any>;
|
|
46
|
+
/**
|
|
47
|
+
* @description 扩展名称
|
|
48
|
+
* @default -
|
|
49
|
+
*/
|
|
50
|
+
extendName?: string;
|
|
51
|
+
/**
|
|
52
|
+
* @description 下拉框的自定义节点 label、value
|
|
53
|
+
* @default { label: 'label', value: 'value' }
|
|
54
|
+
*/
|
|
55
|
+
fieldNames?: fieldNamesProps;
|
|
29
56
|
/**
|
|
30
57
|
* @description 影响的表单项
|
|
31
58
|
* @default -
|
|
32
59
|
*/
|
|
33
60
|
children?: Array<string>;
|
|
61
|
+
/**
|
|
62
|
+
* @description 值发生改变
|
|
63
|
+
* @default -
|
|
64
|
+
*/
|
|
65
|
+
onChange?: () => void;
|
|
34
66
|
}
|
|
35
67
|
interface BizDialogProps {
|
|
36
68
|
/**
|
|
@@ -64,5 +96,5 @@ interface BizDialogProps {
|
|
|
64
96
|
*/
|
|
65
97
|
onCancel?: () => void;
|
|
66
98
|
}
|
|
67
|
-
declare const BizDialog: React.FC<ModalProps & BizDialogProps>;
|
|
99
|
+
declare const BizDialog: React.FC<ModalProps & BizDialogProps & FormItemProps>;
|
|
68
100
|
export default BizDialog;
|