Files
calendar/packages/types/data-table.d.ts
T
Alex van AndelandGitHub 1ab4b9dfab 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
2025-11-26 14:05:55 -03:00

57 lines
1.3 KiB
TypeScript

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;
}
);