@kdcloudjs/kdesign 1.6.39 → 1.6.40
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/CHANGELOG.md +11 -0
- package/dist/kdesign.css +1 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +75 -62
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +1 -1
- package/dist/kdesign.min.js +3 -3
- package/dist/kdesign.min.js.map +1 -1
- package/es/button/button.js +2 -2
- package/es/input/ClearableLabeledInput.js +1 -1
- package/es/select/interface.d.ts +1 -1
- package/es/select/select.js +18 -5
- package/es/tree/utils/treeUtils.js +11 -13
- package/es/upload/upload.d.ts +1 -1
- package/es/upload/upload.js +4 -3
- package/lib/button/button.js +2 -2
- package/lib/input/ClearableLabeledInput.js +1 -1
- package/lib/select/interface.d.ts +1 -1
- package/lib/select/select.js +18 -5
- package/lib/tree/utils/treeUtils.js +11 -13
- package/lib/upload/upload.d.ts +1 -1
- package/lib/upload/upload.js +41 -40
- package/package.json +3 -4
package/es/button/button.js
CHANGED
|
@@ -53,8 +53,8 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
53
53
|
* @param {React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>} e 事件对象
|
|
54
54
|
*/
|
|
55
55
|
var handleClick = function handleClick(e) {
|
|
56
|
-
if (loading) {
|
|
57
|
-
//
|
|
56
|
+
if (loading || disabled) {
|
|
57
|
+
// 加载中和禁用状态不触发点击事件
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
var waveStatus = buttonRef.current.getAttribute('click-animating-wave');
|
package/es/select/interface.d.ts
CHANGED
|
@@ -27,7 +27,6 @@ export interface AbstractSelectProps extends PopperProps {
|
|
|
27
27
|
id?: string;
|
|
28
28
|
children?: React.ReactNode;
|
|
29
29
|
options?: OptionsType[];
|
|
30
|
-
loading?: boolean;
|
|
31
30
|
clearIcon?: React.ReactNode;
|
|
32
31
|
searchIcon?: React.ReactNode;
|
|
33
32
|
suffixIcon?: React.ReactNode;
|
|
@@ -56,6 +55,7 @@ export interface ISelectProps<T extends SelectValue> extends AbstractSelectProps
|
|
|
56
55
|
autoFocus?: boolean;
|
|
57
56
|
onChange?: (value?: T, option?: React.ReactElement<any> | React.ReactElement<any>[]) => void;
|
|
58
57
|
onSelect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
|
|
58
|
+
onDeselect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
|
|
59
59
|
onBlur?: (value?: T) => void;
|
|
60
60
|
onFocus?: () => void;
|
|
61
61
|
onSearch?: (value?: string) => void;
|
package/es/select/select.js
CHANGED
|
@@ -101,6 +101,10 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
101
101
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
102
102
|
inputWidth = _useState10[0],
|
|
103
103
|
setInputWidth = _useState10[1]; // 输入框宽度
|
|
104
|
+
var _useState11 = useState(autoFocus),
|
|
105
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
106
|
+
focusd = _useState12[0],
|
|
107
|
+
setFocusd = _useState12[1];
|
|
104
108
|
var selectPrefixCls = getPrefixCls(prefixCls, 'select', customPrefixcls);
|
|
105
109
|
// 选择器样式
|
|
106
110
|
var selectCls = classNames(selectPrefixCls, className, _defineProperty({}, "".concat(selectPrefixCls, "-visible"), optionShow));
|
|
@@ -184,10 +188,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
184
188
|
}, [optionShow]);
|
|
185
189
|
var handleFocus = useCallback(function (e) {
|
|
186
190
|
e.stopPropagation();
|
|
191
|
+
setFocusd(true);
|
|
187
192
|
onFocus && onFocus(e);
|
|
188
193
|
}, [onFocus]);
|
|
189
194
|
var handleBlur = useCallback(function (e) {
|
|
190
195
|
e.stopPropagation();
|
|
196
|
+
setFocusd(false);
|
|
191
197
|
onBlur && onBlur(e);
|
|
192
198
|
}, [onBlur]);
|
|
193
199
|
// 点击组件
|
|
@@ -239,7 +245,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
239
245
|
}, [searchValue, realChildren, filterOption, optionFilterProp]);
|
|
240
246
|
var getOptionLabel = useCallback(function (obj) {
|
|
241
247
|
var _a;
|
|
242
|
-
var text = 'options'
|
|
248
|
+
var text = Object.prototype.hasOwnProperty.call(selectProps, 'options') && !Object.prototype.hasOwnProperty.call(props, 'optionLabelProp') ? 'label' : optionLabelProp;
|
|
243
249
|
if (obj.props) {
|
|
244
250
|
if (text) {
|
|
245
251
|
return obj === null || obj === void 0 ? void 0 : obj.props[text];
|
|
@@ -383,6 +389,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
383
389
|
// 输入框变化搜索内容
|
|
384
390
|
var handleSearchChange = useCallback(function (event) {
|
|
385
391
|
var val = event.currentTarget.value;
|
|
392
|
+
setOptionShow(true);
|
|
386
393
|
setSearchValue(val);
|
|
387
394
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(val);
|
|
388
395
|
}, [onSearch]);
|
|
@@ -435,9 +442,9 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
435
442
|
return e.preventDefault();
|
|
436
443
|
},
|
|
437
444
|
className: clearIconCls
|
|
438
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
445
|
+
}, clearIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
439
446
|
type: "close-solid"
|
|
440
|
-
})
|
|
447
|
+
})), showArrow && /*#__PURE__*/React.createElement("span", {
|
|
441
448
|
className: arrowIconCls
|
|
442
449
|
}, suffixIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
443
450
|
type: "arrow-down"
|
|
@@ -483,6 +490,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
483
490
|
var isShowSearch = useMemo(function () {
|
|
484
491
|
return isBoolean(showSearch) ? showSearch : isMultiple;
|
|
485
492
|
}, [isMultiple, showSearch]);
|
|
493
|
+
useEffect(function () {
|
|
494
|
+
var _a;
|
|
495
|
+
if (isShowSearch && autoFocus && !disabled) {
|
|
496
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
497
|
+
}
|
|
498
|
+
}, [isShowSearch, autoFocus, disabled]);
|
|
486
499
|
// 渲染下拉列表框
|
|
487
500
|
var renderContent = function renderContent() {
|
|
488
501
|
var dropdownRender = selectProps.dropdownRender,
|
|
@@ -605,7 +618,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
605
618
|
var _context3, _classNames10, _context4, _classNames11;
|
|
606
619
|
var maxTagCount = selectProps.maxTagCount,
|
|
607
620
|
maxTagPlaceholder = selectProps.maxTagPlaceholder;
|
|
608
|
-
var multipleCls = classNames(commCls, (_classNames10 = {}, _defineProperty(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), _defineProperty(_classNames10, _concatInstanceProperty(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-focused"),
|
|
621
|
+
var multipleCls = classNames(commCls, (_classNames10 = {}, _defineProperty(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), _defineProperty(_classNames10, _concatInstanceProperty(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-focused"), focusd || optionShow), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames10));
|
|
609
622
|
var itemCls = classNames((_classNames11 = {}, _defineProperty(_classNames11, "".concat(selectPrefixCls, "-selection-item"), true), _defineProperty(_classNames11, _concatInstanceProperty(_context4 = "".concat(selectPrefixCls, "-selection-item-")).call(_context4, size), size), _classNames11));
|
|
610
623
|
var TagStyle = {
|
|
611
624
|
margin: '2px 8px 2px 0',
|
|
@@ -666,7 +679,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
666
679
|
className: "".concat(selectPrefixCls, "-suffix")
|
|
667
680
|
}, renderSuffix()));
|
|
668
681
|
};
|
|
669
|
-
var singleCls = classNames(commCls, (_classNames12 = {}, _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single"), true), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-focused"),
|
|
682
|
+
var singleCls = classNames(commCls, (_classNames12 = {}, _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single"), true), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-focused"), focusd && !disabled || optionShow), _classNames12));
|
|
670
683
|
var renderSelect = function renderSelect() {
|
|
671
684
|
return /*#__PURE__*/React.createElement("div", {
|
|
672
685
|
className: selectCls,
|
|
@@ -40,6 +40,7 @@ export var flattenAll = function flattenAll(treeData) {
|
|
|
40
40
|
var parent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
41
41
|
treeData && treeData.forEach(function (item, index) {
|
|
42
42
|
var _context, _context2;
|
|
43
|
+
var _a;
|
|
43
44
|
var children = item.children,
|
|
44
45
|
title = item.title,
|
|
45
46
|
key = item.key,
|
|
@@ -53,7 +54,7 @@ export var flattenAll = function flattenAll(treeData) {
|
|
|
53
54
|
hasChildNode: hasChildNode,
|
|
54
55
|
children: children,
|
|
55
56
|
level: level,
|
|
56
|
-
parentKey: (parent === null || parent === void 0 ? void 0 : parent.key) || null,
|
|
57
|
+
parentKey: ((_a = parent === null || parent === void 0 ? void 0 : parent.key) !== null && _a !== void 0 ? _a : '') !== '' ? parent === null || parent === void 0 ? void 0 : parent.key : null,
|
|
57
58
|
pathParentKeys: parent ? _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray((parent === null || parent === void 0 ? void 0 : parent.pathParentKeys) || []), [parent === null || parent === void 0 ? void 0 : parent.key]) : []
|
|
58
59
|
}, others);
|
|
59
60
|
keysData[key] = flattenNode;
|
|
@@ -129,11 +130,8 @@ export var getAllFilterKeys = function getAllFilterKeys(data, filterTreeNode, ke
|
|
|
129
130
|
filterKeys.forEach(function (item) {
|
|
130
131
|
var node = _extends({}, item);
|
|
131
132
|
while (node) {
|
|
132
|
-
var _context3;
|
|
133
133
|
allFilterKeys.add(node.key);
|
|
134
|
-
|
|
135
|
-
return i.key;
|
|
136
|
-
})).call(_context3, node.key) && filterExpandKeys.add(node.key);
|
|
134
|
+
filterExpandKeys.add(node.key);
|
|
137
135
|
node = (keysData === null || keysData === void 0 ? void 0 : keysData[node === null || node === void 0 ? void 0 : node.parentKey]) || null;
|
|
138
136
|
}
|
|
139
137
|
});
|
|
@@ -276,10 +274,10 @@ export var getSpreadAttrData = function getSpreadAttrData(treeData, expandedKeys
|
|
|
276
274
|
};
|
|
277
275
|
};
|
|
278
276
|
export var addKeys = function addKeys() {
|
|
279
|
-
var
|
|
277
|
+
var _context3;
|
|
280
278
|
var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
281
279
|
var newKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
282
|
-
return _Array$from(new _Set(_concatInstanceProperty(
|
|
280
|
+
return _Array$from(new _Set(_concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(prevKeys), _toConsumableArray(newKeys))));
|
|
283
281
|
};
|
|
284
282
|
export var getAllParentKeys = function getAllParentKeys(data) {
|
|
285
283
|
var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -325,13 +323,13 @@ export var getPos = function getPos(data, key) {
|
|
|
325
323
|
return node === null || node === void 0 ? void 0 : node.pos;
|
|
326
324
|
};
|
|
327
325
|
export var getInitCheckedKeys = function getInitCheckedKeys(data, keys) {
|
|
328
|
-
var
|
|
326
|
+
var _context4;
|
|
329
327
|
var checkedKeys = [];
|
|
330
328
|
keys.forEach(function (item) {
|
|
331
329
|
var pos = getPos(data, item);
|
|
332
330
|
checkedKeys.push.apply(checkedKeys, _toConsumableArray(getAllChildKeys(data, pos)));
|
|
333
331
|
});
|
|
334
|
-
return _Array$from(new _Set(_concatInstanceProperty(
|
|
332
|
+
return _Array$from(new _Set(_concatInstanceProperty(_context4 = []).call(_context4, checkedKeys, _toConsumableArray(keys))));
|
|
335
333
|
};
|
|
336
334
|
export var getInitCheckededState = function getInitCheckededState(data) {
|
|
337
335
|
var checkedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -425,7 +423,7 @@ var updateParent = function updateParent(key, keysNodeProps, allKeys, halfChecke
|
|
|
425
423
|
});
|
|
426
424
|
};
|
|
427
425
|
export var getInitCheckededKeys = function getInitCheckededKeys() {
|
|
428
|
-
var
|
|
426
|
+
var _context5;
|
|
429
427
|
var checkedKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
430
428
|
var keysNodeProps = arguments.length > 1 ? arguments[1] : undefined;
|
|
431
429
|
var checkedKeysSet = new _Set(checkedKeys || []);
|
|
@@ -445,7 +443,7 @@ export var getInitCheckededKeys = function getInitCheckededKeys() {
|
|
|
445
443
|
}
|
|
446
444
|
});
|
|
447
445
|
return {
|
|
448
|
-
checkedKeys: _toConsumableArray(new _Set(_concatInstanceProperty(
|
|
446
|
+
checkedKeys: _toConsumableArray(new _Set(_concatInstanceProperty(_context5 = []).call(_context5, _toConsumableArray(checkedKeysSet), _toConsumableArray(childCheckedKeysSet)))),
|
|
449
447
|
halfCheckedKeys: _toConsumableArray(halfCheckedKeysSet)
|
|
450
448
|
};
|
|
451
449
|
};
|
|
@@ -608,8 +606,8 @@ export var getInitExpandedKeys = function getInitExpandedKeys(data, expandedKeys
|
|
|
608
606
|
}
|
|
609
607
|
}
|
|
610
608
|
if (isSearching) {
|
|
611
|
-
var
|
|
612
|
-
keys = _concatInstanceProperty(
|
|
609
|
+
var _context6;
|
|
610
|
+
keys = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(searchExpandedKeys), _toConsumableArray(getAllFilterKeys(data, filterTreeNode, keysData).filterExpandKeys));
|
|
613
611
|
}
|
|
614
612
|
return _Array$from(new _Set(_toConsumableArray(keys)));
|
|
615
613
|
};
|
package/es/upload/upload.d.ts
CHANGED
package/es/upload/upload.js
CHANGED
|
@@ -37,7 +37,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
37
37
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
import
|
|
40
|
+
import React, { Children } from 'react';
|
|
41
41
|
import classNames from 'classnames';
|
|
42
42
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
43
43
|
import { getCompProps } from '../_utils';
|
|
@@ -97,6 +97,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
97
97
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
98
98
|
fileList = _React$useState2[0],
|
|
99
99
|
setFileList = _React$useState2[1];
|
|
100
|
+
var hasChildren = children && Children.toArray(children).length > 0;
|
|
100
101
|
React.useEffect(function () {
|
|
101
102
|
props.fileList && setFileList(props.fileList);
|
|
102
103
|
}, [props.fileList]);
|
|
@@ -365,7 +366,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
365
366
|
disabled: disabled
|
|
366
367
|
}, className),
|
|
367
368
|
style: style
|
|
368
|
-
}, listType === 'text' && /*#__PURE__*/React.createElement("label", _extends({
|
|
369
|
+
}, listType === 'text' && hasChildren && /*#__PURE__*/React.createElement("label", _extends({
|
|
369
370
|
className: classNames((_classNames = {}, _defineProperty(_classNames, _concatInstanceProperty(_context5 = "".concat(prefixCls, "-")).call(_context5, type), true), _defineProperty(_classNames, "hover", hover), _classNames))
|
|
370
371
|
}, dragEvents), /*#__PURE__*/React.createElement("span", {
|
|
371
372
|
className: "".concat(prefixCls, "-handle")
|
|
@@ -378,7 +379,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
378
379
|
ref: mergedRef
|
|
379
380
|
})))), (listType === 'picture' || !(listType === 'text' && (!showUploadList || !fileList.length))) && /*#__PURE__*/React.createElement("ul", {
|
|
380
381
|
className: _concatInstanceProperty(_context6 = "".concat(prefixCls, "-")).call(_context6, listType, "-list")
|
|
381
|
-
}, listType === 'picture' &&
|
|
382
|
+
}, listType === 'picture' && hasChildren && /*#__PURE__*/React.createElement("li", {
|
|
382
383
|
className: classNames(_concatInstanceProperty(_context7 = "".concat(prefixCls, "-")).call(_context7, listType, "-list-item"))
|
|
383
384
|
}, /*#__PURE__*/React.createElement("label", {
|
|
384
385
|
className: "".concat(prefixCls, "-select")
|
package/lib/button/button.js
CHANGED
|
@@ -70,8 +70,8 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
70
70
|
* @param {React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>} e 事件对象
|
|
71
71
|
*/
|
|
72
72
|
var handleClick = function handleClick(e) {
|
|
73
|
-
if (loading) {
|
|
74
|
-
//
|
|
73
|
+
if (loading || disabled) {
|
|
74
|
+
// 加载中和禁用状态不触发点击事件
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
var waveStatus = buttonRef.current.getAttribute('click-animating-wave');
|
|
@@ -27,7 +27,6 @@ export interface AbstractSelectProps extends PopperProps {
|
|
|
27
27
|
id?: string;
|
|
28
28
|
children?: React.ReactNode;
|
|
29
29
|
options?: OptionsType[];
|
|
30
|
-
loading?: boolean;
|
|
31
30
|
clearIcon?: React.ReactNode;
|
|
32
31
|
searchIcon?: React.ReactNode;
|
|
33
32
|
suffixIcon?: React.ReactNode;
|
|
@@ -56,6 +55,7 @@ export interface ISelectProps<T extends SelectValue> extends AbstractSelectProps
|
|
|
56
55
|
autoFocus?: boolean;
|
|
57
56
|
onChange?: (value?: T, option?: React.ReactElement<any> | React.ReactElement<any>[]) => void;
|
|
58
57
|
onSelect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
|
|
58
|
+
onDeselect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
|
|
59
59
|
onBlur?: (value?: T) => void;
|
|
60
60
|
onFocus?: () => void;
|
|
61
61
|
onSearch?: (value?: string) => void;
|
package/lib/select/select.js
CHANGED
|
@@ -113,6 +113,10 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
113
113
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
114
114
|
inputWidth = _useState10[0],
|
|
115
115
|
setInputWidth = _useState10[1]; // 输入框宽度
|
|
116
|
+
var _useState11 = (0, _react.useState)(autoFocus),
|
|
117
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
118
|
+
focusd = _useState12[0],
|
|
119
|
+
setFocusd = _useState12[1];
|
|
116
120
|
var selectPrefixCls = getPrefixCls(prefixCls, 'select', customPrefixcls);
|
|
117
121
|
// 选择器样式
|
|
118
122
|
var selectCls = (0, _classnames.default)(selectPrefixCls, className, (0, _defineProperty2.default)({}, "".concat(selectPrefixCls, "-visible"), optionShow));
|
|
@@ -196,10 +200,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
196
200
|
}, [optionShow]);
|
|
197
201
|
var handleFocus = (0, _react.useCallback)(function (e) {
|
|
198
202
|
e.stopPropagation();
|
|
203
|
+
setFocusd(true);
|
|
199
204
|
onFocus && onFocus(e);
|
|
200
205
|
}, [onFocus]);
|
|
201
206
|
var handleBlur = (0, _react.useCallback)(function (e) {
|
|
202
207
|
e.stopPropagation();
|
|
208
|
+
setFocusd(false);
|
|
203
209
|
onBlur && onBlur(e);
|
|
204
210
|
}, [onBlur]);
|
|
205
211
|
// 点击组件
|
|
@@ -251,7 +257,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
251
257
|
}, [searchValue, realChildren, filterOption, optionFilterProp]);
|
|
252
258
|
var getOptionLabel = (0, _react.useCallback)(function (obj) {
|
|
253
259
|
var _a;
|
|
254
|
-
var text = 'options'
|
|
260
|
+
var text = Object.prototype.hasOwnProperty.call(selectProps, 'options') && !Object.prototype.hasOwnProperty.call(props, 'optionLabelProp') ? 'label' : optionLabelProp;
|
|
255
261
|
if (obj.props) {
|
|
256
262
|
if (text) {
|
|
257
263
|
return obj === null || obj === void 0 ? void 0 : obj.props[text];
|
|
@@ -395,6 +401,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
395
401
|
// 输入框变化搜索内容
|
|
396
402
|
var handleSearchChange = (0, _react.useCallback)(function (event) {
|
|
397
403
|
var val = event.currentTarget.value;
|
|
404
|
+
setOptionShow(true);
|
|
398
405
|
setSearchValue(val);
|
|
399
406
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(val);
|
|
400
407
|
}, [onSearch]);
|
|
@@ -447,9 +454,9 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
447
454
|
return e.preventDefault();
|
|
448
455
|
},
|
|
449
456
|
className: clearIconCls
|
|
450
|
-
}, /*#__PURE__*/_react.default.createElement(_index.Icon, {
|
|
457
|
+
}, clearIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
|
|
451
458
|
type: "close-solid"
|
|
452
|
-
})
|
|
459
|
+
})), showArrow && /*#__PURE__*/_react.default.createElement("span", {
|
|
453
460
|
className: arrowIconCls
|
|
454
461
|
}, suffixIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
|
|
455
462
|
type: "arrow-down"
|
|
@@ -495,6 +502,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
495
502
|
var isShowSearch = (0, _react.useMemo)(function () {
|
|
496
503
|
return (0, _isBoolean.default)(showSearch) ? showSearch : isMultiple;
|
|
497
504
|
}, [isMultiple, showSearch]);
|
|
505
|
+
(0, _react.useEffect)(function () {
|
|
506
|
+
var _a;
|
|
507
|
+
if (isShowSearch && autoFocus && !disabled) {
|
|
508
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
509
|
+
}
|
|
510
|
+
}, [isShowSearch, autoFocus, disabled]);
|
|
498
511
|
// 渲染下拉列表框
|
|
499
512
|
var renderContent = function renderContent() {
|
|
500
513
|
var dropdownRender = selectProps.dropdownRender,
|
|
@@ -617,7 +630,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
617
630
|
var _context3, _classNames10, _context4, _classNames11;
|
|
618
631
|
var maxTagCount = selectProps.maxTagCount,
|
|
619
632
|
maxTagPlaceholder = selectProps.maxTagPlaceholder;
|
|
620
|
-
var multipleCls = (0, _classnames.default)(commCls, (_classNames10 = {}, (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), (0, _defineProperty2.default)(_classNames10, (0, _concat.default)(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-focused"),
|
|
633
|
+
var multipleCls = (0, _classnames.default)(commCls, (_classNames10 = {}, (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), (0, _defineProperty2.default)(_classNames10, (0, _concat.default)(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-focused"), focusd || optionShow), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames10));
|
|
621
634
|
var itemCls = (0, _classnames.default)((_classNames11 = {}, (0, _defineProperty2.default)(_classNames11, "".concat(selectPrefixCls, "-selection-item"), true), (0, _defineProperty2.default)(_classNames11, (0, _concat.default)(_context4 = "".concat(selectPrefixCls, "-selection-item-")).call(_context4, size), size), _classNames11));
|
|
622
635
|
var TagStyle = {
|
|
623
636
|
margin: '2px 8px 2px 0',
|
|
@@ -678,7 +691,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
678
691
|
className: "".concat(selectPrefixCls, "-suffix")
|
|
679
692
|
}, renderSuffix()));
|
|
680
693
|
};
|
|
681
|
-
var singleCls = (0, _classnames.default)(commCls, (_classNames12 = {}, (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single"), true), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-focused"),
|
|
694
|
+
var singleCls = (0, _classnames.default)(commCls, (_classNames12 = {}, (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single"), true), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-focused"), focusd && !disabled || optionShow), _classNames12));
|
|
682
695
|
var renderSelect = function renderSelect() {
|
|
683
696
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
684
697
|
className: selectCls,
|
|
@@ -53,6 +53,7 @@ var flattenAll = function flattenAll(treeData) {
|
|
|
53
53
|
var parent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
54
54
|
treeData && treeData.forEach(function (item, index) {
|
|
55
55
|
var _context, _context2;
|
|
56
|
+
var _a;
|
|
56
57
|
var children = item.children,
|
|
57
58
|
title = item.title,
|
|
58
59
|
key = item.key,
|
|
@@ -66,7 +67,7 @@ var flattenAll = function flattenAll(treeData) {
|
|
|
66
67
|
hasChildNode: hasChildNode,
|
|
67
68
|
children: children,
|
|
68
69
|
level: level,
|
|
69
|
-
parentKey: (parent === null || parent === void 0 ? void 0 : parent.key) || null,
|
|
70
|
+
parentKey: ((_a = parent === null || parent === void 0 ? void 0 : parent.key) !== null && _a !== void 0 ? _a : '') !== '' ? parent === null || parent === void 0 ? void 0 : parent.key : null,
|
|
70
71
|
pathParentKeys: parent ? (0, _concat.default)(_context2 = []).call(_context2, (0, _toConsumableArray2.default)((parent === null || parent === void 0 ? void 0 : parent.pathParentKeys) || []), [parent === null || parent === void 0 ? void 0 : parent.key]) : []
|
|
71
72
|
}, others);
|
|
72
73
|
keysData[key] = flattenNode;
|
|
@@ -147,11 +148,8 @@ var getAllFilterKeys = function getAllFilterKeys(data, filterTreeNode, keysData)
|
|
|
147
148
|
filterKeys.forEach(function (item) {
|
|
148
149
|
var node = (0, _extends2.default)({}, item);
|
|
149
150
|
while (node) {
|
|
150
|
-
var _context3;
|
|
151
151
|
allFilterKeys.add(node.key);
|
|
152
|
-
|
|
153
|
-
return i.key;
|
|
154
|
-
})).call(_context3, node.key) && filterExpandKeys.add(node.key);
|
|
152
|
+
filterExpandKeys.add(node.key);
|
|
155
153
|
node = (keysData === null || keysData === void 0 ? void 0 : keysData[node === null || node === void 0 ? void 0 : node.parentKey]) || null;
|
|
156
154
|
}
|
|
157
155
|
});
|
|
@@ -298,10 +296,10 @@ var getSpreadAttrData = function getSpreadAttrData(treeData, expandedKeys) {
|
|
|
298
296
|
};
|
|
299
297
|
exports.getSpreadAttrData = getSpreadAttrData;
|
|
300
298
|
var addKeys = function addKeys() {
|
|
301
|
-
var
|
|
299
|
+
var _context3;
|
|
302
300
|
var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
303
301
|
var newKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
304
|
-
return (0, _from.default)(new _set.default((0, _concat.default)(
|
|
302
|
+
return (0, _from.default)(new _set.default((0, _concat.default)(_context3 = []).call(_context3, (0, _toConsumableArray2.default)(prevKeys), (0, _toConsumableArray2.default)(newKeys))));
|
|
305
303
|
};
|
|
306
304
|
exports.addKeys = addKeys;
|
|
307
305
|
var getAllParentKeys = function getAllParentKeys(data) {
|
|
@@ -352,13 +350,13 @@ var getPos = function getPos(data, key) {
|
|
|
352
350
|
};
|
|
353
351
|
exports.getPos = getPos;
|
|
354
352
|
var getInitCheckedKeys = function getInitCheckedKeys(data, keys) {
|
|
355
|
-
var
|
|
353
|
+
var _context4;
|
|
356
354
|
var checkedKeys = [];
|
|
357
355
|
keys.forEach(function (item) {
|
|
358
356
|
var pos = getPos(data, item);
|
|
359
357
|
checkedKeys.push.apply(checkedKeys, (0, _toConsumableArray2.default)(getAllChildKeys(data, pos)));
|
|
360
358
|
});
|
|
361
|
-
return (0, _from.default)(new _set.default((0, _concat.default)(
|
|
359
|
+
return (0, _from.default)(new _set.default((0, _concat.default)(_context4 = []).call(_context4, checkedKeys, (0, _toConsumableArray2.default)(keys))));
|
|
362
360
|
};
|
|
363
361
|
exports.getInitCheckedKeys = getInitCheckedKeys;
|
|
364
362
|
var getInitCheckededState = function getInitCheckededState(data) {
|
|
@@ -454,7 +452,7 @@ var updateParent = function updateParent(key, keysNodeProps, allKeys, halfChecke
|
|
|
454
452
|
});
|
|
455
453
|
};
|
|
456
454
|
var getInitCheckededKeys = function getInitCheckededKeys() {
|
|
457
|
-
var
|
|
455
|
+
var _context5;
|
|
458
456
|
var checkedKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
459
457
|
var keysNodeProps = arguments.length > 1 ? arguments[1] : undefined;
|
|
460
458
|
var checkedKeysSet = new _set.default(checkedKeys || []);
|
|
@@ -474,7 +472,7 @@ var getInitCheckededKeys = function getInitCheckededKeys() {
|
|
|
474
472
|
}
|
|
475
473
|
});
|
|
476
474
|
return {
|
|
477
|
-
checkedKeys: (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(
|
|
475
|
+
checkedKeys: (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context5 = []).call(_context5, (0, _toConsumableArray2.default)(checkedKeysSet), (0, _toConsumableArray2.default)(childCheckedKeysSet)))),
|
|
478
476
|
halfCheckedKeys: (0, _toConsumableArray2.default)(halfCheckedKeysSet)
|
|
479
477
|
};
|
|
480
478
|
};
|
|
@@ -642,8 +640,8 @@ var getInitExpandedKeys = function getInitExpandedKeys(data, expandedKeys, defau
|
|
|
642
640
|
}
|
|
643
641
|
}
|
|
644
642
|
if (isSearching) {
|
|
645
|
-
var
|
|
646
|
-
keys = (0, _concat.default)(
|
|
643
|
+
var _context6;
|
|
644
|
+
keys = (0, _concat.default)(_context6 = []).call(_context6, (0, _toConsumableArray2.default)(searchExpandedKeys), (0, _toConsumableArray2.default)(getAllFilterKeys(data, filterTreeNode, keysData).filterExpandKeys));
|
|
647
645
|
}
|
|
648
646
|
return (0, _from.default)(new _set.default((0, _toConsumableArray2.default)(keys)));
|
|
649
647
|
};
|
package/lib/upload/upload.d.ts
CHANGED