@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.
@@ -906,6 +906,7 @@ class PepInputAutoWidthDirective {
906
906
  this.el = el;
907
907
  this.includePadding = true;
908
908
  this.input = null;
909
+ this.lastValue = null;
909
910
  this.onBlurHandler = () => this.setWidthUsingText();
910
911
  this.onKeyupHandler = () => this.setWidthUsingText();
911
912
  }
@@ -926,6 +927,16 @@ class PepInputAutoWidthDirective {
926
927
  }
927
928
  this.setWidthUsingText();
928
929
  }
930
+ ngDoCheck() {
931
+ if (!this.input) {
932
+ return;
933
+ }
934
+ // Keep the width in sync when value is updated programmatically (Angular bindings),
935
+ // not only on user key events.
936
+ if (this.input.value !== this.lastValue) {
937
+ this.setWidthUsingText();
938
+ }
939
+ }
929
940
  ngOnDestroy() {
930
941
  if (!this.input) {
931
942
  return;
@@ -949,6 +960,7 @@ class PepInputAutoWidthDirective {
949
960
  if (this.input) {
950
961
  const text = this.input.value;
951
962
  this.setWidth(this.textWidth(text) + this.paddingWidth);
963
+ this.lastValue = text;
952
964
  }
953
965
  }
954
966
  _sumPropertyValues(properties) {