numora 2.0.2 → 2.0.4
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/index.js +1 -1
- package/dist/index.mjs +460 -487
- package/package.json +1 -1
- package/dist/NumoraInput.d.ts +0 -72
- package/dist/config.d.ts +0 -11
- package/dist/features/compact-notation.d.ts +0 -17
- package/dist/features/decimals.d.ts +0 -52
- package/dist/features/formatting/caret-position-utils.d.ts +0 -54
- package/dist/features/formatting/change-detection.d.ts +0 -40
- package/dist/features/formatting/character-equivalence.d.ts +0 -9
- package/dist/features/formatting/constants.d.ts +0 -29
- package/dist/features/formatting/cursor-boundary.d.ts +0 -39
- package/dist/features/formatting/cursor-position.d.ts +0 -50
- package/dist/features/formatting/digit-counting.d.ts +0 -61
- package/dist/features/formatting/index.d.ts +0 -19
- package/dist/features/formatting/large-number.d.ts +0 -39
- package/dist/features/formatting/percent.d.ts +0 -45
- package/dist/features/formatting/subscript-notation.d.ts +0 -20
- package/dist/features/formatting/thousand-grouping.d.ts +0 -34
- package/dist/features/leading-zeros.d.ts +0 -18
- package/dist/features/mobile-keyboard-filtering.d.ts +0 -18
- package/dist/features/non-numeric-characters.d.ts +0 -9
- package/dist/features/sanitization.d.ts +0 -41
- package/dist/features/scientific-notation.d.ts +0 -9
- package/dist/index.d.ts +0 -4
- package/dist/types.d.ts +0 -34
- package/dist/utils/escape-reg-exp.d.ts +0 -16
- package/dist/utils/event-handlers.d.ts +0 -34
- package/dist/utils/input-pattern.d.ts +0 -5
- package/dist/validation.d.ts +0 -20
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var v = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(v || {}),
|
|
5
|
-
const I = 2, R = 0, O = v.Blur, _ = ",",
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var Q = (e, t, n) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var L = (e, t, n) => Q(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
var v = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(v || {}), S = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e))(S || {});
|
|
5
|
+
const I = 2, R = 0, O = v.Blur, _ = ",", B = S.None, E = ".", X = !1, P = !1, W = !1, k = !1;
|
|
6
6
|
function D(e) {
|
|
7
7
|
return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function A(e) {
|
|
10
10
|
return {
|
|
11
11
|
decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? E,
|
|
12
12
|
thousandSeparator: e == null ? void 0 : e.thousandSeparator
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
function Y(e, t) {
|
|
16
|
-
if (e.key !== t)
|
|
17
|
-
return !1;
|
|
18
16
|
const n = e.target;
|
|
19
17
|
return n ? n.value.includes(t) : !1;
|
|
20
18
|
}
|
|
21
19
|
function V(e, t, n, r) {
|
|
22
|
-
const { selectionStart: i, selectionEnd:
|
|
23
|
-
if (c !==
|
|
20
|
+
const { selectionStart: i, selectionEnd: o, value: s } = t, { key: a } = e, c = n == null ? void 0 : n.ThousandStyle;
|
|
21
|
+
if (c !== S.None && c !== void 0 || a !== "," && a !== ".")
|
|
24
22
|
return !1;
|
|
25
23
|
if (Y(e, r))
|
|
26
24
|
return !0;
|
|
27
|
-
if (
|
|
28
|
-
const l = i ?? 0, h =
|
|
25
|
+
if (a !== r) {
|
|
26
|
+
const l = i ?? 0, h = o ?? l, d = s.slice(0, l) + r + s.slice(h);
|
|
29
27
|
t.value = d;
|
|
30
28
|
const u = l + 1;
|
|
31
29
|
return t.setSelectionRange(u, u), !0;
|
|
@@ -43,273 +41,105 @@ const F = (e, t, n = E) => {
|
|
|
43
41
|
return e;
|
|
44
42
|
if (!e || e === "0" || e === n || e === "-" || e === `-${n}`)
|
|
45
43
|
return e === "-" || e === `-${n}` ? `-${n}${"0".repeat(t)}` : e === n ? `${n}${"0".repeat(t)}` : `${e}${n}${"0".repeat(t)}`;
|
|
46
|
-
const r = e.includes(n), i = e.startsWith("-"),
|
|
44
|
+
const r = e.includes(n), i = e.startsWith("-"), o = i ? e.slice(1) : e, [s, a = ""] = o.split(n);
|
|
47
45
|
if (!r) {
|
|
48
46
|
const c = "0".repeat(t);
|
|
49
47
|
return i ? `-${s}${n}${c}` : `${s}${n}${c}`;
|
|
50
48
|
}
|
|
51
|
-
if (
|
|
52
|
-
const c = t -
|
|
49
|
+
if (a.length < t) {
|
|
50
|
+
const c = t - a.length, l = a + "0".repeat(c);
|
|
53
51
|
return i ? `-${s}${n}${l}` : `${s}${n}${l}`;
|
|
54
52
|
}
|
|
55
53
|
return e;
|
|
56
|
-
},
|
|
57
|
-
const r = D(n), i = new RegExp(`[^0-9${r}]`, "g");
|
|
58
|
-
if (!t)
|
|
59
|
-
return e.replace(i, "");
|
|
60
|
-
const a = e.startsWith("-"), s = e.replace(i, "");
|
|
61
|
-
if (a) {
|
|
62
|
-
if (s.length > 0)
|
|
63
|
-
return "-" + s;
|
|
64
|
-
if (e === "-")
|
|
65
|
-
return "-";
|
|
66
|
-
}
|
|
67
|
-
return s;
|
|
68
|
-
};
|
|
69
|
-
function re(e) {
|
|
70
|
-
const t = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g;
|
|
71
|
-
let n = e, r;
|
|
72
|
-
const i = [];
|
|
73
|
-
for (; (r = t.exec(e)) !== null; ) {
|
|
74
|
-
const a = r[0], s = r[1], o = parseInt(r[2], 10);
|
|
75
|
-
let c;
|
|
76
|
-
if (o === 0)
|
|
77
|
-
c = s;
|
|
78
|
-
else {
|
|
79
|
-
const l = s.startsWith("-"), h = l ? s.slice(1) : s, [d, u = ""] = h.split(".");
|
|
80
|
-
o > 0 ? c = se(d, u, o) : c = ie(d, u, Math.abs(o)), l && (c = "-" + c);
|
|
81
|
-
}
|
|
82
|
-
i.push({ full: a, expanded: c });
|
|
83
|
-
}
|
|
84
|
-
for (const { full: a, expanded: s } of i)
|
|
85
|
-
n = n.replace(a, s);
|
|
86
|
-
return n;
|
|
87
|
-
}
|
|
88
|
-
function se(e, t, n) {
|
|
89
|
-
const r = e + t;
|
|
90
|
-
if (r === "0" || r.match(/^0+$/))
|
|
91
|
-
return "0";
|
|
92
|
-
const i = t.length;
|
|
93
|
-
if (n <= i) {
|
|
94
|
-
const s = r.slice(0, e.length + n), o = r.slice(e.length + n);
|
|
95
|
-
return o ? `${s}.${o}` : s;
|
|
96
|
-
}
|
|
97
|
-
const a = n - i;
|
|
98
|
-
return r + "0".repeat(a);
|
|
99
|
-
}
|
|
100
|
-
function ie(e, t, n) {
|
|
101
|
-
const r = e + t;
|
|
102
|
-
if (r === "0" || r.match(/^0+$/))
|
|
103
|
-
return "0";
|
|
104
|
-
const s = e.length - n;
|
|
105
|
-
if (s <= 0) {
|
|
106
|
-
const o = Math.abs(s), c = `0.${"0".repeat(o)}${r}`;
|
|
107
|
-
return A(c);
|
|
108
|
-
}
|
|
109
|
-
if (s < e.length) {
|
|
110
|
-
const o = r.slice(0, s), c = r.slice(s), l = `${o}.${c}`;
|
|
111
|
-
return A(l);
|
|
112
|
-
}
|
|
113
|
-
return A(r);
|
|
114
|
-
}
|
|
115
|
-
function A(e) {
|
|
116
|
-
if (!e.includes("."))
|
|
117
|
-
return e;
|
|
118
|
-
if (e === "0" || e === "0.")
|
|
119
|
-
return "0";
|
|
120
|
-
if (e.startsWith("0.")) {
|
|
121
|
-
const t = e.replace(/\.?0+$/, "");
|
|
122
|
-
return t === "0" ? "0" : t || "0";
|
|
123
|
-
}
|
|
124
|
-
if (e.startsWith("-0.")) {
|
|
125
|
-
const t = e.replace(/\.?0+$/, "");
|
|
126
|
-
return t === "-0" || t === "0" ? "0" : t || "0";
|
|
127
|
-
}
|
|
128
|
-
return e.replace(/\.?0+$/, "") || e;
|
|
129
|
-
}
|
|
130
|
-
function ae(e) {
|
|
131
|
-
const t = /(\d+\.?\d*)\s*(Qa|Qi|Sx|Sp|[kmbMTO]|N)/gi;
|
|
132
|
-
return e.replace(t, (n, r, i) => {
|
|
133
|
-
const a = {
|
|
134
|
-
k: 3,
|
|
135
|
-
// Thousand
|
|
136
|
-
m: 6,
|
|
137
|
-
// Million (lowercase)
|
|
138
|
-
M: 6,
|
|
139
|
-
// Million (uppercase)
|
|
140
|
-
b: 9,
|
|
141
|
-
// Billion
|
|
142
|
-
T: 12,
|
|
143
|
-
// Trillion
|
|
144
|
-
Qa: 15,
|
|
145
|
-
// Quadrillion
|
|
146
|
-
Qi: 18,
|
|
147
|
-
// Quintillion
|
|
148
|
-
Sx: 21,
|
|
149
|
-
// Sextillion
|
|
150
|
-
Sp: 24,
|
|
151
|
-
// Septillion
|
|
152
|
-
O: 27,
|
|
153
|
-
// Octillion
|
|
154
|
-
N: 30
|
|
155
|
-
// Nonillion
|
|
156
|
-
};
|
|
157
|
-
let s;
|
|
158
|
-
if (i.length > 1)
|
|
159
|
-
s = a[i] || a[i.charAt(0).toUpperCase() + i.slice(1).toLowerCase()];
|
|
160
|
-
else {
|
|
161
|
-
const f = i.toLowerCase();
|
|
162
|
-
s = a[i] || a[f];
|
|
163
|
-
}
|
|
164
|
-
if (!s)
|
|
165
|
-
return n;
|
|
166
|
-
const o = r.startsWith("-"), c = o ? r.slice(1) : r, [l, h = ""] = c.split("."), d = l.replace(/^0+/, "") || "0";
|
|
167
|
-
let u;
|
|
168
|
-
if (h.length === 0)
|
|
169
|
-
u = d + "0".repeat(s);
|
|
170
|
-
else if (h.length <= s) {
|
|
171
|
-
const f = s - h.length;
|
|
172
|
-
u = d + h + "0".repeat(f);
|
|
173
|
-
} else {
|
|
174
|
-
const f = h.slice(0, s), g = h.slice(s);
|
|
175
|
-
u = d + f + "." + g;
|
|
176
|
-
}
|
|
177
|
-
return u = u.replace(/^(-?)0+([1-9])/, "$1$2"), u.match(/^-?0+$/) && (u = o ? "-0" : "0"), u = u.replace(/\.?0+$/, ""), o && !u.startsWith("-") ? "-" + u : u;
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
function oe(e) {
|
|
181
|
-
if (!e || e === "0" || e === "-0" || e === "-" || e === ".")
|
|
182
|
-
return e;
|
|
183
|
-
const t = e.startsWith("-"), n = t ? e.slice(1) : e;
|
|
184
|
-
if (!n || n === "0" || n === ".")
|
|
185
|
-
return e;
|
|
186
|
-
if (n.includes(".")) {
|
|
187
|
-
const [i, a] = n.split(".");
|
|
188
|
-
if (i && i.length > 0) {
|
|
189
|
-
const o = (i.replace(/^0+/, "") || "0") + "." + a;
|
|
190
|
-
return t ? "-" + o : o;
|
|
191
|
-
}
|
|
192
|
-
return e;
|
|
193
|
-
}
|
|
194
|
-
if (n.startsWith("0") && n.length > 1) {
|
|
195
|
-
const i = n.replace(/^0+/, "") || "0";
|
|
196
|
-
return t ? "-" + i : i;
|
|
197
|
-
}
|
|
198
|
-
return e;
|
|
199
|
-
}
|
|
200
|
-
function ce(e) {
|
|
201
|
-
return e.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ").replace(/\s/g, "");
|
|
202
|
-
}
|
|
203
|
-
function L(e, t) {
|
|
204
|
-
const n = D(t);
|
|
205
|
-
return e.replace(new RegExp(n, "g"), "");
|
|
206
|
-
}
|
|
207
|
-
const le = (e, t) => {
|
|
208
|
-
let n = ce(e);
|
|
209
|
-
return t != null && t.thousandSeparator && (n = L(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = ae(n)), n = re(n), n = ne(
|
|
210
|
-
n,
|
|
211
|
-
t == null ? void 0 : t.enableNegative,
|
|
212
|
-
t == null ? void 0 : t.decimalSeparator
|
|
213
|
-
), n = ee(n, (t == null ? void 0 : t.decimalSeparator) || E), t != null && t.enableLeadingZeros || (n = oe(n)), n;
|
|
214
|
-
};
|
|
215
|
-
function he(e, t, n) {
|
|
216
|
-
return {
|
|
217
|
-
enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
|
|
218
|
-
enableNegative: e == null ? void 0 : e.enableNegative,
|
|
219
|
-
enableLeadingZeros: e == null ? void 0 : e.enableLeadingZeros,
|
|
220
|
-
decimalSeparator: t.decimalSeparator,
|
|
221
|
-
thousandSeparator: n ? t.thousandSeparator : void 0
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
const N = {
|
|
54
|
+
}, N = {
|
|
225
55
|
thousand: { size: 3 },
|
|
226
56
|
lakh: { firstGroup: 3, restGroup: 2 },
|
|
227
57
|
wan: { size: 4 }
|
|
228
58
|
};
|
|
229
|
-
function
|
|
59
|
+
function G(e, t, n, r = !1, i = ".") {
|
|
230
60
|
if (!e || e === "0" || e === i || e === "-" || e === `-${i}`)
|
|
231
61
|
return e;
|
|
232
|
-
const
|
|
62
|
+
const o = e.includes(i), s = e.startsWith("-"), a = s ? e.slice(1) : e, [c, l] = a.split(i);
|
|
233
63
|
if (!c) {
|
|
234
|
-
const u = l ? `${i}${l}` :
|
|
64
|
+
const u = l ? `${i}${l}` : a;
|
|
235
65
|
return s ? `-${u}` : u;
|
|
236
66
|
}
|
|
237
67
|
if (r && c.startsWith("0") && c.length > 1) {
|
|
238
68
|
const u = c.match(/^(0+)/);
|
|
239
69
|
if (u) {
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
const p =
|
|
243
|
-
return
|
|
70
|
+
const g = u[1], f = c.slice(g.length);
|
|
71
|
+
if (f) {
|
|
72
|
+
const p = Z(f, t, n), $ = g + p, m = s ? "-" : "";
|
|
73
|
+
return o ? l ? `${m}${$}${i}${l}` : `${m}${$}${i}` : `${m}${$}`;
|
|
244
74
|
}
|
|
245
75
|
}
|
|
246
76
|
}
|
|
247
|
-
const h =
|
|
248
|
-
return
|
|
77
|
+
const h = Z(c, t, n), d = s ? "-" : "";
|
|
78
|
+
return o ? l ? `${d}${h}${i}${l}` : `${d}${h}${i}` : `${d}${h}`;
|
|
249
79
|
}
|
|
250
|
-
function
|
|
80
|
+
function Z(e, t, n) {
|
|
251
81
|
if (e === "0" || e === "")
|
|
252
82
|
return e;
|
|
253
83
|
switch (n) {
|
|
254
|
-
case
|
|
84
|
+
case S.None:
|
|
255
85
|
return e;
|
|
256
|
-
case
|
|
257
|
-
return
|
|
258
|
-
case
|
|
259
|
-
return
|
|
260
|
-
case
|
|
261
|
-
return
|
|
86
|
+
case S.Thousand:
|
|
87
|
+
return ne(e, t);
|
|
88
|
+
case S.Lakh:
|
|
89
|
+
return re(e, t);
|
|
90
|
+
case S.Wan:
|
|
91
|
+
return se(e, t);
|
|
262
92
|
default:
|
|
263
93
|
return e;
|
|
264
94
|
}
|
|
265
95
|
}
|
|
266
|
-
function
|
|
267
|
-
return
|
|
96
|
+
function ne(e, t) {
|
|
97
|
+
return U(e, t, N.thousand.size);
|
|
268
98
|
}
|
|
269
|
-
function
|
|
99
|
+
function re(e, t) {
|
|
270
100
|
if (e.length <= N.lakh.firstGroup)
|
|
271
101
|
return e;
|
|
272
102
|
const n = e.split("").reverse(), r = [], i = n.slice(0, N.lakh.firstGroup).reverse().join("");
|
|
273
103
|
r.push(i);
|
|
274
|
-
for (let
|
|
275
|
-
r.push(n.slice(
|
|
104
|
+
for (let o = N.lakh.firstGroup; o < n.length; o += N.lakh.restGroup)
|
|
105
|
+
r.push(n.slice(o, o + N.lakh.restGroup).reverse().join(""));
|
|
276
106
|
return r.reverse().join(t);
|
|
277
107
|
}
|
|
278
|
-
function
|
|
279
|
-
return
|
|
108
|
+
function se(e, t) {
|
|
109
|
+
return U(e, t, N.wan.size);
|
|
280
110
|
}
|
|
281
|
-
function
|
|
111
|
+
function U(e, t, n) {
|
|
282
112
|
const r = e.split("").reverse(), i = [];
|
|
283
|
-
for (let
|
|
284
|
-
i.push(r.slice(
|
|
113
|
+
for (let o = 0; o < r.length; o += n)
|
|
114
|
+
i.push(r.slice(o, o + n).reverse().join(""));
|
|
285
115
|
return i.reverse().join(t);
|
|
286
116
|
}
|
|
287
|
-
function
|
|
288
|
-
return (t == null ? void 0 : t.formatOn) === "change" && t.thousandSeparator ?
|
|
117
|
+
function ie(e, t, n) {
|
|
118
|
+
return (t == null ? void 0 : t.formatOn) === "change" && t.thousandSeparator ? G(
|
|
289
119
|
e,
|
|
290
120
|
t.thousandSeparator,
|
|
291
|
-
t.ThousandStyle ??
|
|
121
|
+
t.ThousandStyle ?? S.None,
|
|
292
122
|
t.enableLeadingZeros,
|
|
293
123
|
(n == null ? void 0 : n.decimalSeparator) ?? E
|
|
294
124
|
) : e;
|
|
295
125
|
}
|
|
296
|
-
function
|
|
126
|
+
function b(e, t, n, r = ".") {
|
|
297
127
|
let i = 0;
|
|
298
|
-
for (let
|
|
299
|
-
const s = e[
|
|
128
|
+
for (let o = 0; o < t && o < e.length; o++) {
|
|
129
|
+
const s = e[o];
|
|
300
130
|
s !== n && s !== r && i++;
|
|
301
131
|
}
|
|
302
132
|
return i;
|
|
303
133
|
}
|
|
304
|
-
function
|
|
134
|
+
function oe(e, t, n, r = ".") {
|
|
305
135
|
if (t === 0)
|
|
306
136
|
return 0;
|
|
307
137
|
let i = 0;
|
|
308
|
-
for (let
|
|
309
|
-
const s = e[
|
|
138
|
+
for (let o = 0; o < e.length; o++) {
|
|
139
|
+
const s = e[o];
|
|
310
140
|
if (s !== n && s !== r) {
|
|
311
141
|
if (i === t - 1)
|
|
312
|
-
return
|
|
142
|
+
return o + 1;
|
|
313
143
|
i++;
|
|
314
144
|
}
|
|
315
145
|
}
|
|
@@ -319,114 +149,117 @@ function C(e, t, n, r = ".") {
|
|
|
319
149
|
if (t === 0)
|
|
320
150
|
return 0;
|
|
321
151
|
let i = 0;
|
|
322
|
-
for (let
|
|
323
|
-
const s = e[
|
|
152
|
+
for (let o = 0; o < e.length; o++) {
|
|
153
|
+
const s = e[o];
|
|
324
154
|
if (s !== n && s !== r) {
|
|
325
155
|
if (i++, i === t)
|
|
326
|
-
return
|
|
156
|
+
return o + 1;
|
|
327
157
|
if (i > t)
|
|
328
|
-
return
|
|
158
|
+
return o;
|
|
329
159
|
}
|
|
330
160
|
}
|
|
331
161
|
return e.length;
|
|
332
162
|
}
|
|
333
|
-
function
|
|
163
|
+
function j(e, t, n) {
|
|
334
164
|
return t < 0 || t >= e.length ? !1 : e[t] === n;
|
|
335
165
|
}
|
|
336
|
-
function
|
|
166
|
+
function ae(e, t = {}) {
|
|
337
167
|
const {
|
|
338
168
|
thousandSeparator: n,
|
|
339
169
|
decimalSeparator: r = ".",
|
|
340
170
|
prefix: i = "",
|
|
341
|
-
suffix:
|
|
171
|
+
suffix: o = ""
|
|
342
172
|
} = t, s = Array.from({ length: e.length + 1 }).map(() => !0);
|
|
343
|
-
if (i && s.fill(!1, 0, i.length),
|
|
344
|
-
const
|
|
345
|
-
s.fill(!1,
|
|
173
|
+
if (i && s.fill(!1, 0, i.length), o) {
|
|
174
|
+
const a = e.length - o.length;
|
|
175
|
+
s.fill(!1, a + 1, e.length + 1);
|
|
346
176
|
}
|
|
347
|
-
for (let
|
|
348
|
-
const c = e[
|
|
349
|
-
(n && c === n || c === r) && (s[
|
|
177
|
+
for (let a = 0; a < e.length; a++) {
|
|
178
|
+
const c = e[a];
|
|
179
|
+
(n && c === n || c === r) && (s[a] = !1, a + 1 < e.length && !/\d/.test(e[a + 1]) && (s[a + 1] = !1));
|
|
350
180
|
}
|
|
351
|
-
return s.some((
|
|
181
|
+
return s.some((a) => a) || s.fill(!0), s;
|
|
352
182
|
}
|
|
353
183
|
function T(e, t, n, r) {
|
|
354
184
|
const i = e.length;
|
|
355
185
|
if (t = Math.max(0, Math.min(t, i)), !n[t]) {
|
|
356
|
-
let
|
|
357
|
-
for (;
|
|
358
|
-
|
|
186
|
+
let o = t;
|
|
187
|
+
for (; o <= i && !n[o]; )
|
|
188
|
+
o++;
|
|
359
189
|
let s = t;
|
|
360
190
|
for (; s >= 0 && !n[s]; )
|
|
361
191
|
s--;
|
|
362
|
-
|
|
192
|
+
o <= i && s >= 0 ? t = t - s < o - t ? s : o : o <= i ? t = o : s >= 0 && (t = s);
|
|
363
193
|
}
|
|
364
194
|
return (t === -1 || t > i) && (t = i), t;
|
|
365
195
|
}
|
|
366
|
-
const
|
|
367
|
-
function
|
|
196
|
+
const J = (e, t) => e === t;
|
|
197
|
+
function ce(e, t, n, r, i, o, s = ".", a = {}) {
|
|
368
198
|
if (n < 0)
|
|
369
199
|
return 0;
|
|
370
200
|
if (n > e.length || e === "" || t === "")
|
|
371
201
|
return t.length;
|
|
372
|
-
const c =
|
|
202
|
+
const c = /(\d+\.?\d*)\s*[kmbMTOQaqiSxsxSpOoNn]$/i;
|
|
203
|
+
if (c.test(e) && !c.test(t) && t.length > e.length && n >= e.length - 1)
|
|
204
|
+
return t.length;
|
|
205
|
+
const l = t.length < e.length, h = j(
|
|
373
206
|
e,
|
|
374
207
|
n,
|
|
375
208
|
r
|
|
376
|
-
),
|
|
377
|
-
if (
|
|
378
|
-
const
|
|
209
|
+
), d = e.indexOf(s), u = t.indexOf(s);
|
|
210
|
+
if (a.isCharacterEquivalent && e !== t) {
|
|
211
|
+
const p = le(
|
|
379
212
|
e,
|
|
380
213
|
t,
|
|
381
214
|
n,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
215
|
+
a.isCharacterEquivalent || J,
|
|
216
|
+
o,
|
|
217
|
+
a
|
|
385
218
|
);
|
|
386
|
-
if (
|
|
387
|
-
return
|
|
219
|
+
if (p !== void 0)
|
|
220
|
+
return p;
|
|
388
221
|
}
|
|
389
|
-
if (
|
|
390
|
-
return
|
|
222
|
+
if (l)
|
|
223
|
+
return he(
|
|
391
224
|
e,
|
|
392
225
|
t,
|
|
393
226
|
n,
|
|
394
227
|
r,
|
|
395
|
-
l,
|
|
396
228
|
h,
|
|
397
229
|
d,
|
|
398
|
-
|
|
230
|
+
u,
|
|
231
|
+
o,
|
|
399
232
|
s,
|
|
400
|
-
|
|
233
|
+
a
|
|
401
234
|
);
|
|
402
|
-
const f =
|
|
235
|
+
const f = ge(
|
|
403
236
|
e,
|
|
404
237
|
t,
|
|
405
238
|
n,
|
|
406
239
|
r,
|
|
407
|
-
|
|
240
|
+
h,
|
|
408
241
|
s
|
|
409
242
|
);
|
|
410
|
-
return
|
|
243
|
+
return a.boundary ? T(t, f, a.boundary) : f;
|
|
411
244
|
}
|
|
412
|
-
function
|
|
413
|
-
const s = e.length,
|
|
414
|
-
for (let
|
|
415
|
-
l[
|
|
416
|
-
for (let p = 0; p <
|
|
245
|
+
function le(e, t, n, r, i, o) {
|
|
246
|
+
const s = e.length, a = t.length, c = {}, l = new Array(s);
|
|
247
|
+
for (let f = 0; f < s; f++) {
|
|
248
|
+
l[f] = -1;
|
|
249
|
+
for (let p = 0; p < a; p++) {
|
|
417
250
|
if (c[p]) continue;
|
|
418
251
|
if (r(
|
|
419
|
-
e[
|
|
252
|
+
e[f],
|
|
420
253
|
t[p],
|
|
421
254
|
{
|
|
422
255
|
oldValue: e,
|
|
423
256
|
newValue: t,
|
|
424
257
|
typedRange: i,
|
|
425
|
-
oldIndex:
|
|
258
|
+
oldIndex: f,
|
|
426
259
|
newIndex: p
|
|
427
260
|
}
|
|
428
261
|
)) {
|
|
429
|
-
l[
|
|
262
|
+
l[f] = p, c[p] = !0;
|
|
430
263
|
break;
|
|
431
264
|
}
|
|
432
265
|
}
|
|
@@ -434,16 +267,16 @@ function ve(e, t, n, r, i, a) {
|
|
|
434
267
|
let h = n;
|
|
435
268
|
for (; h < s && (l[h] === -1 || !/\d/.test(e[h])); )
|
|
436
269
|
h++;
|
|
437
|
-
const d = h === s || l[h] === -1 ?
|
|
270
|
+
const d = h === s || l[h] === -1 ? a : l[h];
|
|
438
271
|
for (h = n - 1; h >= 0 && l[h] === -1; ) h--;
|
|
439
272
|
const u = h === -1 || l[h] === -1 ? 0 : l[h] + 1;
|
|
440
273
|
if (u > d) return d;
|
|
441
|
-
const
|
|
442
|
-
return
|
|
274
|
+
const g = n - u < d - n ? u : d;
|
|
275
|
+
return o.boundary ? T(t, g, o.boundary) : g;
|
|
443
276
|
}
|
|
444
|
-
function
|
|
277
|
+
function he(e, t, n, r, i, o, s, a, c, l = {}) {
|
|
445
278
|
if (i)
|
|
446
|
-
return
|
|
279
|
+
return ue(
|
|
447
280
|
e,
|
|
448
281
|
t,
|
|
449
282
|
n,
|
|
@@ -451,97 +284,97 @@ function $e(e, t, n, r, i, a, s, o, c, l = {}) {
|
|
|
451
284
|
s,
|
|
452
285
|
c
|
|
453
286
|
);
|
|
454
|
-
const h =
|
|
287
|
+
const h = b(
|
|
455
288
|
e,
|
|
456
289
|
n,
|
|
457
290
|
r,
|
|
458
291
|
c
|
|
459
|
-
), d =
|
|
292
|
+
), d = b(
|
|
460
293
|
e,
|
|
461
294
|
e.length,
|
|
462
295
|
r,
|
|
463
296
|
c
|
|
464
|
-
), u =
|
|
297
|
+
), u = b(
|
|
465
298
|
t,
|
|
466
299
|
t.length,
|
|
467
300
|
r,
|
|
468
301
|
c
|
|
469
|
-
),
|
|
302
|
+
), g = d - u, f = de(
|
|
470
303
|
e,
|
|
471
304
|
n,
|
|
472
305
|
r,
|
|
473
306
|
h,
|
|
474
|
-
|
|
475
|
-
a,
|
|
307
|
+
g,
|
|
476
308
|
o,
|
|
309
|
+
a,
|
|
477
310
|
c
|
|
478
|
-
), p =
|
|
311
|
+
), p = o === -1 || n <= o, $ = fe(
|
|
479
312
|
t,
|
|
480
|
-
g,
|
|
481
|
-
r,
|
|
482
313
|
f,
|
|
483
|
-
|
|
314
|
+
r,
|
|
315
|
+
g,
|
|
316
|
+
a,
|
|
484
317
|
c,
|
|
485
318
|
p,
|
|
486
319
|
s
|
|
487
320
|
);
|
|
488
321
|
return l.boundary ? T(t, $, l.boundary) : $;
|
|
489
322
|
}
|
|
490
|
-
function
|
|
323
|
+
function ue(e, t, n, r, i, o) {
|
|
491
324
|
const s = n + 1;
|
|
492
325
|
if (s < e.length) {
|
|
493
|
-
const
|
|
326
|
+
const a = b(
|
|
494
327
|
e,
|
|
495
328
|
s,
|
|
496
329
|
r,
|
|
497
|
-
|
|
498
|
-
), c =
|
|
330
|
+
o
|
|
331
|
+
), c = oe(
|
|
499
332
|
t,
|
|
500
|
-
|
|
333
|
+
a,
|
|
501
334
|
r,
|
|
502
|
-
|
|
335
|
+
o
|
|
503
336
|
);
|
|
504
337
|
return c < t.length && t[c] !== r ? c + 1 : c;
|
|
505
338
|
}
|
|
506
339
|
return n;
|
|
507
340
|
}
|
|
508
|
-
function
|
|
341
|
+
function de(e, t, n, r, i, o, s, a) {
|
|
509
342
|
if (s) {
|
|
510
343
|
const { start: l, isDelete: h } = s;
|
|
511
|
-
return h ?
|
|
344
|
+
return h ? b(
|
|
512
345
|
e,
|
|
513
346
|
l,
|
|
514
347
|
n,
|
|
515
|
-
|
|
516
|
-
) : Math.max(0,
|
|
348
|
+
a
|
|
349
|
+
) : Math.max(0, b(
|
|
517
350
|
e,
|
|
518
351
|
l,
|
|
519
352
|
n,
|
|
520
|
-
|
|
353
|
+
a
|
|
521
354
|
));
|
|
522
355
|
}
|
|
523
356
|
return t > 0 && e[t - 1] === n && i > 0 ? r + 1 : r;
|
|
524
357
|
}
|
|
525
|
-
function
|
|
526
|
-
if (s &&
|
|
527
|
-
const l = e.substring(0,
|
|
358
|
+
function fe(e, t, n, r, i, o, s, a) {
|
|
359
|
+
if (s && a !== -1) {
|
|
360
|
+
const l = e.substring(0, a), h = b(
|
|
528
361
|
l,
|
|
529
362
|
l.length,
|
|
530
363
|
n,
|
|
531
|
-
|
|
364
|
+
o
|
|
532
365
|
);
|
|
533
366
|
if (t <= h) {
|
|
534
367
|
const d = C(
|
|
535
368
|
l,
|
|
536
369
|
t,
|
|
537
370
|
n,
|
|
538
|
-
|
|
371
|
+
o
|
|
539
372
|
);
|
|
540
|
-
if (d > 0 && d < l.length &&
|
|
373
|
+
if (d > 0 && d < l.length && b(
|
|
541
374
|
l,
|
|
542
375
|
d,
|
|
543
376
|
n,
|
|
544
|
-
|
|
377
|
+
o
|
|
545
378
|
) === t) {
|
|
546
379
|
if (l[d] === n && i && r > 0 && d < l.length - 1)
|
|
547
380
|
return d + 1;
|
|
@@ -555,13 +388,13 @@ function we(e, t, n, r, i, a, s, o) {
|
|
|
555
388
|
e,
|
|
556
389
|
t,
|
|
557
390
|
n,
|
|
558
|
-
|
|
391
|
+
o
|
|
559
392
|
);
|
|
560
|
-
if (c > 0 && c < e.length &&
|
|
393
|
+
if (c > 0 && c < e.length && b(
|
|
561
394
|
e,
|
|
562
395
|
c,
|
|
563
396
|
n,
|
|
564
|
-
|
|
397
|
+
o
|
|
565
398
|
) === t) {
|
|
566
399
|
if (e[c] === n && i && r > 0 && c < e.length - 1)
|
|
567
400
|
return c + 1;
|
|
@@ -570,38 +403,38 @@ function we(e, t, n, r, i, a, s, o) {
|
|
|
570
403
|
}
|
|
571
404
|
return c;
|
|
572
405
|
}
|
|
573
|
-
function
|
|
574
|
-
const s = n >= e.length,
|
|
406
|
+
function ge(e, t, n, r, i, o) {
|
|
407
|
+
const s = n >= e.length, a = b(
|
|
575
408
|
e,
|
|
576
409
|
n,
|
|
577
410
|
r,
|
|
578
|
-
|
|
579
|
-
), c =
|
|
411
|
+
o
|
|
412
|
+
), c = b(
|
|
580
413
|
e,
|
|
581
414
|
e.length,
|
|
582
415
|
r,
|
|
583
|
-
|
|
584
|
-
), l =
|
|
416
|
+
o
|
|
417
|
+
), l = b(
|
|
585
418
|
t,
|
|
586
419
|
t.length,
|
|
587
420
|
r,
|
|
588
|
-
|
|
421
|
+
o
|
|
589
422
|
);
|
|
590
|
-
if (s ||
|
|
423
|
+
if (s || a === c)
|
|
591
424
|
return t.length;
|
|
592
425
|
const h = l - c;
|
|
593
|
-
let d =
|
|
594
|
-
h > 0 && !s &&
|
|
426
|
+
let d = a;
|
|
427
|
+
h > 0 && !s && a < c && (d = a + 1);
|
|
595
428
|
const u = C(
|
|
596
429
|
t,
|
|
597
430
|
d,
|
|
598
431
|
r,
|
|
599
|
-
|
|
432
|
+
o
|
|
600
433
|
);
|
|
601
|
-
return i && !
|
|
434
|
+
return i && !j(t, u, r) ? Math.max(0, u - 1) : u;
|
|
602
435
|
}
|
|
603
|
-
function
|
|
604
|
-
const { selectionStart: r, selectionEnd: i, endOffset:
|
|
436
|
+
function pe(e, t, n) {
|
|
437
|
+
const { selectionStart: r, selectionEnd: i, endOffset: o = 0 } = e;
|
|
605
438
|
if (r !== i) {
|
|
606
439
|
const h = i - r;
|
|
607
440
|
return {
|
|
@@ -611,8 +444,8 @@ function De(e, t, n) {
|
|
|
611
444
|
isDelete: !1
|
|
612
445
|
};
|
|
613
446
|
}
|
|
614
|
-
if (
|
|
615
|
-
const h =
|
|
447
|
+
if (o > 0) {
|
|
448
|
+
const h = o;
|
|
616
449
|
return {
|
|
617
450
|
start: r,
|
|
618
451
|
end: r + h,
|
|
@@ -620,7 +453,7 @@ function De(e, t, n) {
|
|
|
620
453
|
isDelete: !0
|
|
621
454
|
};
|
|
622
455
|
}
|
|
623
|
-
const
|
|
456
|
+
const a = t.length, c = n.length, l = a - c;
|
|
624
457
|
if (!(l <= 0))
|
|
625
458
|
return {
|
|
626
459
|
start: r,
|
|
@@ -629,7 +462,7 @@ function De(e, t, n) {
|
|
|
629
462
|
isDelete: !1
|
|
630
463
|
};
|
|
631
464
|
}
|
|
632
|
-
function
|
|
465
|
+
function Se(e, t) {
|
|
633
466
|
if (e === t)
|
|
634
467
|
return;
|
|
635
468
|
let n = 0;
|
|
@@ -638,16 +471,16 @@ function Me(e, t) {
|
|
|
638
471
|
let r = e.length - 1, i = t.length - 1;
|
|
639
472
|
for (; r >= n && i >= n && e[r] === t[i]; )
|
|
640
473
|
r--, i--;
|
|
641
|
-
const
|
|
642
|
-
if (!(
|
|
474
|
+
const o = r - n + 1, s = i - n + 1;
|
|
475
|
+
if (!(o === 0 && s === 0))
|
|
643
476
|
return {
|
|
644
477
|
start: n,
|
|
645
478
|
end: r + 1,
|
|
646
|
-
deletedLength:
|
|
647
|
-
isDelete:
|
|
479
|
+
deletedLength: o,
|
|
480
|
+
isDelete: o > s
|
|
648
481
|
};
|
|
649
482
|
}
|
|
650
|
-
function
|
|
483
|
+
function z(e, t) {
|
|
651
484
|
if (e.value = e.value, e === null)
|
|
652
485
|
return !1;
|
|
653
486
|
if (e.createTextRange) {
|
|
@@ -656,65 +489,237 @@ function U(e, t) {
|
|
|
656
489
|
}
|
|
657
490
|
return e.selectionStart !== null || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
|
|
658
491
|
}
|
|
659
|
-
function
|
|
660
|
-
return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (
|
|
661
|
-
e.value === n && e.selectionStart !== t &&
|
|
492
|
+
function be(e, t, n) {
|
|
493
|
+
return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (z(e, t), setTimeout(() => {
|
|
494
|
+
e.value === n && e.selectionStart !== t && z(e, t);
|
|
662
495
|
}, 0));
|
|
663
496
|
}
|
|
664
|
-
function
|
|
497
|
+
function ve(e) {
|
|
665
498
|
return Math.max(e.selectionStart, e.selectionEnd);
|
|
666
499
|
}
|
|
667
|
-
function
|
|
500
|
+
function $e(e, t, n) {
|
|
668
501
|
if ((n == null ? void 0 : n.formatOn) !== v.Change || !n.thousandSeparator)
|
|
669
502
|
return;
|
|
670
|
-
const { selectionStart: r, selectionEnd: i, value:
|
|
503
|
+
const { selectionStart: r, selectionEnd: i, value: o } = t;
|
|
671
504
|
if (r === null || i === null || r !== i)
|
|
672
505
|
return;
|
|
673
|
-
const { key: s } = e,
|
|
674
|
-
s === "Backspace" && r > 0 &&
|
|
506
|
+
const { key: s } = e, a = n.thousandSeparator;
|
|
507
|
+
s === "Backspace" && r > 0 && o[r - 1] === a && t.setSelectionRange(r - 1, r - 1), s === "Delete" && o[r] === a && t.setSelectionRange(r + 1, r + 1);
|
|
675
508
|
}
|
|
676
|
-
function
|
|
509
|
+
function Ee(e, t, n, r, i, o, s) {
|
|
677
510
|
if (!i) return;
|
|
678
|
-
const { selectionStart:
|
|
679
|
-
let h =
|
|
680
|
-
{ selectionStart:
|
|
511
|
+
const { selectionStart: a = 0, selectionEnd: c = 0, endOffset: l = 0 } = i;
|
|
512
|
+
let h = pe(
|
|
513
|
+
{ selectionStart: a, selectionEnd: c, endOffset: l },
|
|
681
514
|
t,
|
|
682
515
|
n
|
|
683
516
|
);
|
|
684
|
-
if (h || (h =
|
|
685
|
-
const d =
|
|
686
|
-
thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ??
|
|
687
|
-
decimalSeparator:
|
|
517
|
+
if (h || (h = Se(t, n)), !h) return;
|
|
518
|
+
const d = ae(n, {
|
|
519
|
+
thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator,
|
|
520
|
+
decimalSeparator: o.decimalSeparator
|
|
688
521
|
}), u = {
|
|
689
|
-
thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ??
|
|
690
|
-
isCharacterEquivalent:
|
|
522
|
+
thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator,
|
|
523
|
+
isCharacterEquivalent: J,
|
|
691
524
|
boundary: d
|
|
692
|
-
},
|
|
525
|
+
}, g = (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator ?? ",", f = (s == null ? void 0 : s.ThousandStyle) ?? S.None, p = ce(
|
|
693
526
|
t,
|
|
694
527
|
n,
|
|
695
528
|
r,
|
|
696
|
-
f,
|
|
697
529
|
g,
|
|
530
|
+
f,
|
|
698
531
|
h,
|
|
699
|
-
|
|
532
|
+
o.decimalSeparator,
|
|
700
533
|
u
|
|
701
534
|
);
|
|
702
|
-
|
|
535
|
+
be(e, p, n);
|
|
703
536
|
}
|
|
704
|
-
|
|
705
|
-
const
|
|
537
|
+
const Ne = (e, t = !1, n = ".") => {
|
|
538
|
+
const r = D(n), i = new RegExp(`[^0-9${r}]`, "g");
|
|
539
|
+
if (!t)
|
|
540
|
+
return e.replace(i, "");
|
|
541
|
+
const o = e.startsWith("-"), s = e.replace(i, "");
|
|
542
|
+
if (o) {
|
|
543
|
+
if (s.length > 0)
|
|
544
|
+
return "-" + s;
|
|
545
|
+
if (e === "-")
|
|
546
|
+
return "-";
|
|
547
|
+
}
|
|
548
|
+
return s;
|
|
549
|
+
};
|
|
550
|
+
function Le(e) {
|
|
551
|
+
const t = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g;
|
|
552
|
+
let n = e, r;
|
|
553
|
+
const i = [];
|
|
554
|
+
for (; (r = t.exec(e)) !== null; ) {
|
|
555
|
+
const o = r[0], s = r[1], a = parseInt(r[2], 10);
|
|
556
|
+
let c;
|
|
557
|
+
if (a === 0)
|
|
558
|
+
c = s;
|
|
559
|
+
else {
|
|
560
|
+
const l = s.startsWith("-"), h = l ? s.slice(1) : s, [d, u = ""] = h.split(".");
|
|
561
|
+
a > 0 ? c = we(d, u, a) : c = De(d, u, Math.abs(a)), l && (c = "-" + c);
|
|
562
|
+
}
|
|
563
|
+
i.push({ full: o, expanded: c });
|
|
564
|
+
}
|
|
565
|
+
for (const { full: o, expanded: s } of i)
|
|
566
|
+
n = n.replace(o, s);
|
|
567
|
+
return n;
|
|
568
|
+
}
|
|
569
|
+
function we(e, t, n) {
|
|
570
|
+
const r = e + t;
|
|
571
|
+
if (r === "0" || r.match(/^0+$/))
|
|
572
|
+
return "0";
|
|
573
|
+
const i = t.length;
|
|
574
|
+
if (n <= i) {
|
|
575
|
+
const s = r.slice(0, e.length + n), a = r.slice(e.length + n);
|
|
576
|
+
return a ? `${s}.${a}` : s;
|
|
577
|
+
}
|
|
578
|
+
const o = n - i;
|
|
579
|
+
return r + "0".repeat(o);
|
|
580
|
+
}
|
|
581
|
+
function De(e, t, n) {
|
|
582
|
+
const r = e + t;
|
|
583
|
+
if (r === "0" || r.match(/^0+$/))
|
|
584
|
+
return "0";
|
|
585
|
+
const s = e.length - n;
|
|
586
|
+
if (s <= 0) {
|
|
587
|
+
const a = Math.abs(s), c = `0.${"0".repeat(a)}${r}`;
|
|
588
|
+
return y(c);
|
|
589
|
+
}
|
|
590
|
+
if (s < e.length) {
|
|
591
|
+
const a = r.slice(0, s), c = r.slice(s), l = `${a}.${c}`;
|
|
592
|
+
return y(l);
|
|
593
|
+
}
|
|
594
|
+
return y(r);
|
|
595
|
+
}
|
|
596
|
+
function y(e) {
|
|
597
|
+
if (!e.includes("."))
|
|
598
|
+
return e;
|
|
599
|
+
if (e === "0" || e === "0.")
|
|
600
|
+
return "0";
|
|
601
|
+
if (e.startsWith("0.")) {
|
|
602
|
+
const t = e.replace(/\.?0+$/, "");
|
|
603
|
+
return t === "0" ? "0" : t || "0";
|
|
604
|
+
}
|
|
605
|
+
if (e.startsWith("-0.")) {
|
|
606
|
+
const t = e.replace(/\.?0+$/, "");
|
|
607
|
+
return t === "-0" || t === "0" ? "0" : t || "0";
|
|
608
|
+
}
|
|
609
|
+
return e.replace(/\.?0+$/, "") || e;
|
|
610
|
+
}
|
|
611
|
+
function me(e) {
|
|
612
|
+
const t = /(\d+\.?\d*)\s*(Qa|Qi|Sx|Sp|[kmbMTO]|N)/gi;
|
|
613
|
+
return e.replace(t, (n, r, i) => {
|
|
614
|
+
const o = {
|
|
615
|
+
k: 3,
|
|
616
|
+
// Thousand
|
|
617
|
+
K: 3,
|
|
618
|
+
// Thousand
|
|
619
|
+
m: 6,
|
|
620
|
+
// Million (lowercase)
|
|
621
|
+
M: 6,
|
|
622
|
+
// Million (uppercase)
|
|
623
|
+
b: 9,
|
|
624
|
+
// Billion
|
|
625
|
+
B: 9,
|
|
626
|
+
// Billion
|
|
627
|
+
T: 12,
|
|
628
|
+
// Trillion
|
|
629
|
+
t: 12
|
|
630
|
+
// Trillion
|
|
631
|
+
};
|
|
632
|
+
let s;
|
|
633
|
+
if (i.length > 1) {
|
|
634
|
+
const g = i.charAt(0).toUpperCase() + i.slice(1).toLowerCase();
|
|
635
|
+
s = o[i] || o[g];
|
|
636
|
+
} else {
|
|
637
|
+
const g = i.toLowerCase();
|
|
638
|
+
s = o[i] || o[g];
|
|
639
|
+
}
|
|
640
|
+
if (!s)
|
|
641
|
+
return n;
|
|
642
|
+
const a = r.startsWith("-"), c = a ? r.slice(1) : r, [l, h = ""] = c.split("."), d = l.replace(/^0+/, "") || "0";
|
|
643
|
+
let u;
|
|
644
|
+
if (h.length === 0)
|
|
645
|
+
u = d + "0".repeat(s);
|
|
646
|
+
else if (h.length <= s) {
|
|
647
|
+
const g = s - h.length;
|
|
648
|
+
u = d + h + "0".repeat(g);
|
|
649
|
+
} else {
|
|
650
|
+
const g = h.slice(0, s), f = h.slice(s);
|
|
651
|
+
u = d + g + "." + f;
|
|
652
|
+
}
|
|
653
|
+
return u = u.replace(/^(-?)0+([1-9])/, "$1$2"), u.match(/^-?0+$/) && (u = a ? "-0" : "0"), u.includes(".") && (u = u.replace(/\.?0+$/, "")), a && !u.startsWith("-") ? "-" + u : u;
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function Me(e) {
|
|
657
|
+
if (!e || e === "0" || e === "-0" || e === "-" || e === ".")
|
|
658
|
+
return e;
|
|
659
|
+
const t = e.startsWith("-"), n = t ? e.slice(1) : e;
|
|
660
|
+
if (!n || n === "0" || n === ".")
|
|
661
|
+
return e;
|
|
662
|
+
if (n.includes(".")) {
|
|
663
|
+
const [i, o] = n.split(".");
|
|
664
|
+
if (i && i.length > 0) {
|
|
665
|
+
const a = (i.replace(/^0+/, "") || "0") + "." + o;
|
|
666
|
+
return t ? "-" + a : a;
|
|
667
|
+
}
|
|
668
|
+
return e;
|
|
669
|
+
}
|
|
670
|
+
if (n.startsWith("0") && n.length > 1) {
|
|
671
|
+
const i = n.replace(/^0+/, "") || "0";
|
|
672
|
+
return t ? "-" + i : i;
|
|
673
|
+
}
|
|
674
|
+
return e;
|
|
675
|
+
}
|
|
676
|
+
function ye(e) {
|
|
677
|
+
return e.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ").replace(/\s/g, "");
|
|
678
|
+
}
|
|
679
|
+
function w(e, t) {
|
|
680
|
+
const n = D(t);
|
|
681
|
+
return e.replace(new RegExp(n, "g"), "");
|
|
682
|
+
}
|
|
683
|
+
const Ce = (e, t) => {
|
|
684
|
+
let n = ye(e);
|
|
685
|
+
return t != null && t.thousandSeparator && (n = w(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = me(n)), n = Le(n), n = Ne(
|
|
686
|
+
n,
|
|
687
|
+
t == null ? void 0 : t.enableNegative,
|
|
688
|
+
t == null ? void 0 : t.decimalSeparator
|
|
689
|
+
), n = ee(n, (t == null ? void 0 : t.decimalSeparator) || E), t != null && t.enableLeadingZeros || (n = Me(n)), n;
|
|
690
|
+
};
|
|
691
|
+
function Ae(e, t, n) {
|
|
692
|
+
return {
|
|
693
|
+
enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
|
|
694
|
+
enableNegative: e == null ? void 0 : e.enableNegative,
|
|
695
|
+
enableLeadingZeros: e == null ? void 0 : e.enableLeadingZeros,
|
|
696
|
+
decimalSeparator: t.decimalSeparator,
|
|
697
|
+
thousandSeparator: n ? t.thousandSeparator : void 0
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function x(e, t, n, r) {
|
|
701
|
+
const i = A(n), o = r ?? (n == null ? void 0 : n.formatOn) === v.Change, s = Ce(
|
|
706
702
|
e,
|
|
707
|
-
|
|
708
|
-
),
|
|
709
|
-
|
|
703
|
+
Ae(n, i, o)
|
|
704
|
+
), a = F(
|
|
705
|
+
s,
|
|
710
706
|
t,
|
|
711
707
|
i.decimalSeparator
|
|
712
|
-
),
|
|
713
|
-
|
|
714
|
-
|
|
708
|
+
), c = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = te(
|
|
709
|
+
a,
|
|
710
|
+
c,
|
|
715
711
|
i.decimalSeparator
|
|
716
|
-
),
|
|
717
|
-
return { formatted:
|
|
712
|
+
), h = l;
|
|
713
|
+
return { formatted: ie(l, n, i), raw: h };
|
|
714
|
+
}
|
|
715
|
+
function Ke(e, t, n) {
|
|
716
|
+
const r = !!(n != null && n.thousandSeparator);
|
|
717
|
+
return x(
|
|
718
|
+
e,
|
|
719
|
+
t,
|
|
720
|
+
n,
|
|
721
|
+
r
|
|
722
|
+
);
|
|
718
723
|
}
|
|
719
724
|
function Te(e, t, n) {
|
|
720
725
|
if (e === "Backspace" || e === "Delete")
|
|
@@ -725,74 +730,60 @@ function Te(e, t, n) {
|
|
|
725
730
|
};
|
|
726
731
|
}
|
|
727
732
|
function xe(e, t) {
|
|
728
|
-
const { decimalSeparator: n } =
|
|
733
|
+
const { decimalSeparator: n } = A(t), r = e.target;
|
|
729
734
|
if (V(e, r, t, n)) {
|
|
730
735
|
e.preventDefault();
|
|
731
736
|
return;
|
|
732
737
|
}
|
|
733
|
-
return
|
|
738
|
+
return $e(e, r, t), Te(e.key, r.selectionStart, r.selectionEnd);
|
|
734
739
|
}
|
|
735
740
|
function Ie(e, t, n, r) {
|
|
736
|
-
const i = e.target,
|
|
737
|
-
|
|
741
|
+
const i = e.target, o = i.value, s = ve(i), a = A(r), c = (r == null ? void 0 : r.formatOn) === v.Change, { formatted: l, raw: h } = x(
|
|
742
|
+
o,
|
|
738
743
|
t,
|
|
739
|
-
c,
|
|
740
744
|
r,
|
|
741
|
-
|
|
745
|
+
c
|
|
742
746
|
);
|
|
743
|
-
i.value = l,
|
|
747
|
+
return i.value = l, o !== l && Ee(
|
|
744
748
|
i,
|
|
745
|
-
|
|
749
|
+
o,
|
|
746
750
|
l,
|
|
747
751
|
s,
|
|
748
752
|
n,
|
|
749
|
-
|
|
753
|
+
a,
|
|
750
754
|
r
|
|
751
|
-
);
|
|
755
|
+
), { formatted: l, raw: h };
|
|
752
756
|
}
|
|
753
757
|
function Re(e, t, n, r) {
|
|
754
758
|
const i = r - n;
|
|
755
759
|
return e + t + i;
|
|
756
760
|
}
|
|
757
761
|
function Oe(e, t, n) {
|
|
758
|
-
var
|
|
762
|
+
var u;
|
|
759
763
|
e.preventDefault();
|
|
760
|
-
const r = e.target, { value: i, selectionStart:
|
|
761
|
-
|
|
764
|
+
const r = e.target, { value: i, selectionStart: o, selectionEnd: s } = r, a = ((u = e.clipboardData) == null ? void 0 : u.getData("text/plain")) || "", c = i.slice(0, o || 0) + a + i.slice(s || 0), { formatted: l, raw: h } = x(
|
|
765
|
+
c,
|
|
762
766
|
t,
|
|
763
|
-
!0,
|
|
764
767
|
n,
|
|
765
|
-
|
|
768
|
+
!0
|
|
766
769
|
);
|
|
767
|
-
r.value =
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
+
r.value = l;
|
|
771
|
+
const d = Re(
|
|
772
|
+
o || 0,
|
|
773
|
+
a.length,
|
|
770
774
|
c.length,
|
|
771
|
-
l.length
|
|
772
|
-
h.length
|
|
775
|
+
l.length
|
|
773
776
|
);
|
|
774
|
-
return r.setSelectionRange(
|
|
775
|
-
}
|
|
776
|
-
function Ke(e, t, n) {
|
|
777
|
-
if (!e)
|
|
778
|
-
return e;
|
|
779
|
-
const r = y(n), i = !0, { formatted: a } = x(
|
|
780
|
-
e,
|
|
781
|
-
t,
|
|
782
|
-
i,
|
|
783
|
-
n,
|
|
784
|
-
r
|
|
785
|
-
);
|
|
786
|
-
return a;
|
|
777
|
+
return r.setSelectionRange(d, d), { formatted: l, raw: h };
|
|
787
778
|
}
|
|
788
779
|
function _e(e, t) {
|
|
789
780
|
const n = D(e);
|
|
790
781
|
return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
|
|
791
782
|
}
|
|
792
|
-
function Pe(e) {
|
|
793
|
-
Be(e.decimalMaxLength), We(e.decimalMinLength), ke(e.decimalMinLength, e.decimalMaxLength), Ze(e.formatOn), Ge(e.thousandSeparator), Ue(e.thousandStyle), ze(e.decimalSeparator), je(e.thousandSeparator, e.decimalSeparator), m("enableCompactNotation", e.enableCompactNotation), m("enableNegative", e.enableNegative), m("enableLeadingZeros", e.enableLeadingZeros), m("rawValueMode", e.rawValueMode), Je(e.onChange);
|
|
794
|
-
}
|
|
795
783
|
function Be(e) {
|
|
784
|
+
Pe(e.decimalMaxLength), We(e.decimalMinLength), ke(e.decimalMinLength, e.decimalMaxLength), Ze(e.formatOn), ze(e.thousandSeparator), Ge(e.thousandStyle), Ue(e.decimalSeparator), je(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), Je(e.onChange);
|
|
785
|
+
}
|
|
786
|
+
function Pe(e) {
|
|
796
787
|
if (e !== void 0) {
|
|
797
788
|
if (typeof e != "number")
|
|
798
789
|
throw new Error(
|
|
@@ -836,7 +827,7 @@ function Ze(e) {
|
|
|
836
827
|
`formatOn must be either ${v.Blur} or ${v.Change}. Received: ${JSON.stringify(e)}`
|
|
837
828
|
);
|
|
838
829
|
}
|
|
839
|
-
function
|
|
830
|
+
function ze(e) {
|
|
840
831
|
if (e !== void 0) {
|
|
841
832
|
if (typeof e != "string")
|
|
842
833
|
throw new Error(
|
|
@@ -852,13 +843,13 @@ function Ge(e) {
|
|
|
852
843
|
);
|
|
853
844
|
}
|
|
854
845
|
}
|
|
855
|
-
function
|
|
856
|
-
if (e !== void 0 && !Object.values(
|
|
846
|
+
function Ge(e) {
|
|
847
|
+
if (e !== void 0 && !Object.values(S).includes(e))
|
|
857
848
|
throw new Error(
|
|
858
|
-
`ThousandStyle must be one of: ${Object.values(
|
|
849
|
+
`ThousandStyle must be one of: ${Object.values(S).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
|
|
859
850
|
);
|
|
860
851
|
}
|
|
861
|
-
function
|
|
852
|
+
function Ue(e) {
|
|
862
853
|
if (e !== void 0) {
|
|
863
854
|
if (typeof e != "string")
|
|
864
855
|
throw new Error(
|
|
@@ -880,7 +871,7 @@ function je(e, t) {
|
|
|
880
871
|
`Decimal separator can't be same as thousand separator. thousandSeparator: ${e}, decimalSeparator: ${t}`
|
|
881
872
|
);
|
|
882
873
|
}
|
|
883
|
-
function
|
|
874
|
+
function M(e, t) {
|
|
884
875
|
if (t !== void 0 && typeof t != "boolean")
|
|
885
876
|
throw new Error(
|
|
886
877
|
`${e} must be a boolean. Received: ${typeof t} (${JSON.stringify(t)})`
|
|
@@ -897,28 +888,28 @@ class Qe {
|
|
|
897
888
|
decimalMaxLength: n = I,
|
|
898
889
|
decimalMinLength: r = R,
|
|
899
890
|
formatOn: i = O,
|
|
900
|
-
thousandSeparator:
|
|
901
|
-
thousandStyle: s =
|
|
902
|
-
decimalSeparator:
|
|
903
|
-
enableCompactNotation: c =
|
|
904
|
-
enableNegative: l =
|
|
905
|
-
enableLeadingZeros: h =
|
|
906
|
-
rawValueMode: d =
|
|
891
|
+
thousandSeparator: o = _,
|
|
892
|
+
thousandStyle: s = B,
|
|
893
|
+
decimalSeparator: a = E,
|
|
894
|
+
enableCompactNotation: c = !0,
|
|
895
|
+
enableNegative: l = P,
|
|
896
|
+
enableLeadingZeros: h = W,
|
|
897
|
+
rawValueMode: d = k,
|
|
907
898
|
onChange: u,
|
|
908
|
-
...
|
|
899
|
+
...g
|
|
909
900
|
}) {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
if (
|
|
901
|
+
L(this, "element");
|
|
902
|
+
L(this, "options");
|
|
903
|
+
L(this, "resolvedOptions");
|
|
904
|
+
L(this, "rawValue", "");
|
|
905
|
+
L(this, "caretPositionBeforeChange");
|
|
906
|
+
if (Be({
|
|
916
907
|
decimalMaxLength: n,
|
|
917
908
|
decimalMinLength: r,
|
|
918
909
|
formatOn: i,
|
|
919
|
-
thousandSeparator:
|
|
910
|
+
thousandSeparator: o,
|
|
920
911
|
thousandStyle: s,
|
|
921
|
-
decimalSeparator:
|
|
912
|
+
decimalSeparator: a,
|
|
922
913
|
enableCompactNotation: c,
|
|
923
914
|
enableNegative: l,
|
|
924
915
|
enableLeadingZeros: h,
|
|
@@ -929,52 +920,48 @@ class Qe {
|
|
|
929
920
|
decimalMinLength: r,
|
|
930
921
|
onChange: u,
|
|
931
922
|
formatOn: i,
|
|
932
|
-
thousandSeparator:
|
|
923
|
+
thousandSeparator: o,
|
|
933
924
|
thousandStyle: s,
|
|
934
|
-
decimalSeparator:
|
|
925
|
+
decimalSeparator: a,
|
|
935
926
|
enableCompactNotation: c,
|
|
936
927
|
enableNegative: l,
|
|
937
928
|
enableLeadingZeros: h,
|
|
938
929
|
rawValueMode: d,
|
|
939
|
-
...
|
|
930
|
+
...g
|
|
940
931
|
}, this.resolvedOptions = this.getResolvedOptions(), this.createInputElement(t), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
|
|
941
|
-
const
|
|
932
|
+
const f = this.element.value, p = this.resolvedOptions.thousandSeparator ? w(f, this.resolvedOptions.thousandSeparator) : f;
|
|
942
933
|
this.rawValue = p, this.element.value = this.formatValueForDisplay(p);
|
|
943
|
-
} else if (this.element.value
|
|
944
|
-
const
|
|
945
|
-
this.element.value = this.formatValueForDisplay(
|
|
934
|
+
} else if (this.element.value) {
|
|
935
|
+
const f = this.element.value;
|
|
936
|
+
this.element.value = this.formatValueForDisplay(f);
|
|
946
937
|
}
|
|
947
938
|
}
|
|
948
939
|
createInputElement(t) {
|
|
949
940
|
if (this.element = document.createElement("input"), this.element.setAttribute("type", "text"), this.element.setAttribute("inputmode", "decimal"), this.element.setAttribute("spellcheck", "false"), this.element.setAttribute("autocomplete", "off"), this.resolvedOptions.decimalSeparator !== void 0 && this.resolvedOptions.enableNegative !== void 0) {
|
|
950
|
-
const
|
|
951
|
-
this.element.setAttribute("pattern",
|
|
941
|
+
const H = _e(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
|
|
942
|
+
this.element.setAttribute("pattern", H);
|
|
952
943
|
}
|
|
953
944
|
const {
|
|
954
945
|
decimalMaxLength: n,
|
|
955
946
|
decimalMinLength: r,
|
|
956
947
|
formatOn: i,
|
|
957
|
-
thousandSeparator:
|
|
948
|
+
thousandSeparator: o,
|
|
958
949
|
thousandStyle: s,
|
|
959
|
-
decimalSeparator:
|
|
950
|
+
decimalSeparator: a,
|
|
960
951
|
enableCompactNotation: c,
|
|
961
952
|
enableNegative: l,
|
|
962
953
|
enableLeadingZeros: h,
|
|
963
954
|
rawValueMode: d,
|
|
964
955
|
onChange: u,
|
|
965
|
-
value:
|
|
966
|
-
defaultValue:
|
|
956
|
+
value: g,
|
|
957
|
+
defaultValue: f,
|
|
967
958
|
type: p,
|
|
968
|
-
// Exclude - forced to 'text' above
|
|
969
959
|
inputMode: $,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
// Exclude - forced to 'false' above
|
|
973
|
-
autocomplete: He,
|
|
974
|
-
// Exclude - forced to 'off' above
|
|
960
|
+
spellcheck: m,
|
|
961
|
+
autocomplete: qe,
|
|
975
962
|
...q
|
|
976
963
|
} = this.options;
|
|
977
|
-
Object.assign(this.element, q),
|
|
964
|
+
Object.assign(this.element, q), g !== void 0 ? this.element.value = g : f !== void 0 && (this.element.defaultValue = f, this.element.value = f), t.appendChild(this.element);
|
|
978
965
|
}
|
|
979
966
|
setupEventListeners() {
|
|
980
967
|
this.element.addEventListener("input", this.handleChange.bind(this)), this.element.addEventListener("keydown", this.handleKeyDown.bind(this)), this.element.addEventListener("paste", this.handlePaste.bind(this)), this.resolvedOptions.formatOn === v.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
|
|
@@ -985,12 +972,12 @@ class Qe {
|
|
|
985
972
|
decimalMinLength: this.options.decimalMinLength ?? R,
|
|
986
973
|
formatOn: this.options.formatOn ?? O,
|
|
987
974
|
thousandSeparator: this.options.thousandSeparator ?? _,
|
|
988
|
-
thousandStyle: this.options.thousandStyle ??
|
|
975
|
+
thousandStyle: this.options.thousandStyle ?? B,
|
|
989
976
|
decimalSeparator: this.options.decimalSeparator ?? E,
|
|
990
|
-
enableCompactNotation: this.options.enableCompactNotation ??
|
|
991
|
-
enableNegative: this.options.enableNegative ??
|
|
992
|
-
enableLeadingZeros: this.options.enableLeadingZeros ??
|
|
993
|
-
rawValueMode: this.options.rawValueMode ??
|
|
977
|
+
enableCompactNotation: this.options.enableCompactNotation ?? X,
|
|
978
|
+
enableNegative: this.options.enableNegative ?? P,
|
|
979
|
+
enableLeadingZeros: this.options.enableLeadingZeros ?? W,
|
|
980
|
+
rawValueMode: this.options.rawValueMode ?? k,
|
|
994
981
|
onChange: this.options.onChange
|
|
995
982
|
};
|
|
996
983
|
}
|
|
@@ -1008,39 +995,38 @@ class Qe {
|
|
|
1008
995
|
};
|
|
1009
996
|
}
|
|
1010
997
|
handleValueChange(t, n) {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
this.resolvedOptions.onChange(i);
|
|
998
|
+
if (this.resolvedOptions.rawValueMode && n !== void 0 && (this.rawValue = n), this.resolvedOptions.onChange) {
|
|
999
|
+
const r = this.resolvedOptions.rawValueMode ? this.rawValue : t;
|
|
1000
|
+
this.resolvedOptions.onChange(r);
|
|
1015
1001
|
}
|
|
1016
1002
|
}
|
|
1017
1003
|
formatValueForDisplay(t) {
|
|
1018
1004
|
if (!t)
|
|
1019
1005
|
return t;
|
|
1020
|
-
const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: i, decimalSeparator:
|
|
1021
|
-
return n && r !==
|
|
1006
|
+
const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: i, decimalSeparator: o } = this.resolvedOptions;
|
|
1007
|
+
return n && r !== S.None ? G(
|
|
1022
1008
|
t,
|
|
1023
1009
|
n,
|
|
1024
1010
|
r,
|
|
1025
1011
|
i,
|
|
1026
|
-
|
|
1012
|
+
o
|
|
1027
1013
|
) : t;
|
|
1028
1014
|
}
|
|
1029
1015
|
handleChange(t) {
|
|
1030
|
-
const n =
|
|
1031
|
-
Ie(
|
|
1016
|
+
const { formatted: n, raw: r } = Ie(
|
|
1032
1017
|
t,
|
|
1033
1018
|
this.resolvedOptions.decimalMaxLength,
|
|
1034
1019
|
this.caretPositionBeforeChange,
|
|
1035
1020
|
this.buildFormattingOptions()
|
|
1036
|
-
)
|
|
1021
|
+
);
|
|
1022
|
+
this.caretPositionBeforeChange = void 0, this.handleValueChange(n, r);
|
|
1037
1023
|
}
|
|
1038
1024
|
handleKeyDown(t) {
|
|
1039
|
-
const n = t.target, { selectionStart: r, selectionEnd: i } = n,
|
|
1040
|
-
formatOn:
|
|
1041
|
-
thousandSeparator:
|
|
1042
|
-
ThousandStyle:
|
|
1043
|
-
decimalSeparator:
|
|
1025
|
+
const n = t.target, { selectionStart: r, selectionEnd: i } = n, o = this.buildFormattingOptions(), s = xe(t, {
|
|
1026
|
+
formatOn: o.formatOn,
|
|
1027
|
+
thousandSeparator: o.thousandSeparator,
|
|
1028
|
+
ThousandStyle: o.ThousandStyle,
|
|
1029
|
+
decimalSeparator: o.decimalSeparator
|
|
1044
1030
|
});
|
|
1045
1031
|
s ? this.caretPositionBeforeChange = {
|
|
1046
1032
|
selectionStart: r ?? 0,
|
|
@@ -1052,51 +1038,37 @@ class Qe {
|
|
|
1052
1038
|
};
|
|
1053
1039
|
}
|
|
1054
1040
|
handlePaste(t) {
|
|
1055
|
-
const n = Oe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
|
|
1056
|
-
this.handleValueChange(n);
|
|
1057
|
-
const
|
|
1058
|
-
this.element.dispatchEvent(
|
|
1041
|
+
const { formatted: n, raw: r } = Oe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
|
|
1042
|
+
this.handleValueChange(n, r);
|
|
1043
|
+
const i = new Event("input", { bubbles: !0, cancelable: !0 });
|
|
1044
|
+
this.element.dispatchEvent(i);
|
|
1059
1045
|
}
|
|
1060
1046
|
handleFocus(t) {
|
|
1061
1047
|
if (this.resolvedOptions.formatOn === v.Blur && this.resolvedOptions.thousandSeparator) {
|
|
1062
1048
|
const n = t.target;
|
|
1063
|
-
n.value =
|
|
1049
|
+
n.value = w(n.value, this.resolvedOptions.thousandSeparator);
|
|
1064
1050
|
}
|
|
1065
1051
|
}
|
|
1066
1052
|
handleBlur(t) {
|
|
1067
1053
|
const n = t.target, { thousandSeparator: r, thousandStyle: i } = this.resolvedOptions;
|
|
1068
|
-
if (r && i !==
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
const c = new Event("
|
|
1054
|
+
if (r && i !== S.None && n.value) {
|
|
1055
|
+
const o = n.value, s = this.formatValueForDisplay(n.value);
|
|
1056
|
+
n.value = s;
|
|
1057
|
+
const a = this.resolvedOptions.rawValueMode ? w(s, r) : void 0;
|
|
1058
|
+
if (this.handleValueChange(s, a), o !== s) {
|
|
1059
|
+
const c = new Event("input", { bubbles: !0, cancelable: !0 });
|
|
1074
1060
|
this.element.dispatchEvent(c);
|
|
1061
|
+
const l = new Event("change", { bubbles: !0, cancelable: !0 });
|
|
1062
|
+
this.element.dispatchEvent(l);
|
|
1075
1063
|
}
|
|
1076
1064
|
}
|
|
1077
1065
|
}
|
|
1078
|
-
/**
|
|
1079
|
-
* Extracts and stores the raw numeric value from a formatted value.
|
|
1080
|
-
* Gets the raw value from the data attribute set by event handlers, or extracts it from formatted value.
|
|
1081
|
-
*/
|
|
1082
|
-
updateRawValue(t) {
|
|
1083
|
-
const n = this.element.getAttribute("data-raw-value");
|
|
1084
|
-
if (n !== null) {
|
|
1085
|
-
this.rawValue = n, this.element.removeAttribute("data-raw-value");
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
if (!this.resolvedOptions.thousandSeparator) {
|
|
1089
|
-
this.rawValue = t;
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
this.rawValue = L(t, this.resolvedOptions.thousandSeparator);
|
|
1093
|
-
}
|
|
1094
1066
|
getValue() {
|
|
1095
1067
|
return this.resolvedOptions.rawValueMode ? this.rawValue : this.element.value;
|
|
1096
1068
|
}
|
|
1097
1069
|
setValue(t) {
|
|
1098
1070
|
if (this.resolvedOptions.rawValueMode) {
|
|
1099
|
-
const n = this.resolvedOptions.thousandSeparator ?
|
|
1071
|
+
const n = this.resolvedOptions.thousandSeparator ? w(t, this.resolvedOptions.thousandSeparator) : t;
|
|
1100
1072
|
this.rawValue = n, this.element.value = this.formatValueForDisplay(n);
|
|
1101
1073
|
} else
|
|
1102
1074
|
this.element.value = t;
|
|
@@ -1144,7 +1116,7 @@ class Qe {
|
|
|
1144
1116
|
const t = this.getValue();
|
|
1145
1117
|
if (!t)
|
|
1146
1118
|
return NaN;
|
|
1147
|
-
const n = this.resolvedOptions.thousandSeparator ?
|
|
1119
|
+
const n = this.resolvedOptions.thousandSeparator ? w(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(D(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
|
|
1148
1120
|
return parseFloat(r);
|
|
1149
1121
|
}
|
|
1150
1122
|
/**
|
|
@@ -1162,9 +1134,10 @@ class Qe {
|
|
|
1162
1134
|
export {
|
|
1163
1135
|
v as FormatOn,
|
|
1164
1136
|
Qe as NumoraInput,
|
|
1165
|
-
|
|
1166
|
-
Ke as
|
|
1137
|
+
S as ThousandStyle,
|
|
1138
|
+
Ke as formatValue,
|
|
1167
1139
|
Ie as handleOnChangeNumoraInput,
|
|
1168
1140
|
xe as handleOnKeyDownNumoraInput,
|
|
1169
|
-
Oe as handleOnPasteNumoraInput
|
|
1141
|
+
Oe as handleOnPasteNumoraInput,
|
|
1142
|
+
x as processAndFormatValue
|
|
1170
1143
|
};
|