intelicoreact 1.1.5 → 1.1.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.
@@ -33,7 +33,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
33
33
 
34
34
  var getFileName = function getFileName(value) {
35
35
  var result = value.match(/[^\\]+$/);
36
- return result[0];
36
+ return result === null || result === void 0 ? void 0 : result[0];
37
37
  };
38
38
 
39
39
  var renderRequiredLabel = function renderRequiredLabel() {
@@ -80,6 +80,9 @@ var intlNumbersFormatter = function intlNumbersFormatter(inputValue) {
80
80
  var quantity = fractionDigits.quantity,
81
81
  _fractionDigits$isRen = fractionDigits.isRenderAlways,
82
82
  isRenderAlways = _fractionDigits$isRen === void 0 ? false : _fractionDigits$isRen;
83
+ var dotIndex = inputValue === null || inputValue === void 0 ? void 0 : inputValue.indexOf('.');
84
+ var afterDot = dotIndex !== -1 ? inputValue.slice(dotIndex + 1) : '';
85
+ var minimumFractionDigits = afterDot && lastSym !== '.' ? inputValue.slice(dotIndex).length - 1 : isRenderAlways ? quantity : 0;
83
86
  var priceSettings = {
84
87
  useGrouping: useGrouping,
85
88
  //группировка разрядов
@@ -90,11 +93,19 @@ var intlNumbersFormatter = function intlNumbersFormatter(inputValue) {
90
93
  currencyDisplay: currencyDisplay,
91
94
  //валюта в виде символа
92
95
  //минимально не надо отображать центы, если их нет, иначе всегда будет .00
93
- minimumFractionDigits: isRenderAlways ? quantity : 0,
96
+ minimumFractionDigits: minimumFractionDigits,
94
97
  maximumFractionDigits: quantity //максимально отображать 2 цифры после запятой, если центы всё же есть
95
98
 
96
99
  };
97
- var output = new Intl.NumberFormat(locale, priceSettings).format(value);
100
+ var output;
101
+
102
+ try {
103
+ output = new Intl.NumberFormat(locale, priceSettings).format(value);
104
+ } catch (e) {
105
+ output = value;
106
+ console.warn('Intl.NumberFormat error', e);
107
+ }
108
+
98
109
  return lastSym === '.' ? output + lastSym : output;
99
110
  }; // *** format ***
100
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [