copper-ui
Version:
Modern React UI components library with TypeScript support, built on top of Ant Design
78 lines • 2.2 kB
TypeScript
import { ColumnDef } from '@tanstack/react-table';
import { DatePickerProps, SelectProps } from 'antd';
import { CSSProperties, ReactNode } from 'react';
import { TTableCell } from './cell.types';
import { TTableFilterOption, TTableFilterType } from './filter.types';
import { TTableSortOrder } from './sort.types';
import { TTableItem } from './table.types';
export type TTableColumnSort = {
enabled: boolean;
default?: TTableSortOrder;
id?: string;
};
export type TTableColumnFilter = {
type: "multiselect" | "select";
options: TTableFilterOption[];
id?: string;
className?: string;
style?: CSSProperties;
styles?: SelectProps["styles"];
} | {
type: "date" | "date-range";
id?: string;
className?: string;
style?: CSSProperties;
styles?: DatePickerProps["styles"];
} | {
type: Exclude<TTableFilterType, "multiselect" | "select" | "custom" | "date" | "date-range">;
id?: string;
className?: string;
style?: CSSProperties;
styles?: CSSProperties;
} | {
type: "custom";
isMultiple?: false;
render: (value: {
value: string;
label: string;
}, onChange: (value: {
value: string;
label: string;
}) => void, children: ReactNode) => ReactNode;
id?: string;
className?: string;
style?: CSSProperties;
styles?: CSSProperties;
} | {
type: "custom";
isMultiple: true;
render: (value: {
value: string;
label: string;
}[], onChange: (value: {
value: string;
label: string;
}[]) => void, children: ReactNode) => ReactNode;
id?: string;
className?: string;
style?: CSSProperties;
styles?: CSSProperties;
};
export type TTableColumnMapping = {
value: string | number;
label: string | number;
};
export type TTableColumn<TItem extends TTableItem> = {
sort?: TTableColumnSort;
filter?: TTableColumnFilter;
dataType?: "string" | "number";
definition: ColumnDef<TItem> & {
id: string;
cell: TTableCell<TItem>;
headerTooltip?: {
content: string;
};
mapping?: TTableColumnMapping[];
};
};
//# sourceMappingURL=col.types.d.ts.map