From 922fdf2882e5e84b0377624c45dc4de12347c487 Mon Sep 17 00:00:00 2001 From: Amir Saif Date: Mon, 8 Jul 2024 03:10:47 +0530 Subject: [PATCH] feat:introducing isFilterCaseInSensitive prop for dual-list-select filterOption --- .../src/dual-list-select/dual-list-select.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/common/src/dual-list-select/dual-list-select.js b/packages/common/src/dual-list-select/dual-list-select.js index 4c82e188b..37eaf0ebc 100644 --- a/packages/common/src/dual-list-select/dual-list-select.js +++ b/packages/common/src/dual-list-select/dual-list-select.js @@ -39,10 +39,20 @@ const DualListSelectCommon = (props) => { }); const leftValues = rest.options - .filter((option) => !rest.input.value.includes(option.value) && option.label.includes(state.filterOptions)) + .filter((option) => { + if(!props.isFilterCaseInSensitive) + return !rest.input.value.includes(option.value) && option.label.includes(state.filterOptions); + else + return !rest.input.value.includes(option.value) && option.label.toLowerCase().includes(state.filterOptions.toLowerCase()); + }) .sort((a, b) => (state.sortLeftDesc ? a.label.localeCompare(b.label) : b.label.localeCompare(a.label))); const rightValues = rest.options - .filter((option) => rest.input.value.includes(option.value) && option.label.includes(state.filterValue)) + .filter((option) => { + if(!props.isFilterCaseInSensitive) + return rest.input.value.includes(option.value) && option.label.includes(state.filterValue); + else + return rest.input.value.includes(option.value) && option.label.toLowerCase().includes(state.filterValue.toLowerCase()); + }) .sort((a, b) => (state.sortRightDesc ? a.label.localeCompare(b.label) : b.label.localeCompare(a.label))); const handleOptionsClick = (event, value) => handleOptionClick(event, value, leftValues, true, dispatch, state);