blob: 9fc9668725bb8a49c01c68e458d702b00a1a94f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
import type { ColumnSort, Row } from "@tanstack/react-table"
import { type SQL } from "drizzle-orm"
import { type z } from "zod"
import { type DataTableConfig } from "@/config/data-table"
import { type filterSchema } from "@/lib/parsers"
export type Prettify<T> = {
[K in keyof T]: T[K]
} & {}
export type StringKeyOf<TData> = Extract<keyof TData, string>
export interface SearchParams {
[key: string]: string | string[] | undefined
}
export interface Option {
label: string
value: string | number
icon?: React.ComponentType<{ className?: string }>
count?: number
}
export interface ExtendedColumnSort<TData> extends Omit<ColumnSort, "id"> {
id: StringKeyOf<TData>
}
export type ExtendedSortingState<TData> = ExtendedColumnSort<TData>[]
export type ColumnType = DataTableConfig["columnTypes"][number]
export type FilterOperator = DataTableConfig["globalOperators"][number]
export type JoinOperator = DataTableConfig["joinOperators"][number]["value"]
export interface DataTableFilterField<TData> {
id: StringKeyOf<TData>
label: string
placeholder?: string
options?: Option[]
}
export interface DataTableAdvancedFilterField<TData>
extends DataTableFilterField<TData> {
type: ColumnType
}
export type Filter<TData> = Prettify<
Omit<z.infer<typeof filterSchema>, "id"> & {
id: StringKeyOf<TData>
}
>
export interface DataTableRowAction<TData> {
row: Row<TData>
type:"add_stage"|"specification_meeting"|"clone"|"viewVariables"|"variableSettings"|"addSubClause"|"createRevision"|"duplicate"|"dispose"|"restore"|"download_report"|"submit" |"general_evaluation"| "general_evaluation"|"esg_evaluation" |"schedule"| "view"| "upload" | "addInfo"| "view-series"|"log"| "tbeResult" | "requestInfo"| "esign-detail"| "responseDetail"|"signature"|"update" | "delete" | "user" | "pemission" | "invite" | "items" | "attachment" |"comments" | "open" | "select" | "files" | "vendor-submission" | "resend"
}
export interface QueryBuilderOpts {
where?: SQL
orderBy?: SQL
distinct?: boolean
nullish?: boolean
}
declare module '@tanstack/react-table' {
interface ColumnMeta<TData extends RowData, TValue> {
// Custom column meta properties
excelHeader?: string
group?: string
type?: string
paddingFactor?: number
minWidth?: number
maxWidth?: number
}
}
|