@colijnit/corecomponents_v12 12.0.78 → 12.0.80

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,8 @@
7703
7703
  _this.elementRef = elementRef;
7704
7704
  _this.placeholder = "";
7705
7705
  _this.type = "text";
7706
+ _this.digitsOnly = false;
7707
+ _this.excludePlusMinus = true;
7706
7708
  _this.showClearButton = undefined;
7707
7709
  _this.showPlaceholderOnFocus = true;
7708
7710
  _this.hasOwnLabel = true;
@@ -7748,12 +7750,17 @@
7748
7750
  enumerable: false,
7749
7751
  configurable: true
7750
7752
  });
7753
+ // exclude some non-digit characters, since input type 'number' still allows the characters -, + and e
7754
+ InputTextComponent.prototype.excludeNonDigitChars = function (event) {
7755
+ var excludedKeys = this.excludePlusMinus ? ['e', '-', '+'] : ['e'];
7756
+ return !excludedKeys.includes(event.key);
7757
+ };
7751
7758
  return InputTextComponent;
7752
7759
  }(BaseInputComponent));
7753
7760
  InputTextComponent.decorators = [
7754
7761
  { type: i0.Component, args: [{
7755
7762
  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 ",
7763
+ 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
7764
  providers: [{
7758
7765
  provide: COMPONENT_INTERFACE_NAME,
7759
7766
  useExisting: i0.forwardRef(function () { return InputTextComponent; })
@@ -7777,6 +7784,8 @@
7777
7784
  type: [{ type: i0.Input }],
7778
7785
  min: [{ type: i0.Input }],
7779
7786
  max: [{ type: i0.Input }],
7787
+ digitsOnly: [{ type: i0.Input }],
7788
+ excludePlusMinus: [{ type: i0.Input }],
7780
7789
  showClearButton: [{ type: i0.Input }],
7781
7790
  keyDownWhiteList: [{ type: i0.Input }],
7782
7791
  showPlaceholderOnFocus: [{ type: i0.Input }],