import { FilterTargetType, Operator } from "../../enum"; export const typeBasedOperators = [ { operators: [ { label: "Equal", value: Operator.Equal }, { label: "Not Equal", value: Operator.NotEqual }, { label: "Includes", value: Operator.Like }, { label: "Not Includes", value: Operator.NotLike }, // Value-less on purpose: the API's query generators map these to // "IS NULL" / "IS NOT NULL" and skip the value entirely, so the Value // cell is hidden for them (TypeBasedWidgetFactory) and neither validator // demands one. NOTE this is NULL, not "" — a text column holding an empty // string is not caught by Is Empty. { label: "Is Empty", value: Operator.IsNull }, { label: "Is Not Empty", value: Operator.IsNotNull }, ], type: FilterTargetType.TEXT, }, { operators: [ { label: "Equal", value: Operator.Equal }, { label: "Not Equal", value: Operator.NotEqual }, { label: "Is Greater Than", value: Operator.GreaterThan }, { label: "Is Greater Than Equal", value: Operator.GreaterThanOrEqual }, { label: "Is Less Than", value: Operator.LessThan }, { label: "Is Less Than Equal", value: Operator.LessThanOrEqual }, { label: "Between", value: Operator.Between }, { label: "Not Between", value: Operator.NotBetween }, // Value-less on purpose: the API's query generators map these to // "IS NULL" / "IS NOT NULL" and skip the value entirely, so the Value // cell is hidden for them (TypeBasedWidgetFactory) and neither validator // demands one. NOTE this is NULL, not "" — a text column holding an empty // string is not caught by Is Empty. { label: "Is Empty", value: Operator.IsNull }, { label: "Is Not Empty", value: Operator.IsNotNull }, ], type: FilterTargetType.NUMBER, }, { operators: [ { label: "Equal", value: Operator.Equal }, { label: "Not Equal", value: Operator.NotEqual }, { label: "Is Greater Than", value: Operator.GreaterThan }, { label: "Is Greater Than Equal", value: Operator.GreaterThanOrEqual }, { label: "Is Less Than", value: Operator.LessThan }, { label: "Is Less Than Equal", value: Operator.LessThanOrEqual }, { label: "Between", value: Operator.Between }, { label: "Not Between", value: Operator.NotBetween }, // Value-less on purpose: the API's query generators map these to // "IS NULL" / "IS NOT NULL" and skip the value entirely, so the Value // cell is hidden for them (TypeBasedWidgetFactory) and neither validator // demands one. NOTE this is NULL, not "" — a text column holding an empty // string is not caught by Is Empty. { label: "Is Empty", value: Operator.IsNull }, { label: "Is Not Empty", value: Operator.IsNotNull }, ], type: FilterTargetType.DATE, }, { operators: [ { label: "Equal", value: Operator.Equal }, { label: "Not Equal", value: Operator.NotEqual }, // Value-less on purpose: the API's query generators map these to // "IS NULL" / "IS NOT NULL" and skip the value entirely, so the Value // cell is hidden for them (TypeBasedWidgetFactory) and neither validator // demands one. NOTE this is NULL, not "" — a text column holding an empty // string is not caught by Is Empty. { label: "Is Empty", value: Operator.IsNull }, { label: "Is Not Empty", value: Operator.IsNotNull }, ], type: FilterTargetType.BOOLEAN, }, { operators: [ { label: "Equal", value: Operator.Equal }, { label: "Not Equal", value: Operator.NotEqual }, { label: "In The List", value: Operator.In }, { label: "Not In The List", value: Operator.NotIn }, // Value-less on purpose: the API's query generators map these to // "IS NULL" / "IS NOT NULL" and skip the value entirely, so the Value // cell is hidden for them (TypeBasedWidgetFactory) and neither validator // demands one. NOTE this is NULL, not "" — a text column holding an empty // string is not caught by Is Empty. { label: "Is Empty", value: Operator.IsNull }, { label: "Is Not Empty", value: Operator.IsNotNull }, ], type: FilterTargetType.LIST, }, ]; export const defaultCriteria = "(1)";