aaaff0705b
* refactor(data-table): clean up DateRangeFilter range options - Replace 'past' | 'custom' with 'past' | 'future' | 'any' | 'customOnly' - Add direction field to PresetOption for preset compatibility filtering - Derive presets visibility automatically based on compatible presets - Update bookings list to use new range values: - past -> 'past' - upcoming -> 'future' - unconfirmed/recurring/cancelled -> 'any' Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * feat(playground): add DateRangeFilter playground page with E2E tests - Add playground page at /settings/admin/playground/date-range-filter - Demonstrate all 4 range options: past, future, any, customOnly - Add link to playground index page - Add E2E tests for presets visibility and date restrictions Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix(playground): use correct meta.filter pattern for column filter config Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * clean up the playground esign * add unit tests instead of e2e * fix the implementation --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
58 lines
1.4 KiB
TypeScript
58 lines
1.4 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" | "future" | "any" | "customOnly";
|
|
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;
|
|
}
|
|
);
|