commit
This commit is contained in:
40
src/types/data-table.ts
Normal file
40
src/types/data-table.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import type { DataTableConfig } from '@/config/data-table';
|
||||
import type { FilterItemSchema } from '@/lib/parsers';
|
||||
import type { ColumnSort, Row, RowData } from '@tanstack/react-table';
|
||||
|
||||
declare module '@tanstack/react-table' {
|
||||
// biome-ignore lint/correctness/noUnusedVariables: Interface type parameters required by @tanstack/react-table
|
||||
interface ColumnMeta<TData extends RowData, TValue> {
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
variant?: FilterVariant;
|
||||
options?: Option[];
|
||||
range?: [number, number];
|
||||
unit?: string;
|
||||
icon?: React.FC<React.SVGProps<SVGSVGElement>>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Option {
|
||||
label: string;
|
||||
value: string;
|
||||
count?: number;
|
||||
icon?: React.FC<React.SVGProps<SVGSVGElement>>;
|
||||
}
|
||||
|
||||
export type FilterOperator = DataTableConfig['operators'][number];
|
||||
export type FilterVariant = DataTableConfig['filterVariants'][number];
|
||||
export type JoinOperator = DataTableConfig['joinOperators'][number];
|
||||
|
||||
export interface ExtendedColumnSort<TData> extends Omit<ColumnSort, 'id'> {
|
||||
id: Extract<keyof TData, string>;
|
||||
}
|
||||
|
||||
export interface ExtendedColumnFilter<TData> extends FilterItemSchema {
|
||||
id: Extract<keyof TData, string>;
|
||||
}
|
||||
|
||||
export interface DataTableRowAction<TData> {
|
||||
row: Row<TData>;
|
||||
variant: 'update' | 'delete';
|
||||
}
|
||||
Reference in New Issue
Block a user