@douyinfe/semi-foundation 2.25.2 → 2.26.0
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/grid/grid.scss +1 -1
- package/lib/cjs/grid/grid.css +1 -1
- package/lib/cjs/grid/grid.scss +1 -1
- package/lib/cjs/table/foundation.js +3 -3
- package/lib/cjs/table/utils.js +3 -2
- package/lib/cjs/tagInput/foundation.d.ts +3 -0
- package/lib/cjs/tagInput/foundation.js +60 -1
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/tree/treeUtil.js +17 -2
- package/lib/cjs/treeSelect/foundation.d.ts +6 -0
- package/lib/cjs/treeSelect/foundation.js +50 -4
- package/lib/es/grid/grid.css +1 -1
- package/lib/es/grid/grid.scss +1 -1
- package/lib/es/table/foundation.js +4 -3
- package/lib/es/table/utils.js +3 -2
- package/lib/es/tagInput/foundation.d.ts +3 -0
- package/lib/es/tagInput/foundation.js +60 -1
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +17 -2
- package/lib/es/treeSelect/foundation.d.ts +6 -0
- package/lib/es/treeSelect/foundation.js +50 -4
- package/package.json +2 -2
- package/table/foundation.ts +2 -4
- package/table/utils.ts +2 -2
- package/tagInput/foundation.ts +48 -1
- package/tree/treeUtil.ts +14 -2
- package/treeSelect/foundation.ts +38 -6
package/grid/grid.scss
CHANGED
package/lib/cjs/grid/grid.css
CHANGED
package/lib/cjs/grid/grid.scss
CHANGED
|
@@ -125,9 +125,9 @@ class TableFoundation extends _foundation.default {
|
|
|
125
125
|
const {
|
|
126
126
|
defaultFilteredValue,
|
|
127
127
|
filteredValue,
|
|
128
|
-
|
|
128
|
+
onFilter
|
|
129
129
|
} = column;
|
|
130
|
-
const hasFilter =
|
|
130
|
+
const hasFilter = (0, _isFunction2.default)(onFilter);
|
|
131
131
|
|
|
132
132
|
if (hasFilter && (0, _isUndefined2.default)(filteredValue)) {
|
|
133
133
|
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
@@ -244,7 +244,7 @@ class TableFoundation extends _foundation.default {
|
|
|
244
244
|
* When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
|
|
245
245
|
*/
|
|
246
246
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
247
|
-
return (0, _isFunction2.default)(query.onFilter) && Array.isArray(
|
|
247
|
+
return (0, _isFunction2.default)(query.onFilter) && Array.isArray(currentFilteredValue) && currentFilteredValue.length;
|
|
248
248
|
}));
|
|
249
249
|
const sortedDataSource = this.sortDataSource(filteredDataSource, queries.filter(query => query && (0, _isFunction2.default)(query.sorter)));
|
|
250
250
|
return sortedDataSource;
|
package/lib/cjs/table/utils.js
CHANGED
|
@@ -581,11 +581,12 @@ function warnIfNoDataIndex(column) {
|
|
|
581
581
|
const {
|
|
582
582
|
filters,
|
|
583
583
|
sorter,
|
|
584
|
-
dataIndex
|
|
584
|
+
dataIndex,
|
|
585
|
+
onFilter
|
|
585
586
|
} = column;
|
|
586
587
|
const logger = new _Logger.default('[@douyinfe/semi-ui Table]');
|
|
587
588
|
|
|
588
|
-
if ((Array.isArray(filters) || (0, _isFunction2.default)(sorter)) && (0, _isNullOrUndefined.default)(dataIndex)) {
|
|
589
|
+
if ((Array.isArray(filters) || (0, _isFunction2.default)(onFilter) || (0, _isFunction2.default)(sorter)) && (0, _isNullOrUndefined.default)(dataIndex)) {
|
|
589
590
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
590
591
|
}
|
|
591
592
|
}
|
|
@@ -14,6 +14,7 @@ export interface TagInputAdapter extends DefaultAdapter {
|
|
|
14
14
|
toggleFocusing(focused: boolean): void;
|
|
15
15
|
setHovering: (hovering: boolean) => void;
|
|
16
16
|
setActive: (active: boolean) => void;
|
|
17
|
+
setEntering: (entering: boolean) => void;
|
|
17
18
|
getClickOutsideHandler: () => any;
|
|
18
19
|
registerClickOutsideHandler: (cb: any) => void;
|
|
19
20
|
unregisterClickOutsideHandler: () => void;
|
|
@@ -31,6 +32,8 @@ declare class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
31
32
|
* handler of input change
|
|
32
33
|
*/
|
|
33
34
|
handleInputChange: (e: TagInputChangeEvent) => void;
|
|
35
|
+
handleInputCompositionStart: (e: any) => void;
|
|
36
|
+
handleInputCompositionEnd: (e: any) => void;
|
|
34
37
|
/**
|
|
35
38
|
* check whether the input change is legal
|
|
36
39
|
*/
|
|
@@ -36,7 +36,66 @@ class TagInputFoundation extends _foundation.default {
|
|
|
36
36
|
const {
|
|
37
37
|
value
|
|
38
38
|
} = e.target;
|
|
39
|
-
|
|
39
|
+
const {
|
|
40
|
+
entering
|
|
41
|
+
} = this.getStates();
|
|
42
|
+
|
|
43
|
+
if (entering) {
|
|
44
|
+
// 如果处于输入法输入中,则先不检查输入是否有效,直接更新到inputValue,
|
|
45
|
+
// 因为对于输入法输入中而言,此时更新到 inputValue 的不是最后的结果,比如对于中文,此时 inputValue 中的内容是拼音
|
|
46
|
+
// 当输入法输入结束后,将在 handleInputCompositionEnd 中判断输入是否有效,处理结果
|
|
47
|
+
// If it is composition session, it does not check whether the input is valid, and directly updates to inputValue,
|
|
48
|
+
// Because for composition input, what is updated to inputValue at this time is not the final result.
|
|
49
|
+
// For example, for Chinese, the content in inputValue is pinyin at this time
|
|
50
|
+
// When the composition input is finished, it will be judged whether the input is valid in handleInputCompositionEnd and the result will be processed
|
|
51
|
+
this._onInputChange(value, e);
|
|
52
|
+
} else {
|
|
53
|
+
this._checkInputChangeValid(value) && this._onInputChange(value, e);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
this.handleInputCompositionStart = e => {
|
|
58
|
+
this._adapter.setEntering(true);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
this.handleInputCompositionEnd = e => {
|
|
62
|
+
this._adapter.setEntering(false);
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
value
|
|
66
|
+
} = e.target;
|
|
67
|
+
const {
|
|
68
|
+
maxLength,
|
|
69
|
+
onInputExceed,
|
|
70
|
+
separator
|
|
71
|
+
} = this.getProps();
|
|
72
|
+
let allowChange = true;
|
|
73
|
+
const {
|
|
74
|
+
inputValue
|
|
75
|
+
} = this.getStates();
|
|
76
|
+
|
|
77
|
+
if ((0, _isNumber2.default)(maxLength)) {
|
|
78
|
+
const inputArr = (0, _getSplitedArray.default)(inputValue, separator);
|
|
79
|
+
let index = 0;
|
|
80
|
+
|
|
81
|
+
for (; index < inputArr.length; index++) {
|
|
82
|
+
if (inputArr[index].length > maxLength) {
|
|
83
|
+
allowChange = false;
|
|
84
|
+
(0, _isFunction2.default)(onInputExceed) && onInputExceed(value);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!allowChange) {
|
|
90
|
+
const newInputArr = inputArr.slice(0, index);
|
|
91
|
+
|
|
92
|
+
if (index < inputArr.length) {
|
|
93
|
+
newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this._adapter.setInputValue(newInputArr.join(separator));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
40
99
|
};
|
|
41
100
|
/**
|
|
42
101
|
* check whether the input change is legal
|
|
@@ -54,7 +54,7 @@ export declare function calcMotionKeys(oldKeySet: Set<string>, newKeySet: Set<st
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function filter(sugInput: string, option: any, filterTreeNode: any, filterProps: any): any;
|
|
56
56
|
export declare function normalizedArr(val: any): any[];
|
|
57
|
-
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean): string[];
|
|
57
|
+
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean, flag?: boolean): string[];
|
|
58
58
|
export declare function getMotionKeys(eventKey: string, expandedKeys: Set<string>, keyEntities: KeyEntities): any[];
|
|
59
59
|
export declare function calcCheckedKeysForChecked(key: string, keyEntities: KeyEntities, checkedKeys: Set<string>, halfCheckedKeys: Set<string>): {
|
|
60
60
|
checkedKeys: Set<string>;
|
package/lib/cjs/tree/treeUtil.js
CHANGED
|
@@ -234,6 +234,9 @@ function findKeysForValues(valueList, valueEntities) {
|
|
|
234
234
|
valueList.forEach(val => {
|
|
235
235
|
if (val in valueEntities) {
|
|
236
236
|
res.push(valueEntities[val]);
|
|
237
|
+
} else {
|
|
238
|
+
// if val not in valueEntities, then value push to keys array
|
|
239
|
+
val && res.push(val);
|
|
237
240
|
}
|
|
238
241
|
});
|
|
239
242
|
return res;
|
|
@@ -512,16 +515,23 @@ function normalizedArr(val) {
|
|
|
512
515
|
} else {
|
|
513
516
|
return val;
|
|
514
517
|
}
|
|
515
|
-
}
|
|
518
|
+
} // flag is used to determine whether to return when the key does not belong to the keys in keyEntities
|
|
519
|
+
// export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
|
|
520
|
+
|
|
516
521
|
|
|
517
522
|
function normalizeKeyList(keyList, keyEntities) {
|
|
518
523
|
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
524
|
+
let flag = arguments.length > 3 ? arguments[3] : undefined;
|
|
519
525
|
const res = [];
|
|
520
526
|
const keyListSet = new Set(keyList);
|
|
521
527
|
|
|
522
528
|
if (!leafOnly) {
|
|
523
529
|
keyList.forEach(key => {
|
|
524
530
|
if (!keyEntities[key]) {
|
|
531
|
+
if (flag) {
|
|
532
|
+
res.push(key);
|
|
533
|
+
}
|
|
534
|
+
|
|
525
535
|
return;
|
|
526
536
|
}
|
|
527
537
|
|
|
@@ -539,6 +549,11 @@ function normalizeKeyList(keyList, keyEntities) {
|
|
|
539
549
|
keyList.forEach(key => {
|
|
540
550
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
541
551
|
res.push(key);
|
|
552
|
+
} // when key is not in keyEntities, if flag is true, key should be push in res
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
if (!keyEntities[key] && flag) {
|
|
556
|
+
res.push(key);
|
|
542
557
|
}
|
|
543
558
|
});
|
|
544
559
|
}
|
|
@@ -658,7 +673,7 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
|
|
|
658
673
|
}
|
|
659
674
|
};
|
|
660
675
|
|
|
661
|
-
calcCurrLevel(nodeItem);
|
|
676
|
+
nodeItem && calcCurrLevel(nodeItem);
|
|
662
677
|
return {
|
|
663
678
|
checkedKeys,
|
|
664
679
|
halfCheckedKeys
|
|
@@ -115,6 +115,12 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
115
115
|
_isSelectToClose(): boolean;
|
|
116
116
|
_isLoadControlled(): any;
|
|
117
117
|
_showFilteredOnly(): any;
|
|
118
|
+
findDataForValue(findValue: string): any;
|
|
119
|
+
constructDataForValue(value: string): {
|
|
120
|
+
[x: number]: string;
|
|
121
|
+
key: string;
|
|
122
|
+
};
|
|
123
|
+
getDataForKeyNotInKeyEntities(value: string): any;
|
|
118
124
|
getCopyFromState(items: string | string[]): BasicTreeInnerData;
|
|
119
125
|
getTreeNodeProps(key: string): BasicTreeNodeProps;
|
|
120
126
|
handleNodeLoad(loadedKeys: Set<string>, loadingKeys: Set<string>, data: BasicTreeNodeData, resolve: (value?: any) => void): {
|
|
@@ -115,6 +115,46 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
115
115
|
return Boolean(inputValue) && showFilteredOnly;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
findDataForValue(findValue) {
|
|
119
|
+
const {
|
|
120
|
+
value,
|
|
121
|
+
defaultValue
|
|
122
|
+
} = this.getProps();
|
|
123
|
+
let valueArr = [];
|
|
124
|
+
|
|
125
|
+
if (value) {
|
|
126
|
+
valueArr = Array.isArray(value) ? value : [value];
|
|
127
|
+
} else if (defaultValue) {
|
|
128
|
+
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return valueArr.find(item => {
|
|
132
|
+
return item.value === findValue || item.key === findValue;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
constructDataForValue(value) {
|
|
137
|
+
const {
|
|
138
|
+
treeNodeLabelProp
|
|
139
|
+
} = this.getProps();
|
|
140
|
+
return {
|
|
141
|
+
key: value,
|
|
142
|
+
[treeNodeLabelProp]: value
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
getDataForKeyNotInKeyEntities(value) {
|
|
147
|
+
const {
|
|
148
|
+
onChangeWithObject
|
|
149
|
+
} = this.getProps();
|
|
150
|
+
|
|
151
|
+
if (onChangeWithObject) {
|
|
152
|
+
return this.findDataForValue(value);
|
|
153
|
+
} else {
|
|
154
|
+
return this.constructDataForValue(value);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
118
158
|
getCopyFromState(items) {
|
|
119
159
|
const res = {};
|
|
120
160
|
(0, _treeUtil.normalizedArr)(items).forEach(key => {
|
|
@@ -241,12 +281,12 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
241
281
|
let keyList = [];
|
|
242
282
|
|
|
243
283
|
if (checkRelation === 'related') {
|
|
244
|
-
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
|
|
284
|
+
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly, true);
|
|
245
285
|
} else if (checkRelation === 'unRelated') {
|
|
246
286
|
keyList = key;
|
|
247
287
|
}
|
|
248
288
|
|
|
249
|
-
const nodes = keyList.map(
|
|
289
|
+
const nodes = keyList.map(key => keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
250
290
|
|
|
251
291
|
if (this.getProp('onChangeWithObject')) {
|
|
252
292
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
@@ -420,7 +460,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
420
460
|
disabledKeys,
|
|
421
461
|
realCheckedKeys
|
|
422
462
|
} = this.getStates();
|
|
423
|
-
const item = keyEntities[eventKey].data;
|
|
463
|
+
const item = keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
424
464
|
|
|
425
465
|
if (item.disabled || disableStrictly && disabledKeys.has(eventKey)) {
|
|
426
466
|
return;
|
|
@@ -843,7 +883,13 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
843
883
|
keyEntities
|
|
844
884
|
} = this.getStates();
|
|
845
885
|
const renderSelectedItem = (0, _isFunction2.default)(propRenderSelectedItem) ? propRenderSelectedItem : item => (0, _get2.default)(item, treeNodeLabelProp, null);
|
|
846
|
-
|
|
886
|
+
let item;
|
|
887
|
+
|
|
888
|
+
if (selectedKeys.length) {
|
|
889
|
+
const key = selectedKeys[0];
|
|
890
|
+
item = keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
891
|
+
}
|
|
892
|
+
|
|
847
893
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
848
894
|
return renderText;
|
|
849
895
|
}
|
package/lib/es/grid/grid.css
CHANGED
package/lib/es/grid/grid.scss
CHANGED
|
@@ -99,9 +99,10 @@ class TableFoundation extends BaseFoundation {
|
|
|
99
99
|
const {
|
|
100
100
|
defaultFilteredValue,
|
|
101
101
|
filteredValue,
|
|
102
|
-
|
|
102
|
+
onFilter
|
|
103
103
|
} = column;
|
|
104
|
-
|
|
104
|
+
|
|
105
|
+
const hasFilter = _isFunction(onFilter);
|
|
105
106
|
|
|
106
107
|
if (hasFilter && _isUndefined(filteredValue)) {
|
|
107
108
|
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
@@ -219,7 +220,7 @@ class TableFoundation extends BaseFoundation {
|
|
|
219
220
|
* When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
|
|
220
221
|
*/
|
|
221
222
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
222
|
-
return _isFunction(query.onFilter) && Array.isArray(
|
|
223
|
+
return _isFunction(query.onFilter) && Array.isArray(currentFilteredValue) && currentFilteredValue.length;
|
|
223
224
|
}));
|
|
224
225
|
const sortedDataSource = this.sortDataSource(filteredDataSource, queries.filter(query => query && _isFunction(query.sorter)));
|
|
225
226
|
return sortedDataSource;
|
package/lib/es/table/utils.js
CHANGED
|
@@ -498,11 +498,12 @@ export function warnIfNoDataIndex(column) {
|
|
|
498
498
|
const {
|
|
499
499
|
filters,
|
|
500
500
|
sorter,
|
|
501
|
-
dataIndex
|
|
501
|
+
dataIndex,
|
|
502
|
+
onFilter
|
|
502
503
|
} = column;
|
|
503
504
|
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
504
505
|
|
|
505
|
-
if ((Array.isArray(filters) || _isFunction(sorter)) && isNullOrUndefined(dataIndex)) {
|
|
506
|
+
if ((Array.isArray(filters) || _isFunction(onFilter) || _isFunction(sorter)) && isNullOrUndefined(dataIndex)) {
|
|
506
507
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
507
508
|
}
|
|
508
509
|
}
|
|
@@ -14,6 +14,7 @@ export interface TagInputAdapter extends DefaultAdapter {
|
|
|
14
14
|
toggleFocusing(focused: boolean): void;
|
|
15
15
|
setHovering: (hovering: boolean) => void;
|
|
16
16
|
setActive: (active: boolean) => void;
|
|
17
|
+
setEntering: (entering: boolean) => void;
|
|
17
18
|
getClickOutsideHandler: () => any;
|
|
18
19
|
registerClickOutsideHandler: (cb: any) => void;
|
|
19
20
|
unregisterClickOutsideHandler: () => void;
|
|
@@ -31,6 +32,8 @@ declare class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
31
32
|
* handler of input change
|
|
32
33
|
*/
|
|
33
34
|
handleInputChange: (e: TagInputChangeEvent) => void;
|
|
35
|
+
handleInputCompositionStart: (e: any) => void;
|
|
36
|
+
handleInputCompositionEnd: (e: any) => void;
|
|
34
37
|
/**
|
|
35
38
|
* check whether the input change is legal
|
|
36
39
|
*/
|
|
@@ -19,7 +19,66 @@ class TagInputFoundation extends BaseFoundation {
|
|
|
19
19
|
const {
|
|
20
20
|
value
|
|
21
21
|
} = e.target;
|
|
22
|
-
|
|
22
|
+
const {
|
|
23
|
+
entering
|
|
24
|
+
} = this.getStates();
|
|
25
|
+
|
|
26
|
+
if (entering) {
|
|
27
|
+
// 如果处于输入法输入中,则先不检查输入是否有效,直接更新到inputValue,
|
|
28
|
+
// 因为对于输入法输入中而言,此时更新到 inputValue 的不是最后的结果,比如对于中文,此时 inputValue 中的内容是拼音
|
|
29
|
+
// 当输入法输入结束后,将在 handleInputCompositionEnd 中判断输入是否有效,处理结果
|
|
30
|
+
// If it is composition session, it does not check whether the input is valid, and directly updates to inputValue,
|
|
31
|
+
// Because for composition input, what is updated to inputValue at this time is not the final result.
|
|
32
|
+
// For example, for Chinese, the content in inputValue is pinyin at this time
|
|
33
|
+
// When the composition input is finished, it will be judged whether the input is valid in handleInputCompositionEnd and the result will be processed
|
|
34
|
+
this._onInputChange(value, e);
|
|
35
|
+
} else {
|
|
36
|
+
this._checkInputChangeValid(value) && this._onInputChange(value, e);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
this.handleInputCompositionStart = e => {
|
|
41
|
+
this._adapter.setEntering(true);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
this.handleInputCompositionEnd = e => {
|
|
45
|
+
this._adapter.setEntering(false);
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
value
|
|
49
|
+
} = e.target;
|
|
50
|
+
const {
|
|
51
|
+
maxLength,
|
|
52
|
+
onInputExceed,
|
|
53
|
+
separator
|
|
54
|
+
} = this.getProps();
|
|
55
|
+
let allowChange = true;
|
|
56
|
+
const {
|
|
57
|
+
inputValue
|
|
58
|
+
} = this.getStates();
|
|
59
|
+
|
|
60
|
+
if (_isNumber(maxLength)) {
|
|
61
|
+
const inputArr = getSplitedArray(inputValue, separator);
|
|
62
|
+
let index = 0;
|
|
63
|
+
|
|
64
|
+
for (; index < inputArr.length; index++) {
|
|
65
|
+
if (inputArr[index].length > maxLength) {
|
|
66
|
+
allowChange = false;
|
|
67
|
+
_isFunction(onInputExceed) && onInputExceed(value);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!allowChange) {
|
|
73
|
+
const newInputArr = inputArr.slice(0, index);
|
|
74
|
+
|
|
75
|
+
if (index < inputArr.length) {
|
|
76
|
+
newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this._adapter.setInputValue(newInputArr.join(separator));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
23
82
|
};
|
|
24
83
|
/**
|
|
25
84
|
* check whether the input change is legal
|
|
@@ -54,7 +54,7 @@ export declare function calcMotionKeys(oldKeySet: Set<string>, newKeySet: Set<st
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function filter(sugInput: string, option: any, filterTreeNode: any, filterProps: any): any;
|
|
56
56
|
export declare function normalizedArr(val: any): any[];
|
|
57
|
-
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean): string[];
|
|
57
|
+
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean, flag?: boolean): string[];
|
|
58
58
|
export declare function getMotionKeys(eventKey: string, expandedKeys: Set<string>, keyEntities: KeyEntities): any[];
|
|
59
59
|
export declare function calcCheckedKeysForChecked(key: string, keyEntities: KeyEntities, checkedKeys: Set<string>, halfCheckedKeys: Set<string>): {
|
|
60
60
|
checkedKeys: Set<string>;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -186,6 +186,9 @@ export function findKeysForValues(valueList, valueEntities) {
|
|
|
186
186
|
valueList.forEach(val => {
|
|
187
187
|
if (val in valueEntities) {
|
|
188
188
|
res.push(valueEntities[val]);
|
|
189
|
+
} else {
|
|
190
|
+
// if val not in valueEntities, then value push to keys array
|
|
191
|
+
val && res.push(val);
|
|
189
192
|
}
|
|
190
193
|
});
|
|
191
194
|
return res;
|
|
@@ -455,15 +458,22 @@ export function normalizedArr(val) {
|
|
|
455
458
|
} else {
|
|
456
459
|
return val;
|
|
457
460
|
}
|
|
458
|
-
}
|
|
461
|
+
} // flag is used to determine whether to return when the key does not belong to the keys in keyEntities
|
|
462
|
+
// export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
|
|
463
|
+
|
|
459
464
|
export function normalizeKeyList(keyList, keyEntities) {
|
|
460
465
|
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
466
|
+
let flag = arguments.length > 3 ? arguments[3] : undefined;
|
|
461
467
|
const res = [];
|
|
462
468
|
const keyListSet = new Set(keyList);
|
|
463
469
|
|
|
464
470
|
if (!leafOnly) {
|
|
465
471
|
keyList.forEach(key => {
|
|
466
472
|
if (!keyEntities[key]) {
|
|
473
|
+
if (flag) {
|
|
474
|
+
res.push(key);
|
|
475
|
+
}
|
|
476
|
+
|
|
467
477
|
return;
|
|
468
478
|
}
|
|
469
479
|
|
|
@@ -481,6 +491,11 @@ export function normalizeKeyList(keyList, keyEntities) {
|
|
|
481
491
|
keyList.forEach(key => {
|
|
482
492
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
483
493
|
res.push(key);
|
|
494
|
+
} // when key is not in keyEntities, if flag is true, key should be push in res
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
if (!keyEntities[key] && flag) {
|
|
498
|
+
res.push(key);
|
|
484
499
|
}
|
|
485
500
|
});
|
|
486
501
|
}
|
|
@@ -597,7 +612,7 @@ export function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfC
|
|
|
597
612
|
}
|
|
598
613
|
};
|
|
599
614
|
|
|
600
|
-
calcCurrLevel(nodeItem);
|
|
615
|
+
nodeItem && calcCurrLevel(nodeItem);
|
|
601
616
|
return {
|
|
602
617
|
checkedKeys,
|
|
603
618
|
halfCheckedKeys
|
|
@@ -115,6 +115,12 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
115
115
|
_isSelectToClose(): boolean;
|
|
116
116
|
_isLoadControlled(): any;
|
|
117
117
|
_showFilteredOnly(): any;
|
|
118
|
+
findDataForValue(findValue: string): any;
|
|
119
|
+
constructDataForValue(value: string): {
|
|
120
|
+
[x: number]: string;
|
|
121
|
+
key: string;
|
|
122
|
+
};
|
|
123
|
+
getDataForKeyNotInKeyEntities(value: string): any;
|
|
118
124
|
getCopyFromState(items: string | string[]): BasicTreeInnerData;
|
|
119
125
|
getTreeNodeProps(key: string): BasicTreeNodeProps;
|
|
120
126
|
handleNodeLoad(loadedKeys: Set<string>, loadingKeys: Set<string>, data: BasicTreeNodeData, resolve: (value?: any) => void): {
|
|
@@ -94,6 +94,46 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
94
94
|
return Boolean(inputValue) && showFilteredOnly;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
findDataForValue(findValue) {
|
|
98
|
+
const {
|
|
99
|
+
value,
|
|
100
|
+
defaultValue
|
|
101
|
+
} = this.getProps();
|
|
102
|
+
let valueArr = [];
|
|
103
|
+
|
|
104
|
+
if (value) {
|
|
105
|
+
valueArr = Array.isArray(value) ? value : [value];
|
|
106
|
+
} else if (defaultValue) {
|
|
107
|
+
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return valueArr.find(item => {
|
|
111
|
+
return item.value === findValue || item.key === findValue;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
constructDataForValue(value) {
|
|
116
|
+
const {
|
|
117
|
+
treeNodeLabelProp
|
|
118
|
+
} = this.getProps();
|
|
119
|
+
return {
|
|
120
|
+
key: value,
|
|
121
|
+
[treeNodeLabelProp]: value
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getDataForKeyNotInKeyEntities(value) {
|
|
126
|
+
const {
|
|
127
|
+
onChangeWithObject
|
|
128
|
+
} = this.getProps();
|
|
129
|
+
|
|
130
|
+
if (onChangeWithObject) {
|
|
131
|
+
return this.findDataForValue(value);
|
|
132
|
+
} else {
|
|
133
|
+
return this.constructDataForValue(value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
97
137
|
getCopyFromState(items) {
|
|
98
138
|
const res = {};
|
|
99
139
|
normalizedArr(items).forEach(key => {
|
|
@@ -220,12 +260,12 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
220
260
|
let keyList = [];
|
|
221
261
|
|
|
222
262
|
if (checkRelation === 'related') {
|
|
223
|
-
keyList = normalizeKeyList(key, keyEntities, leafOnly);
|
|
263
|
+
keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
|
|
224
264
|
} else if (checkRelation === 'unRelated') {
|
|
225
265
|
keyList = key;
|
|
226
266
|
}
|
|
227
267
|
|
|
228
|
-
const nodes = keyList.map(
|
|
268
|
+
const nodes = keyList.map(key => keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
229
269
|
|
|
230
270
|
if (this.getProp('onChangeWithObject')) {
|
|
231
271
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
@@ -399,7 +439,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
399
439
|
disabledKeys,
|
|
400
440
|
realCheckedKeys
|
|
401
441
|
} = this.getStates();
|
|
402
|
-
const item = keyEntities[eventKey].data;
|
|
442
|
+
const item = keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
403
443
|
|
|
404
444
|
if (item.disabled || disableStrictly && disabledKeys.has(eventKey)) {
|
|
405
445
|
return;
|
|
@@ -822,7 +862,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
822
862
|
keyEntities
|
|
823
863
|
} = this.getStates();
|
|
824
864
|
const renderSelectedItem = _isFunction(propRenderSelectedItem) ? propRenderSelectedItem : item => _get(item, treeNodeLabelProp, null);
|
|
825
|
-
|
|
865
|
+
let item;
|
|
866
|
+
|
|
867
|
+
if (selectedKeys.length) {
|
|
868
|
+
const key = selectedKeys[0];
|
|
869
|
+
item = keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
870
|
+
}
|
|
871
|
+
|
|
826
872
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
827
873
|
return renderText;
|
|
828
874
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "7fed74a6b19a9bf9d45f56eb36c97fce0ac9de76",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/table/foundation.ts
CHANGED
|
@@ -130,8 +130,8 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
130
130
|
* init filteredValue of filtering column, use defaultFilteredValue or [] when it is undefined
|
|
131
131
|
*/
|
|
132
132
|
static initFilteredValue(column: BaseColumnProps<unknown>) {
|
|
133
|
-
const { defaultFilteredValue, filteredValue,
|
|
134
|
-
const hasFilter =
|
|
133
|
+
const { defaultFilteredValue, filteredValue, onFilter } = column;
|
|
134
|
+
const hasFilter = isFunction(onFilter);
|
|
135
135
|
if (hasFilter && isUndefined(filteredValue)) {
|
|
136
136
|
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
137
137
|
column.filteredValue = defaultFilteredValue;
|
|
@@ -253,8 +253,6 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
253
253
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
254
254
|
return (
|
|
255
255
|
isFunction(query.onFilter) &&
|
|
256
|
-
Array.isArray(query.filters) &&
|
|
257
|
-
query.filters.length &&
|
|
258
256
|
Array.isArray(currentFilteredValue) &&
|
|
259
257
|
currentFilteredValue.length
|
|
260
258
|
);
|
package/table/utils.ts
CHANGED
|
@@ -480,9 +480,9 @@ export interface GetAllDisabledRowKeysProps {
|
|
|
480
480
|
|
|
481
481
|
export function warnIfNoDataIndex(column: Record<string, any>) {
|
|
482
482
|
if (typeof column === 'object' && column !== null) {
|
|
483
|
-
const { filters, sorter, dataIndex } = column;
|
|
483
|
+
const { filters, sorter, dataIndex, onFilter } = column;
|
|
484
484
|
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
485
|
-
if ((Array.isArray(filters) || isFunction(sorter)) && isNullOrUndefined(dataIndex) ) {
|
|
485
|
+
if ((Array.isArray(filters) || isFunction(onFilter) || isFunction(sorter)) && isNullOrUndefined(dataIndex) ) {
|
|
486
486
|
logger.warn(`The column with sorter or filter must pass the 'dataIndex' prop`);
|
|
487
487
|
}
|
|
488
488
|
}
|
package/tagInput/foundation.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface TagInputAdapter extends DefaultAdapter {
|
|
|
27
27
|
toggleFocusing(focused: boolean): void;
|
|
28
28
|
setHovering: (hovering: boolean) => void;
|
|
29
29
|
setActive: (active: boolean) => void;
|
|
30
|
+
setEntering: (entering: boolean) => void;
|
|
30
31
|
getClickOutsideHandler: () => any;
|
|
31
32
|
registerClickOutsideHandler: (cb: any) => void;
|
|
32
33
|
unregisterClickOutsideHandler: () => void;
|
|
@@ -49,9 +50,55 @@ class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
49
50
|
*/
|
|
50
51
|
handleInputChange = (e: TagInputChangeEvent) => {
|
|
51
52
|
const { value } = e.target;
|
|
52
|
-
|
|
53
|
+
const { entering } = this.getStates();
|
|
54
|
+
if (entering) {
|
|
55
|
+
// 如果处于输入法输入中,则先不检查输入是否有效,直接更新到inputValue,
|
|
56
|
+
// 因为对于输入法输入中而言,此时更新到 inputValue 的不是最后的结果,比如对于中文,此时 inputValue 中的内容是拼音
|
|
57
|
+
// 当输入法输入结束后,将在 handleInputCompositionEnd 中判断输入是否有效,处理结果
|
|
58
|
+
// If it is composition session, it does not check whether the input is valid, and directly updates to inputValue,
|
|
59
|
+
// Because for composition input, what is updated to inputValue at this time is not the final result.
|
|
60
|
+
// For example, for Chinese, the content in inputValue is pinyin at this time
|
|
61
|
+
// When the composition input is finished, it will be judged whether the input is valid in handleInputCompositionEnd and the result will be processed
|
|
62
|
+
this._onInputChange(value, e);
|
|
63
|
+
} else {
|
|
64
|
+
this._checkInputChangeValid(value) && this._onInputChange(value, e);
|
|
65
|
+
}
|
|
53
66
|
};
|
|
54
67
|
|
|
68
|
+
handleInputCompositionStart = (e: any) => {
|
|
69
|
+
this._adapter.setEntering(true);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
handleInputCompositionEnd = (e: any) => {
|
|
73
|
+
this._adapter.setEntering(false);
|
|
74
|
+
const { value } = e.target;
|
|
75
|
+
const {
|
|
76
|
+
maxLength,
|
|
77
|
+
onInputExceed,
|
|
78
|
+
separator
|
|
79
|
+
} = this.getProps();
|
|
80
|
+
let allowChange = true;
|
|
81
|
+
const { inputValue } = this.getStates();
|
|
82
|
+
if (isNumber(maxLength)) {
|
|
83
|
+
const inputArr = getSplitedArray(inputValue, separator);
|
|
84
|
+
let index = 0;
|
|
85
|
+
for (; index < inputArr.length; index++) {
|
|
86
|
+
if (inputArr[index].length > maxLength) {
|
|
87
|
+
allowChange = false;
|
|
88
|
+
isFunction(onInputExceed) && onInputExceed(value);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (!allowChange) {
|
|
93
|
+
const newInputArr = inputArr.slice(0, index);
|
|
94
|
+
if (index < inputArr.length) {
|
|
95
|
+
newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
96
|
+
}
|
|
97
|
+
this._adapter.setInputValue(newInputArr.join(separator));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
55
102
|
/**
|
|
56
103
|
* check whether the input change is legal
|
|
57
104
|
*/
|
package/tree/treeUtil.ts
CHANGED
|
@@ -187,6 +187,9 @@ export function findKeysForValues(valueList: any, valueEntities: any, isMultiple
|
|
|
187
187
|
valueList.forEach((val: string) => {
|
|
188
188
|
if (val in valueEntities) {
|
|
189
189
|
res.push(valueEntities[val]);
|
|
190
|
+
} else {
|
|
191
|
+
// if val not in valueEntities, then value push to keys array
|
|
192
|
+
val && res.push(val);
|
|
190
193
|
}
|
|
191
194
|
});
|
|
192
195
|
|
|
@@ -427,12 +430,17 @@ export function normalizedArr(val: any) {
|
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
432
|
|
|
430
|
-
|
|
433
|
+
// flag is used to determine whether to return when the key does not belong to the keys in keyEntities
|
|
434
|
+
// export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
|
|
435
|
+
export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false, flag?: boolean) {
|
|
431
436
|
const res: string[] = [];
|
|
432
437
|
const keyListSet = new Set(keyList);
|
|
433
438
|
if (!leafOnly) {
|
|
434
439
|
keyList.forEach((key: string) => {
|
|
435
440
|
if (!keyEntities[key]) {
|
|
441
|
+
if (flag) {
|
|
442
|
+
res.push(key);
|
|
443
|
+
}
|
|
436
444
|
return;
|
|
437
445
|
}
|
|
438
446
|
const { parent } = keyEntities[key];
|
|
@@ -446,6 +454,10 @@ export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnl
|
|
|
446
454
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
447
455
|
res.push(key);
|
|
448
456
|
}
|
|
457
|
+
// when key is not in keyEntities, if flag is true, key should be push in res
|
|
458
|
+
if (!keyEntities[key] && flag) {
|
|
459
|
+
res.push(key);
|
|
460
|
+
}
|
|
449
461
|
});
|
|
450
462
|
}
|
|
451
463
|
return res;
|
|
@@ -546,7 +558,7 @@ export function calcCheckedKeysForUnchecked(key: string, keyEntities: KeyEntitie
|
|
|
546
558
|
calcCurrLevel(par);
|
|
547
559
|
}
|
|
548
560
|
};
|
|
549
|
-
calcCurrLevel(nodeItem);
|
|
561
|
+
nodeItem && calcCurrLevel(nodeItem);
|
|
550
562
|
return {
|
|
551
563
|
checkedKeys,
|
|
552
564
|
halfCheckedKeys,
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -262,6 +262,36 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
262
262
|
return Boolean(inputValue) && showFilteredOnly;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
findDataForValue(findValue: string) {
|
|
266
|
+
const { value, defaultValue } = this.getProps();
|
|
267
|
+
let valueArr = [];
|
|
268
|
+
if (value) {
|
|
269
|
+
valueArr = Array.isArray(value) ? value : [value];
|
|
270
|
+
} else if (defaultValue) {
|
|
271
|
+
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
272
|
+
}
|
|
273
|
+
return valueArr.find(item => {
|
|
274
|
+
return item.value === findValue || item.key === findValue;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
constructDataForValue(value: string) {
|
|
279
|
+
const { treeNodeLabelProp } = this.getProps();
|
|
280
|
+
return {
|
|
281
|
+
key: value,
|
|
282
|
+
[treeNodeLabelProp]: value
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
getDataForKeyNotInKeyEntities(value: string) {
|
|
287
|
+
const { onChangeWithObject } = this.getProps();
|
|
288
|
+
if (onChangeWithObject) {
|
|
289
|
+
return this.findDataForValue(value);
|
|
290
|
+
} else {
|
|
291
|
+
return this.constructDataForValue(value);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
265
295
|
getCopyFromState(items: string | string[]) {
|
|
266
296
|
const res = {};
|
|
267
297
|
normalizedArr(items).forEach(key => {
|
|
@@ -366,11 +396,11 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
366
396
|
const { leafOnly, checkRelation } = this.getProps();
|
|
367
397
|
let keyList = [];
|
|
368
398
|
if (checkRelation === 'related') {
|
|
369
|
-
keyList = normalizeKeyList(key, keyEntities, leafOnly);
|
|
399
|
+
keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
|
|
370
400
|
} else if (checkRelation === 'unRelated') {
|
|
371
401
|
keyList = key as string[];
|
|
372
402
|
}
|
|
373
|
-
const nodes = keyList.map(
|
|
403
|
+
const nodes = keyList.map(key => (keyEntities[key] && keyEntities[key].data.key === key) ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
374
404
|
if (this.getProp('onChangeWithObject')) {
|
|
375
405
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
376
406
|
} else {
|
|
@@ -498,7 +528,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
498
528
|
removeTag(eventKey: BasicTreeNodeData['key']) {
|
|
499
529
|
const { disableStrictly, checkRelation } = this.getProps();
|
|
500
530
|
const { keyEntities, disabledKeys, realCheckedKeys } = this.getStates();
|
|
501
|
-
const item = keyEntities[eventKey].data;
|
|
531
|
+
const item = (keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey) ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
502
532
|
if (item.disabled || (disableStrictly && disabledKeys.has(eventKey))) {
|
|
503
533
|
return;
|
|
504
534
|
}
|
|
@@ -789,9 +819,11 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
789
819
|
const renderSelectedItem = isFunction(propRenderSelectedItem) ?
|
|
790
820
|
propRenderSelectedItem :
|
|
791
821
|
(item: BasicTreeNodeData) => get(item, treeNodeLabelProp, null);
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
822
|
+
let item;
|
|
823
|
+
if (selectedKeys.length) {
|
|
824
|
+
const key = selectedKeys[0];
|
|
825
|
+
item = (keyEntities[key] && keyEntities[key].data.key === key) ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
826
|
+
}
|
|
795
827
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
796
828
|
return renderText;
|
|
797
829
|
}
|