mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Fix: Select all option should not get exposed anywhere.
This commit is contained in:
parent
208d9f7a77
commit
3bd1f78ea3
2 changed files with 8 additions and 4 deletions
|
|
@ -6,7 +6,11 @@ import './multiselectV2.scss';
|
|||
|
||||
const CustomValueContainer = ({ children, ...props }) => {
|
||||
const selectProps = props.selectProps;
|
||||
const values = Array.isArray(selectProps?.value) && selectProps?.value?.map((option) => option.label);
|
||||
const values =
|
||||
Array.isArray(selectProps?.value) &&
|
||||
selectProps?.value
|
||||
?.filter((option) => option.value !== 'multiselect-custom-menulist-select-all') //Remove the Select all option if selected
|
||||
?.map((option) => option.label);
|
||||
const isAllOptionsSelected = selectProps?.value.length === selectProps.options.length;
|
||||
const valueContainerWidth = selectProps?.containerRef?.current?.offsetWidth;
|
||||
// eslint-disable-next-line import/namespace
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export const MultiselectV2 = ({
|
|||
if (action.option?.value === SELECT_ALL) {
|
||||
// Case 1 - If select all is selected
|
||||
if (action.action === 'select-option') {
|
||||
setInputValue(modifiedSelectOptions);
|
||||
setInputValue(selectOptions);
|
||||
} else {
|
||||
setInputValue([]);
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ export const MultiselectV2 = ({
|
|||
setInputValue(items.filter((item) => item.value !== SELECT_ALL));
|
||||
} else if (selectOptions?.length === items?.length) {
|
||||
// Case 3 - If all options are selected except select all
|
||||
setInputValue(modifiedSelectOptions);
|
||||
setInputValue(selectOptions);
|
||||
} else {
|
||||
// Case 4 - Normal selection
|
||||
setInputValue(items);
|
||||
|
|
@ -503,7 +503,7 @@ export const MultiselectV2 = ({
|
|||
ref={selectRef}
|
||||
menuId={id}
|
||||
isDisabled={isMultiSelectDisabled}
|
||||
value={selected}
|
||||
value={selectOptions?.length === selected?.length ? modifiedSelectOptions : selected}
|
||||
onChange={onChangeHandler}
|
||||
options={modifiedSelectOptions}
|
||||
styles={customStyles}
|
||||
|
|
|
|||
Loading…
Reference in a new issue