numora 3.5.0 → 4.0.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/dist/NumoraInput.d.ts +38 -6
- package/dist/config.d.ts +1 -0
- package/dist/features/decimals.d.ts +0 -4
- package/dist/features/formatting/caret-position-utils.d.ts +28 -34
- package/dist/features/formatting/cursor-position.d.ts +2 -2
- package/dist/features/formatting/dom-writes.d.ts +26 -0
- package/dist/features/formatting/index.d.ts +5 -4
- package/dist/features/formatting/thousand-grouping.d.ts +0 -11
- package/dist/features/fullwidth-digits.d.ts +13 -0
- package/dist/features/max-length.d.ts +8 -0
- package/dist/features/prepend-leading-zero.d.ts +6 -0
- package/dist/features/sanitization.d.ts +16 -29
- package/dist/index.d.ts +14 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +848 -839
- package/dist/types.d.ts +48 -1
- package/dist/utils/event-handlers.d.ts +43 -28
- package/dist/utils/regex-cache.d.ts +0 -27
- package/dist/utils/set-numora-input-value.d.ts +32 -0
- package/dist/validation.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,400 +1,537 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var ee = Object.defineProperty;
|
|
2
|
+
var te = (t, e, n) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var A = (t, e, n) => te(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
var I = /* @__PURE__ */ ((t) => (t.Blur = "blur", t.Change = "change", t))(I || {}), y = /* @__PURE__ */ ((t) => (t.None = "none", t.Thousand = "thousand", t.Lakh = "lakh", t.Wan = "wan", t))(y || {});
|
|
5
|
+
const L = {
|
|
6
|
+
InsertText: "insertText",
|
|
7
|
+
InsertFromPaste: "insertFromPaste",
|
|
8
|
+
InsertFromDrop: "insertFromDrop",
|
|
9
|
+
DeleteContentBackward: "deleteContentBackward",
|
|
10
|
+
DeleteContentForward: "deleteContentForward",
|
|
11
|
+
DeleteByCut: "deleteByCut",
|
|
12
|
+
DeleteByDrag: "deleteByDrag",
|
|
13
|
+
DeleteSoftLineBackward: "deleteSoftLineBackward",
|
|
14
|
+
DeleteHardLineBackward: "deleteHardLineBackward",
|
|
15
|
+
DeleteSoftLineForward: "deleteSoftLineForward",
|
|
16
|
+
DeleteHardLineForward: "deleteHardLineForward",
|
|
17
|
+
HistoryUndo: "historyUndo",
|
|
18
|
+
HistoryRedo: "historyRedo"
|
|
19
|
+
}, ne = 2, re = 0, se = I.Blur, ie = ",", ae = y.None, $ = ".", ce = !1, le = !1, he = !1, ue = !1, oe = !1, U = /* @__PURE__ */ new Map();
|
|
20
|
+
function m(t, e = "g") {
|
|
21
|
+
const n = `${t}:${e}`;
|
|
22
|
+
let r = U.get(n);
|
|
23
|
+
return r || (r = new RegExp(t, e), U.set(n, r)), r;
|
|
8
24
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const n = `${e}:${t}`;
|
|
12
|
-
let r = P.get(n);
|
|
13
|
-
return r || (r = new RegExp(e, t), P.set(n, r)), r;
|
|
25
|
+
function M(t) {
|
|
26
|
+
return t.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
14
27
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return _(n, t);
|
|
18
|
-
}
|
|
19
|
-
const ce = /[.,]/g;
|
|
20
|
-
function x(e) {
|
|
28
|
+
const de = /[.,]/g;
|
|
29
|
+
function G(t) {
|
|
21
30
|
return {
|
|
22
|
-
decimalSeparator: (
|
|
23
|
-
thousandSeparator:
|
|
31
|
+
decimalSeparator: (t == null ? void 0 : t.decimalSeparator) ?? $,
|
|
32
|
+
thousandSeparator: t == null ? void 0 : t.thousandSeparator
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
|
-
function
|
|
27
|
-
const n =
|
|
35
|
+
function K(t, e) {
|
|
36
|
+
const n = t.startsWith("-"), r = n ? t.slice(1) : t, [s = "", i = ""] = r.split(e);
|
|
28
37
|
return {
|
|
29
38
|
sign: n ? "-" : "",
|
|
30
|
-
integer:
|
|
31
|
-
decimal:
|
|
39
|
+
integer: s,
|
|
40
|
+
decimal: i
|
|
32
41
|
};
|
|
33
42
|
}
|
|
34
|
-
const
|
|
35
|
-
const { sign: r, integer:
|
|
36
|
-
if (!
|
|
37
|
-
const a =
|
|
38
|
-
return `${r}${
|
|
39
|
-
},
|
|
40
|
-
const n =
|
|
41
|
-
if (n === -1 || n ===
|
|
42
|
-
const r =
|
|
43
|
-
return r +
|
|
44
|
-
},
|
|
45
|
-
if (
|
|
46
|
-
const { sign: r, integer:
|
|
47
|
-
if (
|
|
48
|
-
return
|
|
49
|
-
const a =
|
|
50
|
-
return `${r}${
|
|
51
|
-
},
|
|
43
|
+
const fe = (t, e, n = $) => {
|
|
44
|
+
const { sign: r, integer: s, decimal: i } = K(t, n);
|
|
45
|
+
if (!i) return t;
|
|
46
|
+
const a = i.slice(0, e);
|
|
47
|
+
return `${r}${s}${n}${a}`;
|
|
48
|
+
}, Se = (t, e = $) => {
|
|
49
|
+
const n = t.indexOf(e);
|
|
50
|
+
if (n === -1 || n === t.length - 1) return t;
|
|
51
|
+
const r = t.slice(0, n + 1), s = t.slice(n + 1), a = e === "." || e === "," ? de : m("[,\\." + M(e) + "]", "g");
|
|
52
|
+
return r + s.replace(a, "");
|
|
53
|
+
}, ge = (t, e = 0, n = $) => {
|
|
54
|
+
if (e <= 0) return t;
|
|
55
|
+
const { sign: r, integer: s, decimal: i } = K(t, n);
|
|
56
|
+
if (i.length >= e)
|
|
57
|
+
return t;
|
|
58
|
+
const a = i.padEnd(e, "0");
|
|
59
|
+
return `${r}${s}${n}${a}`;
|
|
60
|
+
}, Ee = (t, e = !1, n = ".") => {
|
|
61
|
+
const r = M(n), s = m(`[^0-9${r}]`, "g");
|
|
62
|
+
if (!e)
|
|
63
|
+
return t.replace(s, "");
|
|
64
|
+
const i = t.startsWith("-"), a = t.replace(s, "");
|
|
65
|
+
return i && (a.length > 0 || t === "-") ? "-" + a : a;
|
|
66
|
+
}, pe = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g, Y = /^0+$/, R = /\.?0+$/;
|
|
67
|
+
function Le(t) {
|
|
68
|
+
return !t.includes("e") && !t.includes("E") ? t : t.replace(pe, (e, n, r) => {
|
|
69
|
+
const s = parseInt(r, 10);
|
|
70
|
+
if (s === 0) return n;
|
|
71
|
+
const i = n.startsWith("-"), a = i ? n.slice(1) : n, [c, h = ""] = a.split("."), l = s > 0 ? De(c, h, s) : we(c, h, Math.abs(s));
|
|
72
|
+
return i ? "-" + l : l;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function De(t, e, n) {
|
|
76
|
+
const r = t + e;
|
|
77
|
+
if (r === "0" || Y.test(r))
|
|
78
|
+
return "0";
|
|
79
|
+
const s = e.length;
|
|
80
|
+
if (n <= s) {
|
|
81
|
+
const a = r.slice(0, t.length + n), c = r.slice(t.length + n);
|
|
82
|
+
return c ? `${a}.${c}` : a;
|
|
83
|
+
}
|
|
84
|
+
const i = n - s;
|
|
85
|
+
return r + "0".repeat(i);
|
|
86
|
+
}
|
|
87
|
+
function we(t, e, n) {
|
|
88
|
+
const r = t + e;
|
|
89
|
+
if (r === "0" || Y.test(r))
|
|
90
|
+
return "0";
|
|
91
|
+
const i = t.length - n;
|
|
92
|
+
if (i <= 0) {
|
|
93
|
+
const a = Math.abs(i), c = `0.${"0".repeat(a)}${r}`;
|
|
94
|
+
return _(c);
|
|
95
|
+
}
|
|
96
|
+
if (i < t.length) {
|
|
97
|
+
const a = r.slice(0, i), c = r.slice(i), h = `${a}.${c}`;
|
|
98
|
+
return _(h);
|
|
99
|
+
}
|
|
100
|
+
return _(r);
|
|
101
|
+
}
|
|
102
|
+
function _(t) {
|
|
103
|
+
if (!t.includes("."))
|
|
104
|
+
return t;
|
|
105
|
+
if (t === "0.")
|
|
106
|
+
return "0";
|
|
107
|
+
if (t.startsWith("0.")) {
|
|
108
|
+
const e = t.replace(R, "");
|
|
109
|
+
return e === "0" ? "0" : e || "0";
|
|
110
|
+
}
|
|
111
|
+
if (t.startsWith("-0.")) {
|
|
112
|
+
const e = t.replace(R, "");
|
|
113
|
+
return e === "-0" || e === "0" ? "0" : e || "0";
|
|
114
|
+
}
|
|
115
|
+
return t.replace(R, "") || t;
|
|
116
|
+
}
|
|
117
|
+
const ye = /(\d+\.?\d*)\s*([kmbt])/gi, Ie = /^0+/, Ae = /^(-?)0+([1-9])/, Ne = /^-?0+$/, Ce = /\.?0+$/, be = {
|
|
118
|
+
k: 3,
|
|
119
|
+
// Thousand
|
|
120
|
+
m: 6,
|
|
121
|
+
// Million
|
|
122
|
+
b: 9,
|
|
123
|
+
// Billion
|
|
124
|
+
t: 12
|
|
125
|
+
// Trillion
|
|
126
|
+
};
|
|
127
|
+
function Te(t) {
|
|
128
|
+
return t.replace(ye, (e, n, r) => {
|
|
129
|
+
const s = r.toLowerCase(), i = be[s];
|
|
130
|
+
if (!i)
|
|
131
|
+
return e;
|
|
132
|
+
const [a, c = ""] = n.split("."), h = a.replace(Ie, "") || "0";
|
|
133
|
+
let l;
|
|
134
|
+
if (c.length === 0)
|
|
135
|
+
l = h + "0".repeat(i);
|
|
136
|
+
else if (c.length <= i) {
|
|
137
|
+
const u = i - c.length;
|
|
138
|
+
l = h + c + "0".repeat(u);
|
|
139
|
+
} else {
|
|
140
|
+
const u = c.slice(0, i), f = c.slice(i);
|
|
141
|
+
l = h + u + "." + f;
|
|
142
|
+
}
|
|
143
|
+
return l = l.replace(Ae, "$1$2"), Ne.test(l) && (l = "0"), l.includes(".") && (l = l.replace(Ce, "")), l;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function ve(t) {
|
|
147
|
+
if (!t || t === "0" || t === "-0" || t === "-" || t === ".")
|
|
148
|
+
return t;
|
|
149
|
+
const e = t.startsWith("-"), n = e ? t.slice(1) : t;
|
|
150
|
+
if (n === ".")
|
|
151
|
+
return t;
|
|
152
|
+
if (n.includes(".")) {
|
|
153
|
+
const [s, i] = n.split(".");
|
|
154
|
+
if (s) {
|
|
155
|
+
const c = (s.replace(/^0+/, "") || "0") + "." + i;
|
|
156
|
+
return e ? "-" + c : c;
|
|
157
|
+
}
|
|
158
|
+
return t;
|
|
159
|
+
}
|
|
160
|
+
if (n.startsWith("0")) {
|
|
161
|
+
const s = n.replace(/^0+/, "") || "0";
|
|
162
|
+
return e ? "-" + s : s;
|
|
163
|
+
}
|
|
164
|
+
return t;
|
|
165
|
+
}
|
|
166
|
+
function Me(t, e = ".") {
|
|
167
|
+
return t && (t === e ? "0" + e : t === "-" + e ? "-0" + e : t.startsWith("-" + e) ? "-0" + t.slice(1) : t.startsWith(e) ? "0" + t : t);
|
|
168
|
+
}
|
|
169
|
+
function $e(t, e, n = ".") {
|
|
170
|
+
if (e < 0 || t.length <= e) return t;
|
|
171
|
+
let r = t.slice(0, e);
|
|
172
|
+
return r.endsWith(n) && (r = r.slice(0, -1)), r === "-" ? "" : r;
|
|
173
|
+
}
|
|
174
|
+
function xe(t) {
|
|
175
|
+
return t.replace(/[\s\u200B]/g, "");
|
|
176
|
+
}
|
|
177
|
+
function Re(t) {
|
|
178
|
+
return t.replace(
|
|
179
|
+
/[\uFF10-\uFF19]/g,
|
|
180
|
+
(e) => String.fromCharCode(e.charCodeAt(0) - 65248)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
function b(t, e) {
|
|
184
|
+
return t.replace(m(M(e)), "");
|
|
185
|
+
}
|
|
186
|
+
const _e = (t, e) => {
|
|
187
|
+
let n = xe(t);
|
|
188
|
+
return e != null && e.thousandSeparator && (n = b(n, e.thousandSeparator)), n = Re(n), e != null && e.enableCompactNotation && (n = Te(n)), n = Le(n), n = Ee(
|
|
189
|
+
n,
|
|
190
|
+
e == null ? void 0 : e.enableNegative,
|
|
191
|
+
e == null ? void 0 : e.decimalSeparator
|
|
192
|
+
), n = Se(n, e == null ? void 0 : e.decimalSeparator), e != null && e.enableLeadingZeros || (n = ve(n)), e != null && e.autoAddLeadingZero && (n = Me(n, e == null ? void 0 : e.decimalSeparator)), (e == null ? void 0 : e.maxLength) !== void 0 && (n = $e(
|
|
193
|
+
n,
|
|
194
|
+
e.maxLength,
|
|
195
|
+
e == null ? void 0 : e.decimalSeparator
|
|
196
|
+
)), n;
|
|
197
|
+
}, C = {
|
|
52
198
|
thousand: { size: 3 },
|
|
53
199
|
lakh: { firstGroup: 3, restGroup: 2 },
|
|
54
200
|
wan: { size: 4 }
|
|
55
|
-
},
|
|
56
|
-
function Q(
|
|
57
|
-
if (!
|
|
58
|
-
return
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
const
|
|
62
|
-
return a ? `-${
|
|
201
|
+
}, ke = /^(0+)/;
|
|
202
|
+
function Q(t, e, n = y.Thousand, r = !1, s = ".") {
|
|
203
|
+
if (!t || t === "0" || t === s || t === "-" || t === `-${s}`)
|
|
204
|
+
return t;
|
|
205
|
+
const i = t.includes(s), a = t.startsWith("-"), c = a ? t.slice(1) : t, [h, l] = c.split(s);
|
|
206
|
+
if (!h) {
|
|
207
|
+
const o = l ? `${s}${l}` : c;
|
|
208
|
+
return a ? `-${o}` : o;
|
|
63
209
|
}
|
|
64
|
-
if (r &&
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
return
|
|
210
|
+
if (r && h.startsWith("0") && h.length > 1) {
|
|
211
|
+
const o = h.match(ke);
|
|
212
|
+
if (o) {
|
|
213
|
+
const p = o[1], g = h.slice(p.length);
|
|
214
|
+
if (g) {
|
|
215
|
+
const D = j(g, e, n), S = p + D, d = a ? "-" : "";
|
|
216
|
+
return i ? l ? `${d}${S}${s}${l}` : `${d}${S}${s}` : `${d}${S}`;
|
|
71
217
|
}
|
|
72
218
|
}
|
|
73
219
|
}
|
|
74
|
-
const
|
|
75
|
-
return
|
|
220
|
+
const u = j(h, e, n), f = a ? "-" : "";
|
|
221
|
+
return i ? l ? `${f}${u}${s}${l}` : `${f}${u}${s}` : `${f}${u}`;
|
|
76
222
|
}
|
|
77
|
-
function
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
223
|
+
function j(t, e, n) {
|
|
224
|
+
if (t === "0" || t === "")
|
|
225
|
+
return t;
|
|
80
226
|
switch (n) {
|
|
81
|
-
case
|
|
82
|
-
return
|
|
83
|
-
case
|
|
84
|
-
return
|
|
85
|
-
case
|
|
86
|
-
return
|
|
87
|
-
case
|
|
88
|
-
return
|
|
227
|
+
case y.None:
|
|
228
|
+
return t;
|
|
229
|
+
case y.Thousand:
|
|
230
|
+
return H(t, e, C.thousand.size);
|
|
231
|
+
case y.Lakh:
|
|
232
|
+
return Be(t, e);
|
|
233
|
+
case y.Wan:
|
|
234
|
+
return H(t, e, C.wan.size);
|
|
89
235
|
default:
|
|
90
|
-
return
|
|
236
|
+
return t;
|
|
91
237
|
}
|
|
92
238
|
}
|
|
93
|
-
function
|
|
94
|
-
if (
|
|
95
|
-
return
|
|
96
|
-
const n = [], r =
|
|
97
|
-
n.unshift(
|
|
98
|
-
for (let
|
|
99
|
-
n.unshift(
|
|
100
|
-
return n.join(
|
|
239
|
+
function Be(t, e) {
|
|
240
|
+
if (t.length <= C.lakh.firstGroup)
|
|
241
|
+
return t;
|
|
242
|
+
const n = [], r = t.length - C.lakh.firstGroup;
|
|
243
|
+
n.unshift(t.slice(r));
|
|
244
|
+
for (let s = r; s > 0; s -= C.lakh.restGroup)
|
|
245
|
+
n.unshift(t.slice(Math.max(0, s - C.lakh.restGroup), s));
|
|
246
|
+
return n.join(e);
|
|
101
247
|
}
|
|
102
|
-
function
|
|
248
|
+
function H(t, e, n) {
|
|
103
249
|
const r = [];
|
|
104
|
-
for (let
|
|
105
|
-
r.unshift(
|
|
106
|
-
return r.join(
|
|
107
|
-
}
|
|
108
|
-
function fe(e, t, n) {
|
|
109
|
-
return (t == null ? void 0 : t.formatOn) === b.Change && t.thousandSeparator ? Q(
|
|
110
|
-
e,
|
|
111
|
-
t.thousandSeparator,
|
|
112
|
-
t.ThousandStyle ?? L.None,
|
|
113
|
-
t.enableLeadingZeros,
|
|
114
|
-
(n == null ? void 0 : n.decimalSeparator) ?? C
|
|
115
|
-
) : e;
|
|
250
|
+
for (let s = t.length; s > 0; s -= n)
|
|
251
|
+
r.unshift(t.slice(Math.max(0, s - n), s));
|
|
252
|
+
return r.join(e);
|
|
116
253
|
}
|
|
117
|
-
function
|
|
254
|
+
function N(t, e, n) {
|
|
118
255
|
let r = 0;
|
|
119
|
-
for (let
|
|
120
|
-
|
|
256
|
+
for (let s = 0; s < e && s < t.length; s++)
|
|
257
|
+
t[s] !== n && r++;
|
|
121
258
|
return r;
|
|
122
259
|
}
|
|
123
|
-
function
|
|
124
|
-
if (
|
|
260
|
+
function me(t, e, n) {
|
|
261
|
+
if (e === 0)
|
|
125
262
|
return 0;
|
|
126
263
|
let r = 0;
|
|
127
|
-
for (let
|
|
128
|
-
if (
|
|
129
|
-
if (r ===
|
|
130
|
-
return
|
|
264
|
+
for (let s = 0; s < t.length; s++)
|
|
265
|
+
if (t[s] !== n) {
|
|
266
|
+
if (r === e - 1)
|
|
267
|
+
return s + 1;
|
|
131
268
|
r++;
|
|
132
269
|
}
|
|
133
|
-
return
|
|
270
|
+
return t.length;
|
|
134
271
|
}
|
|
135
|
-
function
|
|
136
|
-
if (
|
|
272
|
+
function B(t, e, n) {
|
|
273
|
+
if (e === 0)
|
|
137
274
|
return 0;
|
|
138
275
|
let r = 0;
|
|
139
|
-
for (let
|
|
140
|
-
if (
|
|
141
|
-
if (r++, r ===
|
|
142
|
-
return
|
|
143
|
-
if (r >
|
|
144
|
-
return
|
|
276
|
+
for (let s = 0; s < t.length; s++)
|
|
277
|
+
if (t[s] !== n) {
|
|
278
|
+
if (r++, r === e)
|
|
279
|
+
return s + 1;
|
|
280
|
+
if (r > e)
|
|
281
|
+
return s;
|
|
145
282
|
}
|
|
146
|
-
return
|
|
283
|
+
return t.length;
|
|
147
284
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
285
|
+
function O(t, e, n) {
|
|
286
|
+
return e < 0 || e >= t.length ? !1 : t[e] === n;
|
|
150
287
|
}
|
|
151
|
-
const
|
|
152
|
-
function
|
|
288
|
+
const Ge = /\d/;
|
|
289
|
+
function Ze(t, e = {}) {
|
|
153
290
|
const {
|
|
154
291
|
thousandSeparator: n,
|
|
155
292
|
decimalSeparator: r = ".",
|
|
156
|
-
prefix:
|
|
157
|
-
suffix:
|
|
158
|
-
} =
|
|
159
|
-
if (
|
|
160
|
-
const c =
|
|
161
|
-
a.fill(!1, c + 1,
|
|
293
|
+
prefix: s = "",
|
|
294
|
+
suffix: i = ""
|
|
295
|
+
} = e, a = new Array(t.length + 1).fill(!0);
|
|
296
|
+
if (s && a.fill(!1, 0, s.length), i) {
|
|
297
|
+
const c = t.length - i.length;
|
|
298
|
+
a.fill(!1, c + 1, t.length + 1);
|
|
162
299
|
}
|
|
163
|
-
for (let c = 0; c <
|
|
164
|
-
const
|
|
165
|
-
(n &&
|
|
300
|
+
for (let c = 0; c < t.length; c++) {
|
|
301
|
+
const h = t[c];
|
|
302
|
+
(n && h === n || h === r) && (a[c] = !1, c + 1 < t.length && !Ge.test(t[c + 1]) && (a[c + 1] = !1));
|
|
166
303
|
}
|
|
167
304
|
return a.some((c) => c) || a.fill(!0), a;
|
|
168
305
|
}
|
|
169
|
-
function
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
172
|
-
for (;
|
|
173
|
-
|
|
174
|
-
|
|
306
|
+
function Z(t, e, n, r) {
|
|
307
|
+
const s = t.length;
|
|
308
|
+
if (e = Math.max(0, Math.min(e, s)), r === "left") {
|
|
309
|
+
for (; e >= 0 && !n[e]; )
|
|
310
|
+
e--;
|
|
311
|
+
e === -1 && (e = n.indexOf(!0));
|
|
175
312
|
} else if (r === "right") {
|
|
176
|
-
for (;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
} else if (!n[
|
|
180
|
-
let
|
|
181
|
-
for (;
|
|
182
|
-
|
|
183
|
-
let a =
|
|
313
|
+
for (; e <= s && !n[e]; )
|
|
314
|
+
e++;
|
|
315
|
+
e > s && (e = n.lastIndexOf(!0));
|
|
316
|
+
} else if (!n[e]) {
|
|
317
|
+
let i = e;
|
|
318
|
+
for (; i <= s && !n[i]; )
|
|
319
|
+
i++;
|
|
320
|
+
let a = e;
|
|
184
321
|
for (; a >= 0 && !n[a]; )
|
|
185
322
|
a--;
|
|
186
|
-
|
|
323
|
+
i <= s && a >= 0 ? e = e - a < i - e ? a : i : i <= s ? e = i : a >= 0 && (e = a);
|
|
187
324
|
}
|
|
188
|
-
return (
|
|
325
|
+
return (e === -1 || e > s) && (e = s), e;
|
|
189
326
|
}
|
|
190
|
-
const
|
|
191
|
-
function
|
|
327
|
+
const P = /(\d+\.?\d*)\s*[kmbt]$/i, We = (t, e) => t === e;
|
|
328
|
+
function Ue(t, e, n, r, s, i, a = ".", c = {}) {
|
|
192
329
|
if (n < 0)
|
|
193
330
|
return 0;
|
|
194
|
-
if (n >
|
|
195
|
-
return
|
|
196
|
-
const
|
|
197
|
-
|
|
331
|
+
if (n > t.length || t === "" || e === "" || P.test(t) && !P.test(e) && e.length > t.length && n >= t.length - 1)
|
|
332
|
+
return e.length;
|
|
333
|
+
const h = e.length < t.length, l = O(
|
|
334
|
+
t,
|
|
198
335
|
n,
|
|
199
336
|
r
|
|
200
|
-
),
|
|
201
|
-
if (c.isCharacterEquivalent &&
|
|
202
|
-
const
|
|
337
|
+
), u = t.indexOf(a), f = e.indexOf(a);
|
|
338
|
+
if (c.isCharacterEquivalent && t !== e) {
|
|
339
|
+
const S = {
|
|
203
340
|
thousandSeparator: r || void 0,
|
|
204
341
|
...c
|
|
205
|
-
},
|
|
206
|
-
e,
|
|
342
|
+
}, d = je(
|
|
207
343
|
t,
|
|
344
|
+
e,
|
|
208
345
|
n,
|
|
209
|
-
c.isCharacterEquivalent ||
|
|
210
|
-
|
|
211
|
-
|
|
346
|
+
c.isCharacterEquivalent || We,
|
|
347
|
+
i,
|
|
348
|
+
S
|
|
212
349
|
);
|
|
213
|
-
if (
|
|
214
|
-
return
|
|
350
|
+
if (d !== void 0)
|
|
351
|
+
return d;
|
|
215
352
|
}
|
|
216
|
-
const
|
|
217
|
-
const
|
|
218
|
-
return
|
|
353
|
+
const p = /* @__PURE__ */ new Map(), g = (S, d, E) => {
|
|
354
|
+
const w = `${S === t ? "o" : "n"}:${d}`;
|
|
355
|
+
return p.has(w) || p.set(w, N(S, d, r)), p.get(w);
|
|
219
356
|
};
|
|
220
|
-
if (
|
|
221
|
-
return
|
|
222
|
-
e,
|
|
357
|
+
if (h)
|
|
358
|
+
return He(
|
|
223
359
|
t,
|
|
360
|
+
e,
|
|
224
361
|
n,
|
|
225
362
|
r,
|
|
226
363
|
l,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
364
|
+
u,
|
|
365
|
+
f,
|
|
366
|
+
i,
|
|
230
367
|
c,
|
|
231
|
-
|
|
368
|
+
g
|
|
232
369
|
);
|
|
233
|
-
const
|
|
234
|
-
e,
|
|
370
|
+
const D = Je(
|
|
235
371
|
t,
|
|
372
|
+
e,
|
|
236
373
|
n,
|
|
237
374
|
r,
|
|
238
375
|
l,
|
|
239
|
-
|
|
376
|
+
g
|
|
240
377
|
);
|
|
241
|
-
return c.boundary ?
|
|
378
|
+
return c.boundary ? Z(e, D, c.boundary) : D;
|
|
242
379
|
}
|
|
243
|
-
function
|
|
244
|
-
const a =
|
|
245
|
-
let
|
|
246
|
-
for (let
|
|
247
|
-
let
|
|
248
|
-
for (let
|
|
380
|
+
function je(t, e, n, r, s, i) {
|
|
381
|
+
const a = t.length, c = e.length;
|
|
382
|
+
let h = 0, l = 0, u = c;
|
|
383
|
+
for (let d = 0; d < a; d++) {
|
|
384
|
+
let E = -1;
|
|
385
|
+
for (let w = h; w < c; w++)
|
|
249
386
|
if (r(
|
|
250
|
-
|
|
251
|
-
|
|
387
|
+
t[d],
|
|
388
|
+
e[w],
|
|
252
389
|
{
|
|
253
|
-
oldValue:
|
|
254
|
-
newValue:
|
|
255
|
-
typedRange:
|
|
256
|
-
oldIndex:
|
|
257
|
-
newIndex:
|
|
390
|
+
oldValue: t,
|
|
391
|
+
newValue: e,
|
|
392
|
+
typedRange: s,
|
|
393
|
+
oldIndex: d,
|
|
394
|
+
newIndex: w
|
|
258
395
|
}
|
|
259
396
|
)) {
|
|
260
|
-
|
|
397
|
+
E = w;
|
|
261
398
|
break;
|
|
262
399
|
}
|
|
263
|
-
|
|
400
|
+
E !== -1 && (h = E + 1, d < n ? l = E + 1 : u === c && /\d/.test(t[d]) && (u = E));
|
|
264
401
|
}
|
|
265
|
-
if (l >
|
|
266
|
-
const
|
|
267
|
-
let
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
402
|
+
if (l > u) return u;
|
|
403
|
+
const f = e.length < t.length || s !== void 0 && s.isDelete === !1;
|
|
404
|
+
let o, p = !1, g = !1;
|
|
405
|
+
if (f) {
|
|
406
|
+
o = l;
|
|
407
|
+
const d = i.thousandSeparator, E = i.decimalSeparator ?? ".", w = o < e.length ? e[o] : "";
|
|
408
|
+
d && w === d ? (n > 0 ? t[n - 1] : "") === d ? (o = u, p = !0) : g = !0 : w === E && (g = !0);
|
|
272
409
|
} else
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
return
|
|
277
|
-
const
|
|
278
|
-
if (!
|
|
279
|
-
if (
|
|
280
|
-
for (;
|
|
410
|
+
o = n - l < u - n ? l : u;
|
|
411
|
+
const D = f && !p ? "left" : "right";
|
|
412
|
+
if (i.boundary)
|
|
413
|
+
return g ? o : Z(e, o, i.boundary, D);
|
|
414
|
+
const S = i.thousandSeparator;
|
|
415
|
+
if (!g && S && o >= 0 && o < e.length && e[o] === S)
|
|
416
|
+
if (f && !p)
|
|
417
|
+
for (; o > 0 && e[o] === S; ) o--;
|
|
281
418
|
else
|
|
282
|
-
for (;
|
|
283
|
-
return
|
|
419
|
+
for (; o < e.length && e[o] === S; ) o++;
|
|
420
|
+
return o;
|
|
284
421
|
}
|
|
285
|
-
function
|
|
286
|
-
if (
|
|
287
|
-
return
|
|
288
|
-
e,
|
|
422
|
+
function He(t, e, n, r, s, i, a, c, h = {}, l = N) {
|
|
423
|
+
if (s)
|
|
424
|
+
return Pe(
|
|
289
425
|
t,
|
|
426
|
+
e,
|
|
290
427
|
n,
|
|
291
428
|
r,
|
|
292
429
|
a,
|
|
293
430
|
l
|
|
294
431
|
);
|
|
295
|
-
const
|
|
296
|
-
|
|
432
|
+
const u = l(t, n, r), f = l(t, t.length, r), o = l(e, e.length, r), p = f - o, g = ze(
|
|
433
|
+
t,
|
|
297
434
|
n,
|
|
298
435
|
r,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
436
|
+
u,
|
|
437
|
+
p,
|
|
438
|
+
i,
|
|
302
439
|
c,
|
|
303
440
|
l
|
|
304
|
-
),
|
|
305
|
-
|
|
306
|
-
|
|
441
|
+
), D = i === -1 || n <= i, S = Xe(
|
|
442
|
+
e,
|
|
443
|
+
g,
|
|
307
444
|
r,
|
|
308
|
-
S,
|
|
309
|
-
c,
|
|
310
445
|
p,
|
|
446
|
+
c,
|
|
447
|
+
D,
|
|
311
448
|
a,
|
|
312
449
|
l
|
|
313
450
|
);
|
|
314
|
-
return
|
|
451
|
+
return h.boundary ? Z(e, S, h.boundary) : S;
|
|
315
452
|
}
|
|
316
|
-
function
|
|
453
|
+
function Pe(t, e, n, r, s, i = N) {
|
|
317
454
|
const a = n + 1;
|
|
318
|
-
if (a <
|
|
319
|
-
const c =
|
|
320
|
-
|
|
455
|
+
if (a < t.length) {
|
|
456
|
+
const c = i(t, a, r), h = me(
|
|
457
|
+
e,
|
|
321
458
|
c,
|
|
322
459
|
r
|
|
323
460
|
);
|
|
324
|
-
return
|
|
461
|
+
return h < e.length && e[h] !== r ? h + 1 : h;
|
|
325
462
|
}
|
|
326
463
|
return n;
|
|
327
464
|
}
|
|
328
|
-
function
|
|
465
|
+
function ze(t, e, n, r, s, i, a, c = N) {
|
|
329
466
|
if (a) {
|
|
330
|
-
const { start: l, isDelete:
|
|
331
|
-
return
|
|
467
|
+
const { start: l, isDelete: u } = a;
|
|
468
|
+
return u ? c(t, l, n) : Math.max(0, c(t, l, n));
|
|
332
469
|
}
|
|
333
|
-
return
|
|
470
|
+
return e > 0 && t[e - 1] === n && s > 0 ? r + 1 : r;
|
|
334
471
|
}
|
|
335
|
-
function
|
|
336
|
-
if (
|
|
337
|
-
if (e
|
|
338
|
-
return
|
|
339
|
-
if (!
|
|
340
|
-
return Math.min(
|
|
472
|
+
function z(t, e, n, r, s, i, a = N) {
|
|
473
|
+
if (e > 0 && e < t.length && a(t, e, r) === n) {
|
|
474
|
+
if (t[e] === r && i && s > 0 && e < t.length - 1)
|
|
475
|
+
return e + 1;
|
|
476
|
+
if (!i && s > 0 && e < t.length - 1)
|
|
477
|
+
return Math.min(e + 1, t.length);
|
|
341
478
|
}
|
|
342
|
-
return
|
|
479
|
+
return e;
|
|
343
480
|
}
|
|
344
|
-
function
|
|
345
|
-
if (
|
|
346
|
-
const l =
|
|
347
|
-
if (
|
|
348
|
-
const
|
|
481
|
+
function Xe(t, e, n, r, s, i, a, c = N) {
|
|
482
|
+
if (i && a !== -1) {
|
|
483
|
+
const l = t.substring(0, a), u = c(l, l.length, n);
|
|
484
|
+
if (e <= u) {
|
|
485
|
+
const f = B(
|
|
349
486
|
l,
|
|
350
|
-
|
|
487
|
+
e,
|
|
351
488
|
n
|
|
352
489
|
);
|
|
353
|
-
return
|
|
490
|
+
return z(l, f, e, n, r, s, c);
|
|
354
491
|
}
|
|
355
492
|
}
|
|
356
|
-
const
|
|
357
|
-
e,
|
|
493
|
+
const h = B(
|
|
358
494
|
t,
|
|
495
|
+
e,
|
|
359
496
|
n
|
|
360
497
|
);
|
|
361
|
-
return
|
|
498
|
+
return z(t, h, e, n, r, s, c);
|
|
362
499
|
}
|
|
363
|
-
function
|
|
364
|
-
const a = n >=
|
|
365
|
-
if (a || c ===
|
|
366
|
-
return
|
|
367
|
-
const
|
|
368
|
-
let
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
500
|
+
function Je(t, e, n, r, s, i = N) {
|
|
501
|
+
const a = n >= t.length, c = i(t, n, r), h = i(t, t.length, r), l = i(e, e.length, r);
|
|
502
|
+
if (a || c === h)
|
|
503
|
+
return e.length;
|
|
504
|
+
const u = l - h;
|
|
505
|
+
let f = c;
|
|
506
|
+
u > 0 && !a && c < h && (f = c + 1);
|
|
507
|
+
const o = B(
|
|
508
|
+
e,
|
|
509
|
+
f,
|
|
373
510
|
r
|
|
374
511
|
);
|
|
375
|
-
return
|
|
512
|
+
return s && !O(e, o, r) ? Math.max(0, o - 1) : o;
|
|
376
513
|
}
|
|
377
|
-
function
|
|
378
|
-
const { selectionStart: r, selectionEnd:
|
|
379
|
-
if (r !==
|
|
380
|
-
const
|
|
514
|
+
function qe(t, e, n) {
|
|
515
|
+
const { selectionStart: r, selectionEnd: s, endOffset: i = 0 } = t;
|
|
516
|
+
if (r !== s) {
|
|
517
|
+
const u = s - r;
|
|
381
518
|
return {
|
|
382
519
|
start: r,
|
|
383
|
-
end:
|
|
384
|
-
deletedLength:
|
|
520
|
+
end: s,
|
|
521
|
+
deletedLength: u,
|
|
385
522
|
isDelete: !1
|
|
386
523
|
};
|
|
387
524
|
}
|
|
388
|
-
if (
|
|
389
|
-
const
|
|
525
|
+
if (i > 0) {
|
|
526
|
+
const u = i;
|
|
390
527
|
return {
|
|
391
528
|
start: r,
|
|
392
|
-
end: r +
|
|
393
|
-
deletedLength:
|
|
529
|
+
end: r + u,
|
|
530
|
+
deletedLength: u,
|
|
394
531
|
isDelete: !0
|
|
395
532
|
};
|
|
396
533
|
}
|
|
397
|
-
const c =
|
|
534
|
+
const c = e.length, h = n.length, l = c - h;
|
|
398
535
|
if (!(l <= 0))
|
|
399
536
|
return {
|
|
400
537
|
start: r,
|
|
@@ -403,673 +540,528 @@ function Ce(e, t, n) {
|
|
|
403
540
|
isDelete: !1
|
|
404
541
|
};
|
|
405
542
|
}
|
|
406
|
-
function
|
|
407
|
-
if (
|
|
543
|
+
function Ke(t, e) {
|
|
544
|
+
if (t === e)
|
|
408
545
|
return;
|
|
409
546
|
let n = 0;
|
|
410
|
-
for (; n <
|
|
547
|
+
for (; n < t.length && n < e.length && t[n] === e[n]; )
|
|
411
548
|
n++;
|
|
412
|
-
let r =
|
|
413
|
-
for (; r >= n &&
|
|
414
|
-
r--,
|
|
415
|
-
const
|
|
416
|
-
if (!(
|
|
549
|
+
let r = t.length - 1, s = e.length - 1;
|
|
550
|
+
for (; r >= n && s >= n && t[r] === e[s]; )
|
|
551
|
+
r--, s--;
|
|
552
|
+
const i = r - n + 1, a = s - n + 1;
|
|
553
|
+
if (!(i === 0 && a === 0))
|
|
417
554
|
return {
|
|
418
555
|
start: n,
|
|
419
556
|
end: r + 1,
|
|
420
|
-
deletedLength:
|
|
421
|
-
isDelete:
|
|
557
|
+
deletedLength: i,
|
|
558
|
+
isDelete: i > a
|
|
422
559
|
};
|
|
423
560
|
}
|
|
424
|
-
function
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
return e.selectionStart !== null || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
|
|
432
|
-
}
|
|
433
|
-
function ye(e, t, n) {
|
|
434
|
-
return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (K(e, t), setTimeout(() => {
|
|
435
|
-
e.value === n && e.selectionStart !== t && K(e, t);
|
|
436
|
-
}, 0));
|
|
437
|
-
}
|
|
438
|
-
function Ie(e) {
|
|
439
|
-
return Math.max(e.selectionStart, e.selectionEnd);
|
|
561
|
+
function Ye(t, e, n, r) {
|
|
562
|
+
const s = b(t, r);
|
|
563
|
+
return s === t ? null : {
|
|
564
|
+
raw: s,
|
|
565
|
+
rawStart: b(t.slice(0, e), r).length,
|
|
566
|
+
rawEnd: b(t.slice(0, n), r).length
|
|
567
|
+
};
|
|
440
568
|
}
|
|
441
|
-
function
|
|
442
|
-
if ((n == null ? void 0 : n.formatOn) !==
|
|
569
|
+
function Qe(t, e, n) {
|
|
570
|
+
if ((n == null ? void 0 : n.formatOn) !== I.Change || !n.thousandSeparator)
|
|
443
571
|
return;
|
|
444
|
-
const { selectionStart: r, selectionEnd:
|
|
445
|
-
if (r === null ||
|
|
572
|
+
const { selectionStart: r, selectionEnd: s, value: i } = e;
|
|
573
|
+
if (r === null || s === null || r !== s)
|
|
446
574
|
return;
|
|
447
|
-
const { key: a } =
|
|
448
|
-
a === "Backspace" && r > 0 &&
|
|
575
|
+
const { key: a } = t, c = n.thousandSeparator;
|
|
576
|
+
a === "Backspace" && r > 0 && i[r - 1] === c && e.setSelectionRange(r - 1, r - 1), a === "Delete" && i[r] === c && e.setSelectionRange(r + 1, r + 1);
|
|
449
577
|
}
|
|
450
|
-
function
|
|
451
|
-
if (!
|
|
452
|
-
const { selectionStart:
|
|
453
|
-
let
|
|
454
|
-
{ selectionStart:
|
|
578
|
+
function V(t, e, n, r, s, i) {
|
|
579
|
+
if (!r) return null;
|
|
580
|
+
const { selectionStart: a = 0, selectionEnd: c = 0, endOffset: h = 0 } = r;
|
|
581
|
+
let l = qe(
|
|
582
|
+
{ selectionStart: a, selectionEnd: c, endOffset: h },
|
|
455
583
|
t,
|
|
456
|
-
|
|
584
|
+
e
|
|
457
585
|
);
|
|
458
|
-
if (
|
|
459
|
-
const
|
|
460
|
-
thousandSeparator: (
|
|
586
|
+
if (l || (l = Ke(t, e)), !l) return null;
|
|
587
|
+
const u = Ze(e, {
|
|
588
|
+
thousandSeparator: (i == null ? void 0 : i.thousandSeparator) ?? s.thousandSeparator,
|
|
461
589
|
decimalSeparator: s.decimalSeparator
|
|
462
|
-
}),
|
|
463
|
-
thousandSeparator: (
|
|
590
|
+
}), f = {
|
|
591
|
+
thousandSeparator: (i == null ? void 0 : i.thousandSeparator) ?? s.thousandSeparator,
|
|
464
592
|
decimalSeparator: s.decimalSeparator,
|
|
465
|
-
isCharacterEquivalent: (
|
|
466
|
-
const
|
|
467
|
-
return
|
|
593
|
+
isCharacterEquivalent: (g, D) => {
|
|
594
|
+
const S = (i == null ? void 0 : i.thousandSeparator) ?? s.thousandSeparator;
|
|
595
|
+
return S && g === S ? !1 : g === D;
|
|
468
596
|
},
|
|
469
|
-
boundary:
|
|
470
|
-
},
|
|
597
|
+
boundary: u
|
|
598
|
+
}, o = (i == null ? void 0 : i.thousandSeparator) ?? s.thousandSeparator ?? ",", p = (i == null ? void 0 : i.thousandStyle) ?? y.None;
|
|
599
|
+
return Ue(
|
|
471
600
|
t,
|
|
601
|
+
e,
|
|
472
602
|
n,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
h,
|
|
603
|
+
o,
|
|
604
|
+
p,
|
|
605
|
+
l,
|
|
477
606
|
s.decimalSeparator,
|
|
478
|
-
|
|
607
|
+
f
|
|
479
608
|
);
|
|
480
|
-
ye(e, p, n);
|
|
481
|
-
}
|
|
482
|
-
const Te = (e, t = !1, n = ".") => {
|
|
483
|
-
const r = y(n), i = _(`[^0-9${r}]`, "g");
|
|
484
|
-
if (!t)
|
|
485
|
-
return e.replace(i, "");
|
|
486
|
-
const s = e.startsWith("-"), a = e.replace(i, "");
|
|
487
|
-
return s && (a.length > 0 || e === "-") ? "-" + a : a;
|
|
488
|
-
}, Ae = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g, ee = /^0+$/, T = /\.?0+$/;
|
|
489
|
-
function Re(e) {
|
|
490
|
-
return !e.includes("e") && !e.includes("E") ? e : e.replace(Ae, (t, n, r) => {
|
|
491
|
-
const i = parseInt(r, 10);
|
|
492
|
-
if (i === 0) return n;
|
|
493
|
-
const s = n.startsWith("-"), a = s ? n.slice(1) : n, [c, o = ""] = a.split("."), l = i > 0 ? _e(c, o, i) : xe(c, o, Math.abs(i));
|
|
494
|
-
return s ? "-" + l : l;
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
function _e(e, t, n) {
|
|
498
|
-
const r = e + t;
|
|
499
|
-
if (r === "0" || ee.test(r))
|
|
500
|
-
return "0";
|
|
501
|
-
const i = t.length;
|
|
502
|
-
if (n <= i) {
|
|
503
|
-
const a = r.slice(0, e.length + n), c = r.slice(e.length + n);
|
|
504
|
-
return c ? `${a}.${c}` : a;
|
|
505
|
-
}
|
|
506
|
-
const s = n - i;
|
|
507
|
-
return r + "0".repeat(s);
|
|
508
609
|
}
|
|
509
|
-
function
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const s = e.length - n;
|
|
514
|
-
if (s <= 0) {
|
|
515
|
-
const a = Math.abs(s), c = `0.${"0".repeat(a)}${r}`;
|
|
516
|
-
return A(c);
|
|
517
|
-
}
|
|
518
|
-
if (s < e.length) {
|
|
519
|
-
const a = r.slice(0, s), c = r.slice(s), o = `${a}.${c}`;
|
|
520
|
-
return A(o);
|
|
521
|
-
}
|
|
522
|
-
return A(r);
|
|
610
|
+
function F(t, e, n, r) {
|
|
611
|
+
setTimeout(() => {
|
|
612
|
+
t.value === e && (t.selectionStart !== n || t.selectionEnd !== r) && t.setSelectionRange(n, r);
|
|
613
|
+
}, 0);
|
|
523
614
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (e === "0.")
|
|
528
|
-
return "0";
|
|
529
|
-
if (e.startsWith("0.")) {
|
|
530
|
-
const t = e.replace(T, "");
|
|
531
|
-
return t === "0" ? "0" : t || "0";
|
|
532
|
-
}
|
|
533
|
-
if (e.startsWith("-0.")) {
|
|
534
|
-
const t = e.replace(T, "");
|
|
535
|
-
return t === "-0" || t === "0" ? "0" : t || "0";
|
|
536
|
-
}
|
|
537
|
-
return e.replace(T, "") || e;
|
|
615
|
+
function T(t, e, n) {
|
|
616
|
+
const r = t.value;
|
|
617
|
+
r === e && t.selectionStart === n && t.selectionEnd === n || (t.setRangeText(e, 0, r.length, "end"), t.setSelectionRange(n, n), F(t, e, n, n));
|
|
538
618
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
// Thousand
|
|
542
|
-
m: 6,
|
|
543
|
-
// Million
|
|
544
|
-
b: 9,
|
|
545
|
-
// Billion
|
|
546
|
-
t: 12
|
|
547
|
-
// Trillion
|
|
548
|
-
};
|
|
549
|
-
function Ue(e) {
|
|
550
|
-
return e.replace(Oe, (t, n, r) => {
|
|
551
|
-
const i = r.toLowerCase(), s = We[i];
|
|
552
|
-
if (!s)
|
|
553
|
-
return t;
|
|
554
|
-
const [a, c = ""] = n.split("."), o = a.replace(Be, "") || "0";
|
|
555
|
-
let l;
|
|
556
|
-
if (c.length === 0)
|
|
557
|
-
l = o + "0".repeat(s);
|
|
558
|
-
else if (c.length <= s) {
|
|
559
|
-
const h = s - c.length;
|
|
560
|
-
l = o + c + "0".repeat(h);
|
|
561
|
-
} else {
|
|
562
|
-
const h = c.slice(0, s), g = c.slice(s);
|
|
563
|
-
l = o + h + "." + g;
|
|
564
|
-
}
|
|
565
|
-
return l = l.replace(Ge, "$1$2"), ke.test(l) && (l = "0"), l.includes(".") && (l = l.replace(Ze, "")), l;
|
|
566
|
-
});
|
|
619
|
+
function Oe(t, e, n, r) {
|
|
620
|
+
t.value === e && t.selectionStart === n && t.selectionEnd === r || (t.setRangeText(e, 0, t.value.length, "preserve"), t.setSelectionRange(n, r), F(t, e, n, r));
|
|
567
621
|
}
|
|
568
|
-
function
|
|
569
|
-
|
|
570
|
-
return e;
|
|
571
|
-
const t = e.startsWith("-"), n = t ? e.slice(1) : e;
|
|
572
|
-
if (n === ".")
|
|
573
|
-
return e;
|
|
574
|
-
if (n.includes(".")) {
|
|
575
|
-
const [i, s] = n.split(".");
|
|
576
|
-
if (i) {
|
|
577
|
-
const c = (i.replace(/^0+/, "") || "0") + "." + s;
|
|
578
|
-
return t ? "-" + c : c;
|
|
579
|
-
}
|
|
580
|
-
return e;
|
|
581
|
-
}
|
|
582
|
-
if (n.startsWith("0")) {
|
|
583
|
-
const i = n.replace(/^0+/, "") || "0";
|
|
584
|
-
return t ? "-" + i : i;
|
|
585
|
-
}
|
|
586
|
-
return e;
|
|
587
|
-
}
|
|
588
|
-
function Je(e) {
|
|
589
|
-
return e.replace(/[\s\u200B]/g, "");
|
|
590
|
-
}
|
|
591
|
-
function v(e, t) {
|
|
592
|
-
const n = ae(t);
|
|
593
|
-
return e.replace(n, "");
|
|
594
|
-
}
|
|
595
|
-
const Pe = (e, t) => {
|
|
596
|
-
let n = Je(e);
|
|
597
|
-
return t != null && t.thousandSeparator && (n = v(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Ue(n)), n = Re(n), n = Te(
|
|
598
|
-
n,
|
|
599
|
-
t == null ? void 0 : t.enableNegative,
|
|
600
|
-
t == null ? void 0 : t.decimalSeparator
|
|
601
|
-
), n = oe(n, t == null ? void 0 : t.decimalSeparator), t != null && t.enableLeadingZeros || (n = ze(n)), n;
|
|
602
|
-
};
|
|
603
|
-
function Xe(e, t, n) {
|
|
604
|
-
return {
|
|
605
|
-
enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
|
|
606
|
-
enableNegative: e == null ? void 0 : e.enableNegative,
|
|
607
|
-
enableLeadingZeros: e == null ? void 0 : e.enableLeadingZeros,
|
|
608
|
-
decimalSeparator: t.decimalSeparator,
|
|
609
|
-
thousandSeparator: n ? t.thousandSeparator : void 0
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
function M(e, t, n, r) {
|
|
613
|
-
const i = x(n), s = r ?? (n == null ? void 0 : n.formatOn) === b.Change, a = Pe(
|
|
614
|
-
e,
|
|
615
|
-
Xe(n, i, s)
|
|
616
|
-
), c = le(
|
|
617
|
-
a,
|
|
618
|
-
t,
|
|
619
|
-
i.decimalSeparator
|
|
620
|
-
), o = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = he(
|
|
622
|
+
function x(t, e, n, r) {
|
|
623
|
+
const s = G(n), a = r ?? (n == null ? void 0 : n.formatOn) === I.Change ? n : { ...n, thousandSeparator: void 0 }, c = _e(t, a), h = fe(
|
|
621
624
|
c,
|
|
622
|
-
|
|
623
|
-
|
|
625
|
+
e,
|
|
626
|
+
s.decimalSeparator
|
|
627
|
+
), l = (n == null ? void 0 : n.decimalMinLength) ?? 0, u = ge(
|
|
628
|
+
h,
|
|
629
|
+
l,
|
|
630
|
+
s.decimalSeparator
|
|
624
631
|
);
|
|
625
|
-
return { formatted:
|
|
632
|
+
return { formatted: (n == null ? void 0 : n.formatOn) === I.Change && !!n.thousandSeparator ? Q(
|
|
633
|
+
u,
|
|
634
|
+
n.thousandSeparator,
|
|
635
|
+
n.thousandStyle ?? y.None,
|
|
636
|
+
n.enableLeadingZeros,
|
|
637
|
+
s.decimalSeparator
|
|
638
|
+
) : u, raw: u };
|
|
626
639
|
}
|
|
627
|
-
function
|
|
640
|
+
function ht(t, e, n) {
|
|
628
641
|
const r = !!(n != null && n.thousandSeparator);
|
|
629
|
-
return
|
|
630
|
-
e,
|
|
642
|
+
return x(
|
|
631
643
|
t,
|
|
644
|
+
e,
|
|
632
645
|
n,
|
|
633
646
|
r
|
|
634
647
|
);
|
|
635
648
|
}
|
|
636
|
-
function
|
|
637
|
-
if (
|
|
638
|
-
return
|
|
639
|
-
const r =
|
|
640
|
-
let
|
|
641
|
-
if (
|
|
649
|
+
function Ve(t, e, n) {
|
|
650
|
+
if (t.inputType === L.InsertFromPaste || t.inputType === L.InsertFromDrop)
|
|
651
|
+
return { type: "skip" };
|
|
652
|
+
const r = t.target, s = r.value, i = r.selectionStart ?? 0, a = r.selectionEnd ?? 0, c = G(n);
|
|
653
|
+
let h = t.data ?? "";
|
|
654
|
+
if (t.inputType === L.InsertText && (t.data === "," || t.data === ".")) {
|
|
642
655
|
const d = c.decimalSeparator;
|
|
643
|
-
if ((
|
|
644
|
-
return
|
|
645
|
-
|
|
656
|
+
if ((s.slice(0, i) + s.slice(a)).includes(d))
|
|
657
|
+
return { type: "reject" };
|
|
658
|
+
h = d;
|
|
646
659
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
660
|
+
if (t.inputType === L.InsertText && /^\d$/.test(h)) {
|
|
661
|
+
const d = c.decimalSeparator, E = s.indexOf(d);
|
|
662
|
+
if (E !== -1 && i > E) {
|
|
663
|
+
const w = s.length - E - 1, W = a - i;
|
|
664
|
+
if (w - W + 1 > e)
|
|
665
|
+
return { type: "reject" };
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
let l, u, f = 0;
|
|
669
|
+
const o = i !== a;
|
|
670
|
+
switch (t.inputType) {
|
|
671
|
+
case L.InsertText: {
|
|
672
|
+
l = s.slice(0, i) + h + s.slice(a), u = i + h.length;
|
|
651
673
|
break;
|
|
652
674
|
}
|
|
653
|
-
case
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
675
|
+
case L.DeleteContentBackward: {
|
|
676
|
+
const d = o ? i : Math.max(0, i - 1), E = o ? a : i;
|
|
677
|
+
l = s.slice(0, d) + s.slice(E), u = d;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
case L.DeleteContentForward: {
|
|
681
|
+
const d = o ? a : i + 1;
|
|
682
|
+
l = s.slice(0, i) + s.slice(d), u = i, o || (f = 1);
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
case L.DeleteByCut:
|
|
686
|
+
case L.DeleteByDrag: {
|
|
687
|
+
l = s.slice(0, i) + s.slice(a), u = i;
|
|
660
688
|
break;
|
|
661
689
|
}
|
|
662
|
-
case
|
|
663
|
-
|
|
690
|
+
case L.DeleteSoftLineBackward:
|
|
691
|
+
case L.DeleteHardLineBackward: {
|
|
692
|
+
const d = o ? i : 0;
|
|
693
|
+
l = s.slice(0, d) + s.slice(a), u = d;
|
|
664
694
|
break;
|
|
665
695
|
}
|
|
666
|
-
case
|
|
667
|
-
case
|
|
668
|
-
|
|
696
|
+
case L.DeleteSoftLineForward:
|
|
697
|
+
case L.DeleteHardLineForward: {
|
|
698
|
+
const d = o ? a : s.length;
|
|
699
|
+
l = s.slice(0, i) + s.slice(d), u = i, o || (f = s.length - i);
|
|
669
700
|
break;
|
|
670
701
|
}
|
|
671
702
|
default:
|
|
672
|
-
return
|
|
703
|
+
return { type: "skip" };
|
|
704
|
+
}
|
|
705
|
+
if ((n == null ? void 0 : n.maxLength) !== void 0 && t.inputType === L.InsertText) {
|
|
706
|
+
const d = n.thousandSeparator;
|
|
707
|
+
if ((d ? b(l, d).length : l.length) > n.maxLength)
|
|
708
|
+
return { type: "reject" };
|
|
673
709
|
}
|
|
674
|
-
|
|
675
|
-
const g = (n == null ? void 0 : n.formatOn) === b.Change, { formatted: u, raw: S } = M(
|
|
710
|
+
const p = (n == null ? void 0 : n.formatOn) === I.Change, { formatted: g, raw: D } = x(
|
|
676
711
|
l,
|
|
677
|
-
|
|
712
|
+
e,
|
|
678
713
|
n,
|
|
679
|
-
|
|
714
|
+
p
|
|
680
715
|
);
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
716
|
+
if (n != null && n.isAllowed && !n.isAllowed(D))
|
|
717
|
+
return { type: "reject" };
|
|
718
|
+
let S;
|
|
719
|
+
return l !== g ? S = V(
|
|
685
720
|
l,
|
|
721
|
+
g,
|
|
686
722
|
u,
|
|
687
|
-
h,
|
|
688
723
|
{
|
|
689
|
-
selectionStart:
|
|
724
|
+
selectionStart: i,
|
|
690
725
|
selectionEnd: a,
|
|
691
|
-
endOffset:
|
|
726
|
+
endOffset: f
|
|
692
727
|
},
|
|
693
728
|
c,
|
|
694
729
|
n
|
|
695
|
-
) :
|
|
696
|
-
}
|
|
697
|
-
function qe(e, t, n) {
|
|
698
|
-
if (e === "Backspace" || e === "Delete")
|
|
699
|
-
return e === "Delete" && t === n ? {
|
|
700
|
-
endOffset: 1
|
|
701
|
-
} : {
|
|
702
|
-
endOffset: 0
|
|
703
|
-
};
|
|
730
|
+
) ?? u : S = u, { type: "handled", formatted: g, raw: D, cursorPos: S };
|
|
704
731
|
}
|
|
705
|
-
function
|
|
706
|
-
const n =
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
s,
|
|
712
|
-
t
|
|
713
|
-
|
|
714
|
-
o
|
|
715
|
-
);
|
|
716
|
-
return i.value = l, s !== l && F(
|
|
717
|
-
i,
|
|
718
|
-
s,
|
|
719
|
-
l,
|
|
720
|
-
a,
|
|
721
|
-
n,
|
|
722
|
-
c,
|
|
723
|
-
r
|
|
724
|
-
), { formatted: l, raw: h };
|
|
732
|
+
function Fe(t, e) {
|
|
733
|
+
const n = t.target;
|
|
734
|
+
if (Qe(t, n, e), t.key !== "Backspace" && t.key !== "Delete") return;
|
|
735
|
+
const r = n.selectionStart ?? 0, s = n.selectionEnd ?? 0;
|
|
736
|
+
return {
|
|
737
|
+
selectionStart: r,
|
|
738
|
+
selectionEnd: s,
|
|
739
|
+
endOffset: t.key === "Delete" && r === s ? 1 : 0
|
|
740
|
+
};
|
|
725
741
|
}
|
|
726
|
-
function
|
|
727
|
-
const
|
|
728
|
-
return
|
|
742
|
+
function et(t, e, n, r) {
|
|
743
|
+
const s = r - n;
|
|
744
|
+
return t + e + s;
|
|
729
745
|
}
|
|
730
|
-
function
|
|
731
|
-
var
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
t,
|
|
746
|
+
function tt(t, e, n) {
|
|
747
|
+
var o;
|
|
748
|
+
const r = t.target, { value: s, selectionStart: i, selectionEnd: a } = r, c = ((o = t.clipboardData) == null ? void 0 : o.getData("text/plain")) || "", h = s.slice(0, i || 0) + c + s.slice(a || 0), { formatted: l, raw: u } = x(
|
|
749
|
+
h,
|
|
750
|
+
e,
|
|
736
751
|
n,
|
|
737
752
|
!0
|
|
738
753
|
);
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
754
|
+
if (n != null && n.isAllowed && !n.isAllowed(u))
|
|
755
|
+
return { type: "reject" };
|
|
756
|
+
const f = et(
|
|
757
|
+
i || 0,
|
|
742
758
|
c.length,
|
|
743
|
-
|
|
759
|
+
h.length,
|
|
744
760
|
l.length
|
|
745
761
|
);
|
|
746
|
-
return
|
|
762
|
+
return { type: "handled", formatted: l, raw: u, cursorPos: f };
|
|
747
763
|
}
|
|
748
|
-
function
|
|
749
|
-
|
|
750
|
-
return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
|
|
751
|
-
}
|
|
752
|
-
function Fe(e) {
|
|
753
|
-
var t, n;
|
|
764
|
+
function nt(t) {
|
|
765
|
+
var e, n;
|
|
754
766
|
try {
|
|
755
|
-
const
|
|
767
|
+
const s = new Intl.NumberFormat(t).formatToParts(123456789e-2);
|
|
756
768
|
return {
|
|
757
|
-
decimalSeparator: ((
|
|
758
|
-
thousandSeparator: ((n =
|
|
769
|
+
decimalSeparator: ((e = s.find((i) => i.type === "decimal")) == null ? void 0 : e.value) ?? ".",
|
|
770
|
+
thousandSeparator: ((n = s.find((i) => i.type === "group")) == null ? void 0 : n.value) ?? ","
|
|
759
771
|
};
|
|
760
772
|
} catch {
|
|
761
773
|
return { thousandSeparator: ",", decimalSeparator: "." };
|
|
762
774
|
}
|
|
763
775
|
}
|
|
764
|
-
function
|
|
765
|
-
if (!
|
|
766
|
-
const r =
|
|
776
|
+
function rt(t, e) {
|
|
777
|
+
if (!t) return e;
|
|
778
|
+
const r = nt(t === !0 ? void 0 : t);
|
|
767
779
|
return {
|
|
768
|
-
thousandSeparator:
|
|
769
|
-
decimalSeparator:
|
|
780
|
+
thousandSeparator: e.thousandSeparator ?? r.thousandSeparator,
|
|
781
|
+
decimalSeparator: e.decimalSeparator ?? r.decimalSeparator
|
|
770
782
|
};
|
|
771
783
|
}
|
|
772
|
-
function
|
|
773
|
-
|
|
784
|
+
function st(t) {
|
|
785
|
+
k("decimalMaxLength", t.decimalMaxLength), k("decimalMinLength", t.decimalMinLength), it(t.decimalMinLength, t.decimalMaxLength), q("formatOn", t.formatOn, [I.Blur, I.Change]), X("thousandSeparator", t.thousandSeparator), q("thousandStyle", t.thousandStyle, Object.values(y)), X("decimalSeparator", t.decimalSeparator), at(t.thousandSeparator, t.decimalSeparator), v("enableCompactNotation", t.enableCompactNotation), v("enableNegative", t.enableNegative), v("enableLeadingZeros", t.enableLeadingZeros), v("autoAddLeadingZero", t.autoAddLeadingZero), v("rawValueMode", t.rawValueMode), k("maxLength", t.maxLength), J("isAllowed", t.isAllowed), J("onChange", t.onChange);
|
|
774
786
|
}
|
|
775
|
-
function
|
|
776
|
-
if (e !== void 0)
|
|
777
|
-
|
|
778
|
-
throw new Error(
|
|
779
|
-
`decimalMaxLength must be a number. Received: ${typeof e} (${JSON.stringify(e)})`
|
|
780
|
-
);
|
|
781
|
-
if (!Number.isInteger(e))
|
|
782
|
-
throw new Error(
|
|
783
|
-
`decimalMaxLength must be an integer. Received: ${e}`
|
|
784
|
-
);
|
|
785
|
-
if (e < 0)
|
|
786
|
-
throw new Error(
|
|
787
|
-
`decimalMaxLength must be non-negative. Received: ${e}`
|
|
788
|
-
);
|
|
789
|
-
}
|
|
787
|
+
function k(t, e) {
|
|
788
|
+
if (e !== void 0 && (typeof e != "number" || !Number.isInteger(e) || e < 0))
|
|
789
|
+
throw new Error(`${t} must be a non-negative integer. Received: ${JSON.stringify(e)}`);
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
if (e !== void 0)
|
|
793
|
-
|
|
794
|
-
throw new Error(
|
|
795
|
-
`decimalMinLength must be a number. Received: ${typeof e} (${JSON.stringify(e)})`
|
|
796
|
-
);
|
|
797
|
-
if (!Number.isInteger(e))
|
|
798
|
-
throw new Error(
|
|
799
|
-
`decimalMinLength must be an integer. Received: ${e}`
|
|
800
|
-
);
|
|
801
|
-
if (e < 0)
|
|
802
|
-
throw new Error(
|
|
803
|
-
`decimalMinLength must be non-negative. Received: ${e}`
|
|
804
|
-
);
|
|
805
|
-
}
|
|
791
|
+
function X(t, e) {
|
|
792
|
+
if (e !== void 0 && (typeof e != "string" || e.length !== 1))
|
|
793
|
+
throw new Error(`${t} must be a single character. Received: ${JSON.stringify(e)}`);
|
|
806
794
|
}
|
|
807
|
-
function
|
|
808
|
-
if (
|
|
809
|
-
throw new Error(
|
|
810
|
-
`decimalMinLength (${e}) cannot be greater than decimalMaxLength (${t}).`
|
|
811
|
-
);
|
|
795
|
+
function v(t, e) {
|
|
796
|
+
if (e !== void 0 && typeof e != "boolean")
|
|
797
|
+
throw new Error(`${t} must be a boolean. Received: ${JSON.stringify(e)}`);
|
|
812
798
|
}
|
|
813
|
-
function
|
|
814
|
-
if (e !== void 0 &&
|
|
815
|
-
throw new Error(
|
|
816
|
-
`formatOn must be either ${b.Blur} or ${b.Change}. Received: ${JSON.stringify(e)}`
|
|
817
|
-
);
|
|
818
|
-
}
|
|
819
|
-
function at(e) {
|
|
820
|
-
if (e !== void 0) {
|
|
821
|
-
if (typeof e != "string")
|
|
822
|
-
throw new Error(
|
|
823
|
-
`thousandSeparator must be a string. Received: ${typeof e} (${JSON.stringify(e)})`
|
|
824
|
-
);
|
|
825
|
-
if (e.length === 0)
|
|
826
|
-
throw new Error(
|
|
827
|
-
`thousandSeparator cannot be empty. Received: ${JSON.stringify(e)}`
|
|
828
|
-
);
|
|
829
|
-
if (e.length > 1)
|
|
830
|
-
throw new Error(
|
|
831
|
-
`thousandSeparator must be a single character. Received: "${e}" (length: ${e.length})`
|
|
832
|
-
);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
function ct(e) {
|
|
836
|
-
if (e !== void 0 && !Object.values(L).includes(e))
|
|
837
|
-
throw new Error(
|
|
838
|
-
`ThousandStyle must be one of: ${Object.values(L).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
|
|
839
|
-
);
|
|
840
|
-
}
|
|
841
|
-
function lt(e) {
|
|
842
|
-
if (e !== void 0) {
|
|
843
|
-
if (typeof e != "string")
|
|
844
|
-
throw new Error(
|
|
845
|
-
`decimalSeparator must be a string. Received: ${typeof e} (${JSON.stringify(e)})`
|
|
846
|
-
);
|
|
847
|
-
if (e.length === 0)
|
|
848
|
-
throw new Error(
|
|
849
|
-
`decimalSeparator cannot be empty. Received: ${JSON.stringify(e)}`
|
|
850
|
-
);
|
|
851
|
-
if (e.length > 1)
|
|
852
|
-
throw new Error(
|
|
853
|
-
`decimalSeparator must be a single character. Received: "${e}" (length: ${e.length})`
|
|
854
|
-
);
|
|
855
|
-
}
|
|
799
|
+
function J(t, e) {
|
|
800
|
+
if (e !== void 0 && typeof e != "function")
|
|
801
|
+
throw new Error(`${t} must be a function. Received: ${JSON.stringify(e)}`);
|
|
856
802
|
}
|
|
857
|
-
function
|
|
858
|
-
if (
|
|
803
|
+
function q(t, e, n) {
|
|
804
|
+
if (e !== void 0 && !n.includes(e))
|
|
859
805
|
throw new Error(
|
|
860
|
-
|
|
806
|
+
`${t} must be one of: ${n.map((r) => `'${r}'`).join(", ")}. Received: ${JSON.stringify(e)}`
|
|
861
807
|
);
|
|
862
808
|
}
|
|
863
|
-
function
|
|
864
|
-
if (t
|
|
809
|
+
function it(t, e) {
|
|
810
|
+
if (!(t === void 0 || e === void 0) && t > e)
|
|
865
811
|
throw new Error(
|
|
866
|
-
|
|
812
|
+
`decimalMinLength (${t}) cannot be greater than decimalMaxLength (${e}).`
|
|
867
813
|
);
|
|
868
814
|
}
|
|
869
|
-
function
|
|
870
|
-
if (e
|
|
815
|
+
function at(t, e) {
|
|
816
|
+
if (!(t === void 0 || e === void 0) && t === e)
|
|
871
817
|
throw new Error(
|
|
872
|
-
`
|
|
818
|
+
`decimalSeparator cannot equal thousandSeparator. Both were ${JSON.stringify(t)}.`
|
|
873
819
|
);
|
|
874
820
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
enableNegative: h,
|
|
919
|
-
enableLeadingZeros: g,
|
|
920
|
-
rawValueMode: u,
|
|
921
|
-
...E
|
|
922
|
-
};
|
|
923
|
-
if (this.resolvedOptions = this.getResolvedOptions(p), this.createInputElement(t, p), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
|
|
924
|
-
const d = this.element.value, f = this.resolvedOptions.thousandSeparator ? v(d, this.resolvedOptions.thousandSeparator) : d;
|
|
925
|
-
this.rawValue = f, this.element.value = this.formatValueForDisplay(f);
|
|
926
|
-
} else if (this.element.value) {
|
|
927
|
-
const d = this.element.value;
|
|
928
|
-
this.element.value = this.formatValueForDisplay(d);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
createInputElement(t, n) {
|
|
932
|
-
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");
|
|
933
|
-
const r = Ve(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
|
|
934
|
-
this.element.setAttribute("pattern", r);
|
|
821
|
+
const ct = /* @__PURE__ */ new Set([
|
|
822
|
+
"decimalMaxLength",
|
|
823
|
+
"decimalMinLength",
|
|
824
|
+
"formatOn",
|
|
825
|
+
"thousandSeparator",
|
|
826
|
+
"thousandStyle",
|
|
827
|
+
"decimalSeparator",
|
|
828
|
+
"locale",
|
|
829
|
+
"enableCompactNotation",
|
|
830
|
+
"enableNegative",
|
|
831
|
+
"enableLeadingZeros",
|
|
832
|
+
"autoAddLeadingZero",
|
|
833
|
+
"rawValueMode",
|
|
834
|
+
"maxLength",
|
|
835
|
+
"isAllowed",
|
|
836
|
+
"onChange",
|
|
837
|
+
"value",
|
|
838
|
+
"defaultValue",
|
|
839
|
+
// Protected native attrs set explicitly in createInputElement.
|
|
840
|
+
"type",
|
|
841
|
+
"inputMode",
|
|
842
|
+
"spellcheck",
|
|
843
|
+
"autocomplete"
|
|
844
|
+
]);
|
|
845
|
+
class ut {
|
|
846
|
+
constructor(e, n) {
|
|
847
|
+
A(this, "element");
|
|
848
|
+
A(this, "resolvedOptions");
|
|
849
|
+
A(this, "rawValue", "");
|
|
850
|
+
// True while we're applying our own setRangeText. The synchronous `input` event that
|
|
851
|
+
// setRangeText fires must NOT re-enter handleChange's broadcast path, or onChange
|
|
852
|
+
// double-fires and the cursor is recomputed against the post-write value.
|
|
853
|
+
// try/finally in withInternalWrite guarantees this clears even if the write throws.
|
|
854
|
+
A(this, "suppressNextInputEvent", !1);
|
|
855
|
+
// Mouse-driven focus: the browser commits the click→selection mapping AFTER focus
|
|
856
|
+
// fires, using the input's current value. If we strip separators in the focus handler,
|
|
857
|
+
// the click X-coord then maps to a position N digits too far right (where N = separators
|
|
858
|
+
// before the click point). Set on mousedown, cleared on click after we strip + map -
|
|
859
|
+
// click fires after the browser has finalised the caret, so selectionStart reflects
|
|
860
|
+
// the user's intended position when we read it.
|
|
861
|
+
A(this, "pendingMouseStrip", !1);
|
|
862
|
+
A(this, "caretPositionBeforeChange");
|
|
863
|
+
st(n);
|
|
935
864
|
const {
|
|
936
|
-
decimalMaxLength:
|
|
865
|
+
decimalMaxLength: r = ne,
|
|
866
|
+
decimalMinLength: s = re,
|
|
867
|
+
formatOn: i = se,
|
|
868
|
+
thousandSeparator: a,
|
|
869
|
+
thousandStyle: c = ae,
|
|
870
|
+
decimalSeparator: h,
|
|
871
|
+
locale: l,
|
|
872
|
+
enableCompactNotation: u = ce,
|
|
873
|
+
enableNegative: f = le,
|
|
874
|
+
enableLeadingZeros: o = he,
|
|
875
|
+
autoAddLeadingZero: p = ue,
|
|
876
|
+
rawValueMode: g = oe,
|
|
877
|
+
maxLength: D,
|
|
878
|
+
isAllowed: S,
|
|
879
|
+
onChange: d
|
|
880
|
+
} = n, E = rt(l, { thousandSeparator: a, decimalSeparator: h });
|
|
881
|
+
this.resolvedOptions = {
|
|
882
|
+
decimalMaxLength: r,
|
|
937
883
|
decimalMinLength: s,
|
|
938
|
-
formatOn:
|
|
939
|
-
thousandSeparator:
|
|
940
|
-
thousandStyle:
|
|
941
|
-
decimalSeparator:
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
rawValueMode:
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
inputMode: m,
|
|
952
|
-
spellcheck: te,
|
|
953
|
-
autocomplete: ut,
|
|
954
|
-
...ne
|
|
955
|
-
} = n;
|
|
956
|
-
Object.assign(this.element, ne), d !== void 0 ? this.element.value = d : f !== void 0 && (this.element.defaultValue = f, this.element.value = f), t.appendChild(this.element);
|
|
884
|
+
formatOn: i,
|
|
885
|
+
thousandSeparator: E.thousandSeparator ?? ie,
|
|
886
|
+
thousandStyle: c,
|
|
887
|
+
decimalSeparator: E.decimalSeparator ?? $,
|
|
888
|
+
enableCompactNotation: u,
|
|
889
|
+
enableNegative: f,
|
|
890
|
+
enableLeadingZeros: o,
|
|
891
|
+
autoAddLeadingZero: p,
|
|
892
|
+
rawValueMode: g,
|
|
893
|
+
maxLength: D,
|
|
894
|
+
isAllowed: S,
|
|
895
|
+
onChange: d
|
|
896
|
+
}, this.createInputElement(e, n), this.setupEventListeners(), this.setDefaultValue();
|
|
957
897
|
}
|
|
958
|
-
|
|
959
|
-
|
|
898
|
+
toRaw(e) {
|
|
899
|
+
const n = this.resolvedOptions.thousandSeparator;
|
|
900
|
+
return n ? b(e, n) : e;
|
|
960
901
|
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
});
|
|
966
|
-
return {
|
|
967
|
-
decimalMaxLength: t.decimalMaxLength ?? B,
|
|
968
|
-
decimalMinLength: t.decimalMinLength ?? G,
|
|
969
|
-
formatOn: t.formatOn ?? k,
|
|
970
|
-
thousandSeparator: n.thousandSeparator ?? se,
|
|
971
|
-
thousandStyle: t.thousandStyle ?? Z,
|
|
972
|
-
decimalSeparator: n.decimalSeparator ?? C,
|
|
973
|
-
enableCompactNotation: t.enableCompactNotation ?? W,
|
|
974
|
-
enableNegative: t.enableNegative ?? U,
|
|
975
|
-
enableLeadingZeros: t.enableLeadingZeros ?? z,
|
|
976
|
-
rawValueMode: t.rawValueMode ?? J,
|
|
977
|
-
onChange: t.onChange
|
|
978
|
-
};
|
|
902
|
+
setDefaultValue() {
|
|
903
|
+
if (!this.element.value) return;
|
|
904
|
+
const e = this.toRaw(this.element.value);
|
|
905
|
+
this.resolvedOptions.rawValueMode && (this.rawValue = e), this.element.value = this.applyDisplaySeparators(e);
|
|
979
906
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
907
|
+
createInputElement(e, n) {
|
|
908
|
+
const r = e instanceof HTMLInputElement;
|
|
909
|
+
this.element = r ? e : document.createElement("input"), this.element.setAttribute("type", "text"), this.element.setAttribute("inputmode", "decimal"), this.element.setAttribute("spellcheck", "false"), this.element.setAttribute("autocomplete", "off");
|
|
910
|
+
const s = M(this.resolvedOptions.decimalSeparator), i = this.resolvedOptions.enableNegative ? "-?" : "";
|
|
911
|
+
this.element.setAttribute("pattern", `^${i}[0-9]*[${s}]?[0-9]*$`);
|
|
912
|
+
const a = Object.fromEntries(
|
|
913
|
+
Object.entries(n).filter(([c]) => !ct.has(c))
|
|
914
|
+
);
|
|
915
|
+
Object.assign(this.element, a), n.value !== void 0 ? this.element.value = n.value : n.defaultValue !== void 0 && (this.element.defaultValue = n.defaultValue, this.element.value = n.defaultValue), r || e.appendChild(this.element);
|
|
916
|
+
}
|
|
917
|
+
setupEventListeners() {
|
|
918
|
+
this.element.addEventListener("beforeinput", this.handleBeforeInput.bind(this)), 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 === I.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)), this.element.addEventListener("mousedown", this.handleMouseDown.bind(this)), this.element.addEventListener("click", this.handleClick.bind(this)));
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Runs `fn` with `suppressNextInputEvent` set so the synchronous `input` event fired
|
|
922
|
+
* by `setRangeText` is short-circuited in `handleChange`. Exactly one set/clear pair
|
|
923
|
+
* per write; try/finally guarantees the flag clears even if `fn` throws.
|
|
924
|
+
*/
|
|
925
|
+
withInternalWrite(e) {
|
|
926
|
+
this.suppressNextInputEvent = !0;
|
|
927
|
+
try {
|
|
928
|
+
e();
|
|
929
|
+
} finally {
|
|
930
|
+
this.suppressNextInputEvent = !1;
|
|
931
|
+
}
|
|
992
932
|
}
|
|
993
|
-
handleValueChange(
|
|
933
|
+
handleValueChange(e, n) {
|
|
994
934
|
if (this.resolvedOptions.rawValueMode && n !== void 0 && (this.rawValue = n), this.resolvedOptions.onChange) {
|
|
995
|
-
const r = this.resolvedOptions.rawValueMode ? this.rawValue :
|
|
935
|
+
const r = this.resolvedOptions.rawValueMode ? this.rawValue : e;
|
|
996
936
|
this.resolvedOptions.onChange(r);
|
|
997
937
|
}
|
|
998
938
|
}
|
|
999
|
-
|
|
1000
|
-
if (!
|
|
1001
|
-
return
|
|
1002
|
-
const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros:
|
|
1003
|
-
return n && r !==
|
|
1004
|
-
|
|
939
|
+
applyDisplaySeparators(e) {
|
|
940
|
+
if (!e)
|
|
941
|
+
return e;
|
|
942
|
+
const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: s, decimalSeparator: i } = this.resolvedOptions;
|
|
943
|
+
return n && r !== y.None ? Q(
|
|
944
|
+
e,
|
|
1005
945
|
n,
|
|
1006
946
|
r,
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
) :
|
|
947
|
+
s,
|
|
948
|
+
i
|
|
949
|
+
) : e;
|
|
1010
950
|
}
|
|
1011
|
-
handleBeforeInput(
|
|
1012
|
-
|
|
1013
|
-
|
|
951
|
+
handleBeforeInput(e) {
|
|
952
|
+
const n = Ve(
|
|
953
|
+
e,
|
|
1014
954
|
this.resolvedOptions.decimalMaxLength,
|
|
1015
|
-
this.
|
|
955
|
+
this.resolvedOptions
|
|
1016
956
|
);
|
|
957
|
+
switch (n.type) {
|
|
958
|
+
case "handled": {
|
|
959
|
+
e.preventDefault(), this.withInternalWrite(
|
|
960
|
+
() => T(this.element, n.formatted, n.cursorPos)
|
|
961
|
+
), this.handleValueChange(n.formatted, n.raw);
|
|
962
|
+
break;
|
|
963
|
+
}
|
|
964
|
+
case "reject":
|
|
965
|
+
e.preventDefault();
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
1017
968
|
}
|
|
1018
|
-
handleChange(
|
|
1019
|
-
|
|
1020
|
-
|
|
969
|
+
handleChange(e) {
|
|
970
|
+
if (this.suppressNextInputEvent) return;
|
|
971
|
+
const n = e.target;
|
|
972
|
+
if (e instanceof InputEvent && (e.inputType === L.HistoryUndo || e.inputType === L.HistoryRedo)) {
|
|
973
|
+
const l = this.toRaw(n.value);
|
|
974
|
+
this.caretPositionBeforeChange = void 0, this.handleValueChange(n.value, l);
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
const r = n.value, s = Math.max(n.selectionStart ?? 0, n.selectionEnd ?? 0), i = G(this.resolvedOptions), a = this.resolvedOptions.formatOn === I.Change, { formatted: c, raw: h } = x(
|
|
978
|
+
r,
|
|
1021
979
|
this.resolvedOptions.decimalMaxLength,
|
|
1022
|
-
this.
|
|
1023
|
-
|
|
980
|
+
this.resolvedOptions,
|
|
981
|
+
a
|
|
1024
982
|
);
|
|
1025
|
-
|
|
983
|
+
if (r !== c) {
|
|
984
|
+
const l = V(
|
|
985
|
+
r,
|
|
986
|
+
c,
|
|
987
|
+
s,
|
|
988
|
+
this.caretPositionBeforeChange,
|
|
989
|
+
i,
|
|
990
|
+
this.resolvedOptions
|
|
991
|
+
);
|
|
992
|
+
this.withInternalWrite(
|
|
993
|
+
() => T(n, c, l ?? c.length)
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
this.caretPositionBeforeChange = void 0, this.handleValueChange(c, h);
|
|
1026
997
|
}
|
|
1027
|
-
handleKeyDown(
|
|
1028
|
-
const n =
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
decimalSeparator: s.decimalSeparator
|
|
1033
|
-
});
|
|
1034
|
-
a ? this.caretPositionBeforeChange = {
|
|
1035
|
-
selectionStart: r ?? 0,
|
|
1036
|
-
selectionEnd: i ?? 0,
|
|
1037
|
-
endOffset: a.endOffset
|
|
1038
|
-
} : this.caretPositionBeforeChange = {
|
|
1039
|
-
selectionStart: r ?? 0,
|
|
1040
|
-
selectionEnd: i ?? 0
|
|
998
|
+
handleKeyDown(e) {
|
|
999
|
+
const n = e.target;
|
|
1000
|
+
this.caretPositionBeforeChange = Fe(e, this.resolvedOptions) ?? {
|
|
1001
|
+
selectionStart: n.selectionStart ?? 0,
|
|
1002
|
+
selectionEnd: n.selectionEnd ?? 0
|
|
1041
1003
|
};
|
|
1042
1004
|
}
|
|
1043
|
-
handlePaste(
|
|
1044
|
-
|
|
1045
|
-
this.
|
|
1046
|
-
|
|
1047
|
-
|
|
1005
|
+
handlePaste(e) {
|
|
1006
|
+
e.preventDefault();
|
|
1007
|
+
const n = tt(e, this.resolvedOptions.decimalMaxLength, this.resolvedOptions);
|
|
1008
|
+
n.type !== "reject" && (this.withInternalWrite(
|
|
1009
|
+
() => T(this.element, n.formatted, n.cursorPos)
|
|
1010
|
+
), this.handleValueChange(n.formatted, n.raw));
|
|
1048
1011
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1012
|
+
stripSeparatorsAndMapCaret(e) {
|
|
1013
|
+
const n = this.resolvedOptions.thousandSeparator;
|
|
1014
|
+
if (!n || this.resolvedOptions.thousandStyle === y.None) return;
|
|
1015
|
+
const r = e.selectionStart ?? 0, s = e.selectionEnd ?? e.value.length, i = Ye(e.value, r, s, n);
|
|
1016
|
+
i && (this.withInternalWrite(
|
|
1017
|
+
() => Oe(e, i.raw, i.rawStart, i.rawEnd)
|
|
1018
|
+
), this.handleValueChange(i.raw, i.raw));
|
|
1054
1019
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1020
|
+
handleFocus(e) {
|
|
1021
|
+
this.pendingMouseStrip || this.stripSeparatorsAndMapCaret(e.target);
|
|
1022
|
+
}
|
|
1023
|
+
handleMouseDown() {
|
|
1024
|
+
this.pendingMouseStrip = !0;
|
|
1025
|
+
}
|
|
1026
|
+
handleClick(e) {
|
|
1027
|
+
this.pendingMouseStrip && (this.pendingMouseStrip = !1, this.stripSeparatorsAndMapCaret(e.target));
|
|
1028
|
+
}
|
|
1029
|
+
handleBlur(e) {
|
|
1030
|
+
this.pendingMouseStrip = !1;
|
|
1031
|
+
const n = e.target, { thousandSeparator: r, thousandStyle: s } = this.resolvedOptions;
|
|
1032
|
+
if (!r || s === y.None || !n.value) return;
|
|
1033
|
+
const i = this.applyDisplaySeparators(n.value);
|
|
1034
|
+
i !== n.value && this.withInternalWrite(
|
|
1035
|
+
() => T(n, i, i.length)
|
|
1036
|
+
);
|
|
1037
|
+
const a = this.resolvedOptions.rawValueMode ? this.toRaw(i) : void 0;
|
|
1038
|
+
this.handleValueChange(i, a);
|
|
1063
1039
|
}
|
|
1064
1040
|
getValue() {
|
|
1065
1041
|
return this.resolvedOptions.rawValueMode ? this.rawValue : this.element.value;
|
|
1066
1042
|
}
|
|
1067
|
-
|
|
1043
|
+
/**
|
|
1044
|
+
* Sets the input's value programmatically.
|
|
1045
|
+
*
|
|
1046
|
+
* @param value - The new value. In `rawValueMode`, this is treated as raw and re-formatted for display.
|
|
1047
|
+
* @param options.undoable - Defaults to `true`: routes the write through `setRangeText`
|
|
1048
|
+
* so the browser's undo stack stays intact and `Ctrl+Z` can revert this call. Pass
|
|
1049
|
+
* `false` only when you intentionally want to wipe the undo history (e.g. form reset).
|
|
1050
|
+
*/
|
|
1051
|
+
setValue(e, n) {
|
|
1052
|
+
let r;
|
|
1068
1053
|
if (this.resolvedOptions.rawValueMode) {
|
|
1069
|
-
const
|
|
1070
|
-
this.rawValue =
|
|
1054
|
+
const s = this.toRaw(e);
|
|
1055
|
+
this.rawValue = s, r = this.applyDisplaySeparators(s);
|
|
1071
1056
|
} else
|
|
1072
|
-
|
|
1057
|
+
r = e;
|
|
1058
|
+
if ((n == null ? void 0 : n.undoable) === !1) {
|
|
1059
|
+
this.element.value = r;
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
this.withInternalWrite(
|
|
1063
|
+
() => T(this.element, r, r.length)
|
|
1064
|
+
);
|
|
1073
1065
|
}
|
|
1074
1066
|
disable() {
|
|
1075
1067
|
this.element.disabled = !0;
|
|
@@ -1077,11 +1069,11 @@ class gt {
|
|
|
1077
1069
|
enable() {
|
|
1078
1070
|
this.element.disabled = !1;
|
|
1079
1071
|
}
|
|
1080
|
-
addEventListener(
|
|
1081
|
-
this.element.addEventListener(
|
|
1072
|
+
addEventListener(e, n) {
|
|
1073
|
+
this.element.addEventListener(e, n);
|
|
1082
1074
|
}
|
|
1083
|
-
removeEventListener(
|
|
1084
|
-
this.element.removeEventListener(
|
|
1075
|
+
removeEventListener(e, n) {
|
|
1076
|
+
this.element.removeEventListener(e, n);
|
|
1085
1077
|
}
|
|
1086
1078
|
/**
|
|
1087
1079
|
* Returns the underlying HTMLInputElement for direct access.
|
|
@@ -1103,45 +1095,62 @@ class gt {
|
|
|
1103
1095
|
* In rawValueMode, the value will be formatted for display.
|
|
1104
1096
|
* Otherwise, sets the value directly.
|
|
1105
1097
|
*/
|
|
1106
|
-
set value(
|
|
1107
|
-
this.setValue(
|
|
1098
|
+
set value(e) {
|
|
1099
|
+
this.setValue(e);
|
|
1108
1100
|
}
|
|
1109
1101
|
/**
|
|
1110
1102
|
* Gets the value as a number, similar to HTMLInputElement.valueAsNumber.
|
|
1111
1103
|
* Returns NaN if the value cannot be converted to a number.
|
|
1104
|
+
*
|
|
1105
|
+
* **Precision warning**: this getter returns a JavaScript `number` (IEEE 754 double).
|
|
1106
|
+
* Values beyond ~15 significant digits will lose precision. Numora is designed around
|
|
1107
|
+
* string values for this reason - prefer {@link getValue} when exact precision matters.
|
|
1108
|
+
* Treat `valueAsNumber` strictly as an escape hatch for arithmetic that you already know
|
|
1109
|
+
* is safe at float precision.
|
|
1112
1110
|
*/
|
|
1113
1111
|
get valueAsNumber() {
|
|
1114
|
-
const
|
|
1115
|
-
if (!
|
|
1112
|
+
const e = this.getValue();
|
|
1113
|
+
if (!e)
|
|
1116
1114
|
return NaN;
|
|
1117
|
-
const n = this.
|
|
1115
|
+
const n = this.toRaw(e), r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(M(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
|
|
1118
1116
|
return parseFloat(r);
|
|
1119
1117
|
}
|
|
1120
1118
|
/**
|
|
1121
1119
|
* Sets the value from a number, similar to HTMLInputElement.valueAsNumber.
|
|
1122
1120
|
*/
|
|
1123
|
-
set valueAsNumber(
|
|
1124
|
-
if (isNaN(
|
|
1121
|
+
set valueAsNumber(e) {
|
|
1122
|
+
if (isNaN(e)) {
|
|
1125
1123
|
this.setValue("");
|
|
1126
1124
|
return;
|
|
1127
1125
|
}
|
|
1128
|
-
const n =
|
|
1126
|
+
const n = e.toString();
|
|
1129
1127
|
this.setValue(n);
|
|
1130
1128
|
}
|
|
1131
1129
|
}
|
|
1132
1130
|
export {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
tt as
|
|
1131
|
+
I as FormatOn,
|
|
1132
|
+
L as InputType,
|
|
1133
|
+
ut as NumoraInput,
|
|
1134
|
+
y as ThousandStyle,
|
|
1135
|
+
rt as applyLocale,
|
|
1136
|
+
Ye as computeStripSeparatorsResult,
|
|
1137
|
+
Te as expandCompactNotation,
|
|
1138
|
+
Le as expandScientificNotation,
|
|
1139
|
+
xe as filterMobileKeyboardArtifacts,
|
|
1140
|
+
ht as formatValueForDisplay,
|
|
1141
|
+
nt as getSeparatorsFromLocale,
|
|
1142
|
+
Ve as handleOnBeforeInputNumoraInput,
|
|
1143
|
+
Fe as handleOnKeyDownNumoraInput,
|
|
1144
|
+
tt as handleOnPasteNumoraInput,
|
|
1145
|
+
Re as normalizeFullWidthDigits,
|
|
1146
|
+
Me as prependLeadingZero,
|
|
1147
|
+
Se as removeExtraDecimalSeparators,
|
|
1148
|
+
ve as removeLeadingZeros,
|
|
1149
|
+
Ee as removeNonNumericCharacters,
|
|
1150
|
+
b as removeThousandSeparators,
|
|
1151
|
+
_e as sanitizeNumoraInput,
|
|
1152
|
+
$e as truncateToMaxLength,
|
|
1153
|
+
st as validateNumoraInputOptions,
|
|
1154
|
+
Oe as writeStripPreservingUndo,
|
|
1155
|
+
T as writeValuePreservingUndo
|
|
1147
1156
|
};
|