@zgfe/business-lib 1.1.27 → 1.1.28
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/addToPanel/components/addPanel.js +8 -21
- package/es/addToPanel/components/radioGroup.js +1 -3
- package/es/addToPanel/components/styleList.js +5 -22
- package/es/addToPanel/demo/edit.js +5 -12
- package/es/addToPanel/demo/index.js +5 -12
- package/es/addToPanel/index.js +21 -58
- package/es/addToScene/addGroup.js +0 -4
- package/es/addToScene/demo/index.js +5 -12
- package/es/addToScene/index.js +13 -40
- package/es/assets/demo/index.js +0 -2
- package/es/assets/demo/input.js +5 -12
- package/es/assets/iconfont/iconfont.js +10 -17
- package/es/assets/theme.js +0 -1
- package/es/attrConditions/components/operateList.js +10 -27
- package/es/attrConditions/components/stringList.js +69 -98
- package/es/attrConditions/components/valuesList.js +14 -40
- package/es/attrConditions/demo/group.js +11 -23
- package/es/attrConditions/demo/index.js +17 -26
- package/es/attrConditions/group.js +17 -48
- package/es/attrConditions/index.js +22 -49
- package/es/attrConditions/types.js +0 -1
- package/es/attributeSelector/demo/disable.js +8 -16
- package/es/attributeSelector/demo/index.js +8 -17
- package/es/attributeSelector/index.js +22 -45
- package/es/attributeSelector/listPanel.js +18 -46
- package/es/attributeSelector/option.js +3 -13
- package/es/attributeSelector/types.js +0 -5
- package/es/attributeSelector/util.js +0 -3
- package/es/chart/demo/index.js +5 -14
- package/es/chart/index.js +30 -44
- package/es/chart/util/chartOptionConfig.d.ts +3 -3
- package/es/chart/util/chartOptionConfig.js +13 -37
- package/es/chart/util/data/china.js +1 -4
- package/es/chart/util/formatData.d.ts +2 -2
- package/es/chart/util/formatData.js +0 -5
- package/es/chart/util/formatOption.js +0 -13
- package/es/chart/util/mapUtil.js +5 -26
- package/es/config.js +0 -2
- package/es/cycleTime/demo/disable.js +0 -1
- package/es/cycleTime/index.js +19 -46
- package/es/cycleTime/month.js +8 -27
- package/es/datePicker/datePicker.js +5 -23
- package/es/datePicker/demo/customType.js +13 -22
- package/es/datePicker/demo/day.js +13 -22
- package/es/datePicker/demo/index.js +12 -21
- package/es/datePicker/index.js +18 -41
- package/es/datePicker/utils.js +0 -7
- package/es/demoWrapper/content.js +31 -56
- package/es/demoWrapper/head.js +9 -23
- package/es/demoWrapper/index.js +14 -30
- package/es/dialog/demo/index.js +5 -12
- package/es/dialog/index.js +4 -6
- package/es/dnd/demo/data.js +19 -28
- package/es/dnd/demo/handle.js +19 -28
- package/es/dnd/index.js +21 -45
- package/es/dnd/item.js +10 -30
- package/es/eventSelector/demo/index.js +12 -23
- package/es/eventSelector/index.js +14 -42
- package/es/eventSelector/listPanel.js +27 -61
- package/es/eventSelector/option.js +6 -11
- package/es/icon/iconFont.js +7 -13
- package/es/layout/analysisLayout/demo/index.js +0 -6
- package/es/layout/analysisLayout/index.d.ts +1 -1
- package/es/layout/analysisLayout/index.js +16 -34
- package/es/layout/detail/index.js +1 -3
- package/es/loginForm/index.js +7 -18
- package/es/searchInput/index.js +2 -7
- package/es/select/demo/children.js +8 -16
- package/es/select/demo/customLabel.js +0 -2
- package/es/select/demo/group.js +8 -17
- package/es/select/demo/index.js +11 -19
- package/es/select/demo/loading.js +8 -18
- package/es/select/demo/multiple.js +8 -16
- package/es/select/handle.js +14 -34
- package/es/select/index.js +22 -59
- package/es/select/option.js +10 -30
- package/es/select/overlay.js +25 -62
- package/es/table/demo/data/table.js +0 -2
- package/es/table/demo/index.js +13 -39
- package/es/table/demo/index2.js +5 -15
- package/es/table/demo/index3.js +7 -28
- package/es/table/index.js +14 -33
- package/es/targetConditionGroup/components/targetDimension.js +12 -38
- package/es/targetConditionGroup/demo/group.js +21 -36
- package/es/targetConditionGroup/demo/index.js +5 -13
- package/es/targetConditionGroup/index.js +31 -84
- package/es/targetSelector/demo/index.js +15 -28
- package/es/targetSelector/editBox.js +5 -20
- package/es/targetSelector/index.js +15 -36
- package/es/targetSelector/optionIcon.js +1 -5
- package/es/targetSelector/optionMenu.js +0 -3
- package/es/userCondition/conditionTypeList.js +7 -12
- package/es/userCondition/conditionWrap.js +0 -2
- package/es/userCondition/conditions/cdpCondition.js +51 -97
- package/es/userCondition/conditions/eventCondition.js +6 -16
- package/es/userCondition/conditions/periodCondition.js +8 -26
- package/es/userCondition/conditions/propCondition.js +29 -61
- package/es/userCondition/conditions/runTimesCondition.js +5 -10
- package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
- package/es/userCondition/conditions/tagsCondition.js +15 -33
- package/es/userCondition/conditions/textDesc.js +16 -67
- package/es/userCondition/demo/index.js +11 -21
- package/es/userCondition/index.js +51 -91
- package/es/userCondition/orConditions.js +11 -48
- package/es/userCondition/relationLabel.js +1 -4
- package/es/userCondition/types.d.ts +1 -1
- package/es/userCondition/types.js +0 -1
- package/es/userCondition/util.js +4 -13
- package/es/userGroup/demo/group.js +14 -23
- package/es/userGroup/demo/index.js +5 -15
- package/es/userGroup/index.js +12 -30
- package/es/userTagsSelector/cascaderOverlay.js +19 -51
- package/es/userTagsSelector/components/search/index.js +0 -2
- package/es/userTagsSelector/demo/index.js +0 -3
- package/es/userTagsSelector/groups/groupOption.js +6 -8
- package/es/userTagsSelector/groups/index.js +15 -30
- package/es/userTagsSelector/index.js +17 -35
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +3 -6
- package/es/userTagsSelector/multipleCheckPanel/index.js +8 -21
- package/es/userTagsSelector/util.js +0 -2
- package/es/utils/ajax.js +45 -71
- package/es/utils/base64.js +3 -22
- package/es/utils/type.d.ts +1 -1
- package/es/utils/type.js +4 -7
- package/es/utils/util.js +0 -16
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ChartTypes } from '../types';
|
|
2
|
-
export declare const formatPieData: (data: ChartTypes.Value, showAll?: boolean
|
|
2
|
+
export declare const formatPieData: (data: ChartTypes.Value, showAll?: boolean, showList?: Array<any>) => {
|
|
3
3
|
name: string;
|
|
4
4
|
value: number;
|
|
5
5
|
}[];
|
|
6
|
-
export declare const formatChartData: (data: ChartTypes.Value, showAll?: boolean
|
|
6
|
+
export declare const formatChartData: (data: ChartTypes.Value, showAll?: boolean, showList?: Array<any>, reverseXAxis?: boolean, color?: string[]) => {
|
|
7
7
|
x_axis: string[];
|
|
8
8
|
series: any;
|
|
9
9
|
};
|
|
@@ -12,7 +12,6 @@ export var formatPieData = function formatPieData(data, showAll, showList) {
|
|
|
12
12
|
name: item.names.join(','),
|
|
13
13
|
value: item.values[0]
|
|
14
14
|
};
|
|
15
|
-
|
|
16
15
|
if (showAll) {
|
|
17
16
|
list.push(series);
|
|
18
17
|
} else {
|
|
@@ -33,7 +32,6 @@ export var formatChartData = function formatChartData(data, showAll, showList, r
|
|
|
33
32
|
var colorData = color || chartColors;
|
|
34
33
|
data.series.forEach(function (seriesItem) {
|
|
35
34
|
var name = seriesItem.names.join(',');
|
|
36
|
-
|
|
37
35
|
if (showAll || showList && showMap[name] || !showList && sData.length < 10) {
|
|
38
36
|
if (reverseXAxis) {
|
|
39
37
|
x_axis.push(name);
|
|
@@ -60,10 +58,8 @@ export var formatChartData = function formatChartData(data, showAll, showList, r
|
|
|
60
58
|
series: sData
|
|
61
59
|
};
|
|
62
60
|
};
|
|
63
|
-
|
|
64
61
|
var getShowMap = function getShowMap(showList) {
|
|
65
62
|
var data = {};
|
|
66
|
-
|
|
67
63
|
if (showList) {
|
|
68
64
|
showList.forEach(function (item) {
|
|
69
65
|
if (util.isArray(item)) {
|
|
@@ -73,6 +69,5 @@ var getShowMap = function getShowMap(showList) {
|
|
|
73
69
|
}
|
|
74
70
|
});
|
|
75
71
|
}
|
|
76
|
-
|
|
77
72
|
return data;
|
|
78
73
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import util from '../../utils/util';
|
|
2
2
|
var maxLength = 20;
|
|
3
|
-
|
|
4
3
|
var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
|
|
5
4
|
var xDate = params[0].name;
|
|
6
5
|
var xLabel = xDate;
|
|
7
6
|
var lengthReg = new RegExp('\\S{1,' + maxLength + '}', 'g');
|
|
8
|
-
|
|
9
7
|
if (/^\d{4}-\d{2}-\d{2}$/.test(xLabel)) {
|
|
10
8
|
xLabel = xLabel.replace(/\d{4}-/, '');
|
|
11
9
|
} else if (/^\d{4}-\d{2}-\d{2}\|\d{4}-\d{2}-\d{2}$/.test(xLabel)) {
|
|
@@ -14,24 +12,20 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
|
|
|
14
12
|
} else {
|
|
15
13
|
xLabel = (xLabel.match(lengthReg) || []).join('<br/>');
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
var htmlArray = [];
|
|
19
16
|
htmlArray.push("<div class=\"biz-chart-tooltip-title\">".concat(xLabel, "</div>"));
|
|
20
17
|
params.forEach(function (item) {
|
|
21
18
|
var lineLabel = item.value;
|
|
22
|
-
|
|
23
19
|
if (item.seriesName.indexOf('CTR') > -1) {
|
|
24
20
|
lineLabel += '%';
|
|
25
21
|
} else {
|
|
26
22
|
lineLabel = util.toThousands(lineLabel);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
var name = (params.length > 1 ? item.seriesName : item.data && item.data.label ? item.data.label : item.name).trim();
|
|
30
25
|
htmlArray.push("<div class=\"biz-chart-tooltip-item\">\n <div class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(item.color, "\"></span>\n <div class=\"biz-tooltip-name\">").concat(name, "</div>\n </div> \n <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span>\n </div>"));
|
|
31
26
|
});
|
|
32
27
|
return htmlArray.join('');
|
|
33
28
|
};
|
|
34
|
-
|
|
35
29
|
var yAxisFormatterDefault = function yAxisFormatterDefault(value) {
|
|
36
30
|
if (parseFloat(String(value)) >= 1000) {
|
|
37
31
|
return util.toThousands(parseFloat((value / 1000).toFixed(1))) + 'k';
|
|
@@ -39,7 +33,6 @@ var yAxisFormatterDefault = function yAxisFormatterDefault(value) {
|
|
|
39
33
|
return String(value);
|
|
40
34
|
}
|
|
41
35
|
};
|
|
42
|
-
|
|
43
36
|
var xAxisFormatterDefault = function xAxisFormatterDefault(value) {
|
|
44
37
|
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
45
38
|
return value.replace(/\d{4}-/, '');
|
|
@@ -48,7 +41,6 @@ var xAxisFormatterDefault = function xAxisFormatterDefault(value) {
|
|
|
48
41
|
return dates ? dates[0].replace(/\d{4}-/, '') + '~' + dates[1].replace(/\d{4}-/, '') : value;
|
|
49
42
|
} else {
|
|
50
43
|
value = util.strMiddleSplit(value);
|
|
51
|
-
|
|
52
44
|
if (/:/.test(value)) {
|
|
53
45
|
return value.replace(/\d{4}-\d{2}-\d{2}\s/, '');
|
|
54
46
|
} else if (/,/.test(value)) {
|
|
@@ -58,11 +50,9 @@ var xAxisFormatterDefault = function xAxisFormatterDefault(value) {
|
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
52
|
};
|
|
61
|
-
|
|
62
53
|
var mapTooltipFormatter = function mapTooltipFormatter(params) {
|
|
63
54
|
if (params.data === null || params.data === undefined) return;
|
|
64
55
|
var data = params.data;
|
|
65
|
-
|
|
66
56
|
if (data.childrenOptions && data.childrenOptions.length) {
|
|
67
57
|
var htmlArray = [];
|
|
68
58
|
htmlArray.push("<div class=\"biz-chart-tooltip-title\">".concat(params.name, "</div>"));
|
|
@@ -72,10 +62,8 @@ var mapTooltipFormatter = function mapTooltipFormatter(params) {
|
|
|
72
62
|
});
|
|
73
63
|
return htmlArray.join('');
|
|
74
64
|
}
|
|
75
|
-
|
|
76
65
|
return "<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(data.name, ": </span><span>").concat(util.toThousands(data.value), "</span></div>");
|
|
77
66
|
};
|
|
78
|
-
|
|
79
67
|
var legendFormatterDefault = function legendFormatterDefault(label) {
|
|
80
68
|
return util.strMiddleSplit(label, {
|
|
81
69
|
maxLength: maxLength,
|
|
@@ -84,5 +72,4 @@ var legendFormatterDefault = function legendFormatterDefault(label) {
|
|
|
84
72
|
replaceStr: '...'
|
|
85
73
|
});
|
|
86
74
|
};
|
|
87
|
-
|
|
88
75
|
export { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter, legendFormatterDefault };
|
package/es/chart/util/mapUtil.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
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
4
|
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
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
6
|
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
|
-
|
|
7
|
+
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; }
|
|
13
8
|
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; }
|
|
14
|
-
|
|
15
9
|
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; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
13
|
import util from '../../utils/util';
|
|
20
14
|
import cityGeoCoord from './data/cityGeoCoord';
|
|
21
15
|
import provinceGeoCoord from './data/provinceGeoCoord';
|
|
22
|
-
|
|
23
16
|
var citySeries = function citySeries(data) {
|
|
24
17
|
var backGroundMapSeries = {
|
|
25
18
|
type: 'map',
|
|
@@ -62,7 +55,6 @@ var citySeries = function citySeries(data) {
|
|
|
62
55
|
};
|
|
63
56
|
});
|
|
64
57
|
});
|
|
65
|
-
|
|
66
58
|
for (var j in provinceMapData) {
|
|
67
59
|
backGroundMapSeries.data.push(_objectSpread({
|
|
68
60
|
itemStyle: {
|
|
@@ -71,10 +63,8 @@ var citySeries = function citySeries(data) {
|
|
|
71
63
|
}
|
|
72
64
|
}, provinceMapData[j]));
|
|
73
65
|
}
|
|
74
|
-
|
|
75
66
|
return [scatterSeries, backGroundMapSeries];
|
|
76
67
|
};
|
|
77
|
-
|
|
78
68
|
var provinceSeries = function provinceSeries(data) {
|
|
79
69
|
var series = [];
|
|
80
70
|
var mapStore = formatMapData(data, 'province');
|
|
@@ -100,36 +90,29 @@ var provinceSeries = function provinceSeries(data) {
|
|
|
100
90
|
});
|
|
101
91
|
return series;
|
|
102
92
|
};
|
|
103
|
-
|
|
104
93
|
var maxMinValue = function maxMinValue(series) {
|
|
105
94
|
var max = 100;
|
|
106
95
|
var min = 0;
|
|
107
96
|
var valueArr = [];
|
|
108
97
|
series.data.forEach(function (item) {
|
|
109
98
|
var value = item.hasOwnProperty('value') ? item.value : item.values;
|
|
110
|
-
|
|
111
99
|
if (util.isArray(value)) {
|
|
112
100
|
value = value[value.length - 1];
|
|
113
101
|
}
|
|
114
|
-
|
|
115
102
|
valueArr = valueArr.concat([value]);
|
|
116
103
|
});
|
|
117
|
-
|
|
118
104
|
if (valueArr.length) {
|
|
119
105
|
max = Math.max.apply(Math, _toConsumableArray(valueArr));
|
|
120
106
|
min = Math.min.apply(Math, _toConsumableArray(valueArr));
|
|
121
107
|
}
|
|
122
|
-
|
|
123
108
|
if (max <= min) {
|
|
124
109
|
max = min + 1;
|
|
125
110
|
}
|
|
126
|
-
|
|
127
111
|
return {
|
|
128
112
|
max: max,
|
|
129
113
|
min: min
|
|
130
114
|
};
|
|
131
115
|
};
|
|
132
|
-
|
|
133
116
|
var formatMapData = function formatMapData(seriesData, type) {
|
|
134
117
|
var store = {
|
|
135
118
|
x_axis: seriesData.x_axis,
|
|
@@ -143,7 +126,6 @@ var formatMapData = function formatMapData(seriesData, type) {
|
|
|
143
126
|
name: targetName || areaName,
|
|
144
127
|
value: item.values[0]
|
|
145
128
|
};
|
|
146
|
-
|
|
147
129
|
if (!areaObjMap[areaName]) {
|
|
148
130
|
areaObjMap[areaName] = {
|
|
149
131
|
name: areaName,
|
|
@@ -156,14 +138,11 @@ var formatMapData = function formatMapData(seriesData, type) {
|
|
|
156
138
|
}
|
|
157
139
|
});
|
|
158
140
|
var areaMap = type === 'province' ? provinceGeoCoord : cityGeoCoord;
|
|
159
|
-
|
|
160
141
|
for (var area in areaObjMap) {
|
|
161
142
|
if (areaMap[area]) {
|
|
162
143
|
store.series.push(areaObjMap[area]);
|
|
163
144
|
}
|
|
164
145
|
}
|
|
165
|
-
|
|
166
146
|
return store;
|
|
167
147
|
};
|
|
168
|
-
|
|
169
148
|
export { provinceSeries, citySeries, maxMinValue };
|
package/es/config.js
CHANGED
package/es/cycleTime/index.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
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
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { DatePicker, Skeleton } from 'antd';
|
|
14
8
|
import moment from 'moment';
|
|
15
9
|
import React, { useEffect, useState } from 'react';
|
|
@@ -17,17 +11,15 @@ import { BizSelect } from '..';
|
|
|
17
11
|
import MonthDay from './month';
|
|
18
12
|
import './styles/index.less';
|
|
19
13
|
export var CycleTimeUnit;
|
|
20
|
-
|
|
21
14
|
(function (CycleTimeUnit) {
|
|
22
15
|
CycleTimeUnit[CycleTimeUnit["day"] = 1] = "day";
|
|
23
16
|
CycleTimeUnit[CycleTimeUnit["week"] = 2] = "week";
|
|
24
17
|
CycleTimeUnit[CycleTimeUnit["month"] = 3] = "month";
|
|
25
18
|
})(CycleTimeUnit || (CycleTimeUnit = {}));
|
|
26
|
-
|
|
27
19
|
var BizCycleTime = function BizCycleTime(props) {
|
|
28
20
|
var multiple = props.multiple,
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
size = props.size,
|
|
22
|
+
disable = props.disable;
|
|
31
23
|
var classPrefix = 'biz-cycle-time';
|
|
32
24
|
var unitList = [{
|
|
33
25
|
label: '每日',
|
|
@@ -41,57 +33,46 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
41
33
|
}];
|
|
42
34
|
var days = [];
|
|
43
35
|
var nums = ['一', '二', '三', '四', '五', '六', '日'];
|
|
44
|
-
|
|
45
36
|
for (var i = 1; i < 8; i++) {
|
|
46
37
|
days.push({
|
|
47
38
|
label: "\u661F\u671F".concat(nums[i - 1]),
|
|
48
39
|
value: i
|
|
49
40
|
});
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
var _useState = useState(unitList[0]),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
unit = _useState2[0],
|
|
45
|
+
setUnit = _useState2[1];
|
|
57
46
|
var _useState3 = useState([]),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
day = _useState4[0],
|
|
49
|
+
setDay = _useState4[1];
|
|
62
50
|
var _useState5 = useState(),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
dayList = _useState6[0],
|
|
53
|
+
setDayList = _useState6[1];
|
|
67
54
|
var _useState7 = useState(),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
56
|
+
time = _useState8[0],
|
|
57
|
+
setTime = _useState8[1];
|
|
72
58
|
var _useState9 = useState(true),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
|
+
initing = _useState10[0],
|
|
61
|
+
setIniting = _useState10[1];
|
|
77
62
|
useEffect(function () {
|
|
78
63
|
if (!props.value) {
|
|
79
64
|
setIniting(false);
|
|
80
65
|
return;
|
|
81
66
|
}
|
|
82
|
-
|
|
83
67
|
setIniting(true);
|
|
84
68
|
unitList.forEach(function (item) {
|
|
85
69
|
var _props$value;
|
|
86
|
-
|
|
87
70
|
if (item.value === ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.unit)) {
|
|
88
71
|
setUnit(item);
|
|
89
|
-
|
|
90
72
|
switch (item.value) {
|
|
91
73
|
case CycleTimeUnit.day:
|
|
92
74
|
setTime(props.value.time);
|
|
93
75
|
break;
|
|
94
|
-
|
|
95
76
|
case CycleTimeUnit.week:
|
|
96
77
|
var valList = [];
|
|
97
78
|
days.forEach(function (item) {
|
|
@@ -99,15 +80,12 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
99
80
|
valList.push(item);
|
|
100
81
|
}
|
|
101
82
|
});
|
|
102
|
-
|
|
103
83
|
if (multiple) {
|
|
104
84
|
setDay(valList);
|
|
105
85
|
} else {
|
|
106
86
|
setDay(valList[0]);
|
|
107
87
|
}
|
|
108
|
-
|
|
109
88
|
break;
|
|
110
|
-
|
|
111
89
|
case CycleTimeUnit.month:
|
|
112
90
|
setDay(props.value.day.map(function (v) {
|
|
113
91
|
return {
|
|
@@ -133,22 +111,18 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
133
111
|
}) : [day.value],
|
|
134
112
|
time: time
|
|
135
113
|
};
|
|
136
|
-
|
|
137
114
|
if (unit.value === CycleTimeUnit.day) {
|
|
138
115
|
delete res.day;
|
|
139
116
|
} else {
|
|
140
117
|
delete res.time;
|
|
141
118
|
}
|
|
142
|
-
|
|
143
119
|
if (props.onChange) props.onChange(res);
|
|
144
120
|
}, [unit, day, dayList, time]);
|
|
145
|
-
|
|
146
121
|
if (initing) {
|
|
147
122
|
return /*#__PURE__*/React.createElement("span", {
|
|
148
123
|
className: classPrefix
|
|
149
124
|
}, /*#__PURE__*/React.createElement(Skeleton.Input, null));
|
|
150
125
|
}
|
|
151
|
-
|
|
152
126
|
return /*#__PURE__*/React.createElement("span", {
|
|
153
127
|
className: classPrefix
|
|
154
128
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
@@ -194,7 +168,6 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
194
168
|
disable: disable
|
|
195
169
|
}));
|
|
196
170
|
};
|
|
197
|
-
|
|
198
171
|
BizCycleTime.defaultProps = {
|
|
199
172
|
multiple: false,
|
|
200
173
|
size: 'middle',
|
package/es/cycleTime/month.js
CHANGED
|
@@ -1,50 +1,37 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
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
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { Dropdown, Tag } from 'antd';
|
|
14
8
|
import React, { useEffect, useState } from 'react';
|
|
15
9
|
import { IconFont } from '..';
|
|
16
10
|
import './styles/month.less';
|
|
17
11
|
import _ from 'lodash';
|
|
18
|
-
|
|
19
12
|
var MonthDay = function MonthDay(props) {
|
|
20
13
|
var classPrefix = 'biz-month-day';
|
|
21
14
|
var disable = props.disable;
|
|
22
|
-
|
|
23
15
|
var _useState = useState([]),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
chosenDayList = _useState2[0],
|
|
18
|
+
setChosenDayList = _useState2[1];
|
|
28
19
|
var _useState3 = useState(false),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
21
|
+
visible = _useState4[0],
|
|
22
|
+
setVisible = _useState4[1];
|
|
33
23
|
var dayList = [];
|
|
34
|
-
|
|
35
24
|
for (var i = 1; i < 33; i++) {
|
|
36
25
|
dayList.push({
|
|
37
26
|
label: String(i === 32 ? '月末' : i),
|
|
38
27
|
value: i
|
|
39
28
|
});
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
useEffect(function () {
|
|
43
31
|
if (!props.defaultValue) return;
|
|
44
32
|
var res = [];
|
|
45
33
|
dayList === null || dayList === void 0 ? void 0 : dayList.forEach(function (item) {
|
|
46
34
|
var _props$defaultValue;
|
|
47
|
-
|
|
48
35
|
(_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.forEach(function (v) {
|
|
49
36
|
if (v.value === item.value) res.push(item);
|
|
50
37
|
});
|
|
@@ -54,11 +41,9 @@ var MonthDay = function MonthDay(props) {
|
|
|
54
41
|
useEffect(function () {
|
|
55
42
|
if (props.onChange) props.onChange(chosenDayList);
|
|
56
43
|
}, [chosenDayList]);
|
|
57
|
-
|
|
58
44
|
function onClickMonthDay(day) {
|
|
59
45
|
setChosenDayList(function (list) {
|
|
60
46
|
var res = _.cloneDeep(list);
|
|
61
|
-
|
|
62
47
|
var daySelected = false;
|
|
63
48
|
res.forEach(function (item, i) {
|
|
64
49
|
if (day === item.value) {
|
|
@@ -73,18 +58,15 @@ var MonthDay = function MonthDay(props) {
|
|
|
73
58
|
return res;
|
|
74
59
|
});
|
|
75
60
|
}
|
|
76
|
-
|
|
77
61
|
function onDelMonthDay(day) {
|
|
78
62
|
setChosenDayList(function (list) {
|
|
79
63
|
var res = _.cloneDeep(list);
|
|
80
|
-
|
|
81
64
|
res.forEach(function (item, i) {
|
|
82
65
|
if (item.value === day.value) res.splice(i, 1);
|
|
83
66
|
});
|
|
84
67
|
return res;
|
|
85
68
|
});
|
|
86
69
|
}
|
|
87
|
-
|
|
88
70
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
89
71
|
disabled: disable,
|
|
90
72
|
overlay: /*#__PURE__*/React.createElement("div", {
|
|
@@ -123,7 +105,6 @@ var MonthDay = function MonthDay(props) {
|
|
|
123
105
|
type: "xiangxia"
|
|
124
106
|
}))));
|
|
125
107
|
};
|
|
126
|
-
|
|
127
108
|
MonthDay.defaultProps = {
|
|
128
109
|
size: 'middle',
|
|
129
110
|
disable: false
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
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
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { DatePicker } from 'antd';
|
|
14
8
|
import moment from 'moment';
|
|
15
9
|
import React, { useEffect, useState } from 'react';
|
|
@@ -18,39 +12,32 @@ import IconFont from '../icon/iconFont';
|
|
|
18
12
|
import locale from 'antd/es/date-picker/locale/zh_CN';
|
|
19
13
|
import { getDateRange } from './utils';
|
|
20
14
|
var RangePicker = DatePicker.RangePicker;
|
|
21
|
-
|
|
22
15
|
var BizDate = function BizDate(props) {
|
|
23
16
|
var includeToday = props.includeToday;
|
|
24
17
|
var initValue = {
|
|
25
18
|
begin: moment().subtract(includeToday ? 0 : 1, 'days').format('YYYY-MM-DD'),
|
|
26
19
|
end: moment().subtract(includeToday ? 0 : 1, 'days').format('YYYY-MM-DD')
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
var _useState = useState(),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
dateRange = _useState2[0],
|
|
24
|
+
setDateRange = _useState2[1];
|
|
34
25
|
useEffect(function () {
|
|
35
26
|
setDateRange(props.value ? props.value : initValue);
|
|
36
27
|
}, []);
|
|
37
28
|
useEffect(function () {
|
|
38
29
|
var _props$dateCount;
|
|
39
|
-
|
|
40
30
|
if (((_props$dateCount = props.dateCount) === null || _props$dateCount === void 0 ? void 0 : _props$dateCount.count) == undefined) return;
|
|
41
31
|
var date = getDateRange(props.type, props.dateCount.count, !!includeToday);
|
|
42
32
|
setDateRange(date);
|
|
43
33
|
if (props.onChange) props.onChange(date, true);
|
|
44
34
|
}, [props.dateCount]);
|
|
45
|
-
|
|
46
35
|
var disabledDate = function disabledDate(current) {
|
|
47
36
|
if (includeToday) {
|
|
48
37
|
return current && current > moment().endOf('day');
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
return current && current > moment().subtract(1, 'days').endOf('day');
|
|
52
40
|
};
|
|
53
|
-
|
|
54
41
|
var onChangeDate = function onChangeDate() {
|
|
55
42
|
var range = {
|
|
56
43
|
begin: arguments.length <= 1 ? undefined : arguments[1],
|
|
@@ -59,12 +46,10 @@ var BizDate = function BizDate(props) {
|
|
|
59
46
|
setDateRange(range);
|
|
60
47
|
if (props.onChange) props.onChange(range);
|
|
61
48
|
};
|
|
62
|
-
|
|
63
49
|
var onChangeRange = function onChangeRange() {
|
|
64
50
|
for (var _len = arguments.length, date = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
51
|
date[_key] = arguments[_key];
|
|
66
52
|
}
|
|
67
|
-
|
|
68
53
|
var range = {
|
|
69
54
|
begin: date[1][0],
|
|
70
55
|
end: date[1][1]
|
|
@@ -72,13 +57,11 @@ var BizDate = function BizDate(props) {
|
|
|
72
57
|
setDateRange(range);
|
|
73
58
|
if (props.onChange) props.onChange(range);
|
|
74
59
|
};
|
|
75
|
-
|
|
76
60
|
if (!dateRange) {
|
|
77
61
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
78
62
|
disabled: true
|
|
79
63
|
});
|
|
80
64
|
}
|
|
81
|
-
|
|
82
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
83
66
|
className: "".concat(classPrefix, "-panel")
|
|
84
67
|
}, props.type === 'hour' ? /*#__PURE__*/React.createElement(DatePicker, {
|
|
@@ -111,5 +94,4 @@ var BizDate = function BizDate(props) {
|
|
|
111
94
|
onChange: onChangeRange
|
|
112
95
|
}));
|
|
113
96
|
};
|
|
114
|
-
|
|
115
97
|
export default BizDate;
|