@esri/calcite-components 1.0.0-next.355 → 1.0.0-next.356
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/calcite/assets/calcite-icon/rightAlign16.json +1 -0
- package/dist/calcite/assets/calcite-icon/rightAlign24.json +1 -0
- package/dist/calcite/assets/calcite-icon/rightAlign32.json +1 -0
- package/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/calcite.js +1 -1
- package/dist/calcite/{p-5044316a.system.entry.js → p-0ac72794.system.entry.js} +1 -1
- package/dist/calcite/{p-1d59e70a.system.entry.js → p-0b187e6a.system.entry.js} +1 -1
- package/dist/calcite/p-0d9a5d78.entry.js +5 -0
- package/dist/calcite/p-12c57970.js +5 -0
- package/dist/calcite/{p-2787571e.system.entry.js → p-2c3bbbb4.system.entry.js} +2 -2
- package/dist/calcite/{p-b57ddca8.entry.js → p-3366ef60.entry.js} +1 -1
- package/dist/calcite/p-3c34f20d.system.js +5 -0
- package/dist/calcite/{p-be8c7dbb.system.entry.js → p-3f51ac4b.system.entry.js} +1 -1
- package/dist/calcite/{p-52966b4c.js → p-4f9b0b0f.js} +1 -1
- package/dist/calcite/{p-d6e20af1.system.entry.js → p-4fee156d.system.entry.js} +1 -1
- package/dist/calcite/{p-c25f34d6.entry.js → p-55e6b0b2.entry.js} +1 -1
- package/dist/calcite/{p-7f68da96.entry.js → p-5d9fe852.entry.js} +1 -1
- package/dist/calcite/p-6173cf08.system.js +5 -0
- package/dist/calcite/{p-23a085a3.system.entry.js → p-748c198c.system.entry.js} +1 -1
- package/dist/calcite/{p-3e308abf.system.entry.js → p-7a2142c2.system.entry.js} +1 -1
- package/dist/calcite/p-83d41684.entry.js +5 -0
- package/dist/calcite/{p-cf9debce.entry.js → p-92ad7d95.entry.js} +1 -1
- package/dist/calcite/{p-18d9a261.system.js → p-99d32fc3.system.js} +1 -1
- package/dist/calcite/{p-da3b96f9.entry.js → p-d00fbd1e.entry.js} +1 -1
- package/dist/calcite/{p-834ec82a.system.js → p-d4bafc77.system.js} +1 -1
- package/dist/calcite/{p-a918eec6.entry.js → p-d8653ba3.entry.js} +1 -1
- package/dist/calcite/p-dd9f2e61.js +5 -0
- package/dist/calcite/{p-15bc7ccd.system.entry.js → p-e8270c76.system.entry.js} +1 -1
- package/dist/calcite/p-f3d02833.js +5 -0
- package/dist/calcite/p-fcde21ce.system.js +5 -0
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-date-picker_4.cjs.entry.js +3 -3
- package/dist/cjs/calcite-dropdown_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-input-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +4 -4
- package/dist/cjs/calcite-input.cjs.entry.js +10 -2
- package/dist/cjs/calcite-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/calcite-tooltip_2.cjs.entry.js +1 -1
- package/dist/cjs/calcite.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/locale-b9b153dd.js +127 -0
- package/dist/cjs/number-e813e801.js +84 -0
- package/dist/cjs/{popper-ccef76e3.js → popper-adfdc032.js} +28 -9
- package/dist/cjs/{resources-d3c42dc4.js → resources-c524c005.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rightAlign32.json +1 -0
- package/dist/collection/components/calcite-input/calcite-input.js +8 -0
- package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +2 -2
- package/dist/collection/components/calcite-time-picker/calcite-time-picker.js +4 -4
- package/dist/collection/utils/locale.js +42 -38
- package/dist/collection/utils/number.js +41 -23
- package/dist/components/calcite-input-time-picker.js +1 -1
- package/dist/components/calcite-input2.js +8 -0
- package/dist/components/calcite-time-picker2.js +3 -3
- package/dist/components/locale.js +42 -38
- package/dist/components/number.js +42 -24
- package/dist/components/popper.js +28 -9
- package/dist/custom-elements/index.js +121 -72
- package/dist/esm/calcite-combobox_3.entry.js +1 -1
- package/dist/esm/calcite-date-picker_4.entry.js +3 -3
- package/dist/esm/calcite-dropdown_3.entry.js +1 -1
- package/dist/esm/calcite-input-date-picker.entry.js +4 -4
- package/dist/esm/calcite-input-time-picker_2.entry.js +4 -4
- package/dist/esm/calcite-input.entry.js +10 -2
- package/dist/esm/calcite-popover_2.entry.js +1 -1
- package/dist/esm/calcite-tooltip_2.entry.js +1 -1
- package/dist/esm/calcite.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/locale-1b48f64f.js +122 -0
- package/dist/esm/number-8779395f.js +76 -0
- package/dist/esm/{popper-405efdae.js → popper-1814b3c1.js} +28 -9
- package/dist/esm/{resources-421133b2.js → resources-74c807b4.js} +1 -1
- package/dist/esm-es5/calcite-combobox_3.entry.js +1 -1
- package/dist/esm-es5/calcite-date-picker_4.entry.js +2 -2
- package/dist/esm-es5/calcite-dropdown_3.entry.js +1 -1
- package/dist/esm-es5/calcite-input-date-picker.entry.js +1 -1
- package/dist/esm-es5/calcite-input-time-picker_2.entry.js +1 -1
- package/dist/esm-es5/calcite-input.entry.js +1 -1
- package/dist/esm-es5/calcite-popover_2.entry.js +2 -2
- package/dist/esm-es5/calcite-tooltip_2.entry.js +1 -1
- package/dist/esm-es5/locale-1b48f64f.js +5 -0
- package/dist/esm-es5/number-8779395f.js +5 -0
- package/dist/esm-es5/popper-1814b3c1.js +5 -0
- package/dist/esm-es5/{resources-421133b2.js → resources-74c807b4.js} +1 -1
- package/dist/extras/docs-json.json +5 -5
- package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +1 -1
- package/dist/types/components/calcite-pick-list/shared-list-render.d.ts +2 -2
- package/dist/types/components/calcite-time-picker/calcite-time-picker.d.ts +2 -2
- package/dist/types/components.d.ts +6 -6
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/utils/number.d.ts +2 -1
- package/hydrate/index.js +122 -73
- package/package.json +14 -14
- package/dist/calcite/p-0140ba79.entry.js +0 -5
- package/dist/calcite/p-11b9e4bb.system.js +0 -5
- package/dist/calcite/p-18c4af8f.system.js +0 -5
- package/dist/calcite/p-22523fc5.entry.js +0 -5
- package/dist/calcite/p-6d0d9bba.js +0 -5
- package/dist/calcite/p-8396a2d2.js +0 -5
- package/dist/calcite/p-91300144.js +0 -5
- package/dist/calcite/p-fc998713.system.js +0 -5
- package/dist/cjs/locale-ccfa66f6.js +0 -123
- package/dist/cjs/number-f57fd111.js +0 -65
- package/dist/esm/locale-86b789f9.js +0 -118
- package/dist/esm/number-eb92427e.js +0 -58
- package/dist/esm-es5/locale-86b789f9.js +0 -5
- package/dist/esm-es5/number-eb92427e.js +0 -5
- package/dist/esm-es5/popper-405efdae.js +0 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { sanitizeDecimalString } from "./number";
|
|
5
|
+
import { sanitizeDecimalString, sanitizeExponentialNumberString } from "./number";
|
|
6
6
|
export const locales = [
|
|
7
7
|
"ar",
|
|
8
8
|
"bs",
|
|
@@ -60,23 +60,25 @@ function createLocaleNumberFormatter(locale) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export function delocalizeNumberString(numberString, locale) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
64
|
+
if (nonExpoNumString) {
|
|
65
|
+
const groupSeparator = getGroupSeparator(locale);
|
|
66
|
+
const decimalSeparator = getDecimalSeparator(locale);
|
|
67
|
+
const splitNumberString = nonExpoNumString.split("");
|
|
68
|
+
const decimalIndex = splitNumberString.lastIndexOf(decimalSeparator);
|
|
69
|
+
const delocalizedNumberString = splitNumberString
|
|
70
|
+
.map((value, index) => {
|
|
71
|
+
if (value === groupSeparator || (value === decimalSeparator && index !== decimalIndex)) {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
return value;
|
|
75
|
+
})
|
|
76
|
+
.reduce((string, part) => string + part)
|
|
77
|
+
.replace(decimalSeparator, ".");
|
|
78
|
+
return isNaN(Number(delocalizedNumberString)) ? nonExpoNumString : delocalizedNumberString;
|
|
79
|
+
}
|
|
80
|
+
return nonExpoNumString;
|
|
81
|
+
});
|
|
80
82
|
}
|
|
81
83
|
export function getGroupSeparator(locale) {
|
|
82
84
|
const formatter = createLocaleNumberFormatter(locale);
|
|
@@ -91,25 +93,27 @@ export function getDecimalSeparator(locale) {
|
|
|
91
93
|
return value.trim().length === 0 ? " " : value;
|
|
92
94
|
}
|
|
93
95
|
export function localizeNumberString(numberString, locale, displayGroupSeparator = false) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
96
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
97
|
+
if (nonExpoNumString) {
|
|
98
|
+
const number = Number(sanitizeDecimalString(nonExpoNumString));
|
|
99
|
+
if (!isNaN(number)) {
|
|
100
|
+
const formatter = createLocaleNumberFormatter(locale);
|
|
101
|
+
const parts = formatter.formatToParts(number);
|
|
102
|
+
const localizedNumberString = parts
|
|
103
|
+
.map(({ type, value }) => {
|
|
104
|
+
switch (type) {
|
|
105
|
+
case "group":
|
|
106
|
+
return displayGroupSeparator ? getGroupSeparator(locale) : "";
|
|
107
|
+
case "decimal":
|
|
108
|
+
return getDecimalSeparator(locale);
|
|
109
|
+
default:
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.reduce((string, part) => string + part);
|
|
114
|
+
return localizedNumberString;
|
|
115
|
+
}
|
|
116
|
+
return nonExpoNumString;
|
|
112
117
|
}
|
|
113
|
-
}
|
|
114
|
-
return numberString;
|
|
118
|
+
});
|
|
115
119
|
}
|
|
@@ -10,21 +10,23 @@ export function parseNumberString(numberString) {
|
|
|
10
10
|
if (!numberString || !stringContainsNumbers(numberString)) {
|
|
11
11
|
return "";
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
containsDecimal
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
14
|
+
let containsDecimal = false;
|
|
15
|
+
const result = nonExpoNumString
|
|
16
|
+
.split("")
|
|
17
|
+
.filter((value, i) => {
|
|
18
|
+
if (value.match(/\./g) && !containsDecimal) {
|
|
19
|
+
containsDecimal = true;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (value.match(/\-/g) && i === 0) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return numberKeys.includes(value);
|
|
26
|
+
})
|
|
27
|
+
.reduce((string, part) => string + part);
|
|
28
|
+
return isValidNumber(result) ? Number(result).toString() : null;
|
|
29
|
+
});
|
|
28
30
|
}
|
|
29
31
|
export function sanitizeDecimalString(decimalString) {
|
|
30
32
|
const decimalAtEndOfStringButNotStart = /(?!^\.)\.$/;
|
|
@@ -38,14 +40,30 @@ export function sanitizeLeadingZeroString(zeroString) {
|
|
|
38
40
|
const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
|
|
39
41
|
return zeroString.replace(allLeadingZerosOptionallyNegative, "$1");
|
|
40
42
|
}
|
|
41
|
-
export function sanitizeNumberString(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? sanitizedValue
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
export function sanitizeNumberString(numberString) {
|
|
44
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
45
|
+
const sanitizedValue = sanitizeNegativeString(sanitizeDecimalString(sanitizeLeadingZeroString(nonExpoNumString)));
|
|
46
|
+
const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
|
|
47
|
+
return isValidNumber(sanitizedValue)
|
|
48
|
+
? isNegativeDecimalOnlyZeros.test(sanitizedValue)
|
|
49
|
+
? sanitizedValue
|
|
50
|
+
: Number(sanitizedValue).toString()
|
|
51
|
+
: nonExpoNumString;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export function sanitizeExponentialNumberString(numberString, func) {
|
|
55
|
+
if (!numberString) {
|
|
56
|
+
return numberString;
|
|
57
|
+
}
|
|
58
|
+
const firstE = numberString.toLowerCase().indexOf("e") + 1;
|
|
59
|
+
return numberString
|
|
60
|
+
.replace(/[eE]*$/g, "")
|
|
61
|
+
.substring(0, firstE)
|
|
62
|
+
.concat(numberString.slice(firstE).replace(/[eE]/g, ""))
|
|
63
|
+
.split(/[eE]/)
|
|
64
|
+
.map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
|
|
65
|
+
.join("e")
|
|
66
|
+
.replace(/^e/, "1e");
|
|
49
67
|
}
|
|
50
68
|
function stringContainsNumbers(string) {
|
|
51
69
|
return numberKeys.some((number) => string.includes(number));
|
|
@@ -46,7 +46,7 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
46
46
|
this.scale = "m";
|
|
47
47
|
/** number (seconds) that specifies the granularity that the value must adhere to */
|
|
48
48
|
this.step = 60;
|
|
49
|
-
/** The selected time (always 24-hour format)*/
|
|
49
|
+
/** The selected time in UTC (always 24-hour format) */
|
|
50
50
|
this.value = null;
|
|
51
51
|
/** whether the value of the input was changed as a result of user typing or not */
|
|
52
52
|
this.internalValueChange = false;
|
|
@@ -224,6 +224,14 @@ let CalciteInput = class extends HTMLElement {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
+
if (/[eE]/.test(event.key)) {
|
|
228
|
+
if (!this.value && !this.childNumberEl.value) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
227
235
|
event.preventDefault();
|
|
228
236
|
};
|
|
229
237
|
this.nudgeNumberValue = (direction, nativeEvent) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
5
|
import { HTMLElement, createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
|
|
6
|
-
import { i as isValidNumber, n as numberKeys,
|
|
6
|
+
import { i as isValidNumber, n as numberKeys, c as isActivationKey } from './number.js';
|
|
7
7
|
import { d as defineCustomElement$1 } from './calcite-icon2.js';
|
|
8
8
|
|
|
9
9
|
const maxTenthForMinuteAndSecond = 5;
|
|
@@ -285,9 +285,9 @@ let CalciteTimePicker = class extends HTMLElement {
|
|
|
285
285
|
this.locale = document.documentElement.lang || navigator.language || "en";
|
|
286
286
|
/** The scale (size) of the time picker */
|
|
287
287
|
this.scale = "m";
|
|
288
|
-
/** number that specifies the granularity that the value must adhere to */
|
|
288
|
+
/** number (seconds) that specifies the granularity that the value must adhere to */
|
|
289
289
|
this.step = 60;
|
|
290
|
-
/** The selected time in UTC */
|
|
290
|
+
/** The selected time in UTC (always 24-hour format) */
|
|
291
291
|
this.value = null;
|
|
292
292
|
this.showSecond = this.step < 60;
|
|
293
293
|
this.decrementHour = () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { a as sanitizeDecimalString } from './number.js';
|
|
5
|
+
import { a as sanitizeExponentialNumberString, b as sanitizeDecimalString } from './number.js';
|
|
6
6
|
|
|
7
7
|
const locales = [
|
|
8
8
|
"ar",
|
|
@@ -61,23 +61,25 @@ function createLocaleNumberFormatter(locale) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
function delocalizeNumberString(numberString, locale) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
65
|
+
if (nonExpoNumString) {
|
|
66
|
+
const groupSeparator = getGroupSeparator(locale);
|
|
67
|
+
const decimalSeparator = getDecimalSeparator(locale);
|
|
68
|
+
const splitNumberString = nonExpoNumString.split("");
|
|
69
|
+
const decimalIndex = splitNumberString.lastIndexOf(decimalSeparator);
|
|
70
|
+
const delocalizedNumberString = splitNumberString
|
|
71
|
+
.map((value, index) => {
|
|
72
|
+
if (value === groupSeparator || (value === decimalSeparator && index !== decimalIndex)) {
|
|
73
|
+
return "";
|
|
74
|
+
}
|
|
75
|
+
return value;
|
|
76
|
+
})
|
|
77
|
+
.reduce((string, part) => string + part)
|
|
78
|
+
.replace(decimalSeparator, ".");
|
|
79
|
+
return isNaN(Number(delocalizedNumberString)) ? nonExpoNumString : delocalizedNumberString;
|
|
80
|
+
}
|
|
81
|
+
return nonExpoNumString;
|
|
82
|
+
});
|
|
81
83
|
}
|
|
82
84
|
function getGroupSeparator(locale) {
|
|
83
85
|
const formatter = createLocaleNumberFormatter(locale);
|
|
@@ -92,27 +94,29 @@ function getDecimalSeparator(locale) {
|
|
|
92
94
|
return value.trim().length === 0 ? " " : value;
|
|
93
95
|
}
|
|
94
96
|
function localizeNumberString(numberString, locale, displayGroupSeparator = false) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
98
|
+
if (nonExpoNumString) {
|
|
99
|
+
const number = Number(sanitizeDecimalString(nonExpoNumString));
|
|
100
|
+
if (!isNaN(number)) {
|
|
101
|
+
const formatter = createLocaleNumberFormatter(locale);
|
|
102
|
+
const parts = formatter.formatToParts(number);
|
|
103
|
+
const localizedNumberString = parts
|
|
104
|
+
.map(({ type, value }) => {
|
|
105
|
+
switch (type) {
|
|
106
|
+
case "group":
|
|
107
|
+
return displayGroupSeparator ? getGroupSeparator(locale) : "";
|
|
108
|
+
case "decimal":
|
|
109
|
+
return getDecimalSeparator(locale);
|
|
110
|
+
default:
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
.reduce((string, part) => string + part);
|
|
115
|
+
return localizedNumberString;
|
|
116
|
+
}
|
|
117
|
+
return nonExpoNumString;
|
|
113
118
|
}
|
|
114
|
-
}
|
|
115
|
-
return numberString;
|
|
119
|
+
});
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
export { locales as a, delocalizeNumberString as d, getDecimalSeparator as g, localizeNumberString as l };
|
|
@@ -14,21 +14,23 @@ function parseNumberString(numberString) {
|
|
|
14
14
|
if (!numberString || !stringContainsNumbers(numberString)) {
|
|
15
15
|
return "";
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
containsDecimal
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
18
|
+
let containsDecimal = false;
|
|
19
|
+
const result = nonExpoNumString
|
|
20
|
+
.split("")
|
|
21
|
+
.filter((value, i) => {
|
|
22
|
+
if (value.match(/\./g) && !containsDecimal) {
|
|
23
|
+
containsDecimal = true;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (value.match(/\-/g) && i === 0) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return numberKeys.includes(value);
|
|
30
|
+
})
|
|
31
|
+
.reduce((string, part) => string + part);
|
|
32
|
+
return isValidNumber(result) ? Number(result).toString() : null;
|
|
33
|
+
});
|
|
32
34
|
}
|
|
33
35
|
function sanitizeDecimalString(decimalString) {
|
|
34
36
|
const decimalAtEndOfStringButNotStart = /(?!^\.)\.$/;
|
|
@@ -42,17 +44,33 @@ function sanitizeLeadingZeroString(zeroString) {
|
|
|
42
44
|
const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
|
|
43
45
|
return zeroString.replace(allLeadingZerosOptionallyNegative, "$1");
|
|
44
46
|
}
|
|
45
|
-
function sanitizeNumberString(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
? sanitizedValue
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
function sanitizeNumberString(numberString) {
|
|
48
|
+
return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
|
|
49
|
+
const sanitizedValue = sanitizeNegativeString(sanitizeDecimalString(sanitizeLeadingZeroString(nonExpoNumString)));
|
|
50
|
+
const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
|
|
51
|
+
return isValidNumber(sanitizedValue)
|
|
52
|
+
? isNegativeDecimalOnlyZeros.test(sanitizedValue)
|
|
53
|
+
? sanitizedValue
|
|
54
|
+
: Number(sanitizedValue).toString()
|
|
55
|
+
: nonExpoNumString;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function sanitizeExponentialNumberString(numberString, func) {
|
|
59
|
+
if (!numberString) {
|
|
60
|
+
return numberString;
|
|
61
|
+
}
|
|
62
|
+
const firstE = numberString.toLowerCase().indexOf("e") + 1;
|
|
63
|
+
return numberString
|
|
64
|
+
.replace(/[eE]*$/g, "")
|
|
65
|
+
.substring(0, firstE)
|
|
66
|
+
.concat(numberString.slice(firstE).replace(/[eE]/g, ""))
|
|
67
|
+
.split(/[eE]/)
|
|
68
|
+
.map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
|
|
69
|
+
.join("e")
|
|
70
|
+
.replace(/^e/, "1e");
|
|
53
71
|
}
|
|
54
72
|
function stringContainsNumbers(string) {
|
|
55
73
|
return numberKeys.some((number) => string.includes(number));
|
|
56
74
|
}
|
|
57
75
|
|
|
58
|
-
export {
|
|
76
|
+
export { sanitizeExponentialNumberString as a, sanitizeDecimalString as b, isActivationKey as c, isValidNumber as i, numberKeys as n, parseNumberString as p, sanitizeNumberString as s };
|
|
@@ -487,13 +487,21 @@ function mapToStyles(_ref2) {
|
|
|
487
487
|
adaptive = _ref2.adaptive,
|
|
488
488
|
roundOffsets = _ref2.roundOffsets,
|
|
489
489
|
isFixed = _ref2.isFixed;
|
|
490
|
+
var _offsets$x = offsets.x,
|
|
491
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
492
|
+
_offsets$y = offsets.y,
|
|
493
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
490
494
|
|
|
491
|
-
var _ref3 =
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
495
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
496
|
+
x: x,
|
|
497
|
+
y: y
|
|
498
|
+
}) : {
|
|
499
|
+
x: x,
|
|
500
|
+
y: y
|
|
501
|
+
};
|
|
496
502
|
|
|
503
|
+
x = _ref3.x;
|
|
504
|
+
y = _ref3.y;
|
|
497
505
|
var hasX = offsets.hasOwnProperty('x');
|
|
498
506
|
var hasY = offsets.hasOwnProperty('y');
|
|
499
507
|
var sideX = left;
|
|
@@ -538,6 +546,17 @@ function mapToStyles(_ref2) {
|
|
|
538
546
|
position: position
|
|
539
547
|
}, adaptive && unsetSides);
|
|
540
548
|
|
|
549
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
550
|
+
x: x,
|
|
551
|
+
y: y
|
|
552
|
+
}) : {
|
|
553
|
+
x: x,
|
|
554
|
+
y: y
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
x = _ref4.x;
|
|
558
|
+
y = _ref4.y;
|
|
559
|
+
|
|
541
560
|
if (gpuAcceleration) {
|
|
542
561
|
var _Object$assign;
|
|
543
562
|
|
|
@@ -547,9 +566,9 @@ function mapToStyles(_ref2) {
|
|
|
547
566
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
548
567
|
}
|
|
549
568
|
|
|
550
|
-
function computeStyles(
|
|
551
|
-
var state =
|
|
552
|
-
options =
|
|
569
|
+
function computeStyles(_ref5) {
|
|
570
|
+
var state = _ref5.state,
|
|
571
|
+
options = _ref5.options;
|
|
553
572
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
554
573
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
555
574
|
_options$adaptive = options.adaptive,
|
|
@@ -838,7 +857,7 @@ function getClippingParents(element) {
|
|
|
838
857
|
|
|
839
858
|
|
|
840
859
|
return clippingParents.filter(function (clippingParent) {
|
|
841
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'
|
|
860
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
842
861
|
});
|
|
843
862
|
} // Gets the maximum area that the element is visible in due to any number of
|
|
844
863
|
// clipping parents
|