From bb8390dd8554fe13b201d950030ff1d8742aedf8 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 22 Aug 2024 15:48:41 +0200 Subject: [PATCH] JNG-3980 filter empty values (#449) --- .../components/table/EagerTable.tsx.snapshot | 8 +- .../components/table/LazyTable.tsx.snapshot | 8 +- .../actor/public/i18n/system_default.json.hbs | 22 +-- .../actor/public/i18n/system_en-US.json.hbs | 22 +-- .../actor/public/i18n/system_hu-HU.json.hbs | 2 + .../components/dialog/FilterDialog.tsx.hbs | 70 +------- .../src/components/table/EagerTable.tsx.hbs | 8 +- .../src/components/table/LazyTable.tsx.hbs | 8 +- .../table/table-column-operators.tsx.hbs | 18 +-- .../actor/src/utilities/filter-helper.ts.hbs | 149 +++++++++++++++++- pom.xml | 2 +- 11 files changed, 198 insertions(+), 119 deletions(-) diff --git a/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/EagerTable.tsx.snapshot b/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/EagerTable.tsx.snapshot index f944e515..abc54e6b 100644 --- a/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/EagerTable.tsx.snapshot +++ b/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/EagerTable.tsx.snapshot @@ -235,12 +235,10 @@ export function EagerTable i.value !== undefined)) { - const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); + const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); - if (Array.isArray(newFilters)) { - handleFiltersChange(newFilters); - } + if (Array.isArray(newFilters)) { + handleFiltersChange(newFilters); } } diff --git a/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/LazyTable.tsx.snapshot b/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/LazyTable.tsx.snapshot index 4364a9bf..17d9ff8b 100644 --- a/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/LazyTable.tsx.snapshot +++ b/judo-ui-react-itest/ActionGroupTestPro/action_group_test_pro__god/src/test/resources/snapshots/frontend-react/src/components/table/LazyTable.tsx.snapshot @@ -299,12 +299,10 @@ export function LazyTable i.value !== undefined)) { - const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); + const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); - if (Array.isArray(newFilters)) { - handleFiltersChange(newFilters); - } + if (Array.isArray(newFilters)) { + handleFiltersChange(newFilters); } } diff --git a/judo-ui-react/src/main/resources/actor/public/i18n/system_default.json.hbs b/judo-ui-react/src/main/resources/actor/public/i18n/system_default.json.hbs index e00942c8..d801e6df 100644 --- a/judo-ui-react/src/main/resources/actor/public/i18n/system_default.json.hbs +++ b/judo-ui-react/src/main/resources/actor/public/i18n/system_default.json.hbs @@ -113,16 +113,18 @@ "judo.component.Table.ContextMenu.excludeBy": "Exclude based on the selected value", "judo.applications.available_applications": "Available applications", "judo.applications.change": "Switch Application", - "judo.modal.filter.lessThan": "lessThan", - "judo.modal.filter.greaterThan": "greaterThan", - "judo.modal.filter.lessOrEqual": "lessOrEqual", - "judo.modal.filter.greaterOrEqual": "greaterOrEqual", - "judo.modal.filter.equal": "equal", - "judo.modal.filter.notEqual": "notEqual", - "judo.modal.filter.matches": "matches", - "judo.modal.filter.like": "like", - "judo.modal.filter.equals": "equals", - "judo.modal.filter.notEquals": "notEquals", + "judo.modal.filter.lessThan": "Less than", + "judo.modal.filter.greaterThan": "Greater than", + "judo.modal.filter.lessOrEqual": "Less or equal", + "judo.modal.filter.greaterOrEqual": "Greater or equal", + "judo.modal.filter.equal": "Equal", + "judo.modal.filter.notEqual": "Not equal", + "judo.modal.filter.matches": "Matches", + "judo.modal.filter.like": "Like", + "judo.modal.filter.equals": "Equals", + "judo.modal.filter.notEquals": "Not equals", + "judo.modal.filter.isDefined": "Is defined", + "judo.modal.filter.isUndefined": "Is undefined", "judo.error.error": "Error", "judo.error.unhandled": "An unhandled error occurred.", "judo.error.unmappable": "An error occurred, but we could not display the error info.", diff --git a/judo-ui-react/src/main/resources/actor/public/i18n/system_en-US.json.hbs b/judo-ui-react/src/main/resources/actor/public/i18n/system_en-US.json.hbs index e00942c8..d801e6df 100644 --- a/judo-ui-react/src/main/resources/actor/public/i18n/system_en-US.json.hbs +++ b/judo-ui-react/src/main/resources/actor/public/i18n/system_en-US.json.hbs @@ -113,16 +113,18 @@ "judo.component.Table.ContextMenu.excludeBy": "Exclude based on the selected value", "judo.applications.available_applications": "Available applications", "judo.applications.change": "Switch Application", - "judo.modal.filter.lessThan": "lessThan", - "judo.modal.filter.greaterThan": "greaterThan", - "judo.modal.filter.lessOrEqual": "lessOrEqual", - "judo.modal.filter.greaterOrEqual": "greaterOrEqual", - "judo.modal.filter.equal": "equal", - "judo.modal.filter.notEqual": "notEqual", - "judo.modal.filter.matches": "matches", - "judo.modal.filter.like": "like", - "judo.modal.filter.equals": "equals", - "judo.modal.filter.notEquals": "notEquals", + "judo.modal.filter.lessThan": "Less than", + "judo.modal.filter.greaterThan": "Greater than", + "judo.modal.filter.lessOrEqual": "Less or equal", + "judo.modal.filter.greaterOrEqual": "Greater or equal", + "judo.modal.filter.equal": "Equal", + "judo.modal.filter.notEqual": "Not equal", + "judo.modal.filter.matches": "Matches", + "judo.modal.filter.like": "Like", + "judo.modal.filter.equals": "Equals", + "judo.modal.filter.notEquals": "Not equals", + "judo.modal.filter.isDefined": "Is defined", + "judo.modal.filter.isUndefined": "Is undefined", "judo.error.error": "Error", "judo.error.unhandled": "An unhandled error occurred.", "judo.error.unmappable": "An error occurred, but we could not display the error info.", diff --git a/judo-ui-react/src/main/resources/actor/public/i18n/system_hu-HU.json.hbs b/judo-ui-react/src/main/resources/actor/public/i18n/system_hu-HU.json.hbs index 3e50a496..d5e0debd 100644 --- a/judo-ui-react/src/main/resources/actor/public/i18n/system_hu-HU.json.hbs +++ b/judo-ui-react/src/main/resources/actor/public/i18n/system_hu-HU.json.hbs @@ -84,6 +84,8 @@ "judo.modal.filter.like": "Tartalmazza", "judo.modal.filter.equals": "Egyenlő", "judo.modal.filter.notEquals": "Nem egyenlő", + "judo.modal.filter.isDefined": "Létezik", + "judo.modal.filter.isUndefined": "Nem létezik", "judo.modal.confirm.confirm": "Igen", "judo.modal.confirm.cancel": "Nem", "judo.modal.confirm.confirm-title": "Megerősítés szükséges", diff --git a/judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs index ab2b4193..51f5421a 100644 --- a/judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/components/dialog/FilterDialog.tsx.hbs @@ -30,76 +30,12 @@ import type { Operation, } from '../../components-api'; import { FilterType } from '../../components-api'; -import { exists } from '../../utilities'; +import { exists, getOperationEnumValue, getOperatorsByFilter, getDefaultOperator, isFilterWithoutValue } from '../../utilities'; import { mainContainerPadding } from '../../theme'; -import { _BooleanOperation, _EnumerationOperation, _NumericOperation, _StringOperation } from '~/services/data-api/common/operations'; import { DropdownButton } from '../DropdownButton'; import { TrinaryLogicCombobox } from '../widgets/TrinaryLogicCombobox'; import { MdiIcon } from '../MdiIcon'; -const getDefaultOperator = (filterType: FilterType) => { - switch (filterType) { - case FilterType.boolean: - return _BooleanOperation['equals']; - case FilterType.date: - return _NumericOperation['equal']; - case FilterType.dateTime: - return _NumericOperation['equal']; - // case FilterType.time: - // return _NumericOperation['equal']; - case FilterType.enumeration: - return _EnumerationOperation['equals']; - case FilterType.numeric: - return _NumericOperation['equal']; - case FilterType.string: - return _StringOperation['like']; - case FilterType.trinaryLogic: - return _BooleanOperation['equals']; - } -}; - -const getOperationEnumValue = (filter: Filter, operator: string) => { - switch (filter.filterOption.filterType) { - case FilterType.boolean: - return _BooleanOperation[operator as keyof typeof _BooleanOperation]; - case FilterType.date: - return _NumericOperation[operator as keyof typeof _NumericOperation]; - case FilterType.dateTime: - return _NumericOperation[operator as keyof typeof _NumericOperation]; - // case FilterType.time: - // return _NumericOperation[operator as keyof typeof _NumericOperation]; - case FilterType.enumeration: - return _EnumerationOperation[operator as keyof typeof _BooleanOperation]; - case FilterType.numeric: - return _NumericOperation[operator as keyof typeof _NumericOperation]; - case FilterType.string: - return _StringOperation[operator as keyof typeof _StringOperation]; - case FilterType.trinaryLogic: - return _BooleanOperation[operator as keyof typeof _BooleanOperation]; - } -}; - -const getOperatorsByFilter = (filter: Filter): string[] => { - switch (filter.filterOption.filterType) { - case FilterType.boolean: - return Object.values(_BooleanOperation); - case FilterType.date: - return Object.values(_NumericOperation); - case FilterType.dateTime: - return Object.values(_NumericOperation); - // case FilterType.time: - // return Object.values(_NumericOperation); - case FilterType.enumeration: - return Object.values(_EnumerationOperation); - case FilterType.numeric: - return Object.values(_NumericOperation); - case FilterType.string: - return Object.values(_StringOperation); - case FilterType.trinaryLogic: - return Object.values(_BooleanOperation); - } -}; - const FilterOperator = ({ filter, operatorId, valueId, setFilterOperator }: FilterOperatorProps) => { const { t } = useTranslation(); @@ -126,8 +62,6 @@ const FilterOperator = ({ filter, operatorId, valueId, setFilterOperator }: Filt }; const FilterInput = ({ filter, setFilterValue, valueId }: FilterInputProps) => { - const { t } = useTranslation(); - if (filter.filterOption.filterType === FilterType.enumeration && !exists(filter.filterOption.enumValues)) { throw new Error(`Missing enumValues from FilterOptions of "${filter.filterOption.attributeName}"`); } @@ -280,7 +214,7 @@ const FilterRow = ({ id, filter, closeHandler, setFilterOperator, setFilterValue {filter && } - {filter && } + {filter && !isFilterWithoutValue(filter) && } closeHandler(filter)}> diff --git a/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs index e6c9a04f..bd0e393a 100644 --- a/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs @@ -254,12 +254,10 @@ export function EagerTable i.value !== undefined)) { - const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); + const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); - if (Array.isArray(newFilters)) { - handleFiltersChange(newFilters); - } + if (Array.isArray(newFilters)) { + handleFiltersChange(newFilters); } } {{/ if }} diff --git a/judo-ui-react/src/main/resources/actor/src/components/table/LazyTable.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/table/LazyTable.tsx.hbs index b7de7685..f3f68986 100644 --- a/judo-ui-react/src/main/resources/actor/src/components/table/LazyTable.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/components/table/LazyTable.tsx.hbs @@ -301,12 +301,10 @@ export function LazyTable i.value !== undefined)) { - const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); + const newFilters: Filter[] = mapFilterModelToFilters(newModel, filterOptions); - if (Array.isArray(newFilters)) { - handleFiltersChange(newFilters); - } + if (Array.isArray(newFilters)) { + handleFiltersChange(newFilters); } } {{/ if }} diff --git a/judo-ui-react/src/main/resources/actor/src/components/table/table-column-operators.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/table/table-column-operators.tsx.hbs index 91d05086..60665461 100644 --- a/judo-ui-react/src/main/resources/actor/src/components/table/table-column-operators.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/components/table/table-column-operators.tsx.hbs @@ -10,28 +10,28 @@ import { import type { GridFilterOperator } from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}'; function filterStringColumnOperators(operator: GridFilterOperator): boolean { - // https://github.com/mui/mui-x/blob/master/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts + // https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/colDef/gridStringOperators.ts // startsWith and endsWith is filtered out because they'd need complex value mapping... - return !(['startsWith', 'endsWith', 'isEmpty', 'isNotEmpty', 'isAnyOf'].includes(operator.value)); + return !(['startsWith', 'endsWith', 'isAnyOf'].includes(operator.value)); } function filterNumericColumnOperators(operator: GridFilterOperator): boolean { - // https://github.com/mui/mui-x/blob/master/packages/grid/x-data-grid/src/colDef/gridNumericOperators.ts - return !(['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(operator.value)); + // https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/colDef/gridNumericOperators.ts + return !(['isAnyOf'].includes(operator.value)); } function filterDateColumnOperators(operator: GridFilterOperator): boolean { - // https://github.com/mui/mui-x/blob/master/packages/grid/x-data-grid/src/colDef/gridDateOperators.ts - return !(['isEmpty', 'isNotEmpty'].includes(operator.value)); + // https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/colDef/gridDateOperators.ts + return true; } function filterDateTimeColumnOperators(operator: GridFilterOperator): boolean { - // https://github.com/mui/mui-x/blob/master/packages/grid/x-data-grid/src/colDef/gridDateOperators.ts - return !['isEmpty', 'isNotEmpty'].includes(operator.value); + // https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/colDef/gridDateOperators.ts + return true; } function filterBooleanColumnOperators(operator: GridFilterOperator): boolean { - // https://github.com/mui/mui-x/blob/master/packages/grid/x-data-grid/src/colDef/gridBooleanOperators.ts + // https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/colDef/gridBooleanColDef.tsx return true; } diff --git a/judo-ui-react/src/main/resources/actor/src/utilities/filter-helper.ts.hbs b/judo-ui-react/src/main/resources/actor/src/utilities/filter-helper.ts.hbs index 2588a2f4..a70b9af5 100644 --- a/judo-ui-react/src/main/resources/actor/src/utilities/filter-helper.ts.hbs +++ b/judo-ui-react/src/main/resources/actor/src/utilities/filter-helper.ts.hbs @@ -13,12 +13,113 @@ type FilterBy = { operator: Operation; }; +export const getOperationEnumValue = (filter: Filter, operator: string) => { + switch (filter.filterOption.filterType) { + case FilterType.boolean: + return _BooleanOperation[operator as keyof typeof _BooleanOperation]; + case FilterType.date: + return _NumericOperation[operator as keyof typeof _NumericOperation]; + case FilterType.dateTime: + return _NumericOperation[operator as keyof typeof _NumericOperation]; + // case FilterType.time: + // return _NumericOperation[operator as keyof typeof _NumericOperation]; + case FilterType.enumeration: + return _EnumerationOperation[operator as keyof typeof _BooleanOperation]; + case FilterType.numeric: + return _NumericOperation[operator as keyof typeof _NumericOperation]; + case FilterType.string: + return _StringOperation[operator as keyof typeof _StringOperation]; + case FilterType.trinaryLogic: + return _BooleanOperation[operator as keyof typeof _BooleanOperation]; + } +}; + +export const getDefaultOperator = (filterType: FilterType) => { + switch (filterType) { + case FilterType.boolean: + return _BooleanOperation['equals']; + case FilterType.date: + return _NumericOperation['equal']; + case FilterType.dateTime: + return _NumericOperation['equal']; + // case FilterType.time: + // return _NumericOperation['equal']; + case FilterType.enumeration: + return _EnumerationOperation['equals']; + case FilterType.numeric: + return _NumericOperation['equal']; + case FilterType.string: + return _StringOperation['like']; + case FilterType.trinaryLogic: + return _BooleanOperation['equals']; + } +}; + +export const getEqualityOperator = (filter: Filter): 'equal' | 'equals' => { + switch (filter.filterOption.filterType) { + case FilterType.boolean: + return 'equals'; + case FilterType.date: + return 'equal'; + case FilterType.dateTime: + return 'equal'; + // case FilterType.time: + // return 'equal'; + case FilterType.enumeration: + return 'equals'; + case FilterType.numeric: + return 'equal'; + case FilterType.string: + return 'equal'; + case FilterType.trinaryLogic: + return 'equals'; + } +}; + +export const getOperatorsByFilter = (filter: Filter): string[] => { + switch (filter.filterOption.filterType) { + case FilterType.boolean: + return Object.values(_BooleanOperation); + case FilterType.date: + return Object.values(_NumericOperation); + case FilterType.dateTime: + return Object.values(_NumericOperation); + // case FilterType.time: + // return Object.values(_NumericOperation); + case FilterType.enumeration: + return Object.values(_EnumerationOperation); + case FilterType.numeric: + return Object.values(_NumericOperation); + case FilterType.string: + return Object.values(_StringOperation); + case FilterType.trinaryLogic: + return Object.values(_BooleanOperation); + } +}; + +export const isFilterWithoutValue = (filter: Filter) => { + return ['isDefined', 'isUndefined'].includes(getOperationEnumValue(filter, filter.filterBy.operator)) +}; + +export const ucFirst = (str: string): string => { + if (!str) return str; + return str.charAt(0).toUpperCase() + str.slice(1); +} + export const mapFiltersToQueryCustomizerProperty = (filters: Filter[], property: string): FilterBy[] | undefined => { if (!filters.some((filter) => filter.filterOption.attributeName === property)) return undefined; return filters - .filter((filter) => filter.filterOption.attributeName === property && filter.filterBy.value !== undefined && filter.filterBy.value !== null) + .filter((filter) => filter.filterOption.attributeName === property && (isFilterWithoutValue(filter) || (filter.filterBy.value !== undefined && filter.filterBy.value !== null))) .map((filter) => { + if (isFilterWithoutValue(filter)) { + const equals = getEqualityOperator(filter); + const notEquals = 'not' + ucFirst(equals); + return { + value: null, + operator: (filter.filterBy.operator === 'isDefined' ? notEquals : equals) as Operation, + }; + } return { value: filter.filterBy.value, operator: filter.filterBy.operator, @@ -91,6 +192,10 @@ export function filterByStringOperation(filter: Filter, data: T[]): T[] { return data.filter((d) => (d[attributeName] as string).localeCompare(filter.filterBy.value) <= 0); case _StringOperation.lessThan: return data.filter((d) => (d[attributeName] as string).localeCompare(filter.filterBy.value) < 0); + case _StringOperation.isDefined: + return data.filter((d) => d[attributeName] !== null && d[attributeName] !== undefined); + case _StringOperation.isUndefined: + return data.filter((d) => d[attributeName] === null || d[attributeName] === undefined); default: return [...data]; } @@ -111,6 +216,10 @@ export function filterByNumericOperation(filter: Filter, data: T[]): T[] { return data.filter((d) => (d[attributeName] as number) > filter.filterBy.value); case _NumericOperation.greaterOrEqual: return data.filter((d) => (d[attributeName] as number) >= filter.filterBy.value); + case _NumericOperation.isDefined: + return data.filter((d) => d[attributeName] !== null && d[attributeName] !== undefined); + case _NumericOperation.isUndefined: + return data.filter((d) => d[attributeName] === null || d[attributeName] === undefined); default: return [...data]; } @@ -131,6 +240,10 @@ export function filterByDateOperation(filter: Filter, data: T[]): T[] { return data.filter((d) => compareAsc(d[attributeName] as Date, filter.filterBy.value) > 0); case _NumericOperation.greaterOrEqual: return data.filter((d) => compareAsc(d[attributeName] as Date, filter.filterBy.value) >= 0); + case _NumericOperation.isDefined: + return data.filter((d) => d[attributeName] !== null && d[attributeName] !== undefined); + case _NumericOperation.isUndefined: + return data.filter((d) => d[attributeName] === null || d[attributeName] === undefined); default: return [...data]; } @@ -146,6 +259,10 @@ export function filterByBooleanOperation(filter: Filter, data: T[]): T[] { } return (d[attributeName] as boolean) === filter.filterBy.value }); + case _BooleanOperation.isDefined: + return data.filter((d) => d[attributeName] !== null && d[attributeName] !== undefined); + case _BooleanOperation.isUndefined: + return data.filter((d) => d[attributeName] === null || d[attributeName] === undefined); default: return [...data]; } @@ -158,6 +275,10 @@ export function filterByEnumerationOperation(filter: Filter, data: T[]): T[] return data.filter((d) => d[attributeName] === filter.filterBy.value); case _EnumerationOperation.notEquals: return data.filter((d) => d[attributeName] !== filter.filterBy.value); + case _EnumerationOperation.isDefined: + return data.filter((d) => d[attributeName] !== null && d[attributeName] !== undefined); + case _EnumerationOperation.isUndefined: + return data.filter((d) => d[attributeName] === null || d[attributeName] === undefined); default: return [...data]; } @@ -172,6 +293,12 @@ function mapStringOperator(operator: string): _StringOperation { if (operator === 'not') { return _StringOperation.notEqual; } + if (operator === 'isEmpty') { + return _StringOperation.isUndefined; + } + if (operator === 'isNotEmpty') { + return _StringOperation.isDefined; + } // contains return _StringOperation.like; @@ -193,6 +320,12 @@ function mapNumericOperator(operator: string): _NumericOperation { if (operator === '<=') { return _NumericOperation.lessOrEqual; } + if (operator === 'isEmpty') { + return _NumericOperation.isUndefined; + } + if (operator === 'isNotEmpty') { + return _NumericOperation.isDefined; + } // = return _NumericOperation.equal; @@ -217,6 +350,12 @@ function mapDateOperator(operator: string): _NumericOperation { if (operator === 'onOrBefore') { return _NumericOperation.lessOrEqual; } + if (operator === 'isEmpty') { + return _NumericOperation.isUndefined; + } + if (operator === 'isNotEmpty') { + return _NumericOperation.isDefined; + } // is return _NumericOperation.equal; @@ -231,11 +370,18 @@ function mapSingleSelectOperator(operator: string): _EnumerationOperation { if (operator === 'not') { return _EnumerationOperation.notEquals; } + if (operator === 'isEmpty') { + return _EnumerationOperation.isUndefined; + } + if (operator === 'isNotEmpty') { + return _EnumerationOperation.isDefined; + } // is return _EnumerationOperation.equals; } +// Used to transform MUI Grid filters to JUDO compliant filters export function mapFilterModelToFilters(filterModel: GridFilterModel, filterOptions: FilterOption[]): Filter[] { const filters: Filter[] = []; @@ -318,6 +464,7 @@ export function mapFilterModelToFilters(filterModel: GridFilterModel, filterOpti return filters; } +// Used by cell context menus export function mapFilterToFilterModel(filter: Filter): GridFilterItem { const filterOption = filter.filterOption; const filterBy = filter.filterBy; diff --git a/pom.xml b/pom.xml index f84ac109..3062e543 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.1.0.20240725_123755_3c5f2837_develop 1.0.0.20240712_085217_8319ce27_develop - 1.0.0.20240705_154122_a1f1410d_feature_JNG_5504_modelled_table_actions + 1.0.0.20240815_130502_30c0059e_feature_JNG_3980_filter_empty_values 3.0.0-M7