@syncfusion/ej2-inputs 31.1.22 → 31.2.2
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.
- package/dist/ej2-inputs.min.js +2 -2
- package/dist/ej2-inputs.umd.min.js +2 -2
- package/dist/ej2-inputs.umd.min.js.map +1 -1
- package/dist/es6/ej2-inputs.es2015.js +60 -8
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +57 -5
- package/dist/es6/ej2-inputs.es5.js.map +1 -1
- package/dist/global/ej2-inputs.min.js +2 -2
- package/dist/global/ej2-inputs.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/numerictextbox/numerictextbox.d.ts +2 -0
- package/src/numerictextbox/numerictextbox.js +55 -3
- package/src/uploader/uploader.js +2 -2
- package/styles/bootstrap4.css +1 -1
- package/styles/input/_bootstrap4-definition.scss +1 -1
- package/styles/input/bootstrap4.css +1 -1
|
@@ -1892,6 +1892,9 @@ var NumericTextBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1892
1892
|
if (this.value || this.value === 0) {
|
|
1893
1893
|
var value = this.formatNumber();
|
|
1894
1894
|
var elementValue = this.isFocused ? value : this.instance.getNumberFormat(this.cultureInfo)(this.value);
|
|
1895
|
+
if (/[eE]/.test(value)) {
|
|
1896
|
+
elementValue = this.formatScientificNotation(elementValue);
|
|
1897
|
+
}
|
|
1895
1898
|
this.setElementValue(elementValue);
|
|
1896
1899
|
attributes(this.element, { 'aria-valuenow': value });
|
|
1897
1900
|
if (!isNullOrUndefined(this.hiddenInput)) {
|
|
@@ -1923,9 +1926,17 @@ var NumericTextBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1923
1926
|
var EXPREGEXP = new RegExp('[eE][\-+]?([0-9]+)');
|
|
1924
1927
|
var valueString = value.toString();
|
|
1925
1928
|
if (EXPREGEXP.test(valueString)) {
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
valueString
|
|
1929
|
+
if (/[eE]/.test(valueString)) {
|
|
1930
|
+
valueString = value.toFixed(20).replace(/0+$/, '');
|
|
1931
|
+
if (valueString.charAt(valueString.length - 1) === '.') {
|
|
1932
|
+
valueString = valueString.slice(0, valueString.length - 1);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
else {
|
|
1936
|
+
var result = EXPREGEXP.exec(valueString);
|
|
1937
|
+
if (!isNullOrUndefined(result)) {
|
|
1938
|
+
valueString = value.toFixed(Math.min(parseInt(result[1], 10), 20));
|
|
1939
|
+
}
|
|
1929
1940
|
}
|
|
1930
1941
|
}
|
|
1931
1942
|
var decimalPart = valueString.split('.')[1];
|
|
@@ -1937,6 +1948,7 @@ var NumericTextBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1937
1948
|
};
|
|
1938
1949
|
NumericTextBox.prototype.formatNumber = function () {
|
|
1939
1950
|
var numberOfDecimals = this.getNumberOfDecimals(this.value);
|
|
1951
|
+
this.storedValueString = this.value.toString();
|
|
1940
1952
|
return this.instance.getNumberFormat({
|
|
1941
1953
|
maximumFractionDigits: numberOfDecimals,
|
|
1942
1954
|
minimumFractionDigits: numberOfDecimals, useGrouping: false
|
|
@@ -2050,6 +2062,9 @@ var NumericTextBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
2050
2062
|
this.prevValue = this.value;
|
|
2051
2063
|
if ((this.value || this.value === 0)) {
|
|
2052
2064
|
var formatValue_1 = this.formatNumber();
|
|
2065
|
+
if (/[eE]/.test(this.value.toString())) {
|
|
2066
|
+
formatValue_1 = this.formatScientificNotation(formatValue_1);
|
|
2067
|
+
}
|
|
2053
2068
|
this.setElementValue(formatValue_1);
|
|
2054
2069
|
if (!this.isPrevFocused) {
|
|
2055
2070
|
if (!Browser.isDevice && Browser.info.version === '11.0') {
|
|
@@ -2092,6 +2107,9 @@ var NumericTextBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
2092
2107
|
this.setProperties({ value: null }, true);
|
|
2093
2108
|
}
|
|
2094
2109
|
var parsedInput = this.instance.getNumberParser({ format: 'n' })(this.element.value);
|
|
2110
|
+
if (/[eE]/.test(this.element.value)) {
|
|
2111
|
+
parsedInput = parseFloat(this.formatScientificNotation(this.element.value));
|
|
2112
|
+
}
|
|
2095
2113
|
this.updateValue(parsedInput);
|
|
2096
2114
|
if (!Browser.isDevice) {
|
|
2097
2115
|
EventHandler.remove(this.element, 'mousewheel DOMMouseScroll', this.mouseWheel);
|
|
@@ -2193,6 +2211,40 @@ var NumericTextBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
2193
2211
|
EventHandler.remove(this.spinDown, 'mouseleave', this.mouseUpClick);
|
|
2194
2212
|
}
|
|
2195
2213
|
};
|
|
2214
|
+
NumericTextBox.prototype.formatScientificNotation = function (value) {
|
|
2215
|
+
value = this.storedValueString ? this.storedValueString : value;
|
|
2216
|
+
var _a = value.toLowerCase().split('e'), base = _a[0], exponentPart = _a[1];
|
|
2217
|
+
var exponent = parseInt(exponentPart, 10);
|
|
2218
|
+
var match = this.format.match(/n(\d+)/i);
|
|
2219
|
+
var requiredDigits = match ? parseInt(match[1], 10) : 10;
|
|
2220
|
+
var baseDigits = base.replace('.', '');
|
|
2221
|
+
var fullDecimal;
|
|
2222
|
+
if (exponent < 0) {
|
|
2223
|
+
var zerosCount = Math.abs(Number(exponent)) - 1;
|
|
2224
|
+
var limitedZeros = '0'.repeat(Math.min(zerosCount, requiredDigits));
|
|
2225
|
+
fullDecimal = '0.' + limitedZeros + baseDigits;
|
|
2226
|
+
}
|
|
2227
|
+
else {
|
|
2228
|
+
var _b = base.split('.'), intPart_1 = _b[0], _c = _b[1], decPart_1 = _c === void 0 ? '' : _c;
|
|
2229
|
+
var shift = exponent - decPart_1.length;
|
|
2230
|
+
if (shift >= 0) {
|
|
2231
|
+
fullDecimal = intPart_1 + decPart_1 + '0'.repeat(shift);
|
|
2232
|
+
}
|
|
2233
|
+
else {
|
|
2234
|
+
var newDec = decPart_1.slice(0, exponent) + '.' + decPart_1.slice(exponent);
|
|
2235
|
+
fullDecimal = intPart_1 + newDec;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
var _d = fullDecimal.split('.'), intPart = _d[0], _e = _d[1], decPart = _e === void 0 ? '' : _e;
|
|
2239
|
+
if (this.isFocused) {
|
|
2240
|
+
var limitedDecimal = decPart.slice(0, requiredDigits);
|
|
2241
|
+
return intPart + "." + decPart;
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
var formattedDecimal = decPart.padEnd(requiredDigits, '0').slice(0, requiredDigits);
|
|
2245
|
+
return intPart + "." + formattedDecimal;
|
|
2246
|
+
}
|
|
2247
|
+
};
|
|
2196
2248
|
/**
|
|
2197
2249
|
* Increments the NumericTextBox value with the specified step value.
|
|
2198
2250
|
*
|
|
@@ -10216,7 +10268,7 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
|
|
|
10216
10268
|
var progressbarWrapper = this.createElement('span', { className: PROGRESS_WRAPPER });
|
|
10217
10269
|
var progressBar = this.createElement('progressbar', { className: PROGRESSBAR, attrs: { value: '0', max: '100' } });
|
|
10218
10270
|
var progressbarInnerWrapper = this.createElement('span', { className: PROGRESS_INNER_WRAPPER });
|
|
10219
|
-
progressBar.
|
|
10271
|
+
progressBar.style.width = '0%';
|
|
10220
10272
|
var progressbarText = this.createElement('span', { className: PROGRESSBAR_TEXT });
|
|
10221
10273
|
progressbarText.textContent = '0%';
|
|
10222
10274
|
progressbarInnerWrapper.appendChild(progressBar);
|
|
@@ -10239,7 +10291,7 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
|
|
|
10239
10291
|
}
|
|
10240
10292
|
};
|
|
10241
10293
|
Uploader.prototype.changeProgressValue = function (li, progressValue) {
|
|
10242
|
-
li.querySelector('.' + PROGRESSBAR).
|
|
10294
|
+
li.querySelector('.' + PROGRESSBAR).style.width = progressValue;
|
|
10243
10295
|
li.querySelector('.' + PROGRESSBAR_TEXT).textContent = progressValue;
|
|
10244
10296
|
};
|
|
10245
10297
|
Uploader.prototype.uploadInProgress = function (e, files, customUI, request) {
|