@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
package/es/select/index.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
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
|
var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "keyField"];
|
|
2
|
+
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
4
5
|
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; }
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
8
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
9
11
|
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
|
+
|
|
10
13
|
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); }
|
|
11
|
-
|
|
12
|
-
function
|
|
14
|
+
|
|
15
|
+
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; }
|
|
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
|
+
|
|
13
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
14
21
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
22
|
+
|
|
15
23
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
24
|
+
|
|
16
25
|
import { Dropdown } from 'antd';
|
|
17
26
|
import React, { useEffect, useRef, useState } from 'react';
|
|
18
27
|
import SelectHandle from './handle';
|
|
@@ -20,46 +29,58 @@ import SelectOverlay from './overlay';
|
|
|
20
29
|
import './styles/index.less';
|
|
21
30
|
import _ from 'lodash';
|
|
22
31
|
export var classPrefix = 'biz-select';
|
|
32
|
+
|
|
23
33
|
var BizSelect = function BizSelect(props) {
|
|
24
34
|
var _boxRef$current3;
|
|
35
|
+
|
|
25
36
|
var overlayWidth = props.overlayWidth,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
minDropdownWidth = props.minDropdownWidth,
|
|
38
|
+
labelField = props.labelField,
|
|
39
|
+
keyField = props.keyField,
|
|
40
|
+
res = _objectWithoutProperties(props, _excluded);
|
|
41
|
+
|
|
30
42
|
var _useState = useState(),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
current = _useState2[0],
|
|
45
|
+
setCurrent = _useState2[1];
|
|
46
|
+
|
|
34
47
|
var _useState3 = useState(''),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
searchValue = _useState4[0],
|
|
50
|
+
setSearchValue = _useState4[1];
|
|
51
|
+
|
|
38
52
|
var _useState5 = useState(false),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
54
|
+
visible = _useState6[0],
|
|
55
|
+
setVisible = _useState6[1];
|
|
56
|
+
|
|
42
57
|
var selectRef = useRef(null);
|
|
43
58
|
var overlayRef = useRef(null);
|
|
44
59
|
var boxRef = useRef(null);
|
|
45
60
|
var selectId = Math.random().toString();
|
|
61
|
+
|
|
46
62
|
var _useState7 = useState(200),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
64
|
+
width = _useState8[0],
|
|
65
|
+
setWidth = _useState8[1];
|
|
66
|
+
|
|
50
67
|
useEffect(function () {
|
|
51
68
|
if (props.defaultValue) {
|
|
52
69
|
setCurrent(getValue(props.defaultValue));
|
|
53
70
|
}
|
|
71
|
+
|
|
54
72
|
var handleClick = function handleClick(e) {
|
|
55
73
|
var _selectRef$current, _overlayRef$current, _boxRef$current;
|
|
74
|
+
|
|
56
75
|
var clicked = (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.contains(e.target);
|
|
57
76
|
var overlayClicked = (_overlayRef$current = overlayRef.current) === null || _overlayRef$current === void 0 ? void 0 : _overlayRef$current.contains(e.target);
|
|
58
77
|
(_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.create(clicked, overlayClicked);
|
|
78
|
+
|
|
59
79
|
if (!clicked && !props.enableCreate || overlayClicked) {
|
|
60
80
|
setSearchValue('');
|
|
61
81
|
}
|
|
62
82
|
};
|
|
83
|
+
|
|
63
84
|
window.addEventListener('click', handleClick);
|
|
64
85
|
return function () {
|
|
65
86
|
window.removeEventListener('click', handleClick);
|
|
@@ -67,12 +88,14 @@ var BizSelect = function BizSelect(props) {
|
|
|
67
88
|
}, []);
|
|
68
89
|
useEffect(function () {
|
|
69
90
|
var _boxRef$current2;
|
|
91
|
+
|
|
70
92
|
setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current2 = boxRef.current) === null || _boxRef$current2 === void 0 ? void 0 : _boxRef$current2.width) || 200);
|
|
71
93
|
}, [boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current3 = boxRef.current) === null || _boxRef$current3 === void 0 ? void 0 : _boxRef$current3.width]);
|
|
72
94
|
useEffect(function () {
|
|
73
95
|
if (!props.value) return;
|
|
74
96
|
setCurrent(getValue(props.value));
|
|
75
97
|
}, [props.value, props.options]);
|
|
98
|
+
|
|
76
99
|
var getValue = function getValue(data) {
|
|
77
100
|
if (props.multiple) {
|
|
78
101
|
var result = [];
|
|
@@ -84,6 +107,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
84
107
|
return getCheckedData(data);
|
|
85
108
|
}
|
|
86
109
|
};
|
|
110
|
+
|
|
87
111
|
var getCheckedData = function getCheckedData(data) {
|
|
88
112
|
var result = data;
|
|
89
113
|
props.options.forEach(function (option) {
|
|
@@ -99,8 +123,10 @@ var BizSelect = function BizSelect(props) {
|
|
|
99
123
|
});
|
|
100
124
|
return result;
|
|
101
125
|
};
|
|
126
|
+
|
|
102
127
|
var onDelete = function onDelete(option) {
|
|
103
128
|
var data = _.cloneDeep(current);
|
|
129
|
+
|
|
104
130
|
data.forEach(function (item, index) {
|
|
105
131
|
if (item[keyField] === option[keyField]) {
|
|
106
132
|
data.splice(index, 1);
|
|
@@ -110,22 +136,29 @@ var BizSelect = function BizSelect(props) {
|
|
|
110
136
|
setCurrent(data);
|
|
111
137
|
if (props.onChange) props.onChange(data);
|
|
112
138
|
};
|
|
139
|
+
|
|
113
140
|
var onChange = function onChange(option) {
|
|
114
141
|
setCurrent(option);
|
|
115
142
|
setSearchValue('');
|
|
143
|
+
|
|
116
144
|
if (!props.multiple) {
|
|
117
145
|
onVisibleChange(false);
|
|
118
146
|
}
|
|
147
|
+
|
|
119
148
|
if (props.onChange) props.onChange(option);
|
|
120
149
|
};
|
|
150
|
+
|
|
121
151
|
var onVisibleChange = function onVisibleChange(flag) {
|
|
122
152
|
setSearchValue('');
|
|
123
153
|
setVisible(flag);
|
|
124
154
|
props.onVisibleChange && props.onVisibleChange(flag);
|
|
125
155
|
};
|
|
156
|
+
|
|
126
157
|
var onCreate = function onCreate(val) {
|
|
127
158
|
var _data;
|
|
159
|
+
|
|
128
160
|
if (!props.enableCreate) return;
|
|
161
|
+
|
|
129
162
|
if (current) {
|
|
130
163
|
var flag = true;
|
|
131
164
|
current.forEach(function (item) {
|
|
@@ -135,6 +168,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
135
168
|
});
|
|
136
169
|
if (!flag) return;
|
|
137
170
|
}
|
|
171
|
+
|
|
138
172
|
var data = (_data = {}, _defineProperty(_data, keyField, val), _defineProperty(_data, labelField, val), _data);
|
|
139
173
|
var originData = current || [];
|
|
140
174
|
originData.push(data);
|
|
@@ -142,9 +176,11 @@ var BizSelect = function BizSelect(props) {
|
|
|
142
176
|
setSearchValue('');
|
|
143
177
|
if (props.onChange) props.onChange(originData);
|
|
144
178
|
};
|
|
179
|
+
|
|
145
180
|
var onVisible = function onVisible() {
|
|
146
181
|
setVisible(true);
|
|
147
182
|
};
|
|
183
|
+
|
|
148
184
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
149
185
|
overlay: /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
|
|
150
186
|
value: current,
|
|
@@ -194,6 +230,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
194
230
|
disableItemList: props.disableItemList
|
|
195
231
|
})));
|
|
196
232
|
};
|
|
233
|
+
|
|
197
234
|
BizSelect.defaultProps = {
|
|
198
235
|
labelField: 'label',
|
|
199
236
|
keyField: 'id',
|
package/es/select/option.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 { Tooltip } from 'antd';
|
|
8
14
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
9
15
|
import { classPrefix } from '.';
|
|
@@ -14,14 +20,18 @@ export var SelectAll = function SelectAll(props) {
|
|
|
14
20
|
var size = props.type === 'group' ? props.options.reduce(function (sum, item) {
|
|
15
21
|
return sum + item.children.length || 0;
|
|
16
22
|
}, 0) : props.options.length;
|
|
23
|
+
|
|
17
24
|
if (props.value && props.value.length) {
|
|
18
25
|
return props.value.length < size ? 1 : 2;
|
|
19
26
|
}
|
|
27
|
+
|
|
20
28
|
return 0;
|
|
21
29
|
}, [props.value, props.options, props.type]);
|
|
30
|
+
|
|
22
31
|
var onClick = function onClick() {
|
|
23
32
|
props.onChange && props.onChange(checkCode === 2 ? false : true);
|
|
24
33
|
};
|
|
34
|
+
|
|
25
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
36
|
className: "".concat(classPrefix, "-option ").concat(classPrefix, "-option-multiple ").concat(classPrefix, "-option-all").concat(checkCode === 2 ? ' active' : ''),
|
|
27
37
|
onClick: onClick
|
|
@@ -35,28 +45,34 @@ export var SelectAll = function SelectAll(props) {
|
|
|
35
45
|
className: "".concat(classPrefix, "-checkbox-indeterminate")
|
|
36
46
|
}) : null, "\u5168\u9009");
|
|
37
47
|
};
|
|
48
|
+
|
|
38
49
|
var SelectOption = function SelectOption(props) {
|
|
39
50
|
var option = props.option,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
group = props.group,
|
|
52
|
+
checked = props.checked,
|
|
53
|
+
disabled = props.disabled,
|
|
54
|
+
multiple = props.multiple,
|
|
55
|
+
customLabel = props.customLabel;
|
|
45
56
|
var optionRef = useRef(null);
|
|
57
|
+
|
|
46
58
|
var _useState = useState(false),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
isOverflow = _useState2[0],
|
|
61
|
+
setIsOverflow = _useState2[1];
|
|
62
|
+
|
|
50
63
|
useEffect(function () {
|
|
51
64
|
var _optionRef$current, _optionRef$current2;
|
|
65
|
+
|
|
52
66
|
var clientWidth = (_optionRef$current = optionRef.current) === null || _optionRef$current === void 0 ? void 0 : _optionRef$current.clientWidth;
|
|
53
67
|
var scrollWidth = (_optionRef$current2 = optionRef.current) === null || _optionRef$current2 === void 0 ? void 0 : _optionRef$current2.scrollWidth;
|
|
54
68
|
setIsOverflow(clientWidth < scrollWidth);
|
|
55
69
|
}, []);
|
|
70
|
+
|
|
56
71
|
function onClick() {
|
|
57
72
|
if (disabled) return;
|
|
58
73
|
if (props.onClick) props.onClick(option);
|
|
59
74
|
}
|
|
75
|
+
|
|
60
76
|
function getLabel(label) {
|
|
61
77
|
if (!props.highlight || !props.highlight.enable || !props.highlight.text) return label;
|
|
62
78
|
var text = props.highlight.text;
|
|
@@ -70,10 +86,12 @@ var SelectOption = function SelectOption(props) {
|
|
|
70
86
|
}, text);
|
|
71
87
|
});
|
|
72
88
|
}
|
|
89
|
+
|
|
73
90
|
function renderLabel(option) {
|
|
74
91
|
var dom = getLabel(option[props.labelField]);
|
|
75
92
|
return customLabel ? customLabel(dom, option) : dom;
|
|
76
93
|
}
|
|
94
|
+
|
|
77
95
|
if (group) {
|
|
78
96
|
return /*#__PURE__*/React.createElement("div", {
|
|
79
97
|
className: "".concat(classPrefix, "-group")
|
|
@@ -81,6 +99,7 @@ var SelectOption = function SelectOption(props) {
|
|
|
81
99
|
className: "".concat(classPrefix, "-split")
|
|
82
100
|
}), /*#__PURE__*/React.createElement("span", null, group.name));
|
|
83
101
|
}
|
|
102
|
+
|
|
84
103
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
85
104
|
placement: "rightBottom",
|
|
86
105
|
title: isOverflow ? option[props.labelField] : null,
|
|
@@ -103,4 +122,5 @@ var SelectOption = function SelectOption(props) {
|
|
|
103
122
|
className: "".concat(classPrefix, "-option-btn")
|
|
104
123
|
}, props.extra && props.extra(option))));
|
|
105
124
|
};
|
|
125
|
+
|
|
106
126
|
export default SelectOption;
|
package/es/select/overlay.js
CHANGED
|
@@ -1,17 +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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
|
|
5
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
9
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
|
|
10
13
|
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
|
+
|
|
11
15
|
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); }
|
|
12
|
-
|
|
13
|
-
function
|
|
16
|
+
|
|
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; }
|
|
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
|
+
|
|
14
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
|
|
15
23
|
import React, { useEffect, useState } from 'react';
|
|
16
24
|
import { Spin } from 'antd';
|
|
17
25
|
import BizSearchInput from '../searchInput';
|
|
@@ -20,27 +28,31 @@ import SelectOption, { SelectAll } from './option';
|
|
|
20
28
|
import _ from 'lodash';
|
|
21
29
|
var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
22
30
|
var labelField = props.labelField,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
keyField = props.keyField,
|
|
32
|
+
options = props.options,
|
|
33
|
+
extra = props.extra,
|
|
34
|
+
multiple = props.multiple,
|
|
35
|
+
disableItemList = props.disableItemList,
|
|
36
|
+
dropdownExtra = props.dropdownExtra,
|
|
37
|
+
loading = props.loading,
|
|
38
|
+
customLabel = props.customLabel,
|
|
39
|
+
overlayClassName = props.overlayClassName;
|
|
40
|
+
|
|
32
41
|
var _useState = useState(),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
searchValue = _useState2[0],
|
|
44
|
+
setSearchValue = _useState2[1];
|
|
45
|
+
|
|
36
46
|
var _useState3 = useState(),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
current = _useState4[0],
|
|
49
|
+
setCurrent = _useState4[1];
|
|
50
|
+
|
|
40
51
|
var _useState5 = useState([]),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
53
|
+
showList = _useState6[0],
|
|
54
|
+
setShowList = _useState6[1];
|
|
55
|
+
|
|
44
56
|
useEffect(function () {
|
|
45
57
|
if (props.value) setCurrent(props.value);
|
|
46
58
|
}, [props.value]);
|
|
@@ -51,6 +63,7 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
51
63
|
}, [props.searchValue]);
|
|
52
64
|
useEffect(function () {
|
|
53
65
|
var ids = [];
|
|
66
|
+
|
|
54
67
|
if (current) {
|
|
55
68
|
if (multiple) {
|
|
56
69
|
if (current) {
|
|
@@ -62,8 +75,10 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
62
75
|
ids = [current[keyField]];
|
|
63
76
|
}
|
|
64
77
|
}
|
|
78
|
+
|
|
65
79
|
setShowList(function () {
|
|
66
80
|
var list = [];
|
|
81
|
+
|
|
67
82
|
if (props.type === 'group') {
|
|
68
83
|
list = options.map(function (group) {
|
|
69
84
|
var groupDom = /*#__PURE__*/React.createElement(SelectOption, {
|
|
@@ -77,6 +92,7 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
77
92
|
} else {
|
|
78
93
|
list = getOptionDom(options, ids);
|
|
79
94
|
}
|
|
95
|
+
|
|
80
96
|
if (options.length && !list.flat().length) {
|
|
81
97
|
var dom = /*#__PURE__*/React.createElement("div", {
|
|
82
98
|
className: "".concat(classPrefix, "-notfound"),
|
|
@@ -84,16 +100,22 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
84
100
|
}, props.notFound ? props.notFound : '未找到匹配数据');
|
|
85
101
|
list = [dom];
|
|
86
102
|
}
|
|
103
|
+
|
|
87
104
|
return list;
|
|
88
105
|
});
|
|
89
106
|
}, [searchValue, options, current]);
|
|
107
|
+
|
|
90
108
|
function getOptionDom(data, ids) {
|
|
91
109
|
var optionsDom = [];
|
|
110
|
+
|
|
92
111
|
var list = _.cloneDeep(data);
|
|
112
|
+
|
|
93
113
|
if (props.enableCreate && searchValue) {
|
|
94
114
|
var _list$push;
|
|
115
|
+
|
|
95
116
|
list.push((_list$push = {}, _defineProperty(_list$push, props.keyField, searchValue), _defineProperty(_list$push, props.labelField, searchValue), _defineProperty(_list$push, "isTemp", true), _list$push));
|
|
96
117
|
}
|
|
118
|
+
|
|
97
119
|
var tempOption = null;
|
|
98
120
|
var useTemp = true;
|
|
99
121
|
list.forEach(function (option) {
|
|
@@ -120,25 +142,31 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
120
142
|
key: option[keyField] || String(Math.random()),
|
|
121
143
|
customLabel: customLabel
|
|
122
144
|
});
|
|
145
|
+
|
|
123
146
|
if (option.isTemp) {
|
|
124
147
|
tempOption = dom;
|
|
125
148
|
return;
|
|
126
149
|
}
|
|
150
|
+
|
|
127
151
|
optionsDom.push(dom);
|
|
128
152
|
});
|
|
153
|
+
|
|
129
154
|
if (useTemp && tempOption) {
|
|
130
155
|
optionsDom.push(tempOption);
|
|
131
156
|
}
|
|
157
|
+
|
|
132
158
|
return optionsDom;
|
|
133
159
|
}
|
|
160
|
+
|
|
134
161
|
function onClick(option) {
|
|
135
162
|
var currentOption = _.cloneDeep(current);
|
|
163
|
+
|
|
136
164
|
if (multiple) {
|
|
137
165
|
if (!currentOption) {
|
|
138
166
|
currentOption = [option];
|
|
139
167
|
} else {
|
|
140
168
|
var num = 0,
|
|
141
|
-
|
|
169
|
+
flag = false;
|
|
142
170
|
currentOption.forEach(function (item, i) {
|
|
143
171
|
if (item[keyField] === option[keyField]) {
|
|
144
172
|
flag = true;
|
|
@@ -146,6 +174,7 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
146
174
|
return;
|
|
147
175
|
}
|
|
148
176
|
});
|
|
177
|
+
|
|
149
178
|
if (flag) {
|
|
150
179
|
currentOption.splice(num, 1);
|
|
151
180
|
} else {
|
|
@@ -155,14 +184,18 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
155
184
|
} else {
|
|
156
185
|
currentOption = option;
|
|
157
186
|
}
|
|
187
|
+
|
|
158
188
|
setCurrent(currentOption);
|
|
159
189
|
if (props.onChange) props.onChange(currentOption);
|
|
160
190
|
}
|
|
191
|
+
|
|
161
192
|
function onSearch(v) {
|
|
162
193
|
setSearchValue(v);
|
|
163
194
|
}
|
|
195
|
+
|
|
164
196
|
function render() {
|
|
165
197
|
if (loading) return /*#__PURE__*/React.createElement(Spin, null);
|
|
198
|
+
|
|
166
199
|
if (showList && showList.length) {
|
|
167
200
|
return showList;
|
|
168
201
|
} else {
|
|
@@ -171,8 +204,10 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
171
204
|
}, "\u6682\u65E0\u6570\u636E");
|
|
172
205
|
}
|
|
173
206
|
}
|
|
207
|
+
|
|
174
208
|
var onCheckAllChange = function onCheckAllChange(checked) {
|
|
175
209
|
var selectOptions = [];
|
|
210
|
+
|
|
176
211
|
if (checked) {
|
|
177
212
|
if (props.type === 'group') {
|
|
178
213
|
props.options.forEach(function (item) {
|
|
@@ -184,9 +219,11 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
184
219
|
} else {
|
|
185
220
|
selectOptions = disableItemList || [];
|
|
186
221
|
}
|
|
222
|
+
|
|
187
223
|
setCurrent(selectOptions);
|
|
188
224
|
if (props.onChange) props.onChange(selectOptions);
|
|
189
225
|
};
|
|
226
|
+
|
|
190
227
|
return /*#__PURE__*/React.createElement("div", {
|
|
191
228
|
className: "".concat(classPrefix, "-overlay ").concat(overlayClassName),
|
|
192
229
|
ref: ref
|
|
@@ -24,6 +24,7 @@ export var columns = [{
|
|
|
24
24
|
}
|
|
25
25
|
}];
|
|
26
26
|
var tableData = [];
|
|
27
|
+
|
|
27
28
|
for (var i = 0; i < 100; i++) {
|
|
28
29
|
tableData.push({
|
|
29
30
|
key: i,
|
|
@@ -32,4 +33,5 @@ for (var i = 0; i < 100; i++) {
|
|
|
32
33
|
address: "London Park no. ".concat(i)
|
|
33
34
|
});
|
|
34
35
|
}
|
|
36
|
+
|
|
35
37
|
export default tableData;
|