Added toggle for showing 'All options selected' label in multiselect

This commit is contained in:
devanshu052000 2025-04-22 22:49:09 +05:30
parent d12143d2b9
commit 30593d1f05
5 changed files with 24 additions and 1 deletions

View file

@ -142,6 +142,12 @@ export const multiselectV2Config = {
accordian: 'Options',
isFxNotRequired: true,
},
showAllSelectedLabel: {
type: 'toggle',
displayName: 'Show all options selected label',
validation: { schema: { type: 'boolean' }, defaultValue: true },
section: 'additionalActions',
},
loadingState: {
type: 'toggle',
displayName: 'Loading state',
@ -327,6 +333,7 @@ export const multiselectV2Config = {
optionsLoadingState: { value: '{{false}}' },
sort: { value: 'asc' },
placeholder: { value: 'Select the options' },
showAllSelectedLabel: { value: '{{true}}' },
visibility: { value: '{{true}}' },
disabledState: { value: '{{false}}' },
loadingState: { value: '{{false}}' },

View file

@ -36,7 +36,7 @@ const CustomValueContainer = ({ children, ...props }) => {
</Placeholder>
) : (
<span className="text-truncate" {...props} id="options" style={{ maxWidth: valueContainerWidth }}>
{isAllOptionsSelected ? 'All items are selected.' : values.join(', ')}
{selectProps?.showAllSelectedLabel && isAllOptionsSelected ? 'All items are selected.' : values.join(', ')}
</span>
)}
{/* Rendering children except Placeholder component to preserve the default behavior of react-select like focus

View file

@ -38,6 +38,7 @@ export const MultiselectV2 = ({
loadingState: multiSelectLoadingState,
optionsLoadingState,
sort,
showAllSelectedLabel,
} = properties;
const {
selectedTextColor,
@ -521,6 +522,7 @@ export const MultiselectV2 = ({
doShowIcon={iconVisibility}
containerRef={valueContainerRef}
showAllOption={showAllOption}
showAllSelectedLabel={showAllSelectedLabel}
isSelectAllSelected={isSelectAllSelected}
setIsSelectAllSelected={(value) => {
setIsSelectAllSelected(value);

View file

@ -142,6 +142,12 @@ export const multiselectV2Config = {
accordian: 'Options',
isFxNotRequired: true,
},
showAllSelectedLabel: {
type: 'toggle',
displayName: 'Show all options selected label',
validation: { schema: { type: 'boolean' }, defaultValue: true },
section: 'additionalActions',
},
loadingState: {
type: 'toggle',
displayName: 'Loading state',
@ -327,6 +333,7 @@ export const multiselectV2Config = {
optionsLoadingState: { value: '{{false}}' },
sort: { value: 'asc' },
placeholder: { value: 'Select the options' },
showAllSelectedLabel: { value: '{{true}}' },
visibility: { value: '{{true}}' },
disabledState: { value: '{{false}}' },
loadingState: { value: '{{false}}' },

View file

@ -142,6 +142,12 @@ export const multiselectV2Config = {
accordian: 'Options',
isFxNotRequired: true,
},
showAllSelectedLabel: {
type: 'toggle',
displayName: 'Show all options selected label',
validation: { schema: { type: 'boolean' }, defaultValue: true },
section: 'additionalActions',
},
loadingState: {
type: 'toggle',
displayName: 'Loading state',
@ -327,6 +333,7 @@ export const multiselectV2Config = {
optionsLoadingState: { value: '{{false}}' },
sort: { value: 'asc' },
placeholder: { value: 'Select the options' },
showAllSelectedLabel: { value: '{{true}}' },
visibility: { value: '{{true}}' },
disabledState: { value: '{{false}}' },
loadingState: { value: '{{false}}' },