bitboss-ui 3.0.0-beta.49 → 3.0.0-beta.50
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/ai/BbForm.md +3 -2
- package/dist/ai/BbNumberInput.md +12 -11
- package/dist/ai/changelog.json +6 -5
- package/dist/ai/components.json +3 -3
- package/dist/ai/guides/installation-and-plugin-setup.md +2 -1
- package/dist/ai/guides/migration/v2-to-v3.md +1 -1
- package/dist/ai/helpers/inertia/manifest.json +1 -1
- package/dist/ai/manifest/components/BbForm.json +1 -1
- package/dist/ai/manifest/index.json +2 -2
- package/dist/ai/source/BbButton.md +3 -3
- package/dist/ai/source/BbForm.md +8 -5
- package/dist/ai/source/BbNumberInput.md +26 -2
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbForm/BbForm.vue.d.ts +4 -4
- package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +197 -178
- package/dist/composables/formSubmitLock.d.ts +2 -0
- package/dist/llms-full.txt +18 -15
- package/dist/llms-medium.txt +2 -1
- package/dist/styles.css +1 -1
- package/dist/utils/versionCheck.js +1 -1
- package/package.json +1 -1
- package/scripts/lib/hand-imported-styles.mjs +31 -0
- package/scripts/lib/locale-check.mjs +19 -2
|
@@ -11,11 +11,11 @@ import { useFormBinding as te } from "../../composables/useFormBinding.js";
|
|
|
11
11
|
import ne from "../CommonFieldInput/CommonFieldInput.vue.js";
|
|
12
12
|
import { clampPrecision as re } from "../../utilities/functions/clampPrecision.js";
|
|
13
13
|
import { vSsrValue as ie } from "../../utilities/misc/ssrValue.js";
|
|
14
|
-
import { PLAIN_SYMBOLS as ae, affixOf as oe, applyEdit as se, currencyDigitsOf as ce, displayIndexOf as le, formatAffixed as ue, isShellOnly as de, numberSymbolsOf as fe, rawAtRest as u, rawIndexOf as d, rawOfNumber as pe, readText as me, snapOffset as he, spokenAffixed as ge, stripAffix as _e, valueOfRaw as
|
|
15
|
-
import { BB_NUMBER_INPUT_PT as
|
|
16
|
-
import { computed as
|
|
14
|
+
import { PLAIN_SYMBOLS as ae, affixOf as oe, applyEdit as se, currencyDigitsOf as ce, displayIndexOf as le, formatAffixed as ue, isShellOnly as de, numberSymbolsOf as fe, rawAtRest as u, rawIndexOf as d, rawOfNumber as pe, readText as me, snapOffset as he, spokenAffixed as ge, stripAffix as _e, valueOfRaw as ve, withPaddedMark as ye, writeStrategy as be } from "./numberDisplay.js";
|
|
15
|
+
import { BB_NUMBER_INPUT_PT as xe } from "./types.js";
|
|
16
|
+
import { computed as f, createBlock as Se, createCommentVNode as Ce, createElementBlock as we, createElementVNode as Te, createSlots as Ee, createVNode as De, defineComponent as Oe, guardReactiveProps as ke, mergeProps as p, normalizeProps as Ae, onBeforeUnmount as je, onMounted as Me, openBlock as Ne, ref as m, renderSlot as h, unref as g, useAttrs as Pe, watch as Fe, withCtx as _, withDirectives as Ie, withModifiers as Le } from "vue";
|
|
17
17
|
//#region src/components/BbNumberInput/BbNumberInput.vue?vue&type=script&setup=true&lang.ts
|
|
18
|
-
var
|
|
18
|
+
var Re = [
|
|
19
19
|
"id",
|
|
20
20
|
"aria-describedby",
|
|
21
21
|
"aria-disabled",
|
|
@@ -34,12 +34,12 @@ var Le = [
|
|
|
34
34
|
"readonly",
|
|
35
35
|
"required",
|
|
36
36
|
"aria-required"
|
|
37
|
-
],
|
|
37
|
+
], ze = [
|
|
38
38
|
"disabled",
|
|
39
39
|
"form",
|
|
40
40
|
"name",
|
|
41
41
|
"value"
|
|
42
|
-
],
|
|
42
|
+
], Be = /*@__PURE__*/ Oe({
|
|
43
43
|
inheritAttrs: !1,
|
|
44
44
|
__name: "BbNumberInput",
|
|
45
45
|
props: {
|
|
@@ -188,26 +188,26 @@ var Le = [
|
|
|
188
188
|
"paste",
|
|
189
189
|
"update:modelValue"
|
|
190
190
|
],
|
|
191
|
-
setup(
|
|
192
|
-
let
|
|
191
|
+
setup(Oe, { emit: Be }) {
|
|
192
|
+
let Ve = Oe, { props: v, emit: y, showAsterisk: He, errors: Ue, required: We, ariaRequired: Ge, model: Ke, readonly: b } = te(Ve, Be, {
|
|
193
193
|
componentName: "BbNumberInput",
|
|
194
|
-
identifierFallback: () =>
|
|
194
|
+
identifierFallback: () => Ve.label,
|
|
195
195
|
emptyValue: () => null,
|
|
196
196
|
leaveOn: "blur"
|
|
197
197
|
});
|
|
198
198
|
process.env.NODE_ENV !== "production" && o("BbNumberInput", a("BbNumberInput"));
|
|
199
|
-
let
|
|
199
|
+
let x = i(), S = m(!1), C = f(() => !!b.value || !!v.disabled), qe = f(() => v.persistentHint || S.value), w = f(() => c(v.modelValue)), Je = f(() => !!v.clearable && w.value), Ye = f(() => v.labelMode ?? x.defaultInputLabelMode), T = r({
|
|
200
200
|
component: "BbNumberInput",
|
|
201
|
-
attrs:
|
|
201
|
+
attrs: Pe(),
|
|
202
202
|
controlAttrs: t,
|
|
203
|
-
props:
|
|
204
|
-
parts:
|
|
205
|
-
states:
|
|
206
|
-
active: n(
|
|
207
|
-
}), E =
|
|
203
|
+
props: v,
|
|
204
|
+
parts: xe.parts,
|
|
205
|
+
states: xe.states,
|
|
206
|
+
active: n(v, () => w.value)
|
|
207
|
+
}), E = m(null), D = f(() => v.disableFormatting ? null : oe(s(x.locale), v.currency, v.unit)), O = f(() => D.value?.kind === "currency" ? ce(D.value.code, D.value.tag) : null), k = f(() => v.maxPrecision ?? (O.value ? Math.max(O.value.max, v.minPrecision ?? 0) : 8)), A = f(() => v.minPrecision ?? O.value?.min ?? 0), j = f(() => !!v.disableFormatting && !(A.value > 0)), M = f(() => v.disableFormatting ? ae : fe(s(x.locale), D.value?.kind === "currency" ? D.value.code : void 0)), N = f(() => Math.max(0, Math.min(A.value, k.value))), Xe = () => ({
|
|
208
208
|
maxPrecision: k.value,
|
|
209
209
|
minPrecision: A.value,
|
|
210
|
-
max:
|
|
210
|
+
max: v.max,
|
|
211
211
|
localeKey: M.value.decimal === "," ? "," : "."
|
|
212
212
|
}), P = (e) => ue(e, M.value, { minPrecision: N.value }, D.value), F = (e) => me(_e(e, D.value), M.value), I = {
|
|
213
213
|
raw: "",
|
|
@@ -220,13 +220,13 @@ var Le = [
|
|
|
220
220
|
if (e == null || e === "") return null;
|
|
221
221
|
let t = Number(e);
|
|
222
222
|
return Number.isFinite(t) ? t : null;
|
|
223
|
-
}, U =
|
|
224
|
-
if (
|
|
225
|
-
let t = H(
|
|
226
|
-
return D.value && t !== null ? ge(u(t, k.value), N.value, D.value) :
|
|
223
|
+
}, U = m(H(v.modelValue)), Ze = f(() => u(U.value, k.value)), Qe = (e) => P(u(e, k.value)).text, $e = m(!1), et = f(() => {
|
|
224
|
+
if (!$e.value || v.disableFormatting || S.value || e(v.modelValue)) return;
|
|
225
|
+
let t = H(v.modelValue);
|
|
226
|
+
return D.value && t !== null ? ge(u(t, k.value), N.value, D.value) : Qe(t);
|
|
227
227
|
}), W = (e) => {
|
|
228
228
|
I = {
|
|
229
|
-
raw:
|
|
229
|
+
raw: ye(e, N.value),
|
|
230
230
|
decChar: "",
|
|
231
231
|
groupChar: ""
|
|
232
232
|
};
|
|
@@ -236,15 +236,15 @@ var Le = [
|
|
|
236
236
|
let r = L.shell;
|
|
237
237
|
L = P(I.raw);
|
|
238
238
|
let i = L.text;
|
|
239
|
-
if (n.value !== i && (t && G() &&
|
|
239
|
+
if (n.value !== i && (t && G() && tt(n, i, r !== L.shell), n.value !== i && (n.value = i)), R = i, e !== void 0 && G()) {
|
|
240
240
|
let t = le(L, e);
|
|
241
241
|
n.setSelectionRange(t, t);
|
|
242
242
|
}
|
|
243
|
-
},
|
|
243
|
+
}, tt = (e, t, n) => {
|
|
244
244
|
let r = e.value, i = 0;
|
|
245
245
|
for (; !n && i < r.length && i < t.length && r[i] === t[i];) i++;
|
|
246
246
|
let a = 0;
|
|
247
|
-
if (
|
|
247
|
+
if (be.span === "minimal" && !n) for (; a < r.length - i && a < t.length - i && r[r.length - 1 - a] === t[t.length - 1 - a];) a++;
|
|
248
248
|
let o = t.slice(i, t.length - a);
|
|
249
249
|
z = !0;
|
|
250
250
|
try {
|
|
@@ -252,18 +252,18 @@ var Le = [
|
|
|
252
252
|
} catch {} finally {
|
|
253
253
|
z = !1;
|
|
254
254
|
}
|
|
255
|
-
},
|
|
256
|
-
let e =
|
|
257
|
-
e !== void 0 && (U.value = e,
|
|
255
|
+
}, nt = () => {
|
|
256
|
+
let e = ve(I.raw);
|
|
257
|
+
e !== void 0 && (U.value = e, y("update:modelValue", e));
|
|
258
258
|
}, q = (e, t, n) => {
|
|
259
|
-
let r = se(I, e,
|
|
259
|
+
let r = se(I, e, Xe());
|
|
260
260
|
if (r.rejected) {
|
|
261
261
|
let e = E.value, t = !!e && e.value === L.text && e.selectionStart === e.selectionEnd && d(L, e.selectionStart ?? 0) === r.caret;
|
|
262
262
|
I = r, K(t ? void 0 : r.caret);
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
|
-
I = r, B = !1, K(r.caret, n), B ||
|
|
266
|
-
},
|
|
265
|
+
I = r, B = !1, K(r.caret, n), B || y("input", t), nt();
|
|
266
|
+
}, rt = (e) => [d(L, e.selectionStart ?? e.value.length), d(L, e.selectionEnd ?? e.value.length)], it = {
|
|
267
267
|
deleteContentBackward: "deleteBackward",
|
|
268
268
|
deleteContent: "deleteBackward",
|
|
269
269
|
deleteByCut: "deleteBackward",
|
|
@@ -275,7 +275,7 @@ var Le = [
|
|
|
275
275
|
deleteWordForward: "deleteToEnd",
|
|
276
276
|
deleteSoftLineForward: "deleteToEnd",
|
|
277
277
|
deleteHardLineForward: "deleteToEnd"
|
|
278
|
-
},
|
|
278
|
+
}, at = (e) => e.data ?? (e.dataTransfer ? e.dataTransfer.getData("text/plain") : null), ot = (e, t, n) => [...e].length > 1 ? {
|
|
279
279
|
type: "paste",
|
|
280
280
|
start: t,
|
|
281
281
|
end: n,
|
|
@@ -289,10 +289,15 @@ var Le = [
|
|
|
289
289
|
type: "deleteBackward",
|
|
290
290
|
start: t,
|
|
291
291
|
end: n
|
|
292
|
-
},
|
|
292
|
+
}, st = (e) => {
|
|
293
293
|
let t = E.value;
|
|
294
|
-
if (j.value || z || !t
|
|
295
|
-
|
|
294
|
+
if (j.value || z || !t) return;
|
|
295
|
+
if (C.value) {
|
|
296
|
+
e.cancelable && e.preventDefault();
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (V || e.isComposing || !e.cancelable || e.inputType === "insertText" && !e.data) return;
|
|
300
|
+
let n = e.inputType, [r, i] = rt(t), a;
|
|
296
301
|
if (n === "insertText") a = {
|
|
297
302
|
type: "insert",
|
|
298
303
|
start: r,
|
|
@@ -300,9 +305,9 @@ var Le = [
|
|
|
300
305
|
text: e.data ?? ""
|
|
301
306
|
};
|
|
302
307
|
else if (n === "insertReplacementText") {
|
|
303
|
-
let t =
|
|
308
|
+
let t = at(e);
|
|
304
309
|
if (t === null || !t && r === i) return;
|
|
305
|
-
a =
|
|
310
|
+
a = ot(t, r, i);
|
|
306
311
|
} else if (n === "insertFromPaste" || n === "insertFromDrop") {
|
|
307
312
|
let t = e.dataTransfer?.getData("text/plain") ?? e.data ?? "";
|
|
308
313
|
a = {
|
|
@@ -311,7 +316,7 @@ var Le = [
|
|
|
311
316
|
end: i,
|
|
312
317
|
raw: F(t)
|
|
313
318
|
};
|
|
314
|
-
} else if (
|
|
319
|
+
} else if (it[n]) {
|
|
315
320
|
let o = t.selectionStart ?? 0, s = t.selectionEnd ?? 0;
|
|
316
321
|
if (de(L, o, s)) {
|
|
317
322
|
e.preventDefault();
|
|
@@ -320,38 +325,38 @@ var Le = [
|
|
|
320
325
|
return;
|
|
321
326
|
}
|
|
322
327
|
a = {
|
|
323
|
-
type:
|
|
328
|
+
type: it[n],
|
|
324
329
|
start: r,
|
|
325
330
|
end: i
|
|
326
331
|
};
|
|
327
332
|
}
|
|
328
333
|
a && (e.preventDefault(), q(a, e, !0));
|
|
329
|
-
},
|
|
334
|
+
}, ct = (e) => {
|
|
330
335
|
let t = E.value;
|
|
331
|
-
if (j.value || !t || !e.clipboardData ||
|
|
332
|
-
let [n, r] =
|
|
336
|
+
if (j.value || !t || !e.clipboardData || b.value || v.disabled) return;
|
|
337
|
+
let [n, r] = rt(t), i = e.clipboardData.getData("text/plain");
|
|
333
338
|
e.preventDefault(), q({
|
|
334
339
|
type: "paste",
|
|
335
340
|
start: n,
|
|
336
341
|
end: r,
|
|
337
342
|
raw: F(i)
|
|
338
343
|
}, e, !0);
|
|
339
|
-
},
|
|
344
|
+
}, lt = !1, ut = (e, t) => {
|
|
340
345
|
let n = e.ownerDocument.caretPositionFromPoint?.(t.clientX, t.clientY);
|
|
341
346
|
return n?.offsetNode === e ? n.offset : e.value.length;
|
|
342
|
-
},
|
|
347
|
+
}, dt = (e) => {
|
|
343
348
|
let t = E.value;
|
|
344
|
-
if (j.value || !t || !e.dataTransfer ||
|
|
349
|
+
if (j.value || !t || !e.dataTransfer || lt || b.value || v.disabled) return;
|
|
345
350
|
let n = e.dataTransfer.getData("text/plain");
|
|
346
351
|
e.preventDefault();
|
|
347
|
-
let r = d(L,
|
|
352
|
+
let r = d(L, ut(t, e));
|
|
348
353
|
t.focus(), q({
|
|
349
354
|
type: "paste",
|
|
350
355
|
start: r,
|
|
351
356
|
end: r,
|
|
352
357
|
raw: F(n)
|
|
353
358
|
}, e, !0);
|
|
354
|
-
},
|
|
359
|
+
}, ft = () => {
|
|
355
360
|
let e = E.value;
|
|
356
361
|
if (!e) return;
|
|
357
362
|
let t = se({
|
|
@@ -363,7 +368,7 @@ var Le = [
|
|
|
363
368
|
start: 0,
|
|
364
369
|
end: 0,
|
|
365
370
|
raw: F(e.value)
|
|
366
|
-
},
|
|
371
|
+
}, Xe());
|
|
367
372
|
if (t.rejected) {
|
|
368
373
|
K(G() ? I.raw.length : void 0);
|
|
369
374
|
return;
|
|
@@ -373,13 +378,13 @@ var Le = [
|
|
|
373
378
|
return;
|
|
374
379
|
}
|
|
375
380
|
K(G() ? I.raw.length : void 0);
|
|
376
|
-
},
|
|
381
|
+
}, pt = (e) => {
|
|
377
382
|
let t = E.value;
|
|
378
383
|
if (!t) return;
|
|
379
384
|
let n = R, r = t.value;
|
|
380
385
|
if (n === r) return;
|
|
381
386
|
if (e.inputType === "insertReplacementText") {
|
|
382
|
-
|
|
387
|
+
ht(e, n, r);
|
|
383
388
|
return;
|
|
384
389
|
}
|
|
385
390
|
let i = t.selectionStart ?? r.length, a = 0;
|
|
@@ -403,7 +408,7 @@ var Le = [
|
|
|
403
408
|
start: c,
|
|
404
409
|
end: l
|
|
405
410
|
}, e, !1);
|
|
406
|
-
},
|
|
411
|
+
}, mt = (e, t, n, r) => {
|
|
407
412
|
let i = e.length - (t.length - n.length);
|
|
408
413
|
if (i < 0) return null;
|
|
409
414
|
let a = null;
|
|
@@ -413,98 +418,112 @@ var Le = [
|
|
|
413
418
|
(a === null || s < Math.abs(a + n.length - r)) && (a = o);
|
|
414
419
|
}
|
|
415
420
|
return a === null ? null : [a, a + i];
|
|
416
|
-
},
|
|
417
|
-
let r = E.value, i =
|
|
421
|
+
}, ht = (e, t, n) => {
|
|
422
|
+
let r = E.value, i = at(e), a = i === null ? null : mt(t, n, i, r.selectionStart ?? n.length), o = i !== null && a ? ot(i, d(L, a[0]), d(L, a[1])) : {
|
|
418
423
|
type: "paste",
|
|
419
424
|
start: 0,
|
|
420
425
|
end: I.raw.length,
|
|
421
426
|
raw: F(n)
|
|
422
427
|
};
|
|
423
428
|
q(o, e, !1);
|
|
424
|
-
},
|
|
429
|
+
}, gt = /* @__PURE__ */ new Set([
|
|
425
430
|
"historyUndo",
|
|
426
431
|
"historyRedo",
|
|
427
432
|
""
|
|
428
|
-
]),
|
|
433
|
+
]), _t = (e) => {
|
|
429
434
|
if (z) {
|
|
430
|
-
B = !0,
|
|
435
|
+
B = !0, y("input", e);
|
|
431
436
|
return;
|
|
432
437
|
}
|
|
433
438
|
if (V) return;
|
|
439
|
+
if (C.value) return K();
|
|
434
440
|
let t = e.inputType ?? "";
|
|
435
|
-
if (
|
|
436
|
-
|
|
441
|
+
if (gt.has(t) || !(e instanceof InputEvent)) {
|
|
442
|
+
ft(), y("input", e), nt();
|
|
437
443
|
return;
|
|
438
444
|
}
|
|
439
|
-
|
|
440
|
-
},
|
|
445
|
+
pt(e);
|
|
446
|
+
}, vt = () => {
|
|
441
447
|
j.value || (V = !0);
|
|
442
|
-
},
|
|
443
|
-
j.value
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
448
|
+
}, yt = (e) => {
|
|
449
|
+
if (j.value && C.value && E.value && (E.value.value = v.modelValue?.toString() || ""), !(j.value || !V)) {
|
|
450
|
+
if (V = !1, C.value) return K();
|
|
451
|
+
pt(e);
|
|
452
|
+
}
|
|
453
|
+
}, J = m(null), Y = () => {
|
|
454
|
+
if (!(j.value || !E.value)) {
|
|
455
|
+
if (E.value.value !== R && C.value) return K();
|
|
456
|
+
E.value.value !== R && (ft(), nt(), J.value && (J.value.value = Ze.value));
|
|
457
|
+
}
|
|
458
|
+
}, bt = (e = !1) => {
|
|
447
459
|
j.value || (W(u(U.value, k.value)), K(e ? I.raw.length : void 0));
|
|
448
|
-
},
|
|
460
|
+
}, xt = (e) => {
|
|
449
461
|
e.persisted && Y();
|
|
450
|
-
},
|
|
462
|
+
}, St = null, Ct = (e) => {
|
|
451
463
|
let t = (J.value ?? E.value)?.form;
|
|
452
464
|
t && e.target === t && Y();
|
|
453
|
-
},
|
|
465
|
+
}, wt = !1, Tt = () => {
|
|
454
466
|
let e = E.value;
|
|
455
|
-
if (!e || !L.hole || z || V ||
|
|
467
|
+
if (!e || !L.hole || z || V || wt || !G() || e.value !== L.text) return;
|
|
456
468
|
let t = e.selectionStart ?? 0;
|
|
457
469
|
if (t !== e.selectionEnd) return;
|
|
458
470
|
let n = he(L, t);
|
|
459
471
|
n !== t && e.setSelectionRange(n, n);
|
|
460
472
|
}, X = () => {
|
|
461
|
-
|
|
462
|
-
},
|
|
463
|
-
L.hole && (
|
|
464
|
-
},
|
|
473
|
+
wt = !1, window.removeEventListener("pointerup", X), window.removeEventListener("pointercancel", X), Tt();
|
|
474
|
+
}, Et = () => {
|
|
475
|
+
L.hole && (wt = !0, window.addEventListener("pointerup", X), window.addEventListener("pointercancel", X));
|
|
476
|
+
}, Dt = (e, t = !0) => l(Number(re(e.toString(), k.value)), t ? v.min : -Infinity, v.max), Ot = () => {
|
|
477
|
+
if (C.value) return;
|
|
465
478
|
if (!j.value) {
|
|
466
479
|
Y();
|
|
467
|
-
let e =
|
|
468
|
-
if (typeof e != "number" || e >=
|
|
469
|
-
W(pe(
|
|
480
|
+
let e = ve(I.raw);
|
|
481
|
+
if (typeof e != "number" || e >= v.min) return;
|
|
482
|
+
W(pe(v.min, k.value)), U.value = v.min, K(G() ? I.raw.length : void 0), y("update:modelValue", v.min);
|
|
470
483
|
return;
|
|
471
484
|
}
|
|
472
485
|
if (!E.value?.value) return;
|
|
473
486
|
let e = Number($(E.value.value));
|
|
474
|
-
!Number.isFinite(e) || e >=
|
|
475
|
-
},
|
|
476
|
-
let t = Number(
|
|
477
|
-
return
|
|
487
|
+
!Number.isFinite(e) || e >= v.min || (E.value.value = v.min.toString(), y("update:modelValue", v.min));
|
|
488
|
+
}, kt = (e) => {
|
|
489
|
+
let t = Number(v.modelValue || 0);
|
|
490
|
+
return Dt(t + e);
|
|
478
491
|
}, Z = () => {
|
|
479
|
-
if (
|
|
480
|
-
let e =
|
|
481
|
-
|
|
492
|
+
if (C.value) return;
|
|
493
|
+
let e = kt(v.step * -1);
|
|
494
|
+
y("decrease", e), y("update:modelValue", e);
|
|
482
495
|
}, Q = () => {
|
|
483
|
-
if (
|
|
484
|
-
let e =
|
|
485
|
-
|
|
486
|
-
},
|
|
487
|
-
if (!j.value) return
|
|
488
|
-
if (E.value
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
i = Pt(i), i = jt(i), i = Mt(i), i = Nt(i), It(i) && (i = Ft(i));
|
|
493
|
-
let a = null;
|
|
494
|
-
if (i) {
|
|
495
|
-
let e = $(i), t = Number(e);
|
|
496
|
-
Number.isFinite(t) && (a = Et(t, !1));
|
|
496
|
+
if (C.value) return;
|
|
497
|
+
let e = kt(v.step);
|
|
498
|
+
y("increase", e), y("update:modelValue", e);
|
|
499
|
+
}, At = (e) => {
|
|
500
|
+
if (!j.value) return _t(e);
|
|
501
|
+
if (E.value) {
|
|
502
|
+
if (C.value) {
|
|
503
|
+
E.value.value = v.modelValue?.toString() || "";
|
|
504
|
+
return;
|
|
497
505
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
let
|
|
502
|
-
|
|
506
|
+
if (e.target instanceof HTMLInputElement) {
|
|
507
|
+
let t = e.target.value, n = e.target.selectionStart, r = e.target.selectionEnd;
|
|
508
|
+
y("input", e);
|
|
509
|
+
let i = t;
|
|
510
|
+
i = Ft(i), i = Mt(i), i = Nt(i), i = Pt(i), Lt(i) && (i = It(i));
|
|
511
|
+
let a = null;
|
|
512
|
+
if (i) {
|
|
513
|
+
let e = $(i), t = Number(e);
|
|
514
|
+
Number.isFinite(t) && (a = Dt(t, !1));
|
|
515
|
+
}
|
|
516
|
+
y("update:modelValue", a);
|
|
517
|
+
let o = re(i, k.value);
|
|
518
|
+
if (E.value.value !== o && (E.value.value = o, n !== null && r !== null)) {
|
|
519
|
+
let e = o.length - t.length, i = Math.max(0, n + e), a = Math.max(0, r + e);
|
|
520
|
+
E.value.setSelectionRange(i, a);
|
|
521
|
+
}
|
|
503
522
|
}
|
|
504
523
|
}
|
|
505
|
-
}, At = (e) => {
|
|
506
|
-
e.key === "ArrowUp" ? (e.preventDefault(), Q()) : e.key === "ArrowDown" ? (e.preventDefault(), Z()) : e.key === "Enter" && (Dt(), !e.isComposing && !V && yt(!0));
|
|
507
524
|
}, jt = (e) => {
|
|
525
|
+
e.key === "ArrowUp" ? (e.preventDefault(), Q()) : e.key === "ArrowDown" ? (e.preventDefault(), Z()) : e.key === "Enter" && (Ot(), !e.isComposing && !V && bt(!0));
|
|
526
|
+
}, Mt = (e) => {
|
|
508
527
|
let t = e.lastIndexOf(","), n = e.lastIndexOf("."), r = (t) => e.split(t).length - 1;
|
|
509
528
|
if (t !== -1 && n !== -1) {
|
|
510
529
|
let r = t > n ? t : n;
|
|
@@ -512,70 +531,70 @@ var Le = [
|
|
|
512
531
|
}
|
|
513
532
|
let i = t === -1 ? "." : ",";
|
|
514
533
|
return r(i) > 1 ? e.replaceAll(i, "") : e.replace(",", ".");
|
|
515
|
-
},
|
|
516
|
-
let t = Number(e), n = l(t, -Infinity,
|
|
534
|
+
}, Nt = (e) => e.length ? [...e[0] + e.slice(1).replaceAll("-", "")].reduce((e, t) => (t === "." && e.includes(".") || e.push(t), e), []).join("").replaceAll(/[^\d.-]/g, "") : "", Pt = (e) => e.startsWith(".") && e.length === 1 ? "0." : e.startsWith("-.") && e.length === 2 ? "-0." : e, Ft = (e) => e.slice(0, 20), It = (e) => {
|
|
535
|
+
let t = Number(e), n = l(t, -Infinity, v.max), r = n.toString();
|
|
517
536
|
return n === t && r.includes("e") ? e : r;
|
|
518
|
-
},
|
|
537
|
+
}, Lt = (e) => !(e.length === 0 || e.endsWith(".") || e.endsWith("-") || e.endsWith("-0") || /\.\d*0+$/.test(e)), $ = (e) => {
|
|
519
538
|
let [t, n] = e.split(".");
|
|
520
539
|
return t ||= "0", n ? (n = n?.slice(0, k.value) || "0", `${t}.${n}`) : t;
|
|
521
|
-
},
|
|
522
|
-
onBeforeinput: (e) =>
|
|
540
|
+
}, Rt = {
|
|
541
|
+
onBeforeinput: (e) => st(e),
|
|
523
542
|
onBlur: (e) => {
|
|
524
|
-
|
|
543
|
+
S.value = !1, Y(), Ot(), bt(), y("blur", e);
|
|
525
544
|
},
|
|
526
|
-
onChange: (e) =>
|
|
527
|
-
onClick: (e) =>
|
|
545
|
+
onChange: (e) => y("change", e),
|
|
546
|
+
onClick: (e) => y("click", e),
|
|
528
547
|
onCompositionend: (e) => {
|
|
529
|
-
|
|
548
|
+
yt(e), y("compositionend", e);
|
|
530
549
|
},
|
|
531
550
|
onCompositionstart: (e) => {
|
|
532
|
-
|
|
551
|
+
vt(), y("compositionstart", e);
|
|
533
552
|
},
|
|
534
553
|
onFocus: (e) => {
|
|
535
|
-
|
|
554
|
+
S.value = !0, Y(), y("focus", e);
|
|
536
555
|
},
|
|
537
556
|
onKeydown: (e) => {
|
|
538
|
-
|
|
557
|
+
jt(e), y("keydown", e);
|
|
539
558
|
},
|
|
540
|
-
onKeyup: (e) =>
|
|
541
|
-
onMousedown: (e) =>
|
|
542
|
-
onMouseup: (e) =>
|
|
543
|
-
onPointerdown: () =>
|
|
559
|
+
onKeyup: (e) => y("keyup", e),
|
|
560
|
+
onMousedown: (e) => y("mousedown", e),
|
|
561
|
+
onMouseup: (e) => y("mouseup", e),
|
|
562
|
+
onPointerdown: () => Et(),
|
|
544
563
|
onPaste: (e) => {
|
|
545
|
-
|
|
564
|
+
ct(e), y("paste", e);
|
|
546
565
|
},
|
|
547
|
-
onDragstart: () =>
|
|
548
|
-
onDragend: () =>
|
|
549
|
-
onDrop: (e) =>
|
|
550
|
-
onSelectionchange: () =>
|
|
551
|
-
},
|
|
566
|
+
onDragstart: () => lt = !0,
|
|
567
|
+
onDragend: () => lt = !1,
|
|
568
|
+
onDrop: (e) => dt(e),
|
|
569
|
+
onSelectionchange: () => Tt()
|
|
570
|
+
}, zt = f(() => T.input ? p(Rt, T.input) : Rt), Bt = (t) => {
|
|
552
571
|
if (e(E.value)) return;
|
|
553
572
|
if (!j.value) {
|
|
554
|
-
if (U.value = H(t), G() &&
|
|
573
|
+
if (U.value = H(t), G() && ve(I.raw) === U.value) return;
|
|
555
574
|
W(u(U.value, k.value)), K(G() ? I.raw.length : void 0);
|
|
556
575
|
return;
|
|
557
576
|
}
|
|
558
577
|
let n = E.value.value;
|
|
559
|
-
if (!e(t) && document.activeElement === E.value && !
|
|
578
|
+
if (!e(t) && document.activeElement === E.value && !Lt(n) && n.length > 0 && Number(t) === Dt(Number($(n)), !1)) return;
|
|
560
579
|
let r = t;
|
|
561
580
|
e(r) && (r = ""), E.value.value = r?.toString() || "";
|
|
562
581
|
};
|
|
563
|
-
|
|
564
|
-
|
|
582
|
+
Fe(() => v.modelValue, (e) => {
|
|
583
|
+
Bt(e);
|
|
565
584
|
});
|
|
566
|
-
let
|
|
567
|
-
return
|
|
585
|
+
let Vt = () => j.value ? v.modelValue?.toString() || "" : u(H(v.modelValue), k.value);
|
|
586
|
+
return Me(() => {
|
|
568
587
|
let e = E.value;
|
|
569
|
-
G() && (
|
|
570
|
-
let t = e && !j.value && G() && e.value ===
|
|
571
|
-
if (
|
|
588
|
+
G() && (S.value = !0);
|
|
589
|
+
let t = e && !j.value && G() && e.value === Vt() ? e.selectionStart : null;
|
|
590
|
+
if (Bt(v.modelValue), e && t !== null && G()) {
|
|
572
591
|
let n = le(L, Math.min(t, I.raw.length));
|
|
573
592
|
e.setSelectionRange(n, n);
|
|
574
593
|
}
|
|
575
|
-
window.addEventListener("pageshow",
|
|
576
|
-
}),
|
|
577
|
-
window.removeEventListener("pageshow",
|
|
578
|
-
}),
|
|
594
|
+
window.addEventListener("pageshow", xt), St = e?.ownerDocument ?? null, St?.addEventListener("submit", Ct, !0), $e.value = !0;
|
|
595
|
+
}), je(() => {
|
|
596
|
+
window.removeEventListener("pageshow", xt), St?.removeEventListener("submit", Ct, !0), window.removeEventListener("pointerup", X), window.removeEventListener("pointercancel", X);
|
|
597
|
+
}), Fe([
|
|
579
598
|
M,
|
|
580
599
|
N,
|
|
581
600
|
k,
|
|
@@ -584,19 +603,19 @@ var Le = [
|
|
|
584
603
|
], () => {
|
|
585
604
|
if (E.value) {
|
|
586
605
|
if (j.value) {
|
|
587
|
-
E.value.value =
|
|
606
|
+
E.value.value = v.modelValue?.toString() || "";
|
|
588
607
|
return;
|
|
589
608
|
}
|
|
590
609
|
G() || W(u(U.value, k.value)), K(G() ? I.raw.length : void 0);
|
|
591
610
|
}
|
|
592
|
-
}), (e, t) => (
|
|
611
|
+
}), (e, t) => (Ne(), Se(ee, p({
|
|
593
612
|
id: e.id,
|
|
594
613
|
class: "bb-number-input",
|
|
595
|
-
clearable:
|
|
614
|
+
clearable: Je.value,
|
|
596
615
|
compact: e.compact,
|
|
597
616
|
description: e.description,
|
|
598
617
|
disabled: e.disabled,
|
|
599
|
-
errors:
|
|
618
|
+
errors: g(Ue),
|
|
600
619
|
"has-errors": e.hasErrors,
|
|
601
620
|
"has-value": w.value,
|
|
602
621
|
"has-warnings": e.hasWarnings,
|
|
@@ -605,21 +624,21 @@ var Le = [
|
|
|
605
624
|
"input-align": e.inputAlign,
|
|
606
625
|
label: e.label,
|
|
607
626
|
"label-align": e.labelAlign,
|
|
608
|
-
"label-mode":
|
|
627
|
+
"label-mode": Ye.value,
|
|
609
628
|
"label-position": e.labelPosition,
|
|
610
629
|
layout: e.layout,
|
|
611
630
|
loading: e.loading,
|
|
612
631
|
name: e.name,
|
|
613
|
-
passthrough:
|
|
614
|
-
readonly:
|
|
632
|
+
passthrough: g(T),
|
|
633
|
+
readonly: g(b),
|
|
615
634
|
reverse: e.reverse,
|
|
616
|
-
"show-asterisk":
|
|
617
|
-
"show-hint":
|
|
635
|
+
"show-asterisk": g(He),
|
|
636
|
+
"show-hint": qe.value,
|
|
618
637
|
warnings: e.warnings
|
|
619
|
-
},
|
|
620
|
-
label:
|
|
621
|
-
input:
|
|
622
|
-
"append:icon":
|
|
638
|
+
}, g(T).forwardAttrs), Ee({
|
|
639
|
+
label: _((t) => [h(e.$slots, "label", Ae(ke(t)))]),
|
|
640
|
+
input: _(({ id: n, hasErrors: r, hasWarnings: i, ariaDescribedby: a, ariaLabelledby: o }) => [De(ne, {
|
|
641
|
+
"append:icon": g(v)["append:icon"],
|
|
623
642
|
clearable: e.clearable,
|
|
624
643
|
compact: e.compact,
|
|
625
644
|
disabled: e.disabled,
|
|
@@ -627,30 +646,30 @@ var Le = [
|
|
|
627
646
|
"has-value": w.value,
|
|
628
647
|
"has-warnings": i,
|
|
629
648
|
loading: e.loading,
|
|
630
|
-
passthrough:
|
|
631
|
-
"prepend:icon":
|
|
632
|
-
readonly:
|
|
649
|
+
passthrough: g(T),
|
|
650
|
+
"prepend:icon": g(v)["prepend:icon"],
|
|
651
|
+
readonly: g(b),
|
|
633
652
|
"reserve-append-space": e.clearable,
|
|
634
653
|
variant: e.variant,
|
|
635
|
-
"onClick:clear": t[0] ||= (e) =>
|
|
636
|
-
},
|
|
637
|
-
"prepend:outer":
|
|
654
|
+
"onClick:clear": t[0] ||= (e) => g(y)("update:modelValue", null)
|
|
655
|
+
}, Ee({
|
|
656
|
+
"prepend:outer": _(() => [h(e.$slots, "prepend:outer", {
|
|
638
657
|
decrease: Z,
|
|
639
658
|
increase: Q
|
|
640
659
|
})]),
|
|
641
|
-
prepend:
|
|
660
|
+
prepend: _(() => [h(e.$slots, "prepend", {
|
|
642
661
|
decrease: Z,
|
|
643
662
|
increase: Q
|
|
644
663
|
})]),
|
|
645
|
-
append:
|
|
664
|
+
append: _(() => [h(e.$slots, "append", {
|
|
646
665
|
decrease: Z,
|
|
647
666
|
increase: Q
|
|
648
667
|
})]),
|
|
649
|
-
"append:outer":
|
|
668
|
+
"append:outer": _(() => [h(e.$slots, "append:outer", {
|
|
650
669
|
decrease: Z,
|
|
651
670
|
increase: Q
|
|
652
671
|
})]),
|
|
653
|
-
default:
|
|
672
|
+
default: _(() => [Ie(Te("input", p({
|
|
654
673
|
id: n,
|
|
655
674
|
ref_key: "input",
|
|
656
675
|
ref: E,
|
|
@@ -658,11 +677,11 @@ var Le = [
|
|
|
658
677
|
"aria-disabled": e.disabled || void 0,
|
|
659
678
|
"aria-invalid": r || void 0,
|
|
660
679
|
"aria-labelledby": o,
|
|
661
|
-
"aria-readonly":
|
|
680
|
+
"aria-readonly": g(b) || void 0,
|
|
662
681
|
"aria-valuemax": e.max === 2 ** 53 - 1 ? void 0 : e.max,
|
|
663
682
|
"aria-valuemin": e.min === -(2 ** 53 - 1) ? void 0 : e.min,
|
|
664
|
-
"aria-valuenow":
|
|
665
|
-
"aria-valuetext":
|
|
683
|
+
"aria-valuenow": g(c)(g(Ke)) ? g(Ke) : void 0,
|
|
684
|
+
"aria-valuetext": et.value,
|
|
666
685
|
autocomplete: e.autocomplete,
|
|
667
686
|
autofocus: e.autofocus,
|
|
668
687
|
class: "bb-number-input__input",
|
|
@@ -670,25 +689,25 @@ var Le = [
|
|
|
670
689
|
inputmode: "decimal",
|
|
671
690
|
name: e.disableFormatting ? e.name : void 0,
|
|
672
691
|
placeholder: e.placeholder,
|
|
673
|
-
readonly:
|
|
674
|
-
required:
|
|
675
|
-
"aria-required":
|
|
692
|
+
readonly: g(b),
|
|
693
|
+
required: g(We),
|
|
694
|
+
"aria-required": g(Ge),
|
|
676
695
|
role: "spinbutton",
|
|
677
696
|
size: "1",
|
|
678
697
|
type: "text",
|
|
679
|
-
onInput:
|
|
680
|
-
},
|
|
698
|
+
onInput: Le(At, ["stop"])
|
|
699
|
+
}, p(g(T).controlAttrs, zt.value)), null, 16, Re), [[g(ie), Vt]])]),
|
|
681
700
|
_: 2
|
|
682
701
|
}, [e.$slots.prefix ? {
|
|
683
702
|
name: "prefix",
|
|
684
|
-
fn:
|
|
703
|
+
fn: _(() => [h(e.$slots, "prefix", {
|
|
685
704
|
decrease: Z,
|
|
686
705
|
increase: Q
|
|
687
706
|
})]),
|
|
688
707
|
key: "0"
|
|
689
708
|
} : void 0, e.$slots.suffix ? {
|
|
690
709
|
name: "suffix",
|
|
691
|
-
fn:
|
|
710
|
+
fn: _(() => [h(e.$slots, "suffix", {
|
|
692
711
|
decrease: Z,
|
|
693
712
|
increase: Q
|
|
694
713
|
})]),
|
|
@@ -707,20 +726,20 @@ var Le = [
|
|
|
707
726
|
"readonly",
|
|
708
727
|
"reserve-append-space",
|
|
709
728
|
"variant"
|
|
710
|
-
]), !e.disableFormatting && e.name ? (
|
|
729
|
+
]), !e.disableFormatting && e.name ? (Ne(), we("input", {
|
|
711
730
|
key: 0,
|
|
712
731
|
ref_key: "posted",
|
|
713
732
|
ref: J,
|
|
714
733
|
disabled: e.disabled,
|
|
715
|
-
form:
|
|
734
|
+
form: g(T).controlAttrs.form,
|
|
716
735
|
name: e.name,
|
|
717
736
|
type: "hidden",
|
|
718
|
-
value:
|
|
719
|
-
}, null, 8,
|
|
737
|
+
value: Ze.value
|
|
738
|
+
}, null, 8, ze)) : Ce("", !0)]),
|
|
720
739
|
_: 2
|
|
721
740
|
}, [e.$slots.description ? {
|
|
722
741
|
name: "description",
|
|
723
|
-
fn:
|
|
742
|
+
fn: _((t) => [h(e.$slots, "description", Ae(ke(t)))]),
|
|
724
743
|
key: "0"
|
|
725
744
|
} : void 0]), 1040, [
|
|
726
745
|
"id",
|
|
@@ -752,4 +771,4 @@ var Le = [
|
|
|
752
771
|
}
|
|
753
772
|
});
|
|
754
773
|
//#endregion
|
|
755
|
-
export {
|
|
774
|
+
export { Be as default };
|