@integry/sdk 4.6.57 → 4.6.59

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.6.57",
3
+ "version": "4.6.59",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -553,7 +553,14 @@ const ListBox = (props: ListBoxProps) => {
553
553
  setSearchValue('');
554
554
  let fieldVal = el.value;
555
555
  if (isMultiSelect) {
556
- let fieldIds = value ? JSON.parse(value) : [];
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 = value ? JSON.parse(value) : [];
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 = value ? JSON.parse(value) : [];
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
- selectedValues = JSON.parse(value);
220
- selectedValues = Array.isArray(selectedValues)
221
- ? selectedValues
222
- : [String(selectedValues)];
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
  }
@@ -848,6 +848,35 @@ const TagList = ({
848
848
  tagsParamForOutput = value as Record<string, unknown>;
849
849
  }
850
850
 
851
+ const handleMenuRowClcik = (e: Event) => {
852
+ if (isStep && hasOutput) {
853
+ // For step nodes with output, toggle output expansion
854
+ setExpandedOutputs((prev) => ({
855
+ ...prev,
856
+ [key]: !prev[key],
857
+ }));
858
+ } else if (hasChildren) {
859
+ // For array/object nodes, toggle node expansion
860
+ toggleExpand(key);
861
+ toggleOutputExpand(key, e);
862
+ } else {
863
+ // For leaf nodes, select the value
864
+ const tagPath = `${activeTab}.${extractStepsFromOutputPath(
865
+ currentPath,
866
+ )}`;
867
+ onSelect({
868
+ currentPath: tagPath
869
+ .replace(/\bparameters\.parameters\b/g, 'parameters')
870
+ .replace(
871
+ /\bauthorization\.authorization\b/g,
872
+ 'authorization',
873
+ ),
874
+ key,
875
+ value: escapeHTMLIfNeeded(value),
876
+ });
877
+ }
878
+ };
879
+
851
880
  return html`
852
881
  <li key=${key} class="${nodeMatches ? styles.searchMatch : ''}">
853
882
  <div
@@ -951,7 +980,7 @@ const TagList = ({
951
980
  ${Array.isArray(value) && value.length > 0
952
981
  ? html`<span
953
982
  class="${styles.outputIndicator} ${styles.objectExpandIcon}"
954
- onClick=${(e: Event) => toggleOutputExpand(key, e)}
983
+ onClick=${(e: Event) => handleMenuRowClcik(e)}
955
984
  title="Toggle expand output"
956
985
  >
957
986
  <svg
@@ -982,7 +1011,9 @@ const TagList = ({
982
1011
  Object.keys(value as Record<string, unknown>).length > 0
983
1012
  ? html`<span
984
1013
  class="${styles.outputIndicator} ${styles.objectExpandIcon}"
985
- onClick=${(e: Event) => toggleOutputExpand(key, e)}
1014
+ onClick=${(e: Event) => {
1015
+ handleMenuRowClcik(e);
1016
+ }}
986
1017
  title="Toggle expand output"
987
1018
  >
988
1019
  <svg
@@ -134,8 +134,8 @@
134
134
  }
135
135
  }
136
136
  span.tagIcon {
137
- margin-right: 10px;
138
- order: 1;
137
+ margin-right: 5px;
138
+ order: 2;
139
139
  svg,
140
140
  img {
141
141
  width: 1rem;
@@ -223,6 +223,8 @@
223
223
  white-space: nowrap;
224
224
  margin-left: 5px;
225
225
  min-width: 20px;
226
+ width: 100%;
227
+ max-width: fit-content;
226
228
 
227
229
  mark {
228
230
  background-color: yellow;
@@ -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
- const options: Option[] = fieldDetails.meta.ui.ui_field?.options || [];
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
- html`
431
- <${ListBox}
432
- key=${fieldName}
433
- fieldId=${fieldName}
434
- apiHandler=${apiHandler}
435
- title=${fieldDetails.meta.title}
436
- description=${fieldDetails.meta.description_for_users}
437
- placeholder="${placeholder}"
438
- isRequired="${fieldDetails.meta.is_required}"
439
- isDynamic=${false}
440
- isDisabled=${isDisabled}
441
- endpointUrl=${JSON.stringify(
442
- fieldDetails.meta.ui.ui_field?.options,
443
- ) || ''}
444
- options=${options}
445
- value=${(objectArray[objectIndex] || {})[fieldName] || ''}
446
- onChange=${(val: any) =>
447
- handleFieldChange(
448
- objectIndex,
449
- fieldName,
450
- val,
451
- fieldDetails.meta.ui.ui_field?.type || 'DYNAMIC_DROPDOWN',
452
- fieldDetails.meta.machine_name,
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
  `;
@@ -933,6 +933,9 @@ class FunctionForm extends Component<
933
933
  this.props.variables || {},
934
934
  )}
935
935
  isDisabled=${isAIAssisted}
936
+ objectValue=${this.state.dynamicFieldDataState[
937
+ field.id
938
+ ] || {}}
936
939
  />
937
940
  `,
938
941
  )}