chore: adjust parameter order (#41036)

This commit is contained in:
lijianan 2023-03-03 14:56:12 +08:00 committed by GitHub
parent 39c645bbb7
commit d7378a09ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 15 deletions

View File

@ -400,17 +400,20 @@ function InternalTable<RecordType extends object = any>(
]);
// ========================== Selections ==========================
const [transformSelectionColumns, selectedKeySet] = useSelection<RecordType>(rowSelection, {
prefixCls,
data: mergedData,
pageData,
getRowKey,
getRecordByKey,
expandType,
childrenColumnName,
locale: tableLocale,
getPopupContainer: getPopupContainer || getContextPopupContainer,
});
const [transformSelectionColumns, selectedKeySet] = useSelection<RecordType>(
{
prefixCls,
data: mergedData,
pageData,
getRowKey,
getRecordByKey,
expandType,
childrenColumnName,
locale: tableLocale,
getPopupContainer: getPopupContainer || getContextPopupContainer,
},
rowSelection,
);
const internalRowClassName = (record: RecordType, index: number, indent: number) => {
let mergedRowClassName: string;

View File

@ -68,10 +68,10 @@ function flattenData<RecordType>(childrenColumnName: string, data?: RecordType[]
return list;
}
export default function useSelection<RecordType>(
rowSelection: TableRowSelection<RecordType> | undefined,
function useSelection<RecordType>(
config: UseSelectionConfig<RecordType>,
): [TransformColumns<RecordType>, Set<Key>] {
rowSelection?: TableRowSelection<RecordType>,
): readonly [TransformColumns<RecordType>, Set<Key>] {
const {
preserveSelectedRowKeys,
selectedRowKeys,
@ -716,5 +716,7 @@ export default function useSelection<RecordType>(
],
);
return [transformColumns, derivedSelectedKeySet];
return [transformColumns, derivedSelectedKeySet] as const;
}
export default useSelection;