@vgip/meta-ui 2.1.4 → 2.1.5

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.
@@ -142,6 +142,9 @@ const optionsFieldNormalizer = (field) => {
142
142
  if (field.reference) {
143
143
  f.reference = field.reference;
144
144
  }
145
+ if (field.acceptNew) {
146
+ f.acceptNew = field.acceptNew;
147
+ }
145
148
  if (field.searchUrl || field.searchParams) {
146
149
  f.search = {
147
150
  url: field.searchUrl,
@@ -3603,6 +3606,16 @@ class FieldSelect extends FieldAbstract {
3603
3606
  break;
3604
3607
  }
3605
3608
  }
3609
+ if (this.meta.acceptNew && this.model !== value) { // VGIS-10948
3610
+ const newOption = {
3611
+ id: value.id || value,
3612
+ label: value.id || value
3613
+ };
3614
+ this.options.push(newOption);
3615
+ this.model = newOption;
3616
+ this.value = this.modelToValue(newOption, this.meta.valueType);
3617
+ this.showText = newOption.label;
3618
+ }
3606
3619
  }
3607
3620
  else {
3608
3621
  delete this.model;