@colijnit/corecomponents_v12 12.0.78 → 12.0.79

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.
@@ -7703,6 +7703,7 @@
7703
7703
  _this.elementRef = elementRef;
7704
7704
  _this.placeholder = "";
7705
7705
  _this.type = "text";
7706
+ _this.digitsOnly = false;
7706
7707
  _this.showClearButton = undefined;
7707
7708
  _this.showPlaceholderOnFocus = true;
7708
7709
  _this.hasOwnLabel = true;
@@ -7748,12 +7749,17 @@
7748
7749
  enumerable: false,
7749
7750
  configurable: true
7750
7751
  });
7752
+ // exclude some non-digit characters, since input type 'number' still allows the characters -, + and e
7753
+ InputTextComponent.prototype.excludeNonDigitChars = function (event) {
7754
+ var excludedKeyCodes = [69, 107, 109, 187, 189];
7755
+ return !excludedKeyCodes.includes(event.keyCode);
7756
+ };
7751
7757
  return InputTextComponent;
7752
7758
  }(BaseInputComponent));
7753
7759
  InputTextComponent.decorators = [
7754
7760
  { type: i0.Component, args: [{
7755
7761
  selector: "co-input-text",
7756
- template: "\n <label *ngIf=\"showPlaceholderOnFocus || (!showPlaceholderOnFocus && !hasValue && !focused)\" [textContent]=\"placeholder\"></label>\n <co-icon *ngIf=\"leftIcon\" class=\"input-text-left-icon\" [icon]=\"leftIcon\"></co-icon>\n <co-icon *ngIf=\"rightIcon\" class=\"input-text-right-icon\" [icon]=\"rightIcon\"></co-icon>\n <input #input\n [type]=\"type\"\n [ngModel]=\"model\"\n [min]=\"type === 'number' && this.min ? this.min : undefined\"\n [max]=\"type === 'number' && this.max ? this.max : undefined\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n >\n <co-commit-buttons *ngIf=\"showSaveCancel && focused && canSaveOrCancel\"\n [committing]=\"committing\"\n [commitFinished]=\"commitFinished\"\n (commitClick)=\"commitClick($event)\"\n (cancelClick)=\"cancelClick($event)\"\n >\n </co-commit-buttons>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
7762
+ template: "\n <label *ngIf=\"showPlaceholderOnFocus || (!showPlaceholderOnFocus && !hasValue && !focused)\"\n [textContent]=\"placeholder\"></label>\n <co-icon *ngIf=\"leftIcon\" class=\"input-text-left-icon\" [icon]=\"leftIcon\"></co-icon>\n <co-icon *ngIf=\"rightIcon\" class=\"input-text-right-icon\" [icon]=\"rightIcon\"></co-icon>\n <input #input\n [type]=\"digitsOnly ? 'number' : type\"\n [ngModel]=\"model\"\n [min]=\"type === 'number' && this.min ? this.min : undefined\"\n [max]=\"type === 'number' && this.max ? this.max : undefined\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n (keydown)=\"digitsOnly ? excludeNonDigitChars($event) : true\"\n >\n <co-commit-buttons *ngIf=\"showSaveCancel && focused && canSaveOrCancel\"\n [committing]=\"committing\"\n [commitFinished]=\"commitFinished\"\n (commitClick)=\"commitClick($event)\"\n (cancelClick)=\"cancelClick($event)\"\n >\n </co-commit-buttons>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
7757
7763
  providers: [{
7758
7764
  provide: COMPONENT_INTERFACE_NAME,
7759
7765
  useExisting: i0.forwardRef(function () { return InputTextComponent; })
@@ -7777,6 +7783,7 @@
7777
7783
  type: [{ type: i0.Input }],
7778
7784
  min: [{ type: i0.Input }],
7779
7785
  max: [{ type: i0.Input }],
7786
+ digitsOnly: [{ type: i0.Input }],
7780
7787
  showClearButton: [{ type: i0.Input }],
7781
7788
  keyDownWhiteList: [{ type: i0.Input }],
7782
7789
  showPlaceholderOnFocus: [{ type: i0.Input }],