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';
}

49
src/types/index.ts Normal file
View File

@@ -0,0 +1,49 @@
import { Icons } from '@/components/icons';
export interface PermissionCheck {
permission?: string;
plan?: string;
feature?: string;
role?: string;
requireOrg?: boolean;
}
export interface NavItem {
title: string;
url: string;
disabled?: boolean;
external?: boolean;
shortcut?: [string, string];
icon?: keyof typeof Icons;
label?: string;
description?: string;
isActive?: boolean;
items?: NavItem[];
access?: PermissionCheck;
}
export interface NavGroup {
label: string;
items: NavItem[];
}
export interface NavItemWithChildren extends NavItem {
items: NavItemWithChildren[];
}
export interface NavItemWithOptionalChildren extends NavItem {
items?: NavItemWithChildren[];
}
export interface FooterItem {
title: string;
items: {
title: string;
href: string;
external?: boolean;
}[];
}
export type MainNavItem = NavItemWithOptionalChildren;
export type SidebarNavItem = NavItemWithChildren;