chore: Fix circular dependency in tanstack-table.d.ts (#25411)
* chore: Fix circular dependency in tanstack-table.d.ts * fix: Re-export TextFilterOperator * Unable to export non-type values from @calcom/types * Refactor data-table types in a way that ensures type-safety as before * Add FilterPopover and further fixups * Fix further type errors missed earlier * More hidden type errors * Type error in useFilterValue
This commit is contained in:
1 parent
f3d0475840
commit
1ab4b9dfab
17 files changed
+140
-110
No files matched your search
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
import type { IconName } from "@calcom/ui/components/icon/icon-names";
|
||||
|
||||
export type FilterType = "ss" | "ms" | "t" | "n" | "dr";
|
||||
|
||||
export type TextFilterOperator = "equals" | "notEquals" | "contains" | "notContains" | "startsWith" | "endsWith" | "isEmpty" | "isNotEmpty";
|
||||
|
||||
export type TextFilterOptions = {
|
||||
allowedOperators?: TextFilterOperator[];
|
||||
placeholder?: string;
|
||||
};
|
||||
|
||||
export type DateRangeFilterOptions = {
|
||||
range?: "past" | "custom";
|
||||
convertToTimeZone?: boolean;
|
||||
};
|
||||
|
||||
export type ColumnFilterMeta =
|
||||
| {
|
||||
type: Extract<FilterType, "dr">;
|
||||
icon?: IconName;
|
||||
dateRangeOptions?: DateRangeFilterOptions;
|
||||
}
|
||||
| {
|
||||
type: Extract<FilterType, "t">;
|
||||
icon?: IconName;
|
||||
textOptions?: TextFilterOptions;
|
||||
}
|
||||
| {
|
||||
type?: Extract<FilterType, "ms" | "n" | "ss">;
|
||||
icon?: IconName;
|
||||
};
|
||||
|
||||
export type FilterableColumn = {
|
||||
id: string;
|
||||
title: string;
|
||||
icon?: IconName;
|
||||
} & (
|
||||
| {
|
||||
type: Extract<FilterType, "ss">;
|
||||
options: FacetedValue[];
|
||||
}
|
||||
| {
|
||||
type: Extract<FilterType, "ms">;
|
||||
options: FacetedValue[];
|
||||
}
|
||||
| {
|
||||
type: Extract<FilterType, "t">;
|
||||
textOptions?: TextFilterOptions;
|
||||
}
|
||||
| {
|
||||
type: Extract<FilterType, "n">;
|
||||
}
|
||||
| {
|
||||
type: Extract<FilterType, "dr">;
|
||||
dateRangeOptions?: DateRangeFilterOptions;
|
||||
}
|
||||
);
|
||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
||||
import "@tanstack/react-table";
|
||||
|
||||
import type { ColumnFilterMeta } from "@calcom/features/data-table/lib/types";
|
||||
import type { ColumnFilterMeta } from "./data-table";
|
||||
|
||||
declare module "@tanstack/table-core" {
|
||||
interface ColumnMeta<TData extends RowData, TValue> {
|
||||
interface ColumnMeta {
|
||||
filter?: ColumnFilterMeta;
|
||||
|
||||
// `autoWidth` can make the column size dynamic,
|
||||
|
||||
Reference in new issue
Block a user