antd-curd
Version:
基于 ant design 、 dva 的增删改查页面组件
57 lines (56 loc) • 1.85 kB
TypeScript
import React, { PureComponent } from 'react';
import { ListProps } from 'antd/lib/list';
import { PaginationConfig } from 'antd/lib/pagination';
declare type OmittedListProps<T> = Omit<ListProps<T>, 'dataSource' | 'renderItem'>;
export declare type Page = {
current: number;
pageSize: number;
};
export declare type RecordSelection = {
selectedRowKeys: number[];
onSelectChange: (selectedRowKeys: any[]) => void;
getCheckboxProps: (record: any) => any;
};
export declare type renderItemConfig = {
record: any;
actions: React.ReactNode[] | null;
recordSelection: RecordSelection;
checkable?: boolean;
};
export interface StandardListProps<T> extends OmittedListProps<T> {
data: {
list: T[];
pagination?: PaginationConfig;
};
onSelectRow?: (recordArray: any[]) => void;
checkable?: boolean;
selectedRows?: any[];
renderItem: (config: renderItemConfig) => React.ReactNode;
setActions?: (record: any) => React.ReactNode[] | null;
onChange?: (page: Page) => void;
}
interface StandardListState {
selectedRowKeys: (number | string)[];
}
declare class StandardList<T extends {
id: number | string;
}> extends PureComponent<StandardListProps<T>, StandardListState> {
static defaultProps: {
data: {
list: never[];
pagination: {};
};
loading: boolean;
rowKey: string;
};
state: {
selectedRowKeys: never[];
};
cleanSelectedKeys: () => void;
onCheckAllChange: () => void;
handleSelectChange: (selectedRowKeys: any) => void;
handlePageChange: (current: number, pageSize: number) => void;
handleShowSizeChange: (current: number, pageSize: number) => void;
render(): JSX.Element;
}
export default StandardList;