@pepperi-addons/ngx-lib 0.4.2-beta.318 → 0.4.2-beta.319

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.
@@ -899,6 +899,7 @@ class PepInputAutoWidthDirective {
899
899
  this.el = el;
900
900
  this.includePadding = true;
901
901
  this.input = null;
902
+ this.lastValue = null;
902
903
  this.onBlurHandler = () => this.setWidthUsingText();
903
904
  this.onKeyupHandler = () => this.setWidthUsingText();
904
905
  }
@@ -918,6 +919,16 @@ class PepInputAutoWidthDirective {
918
919
  }
919
920
  this.setWidthUsingText();
920
921
  }
922
+ ngDoCheck() {
923
+ if (!this.input) {
924
+ return;
925
+ }
926
+ // Keep the width in sync when value is updated programmatically (Angular bindings),
927
+ // not only on user key events.
928
+ if (this.input.value !== this.lastValue) {
929
+ this.setWidthUsingText();
930
+ }
931
+ }
921
932
  ngOnDestroy() {
922
933
  if (!this.input) {
923
934
  return;
@@ -941,6 +952,7 @@ class PepInputAutoWidthDirective {
941
952
  if (this.input) {
942
953
  const text = this.input.value;
943
954
  this.setWidth(this.textWidth(text) + this.paddingWidth);
955
+ this.lastValue = text;
944
956
  }
945
957
  }
946
958
  _sumPropertyValues(properties) {