Add enum_is operator

Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7

Reviewed By: lblasa, antonk52

Differential Revision: D49230138

fbshipit-source-id: f20a1a053cc6370acec57e63df80691c64bffc90
This commit is contained in:
Andrey Goncharov
2023-09-14 04:48:12 -07:00
committed by Facebook GitHub Bot
parent 1618404d25
commit 61160a2d4b

View File

@@ -86,6 +86,13 @@ export const dataTablePowerSearchOperators = {
key: 'float_less_or_equal',
valueType: 'FLOAT',
}),
// { [enumValue]: enumLabel }
enum_is: (enumLabels: Record<string, string>) => ({
label: 'is',
key: 'enum_is',
valueType: 'ENUM',
enumLabels,
}),
} satisfies {
[key: string]: (...args: any[]) => OperatorConfig;
};
@@ -136,4 +143,6 @@ export const dataTablePowerSearchOperatorProcessorConfig = {
value < searchValue,
float_less_or_equal: (_operator, searchValue: number, value: number) =>
value <= searchValue,
enum_is: (_operator, searchValue: string, value: string) =>
searchValue === value,
} satisfies PowerSearchOperatorProcessorConfig;