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