@esfaenza/forms-and-validations 11.2.73 → 11.2.74

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.
@@ -1941,7 +1941,7 @@
1941
1941
  });
1942
1942
  // Post trybind se c'è un modello associato ricalcolo l'**EvaluatedModel**
1943
1943
  if (this.Model)
1944
- this.EvaluatedModel = (_a = this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description;
1944
+ (_a = this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description;
1945
1945
  }
1946
1946
  };
1947
1947
  /** Valuta il contenuto della variabile BindCheckingGroups */
@@ -2537,6 +2537,7 @@
2537
2537
  _this.tryBindSourceDisplay();
2538
2538
  // In questo caso è già filtrata dalla SearchFunction
2539
2539
  _this.FilteredBoundSource = _this.BoundSource;
2540
+ _this.removeFilteredSourceOnDescriptionSelection();
2540
2541
  _this.cdr.markForCheck();
2541
2542
  });
2542
2543
  }, 400);
@@ -2545,10 +2546,19 @@
2545
2546
  this.throttla("filtersource", function () {
2546
2547
  // In questo caso devo filtrare io in memoria
2547
2548
  _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return (_this.CaseSensitive && t.description.includes(event)) || (!_this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())); });
2549
+ _this.removeFilteredSourceOnDescriptionSelection();
2548
2550
  _this.cdr.markForCheck();
2549
2551
  }, 100);
2550
2552
  }
2551
2553
  };
2554
+ /** @ignore */
2555
+ FormAdaptiveComponent.prototype.removeFilteredSourceOnDescriptionSelection = function () {
2556
+ if (this.FilteredBoundSource.length == 1 && (this.FilteredBoundSource[0].description === this.Model)) {
2557
+ this.Model = this.BoundSource[0].id;
2558
+ this.EvaluatedModel = this.BoundSource[0].description;
2559
+ this.FilteredBoundSource = [];
2560
+ }
2561
+ };
2552
2562
  /** Metodo richiamato quando viene modificato il modello del campo di input */
2553
2563
  FormAdaptiveComponent.prototype.changed = function () {
2554
2564
  var toEmit = this.getModelToEmit();
@@ -3427,6 +3437,7 @@
3427
3437
  _this.tryBindSourceDisplay();
3428
3438
  // In questo caso è già filtrata dalla SearchFunction
3429
3439
  _this.FilteredBoundSource = _this.BoundSource;
3440
+ _this.removeFilteredSourceOnDescriptionSelection();
3430
3441
  _this.cdr.markForCheck();
3431
3442
  });
3432
3443
  }, 400);
@@ -3435,11 +3446,20 @@
3435
3446
  this.throttla("filtersource", function () {
3436
3447
  // In questo caso devo filtrare io in memoria
3437
3448
  _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return (_this.CaseSensitive && t.description.includes(event)) || (!_this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())); });
3449
+ _this.removeFilteredSourceOnDescriptionSelection();
3438
3450
  _this.cdr.markForCheck();
3439
3451
  }, 100);
3440
3452
  }
3441
3453
  };
3442
3454
  /** @ignore */
3455
+ FormAutocompleteComponent.prototype.removeFilteredSourceOnDescriptionSelection = function () {
3456
+ if (this.FilteredBoundSource.length == 1 && (this.FilteredBoundSource[0].description === this.Model)) {
3457
+ this.Model = this.BoundSource[0].id;
3458
+ this.EvaluatedModel = this.BoundSource[0].description;
3459
+ this.FilteredBoundSource = [];
3460
+ }
3461
+ };
3462
+ /** @ignore */
3443
3463
  FormAutocompleteComponent.prototype.ngOnChanges = function (changes) {
3444
3464
  var _a;
3445
3465
  var newSource = changes["Source"];