@integry/sdk 4.5.38 → 4.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -100,17 +100,33 @@ const ObjectField = (props: ObjectFieldProps) => {
|
|
|
100
100
|
activityOutputData,
|
|
101
101
|
activityOutputDataRaw,
|
|
102
102
|
} = props;
|
|
103
|
+
const [objectArray, setObjectArray] = useState<FieldObject[]>([{}]); // Start with one empty object in the array
|
|
104
|
+
const [showAddMoreOption, setShowAddMoreOption] = useState(true);
|
|
105
|
+
|
|
106
|
+
let templateFields = [];
|
|
107
|
+
|
|
108
|
+
if (Array.isArray(field.template_fields)) {
|
|
109
|
+
if (field.template_fields.length > 0) {
|
|
110
|
+
templateFields = field.template_fields;
|
|
111
|
+
} else if (field.type === 'TEXTAREA') {
|
|
112
|
+
templateFields = [field];
|
|
113
|
+
}
|
|
114
|
+
} else if (field.properties && Object.keys(field.properties).length === 0) {
|
|
115
|
+
field.type = 'TEXTAREA';
|
|
116
|
+
field.template_fields = [];
|
|
117
|
+
field.properties = null;
|
|
118
|
+
templateFields = [field];
|
|
119
|
+
setShowAddMoreOption(false);
|
|
120
|
+
}
|
|
103
121
|
const normalizedField = {
|
|
104
122
|
...field,
|
|
105
123
|
properties:
|
|
106
124
|
field.properties ||
|
|
107
125
|
(field.template_fields
|
|
108
|
-
? transformTemplateFieldsToProperties(
|
|
126
|
+
? transformTemplateFieldsToProperties(templateFields)
|
|
109
127
|
: {}),
|
|
110
128
|
};
|
|
111
129
|
|
|
112
|
-
const [objectArray, setObjectArray] = useState<FieldObject[]>([{}]); // Start with one empty object in the array
|
|
113
|
-
|
|
114
130
|
// Method to handle field changes for each object in the array
|
|
115
131
|
const handleFieldChange = (
|
|
116
132
|
index: number,
|
|
@@ -356,6 +372,7 @@ const ObjectField = (props: ObjectFieldProps) => {
|
|
|
356
372
|
`,
|
|
357
373
|
)}
|
|
358
374
|
${isArray &&
|
|
375
|
+
showAddMoreOption &&
|
|
359
376
|
html` <a onClick=${handleAddMore}>+ Add another ${field.title}</a> `}
|
|
360
377
|
</div>
|
|
361
378
|
`;
|
|
@@ -206,7 +206,13 @@ class FunctionForm extends Component<
|
|
|
206
206
|
value = JSON.parse(value);
|
|
207
207
|
// Ensure the parsed value is an object
|
|
208
208
|
} catch (e) {
|
|
209
|
-
value
|
|
209
|
+
if (typeof value === 'string') {
|
|
210
|
+
value = {
|
|
211
|
+
[fieldDetails.meta.title]: value,
|
|
212
|
+
};
|
|
213
|
+
} else {
|
|
214
|
+
value = {};
|
|
215
|
+
}
|
|
210
216
|
}
|
|
211
217
|
}
|
|
212
218
|
break;
|