monkey-style-guide 2.0.83 → 2.0.84

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.
@@ -2265,11 +2265,14 @@
2265
2265
  }
2266
2266
  return value;
2267
2267
  };
2268
+ MonkeyInputComponent.prototype.replaceZero = function (value) {
2269
+ return ("" + value).replace(new RegExp(/0/, 'g'), '');
2270
+ };
2268
2271
  MonkeyInputComponent.prototype.formatValue = function (value) {
2269
2272
  var _a, _b;
2270
2273
  var settings = this.settings;
2271
2274
  if (this.currency) {
2272
- if (!value)
2275
+ if (!value || !this.replaceZero(value))
2273
2276
  return '';
2274
2277
  return this.currencyPipe.transform(value, ((_a = settings === null || settings === void 0 ? void 0 : settings.currency) === null || _a === void 0 ? void 0 : _a.code) || 'BRL', '', '1.2-2', ((_b = settings === null || settings === void 0 ? void 0 : settings.currency) === null || _b === void 0 ? void 0 : _b.locale) || 'pt-BR');
2275
2278
  }
@@ -2342,10 +2345,16 @@
2342
2345
  (_c = (_b = (_a = document === null || document === void 0 ? void 0 : document.getElementById(this._id)) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('input')) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.focus();
2343
2346
  };
2344
2347
  MonkeyInputComponent.prototype.onKeyPress = function (event) {
2348
+ var _a;
2345
2349
  var pattern = null;
2350
+ var cmp = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value;
2346
2351
  var inputChar = String.fromCharCode(event.charCode);
2347
2352
  if (this.currency || this.onlyNumber || this.percent) {
2348
2353
  pattern = /[0-9]/;
2354
+ if (inputChar === '0' && !this.replaceZero(cmp)) {
2355
+ event.preventDefault();
2356
+ return;
2357
+ }
2349
2358
  }
2350
2359
  else if (this.onlyAlphaNumeric) {
2351
2360
  pattern = /[^0-9A-Za-z]/;