[WEB-5804] refactor: decouple filter value types from filter configurations (#8441)
* [WEB-5804] refactor: decouple filter value types from filter configurations Remove value type constraints from filter configurations to support operator-specific value types. Different operators can accept different value types for the same filter property, so value types should be determined at the operator level rather than the filter level. - Remove generic value type parameter from TFilterConfig - Update TOperatorConfigMap to accept union of all value types - Simplify filter config factory signatures across all filter types - Add forceUpdate parameter to updateConditionValue method * refactor: remove filter value type constraints from filter configurations Eliminate the generic value type parameter from filter configurations to allow for operator-specific value types. This change enhances flexibility by enabling different operators to accept various value types for the same filter property. - Updated TFilterConfig and related interfaces to remove value type constraints - Adjusted filter configuration methods and types accordingly - Refactored date operator support to align with the new structure
This commit is contained in:
parent
5499e49b72
commit
f04be48f61
20 changed files with 126 additions and 133 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import { useCallback, useMemo } from "react";
|
||||
import { AtSign, Briefcase, Calendar } from "lucide-react";
|
||||
import { AtSign, Briefcase } from "lucide-react";
|
||||
// plane imports
|
||||
import { Logo } from "@plane/propel/emoji-icon-picker";
|
||||
import {
|
||||
CalendarLayoutIcon,
|
||||
CycleGroupIcon,
|
||||
CycleIcon,
|
||||
ModuleIcon,
|
||||
|
|
@ -21,7 +22,6 @@ import type {
|
|||
IState,
|
||||
IUserLite,
|
||||
TFilterConfig,
|
||||
TFilterValue,
|
||||
IIssueLabel,
|
||||
IModule,
|
||||
IProject,
|
||||
|
|
@ -74,9 +74,9 @@ export type TUseWorkItemFiltersConfigProps = {
|
|||
|
||||
export type TWorkItemFiltersConfig = {
|
||||
areAllConfigsInitialized: boolean;
|
||||
configs: TFilterConfig<TWorkItemFilterProperty, TFilterValue>[];
|
||||
configs: TFilterConfig<TWorkItemFilterProperty>[];
|
||||
configMap: {
|
||||
[key in TWorkItemFilterProperty]?: TFilterConfig<TWorkItemFilterProperty, TFilterValue>;
|
||||
[key in TWorkItemFilterProperty]?: TFilterConfig<TWorkItemFilterProperty>;
|
||||
};
|
||||
isFilterEnabled: (key: TWorkItemFilterProperty) => boolean;
|
||||
members: IUserLite[];
|
||||
|
|
@ -326,7 +326,7 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
|
|||
() =>
|
||||
getCreatedAtFilterConfig<TWorkItemFilterProperty>("created_at")({
|
||||
isEnabled: true,
|
||||
filterIcon: Calendar,
|
||||
filterIcon: CalendarLayoutIcon,
|
||||
...operatorConfigs,
|
||||
}),
|
||||
[operatorConfigs]
|
||||
|
|
@ -337,7 +337,7 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
|
|||
() =>
|
||||
getUpdatedAtFilterConfig<TWorkItemFilterProperty>("updated_at")({
|
||||
isEnabled: true,
|
||||
filterIcon: Calendar,
|
||||
filterIcon: CalendarLayoutIcon,
|
||||
...operatorConfigs,
|
||||
}),
|
||||
[operatorConfigs]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue