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