@integry/sdk 4.6.28 → 4.6.30

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.28",
3
+ "version": "4.6.30",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -529,7 +529,8 @@ const ListBox = (props: ListBoxProps) => {
529
529
  setSearchValue('');
530
530
  let fieldVal = el.value;
531
531
  if (isMultiSelect) {
532
- const fieldIds = value ? JSON.parse(value) : [];
532
+ let fieldIds = value ? JSON.parse(value) : [];
533
+ fieldIds = Array.isArray(fieldIds) ? fieldIds : [String(fieldIds)];
533
534
  // check if el.id is already selected and then remove it
534
535
  if (fieldIds.includes(el.id)) {
535
536
  const index = fieldIds.indexOf(el.id);
@@ -546,8 +547,8 @@ const ListBox = (props: ListBoxProps) => {
546
547
  if (indexes.length > 0) {
547
548
  fieldVal = indexes.map((i) => items[i].value).join(', ');
548
549
  }
549
- onChange(JSON.stringify(fieldIds));
550
- setEditableTextValue(JSON.stringify(fieldIds));
550
+ onChange(fieldIds.length > 0 ? JSON.stringify(fieldIds) : '');
551
+ setEditableTextValue(fieldIds.length > 0 ? JSON.stringify(fieldIds) : '');
551
552
  } else {
552
553
  onChange(el.id);
553
554
  setEditableTextValue(fieldVal);
@@ -600,12 +601,14 @@ const ListBox = (props: ListBoxProps) => {
600
601
  const getSelectedItem = useMemo(() => {
601
602
  let index = -1;
602
603
  if (isMultiSelect) {
603
- const values = value ? JSON.parse(value) : [];
604
+ let values = value ? JSON.parse(value) : [];
605
+ values = Array.isArray(values) ? values : [String(values)];
604
606
  const indexes: any = [];
605
- const selectedValues = values.map((val: any) => {
606
- index = items.findIndex((el) => el.id === val);
607
- indexes.push(index);
608
- });
607
+ const selectedValues =
608
+ values.map((val: any) => {
609
+ index = items.findIndex((el) => el.id === val);
610
+ indexes.push(index);
611
+ }) || [];
609
612
  if (indexes.length > 0 && items.length > 0) {
610
613
  return indexes.map((i: number) => items[i].value).join(', ');
611
614
  }
@@ -215,6 +215,9 @@ const FieldDropdown = (props: FieldMenuProps) => {
215
215
  if (value) {
216
216
  if (isMultiSelect) {
217
217
  selectedValues = JSON.parse(value);
218
+ selectedValues = Array.isArray(selectedValues)
219
+ ? selectedValues
220
+ : [String(selectedValues)];
218
221
  } else {
219
222
  selectedValues = [value];
220
223
  }
@@ -306,24 +306,8 @@ class FunctionForm extends Component<
306
306
  };
307
307
  });
308
308
 
309
- let isValid = false;
310
- if (dataType === 'number') {
311
- isValid = !Number.isNaN(Number(value));
312
- } else if (dataType === 'boolean') {
313
- isValid =
314
- value === 'true' ||
315
- value === 'false' ||
316
- value === '1' ||
317
- value === '0' ||
318
- value === true ||
319
- value === false ||
320
- value === 1 ||
321
- value === 0;
322
- } else if (dataType === 'string') {
323
- isValid = true;
324
- } else {
325
- isValid = true;
326
- }
309
+ const isValid = true;
310
+
327
311
  if (value && isValid) {
328
312
  this.setState({
329
313
  invalidFields: this.state.invalidFields.filter(