MSP-4162 add id search for firstColumn
This commit is contained in:
1 parent
0ea5aa2d8d
commit
e088b07f7a
1 file changed
+12
-5
@@ -3,9 +3,16 @@ import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
export const filterFirstColumnItems = <T extends NonNullable<unknown>>(
|
||||
listItems: ColumnItem<T>[],
|
||||
searchValue: string
|
||||
): ColumnItem<T>[] =>
|
||||
listItems
|
||||
? listItems.filter((el) =>
|
||||
el.name.toLowerCase().trim().includes(searchValue.toLowerCase().trim())
|
||||
)
|
||||
): ColumnItem<T>[] => {
|
||||
const normalizedSearchValue = searchValue.toLowerCase().trim()
|
||||
return listItems
|
||||
? listItems.filter((el) => {
|
||||
const normalizedName = el.name.toLowerCase().trim()
|
||||
const normalizedId = el.id.toString().toLowerCase().trim()
|
||||
return (
|
||||
normalizedName.includes(normalizedSearchValue) ||
|
||||
normalizedId.includes(normalizedSearchValue)
|
||||
)
|
||||
})
|
||||
: []
|
||||
}
|
||||
Reference in new issue
Block a user