@integry/sdk 4.5.39 → 4.5.41

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.5.39",
3
+ "version": "4.5.41",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -100,14 +100,28 @@ 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
+
103
106
  let templateFields = [];
104
107
 
105
108
  if (Array.isArray(field.template_fields)) {
106
109
  if (field.template_fields.length > 0) {
107
110
  templateFields = field.template_fields;
108
- } else if (field.type === 'TEXTAREA') {
111
+ } else if (field.type === 'TEXTAREA' || field.type === 'DYNAMIC') {
112
+ if (field.data_type === 'OBJECT[]') {
113
+ field.type = 'TEXTAREA';
114
+ setShowAddMoreOption(false);
115
+ }
116
+
109
117
  templateFields = [field];
110
118
  }
119
+ } else if (field.properties && Object.keys(field.properties).length === 0) {
120
+ field.type = 'TEXTAREA';
121
+ field.template_fields = [];
122
+ field.properties = null;
123
+ templateFields = [field];
124
+ setShowAddMoreOption(false);
111
125
  }
112
126
  const normalizedField = {
113
127
  ...field,
@@ -118,8 +132,6 @@ const ObjectField = (props: ObjectFieldProps) => {
118
132
  : {}),
119
133
  };
120
134
 
121
- const [objectArray, setObjectArray] = useState<FieldObject[]>([{}]); // Start with one empty object in the array
122
-
123
135
  // Method to handle field changes for each object in the array
124
136
  const handleFieldChange = (
125
137
  index: number,
@@ -365,6 +377,7 @@ const ObjectField = (props: ObjectFieldProps) => {
365
377
  `,
366
378
  )}
367
379
  ${isArray &&
380
+ showAddMoreOption &&
368
381
  html` <a onClick=${handleAddMore}>+ Add another ${field.title}</a> `}
369
382
  </div>
370
383
  `;