@vgip/meta-ui 1.3.5 → 1.3.6

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.
@@ -3429,7 +3429,7 @@ class FieldReference extends FieldAbstract {
3429
3429
  value = null;
3430
3430
  }
3431
3431
  if (this.multiple) {
3432
- if (value) {
3432
+ if (value && value instanceof Array) {
3433
3433
  for (const v of value) {
3434
3434
  if (!this.model) {
3435
3435
  this.model = [];
@@ -3442,7 +3442,9 @@ class FieldReference extends FieldAbstract {
3442
3442
  });
3443
3443
  }
3444
3444
  }
3445
- // this.value = value;
3445
+ }
3446
+ else {
3447
+ value = null; // protect when value from server is not array
3446
3448
  }
3447
3449
  }
3448
3450
  else {
@@ -3461,10 +3463,13 @@ class FieldReference extends FieldAbstract {
3461
3463
  // }
3462
3464
  }
3463
3465
  this.model = value;
3464
- this.value = this.modelToValue(value, this.meta.valueType || 'object');
3465
3466
  if (!this.multiple) {
3467
+ this.value = this.modelToValue(value, this.meta.valueType || 'object');
3466
3468
  this.buildExternalLink();
3467
3469
  }
3470
+ else {
3471
+ this.value = !this.model ? this.model : this.model.map((m) => this.modelToValue(m, this.meta.valueType || 'object'));
3472
+ }
3468
3473
  this.meta.$optional = this.isOptional;
3469
3474
  },
3470
3475
  get: () => this.value,