Use view filters operands in step filters + migrate to twenty-shared (#13137)

Step operand will more or less be the same as view filter operand. 

This PR:
- moves `ViewFilterOperand` to twenty-shared
- use it as step operand
- check what operand should be available based on the selected field
type in filter action
- rewrite the function that evaluates filters so it uses
ViewFilterOperand instead

ViewFilterOperand may be renamed in a future PR.
This commit is contained in:
Thomas Trompette
2025-07-10 10:36:37 +02:00
committed by GitHub
parent d808cbeed9
commit 50e402af07
55 changed files with 677 additions and 665 deletions

View File

@ -1,21 +1,10 @@
import { ViewFilterOperand } from './ViewFilterOperand';
export enum StepLogicalOperator {
AND = 'AND',
OR = 'OR',
}
export enum StepOperand {
EQ = 'eq',
NE = 'ne',
GT = 'gt',
GTE = 'gte',
LT = 'lt',
LTE = 'lte',
LIKE = 'like',
ILIKE = 'ilike',
IN = 'in',
IS = 'is',
}
export type StepFilterGroup = {
id: string;
logicalOperator: StepLogicalOperator;
@ -28,7 +17,7 @@ export type StepFilter = {
type: string;
label: string;
value: string;
operand: StepOperand;
operand: ViewFilterOperand;
displayValue: string;
stepFilterGroupId: string;
stepOutputKey: string;

View File

@ -0,0 +1,18 @@
export enum ViewFilterOperand {
Is = 'is',
IsNotNull = 'isNotNull',
IsNot = 'isNot',
LessThanOrEqual = 'lessThan', // TODO: we could change this to 'lessThanOrEqual' for consistency but it would require a migration
GreaterThanOrEqual = 'greaterThan', // TODO: we could change this to 'greaterThanOrEqual' for consistency but it would require a migration
IsBefore = 'isBefore',
IsAfter = 'isAfter',
Contains = 'contains',
DoesNotContain = 'doesNotContain',
IsEmpty = 'isEmpty',
IsNotEmpty = 'isNotEmpty',
IsRelative = 'isRelative',
IsInPast = 'isInPast',
IsInFuture = 'isInFuture',
IsToday = 'isToday',
VectorSearch = 'search',
}

View File

@ -14,4 +14,5 @@ export type { IsExactly } from './IsExactly';
export type { ObjectRecordsPermissions } from './ObjectRecordsPermissions';
export type { ObjectRecordsPermissionsByRoleId } from './ObjectRecordsPermissionsByRoleId';
export type { StepFilterGroup, StepFilter } from './StepFilters';
export { StepLogicalOperator, StepOperand } from './StepFilters';
export { StepLogicalOperator } from './StepFilters';
export { ViewFilterOperand } from './ViewFilterOperand';