@douyinfe/semi-foundation 2.55.5 → 2.56.0-alpha.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/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +2 -2
- package/lib/cjs/treeSelect/foundation.js +6 -3
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/treeSelect/foundation.d.ts +2 -2
- package/lib/es/treeSelect/foundation.js +6 -3
- package/lib/es/upload/constants.d.ts +1 -1
- package/package.json +3 -3
- package/treeSelect/foundation.ts +8 -6
|
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
|
|
|
83
83
|
export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
|
|
84
84
|
export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
|
|
85
85
|
export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
|
|
86
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
86
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
|
|
87
87
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
88
88
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -69,7 +69,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
69
69
|
renderSelectedItem?: BasicRenderSelectedItem;
|
|
70
70
|
getPopupContainer?: () => HTMLElement;
|
|
71
71
|
onBlur?: (e: any) => void;
|
|
72
|
-
onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
|
|
72
|
+
onSearch?: (sunInput: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
73
73
|
onChange?: BasicOnChange;
|
|
74
74
|
onFocus?: (e: any) => void;
|
|
75
75
|
onVisibleChange?: (isVisible: boolean) => void;
|
|
@@ -90,7 +90,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
90
90
|
rePositionDropdown: () => void;
|
|
91
91
|
updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
|
|
92
92
|
notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
|
|
93
|
-
notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
|
|
93
|
+
notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
94
94
|
cacheFlattenNodes: (bool: boolean) => void;
|
|
95
95
|
openMenu: () => void;
|
|
96
96
|
closeMenu: (cb?: () => void) => void;
|
|
@@ -474,6 +474,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
474
474
|
} = this.getProps();
|
|
475
475
|
const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : (0, _get2.default)(keyMaps, 'label', 'label');
|
|
476
476
|
const newExpandedKeys = new Set(expandedKeys);
|
|
477
|
+
let filteredNodes = [];
|
|
477
478
|
let filteredOptsKeys = [];
|
|
478
479
|
let expandedOptsKeys = [];
|
|
479
480
|
let newFlattenNodes = [];
|
|
@@ -483,19 +484,21 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
483
484
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
484
485
|
newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, newExpandedKeys, keyMaps);
|
|
485
486
|
} else {
|
|
486
|
-
|
|
487
|
+
const filteredOpts = Object.values(keyEntities).filter(item => {
|
|
487
488
|
const {
|
|
488
489
|
data
|
|
489
490
|
} = item;
|
|
490
491
|
return (0, _treeUtil.filter)(sugInput, data, filterTreeNode, realFilterProp);
|
|
491
|
-
})
|
|
492
|
+
});
|
|
493
|
+
filteredNodes = filteredOpts.map(item => item.data);
|
|
494
|
+
filteredOptsKeys = filteredOpts.map(item => item.key);
|
|
492
495
|
expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(filteredOptsKeys, keyEntities, false);
|
|
493
496
|
const shownChildKeys = (0, _treeUtil.findDescendantKeys)(filteredOptsKeys, keyEntities, true);
|
|
494
497
|
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
495
498
|
newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
|
|
496
499
|
}
|
|
497
500
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
498
|
-
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
501
|
+
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys), filteredNodes);
|
|
499
502
|
this._adapter.updateState({
|
|
500
503
|
expandedKeys: newExpandedKeys,
|
|
501
504
|
flattenNodes: newFlattenNodes,
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("custom" | "auto")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
|
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
|
|
|
83
83
|
export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
|
|
84
84
|
export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
|
|
85
85
|
export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
|
|
86
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
86
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
|
|
87
87
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
88
88
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -69,7 +69,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
69
69
|
renderSelectedItem?: BasicRenderSelectedItem;
|
|
70
70
|
getPopupContainer?: () => HTMLElement;
|
|
71
71
|
onBlur?: (e: any) => void;
|
|
72
|
-
onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
|
|
72
|
+
onSearch?: (sunInput: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
73
73
|
onChange?: BasicOnChange;
|
|
74
74
|
onFocus?: (e: any) => void;
|
|
75
75
|
onVisibleChange?: (isVisible: boolean) => void;
|
|
@@ -90,7 +90,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
90
90
|
rePositionDropdown: () => void;
|
|
91
91
|
updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
|
|
92
92
|
notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
|
|
93
|
-
notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
|
|
93
|
+
notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
94
94
|
cacheFlattenNodes: (bool: boolean) => void;
|
|
95
95
|
openMenu: () => void;
|
|
96
96
|
closeMenu: (cb?: () => void) => void;
|
|
@@ -467,6 +467,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
467
467
|
} = this.getProps();
|
|
468
468
|
const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : _get(keyMaps, 'label', 'label');
|
|
469
469
|
const newExpandedKeys = new Set(expandedKeys);
|
|
470
|
+
let filteredNodes = [];
|
|
470
471
|
let filteredOptsKeys = [];
|
|
471
472
|
let expandedOptsKeys = [];
|
|
472
473
|
let newFlattenNodes = [];
|
|
@@ -476,19 +477,21 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
476
477
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
477
478
|
newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
478
479
|
} else {
|
|
479
|
-
|
|
480
|
+
const filteredOpts = Object.values(keyEntities).filter(item => {
|
|
480
481
|
const {
|
|
481
482
|
data
|
|
482
483
|
} = item;
|
|
483
484
|
return filter(sugInput, data, filterTreeNode, realFilterProp);
|
|
484
|
-
})
|
|
485
|
+
});
|
|
486
|
+
filteredNodes = filteredOpts.map(item => item.data);
|
|
487
|
+
filteredOptsKeys = filteredOpts.map(item => item.key);
|
|
485
488
|
expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
486
489
|
const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
|
|
487
490
|
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
488
491
|
newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
|
|
489
492
|
}
|
|
490
493
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
491
|
-
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
494
|
+
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys), filteredNodes);
|
|
492
495
|
this._adapter.updateState({
|
|
493
496
|
expandedKeys: newExpandedKeys,
|
|
494
497
|
flattenNodes: newFlattenNodes,
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("custom" | "auto")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.56.0-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@douyinfe/semi-animation": "2.
|
|
10
|
+
"@douyinfe/semi-animation": "2.56.0-alpha.0",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
13
|
"date-fns": "^2.29.3",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "c66a7f2315110d6af211d6edb6163c71a4d8aaa8",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
30
30
|
"@babel/preset-env": "^7.15.8",
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -139,7 +139,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps,
|
|
|
139
139
|
getPopupContainer?: () => HTMLElement;
|
|
140
140
|
// triggerRender?: (props: BasicTriggerRenderProps) => any;
|
|
141
141
|
onBlur?: (e: any) => void;
|
|
142
|
-
onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
|
|
142
|
+
onSearch?: (sunInput: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
143
143
|
onChange?: BasicOnChange;
|
|
144
144
|
onFocus?: (e: any) => void;
|
|
145
145
|
onVisibleChange?: (isVisible: boolean) => void;
|
|
@@ -183,7 +183,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
183
183
|
rePositionDropdown: () => void;
|
|
184
184
|
updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
|
|
185
185
|
notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
|
|
186
|
-
notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
|
|
186
|
+
notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
|
|
187
187
|
cacheFlattenNodes: (bool: boolean) => void;
|
|
188
188
|
openMenu: () => void;
|
|
189
189
|
closeMenu: (cb?: () => void) => void;
|
|
@@ -610,6 +610,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
610
610
|
const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps } = this.getProps();
|
|
611
611
|
const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : get(keyMaps, 'label', 'label');
|
|
612
612
|
const newExpandedKeys: Set<string> = new Set(expandedKeys);
|
|
613
|
+
let filteredNodes: BasicTreeNodeData[] = [];
|
|
613
614
|
let filteredOptsKeys: string[] = [];
|
|
614
615
|
let expandedOptsKeys = [];
|
|
615
616
|
let newFlattenNodes = [];
|
|
@@ -619,19 +620,20 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
619
620
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
620
621
|
newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
621
622
|
} else {
|
|
622
|
-
|
|
623
|
+
const filteredOpts = Object.values(keyEntities)
|
|
623
624
|
.filter((item: BasicKeyEntity) => {
|
|
624
625
|
const { data } = item;
|
|
625
626
|
return filter(sugInput, data, filterTreeNode, realFilterProp);
|
|
626
|
-
})
|
|
627
|
-
|
|
627
|
+
});
|
|
628
|
+
filteredNodes = filteredOpts.map((item: BasicKeyEntity) => item.data);
|
|
629
|
+
filteredOptsKeys = filteredOpts.map((item: BasicKeyEntity) => item.key);
|
|
628
630
|
expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
629
631
|
const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
|
|
630
632
|
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
631
633
|
newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
|
|
632
634
|
}
|
|
633
635
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
634
|
-
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
636
|
+
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys), filteredNodes);
|
|
635
637
|
this._adapter.updateState({
|
|
636
638
|
expandedKeys: newExpandedKeys,
|
|
637
639
|
flattenNodes: newFlattenNodes,
|