Add multiselect option to form step (#18979)
<img width="415" height="462" alt="Capture d’écran 2026-03-25 à 18 10 06" src="https://github.com/user-attachments/assets/e5157636-25ea-41b9-ae13-8f64a24cbd5e" /> <img width="415" height="462" alt="Capture d’écran 2026-03-25 à 18 10 12" src="https://github.com/user-attachments/assets/5811848f-1ce6-4c09-9563-61f906968888" />
This commit is contained in:
+3
-1
@@ -330,7 +330,9 @@ export const WorkflowEditActionFormBuilder = ({
|
||||
.placeholder}
|
||||
</FormFieldPlaceholder>
|
||||
</StyledPlaceholderContainer>
|
||||
{field.type === 'RECORD' && (
|
||||
{(field.type === 'RECORD' ||
|
||||
field.type === 'SELECT' ||
|
||||
field.type === 'MULTI_SELECT') && (
|
||||
<IconChevronDown
|
||||
size={theme.icon.size.md}
|
||||
color={
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ export const WorkflowEditActionFormFiller = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (field.type === 'SELECT') {
|
||||
if (field.type === 'SELECT' || field.type === 'MULTI_SELECT') {
|
||||
const selectedFieldId = field.settings?.selectedFieldId;
|
||||
|
||||
if (!isDefined(selectedFieldId)) {
|
||||
|
||||
+1
@@ -28,6 +28,7 @@ export const WorkflowFormFieldSettingsByType = ({
|
||||
<WorkflowFormFieldSettingsDate field={field} onChange={onChange} />
|
||||
);
|
||||
case FieldMetadataType.SELECT:
|
||||
case FieldMetadataType.MULTI_SELECT:
|
||||
return (
|
||||
<WorkflowFormFieldSettingsSelect field={field} onChange={onChange} />
|
||||
);
|
||||
|
||||
+8
-11
@@ -9,7 +9,6 @@ import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { styled } from '@linaria/react';
|
||||
import camelCase from 'lodash.camelcase';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { themeCssVariables } from 'twenty-ui/theme-constants';
|
||||
|
||||
type WorkflowFormFieldSettingsSelectProps = {
|
||||
@@ -50,14 +49,14 @@ export const WorkflowFormFieldSettingsSelect = ({
|
||||
return acc.concat(
|
||||
objectMetadataItem.fields
|
||||
.filter(
|
||||
(field) =>
|
||||
field.isActive &&
|
||||
!isHiddenSystemField(field) &&
|
||||
field.type === FieldMetadataType.SELECT,
|
||||
(objectField) =>
|
||||
objectField.isActive &&
|
||||
!isHiddenSystemField(objectField) &&
|
||||
objectField.type === field.type,
|
||||
)
|
||||
.map((field) => ({
|
||||
label: `${objectMetadataItem.labelSingular} > ${field.label}`,
|
||||
value: field.id,
|
||||
.map((objectField) => ({
|
||||
label: `${objectMetadataItem.labelSingular} > ${objectField.label}`,
|
||||
value: objectField.id,
|
||||
})),
|
||||
);
|
||||
},
|
||||
@@ -78,9 +77,7 @@ export const WorkflowFormFieldSettingsSelect = ({
|
||||
});
|
||||
}}
|
||||
defaultValue={field.label}
|
||||
placeholder={
|
||||
getDefaultFormFieldSettings(FieldMetadataType.SELECT).label
|
||||
}
|
||||
placeholder={getDefaultFormFieldSettings(field.type).label}
|
||||
/>
|
||||
</FormFieldInputContainer>
|
||||
<FormFieldInputContainer>
|
||||
|
||||
+6
@@ -6,6 +6,7 @@ import {
|
||||
IllustrationIconNumbers,
|
||||
IllustrationIconOneToMany,
|
||||
IllustrationIconTag,
|
||||
IllustrationIconTags,
|
||||
IllustrationIconText,
|
||||
} from 'twenty-ui/display';
|
||||
import { type SelectOption } from 'twenty-ui/input';
|
||||
@@ -37,4 +38,9 @@ export const FORM_SELECT_FIELD_TYPE_OPTIONS: SelectOption<WorkflowFormFieldType>
|
||||
value: FieldMetadataType.SELECT,
|
||||
Icon: IllustrationIconTag,
|
||||
},
|
||||
{
|
||||
label: 'Multi-Select',
|
||||
value: FieldMetadataType.MULTI_SELECT,
|
||||
Icon: IllustrationIconTags,
|
||||
},
|
||||
];
|
||||
|
||||
+1
@@ -5,4 +5,5 @@ export type WorkflowFormFieldType =
|
||||
| FieldMetadataType.NUMBER
|
||||
| FieldMetadataType.DATE
|
||||
| FieldMetadataType.SELECT
|
||||
| FieldMetadataType.MULTI_SELECT
|
||||
| 'RECORD';
|
||||
|
||||
+14
@@ -54,6 +54,20 @@ describe('getDefaultFormFieldSettings', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return correct default settings for MULTI_SELECT field type', () => {
|
||||
const result = getDefaultFormFieldSettings(FieldMetadataType.MULTI_SELECT);
|
||||
expect(result).toEqual({
|
||||
id: 'test-uuid-123',
|
||||
name: 'multiSelect',
|
||||
label: 'Multi-Select',
|
||||
placeholder: 'Choose values',
|
||||
settings: {
|
||||
selectType: 'EXISTING_FIELD',
|
||||
selectedFieldId: undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should generate unique UUID for each call', () => {
|
||||
getDefaultFormFieldSettings(FieldMetadataType.TEXT);
|
||||
getDefaultFormFieldSettings(FieldMetadataType.NUMBER);
|
||||
|
||||
+11
@@ -47,6 +47,17 @@ export const getDefaultFormFieldSettings = (type: WorkflowFormFieldType) => {
|
||||
selectedFieldId: undefined,
|
||||
},
|
||||
};
|
||||
case FieldMetadataType.MULTI_SELECT:
|
||||
return {
|
||||
id: v4(),
|
||||
name: 'multiSelect',
|
||||
label: 'Multi-Select',
|
||||
placeholder: 'Choose values',
|
||||
settings: {
|
||||
selectType: 'EXISTING_FIELD',
|
||||
selectedFieldId: undefined,
|
||||
},
|
||||
};
|
||||
default:
|
||||
assertUnreachable(type);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export const workflowFormActionSettingsSchema =
|
||||
z.literal(FieldMetadataType.NUMBER),
|
||||
z.literal(FieldMetadataType.DATE),
|
||||
z.literal(FieldMetadataType.SELECT),
|
||||
z.literal(FieldMetadataType.MULTI_SELECT),
|
||||
z.literal('RECORD'),
|
||||
]),
|
||||
placeholder: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user