mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Merge pull request #12672 from ToolJet/feat/multiselect-label
Added toggle for showing 'All options selected' label in multiselect
This commit is contained in:
commit
0bed40ab3f
6 changed files with 35 additions and 1 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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}}' },
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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}
|
||||||
|
|
|
||||||
|
|
@ -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}}' },
|
||||||
|
|
|
||||||
|
|
@ -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}}' },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue