@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
package/es/select/option.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 { Tooltip } from 'antd';
|
|
14
8
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
15
9
|
import { classPrefix } from '.';
|
|
@@ -20,18 +14,14 @@ export var SelectAll = function SelectAll(props) {
|
|
|
20
14
|
var size = props.type === 'group' ? props.options.reduce(function (sum, item) {
|
|
21
15
|
return sum + item.children.length || 0;
|
|
22
16
|
}, 0) : props.options.length;
|
|
23
|
-
|
|
24
17
|
if (props.value && props.value.length) {
|
|
25
18
|
return props.value.length < size ? 1 : 2;
|
|
26
19
|
}
|
|
27
|
-
|
|
28
20
|
return 0;
|
|
29
21
|
}, [props.value, props.options, props.type]);
|
|
30
|
-
|
|
31
22
|
var onClick = function onClick() {
|
|
32
23
|
props.onChange && props.onChange(checkCode === 2 ? false : true);
|
|
33
24
|
};
|
|
34
|
-
|
|
35
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
26
|
className: "".concat(classPrefix, "-option ").concat(classPrefix, "-option-multiple ").concat(classPrefix, "-option-all").concat(checkCode === 2 ? ' active' : ''),
|
|
37
27
|
onClick: onClick
|
|
@@ -45,34 +35,28 @@ export var SelectAll = function SelectAll(props) {
|
|
|
45
35
|
className: "".concat(classPrefix, "-checkbox-indeterminate")
|
|
46
36
|
}) : null, "\u5168\u9009");
|
|
47
37
|
};
|
|
48
|
-
|
|
49
38
|
var SelectOption = function SelectOption(props) {
|
|
50
39
|
var option = props.option,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
group = props.group,
|
|
41
|
+
checked = props.checked,
|
|
42
|
+
disabled = props.disabled,
|
|
43
|
+
multiple = props.multiple,
|
|
44
|
+
customLabel = props.customLabel;
|
|
56
45
|
var optionRef = useRef(null);
|
|
57
|
-
|
|
58
46
|
var _useState = useState(false),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
isOverflow = _useState2[0],
|
|
49
|
+
setIsOverflow = _useState2[1];
|
|
63
50
|
useEffect(function () {
|
|
64
51
|
var _optionRef$current, _optionRef$current2;
|
|
65
|
-
|
|
66
52
|
var clientWidth = (_optionRef$current = optionRef.current) === null || _optionRef$current === void 0 ? void 0 : _optionRef$current.clientWidth;
|
|
67
53
|
var scrollWidth = (_optionRef$current2 = optionRef.current) === null || _optionRef$current2 === void 0 ? void 0 : _optionRef$current2.scrollWidth;
|
|
68
54
|
setIsOverflow(clientWidth < scrollWidth);
|
|
69
55
|
}, []);
|
|
70
|
-
|
|
71
56
|
function onClick() {
|
|
72
57
|
if (disabled) return;
|
|
73
58
|
if (props.onClick) props.onClick(option);
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
function getLabel(label) {
|
|
77
61
|
if (!props.highlight || !props.highlight.enable || !props.highlight.text) return label;
|
|
78
62
|
var text = props.highlight.text;
|
|
@@ -86,12 +70,10 @@ var SelectOption = function SelectOption(props) {
|
|
|
86
70
|
}, text);
|
|
87
71
|
});
|
|
88
72
|
}
|
|
89
|
-
|
|
90
73
|
function renderLabel(option) {
|
|
91
74
|
var dom = getLabel(option[props.labelField]);
|
|
92
75
|
return customLabel ? customLabel(dom, option) : dom;
|
|
93
76
|
}
|
|
94
|
-
|
|
95
77
|
if (group) {
|
|
96
78
|
return /*#__PURE__*/React.createElement("div", {
|
|
97
79
|
className: "".concat(classPrefix, "-group")
|
|
@@ -99,7 +81,6 @@ var SelectOption = function SelectOption(props) {
|
|
|
99
81
|
className: "".concat(classPrefix, "-split")
|
|
100
82
|
}), /*#__PURE__*/React.createElement("span", null, group.name));
|
|
101
83
|
}
|
|
102
|
-
|
|
103
84
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
104
85
|
placement: "rightBottom",
|
|
105
86
|
title: isOverflow ? option[props.labelField] : null,
|
|
@@ -122,5 +103,4 @@ var SelectOption = function SelectOption(props) {
|
|
|
122
103
|
className: "".concat(classPrefix, "-option-btn")
|
|
123
104
|
}, props.extra && props.extra(option))));
|
|
124
105
|
};
|
|
125
|
-
|
|
126
106
|
export default SelectOption;
|
package/es/select/overlay.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
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); }
|
|
11
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
|
|
13
10
|
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."); }
|
|
14
|
-
|
|
15
11
|
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); }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
12
|
+
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
|
+
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; } }
|
|
21
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
|
|
23
15
|
import React, { useEffect, useState } from 'react';
|
|
24
16
|
import { Spin } from 'antd';
|
|
25
17
|
import BizSearchInput from '../searchInput';
|
|
@@ -28,31 +20,27 @@ import SelectOption, { SelectAll } from './option';
|
|
|
28
20
|
import _ from 'lodash';
|
|
29
21
|
var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
30
22
|
var labelField = props.labelField,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
keyField = props.keyField,
|
|
24
|
+
options = props.options,
|
|
25
|
+
extra = props.extra,
|
|
26
|
+
multiple = props.multiple,
|
|
27
|
+
disableItemList = props.disableItemList,
|
|
28
|
+
dropdownExtra = props.dropdownExtra,
|
|
29
|
+
loading = props.loading,
|
|
30
|
+
customLabel = props.customLabel,
|
|
31
|
+
overlayClassName = props.overlayClassName;
|
|
41
32
|
var _useState = useState(),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
searchValue = _useState2[0],
|
|
35
|
+
setSearchValue = _useState2[1];
|
|
46
36
|
var _useState3 = useState(),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
current = _useState4[0],
|
|
39
|
+
setCurrent = _useState4[1];
|
|
51
40
|
var _useState5 = useState([]),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
42
|
+
showList = _useState6[0],
|
|
43
|
+
setShowList = _useState6[1];
|
|
56
44
|
useEffect(function () {
|
|
57
45
|
if (props.value) setCurrent(props.value);
|
|
58
46
|
}, [props.value]);
|
|
@@ -63,7 +51,6 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
63
51
|
}, [props.searchValue]);
|
|
64
52
|
useEffect(function () {
|
|
65
53
|
var ids = [];
|
|
66
|
-
|
|
67
54
|
if (current) {
|
|
68
55
|
if (multiple) {
|
|
69
56
|
if (current) {
|
|
@@ -75,10 +62,8 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
75
62
|
ids = [current[keyField]];
|
|
76
63
|
}
|
|
77
64
|
}
|
|
78
|
-
|
|
79
65
|
setShowList(function () {
|
|
80
66
|
var list = [];
|
|
81
|
-
|
|
82
67
|
if (props.type === 'group') {
|
|
83
68
|
list = options.map(function (group) {
|
|
84
69
|
var groupDom = /*#__PURE__*/React.createElement(SelectOption, {
|
|
@@ -92,7 +77,6 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
92
77
|
} else {
|
|
93
78
|
list = getOptionDom(options, ids);
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
if (options.length && !list.flat().length) {
|
|
97
81
|
var dom = /*#__PURE__*/React.createElement("div", {
|
|
98
82
|
className: "".concat(classPrefix, "-notfound"),
|
|
@@ -100,22 +84,16 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
100
84
|
}, props.notFound ? props.notFound : '未找到匹配数据');
|
|
101
85
|
list = [dom];
|
|
102
86
|
}
|
|
103
|
-
|
|
104
87
|
return list;
|
|
105
88
|
});
|
|
106
89
|
}, [searchValue, options, current]);
|
|
107
|
-
|
|
108
90
|
function getOptionDom(data, ids) {
|
|
109
91
|
var optionsDom = [];
|
|
110
|
-
|
|
111
92
|
var list = _.cloneDeep(data);
|
|
112
|
-
|
|
113
93
|
if (props.enableCreate && searchValue) {
|
|
114
94
|
var _list$push;
|
|
115
|
-
|
|
116
95
|
list.push((_list$push = {}, _defineProperty(_list$push, props.keyField, searchValue), _defineProperty(_list$push, props.labelField, searchValue), _defineProperty(_list$push, "isTemp", true), _list$push));
|
|
117
96
|
}
|
|
118
|
-
|
|
119
97
|
var tempOption = null;
|
|
120
98
|
var useTemp = true;
|
|
121
99
|
list.forEach(function (option) {
|
|
@@ -142,31 +120,25 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
142
120
|
key: option[keyField] || String(Math.random()),
|
|
143
121
|
customLabel: customLabel
|
|
144
122
|
});
|
|
145
|
-
|
|
146
123
|
if (option.isTemp) {
|
|
147
124
|
tempOption = dom;
|
|
148
125
|
return;
|
|
149
126
|
}
|
|
150
|
-
|
|
151
127
|
optionsDom.push(dom);
|
|
152
128
|
});
|
|
153
|
-
|
|
154
129
|
if (useTemp && tempOption) {
|
|
155
130
|
optionsDom.push(tempOption);
|
|
156
131
|
}
|
|
157
|
-
|
|
158
132
|
return optionsDom;
|
|
159
133
|
}
|
|
160
|
-
|
|
161
134
|
function onClick(option) {
|
|
162
135
|
var currentOption = _.cloneDeep(current);
|
|
163
|
-
|
|
164
136
|
if (multiple) {
|
|
165
137
|
if (!currentOption) {
|
|
166
138
|
currentOption = [option];
|
|
167
139
|
} else {
|
|
168
140
|
var num = 0,
|
|
169
|
-
|
|
141
|
+
flag = false;
|
|
170
142
|
currentOption.forEach(function (item, i) {
|
|
171
143
|
if (item[keyField] === option[keyField]) {
|
|
172
144
|
flag = true;
|
|
@@ -174,7 +146,6 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
174
146
|
return;
|
|
175
147
|
}
|
|
176
148
|
});
|
|
177
|
-
|
|
178
149
|
if (flag) {
|
|
179
150
|
currentOption.splice(num, 1);
|
|
180
151
|
} else {
|
|
@@ -184,18 +155,14 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
184
155
|
} else {
|
|
185
156
|
currentOption = option;
|
|
186
157
|
}
|
|
187
|
-
|
|
188
158
|
setCurrent(currentOption);
|
|
189
159
|
if (props.onChange) props.onChange(currentOption);
|
|
190
160
|
}
|
|
191
|
-
|
|
192
161
|
function onSearch(v) {
|
|
193
162
|
setSearchValue(v);
|
|
194
163
|
}
|
|
195
|
-
|
|
196
164
|
function render() {
|
|
197
165
|
if (loading) return /*#__PURE__*/React.createElement(Spin, null);
|
|
198
|
-
|
|
199
166
|
if (showList && showList.length) {
|
|
200
167
|
return showList;
|
|
201
168
|
} else {
|
|
@@ -204,10 +171,8 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
204
171
|
}, "\u6682\u65E0\u6570\u636E");
|
|
205
172
|
}
|
|
206
173
|
}
|
|
207
|
-
|
|
208
174
|
var onCheckAllChange = function onCheckAllChange(checked) {
|
|
209
175
|
var selectOptions = [];
|
|
210
|
-
|
|
211
176
|
if (checked) {
|
|
212
177
|
if (props.type === 'group') {
|
|
213
178
|
props.options.forEach(function (item) {
|
|
@@ -219,11 +184,9 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
219
184
|
} else {
|
|
220
185
|
selectOptions = disableItemList || [];
|
|
221
186
|
}
|
|
222
|
-
|
|
223
187
|
setCurrent(selectOptions);
|
|
224
188
|
if (props.onChange) props.onChange(selectOptions);
|
|
225
189
|
};
|
|
226
|
-
|
|
227
190
|
return /*#__PURE__*/React.createElement("div", {
|
|
228
191
|
className: "".concat(classPrefix, "-overlay ").concat(overlayClassName),
|
|
229
192
|
ref: ref
|
|
@@ -24,7 +24,6 @@ export var columns = [{
|
|
|
24
24
|
}
|
|
25
25
|
}];
|
|
26
26
|
var tableData = [];
|
|
27
|
-
|
|
28
27
|
for (var i = 0; i < 100; i++) {
|
|
29
28
|
tableData.push({
|
|
30
29
|
key: i,
|
|
@@ -33,5 +32,4 @@ for (var i = 0; i < 100; i++) {
|
|
|
33
32
|
address: "London Park no. ".concat(i)
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
export default tableData;
|
package/es/table/demo/index.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
7
|
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."); }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
8
|
+
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; } }
|
|
15
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
10
|
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; }
|
|
18
|
-
|
|
19
11
|
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; }
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
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); }
|
|
23
15
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
24
|
-
|
|
25
16
|
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); }
|
|
26
|
-
|
|
27
|
-
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; }
|
|
28
|
-
|
|
17
|
+
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; }
|
|
29
18
|
import React, { useEffect, useState } from 'react';
|
|
30
19
|
import { BizTable } from '@zgfe/business-lib';
|
|
31
20
|
import util from '../../utils/util';
|
|
32
21
|
import chartData from './data/data';
|
|
33
22
|
import { chartColors as color } from './data/color';
|
|
34
23
|
import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
|
|
35
|
-
|
|
36
24
|
var getColumn = function getColumn(columnData) {
|
|
37
25
|
var data = [{
|
|
38
26
|
title: '显示',
|
|
@@ -45,7 +33,6 @@ var getColumn = function getColumn(columnData) {
|
|
|
45
33
|
for (var _len = arguments.length, res = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
46
34
|
res[_key] = arguments[_key];
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
50
37
|
style: {
|
|
51
38
|
width: '12px',
|
|
@@ -63,10 +50,8 @@ var getColumn = function getColumn(columnData) {
|
|
|
63
50
|
ellipsis: true,
|
|
64
51
|
fixed: 'left'
|
|
65
52
|
}];
|
|
66
|
-
|
|
67
53
|
for (var i = 0; i < columnData.length; i++) {
|
|
68
54
|
var value = columnData[i];
|
|
69
|
-
|
|
70
55
|
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
71
56
|
value = value.replace(/\d{4}-/, '');
|
|
72
57
|
} else if (/^\d{4}-\d{2}-\d{2}\|\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
@@ -74,14 +59,12 @@ var getColumn = function getColumn(columnData) {
|
|
|
74
59
|
value = dates ? dates[0].replace(/\d{4}-/, '') + '~' + dates[1].replace(/\d{4}-/, '') : value;
|
|
75
60
|
} else {
|
|
76
61
|
value = util.strMiddleSplit(value);
|
|
77
|
-
|
|
78
62
|
if (/:/.test(value)) {
|
|
79
63
|
value = value.replace(/\d{4}-\d{2}-\d{2}\s/, '');
|
|
80
64
|
} else if (/,/.test(value)) {
|
|
81
65
|
value = value.replace(/,/g, '-');
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
|
-
|
|
85
68
|
data.push({
|
|
86
69
|
title: value,
|
|
87
70
|
width: 100,
|
|
@@ -95,7 +78,6 @@ var getColumn = function getColumn(columnData) {
|
|
|
95
78
|
}
|
|
96
79
|
});
|
|
97
80
|
}
|
|
98
|
-
|
|
99
81
|
data.push({
|
|
100
82
|
title: '操作',
|
|
101
83
|
dataIndex: 'operation',
|
|
@@ -108,13 +90,10 @@ var getColumn = function getColumn(columnData) {
|
|
|
108
90
|
});
|
|
109
91
|
return data;
|
|
110
92
|
};
|
|
111
|
-
|
|
112
93
|
var formateTableData = function formateTableData(sData) {
|
|
113
94
|
var tableData = [];
|
|
114
|
-
|
|
115
95
|
var _iterator = _createForOfIteratorHelper(sData),
|
|
116
|
-
|
|
117
|
-
|
|
96
|
+
_step;
|
|
118
97
|
try {
|
|
119
98
|
var _loop = function _loop() {
|
|
120
99
|
var row = _step.value;
|
|
@@ -128,7 +107,6 @@ var formateTableData = function formateTableData(sData) {
|
|
|
128
107
|
});
|
|
129
108
|
tableData.push(_objectSpread({}, item));
|
|
130
109
|
};
|
|
131
|
-
|
|
132
110
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
133
111
|
_loop();
|
|
134
112
|
}
|
|
@@ -137,21 +115,17 @@ var formateTableData = function formateTableData(sData) {
|
|
|
137
115
|
} finally {
|
|
138
116
|
_iterator.f();
|
|
139
117
|
}
|
|
140
|
-
|
|
141
118
|
return tableData;
|
|
142
119
|
};
|
|
143
|
-
|
|
144
120
|
export default (function () {
|
|
145
121
|
var _useState = useState([]),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
122
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
123
|
+
columns = _useState2[0],
|
|
124
|
+
setColumns = _useState2[1];
|
|
150
125
|
var _useState3 = useState([]),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
126
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
127
|
+
tableData = _useState4[0],
|
|
128
|
+
setTableData = _useState4[1];
|
|
155
129
|
useEffect(function () {
|
|
156
130
|
var data = getColumn(chartData.xData);
|
|
157
131
|
setColumns(function () {
|
package/es/table/demo/index2.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
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 React, { useEffect, useState } from 'react';
|
|
14
8
|
import { BizTable } from '@zgfe/business-lib';
|
|
15
9
|
import { columns } from './data/table';
|
|
16
10
|
export default (function () {
|
|
17
11
|
var _useState = useState([]),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
tableData = _useState2[0],
|
|
14
|
+
setTableData = _useState2[1];
|
|
22
15
|
var getData = function getData(pagination) {
|
|
23
16
|
var current = pagination && pagination.current || 0;
|
|
24
17
|
var data = [];
|
|
25
|
-
|
|
26
18
|
for (var i = 0; i < 10; i++) {
|
|
27
19
|
data.push({
|
|
28
20
|
key: current * 10 + i,
|
|
@@ -31,12 +23,10 @@ export default (function () {
|
|
|
31
23
|
address: "London Park no. ".concat(current * 10 + i)
|
|
32
24
|
});
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
setTableData(function () {
|
|
36
27
|
return data;
|
|
37
28
|
});
|
|
38
29
|
};
|
|
39
|
-
|
|
40
30
|
useEffect(function () {
|
|
41
31
|
getData();
|
|
42
32
|
}, []);
|
package/es/table/demo/index3.js
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
2
|
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
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
6
|
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."); }
|
|
12
|
-
|
|
13
7
|
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); }
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
19
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
11
|
import React, { useEffect, useState } from 'react';
|
|
22
12
|
import { BizTable } from '@zgfe/business-lib';
|
|
23
13
|
var dataSource2 = [{
|
|
@@ -137,10 +127,9 @@ var column2 = [{
|
|
|
137
127
|
}];
|
|
138
128
|
export default (function () {
|
|
139
129
|
var _useState = useState([]),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
130
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
131
|
+
tableData = _useState2[0],
|
|
132
|
+
setTableData = _useState2[1];
|
|
144
133
|
var sortData = function sortData(data) {
|
|
145
134
|
var compare = function compare(a, b) {
|
|
146
135
|
if (a.attr1 !== b.attr1) {
|
|
@@ -151,35 +140,28 @@ export default (function () {
|
|
|
151
140
|
return a.attr3 - b.attr3;
|
|
152
141
|
}
|
|
153
142
|
};
|
|
154
|
-
|
|
155
143
|
data.sort(compare);
|
|
156
144
|
return data;
|
|
157
145
|
};
|
|
158
|
-
|
|
159
146
|
var mergeRow = function mergeRow(source, field, field2, field3) {
|
|
160
147
|
var count = 0,
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
scount = 0,
|
|
149
|
+
tcount = 0;
|
|
163
150
|
var indexCount = 1;
|
|
164
151
|
var data = JSON.parse(JSON.stringify(source));
|
|
165
|
-
|
|
166
152
|
while (indexCount < data.length) {
|
|
167
153
|
var item = data.slice(count, count + 1)[0];
|
|
168
|
-
|
|
169
154
|
if (!item["".concat(field, "RowSpan")]) {
|
|
170
155
|
item["".concat(field, "RowSpan")] = 1;
|
|
171
156
|
item["".concat(field2, "RowSpan")] = 1;
|
|
172
157
|
item["".concat(field3, "RowSpan")] = 1;
|
|
173
158
|
}
|
|
174
|
-
|
|
175
159
|
if (item[field] === data[indexCount][field]) {
|
|
176
160
|
item["".concat(field, "RowSpan")]++;
|
|
177
161
|
data[indexCount]["".concat(field, "RowSpan")] = 0;
|
|
178
|
-
|
|
179
162
|
if (data[scount][field2] === data[indexCount][field2]) {
|
|
180
163
|
data[scount]["".concat(field2, "RowSpan")]++;
|
|
181
164
|
data[indexCount]["".concat(field2, "RowSpan")] = 0;
|
|
182
|
-
|
|
183
165
|
if (data[tcount][field3] === data[indexCount][field3]) {
|
|
184
166
|
data[tcount]["".concat(field3, "RowSpan")]++;
|
|
185
167
|
data[indexCount]["".concat(field3, "RowSpan")] = 0;
|
|
@@ -198,13 +180,10 @@ export default (function () {
|
|
|
198
180
|
scount = indexCount;
|
|
199
181
|
tcount = indexCount;
|
|
200
182
|
}
|
|
201
|
-
|
|
202
183
|
indexCount++;
|
|
203
184
|
}
|
|
204
|
-
|
|
205
185
|
return data;
|
|
206
186
|
};
|
|
207
|
-
|
|
208
187
|
useEffect(function () {
|
|
209
188
|
var data = mergeRow(sortData(dataSource2), 'attr1', 'attr2', 'attr3');
|
|
210
189
|
setTableData(function () {
|