Merge pull request #12672 from ToolJet/feat/multiselect-label

Added toggle for showing 'All options selected' label in multiselect
This commit is contained in:
Johnson Cherian 2025-04-25 12:05:15 +05:30 committed by GitHub
commit 0bed40ab3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 35 additions and 1 deletions

View file

@ -539,6 +539,17 @@ export function Select({ componentMeta, darkMode, ...restProps }) {
currentState, currentState,
allComponents allComponents
)} )}
{isMultiSelect &&
renderElement(
component,
componentMeta,
paramUpdated,
dataQueries,
'showAllSelectedLabel',
'properties',
currentState,
allComponents
)}
{isSortingEnabled && {isSortingEnabled &&
renderElement( renderElement(
component, component,

View file

@ -121,6 +121,12 @@ export const multiselectV2Config = {
}, },
accordian: 'Options', accordian: 'Options',
}, },
showAllSelectedLabel: {
type: 'toggle',
displayName: 'Show "All items are selected"',
validation: { schema: { type: 'boolean' }, defaultValue: true },
accordian: 'Options',
},
optionsLoadingState: { optionsLoadingState: {
type: 'toggle', type: 'toggle',
displayName: 'Options loading state', displayName: 'Options loading state',
@ -339,6 +345,7 @@ export const multiselectV2Config = {
optionsLoadingState: { value: '{{false}}' }, optionsLoadingState: { value: '{{false}}' },
sort: { value: 'asc' }, sort: { value: 'asc' },
placeholder: { value: 'Select the options' }, placeholder: { value: 'Select the options' },
showAllSelectedLabel: { value: '{{true}}' },
showClearBtn: { value: '{{true}}' }, showClearBtn: { value: '{{true}}' },
showSearchInput: { value: '{{true}}' }, showSearchInput: { value: '{{true}}' },
visibility: { value: '{{true}}' }, visibility: { value: '{{true}}' },

View file

@ -36,7 +36,7 @@ const CustomValueContainer = ({ children, ...props }) => {
</Placeholder> </Placeholder>
) : ( ) : (
<span className="text-truncate" {...props} id="options" style={{ maxWidth: valueContainerWidth }}> <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> </span>
)} )}
{/* Rendering children except Placeholder component to preserve the default behavior of react-select like focus {/* Rendering children except Placeholder component to preserve the default behavior of react-select like focus

View file

@ -37,6 +37,7 @@ export const MultiselectV2 = ({
loadingState: multiSelectLoadingState, loadingState: multiSelectLoadingState,
optionsLoadingState, optionsLoadingState,
sort, sort,
showAllSelectedLabel,
showClearBtn, showClearBtn,
showSearchInput, showSearchInput,
} = properties; } = properties;
@ -544,6 +545,7 @@ export const MultiselectV2 = ({
icon={icon} icon={icon}
doShowIcon={iconVisibility} doShowIcon={iconVisibility}
containerRef={valueContainerRef} containerRef={valueContainerRef}
showAllSelectedLabel={showAllSelectedLabel}
iconColor={iconColor} iconColor={iconColor}
optionsLoadingState={optionsLoadingState && advanced} optionsLoadingState={optionsLoadingState && advanced}
darkMode={darkMode} darkMode={darkMode}

View file

@ -121,6 +121,12 @@ export const multiselectV2Config = {
}, },
accordian: 'Options', accordian: 'Options',
}, },
showAllSelectedLabel: {
type: 'toggle',
displayName: 'Show "All items are selected"',
validation: { schema: { type: 'boolean' }, defaultValue: true },
accordian: 'Options',
},
optionsLoadingState: { optionsLoadingState: {
type: 'toggle', type: 'toggle',
displayName: 'Options loading state', displayName: 'Options loading state',
@ -339,6 +345,7 @@ export const multiselectV2Config = {
optionsLoadingState: { value: '{{false}}' }, optionsLoadingState: { value: '{{false}}' },
sort: { value: 'asc' }, sort: { value: 'asc' },
placeholder: { value: 'Select the options' }, placeholder: { value: 'Select the options' },
showAllSelectedLabel: { value: '{{true}}' },
showClearBtn: { value: '{{true}}' }, showClearBtn: { value: '{{true}}' },
showSearchInput: { value: '{{true}}' }, showSearchInput: { value: '{{true}}' },
visibility: { value: '{{true}}' }, visibility: { value: '{{true}}' },

View file

@ -121,6 +121,12 @@ export const multiselectV2Config = {
}, },
accordian: 'Options', accordian: 'Options',
}, },
showAllSelectedLabel: {
type: 'toggle',
displayName: 'Show "All items are selected"',
validation: { schema: { type: 'boolean' }, defaultValue: true },
accordian: 'Options',
},
optionsLoadingState: { optionsLoadingState: {
type: 'toggle', type: 'toggle',
displayName: 'Options loading state', displayName: 'Options loading state',
@ -339,6 +345,7 @@ export const multiselectV2Config = {
optionsLoadingState: { value: '{{false}}' }, optionsLoadingState: { value: '{{false}}' },
sort: { value: 'asc' }, sort: { value: 'asc' },
placeholder: { value: 'Select the options' }, placeholder: { value: 'Select the options' },
showAllSelectedLabel: { value: '{{true}}' },
showClearBtn: { value: '{{true}}' }, showClearBtn: { value: '{{true}}' },
showSearchInput: { value: '{{true}}' }, showSearchInput: { value: '{{true}}' },
visibility: { value: '{{true}}' }, visibility: { value: '{{true}}' },