numora 3.1.0 → 3.2.0
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/README.md +33 -213
- package/dist/NumoraInput.d.ts +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +238 -207
- package/dist/types.d.ts +2 -1
- package/dist/utils/locale.d.ts +14 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var b = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(b || {}),
|
|
5
|
-
const
|
|
1
|
+
var te = Object.defineProperty;
|
|
2
|
+
var ne = (e, t, n) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var D = (e, t, n) => ne(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
var b = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(b || {}), m = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e.Locale = "locale", e))(m || {});
|
|
5
|
+
const G = 2, Z = 0, k = b.Blur, re = ",", H = m.None, v = ".", B = !1, P = !1, W = !1, U = !1;
|
|
6
6
|
function w(e) {
|
|
7
7
|
return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
function
|
|
9
|
+
const z = /* @__PURE__ */ new Map();
|
|
10
|
+
function T(e, t = "g") {
|
|
11
11
|
const n = `${e}:${t}`;
|
|
12
|
-
let r =
|
|
13
|
-
return r || (r = new RegExp(e, t),
|
|
12
|
+
let r = z.get(n);
|
|
13
|
+
return r || (r = new RegExp(e, t), z.set(n, r)), r;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function ie(e, t = "g") {
|
|
16
16
|
const n = w(e);
|
|
17
|
-
return
|
|
17
|
+
return T(n, t);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
19
|
+
const se = /[.,]/g;
|
|
20
|
+
function _(e) {
|
|
21
21
|
return {
|
|
22
|
-
decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ??
|
|
22
|
+
decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? v,
|
|
23
23
|
thousandSeparator: e == null ? void 0 : e.thousandSeparator
|
|
24
24
|
};
|
|
25
25
|
}
|
|
@@ -31,15 +31,15 @@ function Y(e, t) {
|
|
|
31
31
|
decimal: s
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ae(e, t) {
|
|
35
35
|
if (!e.value.includes(t)) return !1;
|
|
36
36
|
const { selectionStart: n, selectionEnd: r, value: i } = e;
|
|
37
37
|
return !i.slice(n ?? 0, r ?? 0).includes(t);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function ce(e, t, n) {
|
|
40
40
|
const { key: r } = e;
|
|
41
41
|
if (r !== "," && r !== ".") return !1;
|
|
42
|
-
if (
|
|
42
|
+
if (ae(t, n))
|
|
43
43
|
return !0;
|
|
44
44
|
if (r !== n) {
|
|
45
45
|
const { selectionStart: i, selectionEnd: s, value: a } = t, c = i ?? 0, l = s ?? c;
|
|
@@ -49,29 +49,29 @@ function oe(e, t, n) {
|
|
|
49
49
|
}
|
|
50
50
|
return !1;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const oe = (e, t, n = v) => {
|
|
53
53
|
const { sign: r, integer: i, decimal: s } = Y(e, n);
|
|
54
54
|
if (!s) return e;
|
|
55
55
|
const a = s.slice(0, t);
|
|
56
56
|
return `${r}${i}${n}${a}`;
|
|
57
|
-
},
|
|
57
|
+
}, le = (e, t = v) => {
|
|
58
58
|
const n = e.indexOf(t);
|
|
59
59
|
if (n === -1 || n === e.length - 1) return e;
|
|
60
|
-
const r = e.slice(0, n + 1), i = e.slice(n + 1), a = t === "." || t === "," ?
|
|
60
|
+
const r = e.slice(0, n + 1), i = e.slice(n + 1), a = t === "." || t === "," ? se : T("[,\\." + w(t) + "]", "g");
|
|
61
61
|
return r + i.replace(a, "");
|
|
62
|
-
},
|
|
62
|
+
}, he = (e, t = 0, n = v) => {
|
|
63
63
|
if (t <= 0) return e;
|
|
64
64
|
const { sign: r, integer: i, decimal: s } = Y(e, n);
|
|
65
65
|
if (s.length >= t)
|
|
66
66
|
return e;
|
|
67
67
|
const a = s.padEnd(t, "0");
|
|
68
68
|
return `${r}${i}${n}${a}`;
|
|
69
|
-
},
|
|
69
|
+
}, $ = {
|
|
70
70
|
thousand: { size: 3 },
|
|
71
71
|
lakh: { firstGroup: 3, restGroup: 2 },
|
|
72
72
|
wan: { size: 4 }
|
|
73
|
-
},
|
|
74
|
-
function Q(e, t, n =
|
|
73
|
+
}, ue = /^(0+)/;
|
|
74
|
+
function Q(e, t, n = m.Thousand, r = !1, i = ".") {
|
|
75
75
|
if (!e || e === "0" || e === i || e === "-" || e === `-${i}`)
|
|
76
76
|
return e;
|
|
77
77
|
const s = e.includes(i), a = e.startsWith("-"), c = a ? e.slice(1) : e, [l, o] = c.split(i);
|
|
@@ -80,56 +80,56 @@ function Q(e, t, n = p.Thousand, r = !1, i = ".") {
|
|
|
80
80
|
return a ? `-${u}` : u;
|
|
81
81
|
}
|
|
82
82
|
if (r && l.startsWith("0") && l.length > 1) {
|
|
83
|
-
const u = l.match(
|
|
83
|
+
const u = l.match(ue);
|
|
84
84
|
if (u) {
|
|
85
|
-
const g = u[1],
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
return s ? o ? `${
|
|
85
|
+
const g = u[1], S = l.slice(g.length);
|
|
86
|
+
if (S) {
|
|
87
|
+
const E = J(S, t, n), f = g + E, p = a ? "-" : "";
|
|
88
|
+
return s ? o ? `${p}${f}${i}${o}` : `${p}${f}${i}` : `${p}${f}`;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
const h =
|
|
92
|
+
const h = J(l, t, n), d = a ? "-" : "";
|
|
93
93
|
return s ? o ? `${d}${h}${i}${o}` : `${d}${h}${i}` : `${d}${h}`;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function J(e, t, n) {
|
|
96
96
|
if (e === "0" || e === "")
|
|
97
97
|
return e;
|
|
98
98
|
switch (n) {
|
|
99
|
-
case
|
|
99
|
+
case m.None:
|
|
100
100
|
return e;
|
|
101
|
-
case
|
|
102
|
-
return
|
|
103
|
-
case
|
|
104
|
-
return
|
|
105
|
-
case
|
|
106
|
-
return
|
|
101
|
+
case m.Thousand:
|
|
102
|
+
return X(e, t, $.thousand.size);
|
|
103
|
+
case m.Lakh:
|
|
104
|
+
return de(e, t);
|
|
105
|
+
case m.Wan:
|
|
106
|
+
return X(e, t, $.wan.size);
|
|
107
107
|
default:
|
|
108
108
|
return e;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (e.length <=
|
|
111
|
+
function de(e, t) {
|
|
112
|
+
if (e.length <= $.lakh.firstGroup)
|
|
113
113
|
return e;
|
|
114
|
-
const n = [], r = e.length -
|
|
114
|
+
const n = [], r = e.length - $.lakh.firstGroup;
|
|
115
115
|
n.unshift(e.slice(r));
|
|
116
|
-
for (let i = r; i > 0; i -=
|
|
117
|
-
n.unshift(e.slice(Math.max(0, i -
|
|
116
|
+
for (let i = r; i > 0; i -= $.lakh.restGroup)
|
|
117
|
+
n.unshift(e.slice(Math.max(0, i - $.lakh.restGroup), i));
|
|
118
118
|
return n.join(t);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function X(e, t, n) {
|
|
121
121
|
const r = [];
|
|
122
122
|
for (let i = e.length; i > 0; i -= n)
|
|
123
123
|
r.unshift(e.slice(Math.max(0, i - n), i));
|
|
124
124
|
return r.join(t);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function fe(e, t, n) {
|
|
127
127
|
return (t == null ? void 0 : t.formatOn) === b.Change && t.thousandSeparator ? Q(
|
|
128
128
|
e,
|
|
129
129
|
t.thousandSeparator,
|
|
130
|
-
t.ThousandStyle ??
|
|
130
|
+
t.ThousandStyle ?? m.None,
|
|
131
131
|
t.enableLeadingZeros,
|
|
132
|
-
(n == null ? void 0 : n.decimalSeparator) ??
|
|
132
|
+
(n == null ? void 0 : n.decimalSeparator) ?? v
|
|
133
133
|
) : e;
|
|
134
134
|
}
|
|
135
135
|
function L(e, t, n) {
|
|
@@ -138,7 +138,7 @@ function L(e, t, n) {
|
|
|
138
138
|
e[i] !== n && r++;
|
|
139
139
|
return r;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function ge(e, t, n) {
|
|
142
142
|
if (t === 0)
|
|
143
143
|
return 0;
|
|
144
144
|
let r = 0;
|
|
@@ -150,7 +150,7 @@ function Se(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return e.length;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function I(e, t, n) {
|
|
154
154
|
if (t === 0)
|
|
155
155
|
return 0;
|
|
156
156
|
let r = 0;
|
|
@@ -166,8 +166,8 @@ function y(e, t, n) {
|
|
|
166
166
|
function V(e, t, n) {
|
|
167
167
|
return t < 0 || t >= e.length ? !1 : e[t] === n;
|
|
168
168
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
169
|
+
const Se = /\d/;
|
|
170
|
+
function Ee(e, t = {}) {
|
|
171
171
|
const {
|
|
172
172
|
thousandSeparator: n,
|
|
173
173
|
decimalSeparator: r = ".",
|
|
@@ -180,11 +180,11 @@ function pe(e, t = {}) {
|
|
|
180
180
|
}
|
|
181
181
|
for (let c = 0; c < e.length; c++) {
|
|
182
182
|
const l = e[c];
|
|
183
|
-
(n && l === n || l === r) && (a[c] = !1, c + 1 < e.length && !
|
|
183
|
+
(n && l === n || l === r) && (a[c] = !1, c + 1 < e.length && !Se.test(e[c + 1]) && (a[c + 1] = !1));
|
|
184
184
|
}
|
|
185
185
|
return a.some((c) => c) || a.fill(!0), a;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function x(e, t, n, r) {
|
|
188
188
|
const i = e.length;
|
|
189
189
|
if (t = Math.max(0, Math.min(t, i)), !n[t]) {
|
|
190
190
|
let s = t;
|
|
@@ -197,11 +197,11 @@ function _(e, t, n, r) {
|
|
|
197
197
|
}
|
|
198
198
|
return (t === -1 || t > i) && (t = i), t;
|
|
199
199
|
}
|
|
200
|
-
const
|
|
200
|
+
const j = /(\d+\.?\d*)\s*[kmbt]$/i, me = (e, t) => e === t;
|
|
201
201
|
function be(e, t, n, r, i, s, a = ".", c = {}) {
|
|
202
202
|
if (n < 0)
|
|
203
203
|
return 0;
|
|
204
|
-
if (n > e.length || e === "" || t === "" ||
|
|
204
|
+
if (n > e.length || e === "" || t === "" || j.test(e) && !j.test(t) && t.length > e.length && n >= e.length - 1)
|
|
205
205
|
return t.length;
|
|
206
206
|
const l = t.length < e.length, o = V(
|
|
207
207
|
e,
|
|
@@ -209,23 +209,23 @@ function be(e, t, n, r, i, s, a = ".", c = {}) {
|
|
|
209
209
|
r
|
|
210
210
|
), h = e.indexOf(a), d = t.indexOf(a);
|
|
211
211
|
if (c.isCharacterEquivalent && e !== t) {
|
|
212
|
-
const
|
|
212
|
+
const f = pe(
|
|
213
213
|
e,
|
|
214
214
|
t,
|
|
215
215
|
n,
|
|
216
|
-
c.isCharacterEquivalent ||
|
|
216
|
+
c.isCharacterEquivalent || me,
|
|
217
217
|
s,
|
|
218
218
|
c
|
|
219
219
|
);
|
|
220
|
-
if (
|
|
221
|
-
return
|
|
220
|
+
if (f !== void 0)
|
|
221
|
+
return f;
|
|
222
222
|
}
|
|
223
|
-
const g = /* @__PURE__ */ new Map(),
|
|
224
|
-
const C = `${
|
|
225
|
-
return g.has(C) || g.set(C, L(
|
|
223
|
+
const g = /* @__PURE__ */ new Map(), S = (f, p, y) => {
|
|
224
|
+
const C = `${f === e ? "o" : "n"}:${p}`;
|
|
225
|
+
return g.has(C) || g.set(C, L(f, p, r)), g.get(C);
|
|
226
226
|
};
|
|
227
227
|
if (l)
|
|
228
|
-
return
|
|
228
|
+
return Le(
|
|
229
229
|
e,
|
|
230
230
|
t,
|
|
231
231
|
n,
|
|
@@ -235,47 +235,47 @@ function be(e, t, n, r, i, s, a = ".", c = {}) {
|
|
|
235
235
|
d,
|
|
236
236
|
s,
|
|
237
237
|
c,
|
|
238
|
-
|
|
238
|
+
S
|
|
239
239
|
);
|
|
240
|
-
const
|
|
240
|
+
const E = De(
|
|
241
241
|
e,
|
|
242
242
|
t,
|
|
243
243
|
n,
|
|
244
244
|
r,
|
|
245
245
|
o,
|
|
246
|
-
|
|
246
|
+
S
|
|
247
247
|
);
|
|
248
|
-
return c.boundary ?
|
|
248
|
+
return c.boundary ? x(t, E, c.boundary) : E;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function pe(e, t, n, r, i, s) {
|
|
251
251
|
const a = e.length, c = t.length;
|
|
252
252
|
let l = 0, o = 0, h = c;
|
|
253
253
|
for (let u = 0; u < a; u++) {
|
|
254
254
|
let g = -1;
|
|
255
|
-
for (let
|
|
255
|
+
for (let S = l; S < c; S++)
|
|
256
256
|
if (r(
|
|
257
257
|
e[u],
|
|
258
|
-
t[
|
|
258
|
+
t[S],
|
|
259
259
|
{
|
|
260
260
|
oldValue: e,
|
|
261
261
|
newValue: t,
|
|
262
262
|
typedRange: i,
|
|
263
263
|
oldIndex: u,
|
|
264
|
-
newIndex:
|
|
264
|
+
newIndex: S
|
|
265
265
|
}
|
|
266
266
|
)) {
|
|
267
|
-
g =
|
|
267
|
+
g = S;
|
|
268
268
|
break;
|
|
269
269
|
}
|
|
270
270
|
g !== -1 && (l = g + 1, u < n ? o = g + 1 : h === c && /\d/.test(e[u]) && (h = g));
|
|
271
271
|
}
|
|
272
272
|
if (o > h) return h;
|
|
273
273
|
const d = n - o < h - n ? o : h;
|
|
274
|
-
return s.boundary ?
|
|
274
|
+
return s.boundary ? x(t, d, s.boundary) : d;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function Le(e, t, n, r, i, s, a, c, l = {}, o = L) {
|
|
277
277
|
if (i)
|
|
278
|
-
return
|
|
278
|
+
return Ne(
|
|
279
279
|
e,
|
|
280
280
|
t,
|
|
281
281
|
n,
|
|
@@ -283,7 +283,7 @@ function Ne(e, t, n, r, i, s, a, c, l = {}, o = L) {
|
|
|
283
283
|
a,
|
|
284
284
|
o
|
|
285
285
|
);
|
|
286
|
-
const h = o(e, n, r), d = o(e, e.length, r), u = o(t, t.length, r), g = d - u,
|
|
286
|
+
const h = o(e, n, r), d = o(e, e.length, r), u = o(t, t.length, r), g = d - u, S = $e(
|
|
287
287
|
e,
|
|
288
288
|
n,
|
|
289
289
|
r,
|
|
@@ -292,22 +292,22 @@ function Ne(e, t, n, r, i, s, a, c, l = {}, o = L) {
|
|
|
292
292
|
s,
|
|
293
293
|
c,
|
|
294
294
|
o
|
|
295
|
-
),
|
|
295
|
+
), E = s === -1 || n <= s, f = ve(
|
|
296
296
|
t,
|
|
297
|
-
|
|
297
|
+
S,
|
|
298
298
|
r,
|
|
299
299
|
g,
|
|
300
300
|
c,
|
|
301
|
-
|
|
301
|
+
E,
|
|
302
302
|
a,
|
|
303
303
|
o
|
|
304
304
|
);
|
|
305
|
-
return l.boundary ?
|
|
305
|
+
return l.boundary ? x(t, f, l.boundary) : f;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function Ne(e, t, n, r, i, s = L) {
|
|
308
308
|
const a = n + 1;
|
|
309
309
|
if (a < e.length) {
|
|
310
|
-
const c = s(e, a, r), l =
|
|
310
|
+
const c = s(e, a, r), l = ge(
|
|
311
311
|
t,
|
|
312
312
|
c,
|
|
313
313
|
r
|
|
@@ -323,7 +323,7 @@ function $e(e, t, n, r, i, s, a, c = L) {
|
|
|
323
323
|
}
|
|
324
324
|
return t > 0 && e[t - 1] === n && i > 0 ? r + 1 : r;
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function K(e, t, n, r, i, s, a = L) {
|
|
327
327
|
if (t > 0 && t < e.length && a(e, t, r) === n) {
|
|
328
328
|
if (e[t] === r && s && i > 0 && t < e.length - 1)
|
|
329
329
|
return t + 1;
|
|
@@ -332,33 +332,33 @@ function q(e, t, n, r, i, s, a = L) {
|
|
|
332
332
|
}
|
|
333
333
|
return t;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function ve(e, t, n, r, i, s, a, c = L) {
|
|
336
336
|
if (s && a !== -1) {
|
|
337
337
|
const o = e.substring(0, a), h = c(o, o.length, n);
|
|
338
338
|
if (t <= h) {
|
|
339
|
-
const d =
|
|
339
|
+
const d = I(
|
|
340
340
|
o,
|
|
341
341
|
t,
|
|
342
342
|
n
|
|
343
343
|
);
|
|
344
|
-
return
|
|
344
|
+
return K(o, d, t, n, r, i, c);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
const l =
|
|
347
|
+
const l = I(
|
|
348
348
|
e,
|
|
349
349
|
t,
|
|
350
350
|
n
|
|
351
351
|
);
|
|
352
|
-
return
|
|
352
|
+
return K(e, l, t, n, r, i, c);
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function De(e, t, n, r, i, s = L) {
|
|
355
355
|
const a = n >= e.length, c = s(e, n, r), l = s(e, e.length, r), o = s(t, t.length, r);
|
|
356
356
|
if (a || c === l)
|
|
357
357
|
return t.length;
|
|
358
358
|
const h = o - l;
|
|
359
359
|
let d = c;
|
|
360
360
|
h > 0 && !a && c < l && (d = c + 1);
|
|
361
|
-
const u =
|
|
361
|
+
const u = I(
|
|
362
362
|
t,
|
|
363
363
|
d,
|
|
364
364
|
r
|
|
@@ -394,7 +394,7 @@ function we(e, t, n) {
|
|
|
394
394
|
isDelete: !1
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function ye(e, t) {
|
|
398
398
|
if (e === t)
|
|
399
399
|
return;
|
|
400
400
|
let n = 0;
|
|
@@ -412,7 +412,7 @@ function Ce(e, t) {
|
|
|
412
412
|
isDelete: s > a
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function q(e, t) {
|
|
416
416
|
if (e.value = e.value, e === null)
|
|
417
417
|
return !1;
|
|
418
418
|
if (e.createTextRange) {
|
|
@@ -421,15 +421,15 @@ function H(e, t) {
|
|
|
421
421
|
}
|
|
422
422
|
return e.selectionStart !== null || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
|
|
423
423
|
}
|
|
424
|
-
function
|
|
425
|
-
return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (
|
|
426
|
-
e.value === n && e.selectionStart !== t &&
|
|
424
|
+
function Ce(e, t, n) {
|
|
425
|
+
return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (q(e, t), setTimeout(() => {
|
|
426
|
+
e.value === n && e.selectionStart !== t && q(e, t);
|
|
427
427
|
}, 0));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function Me(e) {
|
|
430
430
|
return Math.max(e.selectionStart, e.selectionEnd);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function Ae(e, t, n) {
|
|
433
433
|
if ((n == null ? void 0 : n.formatOn) !== b.Change || !n.thousandSeparator)
|
|
434
434
|
return;
|
|
435
435
|
const { selectionStart: r, selectionEnd: i, value: s } = t;
|
|
@@ -438,7 +438,7 @@ function Re(e, t, n) {
|
|
|
438
438
|
const { key: a } = e, c = n.thousandSeparator;
|
|
439
439
|
a === "Backspace" && r > 0 && s[r - 1] === c && t.setSelectionRange(r - 1, r - 1), a === "Delete" && s[r] === c && t.setSelectionRange(r + 1, r + 1);
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Re(e, t, n, r, i, s, a) {
|
|
442
442
|
if (!i) return;
|
|
443
443
|
const { selectionStart: c = 0, selectionEnd: l = 0, endOffset: o = 0 } = i;
|
|
444
444
|
let h = we(
|
|
@@ -446,44 +446,47 @@ function ye(e, t, n, r, i, s, a) {
|
|
|
446
446
|
t,
|
|
447
447
|
n
|
|
448
448
|
);
|
|
449
|
-
if (h || (h =
|
|
450
|
-
const d =
|
|
449
|
+
if (h || (h = ye(t, n)), !h) return;
|
|
450
|
+
const d = Ee(n, {
|
|
451
451
|
thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator,
|
|
452
452
|
decimalSeparator: s.decimalSeparator
|
|
453
453
|
}), u = {
|
|
454
454
|
thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator,
|
|
455
|
-
isCharacterEquivalent:
|
|
455
|
+
isCharacterEquivalent: (f, p) => {
|
|
456
|
+
const y = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator;
|
|
457
|
+
return y && f === y ? !1 : f === p;
|
|
458
|
+
},
|
|
456
459
|
boundary: d
|
|
457
|
-
}, g = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator ?? ",",
|
|
460
|
+
}, g = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator ?? ",", S = (a == null ? void 0 : a.ThousandStyle) ?? m.None, E = be(
|
|
458
461
|
t,
|
|
459
462
|
n,
|
|
460
463
|
r,
|
|
461
464
|
g,
|
|
462
|
-
|
|
465
|
+
S,
|
|
463
466
|
h,
|
|
464
467
|
s.decimalSeparator,
|
|
465
468
|
u
|
|
466
469
|
);
|
|
467
|
-
|
|
470
|
+
Ce(e, E, n);
|
|
468
471
|
}
|
|
469
472
|
const Ie = (e, t = !1, n = ".") => {
|
|
470
|
-
const r = w(n), i =
|
|
473
|
+
const r = w(n), i = T(`[^0-9${r}]`, "g");
|
|
471
474
|
if (!t)
|
|
472
475
|
return e.replace(i, "");
|
|
473
476
|
const s = e.startsWith("-"), a = e.replace(i, "");
|
|
474
477
|
return s && (a.length > 0 || e === "-") ? "-" + a : a;
|
|
475
|
-
}, Te = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g,
|
|
478
|
+
}, Te = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g, F = /^0+$/, A = /\.?0+$/;
|
|
476
479
|
function _e(e) {
|
|
477
480
|
return !e.includes("e") && !e.includes("E") ? e : e.replace(Te, (t, n, r) => {
|
|
478
481
|
const i = parseInt(r, 10);
|
|
479
482
|
if (i === 0) return n;
|
|
480
|
-
const s = n.startsWith("-"), a = s ? n.slice(1) : n, [c, l = ""] = a.split("."), o = i > 0 ?
|
|
483
|
+
const s = n.startsWith("-"), a = s ? n.slice(1) : n, [c, l = ""] = a.split("."), o = i > 0 ? xe(c, l, i) : Oe(c, l, Math.abs(i));
|
|
481
484
|
return s ? "-" + o : o;
|
|
482
485
|
});
|
|
483
486
|
}
|
|
484
|
-
function
|
|
487
|
+
function xe(e, t, n) {
|
|
485
488
|
const r = e + t;
|
|
486
|
-
if (r === "0" ||
|
|
489
|
+
if (r === "0" || F.test(r))
|
|
487
490
|
return "0";
|
|
488
491
|
const i = t.length;
|
|
489
492
|
if (n <= i) {
|
|
@@ -493,9 +496,9 @@ function Oe(e, t, n) {
|
|
|
493
496
|
const s = n - i;
|
|
494
497
|
return r + "0".repeat(s);
|
|
495
498
|
}
|
|
496
|
-
function
|
|
499
|
+
function Oe(e, t, n) {
|
|
497
500
|
const r = e + t;
|
|
498
|
-
if (r === "0" ||
|
|
501
|
+
if (r === "0" || F.test(r))
|
|
499
502
|
return "0";
|
|
500
503
|
const s = e.length - n;
|
|
501
504
|
if (s <= 0) {
|
|
@@ -575,17 +578,17 @@ function ze(e) {
|
|
|
575
578
|
function Je(e) {
|
|
576
579
|
return e.replace(/[\s\u200B]/g, "");
|
|
577
580
|
}
|
|
578
|
-
function
|
|
579
|
-
const n =
|
|
581
|
+
function N(e, t) {
|
|
582
|
+
const n = ie(t);
|
|
580
583
|
return e.replace(n, "");
|
|
581
584
|
}
|
|
582
585
|
const Xe = (e, t) => {
|
|
583
586
|
let n = Je(e);
|
|
584
|
-
return t != null && t.thousandSeparator && (n =
|
|
587
|
+
return t != null && t.thousandSeparator && (n = N(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Ue(n)), n = _e(n), n = Ie(
|
|
585
588
|
n,
|
|
586
589
|
t == null ? void 0 : t.enableNegative,
|
|
587
590
|
t == null ? void 0 : t.decimalSeparator
|
|
588
|
-
), n =
|
|
591
|
+
), n = le(n, t == null ? void 0 : t.decimalSeparator), t != null && t.enableLeadingZeros || (n = ze(n)), n;
|
|
589
592
|
};
|
|
590
593
|
function je(e, t, n) {
|
|
591
594
|
return {
|
|
@@ -597,21 +600,21 @@ function je(e, t, n) {
|
|
|
597
600
|
};
|
|
598
601
|
}
|
|
599
602
|
function O(e, t, n, r) {
|
|
600
|
-
const i =
|
|
603
|
+
const i = _(n), s = r ?? (n == null ? void 0 : n.formatOn) === b.Change, a = Xe(
|
|
601
604
|
e,
|
|
602
605
|
je(n, i, s)
|
|
603
|
-
), c =
|
|
606
|
+
), c = oe(
|
|
604
607
|
a,
|
|
605
608
|
t,
|
|
606
609
|
i.decimalSeparator
|
|
607
|
-
), l = (n == null ? void 0 : n.decimalMinLength) ?? 0, o =
|
|
610
|
+
), l = (n == null ? void 0 : n.decimalMinLength) ?? 0, o = he(
|
|
608
611
|
c,
|
|
609
612
|
l,
|
|
610
613
|
i.decimalSeparator
|
|
611
614
|
);
|
|
612
|
-
return { formatted:
|
|
615
|
+
return { formatted: fe(o, n, i), raw: o };
|
|
613
616
|
}
|
|
614
|
-
function
|
|
617
|
+
function ft(e, t, n) {
|
|
615
618
|
const r = !!(n != null && n.thousandSeparator);
|
|
616
619
|
return O(
|
|
617
620
|
e,
|
|
@@ -629,21 +632,21 @@ function Ke(e, t, n) {
|
|
|
629
632
|
};
|
|
630
633
|
}
|
|
631
634
|
function qe(e, t) {
|
|
632
|
-
const { decimalSeparator: n } =
|
|
633
|
-
if (
|
|
635
|
+
const { decimalSeparator: n } = _(t), r = e.target;
|
|
636
|
+
if (ce(e, r, n)) {
|
|
634
637
|
e.preventDefault();
|
|
635
638
|
return;
|
|
636
639
|
}
|
|
637
|
-
return
|
|
640
|
+
return Ae(e, r, t), Ke(e.key, r.selectionStart, r.selectionEnd);
|
|
638
641
|
}
|
|
639
642
|
function He(e, t, n, r) {
|
|
640
|
-
const i = e.target, s = i.value, a =
|
|
643
|
+
const i = e.target, s = i.value, a = Me(i), c = _(r), l = (r == null ? void 0 : r.formatOn) === b.Change, { formatted: o, raw: h } = O(
|
|
641
644
|
s,
|
|
642
645
|
t,
|
|
643
646
|
r,
|
|
644
647
|
l
|
|
645
648
|
);
|
|
646
|
-
return i.value = o, s !== o &&
|
|
649
|
+
return i.value = o, s !== o && Re(
|
|
647
650
|
i,
|
|
648
651
|
s,
|
|
649
652
|
o,
|
|
@@ -680,9 +683,29 @@ function Ve(e, t) {
|
|
|
680
683
|
return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
|
|
681
684
|
}
|
|
682
685
|
function Fe(e) {
|
|
683
|
-
|
|
686
|
+
var t, n;
|
|
687
|
+
try {
|
|
688
|
+
const i = new Intl.NumberFormat(e).formatToParts(123456789e-2);
|
|
689
|
+
return {
|
|
690
|
+
decimalSeparator: ((t = i.find((s) => s.type === "decimal")) == null ? void 0 : t.value) ?? ".",
|
|
691
|
+
thousandSeparator: ((n = i.find((s) => s.type === "group")) == null ? void 0 : n.value) ?? ","
|
|
692
|
+
};
|
|
693
|
+
} catch {
|
|
694
|
+
return { thousandSeparator: ",", decimalSeparator: "." };
|
|
695
|
+
}
|
|
684
696
|
}
|
|
685
697
|
function et(e) {
|
|
698
|
+
let t = e.thousandSeparator ?? re, n = e.decimalSeparator ?? v, r = e.thousandStyle ?? H;
|
|
699
|
+
if (e.thousandStyle === m.Locale || e.decimalSeparator === "auto") {
|
|
700
|
+
const s = Fe();
|
|
701
|
+
e.thousandStyle === m.Locale && (t = e.thousandSeparator ?? s.thousandSeparator, n = e.decimalSeparator === "auto" || e.decimalSeparator === void 0 ? s.decimalSeparator : e.decimalSeparator, r = m.Thousand), e.decimalSeparator === "auto" && (n = s.decimalSeparator);
|
|
702
|
+
}
|
|
703
|
+
return { thousandSeparator: t, thousandStyle: r, decimalSeparator: n };
|
|
704
|
+
}
|
|
705
|
+
function tt(e) {
|
|
706
|
+
nt(e.decimalMaxLength), rt(e.decimalMinLength), it(e.decimalMinLength, e.decimalMaxLength), st(e.formatOn), at(e.thousandSeparator), ct(e.thousandStyle), ot(e.decimalSeparator), lt(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), ht(e.onChange);
|
|
707
|
+
}
|
|
708
|
+
function nt(e) {
|
|
686
709
|
if (e !== void 0) {
|
|
687
710
|
if (typeof e != "number")
|
|
688
711
|
throw new Error(
|
|
@@ -698,7 +721,7 @@ function et(e) {
|
|
|
698
721
|
);
|
|
699
722
|
}
|
|
700
723
|
}
|
|
701
|
-
function
|
|
724
|
+
function rt(e) {
|
|
702
725
|
if (e !== void 0) {
|
|
703
726
|
if (typeof e != "number")
|
|
704
727
|
throw new Error(
|
|
@@ -714,19 +737,19 @@ function tt(e) {
|
|
|
714
737
|
);
|
|
715
738
|
}
|
|
716
739
|
}
|
|
717
|
-
function
|
|
740
|
+
function it(e, t) {
|
|
718
741
|
if (!(e === void 0 || t === void 0) && e > t)
|
|
719
742
|
throw new Error(
|
|
720
743
|
`decimalMinLength (${e}) cannot be greater than decimalMaxLength (${t}).`
|
|
721
744
|
);
|
|
722
745
|
}
|
|
723
|
-
function
|
|
746
|
+
function st(e) {
|
|
724
747
|
if (e !== void 0 && e !== b.Blur && e !== b.Change)
|
|
725
748
|
throw new Error(
|
|
726
749
|
`formatOn must be either ${b.Blur} or ${b.Change}. Received: ${JSON.stringify(e)}`
|
|
727
750
|
);
|
|
728
751
|
}
|
|
729
|
-
function
|
|
752
|
+
function at(e) {
|
|
730
753
|
if (e !== void 0) {
|
|
731
754
|
if (typeof e != "string")
|
|
732
755
|
throw new Error(
|
|
@@ -742,14 +765,14 @@ function it(e) {
|
|
|
742
765
|
);
|
|
743
766
|
}
|
|
744
767
|
}
|
|
745
|
-
function
|
|
746
|
-
if (e !== void 0 && !Object.values(
|
|
768
|
+
function ct(e) {
|
|
769
|
+
if (e !== void 0 && !Object.values(m).includes(e))
|
|
747
770
|
throw new Error(
|
|
748
|
-
`ThousandStyle must be one of: ${Object.values(
|
|
771
|
+
`ThousandStyle must be one of: ${Object.values(m).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
|
|
749
772
|
);
|
|
750
773
|
}
|
|
751
|
-
function
|
|
752
|
-
if (e
|
|
774
|
+
function ot(e) {
|
|
775
|
+
if (!(e === void 0 || e === "auto")) {
|
|
753
776
|
if (typeof e != "string")
|
|
754
777
|
throw new Error(
|
|
755
778
|
`decimalSeparator must be a string. Received: ${typeof e} (${JSON.stringify(e)})`
|
|
@@ -764,8 +787,8 @@ function at(e) {
|
|
|
764
787
|
);
|
|
765
788
|
}
|
|
766
789
|
}
|
|
767
|
-
function
|
|
768
|
-
if (!(e === void 0 || t === void 0) && e === t)
|
|
790
|
+
function lt(e, t) {
|
|
791
|
+
if (!(e === void 0 || t === void 0) && t !== "auto" && e === t)
|
|
769
792
|
throw new Error(
|
|
770
793
|
`Decimal separator can't be same as thousand separator. thousandSeparator: ${e}, decimalSeparator: ${t}`
|
|
771
794
|
);
|
|
@@ -776,33 +799,32 @@ function M(e, t) {
|
|
|
776
799
|
`${e} must be a boolean. Received: ${typeof t} (${JSON.stringify(t)})`
|
|
777
800
|
);
|
|
778
801
|
}
|
|
779
|
-
function
|
|
802
|
+
function ht(e) {
|
|
780
803
|
if (e !== void 0 && typeof e != "function")
|
|
781
804
|
throw new Error(
|
|
782
805
|
`onChange must be a function or undefined. Received: ${typeof e} (${JSON.stringify(e)})`
|
|
783
806
|
);
|
|
784
807
|
}
|
|
785
|
-
class
|
|
808
|
+
class gt {
|
|
786
809
|
constructor(t, {
|
|
787
|
-
decimalMaxLength: n =
|
|
788
|
-
decimalMinLength: r =
|
|
789
|
-
formatOn: i =
|
|
790
|
-
thousandSeparator: s
|
|
791
|
-
thousandStyle: a =
|
|
792
|
-
decimalSeparator: c
|
|
793
|
-
enableCompactNotation: l =
|
|
794
|
-
enableNegative: o =
|
|
795
|
-
enableLeadingZeros: h =
|
|
796
|
-
rawValueMode: d =
|
|
810
|
+
decimalMaxLength: n = G,
|
|
811
|
+
decimalMinLength: r = Z,
|
|
812
|
+
formatOn: i = k,
|
|
813
|
+
thousandSeparator: s,
|
|
814
|
+
thousandStyle: a = H,
|
|
815
|
+
decimalSeparator: c,
|
|
816
|
+
enableCompactNotation: l = B,
|
|
817
|
+
enableNegative: o = P,
|
|
818
|
+
enableLeadingZeros: h = W,
|
|
819
|
+
rawValueMode: d = U,
|
|
797
820
|
onChange: u,
|
|
798
821
|
...g
|
|
799
822
|
}) {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
if (Fe({
|
|
823
|
+
D(this, "element");
|
|
824
|
+
D(this, "resolvedOptions");
|
|
825
|
+
D(this, "rawValue", "");
|
|
826
|
+
D(this, "caretPositionBeforeChange");
|
|
827
|
+
tt({
|
|
806
828
|
decimalMaxLength: n,
|
|
807
829
|
decimalMinLength: r,
|
|
808
830
|
formatOn: i,
|
|
@@ -814,7 +836,8 @@ class ut {
|
|
|
814
836
|
enableLeadingZeros: h,
|
|
815
837
|
rawValueMode: d,
|
|
816
838
|
onChange: u
|
|
817
|
-
})
|
|
839
|
+
});
|
|
840
|
+
const S = {
|
|
818
841
|
decimalMaxLength: n,
|
|
819
842
|
decimalMinLength: r,
|
|
820
843
|
onChange: u,
|
|
@@ -827,56 +850,62 @@ class ut {
|
|
|
827
850
|
enableLeadingZeros: h,
|
|
828
851
|
rawValueMode: d,
|
|
829
852
|
...g
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
|
|
853
|
+
};
|
|
854
|
+
if (this.resolvedOptions = this.getResolvedOptions(S), this.createInputElement(t, S), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
|
|
855
|
+
const E = this.element.value, f = this.resolvedOptions.thousandSeparator ? N(E, this.resolvedOptions.thousandSeparator) : E;
|
|
856
|
+
this.rawValue = f, this.element.value = this.formatValueForDisplay(f);
|
|
833
857
|
} else if (this.element.value) {
|
|
834
|
-
const
|
|
835
|
-
this.element.value = this.formatValueForDisplay(
|
|
858
|
+
const E = this.element.value;
|
|
859
|
+
this.element.value = this.formatValueForDisplay(E);
|
|
836
860
|
}
|
|
837
861
|
}
|
|
838
|
-
createInputElement(t) {
|
|
862
|
+
createInputElement(t, n) {
|
|
839
863
|
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");
|
|
840
|
-
const
|
|
841
|
-
this.element.setAttribute("pattern",
|
|
864
|
+
const r = Ve(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
|
|
865
|
+
this.element.setAttribute("pattern", r);
|
|
842
866
|
const {
|
|
843
|
-
decimalMaxLength:
|
|
844
|
-
decimalMinLength:
|
|
845
|
-
formatOn:
|
|
846
|
-
thousandSeparator:
|
|
847
|
-
thousandStyle:
|
|
848
|
-
decimalSeparator:
|
|
849
|
-
enableCompactNotation:
|
|
850
|
-
enableNegative:
|
|
851
|
-
enableLeadingZeros:
|
|
852
|
-
rawValueMode:
|
|
853
|
-
onChange:
|
|
854
|
-
value:
|
|
855
|
-
defaultValue:
|
|
856
|
-
type:
|
|
857
|
-
inputMode:
|
|
858
|
-
spellcheck:
|
|
859
|
-
autocomplete:
|
|
860
|
-
...
|
|
861
|
-
} =
|
|
862
|
-
Object.assign(this.element,
|
|
867
|
+
decimalMaxLength: i,
|
|
868
|
+
decimalMinLength: s,
|
|
869
|
+
formatOn: a,
|
|
870
|
+
thousandSeparator: c,
|
|
871
|
+
thousandStyle: l,
|
|
872
|
+
decimalSeparator: o,
|
|
873
|
+
enableCompactNotation: h,
|
|
874
|
+
enableNegative: d,
|
|
875
|
+
enableLeadingZeros: u,
|
|
876
|
+
rawValueMode: g,
|
|
877
|
+
onChange: S,
|
|
878
|
+
value: E,
|
|
879
|
+
defaultValue: f,
|
|
880
|
+
type: p,
|
|
881
|
+
inputMode: y,
|
|
882
|
+
spellcheck: C,
|
|
883
|
+
autocomplete: ut,
|
|
884
|
+
...ee
|
|
885
|
+
} = n;
|
|
886
|
+
Object.assign(this.element, ee), E !== void 0 ? this.element.value = E : f !== void 0 && (this.element.defaultValue = f, this.element.value = f), t.appendChild(this.element);
|
|
863
887
|
}
|
|
864
888
|
setupEventListeners() {
|
|
865
889
|
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 === b.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
|
|
866
890
|
}
|
|
867
|
-
getResolvedOptions() {
|
|
891
|
+
getResolvedOptions(t) {
|
|
892
|
+
const n = et({
|
|
893
|
+
thousandSeparator: t.thousandSeparator,
|
|
894
|
+
thousandStyle: t.thousandStyle,
|
|
895
|
+
decimalSeparator: t.decimalSeparator
|
|
896
|
+
});
|
|
868
897
|
return {
|
|
869
|
-
decimalMaxLength:
|
|
870
|
-
decimalMinLength:
|
|
871
|
-
formatOn:
|
|
872
|
-
thousandSeparator:
|
|
873
|
-
thousandStyle:
|
|
874
|
-
decimalSeparator:
|
|
875
|
-
enableCompactNotation:
|
|
876
|
-
enableNegative:
|
|
877
|
-
enableLeadingZeros:
|
|
878
|
-
rawValueMode:
|
|
879
|
-
onChange:
|
|
898
|
+
decimalMaxLength: t.decimalMaxLength ?? G,
|
|
899
|
+
decimalMinLength: t.decimalMinLength ?? Z,
|
|
900
|
+
formatOn: t.formatOn ?? k,
|
|
901
|
+
thousandSeparator: n.thousandSeparator,
|
|
902
|
+
thousandStyle: n.thousandStyle,
|
|
903
|
+
decimalSeparator: n.decimalSeparator,
|
|
904
|
+
enableCompactNotation: t.enableCompactNotation ?? B,
|
|
905
|
+
enableNegative: t.enableNegative ?? P,
|
|
906
|
+
enableLeadingZeros: t.enableLeadingZeros ?? W,
|
|
907
|
+
rawValueMode: t.rawValueMode ?? U,
|
|
908
|
+
onChange: t.onChange
|
|
880
909
|
};
|
|
881
910
|
}
|
|
882
911
|
buildFormattingOptions() {
|
|
@@ -902,7 +931,7 @@ class ut {
|
|
|
902
931
|
if (!t)
|
|
903
932
|
return t;
|
|
904
933
|
const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: i, decimalSeparator: s } = this.resolvedOptions;
|
|
905
|
-
return n && r !==
|
|
934
|
+
return n && r !== m.None ? Q(
|
|
906
935
|
t,
|
|
907
936
|
n,
|
|
908
937
|
r,
|
|
@@ -944,15 +973,15 @@ class ut {
|
|
|
944
973
|
handleFocus(t) {
|
|
945
974
|
if (this.resolvedOptions.formatOn === b.Blur && this.resolvedOptions.thousandSeparator) {
|
|
946
975
|
const n = t.target;
|
|
947
|
-
n.value =
|
|
976
|
+
n.value = N(n.value, this.resolvedOptions.thousandSeparator);
|
|
948
977
|
}
|
|
949
978
|
}
|
|
950
979
|
handleBlur(t) {
|
|
951
980
|
const n = t.target, { thousandSeparator: r, thousandStyle: i } = this.resolvedOptions;
|
|
952
|
-
if (r && i !==
|
|
981
|
+
if (r && i !== m.None && n.value) {
|
|
953
982
|
const s = this.formatValueForDisplay(n.value);
|
|
954
983
|
n.value = s;
|
|
955
|
-
const a = this.resolvedOptions.rawValueMode ?
|
|
984
|
+
const a = this.resolvedOptions.rawValueMode ? N(s, r) : void 0;
|
|
956
985
|
this.handleValueChange(s, a);
|
|
957
986
|
}
|
|
958
987
|
}
|
|
@@ -961,7 +990,7 @@ class ut {
|
|
|
961
990
|
}
|
|
962
991
|
setValue(t) {
|
|
963
992
|
if (this.resolvedOptions.rawValueMode) {
|
|
964
|
-
const n = this.resolvedOptions.thousandSeparator ?
|
|
993
|
+
const n = this.resolvedOptions.thousandSeparator ? N(t, this.resolvedOptions.thousandSeparator) : t;
|
|
965
994
|
this.rawValue = n, this.element.value = this.formatValueForDisplay(n);
|
|
966
995
|
} else
|
|
967
996
|
this.element.value = t;
|
|
@@ -1009,7 +1038,7 @@ class ut {
|
|
|
1009
1038
|
const t = this.getValue();
|
|
1010
1039
|
if (!t)
|
|
1011
1040
|
return NaN;
|
|
1012
|
-
const n = this.resolvedOptions.thousandSeparator ?
|
|
1041
|
+
const n = this.resolvedOptions.thousandSeparator ? N(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(w(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
|
|
1013
1042
|
return parseFloat(r);
|
|
1014
1043
|
}
|
|
1015
1044
|
/**
|
|
@@ -1026,14 +1055,16 @@ class ut {
|
|
|
1026
1055
|
}
|
|
1027
1056
|
export {
|
|
1028
1057
|
b as FormatOn,
|
|
1029
|
-
|
|
1030
|
-
|
|
1058
|
+
gt as NumoraInput,
|
|
1059
|
+
m as ThousandStyle,
|
|
1031
1060
|
O as formatInputValue,
|
|
1032
|
-
|
|
1061
|
+
ft as formatValueForDisplay,
|
|
1033
1062
|
Ve as getNumoraPattern,
|
|
1063
|
+
Fe as getSeparatorsFromLocale,
|
|
1034
1064
|
He as handleOnChangeNumoraInput,
|
|
1035
1065
|
qe as handleOnKeyDownNumoraInput,
|
|
1036
1066
|
Qe as handleOnPasteNumoraInput,
|
|
1037
|
-
|
|
1038
|
-
|
|
1067
|
+
N as removeThousandSeparators,
|
|
1068
|
+
et as resolveLocaleOptions,
|
|
1069
|
+
tt as validateNumoraInputOptions
|
|
1039
1070
|
};
|