New Changes with Table

This commit is contained in:
2025-11-11 16:42:00 +05:30
parent 783877b6d6
commit d5e9208de7
3 changed files with 51 additions and 10 deletions
+1 -1
View File
@@ -20,4 +20,4 @@ export { default as TimePicker } from "./components/TimePicker.astro";
export { default as Table } from "./components/Table.astro";
export { default as Tooltip } from "./components/Tooltip.astro";
export { cn } from "./utils/cn.js";
export type { Column, TableProps, FetchTableRequest, FetchTableResponse } from "./types/table/types.js";
export type { Column, TableProps, TableResponse, TableRequestBody, ClientFetchOptions, ClientFilter, ClientJoin } from "./types/table/types.js";
+48 -7
View File
@@ -38,15 +38,56 @@ export interface TableProps<T> {
rowClick?: string;
}
export type FetchTableRequest = {
export type ClientJoin = {
type?: "INNER" | "LEFT" | "RIGHT";
table: string;
alias?: string;
on: string;
selectCols?: string[];
};
export type ClientFilter = {
column: string;
operator:
| "=" | "!=" | ">" | "<" | ">=" | "<="
| "ILIKE" | "LIKE"
| "IN" | "ANY"
| "@>"
| "IS NULL" | "IS NOT NULL";
value?: unknown;
logical?: "AND" | "OR";
};
export type ClientFetchOptions = {
table: string;
alias?: string;
columns: string[];
joinSelectCols?: string[];
joins?: ClientJoin[];
sortable?: Record<string, string>;
searchColumns?: string[];
softDeleteCol?: string;
softDeleteOp?: "IS NULL" | "=" | "!=";
softDeleteValue?: unknown;
defaultFilters?: ClientFilter[];
};
export type TableRequest = {
page: number;
pageSize: number;
sortKey: string;
sortOrder: string;
search: string;
}
sortKey?: string;
sortOrder?: "ASC" | "DESC";
search?: string;
filters?: ClientFilter[];
};
export interface FetchTableResponse<T> {
export type TableRequestBody = {
req: TableRequest;
opts: ClientFetchOptions;
};
export interface TableResponse<T> {
data: T[];
total: number;
}
}