Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
anistouri committed Dec 12, 2024
1 parent dbf240f commit 44b1baf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/custom-aggrid/custom-aggrid-header-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const makeAgGridCustomHeaderColumn = ({
isCustomColumn: isCustomColumn,
Menu: Menu,
},
//filterParams: props?.agGridFilterParams || undefined,
filterParams: props?.agGridFilterParams || undefined,
...props,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
*/

import { FILTER_NUMBER_COMPARATORS, FILTER_TEXT_COMPARATORS } from 'components/custom-aggrid/custom-aggrid-header.type';
import { EnumOption } from 'components/utils/utils-type';

function contains(target: string, lookingFor: string) {
return target && target?.toLowerCase().indexOf(lookingFor.toLowerCase()) >= 0;
}

export const getEnumFilterConfig = (enumOption: EnumOption[]) => {
export const getEnumFilterConfig = () => {
return {
enumFilter: {
filter: 'agTextColumnFilter',
Expand All @@ -22,10 +21,6 @@ export const getEnumFilterConfig = (enumOption: EnumOption[]) => {
filterOptions: [FILTER_TEXT_COMPARATORS.CONTAINS],
textMatcher: ({ value, filterText }: { value: string; filterText: string }) => {
if (value) {
/* const label =
getEnumLabelById(Object.values(enumOption) as EnumOption[], value?.toUpperCase()) ||
value;
const text = label ? intl.formatMessage({ id: label }) : value; */
return contains(value, filterText || '');
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const defaultBooleanFilterConfig = {
// It generates configuration for filtering, sorting and rendering
export const getDefaultEnumConfig = (enumOptions: Readonly<EnumOption[]>) =>
({
...getEnumFilterConfig(enumOptions as EnumOption[]),
...getEnumFilterConfig(),
cellRenderer: EnumCellRenderer,
cellRendererParams: {
enumOptions: enumOptions as Writable<typeof enumOptions>,
Expand Down

0 comments on commit 44b1baf

Please sign in to comment.