Manage composite fields in step filters (#13407)
- add to step output schema the information that field is a composite sub field - from output schema, when selecting the variable, copy all info required to stepFilter - from stepFilter, when selecting a value, display a special component for composites
This commit is contained in:
@ -8,6 +8,7 @@ export type Leaf = {
|
||||
description?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value: any;
|
||||
isCompositeSubField?: boolean;
|
||||
};
|
||||
|
||||
export type Node = {
|
||||
@ -29,7 +30,9 @@ type Link = {
|
||||
export type BaseOutputSchema = Record<string, Leaf | Node>;
|
||||
|
||||
export type FieldOutputSchema =
|
||||
| ((Leaf | Node) & { fieldMetadataId?: string })
|
||||
| ((Leaf | Node) & {
|
||||
fieldMetadataId?: string;
|
||||
})
|
||||
| RecordOutputSchema;
|
||||
|
||||
export type RecordOutputSchema = {
|
||||
|
||||
@ -158,12 +158,16 @@ describe('generateFakeField', () => {
|
||||
type: FieldMetadataType.LINKS,
|
||||
value: {
|
||||
label: {
|
||||
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
|
||||
isCompositeSubField: true,
|
||||
isLeaf: true,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Label',
|
||||
value: 'Fake Label',
|
||||
},
|
||||
url: {
|
||||
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
|
||||
isCompositeSubField: true,
|
||||
isLeaf: true,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Url',
|
||||
@ -199,12 +203,16 @@ describe('generateFakeField', () => {
|
||||
type: FieldMetadataType.CURRENCY,
|
||||
value: {
|
||||
amount: {
|
||||
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
|
||||
isCompositeSubField: true,
|
||||
isLeaf: true,
|
||||
type: FieldMetadataType.NUMBER,
|
||||
label: 'Amount',
|
||||
value: 100,
|
||||
},
|
||||
currencyCode: {
|
||||
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
|
||||
isCompositeSubField: true,
|
||||
isLeaf: true,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Currency Code',
|
||||
|
||||
@ -80,18 +80,24 @@ describe('generateFakeFormResponse', () => {
|
||||
"type": "LINKS",
|
||||
"value": {
|
||||
"primaryLinkLabel": {
|
||||
"fieldMetadataId": "domainNameFieldMetadataId",
|
||||
"isCompositeSubField": true,
|
||||
"isLeaf": true,
|
||||
"label": "Primary Link Label",
|
||||
"type": "TEXT",
|
||||
"value": "My text",
|
||||
},
|
||||
"primaryLinkUrl": {
|
||||
"fieldMetadataId": "domainNameFieldMetadataId",
|
||||
"isCompositeSubField": true,
|
||||
"isLeaf": true,
|
||||
"label": "Primary Link Url",
|
||||
"type": "TEXT",
|
||||
"value": "My text",
|
||||
},
|
||||
"secondaryLinks": {
|
||||
"fieldMetadataId": "domainNameFieldMetadataId",
|
||||
"isCompositeSubField": true,
|
||||
"isLeaf": true,
|
||||
"label": "Secondary Links",
|
||||
"type": "RAW_JSON",
|
||||
|
||||
@ -37,6 +37,8 @@ export const generateFakeField = ({
|
||||
type: property.type,
|
||||
label: camelToTitleCase(property.name),
|
||||
value: value || generateFakeValue(property.type, 'FieldMetadataType'),
|
||||
fieldMetadataId,
|
||||
isCompositeSubField: true,
|
||||
};
|
||||
|
||||
return acc;
|
||||
|
||||
Reference in New Issue
Block a user