@seniorsistemas/angular-components 16.3.5 → 16.3.7

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.
@@ -1653,13 +1653,13 @@
1653
1653
  var BignumberField = /** @class */ (function (_super) {
1654
1654
  __extends(BignumberField, _super);
1655
1655
  function BignumberField(config) {
1656
- var _a;
1656
+ var _a, _b;
1657
1657
  var _this = _super.call(this, config) || this;
1658
- _this.allowNegative = config.allowNegative;
1658
+ _this.allowNegative = (_a = config.allowNegative) !== null && _a !== void 0 ? _a : true;
1659
1659
  _this.numberLocaleOptions = config.numberLocaleOptions || new NumberLocaleOptions();
1660
1660
  _this.browserAutocomplete = config.browserAutocomplete;
1661
1661
  _this.precision = config.precision;
1662
- _this.scale = (_a = config.scale) !== null && _a !== void 0 ? _a : 2;
1662
+ _this.scale = (_b = config.scale) !== null && _b !== void 0 ? _b : 2;
1663
1663
  _this.alignTo = _this.scale ? ng2CurrencyMask.AlignmentOptions.RIGHT : ng2CurrencyMask.AlignmentOptions.LEFT;
1664
1664
  _this.mask = config.mask;
1665
1665
  _this.leftAddon = config.leftAddon;
@@ -3955,7 +3955,6 @@
3955
3955
  _this.precision = 15;
3956
3956
  _this.scale = 0;
3957
3957
  _this.decimalSeparator = ",";
3958
- _this.thousandsSeparator = ".";
3959
3958
  _this.alignTo = ng2CurrencyMask.AlignmentOptions.LEFT;
3960
3959
  _this.allowNegative = true;
3961
3960
  return _this;
@@ -3979,14 +3978,26 @@
3979
3978
  this.updateVariables();
3980
3979
  }
3981
3980
  };
3981
+ BignumberInputDirective.prototype.onKeypress = function (event) {
3982
+ var code = event.code;
3983
+ if (code === "Minus" || code === "NumpadSubtract") {
3984
+ if (this.allowNegative) {
3985
+ this.maxLength = this._maxLength + 1;
3986
+ }
3987
+ }
3988
+ else if (code === "Equal" || code === "NumpadAdd") {
3989
+ this.maxLength = this._maxLength;
3990
+ }
3991
+ };
3982
3992
  /**
3983
3993
  * Update the options values according to the directive input values.
3984
3994
  */
3985
3995
  BignumberInputDirective.prototype.updateVariables = function () {
3996
+ var _a;
3986
3997
  this.options = {
3987
3998
  align: this.alignTo,
3988
3999
  decimalSeparator: this.decimalSeparator,
3989
- thousandsSeparator: this.thousandsSeparator,
4000
+ thousandsSeparator: (_a = this.thousandsSeparator) !== null && _a !== void 0 ? _a : ".",
3990
4001
  scale: this.scale || 0,
3991
4002
  prefix: "",
3992
4003
  suffix: "",
@@ -3998,10 +4009,12 @@
3998
4009
  * Responsible to calculate the field maximum length considering the separators.
3999
4010
  */
4000
4011
  BignumberInputDirective.prototype.calculateMaxLength = function () {
4012
+ var _a, _b;
4001
4013
  var decSepLength = this.decimalSeparator.length;
4002
- var thoSepLength = this.thousandsSeparator.length;
4014
+ var thoSepLength = (_b = (_a = this.thousandsSeparator) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1;
4003
4015
  var maxLength = this.precision + (this.scale ? decSepLength : 0);
4004
4016
  maxLength += Math.ceil((this.precision - (this.scale ? this.scale : 0)) / 3 - 1) * thoSepLength;
4017
+ this._maxLength = maxLength;
4005
4018
  this.maxLength = maxLength;
4006
4019
  };
4007
4020
  var BignumberInputDirective_1;
@@ -4030,6 +4043,9 @@
4030
4043
  __decorate([
4031
4044
  core.HostBinding("attr.maxLength")
4032
4045
  ], BignumberInputDirective.prototype, "maxLength", void 0);
4046
+ __decorate([
4047
+ core.HostListener("keypress", ["$event"])
4048
+ ], BignumberInputDirective.prototype, "onKeypress", null);
4033
4049
  BignumberInputDirective = BignumberInputDirective_1 = __decorate([
4034
4050
  core.Directive({
4035
4051
  selector: "input[sBignumberInput]",