@integry/sdk 4.6.57 → 4.6.58
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/.vscode/launch.json +2 -2
- package/dist/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/MultipurposeField/Dropdown/index.tsx +24 -3
- package/src/components/MultipurposeField/TagMenu/index.ts +8 -4
- package/src/components/form/ObjectField/index.ts +40 -44
- package/src/features/common/FunctionForm/index.ts +3 -0
package/package.json
CHANGED
|
@@ -553,7 +553,14 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
553
553
|
setSearchValue('');
|
|
554
554
|
let fieldVal = el.value;
|
|
555
555
|
if (isMultiSelect) {
|
|
556
|
-
let fieldIds =
|
|
556
|
+
let fieldIds = [];
|
|
557
|
+
try {
|
|
558
|
+
if (value) {
|
|
559
|
+
fieldIds = JSON.parse(value);
|
|
560
|
+
}
|
|
561
|
+
} catch (e) {
|
|
562
|
+
fieldIds = [];
|
|
563
|
+
}
|
|
557
564
|
fieldIds = Array.isArray(fieldIds) ? fieldIds : [String(fieldIds)];
|
|
558
565
|
// check if el.id is already selected and then remove it
|
|
559
566
|
if (fieldIds.includes(el.id)) {
|
|
@@ -625,7 +632,14 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
625
632
|
const getSelectedItem = useMemo(() => {
|
|
626
633
|
let index = -1;
|
|
627
634
|
if (isMultiSelect) {
|
|
628
|
-
let values =
|
|
635
|
+
let values = [];
|
|
636
|
+
try {
|
|
637
|
+
if (value) {
|
|
638
|
+
values = JSON.parse(value);
|
|
639
|
+
}
|
|
640
|
+
} catch (e) {
|
|
641
|
+
values = [];
|
|
642
|
+
}
|
|
629
643
|
values = Array.isArray(values) ? values : [String(values)];
|
|
630
644
|
const indexes: any = [];
|
|
631
645
|
const selectedValues =
|
|
@@ -653,7 +667,14 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
653
667
|
const getSelectedItemIcon = useMemo(() => {
|
|
654
668
|
let index = -1;
|
|
655
669
|
if (isMultiSelect) {
|
|
656
|
-
let values =
|
|
670
|
+
let values = [];
|
|
671
|
+
try {
|
|
672
|
+
if (value) {
|
|
673
|
+
values = JSON.parse(value);
|
|
674
|
+
}
|
|
675
|
+
} catch (e) {
|
|
676
|
+
values = [];
|
|
677
|
+
}
|
|
657
678
|
values = Array.isArray(values) ? values : [String(values)];
|
|
658
679
|
const indexes: any = [];
|
|
659
680
|
const selectedValues =
|
|
@@ -216,10 +216,14 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
216
216
|
let selectedValues: any = [];
|
|
217
217
|
if (value) {
|
|
218
218
|
if (isMultiSelect) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
try {
|
|
220
|
+
selectedValues = JSON.parse(value);
|
|
221
|
+
selectedValues = Array.isArray(selectedValues)
|
|
222
|
+
? selectedValues
|
|
223
|
+
: [String(selectedValues)];
|
|
224
|
+
} catch (e) {
|
|
225
|
+
selectedValues = [String(value)];
|
|
226
|
+
}
|
|
223
227
|
} else {
|
|
224
228
|
selectedValues = [value];
|
|
225
229
|
}
|
|
@@ -281,7 +281,19 @@ const ObjectField = (props: ObjectFieldProps) => {
|
|
|
281
281
|
) =>
|
|
282
282
|
Object.entries(properties).map(([fieldName, fieldDetails], index) => {
|
|
283
283
|
const fieldType = fieldDetails.meta.ui.ui_field?.type || 'TEXTFIELD';
|
|
284
|
-
|
|
284
|
+
let options: Option[] = fieldDetails.meta.ui.ui_field?.options || [];
|
|
285
|
+
if (fieldType === 'CHECKBOX') {
|
|
286
|
+
options = [
|
|
287
|
+
{
|
|
288
|
+
id: '0',
|
|
289
|
+
value: 'No',
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: '1',
|
|
293
|
+
value: 'Yes',
|
|
294
|
+
},
|
|
295
|
+
];
|
|
296
|
+
}
|
|
285
297
|
const placeholder =
|
|
286
298
|
fieldDetails.meta.ui.placeholder ||
|
|
287
299
|
(['DYNAMIC_DROPDOWN', 'STATIC_DROPDOWN'].includes(
|
|
@@ -380,22 +392,6 @@ const ObjectField = (props: ObjectFieldProps) => {
|
|
|
380
392
|
isDisabled=${isDisabled}
|
|
381
393
|
><//>
|
|
382
394
|
`}
|
|
383
|
-
${fieldType === 'CHECKBOX' &&
|
|
384
|
-
html`
|
|
385
|
-
<${CheckboxGroup}
|
|
386
|
-
fieldId="${fieldName}"
|
|
387
|
-
title="${fieldDetails.meta.title}"
|
|
388
|
-
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
389
|
-
onChange=${(val: any) =>
|
|
390
|
-
handleFieldChange(
|
|
391
|
-
objectIndex,
|
|
392
|
-
fieldName,
|
|
393
|
-
val,
|
|
394
|
-
fieldDetails.meta.ui.ui_field?.type || 'CHECKBOX',
|
|
395
|
-
fieldDetails.meta.machine_name,
|
|
396
|
-
)}
|
|
397
|
-
/>
|
|
398
|
-
`}
|
|
399
395
|
${fieldType === 'DYNAMIC_DROPDOWN' &&
|
|
400
396
|
html`
|
|
401
397
|
<${ListBox}
|
|
@@ -426,33 +422,33 @@ const ObjectField = (props: ObjectFieldProps) => {
|
|
|
426
422
|
''}
|
|
427
423
|
/>
|
|
428
424
|
`}
|
|
429
|
-
${fieldType === 'STATIC_DROPDOWN'
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
425
|
+
${fieldType === 'STATIC_DROPDOWN' ||
|
|
426
|
+
(fieldType === 'CHECKBOX' &&
|
|
427
|
+
html`
|
|
428
|
+
<${ListBox}
|
|
429
|
+
key=${`${fieldName}_${objectIndex}`}
|
|
430
|
+
fieldId=${`${fieldName}_${objectIndex}`}
|
|
431
|
+
apiHandler=${apiHandler}
|
|
432
|
+
title=${fieldDetails.meta.title}
|
|
433
|
+
description=${fieldDetails.meta.description_for_users}
|
|
434
|
+
placeholder="${placeholder}"
|
|
435
|
+
isRequired="${fieldDetails.meta.is_required}"
|
|
436
|
+
isDynamic=${false}
|
|
437
|
+
isDisabled=${isDisabled}
|
|
438
|
+
endpointUrl=${JSON.stringify(options) || ''}
|
|
439
|
+
options=${options}
|
|
440
|
+
type=${fieldType}
|
|
441
|
+
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
442
|
+
onChange=${(val: any) =>
|
|
443
|
+
handleFieldChange(
|
|
444
|
+
objectIndex,
|
|
445
|
+
fieldName,
|
|
446
|
+
val,
|
|
447
|
+
fieldDetails.meta.ui.ui_field?.type || 'DYNAMIC_DROPDOWN',
|
|
448
|
+
fieldDetails.meta.machine_name,
|
|
449
|
+
)}
|
|
450
|
+
/>
|
|
451
|
+
`)}
|
|
456
452
|
<//>
|
|
457
453
|
</div>
|
|
458
454
|
`;
|