mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
fix: Table selections type when use Table.SELECTION_ALL or Table.SELECTION_INVERT (#23462)
* fix:selections type when use SELECTION_ALL | SELECTION_INVERT * fix: Table selections type when use Table.SELECTION_ALL or Table.SELECTION_INVERT * fix: Table selections type when use Table.SELECTION_ALL or Table.SELECTION_INVERT * Update useSelection.tsx * Update type.test.tsx Co-authored-by: 二货机器人 <smith3816@gmail.com>
This commit is contained in:
parent
d77c2e8ba7
commit
937beba421
@ -24,6 +24,12 @@ describe('Table.typescript', () => {
|
||||
);
|
||||
expect(table).toBeTruthy();
|
||||
});
|
||||
it('selections', () => {
|
||||
const table = (
|
||||
<Table rowSelection={{ selections: [Table.SELECTION_ALL] }} />
|
||||
);
|
||||
expect(table).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Table.typescript types', () => {
|
||||
|
@ -21,8 +21,8 @@ import {
|
||||
const EMPTY_LIST: any[] = [];
|
||||
|
||||
// TODO: warning if use ajax!!!
|
||||
export const SELECTION_ALL = 'SELECT_ALL';
|
||||
export const SELECTION_INVERT = 'SELECT_INVERT';
|
||||
export const SELECTION_ALL = 'SELECT_ALL' as const;
|
||||
export const SELECTION_INVERT = 'SELECT_INVERT' as const;
|
||||
|
||||
function getFixedType<RecordType>(column: ColumnsType<RecordType>[number]): FixedType | undefined {
|
||||
return column && column.fixed;
|
||||
@ -41,7 +41,10 @@ interface UseSelectionConfig<RecordType> {
|
||||
getPopupContainer?: GetPopupContainer;
|
||||
}
|
||||
|
||||
type INTERNAL_SELECTION_ITEM = SelectionItem | typeof SELECTION_ALL | typeof SELECTION_INVERT;
|
||||
export type INTERNAL_SELECTION_ITEM =
|
||||
| SelectionItem
|
||||
| typeof SELECTION_ALL
|
||||
| typeof SELECTION_INVERT;
|
||||
|
||||
function flattenData<RecordType>(
|
||||
data: RecordType[] | undefined,
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
} from 'rc-table/lib/interface';
|
||||
import { CheckboxProps } from '../checkbox';
|
||||
import { PaginationConfig } from '../pagination';
|
||||
import { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
|
||||
|
||||
export { GetRowKey, ExpandableConfig };
|
||||
|
||||
@ -130,7 +131,7 @@ export interface TableRowSelection<T> {
|
||||
onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
||||
/** @deprecated This function is meaningless and should use `onChange` instead */
|
||||
onSelectInvert?: (selectedRowKeys: Key[]) => void;
|
||||
selections?: SelectionItem[] | boolean;
|
||||
selections?: INTERNAL_SELECTION_ITEM[] | boolean;
|
||||
hideDefaultSelections?: boolean;
|
||||
fixed?: boolean;
|
||||
columnWidth?: string | number;
|
||||
|
Loading…
Reference in New Issue
Block a user