mirror of https://github.com/buster-so/buster.git
create mapped union type
This commit is contained in:
parent
8eb1b276fd
commit
fd377cbfa2
|
@ -14,16 +14,18 @@ export interface BusterListProps<T = any> {
|
|||
rowClassName?: string;
|
||||
}
|
||||
|
||||
export interface BusterListColumn<T = any> {
|
||||
dataIndex: keyof T;
|
||||
title: string;
|
||||
width?: number;
|
||||
minWidth?: number;
|
||||
align?: 'left' | 'center' | 'right'; //TODO
|
||||
render?: (value: T[keyof T], record: T) => React.JSX.Element | string | React.ReactNode;
|
||||
headerRender?: (title: string) => React.ReactNode;
|
||||
ellipsis?: boolean;
|
||||
}
|
||||
export type BusterListColumn<T> = {
|
||||
[K in keyof T]: {
|
||||
dataIndex: K;
|
||||
title: string;
|
||||
width?: number;
|
||||
minWidth?: number;
|
||||
align?: 'left' | 'center' | 'right';
|
||||
render?: (value: T[K], record: T) => React.JSX.Element | string | React.ReactNode;
|
||||
headerRender?: (title: string) => React.ReactNode;
|
||||
ellipsis?: boolean;
|
||||
};
|
||||
}[keyof T];
|
||||
|
||||
export type BusterListRow = BusterListRowItem;
|
||||
export interface BusterListRowItem {
|
||||
|
|
|
@ -60,7 +60,7 @@ export const ReportItemsContainer: React.FC<{
|
|||
{
|
||||
dataIndex: 'name',
|
||||
title: 'Name',
|
||||
render: (name, record) => <TitleCell name={record.name} chatId={record?.id} />
|
||||
render: (name, record) => <TitleCell name={name} chatId={record?.id} />
|
||||
},
|
||||
{
|
||||
dataIndex: 'last_edited',
|
||||
|
|
Loading…
Reference in New Issue