New Changes with Table
This commit is contained in:
@@ -32,7 +32,7 @@ export { default as Table } from "../src/components/Table.astro";
|
|||||||
export { default as VideoPlayer } from "../src/components/VideoPlayer.astro";
|
export { default as VideoPlayer } from "../src/components/VideoPlayer.astro";
|
||||||
export { default as WebRtcPlayer } from "../src/components/WebRtcPlayer.astro";
|
export { default as WebRtcPlayer } from "../src/components/WebRtcPlayer.astro";
|
||||||
export { cn } from "../src/utils/cn.js";
|
export { cn } from "../src/utils/cn.js";
|
||||||
export { Column, TableProps, FetchTableRequest, FetchTableResponse } from "../src/types/table/types.js";
|
export { Column, TableProps, TableResponse, TableRequestBody, ClientFetchOptions, ClientFilter, ClientJoin } from "../src/types/table/types.js";
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const indexDts = `/* Auto-generated types (lightweight) */
|
const indexDts = `/* Auto-generated types (lightweight) */
|
||||||
@@ -63,7 +63,7 @@ export const Tooltip: any;
|
|||||||
export const VideoPlayer: any;
|
export const VideoPlayer: any;
|
||||||
export const WebRtcPlayer: any;
|
export const WebRtcPlayer: any;
|
||||||
export function cn(...classes: Array<string | number | false | null | undefined>): string;
|
export function cn(...classes: Array<string | number | false | null | undefined>): string;
|
||||||
export type { Column, TableProps, FetchTableRequest, FetchTableResponse } from "../src/types/table/types.js";
|
export type { Column, TableProps, TableResponse, TableRequestBody, ClientFetchOptions, ClientFilter, ClientJoin } from "../src/types/table/types.js";
|
||||||
`;
|
`;
|
||||||
|
|
||||||
fs.writeFileSync(path.join(distDir, "index.js"), indexJs, "utf8");
|
fs.writeFileSync(path.join(distDir, "index.js"), indexJs, "utf8");
|
||||||
|
|||||||
+1
-1
@@ -20,4 +20,4 @@ export { default as TimePicker } from "./components/TimePicker.astro";
|
|||||||
export { default as Table } from "./components/Table.astro";
|
export { default as Table } from "./components/Table.astro";
|
||||||
export { default as Tooltip } from "./components/Tooltip.astro";
|
export { default as Tooltip } from "./components/Tooltip.astro";
|
||||||
export { cn } from "./utils/cn.js";
|
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";
|
||||||
@@ -38,15 +38,56 @@ export interface TableProps<T> {
|
|||||||
rowClick?: string;
|
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;
|
page: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
sortKey: string;
|
sortKey?: string;
|
||||||
sortOrder: string;
|
sortOrder?: "ASC" | "DESC";
|
||||||
search: string;
|
search?: string;
|
||||||
}
|
filters?: ClientFilter[];
|
||||||
|
};
|
||||||
|
|
||||||
export interface FetchTableResponse<T> {
|
export type TableRequestBody = {
|
||||||
|
req: TableRequest;
|
||||||
|
opts: ClientFetchOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface TableResponse<T> {
|
||||||
data: T[];
|
data: T[];
|
||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user