@livestore/devtools-vite 0.4.0-dev.22 → 0.4.0-dev.24
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 +2 -4
- package/dist/devtools-bundle/{data-grid-overlay-editor-DAFeubZU.js → data-grid-overlay-editor-B9SeOgSD.js} +1 -1
- package/dist/devtools-bundle/{devtools-react-bundle-Cr6SFlqv.js → devtools-react-bundle-CKWwCQfK.js} +62378 -59914
- package/dist/devtools-bundle/devtools-vite.css +1 -1
- package/dist/devtools-bundle/{index-BxiMdN5N.js → index-CS9sgctA.js} +1 -1
- package/dist/devtools-bundle/index.js +1 -1
- package/dist/devtools-bundle/{mod-2ScWT2NO.js → mod-C9RzS96o.js} +24 -24
- package/dist/devtools-bundle/{number-overlay-editor-C737Vjea.js → number-overlay-editor-Dfha3F1D.js} +174 -166
- package/dist/plugin.d.ts +19 -41
- package/dist/plugin.js +562 -576
- package/dist/release-metadata.json +27 -0
- package/package.json +17 -12
package/dist/devtools-bundle/{number-overlay-editor-C737Vjea.js → number-overlay-editor-Dfha3F1D.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { s as
|
|
2
|
-
const
|
|
1
|
+
import { s as Be, R as Y, r as O } from "./devtools-react-bundle-CKWwCQfK.js";
|
|
2
|
+
const Fe = /* @__PURE__ */ Be("div")({
|
|
3
3
|
name: "NumberOverlayEditorStyle",
|
|
4
4
|
class: "gdg-n15fjm3e",
|
|
5
5
|
propsAsIs: !1
|
|
6
6
|
});
|
|
7
|
-
function
|
|
7
|
+
function pe(e, t) {
|
|
8
8
|
var r = {};
|
|
9
9
|
for (var n in e)
|
|
10
10
|
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
@@ -13,13 +13,13 @@ function Se(e, t) {
|
|
|
13
13
|
t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (r[n[a]] = e[n[a]]);
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
var
|
|
16
|
+
var ee;
|
|
17
17
|
(function(e) {
|
|
18
18
|
e.event = "event", e.props = "prop";
|
|
19
|
-
})(
|
|
19
|
+
})(ee || (ee = {}));
|
|
20
20
|
function q() {
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function _e(e) {
|
|
23
23
|
var t, r = void 0;
|
|
24
24
|
return function() {
|
|
25
25
|
for (var n = [], a = arguments.length; a--; ) n[a] = arguments[a];
|
|
@@ -31,43 +31,42 @@ function Fe(e) {
|
|
|
31
31
|
function ae(e) {
|
|
32
32
|
return !!(e || "").match(/\d/);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function z(e) {
|
|
35
35
|
return e == null;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function je(e) {
|
|
38
38
|
return typeof e == "number" && isNaN(e);
|
|
39
39
|
}
|
|
40
|
-
function pe(e) {
|
|
41
|
-
return Y(e) || _e(e) || typeof e == "number" && !isFinite(e);
|
|
42
|
-
}
|
|
43
40
|
function xe(e) {
|
|
41
|
+
return z(e) || je(e) || typeof e == "number" && !isFinite(e);
|
|
42
|
+
}
|
|
43
|
+
function ye(e) {
|
|
44
44
|
return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Me(e) {
|
|
47
47
|
switch (e) {
|
|
48
48
|
case "lakh":
|
|
49
49
|
return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
|
|
50
50
|
case "wan":
|
|
51
51
|
return /(\d)(?=(\d{4})+(?!\d))/g;
|
|
52
|
-
case "thousand":
|
|
53
52
|
default:
|
|
54
53
|
return /(\d)(?=(\d{3})+(?!\d))/g;
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
function Le(e, t, r) {
|
|
58
|
-
var n =
|
|
57
|
+
var n = Me(r), a = e.search(/[1-9]/);
|
|
59
58
|
return a = a === -1 ? e.length : a, e.substring(0, a) + e.substring(a, e.length).replace(n, "$1" + t);
|
|
60
59
|
}
|
|
61
|
-
function
|
|
62
|
-
var t =
|
|
60
|
+
function de(e) {
|
|
61
|
+
var t = O.useRef(e);
|
|
63
62
|
t.current = e;
|
|
64
|
-
var r =
|
|
63
|
+
var r = O.useRef(function() {
|
|
65
64
|
for (var n = [], a = arguments.length; a--; ) n[a] = arguments[a];
|
|
66
65
|
return t.current.apply(t, n);
|
|
67
66
|
});
|
|
68
67
|
return r.current;
|
|
69
68
|
}
|
|
70
|
-
function
|
|
69
|
+
function ce(e, t) {
|
|
71
70
|
t === void 0 && (t = !0);
|
|
72
71
|
var r = e[0] === "-", n = r && t;
|
|
73
72
|
e = e.replace("-", "");
|
|
@@ -87,35 +86,35 @@ function ke(e) {
|
|
|
87
86
|
var r = e.split("."), n = r[0].replace(/^0+/, "") || "0", a = r[1] || "";
|
|
88
87
|
return (t ? "-" : "") + n + (a ? "." + a : "");
|
|
89
88
|
}
|
|
90
|
-
function
|
|
89
|
+
function be(e, t, r) {
|
|
91
90
|
for (var n = "", a = r ? "0" : "", i = 0; i <= t - 1; i++)
|
|
92
91
|
n += e[i] || a;
|
|
93
92
|
return n;
|
|
94
93
|
}
|
|
95
|
-
function
|
|
94
|
+
function ge(e, t) {
|
|
96
95
|
return Array(t + 1).join(e);
|
|
97
96
|
}
|
|
98
|
-
function
|
|
97
|
+
function Ve(e) {
|
|
99
98
|
var t = e + "", r = t[0] === "-" ? "-" : "";
|
|
100
99
|
r && (t = t.substring(1));
|
|
101
100
|
var n = t.split(/[eE]/g), a = n[0], i = n[1];
|
|
102
101
|
if (i = Number(i), !i)
|
|
103
102
|
return r + a;
|
|
104
103
|
a = a.replace(".", "");
|
|
105
|
-
var f = 1 + i,
|
|
106
|
-
return f < 0 ? a = "0." +
|
|
104
|
+
var f = 1 + i, S = a.length;
|
|
105
|
+
return f < 0 ? a = "0." + ge("0", Math.abs(f)) + a : f >= S ? a = a + ge("0", f - S) : a = (a.substring(0, f) || "0") + "." + a.substring(f), r + a;
|
|
107
106
|
}
|
|
108
|
-
function
|
|
107
|
+
function me(e, t, r) {
|
|
109
108
|
if (["", "-"].indexOf(e) !== -1)
|
|
110
109
|
return e;
|
|
111
|
-
var n = (e.indexOf(".") !== -1 || r) && t, a =
|
|
110
|
+
var n = (e.indexOf(".") !== -1 || r) && t, a = ce(e), i = a.beforeDecimal, f = a.afterDecimal, S = a.hasNegation, m = parseFloat("0." + (f || "0")), p = f.length <= t ? "0." + f : m.toFixed(t), h = p.split("."), c = i;
|
|
112
111
|
i && Number(h[0]) && (c = i.split("").reverse().reduce(function(I, C, g) {
|
|
113
112
|
return I.length > g ? (Number(I[0]) + Number(C)).toString() + I.substring(1, I.length) : C + I;
|
|
114
113
|
}, h[0]));
|
|
115
|
-
var x =
|
|
116
|
-
return "" + y + c +
|
|
114
|
+
var x = be(h[1] || "", t, r), y = S ? "-" : "", l = n ? "." : "";
|
|
115
|
+
return "" + y + c + l + x;
|
|
117
116
|
}
|
|
118
|
-
function
|
|
117
|
+
function J(e, t) {
|
|
119
118
|
if (e.value = e.value, e !== null) {
|
|
120
119
|
if (e.createTextRange) {
|
|
121
120
|
var r = e.createTextRange();
|
|
@@ -124,7 +123,7 @@ function H(e, t) {
|
|
|
124
123
|
return e.selectionStart || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
|
-
var
|
|
126
|
+
var Ne = _e(function(e, t) {
|
|
128
127
|
for (var r = 0, n = 0, a = e.length, i = t.length; e[r] === t[r] && r < a; )
|
|
129
128
|
r++;
|
|
130
129
|
for (; e[a - 1 - n] === t[i - 1 - n] && i - n > r && a - n > r; )
|
|
@@ -143,7 +142,7 @@ var Ve = Fe(function(e, t) {
|
|
|
143
142
|
function Ke(e, t, r) {
|
|
144
143
|
return Math.min(Math.max(e, t), r);
|
|
145
144
|
}
|
|
146
|
-
function
|
|
145
|
+
function se(e) {
|
|
147
146
|
return Math.max(e.selectionStart, e.selectionEnd);
|
|
148
147
|
}
|
|
149
148
|
function We() {
|
|
@@ -168,22 +167,22 @@ function $e(e) {
|
|
|
168
167
|
}
|
|
169
168
|
function Ge(e, t, r, n, a, i, f) {
|
|
170
169
|
f === void 0 && (f = $e);
|
|
171
|
-
var
|
|
170
|
+
var S = a.findIndex(function(k) {
|
|
172
171
|
return k;
|
|
173
|
-
}),
|
|
174
|
-
!t && !r.startsWith(
|
|
172
|
+
}), m = e.slice(0, S);
|
|
173
|
+
!t && !r.startsWith(m) && (t = m, r = m + r, n = n + m.length);
|
|
175
174
|
for (var p = r.length, h = e.length, c = {}, x = new Array(p), y = 0; y < p; y++) {
|
|
176
175
|
x[y] = -1;
|
|
177
|
-
for (var
|
|
176
|
+
for (var l = 0, I = h; l < I; l++) {
|
|
178
177
|
var C = f({
|
|
179
178
|
currentValue: r,
|
|
180
179
|
lastValue: t,
|
|
181
180
|
formattedValue: e,
|
|
182
181
|
currentValueIndex: y,
|
|
183
|
-
formattedValueIndex:
|
|
182
|
+
formattedValueIndex: l
|
|
184
183
|
});
|
|
185
|
-
if (C && c[
|
|
186
|
-
x[y] =
|
|
184
|
+
if (C && c[l] !== !0) {
|
|
185
|
+
x[y] = l, c[l] = !0;
|
|
187
186
|
break;
|
|
188
187
|
}
|
|
189
188
|
}
|
|
@@ -196,7 +195,7 @@ function Ge(e, t, r, n, a, i, f) {
|
|
|
196
195
|
var F = g === -1 || x[g] === -1 ? 0 : x[g] + 1;
|
|
197
196
|
return F > B ? B : n - F < B - n ? F : B;
|
|
198
197
|
}
|
|
199
|
-
function
|
|
198
|
+
function he(e, t, r, n) {
|
|
200
199
|
var a = e.length;
|
|
201
200
|
if (t = Ke(t, 0, a), n === "left") {
|
|
202
201
|
for (; t >= 0 && !r[t]; )
|
|
@@ -216,24 +215,33 @@ function Ze(e) {
|
|
|
216
215
|
t[r] = !!(ae(e[r]) || ae(e[r - 1]));
|
|
217
216
|
return t;
|
|
218
217
|
}
|
|
219
|
-
function
|
|
218
|
+
function we(e, t, r, n, a, i) {
|
|
220
219
|
i === void 0 && (i = q);
|
|
221
|
-
var f =
|
|
220
|
+
var f = de(function(l, I) {
|
|
222
221
|
var C, g;
|
|
223
|
-
return
|
|
224
|
-
}),
|
|
225
|
-
return f(
|
|
226
|
-
}),
|
|
227
|
-
|
|
228
|
-
formattedValue:
|
|
229
|
-
numAsString:
|
|
230
|
-
}), i(
|
|
231
|
-
}, c = e, x = r;
|
|
232
|
-
|
|
222
|
+
return xe(l) ? (g = "", C = "") : typeof l == "number" || I ? (g = typeof l == "number" ? Ve(l) : l, C = n(g)) : (g = a(l, void 0), C = n(g)), { formattedValue: C, numAsString: g };
|
|
223
|
+
}), S = O.useState(function() {
|
|
224
|
+
return f(z(e) ? t : e, r);
|
|
225
|
+
}), m = S[0], p = S[1], h = de(function(l, I) {
|
|
226
|
+
l.formattedValue !== m.formattedValue && p({
|
|
227
|
+
formattedValue: l.formattedValue,
|
|
228
|
+
numAsString: l.value
|
|
229
|
+
}), i(l, I);
|
|
230
|
+
}), c = e, x = r;
|
|
231
|
+
z(e) && (c = m.numAsString, x = !0);
|
|
233
232
|
var y = f(c, x);
|
|
234
|
-
return
|
|
233
|
+
return O.useMemo(function() {
|
|
235
234
|
p(y);
|
|
236
|
-
}, [y.formattedValue]),
|
|
235
|
+
}, [y.formattedValue]), O.useEffect(function() {
|
|
236
|
+
if (!z(t) && z(e) && m.formattedValue !== "") {
|
|
237
|
+
var l = parseFloat(m.numAsString);
|
|
238
|
+
h({
|
|
239
|
+
formattedValue: m.formattedValue,
|
|
240
|
+
value: m.numAsString,
|
|
241
|
+
floatValue: isNaN(l) ? void 0 : l
|
|
242
|
+
}, { event: void 0, source: ee.props });
|
|
243
|
+
}
|
|
244
|
+
}, []), [m, h];
|
|
237
245
|
}
|
|
238
246
|
function qe(e) {
|
|
239
247
|
return e.replace(/[^0-9]/g, "");
|
|
@@ -248,14 +256,14 @@ function He(e) {
|
|
|
248
256
|
r === void 0 && (r = "input");
|
|
249
257
|
var n = e.customInput, a = e.renderText, i = e.getInputRef, f = e.format;
|
|
250
258
|
f === void 0 && (f = ze);
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
var
|
|
259
|
+
var S = e.removeFormatting;
|
|
260
|
+
S === void 0 && (S = qe);
|
|
261
|
+
var m = e.defaultValue, p = e.valueIsNumericString, h = e.onValueChange, c = e.isAllowed, x = e.onChange;
|
|
254
262
|
x === void 0 && (x = q);
|
|
255
263
|
var y = e.onKeyDown;
|
|
256
264
|
y === void 0 && (y = q);
|
|
257
|
-
var
|
|
258
|
-
|
|
265
|
+
var l = e.onMouseUp;
|
|
266
|
+
l === void 0 && (l = q);
|
|
259
267
|
var I = e.onFocus;
|
|
260
268
|
I === void 0 && (I = q);
|
|
261
269
|
var C = e.onBlur;
|
|
@@ -264,13 +272,13 @@ function He(e) {
|
|
|
264
272
|
B === void 0 && (B = Ze);
|
|
265
273
|
var F = e.isValidInputCharacter;
|
|
266
274
|
F === void 0 && (F = ae);
|
|
267
|
-
var k = e.isCharacterSame, j =
|
|
275
|
+
var k = e.isCharacterSame, j = pe(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), H = we(g, m, !!p, f, S, h), P = H[0], V = P.formattedValue, M = P.numAsString, W = H[1], L = O.useRef(), U = O.useRef({ formattedValue: V, numAsString: M }), $ = function(o, u) {
|
|
268
276
|
U.current = { formattedValue: o.formattedValue, numAsString: o.value }, W(o, u);
|
|
269
|
-
},
|
|
277
|
+
}, Q = O.useState(!1), te = Q[0], d = Q[1], s = O.useRef(null), N = O.useRef({
|
|
270
278
|
setCaretTimeout: null,
|
|
271
279
|
focusTimeout: null
|
|
272
280
|
});
|
|
273
|
-
|
|
281
|
+
O.useEffect(function() {
|
|
274
282
|
return d(!0), function() {
|
|
275
283
|
clearTimeout(N.current.setCaretTimeout), clearTimeout(N.current.focusTimeout);
|
|
276
284
|
};
|
|
@@ -283,43 +291,43 @@ function He(e) {
|
|
|
283
291
|
floatValue: isNaN(v) ? void 0 : v
|
|
284
292
|
};
|
|
285
293
|
}, E = function(o, u, v) {
|
|
286
|
-
o.selectionStart === 0 && o.selectionEnd === o.value.length || (
|
|
287
|
-
o.value === v && o.selectionStart !== u &&
|
|
294
|
+
o.selectionStart === 0 && o.selectionEnd === o.value.length || (J(o, u), N.current.setCaretTimeout = setTimeout(function() {
|
|
295
|
+
o.value === v && o.selectionStart !== u && J(o, u);
|
|
288
296
|
}, 0));
|
|
289
|
-
},
|
|
290
|
-
return
|
|
291
|
-
},
|
|
297
|
+
}, T = function(o, u, v) {
|
|
298
|
+
return he(o, u, B(o), v);
|
|
299
|
+
}, X = function(o, u, v) {
|
|
292
300
|
var w = B(u), _ = Ge(u, V, o, v, w, F, k);
|
|
293
|
-
return _ =
|
|
301
|
+
return _ = he(u, _, w), _;
|
|
294
302
|
}, oe = function(o) {
|
|
295
303
|
var u = o.formattedValue;
|
|
296
304
|
u === void 0 && (u = "");
|
|
297
305
|
var v = o.input, w = o.source, _ = o.event, D = o.numAsString, b;
|
|
298
306
|
if (v) {
|
|
299
|
-
var K = o.inputValue || v.value, G =
|
|
300
|
-
v.value = u, b =
|
|
307
|
+
var K = o.inputValue || v.value, G = se(v);
|
|
308
|
+
v.value = u, b = X(K, u, G), b !== void 0 && E(v, b, u);
|
|
301
309
|
}
|
|
302
310
|
u !== V && $(A(u, D), { event: _, source: w });
|
|
303
311
|
};
|
|
304
|
-
|
|
312
|
+
O.useEffect(function() {
|
|
305
313
|
var o = U.current, u = o.formattedValue, v = o.numAsString;
|
|
306
|
-
(V !== u ||
|
|
314
|
+
(V !== u || M !== v) && $(A(V, M), {
|
|
307
315
|
event: void 0,
|
|
308
|
-
source:
|
|
316
|
+
source: ee.props
|
|
309
317
|
});
|
|
310
|
-
}, [V,
|
|
311
|
-
var
|
|
318
|
+
}, [V, M]);
|
|
319
|
+
var re = s.current ? se(s.current) : void 0, ne = typeof window < "u" ? O.useLayoutEffect : O.useEffect;
|
|
312
320
|
ne(function() {
|
|
313
|
-
var o =
|
|
321
|
+
var o = s.current;
|
|
314
322
|
if (V !== U.current.formattedValue && o) {
|
|
315
|
-
var u =
|
|
323
|
+
var u = X(U.current.formattedValue, V, re);
|
|
316
324
|
o.value = V, E(o, u, V);
|
|
317
325
|
}
|
|
318
326
|
}, [V]);
|
|
319
327
|
var ue = function(o, u, v) {
|
|
320
|
-
var w = u.target, _ =
|
|
321
|
-
if (b =
|
|
322
|
-
var G = u.target, Z =
|
|
328
|
+
var w = u.target, _ = L.current ? Pe(L.current, w.selectionEnd) : Ne(V, o), D = Object.assign(Object.assign({}, _), { lastValue: V }), b = S(o, D), K = R(b);
|
|
329
|
+
if (b = S(K, void 0), c && !c(A(K, b))) {
|
|
330
|
+
var G = u.target, Z = se(G), le = X(o, V, Z);
|
|
323
331
|
return G.value = V, E(G, le, V), !1;
|
|
324
332
|
}
|
|
325
333
|
return oe({
|
|
@@ -333,11 +341,11 @@ function He(e) {
|
|
|
333
341
|
}, fe = function(o, u) {
|
|
334
342
|
u === void 0 && (u = 0);
|
|
335
343
|
var v = o.selectionStart, w = o.selectionEnd;
|
|
336
|
-
|
|
337
|
-
}, De = function(o) {
|
|
338
|
-
var u = o.target, v = u.value, w = ue(v, o, re.event);
|
|
339
|
-
w && x(o), M.current = void 0;
|
|
344
|
+
L.current = { selectionStart: v, selectionEnd: w + u };
|
|
340
345
|
}, Ie = function(o) {
|
|
346
|
+
var u = o.target, v = u.value, w = ue(v, o, ee.event);
|
|
347
|
+
w && x(o), L.current = void 0;
|
|
348
|
+
}, Ce = function(o) {
|
|
341
349
|
var u = o.target, v = o.key, w = u.selectionStart, _ = u.selectionEnd, D = u.value;
|
|
342
350
|
D === void 0 && (D = "");
|
|
343
351
|
var b;
|
|
@@ -352,58 +360,58 @@ function He(e) {
|
|
|
352
360
|
var Z = b;
|
|
353
361
|
if (G) {
|
|
354
362
|
var le = v === "ArrowLeft" ? "left" : "right";
|
|
355
|
-
Z =
|
|
356
|
-
} else v === "Delete" && !F(D[b]) ? Z =
|
|
363
|
+
Z = T(D, b, le), Z !== b && o.preventDefault();
|
|
364
|
+
} else v === "Delete" && !F(D[b]) ? Z = T(D, b, "right") : v === "Backspace" && !F(D[b]) && (Z = T(D, b, "left"));
|
|
357
365
|
Z !== b && E(u, Z, D), y(o), fe(u, K);
|
|
358
|
-
},
|
|
366
|
+
}, Ee = function(o) {
|
|
359
367
|
var u = o.target, v = function() {
|
|
360
368
|
var w = u.selectionStart, _ = u.selectionEnd, D = u.value;
|
|
361
369
|
if (D === void 0 && (D = ""), w === _) {
|
|
362
|
-
var b =
|
|
370
|
+
var b = T(D, w);
|
|
363
371
|
b !== w && E(u, b, D);
|
|
364
372
|
}
|
|
365
373
|
};
|
|
366
374
|
v(), requestAnimationFrame(function() {
|
|
367
375
|
v();
|
|
368
|
-
}),
|
|
369
|
-
},
|
|
376
|
+
}), l(o), fe(u);
|
|
377
|
+
}, Re = function(o) {
|
|
370
378
|
o.persist && o.persist();
|
|
371
379
|
var u = o.target, v = o.currentTarget;
|
|
372
|
-
|
|
380
|
+
s.current = u, N.current.focusTimeout = setTimeout(function() {
|
|
373
381
|
var w = u.selectionStart, _ = u.selectionEnd, D = u.value;
|
|
374
382
|
D === void 0 && (D = "");
|
|
375
|
-
var b =
|
|
383
|
+
var b = T(D, w);
|
|
376
384
|
b !== w && !(w === 0 && _ === D.length) && E(u, b, D), I(Object.assign(Object.assign({}, o), { currentTarget: v }));
|
|
377
385
|
}, 0);
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
},
|
|
386
|
+
}, Ae = function(o) {
|
|
387
|
+
s.current = null, clearTimeout(N.current.focusTimeout), clearTimeout(N.current.setCaretTimeout), C(o);
|
|
388
|
+
}, Oe = te && We() ? "numeric" : void 0, ve = Object.assign({ inputMode: Oe }, j, {
|
|
381
389
|
type: t,
|
|
382
390
|
value: V,
|
|
383
|
-
onChange:
|
|
384
|
-
onKeyDown:
|
|
385
|
-
onMouseUp:
|
|
386
|
-
onFocus:
|
|
387
|
-
onBlur:
|
|
391
|
+
onChange: Ie,
|
|
392
|
+
onKeyDown: Ce,
|
|
393
|
+
onMouseUp: Ee,
|
|
394
|
+
onFocus: Re,
|
|
395
|
+
onBlur: Ae
|
|
388
396
|
});
|
|
389
397
|
if (r === "text")
|
|
390
|
-
return a ?
|
|
398
|
+
return a ? Y.createElement(Y.Fragment, null, a(V, j) || null) : Y.createElement("span", Object.assign({}, j, { ref: i }), V);
|
|
391
399
|
if (n) {
|
|
392
|
-
var
|
|
393
|
-
return
|
|
400
|
+
var Te = n;
|
|
401
|
+
return Y.createElement(Te, Object.assign({}, ve, { ref: i }));
|
|
394
402
|
}
|
|
395
|
-
return
|
|
403
|
+
return Y.createElement("input", Object.assign({}, ve, { ref: i }));
|
|
396
404
|
}
|
|
397
|
-
function
|
|
405
|
+
function Se(e, t) {
|
|
398
406
|
var r = t.decimalScale, n = t.fixedDecimalScale, a = t.prefix;
|
|
399
407
|
a === void 0 && (a = "");
|
|
400
408
|
var i = t.suffix;
|
|
401
409
|
i === void 0 && (i = "");
|
|
402
|
-
var f = t.allowNegative,
|
|
403
|
-
if (
|
|
410
|
+
var f = t.allowNegative, S = t.thousandsGroupStyle;
|
|
411
|
+
if (S === void 0 && (S = "thousand"), e === "" || e === "-")
|
|
404
412
|
return e;
|
|
405
|
-
var
|
|
406
|
-
return r !== void 0 && (
|
|
413
|
+
var m = ie(t), p = m.thousandSeparator, h = m.decimalSeparator, c = r !== 0 && e.indexOf(".") !== -1 || r && n, x = ce(e, f), y = x.beforeDecimal, l = x.afterDecimal, I = x.addNegation;
|
|
414
|
+
return r !== void 0 && (l = be(l, r, !!n)), p && (y = Le(y, p, S)), a && (y = a + y), i && (l = l + i), I && (y = "-" + y), e = y + (c && h || "") + l, e;
|
|
407
415
|
}
|
|
408
416
|
function ie(e) {
|
|
409
417
|
var t = e.decimalSeparator;
|
|
@@ -421,7 +429,7 @@ function Je(e, t) {
|
|
|
421
429
|
return e = e.replace(/-/g, ""), a && !i && t && (e = "-" + e), e;
|
|
422
430
|
}
|
|
423
431
|
function Qe(e, t) {
|
|
424
|
-
return new RegExp("(^-)|[0-9]|" +
|
|
432
|
+
return new RegExp("(^-)|[0-9]|" + ye(e), "g");
|
|
425
433
|
}
|
|
426
434
|
function Xe(e, t, r) {
|
|
427
435
|
return e === "" ? !0 : !t?.match(/\d/) && !r?.match(/\d/) && typeof e == "string" && !isNaN(Number(e));
|
|
@@ -433,32 +441,32 @@ function Ye(e, t, r) {
|
|
|
433
441
|
i === void 0 && (i = "");
|
|
434
442
|
var f = r.suffix;
|
|
435
443
|
f === void 0 && (f = "");
|
|
436
|
-
var
|
|
444
|
+
var S = r.decimalScale, m = t.from, p = t.to, h = p.start, c = p.end, x = ie(r), y = x.allowedDecimalSeparators, l = x.decimalSeparator, I = e[c] === l;
|
|
437
445
|
if (ae(e) && (e === i || e === f) && t.lastValue === "")
|
|
438
446
|
return e;
|
|
439
447
|
if (c - h === 1 && y.indexOf(e[h]) !== -1) {
|
|
440
|
-
var C =
|
|
448
|
+
var C = S === 0 ? "" : l;
|
|
441
449
|
e = e.substring(0, h) + C + e.substring(h + 1, e.length);
|
|
442
450
|
}
|
|
443
|
-
var g = function(
|
|
451
|
+
var g = function(s, N, R) {
|
|
444
452
|
var A = !1, E = !1;
|
|
445
|
-
i.startsWith("-") ? A = !1 :
|
|
446
|
-
var
|
|
447
|
-
return E && (
|
|
453
|
+
i.startsWith("-") ? A = !1 : s.startsWith("--") ? (A = !1, E = !0) : f.startsWith("-") && s.length === f.length ? A = !1 : s[0] === "-" && (A = !0);
|
|
454
|
+
var T = A ? 1 : 0;
|
|
455
|
+
return E && (T = 2), T && (s = s.substring(T), N -= T, R -= T), { value: s, start: N, end: R, hasNegation: A };
|
|
448
456
|
}, B = g(e, h, c), F = B.hasNegation;
|
|
449
457
|
n = B, e = n.value, h = n.start, c = n.end;
|
|
450
|
-
var k = g(t.lastValue,
|
|
451
|
-
e.length && P.length && (j > P.length - f.length ||
|
|
452
|
-
var
|
|
453
|
-
e.startsWith(i) ?
|
|
454
|
-
var W = e.length,
|
|
455
|
-
e.endsWith(f) ? W =
|
|
456
|
-
var U = e.indexOf(
|
|
457
|
-
e = e.replace(new RegExp(
|
|
458
|
+
var k = g(t.lastValue, m.start, m.end), j = k.start, H = k.end, P = k.value, V = e.substring(h, c);
|
|
459
|
+
e.length && P.length && (j > P.length - f.length || H < i.length) && !(V && f.startsWith(V)) && (e = P);
|
|
460
|
+
var M = 0;
|
|
461
|
+
e.startsWith(i) ? M += i.length : h < i.length && (M = h), e = e.substring(M), c -= M;
|
|
462
|
+
var W = e.length, L = e.length - f.length;
|
|
463
|
+
e.endsWith(f) ? W = L : (c > L || c > e.length - f.length) && (W = c), e = e.substring(0, W), e = Je(F ? "-" + e : e, a), e = (e.match(Qe(l)) || []).join("");
|
|
464
|
+
var U = e.indexOf(l);
|
|
465
|
+
e = e.replace(new RegExp(ye(l), "g"), function(s, N) {
|
|
458
466
|
return N === U ? "." : "";
|
|
459
467
|
});
|
|
460
|
-
var $ =
|
|
461
|
-
return p.end - p.start <
|
|
468
|
+
var $ = ce(e, a), Q = $.beforeDecimal, te = $.afterDecimal, d = $.addNegation;
|
|
469
|
+
return p.end - p.start < m.end - m.start && Q === "" && I && !parseFloat(te) && (e = d ? "-" : ""), e;
|
|
462
470
|
}
|
|
463
471
|
function et(e, t) {
|
|
464
472
|
var r = t.prefix;
|
|
@@ -468,7 +476,7 @@ function et(e, t) {
|
|
|
468
476
|
var a = Array.from({ length: e.length + 1 }).map(function() {
|
|
469
477
|
return !0;
|
|
470
478
|
}), i = e[0] === "-";
|
|
471
|
-
a.fill(!1, 0, r.length + (i ? 1 : 0));
|
|
479
|
+
a.fill(!1, 0, Math.min(r.length + (i ? 1 : 0), e.length));
|
|
472
480
|
var f = e.length;
|
|
473
481
|
return a.fill(!1, f - n.length + 1, f + 1), a;
|
|
474
482
|
}
|
|
@@ -494,19 +502,19 @@ function rt(e) {
|
|
|
494
502
|
a === void 0 && (a = q);
|
|
495
503
|
var i = e.onBlur;
|
|
496
504
|
i === void 0 && (i = q);
|
|
497
|
-
var f = e.thousandSeparator,
|
|
505
|
+
var f = e.thousandSeparator, S = e.decimalScale, m = e.fixedDecimalScale, p = e.prefix;
|
|
498
506
|
p === void 0 && (p = "");
|
|
499
|
-
var h = e.defaultValue, c = e.value, x = e.valueIsNumericString, y = e.onValueChange,
|
|
500
|
-
return
|
|
501
|
-
}, F = function(d,
|
|
502
|
-
return Ye(d,
|
|
503
|
-
}, k =
|
|
504
|
-
|
|
505
|
-
var
|
|
506
|
-
return
|
|
507
|
-
}, P =
|
|
508
|
-
var
|
|
509
|
-
if (E === void 0 && (E = ""), (N === "Backspace" || N === "Delete") && A < p.length) {
|
|
507
|
+
var h = e.defaultValue, c = e.value, x = e.valueIsNumericString, y = e.onValueChange, l = pe(e, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), I = ie(e), C = I.decimalSeparator, g = I.allowedDecimalSeparators, B = function(d) {
|
|
508
|
+
return Se(d, e);
|
|
509
|
+
}, F = function(d, s) {
|
|
510
|
+
return Ye(d, s, e);
|
|
511
|
+
}, k = z(c) ? h : c, j = x ?? Xe(k, p, t);
|
|
512
|
+
z(c) ? z(h) || (j = j || typeof h == "number") : j = j || typeof c == "number";
|
|
513
|
+
var H = function(d) {
|
|
514
|
+
return xe(d) ? d : (typeof d == "number" && (d = Ve(d)), j && typeof S == "number" ? me(d, S, !!m) : d);
|
|
515
|
+
}, P = we(H(c), H(h), !!j, B, F, y), V = P[0], M = V.numAsString, W = V.formattedValue, L = P[1], U = function(d) {
|
|
516
|
+
var s = d.target, N = d.key, R = s.selectionStart, A = s.selectionEnd, E = s.value;
|
|
517
|
+
if (E === void 0 && (E = ""), (N === "Backspace" || N === "Delete") && A < p.length && E !== "-") {
|
|
510
518
|
d.preventDefault();
|
|
511
519
|
return;
|
|
512
520
|
}
|
|
@@ -514,37 +522,37 @@ function rt(e) {
|
|
|
514
522
|
a(d);
|
|
515
523
|
return;
|
|
516
524
|
}
|
|
517
|
-
N === "Backspace" && E[0] === "-" && R === p.length + 1 && r &&
|
|
518
|
-
var
|
|
519
|
-
N === "Backspace" && E[R - 1] ===
|
|
525
|
+
N === "Backspace" && E[0] === "-" && R === p.length + 1 && r && J(s, 1), S && m && (N === "Backspace" && E[R - 1] === C ? (J(s, R - 1), d.preventDefault()) : N === "Delete" && E[R] === C && d.preventDefault()), g?.includes(N) && E[R] === C && J(s, R + 1);
|
|
526
|
+
var T = f === !0 ? "," : f;
|
|
527
|
+
N === "Backspace" && E[R - 1] === T && J(s, R - 1), N === "Delete" && E[R] === T && J(s, R + 1), a(d);
|
|
520
528
|
}, $ = function(d) {
|
|
521
|
-
var
|
|
522
|
-
if (
|
|
523
|
-
var N =
|
|
524
|
-
|
|
529
|
+
var s = M;
|
|
530
|
+
if (s.match(/\d/g) || (s = ""), n || (s = ke(s)), m && S && (s = me(s, S, m)), s !== M) {
|
|
531
|
+
var N = Se(s, e);
|
|
532
|
+
L({
|
|
525
533
|
formattedValue: N,
|
|
526
|
-
value:
|
|
527
|
-
floatValue: parseFloat(
|
|
534
|
+
value: s,
|
|
535
|
+
floatValue: parseFloat(s)
|
|
528
536
|
}, {
|
|
529
537
|
event: d,
|
|
530
|
-
source:
|
|
538
|
+
source: ee.event
|
|
531
539
|
});
|
|
532
540
|
}
|
|
533
541
|
i(d);
|
|
534
|
-
},
|
|
542
|
+
}, Q = function(d) {
|
|
535
543
|
return d === C ? !0 : ae(d);
|
|
536
|
-
},
|
|
537
|
-
var
|
|
544
|
+
}, te = function(d) {
|
|
545
|
+
var s = d.currentValue, N = d.lastValue, R = d.formattedValue, A = d.currentValueIndex, E = d.formattedValueIndex, T = s[A], X = R[E], oe = Ne(N, s), re = oe.to, ne = function(ue) {
|
|
538
546
|
return F(ue).indexOf(".") + p.length;
|
|
539
547
|
};
|
|
540
|
-
return c === 0 &&
|
|
548
|
+
return c === 0 && m && S && s[re.start] === C && ne(s) < A && ne(R) > E ? !1 : A >= re.start && A < re.end && g && g.includes(T) && X === C ? !0 : T === X;
|
|
541
549
|
};
|
|
542
|
-
return Object.assign(Object.assign({},
|
|
550
|
+
return Object.assign(Object.assign({}, l), {
|
|
543
551
|
value: W,
|
|
544
552
|
valueIsNumericString: !1,
|
|
545
|
-
isValidInputCharacter:
|
|
546
|
-
isCharacterSame:
|
|
547
|
-
onValueChange:
|
|
553
|
+
isValidInputCharacter: Q,
|
|
554
|
+
isCharacterSame: te,
|
|
555
|
+
onValueChange: L,
|
|
548
556
|
format: B,
|
|
549
557
|
removeFormatting: F,
|
|
550
558
|
getCaretBoundary: function(d) {
|
|
@@ -556,34 +564,34 @@ function rt(e) {
|
|
|
556
564
|
}
|
|
557
565
|
function at(e) {
|
|
558
566
|
var t = rt(e);
|
|
559
|
-
return
|
|
567
|
+
return Y.createElement(He, Object.assign({}, t));
|
|
560
568
|
}
|
|
561
|
-
function
|
|
569
|
+
function De() {
|
|
562
570
|
return Intl.NumberFormat()?.formatToParts(1.1)?.find((r) => r.type === "decimal")?.value ?? ".";
|
|
563
571
|
}
|
|
564
572
|
function nt() {
|
|
565
|
-
return
|
|
573
|
+
return De() === "." ? "," : ".";
|
|
566
574
|
}
|
|
567
575
|
const ot = (e) => {
|
|
568
|
-
const { value: t, onChange: r, disabled: n, highlight: a, validatedSelection: i, fixedDecimals: f, allowNegative:
|
|
569
|
-
return
|
|
576
|
+
const { value: t, onChange: r, disabled: n, highlight: a, validatedSelection: i, fixedDecimals: f, allowNegative: S, thousandSeparator: m, decimalSeparator: p } = e, h = O.useRef();
|
|
577
|
+
return O.useLayoutEffect(() => {
|
|
570
578
|
if (i !== void 0) {
|
|
571
579
|
const c = typeof i == "number" ? [i, null] : i;
|
|
572
580
|
h.current?.setSelectionRange(c[0], c[1]);
|
|
573
581
|
}
|
|
574
|
-
}, [i]),
|
|
575
|
-
|
|
582
|
+
}, [i]), O.createElement(
|
|
583
|
+
Fe,
|
|
576
584
|
null,
|
|
577
|
-
|
|
585
|
+
O.createElement(at, {
|
|
578
586
|
autoFocus: !0,
|
|
579
587
|
getInputRef: h,
|
|
580
588
|
className: "gdg-input",
|
|
581
589
|
onFocus: (c) => c.target.setSelectionRange(a ? 0 : c.target.value.length, c.target.value.length),
|
|
582
590
|
disabled: n === !0,
|
|
583
591
|
decimalScale: f,
|
|
584
|
-
allowNegative:
|
|
585
|
-
thousandSeparator:
|
|
586
|
-
decimalSeparator: p ??
|
|
592
|
+
allowNegative: S,
|
|
593
|
+
thousandSeparator: m ?? nt(),
|
|
594
|
+
decimalSeparator: p ?? De(),
|
|
587
595
|
value: Object.is(t, -0) ? "-" : t ?? "",
|
|
588
596
|
// decimalScale={3}
|
|
589
597
|
// prefix={"$"}
|