mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 08:59:40 +08:00
f488cb871b
* fix(antd/transfer): transfer performance optimization while dataSource is large * fix(antd/transfer): unified function format of transKeys util file * fix(antd/transfer): transKeys Map Structure Adjustment
17 lines
434 B
TypeScript
17 lines
434 B
TypeScript
export const groupKeysMap = (keys: string[]) => {
|
|
const map = new Map<string, number>();
|
|
keys.forEach((key, index) => {
|
|
map.set(key, index);
|
|
});
|
|
return map;
|
|
};
|
|
export const groupDisabledKeysMap = <RecordType extends any[]>(dataSource: RecordType) => {
|
|
const map = new Map<string, number>();
|
|
dataSource.forEach(({ disabled, key }, index) => {
|
|
if (disabled) {
|
|
map.set(key, index);
|
|
}
|
|
});
|
|
return map;
|
|
};
|