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:
Alex van Andel authored and GitHub committed 2025-11-26 14:05:55 -03:00
1 parent f3d0475840
commit 1ab4b9dfab
17 files changed
+140 -110

No files matched your search

+57
View File
@@ -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;
}
);
+2 -2
View File
@@ -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,