This commit is contained in:
phaichayon
2026-04-16 14:06:59 +07:00
parent 1e8d6a9b19
commit 4702150af1
50 changed files with 3815 additions and 3 deletions

40
src/types/data-table.ts Normal file
View 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';
}