Skip to content

Commit

Permalink
feat:introducing isFilterCaseInSensitive prop for dual-list-select fi…
Browse files Browse the repository at this point in the history
…lterOption
  • Loading branch information
AmirSaif committed Jul 7, 2024
1 parent 9c693a4 commit 922fdf2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/common/src/dual-list-select/dual-list-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 922fdf2

Please sign in to comment.