bitboss-ui 2.0.5 → 2.0.8
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/components/BaseDialog/BaseDialog.vue.d.ts +1 -3
- package/dist/composables/useOptions.d.ts +1 -1
- package/dist/index.js +89 -87
- package/dist/index.js.map +1 -1
- package/dist/index10.js +7 -39
- package/dist/index10.js.map +1 -1
- package/dist/index101.js +60 -87
- package/dist/index101.js.map +1 -1
- package/dist/index103.js +113 -258
- package/dist/index103.js.map +1 -1
- package/dist/index105.js +254 -388
- package/dist/index105.js.map +1 -1
- package/dist/index107.js +387 -98
- package/dist/index107.js.map +1 -1
- package/dist/index109.js +52 -48
- package/dist/index109.js.map +1 -1
- package/dist/index11.js +74 -188
- package/dist/index11.js.map +1 -1
- package/dist/index111.js +35 -34
- package/dist/index111.js.map +1 -1
- package/dist/index113.js +105 -23
- package/dist/index113.js.map +1 -1
- package/dist/index115.js +23 -156
- package/dist/index115.js.map +1 -1
- package/dist/index117.js +153 -112
- package/dist/index117.js.map +1 -1
- package/dist/index119.js +115 -39
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +38 -80
- package/dist/index12.js.map +1 -1
- package/dist/index121.js +36 -40
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +34 -37
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +30 -21
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +47 -2
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +35 -21
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +2 -2
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +21 -312
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -24
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +312 -2
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +196 -0
- package/dist/index13.js.map +1 -0
- package/dist/index130.js +24 -5
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -9
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +5 -6
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +9 -3
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +6 -3
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +1 -1
- package/dist/index136.js +1 -1
- package/dist/index137.js +1 -1
- package/dist/index138.js +1 -1
- package/dist/index139.js +1 -1
- package/dist/index14.js +73 -121
- package/dist/index14.js.map +1 -1
- package/dist/index140.js +1 -1
- package/dist/index141.js +1 -1
- package/dist/index142.js +1 -1
- package/dist/index143.js +1 -1
- package/dist/index144.js +1 -1
- package/dist/index145.js +1 -1
- package/dist/index146.js +1 -1
- package/dist/index147.js +1 -1
- package/dist/index148.js +1 -1
- package/dist/index149.js +1 -1
- package/dist/index150.js +1 -1
- package/dist/index151.js +1 -1
- package/dist/index152.js +1 -1
- package/dist/index153.js +1 -1
- package/dist/index154.js +1 -1
- package/dist/index155.js +1 -1
- package/dist/index156.js +1 -1
- package/dist/index157.js +1 -1
- package/dist/index158.js +1 -1
- package/dist/index159.js +2 -2
- package/dist/index16.js +119 -118
- package/dist/index16.js.map +1 -1
- package/dist/index160.js +6 -0
- package/dist/index160.js.map +1 -0
- package/dist/index161.js +1 -1
- package/dist/index163.js +2 -2
- package/dist/index165.js +1 -1
- package/dist/index166.js +1 -1
- package/dist/index167.js +1 -1
- package/dist/index168.js +1 -1
- package/dist/index169.js +2 -2
- package/dist/index170.js +6 -0
- package/dist/index170.js.map +1 -0
- package/dist/index171.js +3 -2
- package/dist/index171.js.map +1 -1
- package/dist/index173.js +2 -3
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +1 -1
- package/dist/index175.js +1 -1
- package/dist/index176.js +1 -1
- package/dist/index177.js +1 -1
- package/dist/index178.js +1 -1
- package/dist/index179.js +1 -1
- package/dist/index18.js +120 -208
- package/dist/index18.js.map +1 -1
- package/dist/index180.js +1 -1
- package/dist/index181.js +1 -1
- package/dist/index182.js +1 -1
- package/dist/index183.js +2 -2
- package/dist/index184.js +6 -0
- package/dist/index184.js.map +1 -0
- package/dist/index185.js +1 -1
- package/dist/index187.js +1 -1
- package/dist/index189.js +1 -1
- package/dist/index190.js +1 -1
- package/dist/index191.js +1 -1
- package/dist/index192.js +1 -1
- package/dist/index193.js +1 -1
- package/dist/index194.js +1 -1
- package/dist/index195.js +1 -1
- package/dist/index196.js +1 -1
- package/dist/index197.js +3 -81
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +3 -3
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +81 -5
- package/dist/index199.js.map +1 -1
- package/dist/index20.js +193 -275
- package/dist/index20.js.map +1 -1
- package/dist/index200.js +2 -16
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +3 -16
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +124 -17
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +5 -19
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +119 -23
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +19 -3
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +16 -2
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +16 -8
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +2 -249
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +5 -0
- package/dist/index209.js.map +1 -0
- package/dist/index210.js +35 -52
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +173 -36
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +6 -5
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +39 -36
- package/dist/index213.js.map +1 -1
- package/dist/index215.js +13 -4
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +5 -2
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +369 -2
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +6 -40
- package/dist/index218.js.map +1 -1
- package/dist/{index214.js → index219.js} +1 -1
- package/dist/{index214.js.map → index219.js.map} +1 -1
- package/dist/index22.js +287 -247
- package/dist/index22.js.map +1 -1
- package/dist/index220.js +4 -13
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +2 -158
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +3 -84
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +10 -0
- package/dist/index223.js.map +1 -0
- package/dist/index224.js +19 -3
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +26 -34
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +3 -6
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +249 -7
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +49 -123
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +44 -123
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +5 -2
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +49 -174
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +158 -5
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +83 -368
- package/dist/index233.js.map +1 -1
- package/dist/index235.js +2 -18
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +17 -105
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +109 -0
- package/dist/index237.js.map +1 -0
- package/dist/{index238.js → index239.js} +3 -3
- package/dist/{index238.js.map → index239.js.map} +1 -1
- package/dist/index24.js +249 -120
- package/dist/index24.js.map +1 -1
- package/dist/index241.js +2 -10
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +9 -2
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +3 -224
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +9 -281
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +23 -6
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +6 -2
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +16 -2
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +224 -2
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +281 -2
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +6 -2
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +2 -2
- package/dist/index252.js +2 -3
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +2 -2
- package/dist/index254.js +2 -2
- package/dist/index255.js +2 -2
- package/dist/index256.js +122 -24
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +429 -20
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +6 -0
- package/dist/index258.js.map +1 -0
- package/dist/index26.js +119 -142
- package/dist/index26.js.map +1 -1
- package/dist/index260.js +6 -3
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +21 -8
- package/dist/index261.js.map +1 -1
- package/dist/index263.js +9 -3
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +439 -0
- package/dist/index264.js.map +1 -0
- package/dist/index265.js +127 -6
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +199 -15
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +4 -9
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +89 -3
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +2 -12
- package/dist/index269.js.map +1 -1
- package/dist/index270.js +2 -9
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +2 -9
- package/dist/index271.js.map +1 -1
- package/dist/index272.js +2 -17
- package/dist/index272.js.map +1 -1
- package/dist/index273.js +2 -431
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +2 -89
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +28 -2
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +17 -64
- package/dist/index276.js.map +1 -1
- package/dist/index278.js +3 -200
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +12 -2
- package/dist/index279.js.map +1 -1
- package/dist/index28.js +138 -83
- package/dist/index28.js.map +1 -1
- package/dist/index280.js +7 -124
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +7 -20
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +20 -0
- package/dist/index282.js.map +1 -0
- package/dist/index283.js +2 -436
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +68 -126
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +5 -3
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +1 -1
- package/dist/index287.js +3 -211
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +214 -0
- package/dist/index288.js.map +1 -0
- package/dist/index290.js +4 -7
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +4 -19
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +58 -6
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +35 -4
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +7 -4
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +6 -58
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +18 -34
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +2 -11
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +47 -2
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +10 -46
- package/dist/index299.js.map +1 -1
- package/dist/index30.js +85 -115
- package/dist/index30.js.map +1 -1
- package/dist/index32.js +111 -112
- package/dist/index32.js.map +1 -1
- package/dist/index34.js +114 -365
- package/dist/index34.js.map +1 -1
- package/dist/index36.js +361 -283
- package/dist/index36.js.map +1 -1
- package/dist/index38.js +288 -106
- package/dist/index38.js.map +1 -1
- package/dist/index40.js +114 -121
- package/dist/index40.js.map +1 -1
- package/dist/index42.js +113 -200
- package/dist/index42.js.map +1 -1
- package/dist/index44.js +180 -90
- package/dist/index44.js.map +1 -1
- package/dist/index46.js +110 -78
- package/dist/index46.js.map +1 -1
- package/dist/index48.js +89 -54
- package/dist/index48.js.map +1 -1
- package/dist/index5.js +14 -78
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +54 -84
- package/dist/index50.js.map +1 -1
- package/dist/index52.js +86 -60
- package/dist/index52.js.map +1 -1
- package/dist/index54.js +59 -40
- package/dist/index54.js.map +1 -1
- package/dist/index56.js +42 -55
- package/dist/index56.js.map +1 -1
- package/dist/index58.js +53 -103
- package/dist/index58.js.map +1 -1
- package/dist/index6.js +36 -58
- package/dist/index6.js.map +1 -1
- package/dist/index60.js +103 -89
- package/dist/index60.js.map +1 -1
- package/dist/index62.js +61 -88
- package/dist/index62.js.map +1 -1
- package/dist/index64.js +119 -77
- package/dist/index64.js.map +1 -1
- package/dist/index66.js +77 -91
- package/dist/index66.js.map +1 -1
- package/dist/index68.js +88 -49
- package/dist/index68.js.map +1 -1
- package/dist/index7.js +78 -20
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +51 -304
- package/dist/index70.js.map +1 -1
- package/dist/index72.js +299 -115
- package/dist/index72.js.map +1 -1
- package/dist/index74.js +120 -214
- package/dist/index74.js.map +1 -1
- package/dist/index76.js +213 -36
- package/dist/index76.js.map +1 -1
- package/dist/index78.js +47 -0
- package/dist/index78.js.map +1 -0
- package/dist/index79.js +119 -230
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +61 -7
- package/dist/index8.js.map +1 -1
- package/dist/index81.js +227 -154
- package/dist/index81.js.map +1 -1
- package/dist/index83.js +154 -207
- package/dist/index83.js.map +1 -1
- package/dist/index85.js +215 -26
- package/dist/index85.js.map +1 -1
- package/dist/index87.js +27 -88
- package/dist/index87.js.map +1 -1
- package/dist/index89.js +53 -88
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +17 -76
- package/dist/index9.js.map +1 -1
- package/dist/index91.js +75 -44
- package/dist/index91.js.map +1 -1
- package/dist/index93.js +89 -15
- package/dist/index93.js.map +1 -1
- package/dist/index95.js +15 -166
- package/dist/index95.js.map +1 -1
- package/dist/index97.js +120 -59
- package/dist/index97.js.map +1 -1
- package/dist/index99.js +66 -52
- package/dist/index99.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/index120.js +0 -47
- package/dist/index120.js.map +0 -1
- package/dist/index164.js +0 -6
- package/dist/index164.js.map +0 -1
- package/dist/index172.js +0 -6
- package/dist/index172.js.map +0 -1
- package/dist/index188.js +0 -6
- package/dist/index188.js.map +0 -1
- package/dist/index234.js +0 -6
- package/dist/index234.js.map +0 -1
- package/dist/index240.js +0 -5
- package/dist/index240.js.map +0 -1
- package/dist/index259.js +0 -10
- package/dist/index259.js.map +0 -1
- package/dist/index262.js +0 -26
- package/dist/index262.js.map +0 -1
- package/dist/index277.js +0 -8
- package/dist/index277.js.map +0 -1
- package/dist/index3.js +0 -17
- package/dist/index3.js.map +0 -1
- package/dist/index4.js +0 -43
- package/dist/index4.js.map +0 -1
- package/dist/index77.js +0 -130
- package/dist/index77.js.map +0 -1
package/dist/index28.js
CHANGED
|
@@ -1,98 +1,153 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
__name: "BaseRadio",
|
|
1
|
+
import { defineComponent as C, computed as M, ref as g, onMounted as E, watch as N, openBlock as x, createBlock as T, normalizeClass as q, withCtx as i, renderSlot as d, createVNode as A, createElementVNode as D, mergeProps as L, withModifiers as S } from "vue";
|
|
2
|
+
import { clamp as b } from "./index200.js";
|
|
3
|
+
import j from "./index213.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import z from "./index215.js";
|
|
6
|
+
const O = ["id", "aria-describedby", "autocomplete", "autofocus", "disabled", "name", "placeholder", "readonly", "required", "step"], J = /* @__PURE__ */ C({
|
|
7
|
+
__name: "BaseNumberInput",
|
|
9
8
|
props: {
|
|
9
|
+
"append:icon": {},
|
|
10
10
|
ariaDescribedby: {},
|
|
11
|
+
autocomplete: {},
|
|
11
12
|
autofocus: {},
|
|
12
|
-
checked: {},
|
|
13
|
-
color: {},
|
|
14
13
|
disabled: { type: Boolean },
|
|
15
14
|
hasErrors: { type: Boolean },
|
|
16
15
|
id: {},
|
|
16
|
+
loading: { type: Boolean },
|
|
17
|
+
max: {},
|
|
18
|
+
min: {},
|
|
17
19
|
modelValue: {},
|
|
18
20
|
name: {},
|
|
21
|
+
placeholder: {},
|
|
22
|
+
"prepend:icon": {},
|
|
19
23
|
readonly: {},
|
|
20
24
|
required: { type: Boolean },
|
|
21
|
-
|
|
25
|
+
step: { default: 1 }
|
|
22
26
|
},
|
|
23
|
-
emits: ["blur", "change", "click", "focus", "input", "keydown", "mousedown", "mouseup", "update:modelValue"],
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
a("change", o), a("update:modelValue", e.value);
|
|
46
|
-
},
|
|
47
|
-
onClick: (o) => a("click", o),
|
|
48
|
-
onFocus: (o) => {
|
|
49
|
-
l.value = !0, a("focus", o);
|
|
50
|
-
},
|
|
51
|
-
onInput: (o) => a("input", o),
|
|
52
|
-
onKeydown: (o) => a("keydown", o),
|
|
53
|
-
onMousedown: (o) => a("mousedown", o),
|
|
54
|
-
onMouseup: (o) => a("mouseup", o)
|
|
55
|
-
};
|
|
56
|
-
return {
|
|
57
|
-
"aria-describedby": e.ariaDescribedby,
|
|
58
|
-
autofocus: e.autofocus,
|
|
59
|
-
checked: c.value,
|
|
60
|
-
// There is no such thing as readonly radio so we disable and style it with css
|
|
61
|
-
disabled: e.disabled || e.readonly,
|
|
62
|
-
id: e.id,
|
|
63
|
-
name: e.name,
|
|
64
|
-
required: e.required,
|
|
65
|
-
tabindex: e.disabled ? -1 : void 0,
|
|
66
|
-
type: "radio",
|
|
67
|
-
value: r,
|
|
68
|
-
...k
|
|
69
|
-
};
|
|
70
|
-
}), y = s(() => ({
|
|
71
|
-
checked: c.value,
|
|
72
|
-
disabled: e.disabled,
|
|
73
|
-
focused: l.value,
|
|
74
|
-
hasErrors: e.hasErrors,
|
|
75
|
-
id: e.id,
|
|
76
|
-
name: e.name,
|
|
77
|
-
parsedValue: d.value.value,
|
|
78
|
-
readonly: e.readonly,
|
|
79
|
-
required: e.required,
|
|
80
|
-
value: e.value
|
|
81
|
-
})), v = s(() => {
|
|
82
|
-
let r = {};
|
|
83
|
-
return e.color && i(e.color) && (r.color = e.color), {
|
|
84
|
-
class: "bb-base-radio-container__icon",
|
|
85
|
-
style: r
|
|
86
|
-
};
|
|
27
|
+
emits: ["blur", "change", "click", "decrease", "focus", "increase", "input", "keydown", "mousedown", "mouseup", "update:modelValue"],
|
|
28
|
+
setup(v, { expose: I, emit: V }) {
|
|
29
|
+
const n = v, l = V, $ = M(() => ({
|
|
30
|
+
"bb-base-number-input": !0,
|
|
31
|
+
"bb-base-number-input--disabled": n.disabled,
|
|
32
|
+
"bb-base-number-input--errors": n.hasErrors,
|
|
33
|
+
"bb-base-number-input--loading": n.loading,
|
|
34
|
+
"bb-base-number-input--readonly": n.readonly
|
|
35
|
+
})), s = g(null), p = g(!1), r = () => {
|
|
36
|
+
if (n.disabled || n.readonly || p.value) return;
|
|
37
|
+
const e = typeof n.min > "u" ? -1 / 0 : n.min, t = typeof n.max > "u" ? 1 / 0 : n.max;
|
|
38
|
+
let o = Math.max(Number(n.modelValue || 0) - n.step, e);
|
|
39
|
+
o = o === null ? o : b(o, e, t), l("decrease", o), l("update:modelValue", o);
|
|
40
|
+
}, u = () => {
|
|
41
|
+
if (n.disabled || n.readonly || p.value) return;
|
|
42
|
+
const e = typeof n.min > "u" ? -1 / 0 : n.min, t = typeof n.max > "u" ? 1 / 0 : n.max;
|
|
43
|
+
let o = Math.min(Number(n.modelValue || 0) + +n.step, t);
|
|
44
|
+
o = o === null ? o : b(o, e, t), l("increase", o), l("update:modelValue", o);
|
|
45
|
+
};
|
|
46
|
+
I({
|
|
47
|
+
increase: u,
|
|
48
|
+
decrease: r
|
|
87
49
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
50
|
+
const k = (e) => {
|
|
51
|
+
if (e.target instanceof HTMLInputElement) {
|
|
52
|
+
const t = e.target.value, o = /[,.]/g, m = [...t.matchAll(o)];
|
|
53
|
+
if (!(m.length === 1 && m.some((a) => a.index === t.length - 1)) && !(m.length && t[t.length - 1] === "0") && t !== "-") {
|
|
54
|
+
p.value = !1;
|
|
55
|
+
let a;
|
|
56
|
+
e.target.value === "" ? a = null : a = y(e.target.value);
|
|
57
|
+
const c = typeof n.min > "u" ? -1 / 0 : n.min, f = typeof n.max > "u" ? 1 / 0 : n.max;
|
|
58
|
+
a = a === null ? a : b(a, c, f), l("update:modelValue", a), s.value && (a === null ? s.value.value = "" : s.value.value = `${a}`);
|
|
59
|
+
} else
|
|
60
|
+
p.value = !0;
|
|
61
|
+
l("input", e);
|
|
62
|
+
}
|
|
63
|
+
}, y = (e) => {
|
|
64
|
+
if (typeof e == "number") return e;
|
|
65
|
+
let t = e.replaceAll(",", "."), a = t.slice(0, 1).concat(t.slice(1).replaceAll("-", "")).replaceAll(/[^\d.-]/g, "").split("."), c = a.slice(0, 1).join("") || 0, f = a.slice(1).join("") || 0, B = `${c}.${f}`;
|
|
66
|
+
return Number(B);
|
|
67
|
+
}, w = {
|
|
68
|
+
onBlur: (e) => l("blur", e),
|
|
69
|
+
onChange: (e) => l("change", e),
|
|
70
|
+
onClick: (e) => l("click", e),
|
|
71
|
+
onFocus: (e) => l("focus", e),
|
|
72
|
+
onKeydown: (e) => l("keydown", e),
|
|
73
|
+
onMousedown: (e) => l("mousedown", e),
|
|
74
|
+
onMouseup: (e) => l("mouseup", e)
|
|
75
|
+
}, h = (e) => {
|
|
76
|
+
s.value ? e === null || e === "" || e === void 0 ? s.value.value = "" : typeof e < "u" && (s.value.value = y(e).toString()) : console.error("Could not align input as it is not mounted");
|
|
77
|
+
};
|
|
78
|
+
return E(() => {
|
|
79
|
+
h(n.modelValue);
|
|
80
|
+
}), N(() => n.modelValue, h), (e, t) => (x(), T(z, {
|
|
81
|
+
class: q($.value)
|
|
82
|
+
}, {
|
|
83
|
+
"prepend-outer": i(() => [
|
|
84
|
+
d(e.$slots, "prepend-outer", {
|
|
85
|
+
decrease: r,
|
|
86
|
+
increase: u
|
|
87
|
+
})
|
|
88
|
+
]),
|
|
89
|
+
"append-outer": i(() => [
|
|
90
|
+
d(e.$slots, "append-outer", {
|
|
91
|
+
decrease: r,
|
|
92
|
+
increase: u
|
|
93
|
+
})
|
|
94
|
+
]),
|
|
95
|
+
default: i(() => [
|
|
96
|
+
A(j, {
|
|
97
|
+
"append:icon": n["append:icon"],
|
|
98
|
+
"prepend:icon": n["prepend:icon"]
|
|
99
|
+
}, {
|
|
100
|
+
prepend: i(() => [
|
|
101
|
+
d(e.$slots, "prepend", {
|
|
102
|
+
decrease: r,
|
|
103
|
+
increase: u
|
|
104
|
+
})
|
|
105
|
+
]),
|
|
106
|
+
prefix: i(() => [
|
|
107
|
+
d(e.$slots, "prefix", {
|
|
108
|
+
decrease: r,
|
|
109
|
+
increase: u
|
|
110
|
+
})
|
|
111
|
+
]),
|
|
112
|
+
append: i(() => [
|
|
113
|
+
d(e.$slots, "append", {
|
|
114
|
+
decrease: r,
|
|
115
|
+
increase: u
|
|
116
|
+
})
|
|
117
|
+
]),
|
|
118
|
+
suffix: i(() => [
|
|
119
|
+
d(e.$slots, "suffix", {
|
|
120
|
+
decrease: r,
|
|
121
|
+
increase: u
|
|
122
|
+
})
|
|
123
|
+
]),
|
|
124
|
+
default: i(() => [
|
|
125
|
+
D("input", L({
|
|
126
|
+
id: e.id,
|
|
127
|
+
ref_key: "input",
|
|
128
|
+
ref: s,
|
|
129
|
+
"aria-describedby": e.ariaDescribedby,
|
|
130
|
+
autocomplete: e.autocomplete,
|
|
131
|
+
autofocus: e.autofocus,
|
|
132
|
+
class: "bb-base-number-input__input",
|
|
133
|
+
disabled: e.disabled,
|
|
134
|
+
inputmode: "decimal",
|
|
135
|
+
name: e.name,
|
|
136
|
+
placeholder: e.placeholder,
|
|
137
|
+
readonly: e.readonly,
|
|
138
|
+
required: e.required,
|
|
139
|
+
size: "1",
|
|
140
|
+
step: e.step,
|
|
141
|
+
type: "text"
|
|
142
|
+
}, w, {
|
|
143
|
+
onInput: S(k, ["stop"])
|
|
144
|
+
}), null, 16, O)
|
|
145
|
+
]),
|
|
146
|
+
_: 3
|
|
147
|
+
}, 8, ["append:icon", "prepend:icon"])
|
|
148
|
+
]),
|
|
149
|
+
_: 3
|
|
150
|
+
}, 8, ["class"]));
|
|
96
151
|
}
|
|
97
152
|
});
|
|
98
153
|
export {
|
package/dist/index28.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index28.js","sources":["../src/components/BaseRadio/BaseRadio.vue"],"sourcesContent":["<template>\n\t<span v-bind=\"containerAttributes\">\n\t\t<input v-bind=\"inputAttributes\" />\n\t\t<span aria-hidden=\"true\" class=\"bb-base-radio-container\">\n\t\t\t<slot name=\"icon\" v-bind=\"slotAttributes\">\n\t\t\t\t<span v-bind=\"iconAttributes\"></span>\n\t\t\t</slot>\n\t\t</span>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { when } from '@/utilities/functions/when';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\n\nexport type BaseRadioProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Defines the input as checked\n\t */\n\tchecked?: InputHTMLAttributes['checked'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Used by v-model. Can be any serializable type.\n\t */\n\tmodelValue?: any;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname: InputHTMLAttributes['name'];\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * Defines the value of the radio input.\n\t * It can be any serializable value.\n\t */\n\tvalue: any;\n};\n\nexport type BaseRadioEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: any): void;\n};\n\nexport type SlotAttributes = {\n\tchecked: boolean;\n\tdisabled: Exclude<BaseRadioProps['disabled'], undefined>;\n\tfocused: boolean;\n\thasErrors: Exclude<BaseRadioProps['hasErrors'], undefined>;\n\tid: BaseRadioProps['id'];\n\tname: BaseRadioProps['name'];\n\tparsedValue: string;\n\treadonly: BaseRadioProps['readonly'];\n\tvalue: any;\n};\nconst props = defineProps<BaseRadioProps>();\n\nconst emit = defineEmits<BaseRadioEvents>();\n\ndefineSlots<{\n\ticon?: (props: SlotAttributes) => any;\n}>();\n\nconst checked = computed(() => {\n\tif (props.checked) return true;\n\treturn JSON.stringify(props.modelValue) === JSON.stringify(props.value);\n});\nconst hasFocus = ref(false);\n\nconst containerAttributes = computed(() => {\n\tconst attributes: Record<string, any> = {\n\t\tclass: {\n\t\t\t'bb-base-radio': true,\n\t\t\t'bb-base-radio--disabled': props.disabled,\n\t\t\t'bb-base-radio--errors': props.hasErrors,\n\t\t\t'bb-base-radio--readonly': props.readonly,\n\t\t\t[`bb-base-radio--${props.color}`]:\n\t\t\t\tprops.color && !isCssColor(props.color),\n\t\t},\n\t};\n\tif (props.color && isCssColor(props.color)) {\n\t\tattributes['style'] = `--color: ${props.color}`;\n\t}\n\treturn attributes;\n});\n\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n\t(item: unknown) => typeof item !== 'string',\n\tJSON.stringify\n);\n\nconst inputAttributes = computed(() => {\n\tconst value = makeInputValue(props.value);\n\n\tconst onBlur = (event: FocusEvent): void => {\n\t\thasFocus.value = false;\n\t\temit('blur', event);\n\t};\n\tconst onChange = (event: Event): void => {\n\t\temit('change', event);\n\t\temit('update:modelValue', props.value);\n\t};\n\tconst onFocus = (event: FocusEvent): void => {\n\t\thasFocus.value = true;\n\t\temit('focus', event);\n\t};\n\n\tconst eventListeners = {\n\t\tonBlur,\n\t\tonChange,\n\t\tonClick: (event: MouseEvent) => emit('click', event),\n\t\tonFocus,\n\t\tonInput: (event: Event) => emit('input', event),\n\t\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\t\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\t\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n\t};\n\n\treturn {\n\t\t'aria-describedby': props.ariaDescribedby,\n\t\tautofocus: props.autofocus,\n\t\tchecked: checked.value,\n\t\t// There is no such thing as readonly radio so we disable and style it with css\n\t\tdisabled: props.disabled || props.readonly,\n\t\tid: props.id,\n\t\tname: props.name,\n\t\trequired: props.required,\n\t\ttabindex: props.disabled ? -1 : undefined,\n\t\ttype: 'radio',\n\t\tvalue: value,\n\t\t...eventListeners,\n\t};\n});\n\nconst slotAttributes = computed<SlotAttributes>(() => ({\n\tchecked: checked.value,\n\tdisabled: props.disabled,\n\tfocused: hasFocus.value,\n\thasErrors: props.hasErrors,\n\tid: props.id,\n\tname: props.name,\n\tparsedValue: inputAttributes.value.value,\n\treadonly: props.readonly,\n\trequired: props.required,\n\tvalue: props.value,\n}));\n\nconst iconAttributes = computed(() => {\n\tlet style: { [key: string]: string } = {};\n\tif (props.color && isCssColor(props.color)) {\n\t\tstyle.color = props.color;\n\t}\n\treturn {\n\t\tclass: 'bb-base-radio-container__icon',\n\t\tstyle,\n\t};\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseRadio';\n</style>\n"],"names":["props","__props","emit","__emit","checked","computed","hasFocus","ref","containerAttributes","attributes","isCssColor","makeInputValue","when","item","inputAttributes","value","eventListeners","event","slotAttributes","iconAttributes","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0GA,UAAMA,IAAQC,GAERC,IAAOC,GAMPC,IAAUC,EAAS,MACpBL,EAAM,UAAgB,KACnB,KAAK,UAAUA,EAAM,UAAU,MAAM,KAAK,UAAUA,EAAM,KAAK,CACtE,GACKM,IAAWC,EAAI,EAAK,GAEpBC,IAAsBH,EAAS,MAAM;AAC1C,YAAMI,IAAkC;AAAA,QACvC,OAAO;AAAA,UACN,iBAAiB;AAAA,UACjB,2BAA2BT,EAAM;AAAA,UACjC,yBAAyBA,EAAM;AAAA,UAC/B,2BAA2BA,EAAM;AAAA,UACjC,CAAC,kBAAkBA,EAAM,KAAK,EAAE,GAC/BA,EAAM,SAAS,CAACU,EAAWV,EAAM,KAAK;AAAA,QACxC;AAAA,MAAA;AAED,aAAIA,EAAM,SAASU,EAAWV,EAAM,KAAK,MACxCS,EAAW,QAAW,YAAYT,EAAM,KAAK,KAEvCS;AAAA,IAAA,CACP,GAMKE,IAAiBC;AAAA,MACtB,CAACC,MAAkB,OAAOA,KAAS;AAAA,MACnC,KAAK;AAAA,IAAA,GAGAC,IAAkBT,EAAS,MAAM;AAChC,YAAAU,IAAQJ,EAAeX,EAAM,KAAK,GAelCgB,IAAiB;AAAA,QACtB,QAdc,CAACC,MAA4B;AAC3C,UAAAX,EAAS,QAAQ,IACjBJ,EAAK,QAAQe,CAAK;AAAA,QAAA;AAAA,QAalB,UAXgB,CAACA,MAAuB;AACxC,UAAAf,EAAK,UAAUe,CAAK,GACff,EAAA,qBAAqBF,EAAM,KAAK;AAAA,QAAA;AAAA,QAUrC,SAAS,CAACiB,MAAsBf,EAAK,SAASe,CAAK;AAAA,QACnD,SATe,CAACA,MAA4B;AAC5C,UAAAX,EAAS,QAAQ,IACjBJ,EAAK,SAASe,CAAK;AAAA,QAAA;AAAA,QAQnB,SAAS,CAACA,MAAiBf,EAAK,SAASe,CAAK;AAAA,QAC9C,WAAW,CAACA,MAAyBf,EAAK,WAAWe,CAAK;AAAA,QAC1D,aAAa,CAACA,MAAsBf,EAAK,aAAae,CAAK;AAAA,QAC3D,WAAW,CAACA,MAAsBf,EAAK,WAAWe,CAAK;AAAA,MAAA;AAGjD,aAAA;AAAA,QACN,oBAAoBjB,EAAM;AAAA,QAC1B,WAAWA,EAAM;AAAA,QACjB,SAASI,EAAQ;AAAA;AAAA,QAEjB,UAAUJ,EAAM,YAAYA,EAAM;AAAA,QAClC,IAAIA,EAAM;AAAA,QACV,MAAMA,EAAM;AAAA,QACZ,UAAUA,EAAM;AAAA,QAChB,UAAUA,EAAM,WAAW,KAAK;AAAA,QAChC,MAAM;AAAA,QACN,OAAAe;AAAA,QACA,GAAGC;AAAA,MAAA;AAAA,IACJ,CACA,GAEKE,IAAiBb,EAAyB,OAAO;AAAA,MACtD,SAASD,EAAQ;AAAA,MACjB,UAAUJ,EAAM;AAAA,MAChB,SAASM,EAAS;AAAA,MAClB,WAAWN,EAAM;AAAA,MACjB,IAAIA,EAAM;AAAA,MACV,MAAMA,EAAM;AAAA,MACZ,aAAac,EAAgB,MAAM;AAAA,MACnC,UAAUd,EAAM;AAAA,MAChB,UAAUA,EAAM;AAAA,MAChB,OAAOA,EAAM;AAAA,IACZ,EAAA,GAEImB,IAAiBd,EAAS,MAAM;AACrC,UAAIe,IAAmC,CAAA;AACvC,aAAIpB,EAAM,SAASU,EAAWV,EAAM,KAAK,MACxCoB,EAAM,QAAQpB,EAAM,QAEd;AAAA,QACN,OAAO;AAAA,QACP,OAAAoB;AAAA,MAAA;AAAA,IACD,CACA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index28.js","sources":["../src/components/BaseNumberInput/BaseNumberInput.vue"],"sourcesContent":["<template>\n\t<CommonInputOuterContainer :class=\"classes\">\n\t\t<template #prepend-outer\n\t\t\t><slot\n\t\t\t\t:decrease=\"decrease\"\n\t\t\t\t:increase=\"increase\"\n\t\t\t\tname=\"prepend-outer\"\n\t\t\t></slot\n\t\t></template>\n\t\t<CommonInputInnerContainer\n\t\t\t:append:icon=\"props['append:icon']\"\n\t\t\t:prepend:icon=\"props['prepend:icon']\"\n\t\t>\n\t\t\t<template #prepend\n\t\t\t\t><slot :decrease=\"decrease\" :increase=\"increase\" name=\"prepend\"\n\t\t\t/></template>\n\t\t\t<template #prefix\n\t\t\t\t><slot :decrease=\"decrease\" :increase=\"increase\" name=\"prefix\"\n\t\t\t/></template>\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tref=\"input\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:autocomplete=\"autocomplete\"\n\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t:class=\"'bb-base-number-input__input'\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:inputmode=\"'decimal'\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:required=\"required\"\n\t\t\t\tsize=\"1\"\n\t\t\t\t:step=\"step\"\n\t\t\t\t:type=\"`text`\"\n\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t@input.stop=\"onInput\"\n\t\t\t/>\n\t\t\t<template #append\n\t\t\t\t><slot :decrease=\"decrease\" :increase=\"increase\" name=\"append\"\n\t\t\t/></template>\n\t\t\t<template #suffix\n\t\t\t\t><slot :decrease=\"decrease\" :increase=\"increase\" name=\"suffix\"\n\t\t\t/></template>\n\t\t</CommonInputInnerContainer>\n\t\t<template #append-outer\n\t\t\t><slot\n\t\t\t\t:decrease=\"decrease\"\n\t\t\t\t:increase=\"increase\"\n\t\t\t\tname=\"append-outer\"\n\t\t\t></slot\n\t\t></template>\n\t</CommonInputOuterContainer>\n</template>\n\n<script setup lang=\"ts\">\nimport { clamp } from '@/utilities/functions/clamp';\nimport { computed, onMounted, ref, watch } from 'vue';\nimport CommonInputInnerContainer from '../CommonInputInnerContainer.vue';\nimport CommonInputOuterContainer from '../CommonInputOuterContainer.vue';\nimport type { HTMLAttributes, InputHTMLAttributes } from 'vue';\n\nexport type BaseNumberInputProps = {\n\t/**\n\t * Name of the icon to be added at the end of the input.\n\t */\n\t// eslint-disable-next-line vue/prop-name-casing\n\t'append:icon'?: string;\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Sets the component in a loading state, usually triggering some visual styles.\n\t */\n\tloading?: boolean;\n\n\t/**\n\t * Maximum value cap\n\t */\n\tmax?: number;\n\n\t/**\n\t * Minimum value cap\n\t */\n\tmin?: number;\n\n\t/**\n\t * Used by v-model\n\t */\n\tmodelValue: number | string | null;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Name of the icon to be added at the start of the input.\n\t */\n\t// eslint-disable-next-line vue/prop-name-casing\n\t'prepend:icon'?: string;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * Incremental unit used in the exposed `increase`\n\t * and `decrease` function. It's NOT APPLIED to manual input as a step of 5\n\t * will prevent the user from inserting a value like `115` because of rounding down.\n\t */\n\tstep?: number;\n};\n\nconst props = withDefaults(defineProps<BaseNumberInputProps>(), {\n\tstep: 1,\n});\n\nexport type BaseNumberInputEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'decrease', value: number): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'increase', value: number): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: number | null): void;\n};\n\nconst emit = defineEmits<BaseNumberInputEvents>();\n\nexport type BaseNumberInputSlots = {\n\tprefix?: (props: object) => any;\n\tappend?: (props: {\n\t\tincrease: typeof increase;\n\t\tdecrease: typeof decrease;\n\t}) => any;\n\t'append-outer'?: (props: {\n\t\tincrease: typeof increase;\n\t\tdecrease: typeof decrease;\n\t}) => any;\n\tprepend?: (props: {\n\t\tincrease: typeof increase;\n\t\tdecrease: typeof decrease;\n\t}) => any;\n\t'prepend-outer'?: (props: {\n\t\tincrease: typeof increase;\n\t\tdecrease: typeof decrease;\n\t}) => any;\n\tsuffix?: (props: object) => any;\n};\n\ndefineSlots<BaseNumberInputSlots>();\n\nconst classes = computed(() => {\n\treturn {\n\t\t'bb-base-number-input': true,\n\t\t'bb-base-number-input--disabled': props.disabled,\n\t\t'bb-base-number-input--errors': props.hasErrors,\n\t\t'bb-base-number-input--loading': props.loading,\n\t\t'bb-base-number-input--readonly': props.readonly,\n\t};\n});\n\nconst input = ref<HTMLInputElement | null>(null);\nconst isInsertingSymbols = ref(false);\nconst decrease = () => {\n\tif (props.disabled || props.readonly || isInsertingSymbols.value) return;\n\tconst min = typeof props.min === 'undefined' ? -Infinity : props.min;\n\tconst max = typeof props.max === 'undefined' ? Infinity : props.max;\n\tlet valueToEmit = Math.max(Number(props.modelValue || 0) - props.step, min);\n\n\tvalueToEmit =\n\t\tvalueToEmit === null ? valueToEmit : clamp(valueToEmit, min, max);\n\temit('decrease', valueToEmit);\n\temit('update:modelValue', valueToEmit);\n};\n\nconst increase = () => {\n\tif (props.disabled || props.readonly || isInsertingSymbols.value) return;\n\tconst min = typeof props.min === 'undefined' ? -Infinity : props.min;\n\tconst max = typeof props.max === 'undefined' ? Infinity : props.max;\n\tlet valueToEmit = Math.min(Number(props.modelValue || 0) + +props.step, max);\n\n\tvalueToEmit =\n\t\tvalueToEmit === null ? valueToEmit : clamp(valueToEmit, min, max);\n\temit('increase', valueToEmit);\n\temit('update:modelValue', valueToEmit);\n};\n\ndefineExpose({\n\tincrease,\n\tdecrease,\n});\n\nconst onInput = (event: Event) => {\n\tif (event.target instanceof HTMLInputElement) {\n\t\tconst value = event.target.value;\n\t\tconst commaOrPeriod = /[,.]/g;\n\t\tconst matches = [...value.matchAll(commaOrPeriod)];\n\t\t/**\n\t\t * Proceed unless the user is pressing comma or period to insert a decimal number,\n\t\t * we do not want to replace the comma as soon as the user presses it\n\t\t */\n\t\tif (\n\t\t\t!(\n\t\t\t\tmatches.length === 1 &&\n\t\t\t\tmatches.some((match) => match.index === value.length - 1)\n\t\t\t) &&\n\t\t\t!(matches.length && value[value.length - 1] === '0') &&\n\t\t\tvalue !== '-'\n\t\t) {\n\t\t\tisInsertingSymbols.value = false;\n\t\t\tlet valueToEmit: null | number;\n\t\t\tif (event.target.value === '') {\n\t\t\t\tvalueToEmit = null;\n\t\t\t} else {\n\t\t\t\tvalueToEmit = makeValidNumberString(event.target.value);\n\t\t\t}\n\t\t\tconst min = typeof props.min === 'undefined' ? -Infinity : props.min;\n\t\t\tconst max = typeof props.max === 'undefined' ? Infinity : props.max;\n\t\t\tvalueToEmit =\n\t\t\t\tvalueToEmit === null ? valueToEmit : clamp(valueToEmit, min, max);\n\t\t\temit('update:modelValue', valueToEmit);\n\t\t\tif (input.value) {\n\t\t\t\tif (valueToEmit === null) {\n\t\t\t\t\tinput.value.value = '';\n\t\t\t\t} else {\n\t\t\t\t\tinput.value.value = `${valueToEmit}`;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tisInsertingSymbols.value = true;\n\t\t}\n\t\temit('input', event);\n\t}\n};\n\nconst makeValidNumberString = (value: string | number) => {\n\tif (typeof value === 'number') return value;\n\t// Replace comma with periods\n\tlet current = value.replaceAll(',', '.');\n\tlet preventDashes = current\n\t\t.slice(0, 1)\n\t\t.concat(current.slice(1).replaceAll('-', ''));\n\tlet noLetters = preventDashes.replaceAll(/[^\\d.-]/g, '');\n\tlet parts = noLetters.split('.');\n\tlet first = parts.slice(0, 1).join('') || 0;\n\tlet second = parts.slice(1).join('') || 0;\n\tlet unified = `${first}.${second}`;\n\treturn Number(unified);\n};\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: (event: Event) => emit('change', event),\n\tonClick: (event: MouseEvent) => emit('click', event),\n\tonFocus: (event: FocusEvent) => emit('focus', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n};\n\nconst alignInputToModelValue = (value?: string | number | null) => {\n\tif (input.value) {\n\t\tif (value === null || value === '' || value === undefined) {\n\t\t\tinput.value.value = '';\n\t\t} else if (typeof value !== 'undefined') {\n\t\t\tinput.value.value = makeValidNumberString(value).toString();\n\t\t}\n\t} else {\n\t\tconsole.error('Could not align input as it is not mounted');\n\t}\n};\nonMounted(() => {\n\talignInputToModelValue(props.modelValue);\n});\n/**\n * Allow modelValue to be passed as string (as sometimes happens from the server) and normalize it\n */\nwatch(() => props.modelValue, alignInputToModelValue);\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseNumberInput';\n</style>\n"],"names":["props","__props","emit","__emit","classes","computed","input","ref","isInsertingSymbols","decrease","min","max","valueToEmit","clamp","increase","__expose","onInput","event","value","commaOrPeriod","matches","match","makeValidNumberString","current","parts","first","second","unified","eventListeners","alignInputToModelValue","onMounted","watch"],"mappings":"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"}
|
package/dist/index280.js
CHANGED
|
@@ -1,129 +1,12 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return (n == null || (t = n.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
7
|
-
}
|
|
8
|
-
function S(n) {
|
|
9
|
-
var t;
|
|
10
|
-
return (t = (d(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : t.documentElement;
|
|
11
|
-
}
|
|
12
|
-
function d(n) {
|
|
13
|
-
return n instanceof Node || n instanceof i(n).Node;
|
|
14
|
-
}
|
|
15
|
-
function m(n) {
|
|
16
|
-
return n instanceof Element || n instanceof i(n).Element;
|
|
17
|
-
}
|
|
18
|
-
function p(n) {
|
|
19
|
-
return n instanceof HTMLElement || n instanceof i(n).HTMLElement;
|
|
20
|
-
}
|
|
21
|
-
function f(n) {
|
|
22
|
-
return typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof i(n).ShadowRoot;
|
|
23
|
-
}
|
|
24
|
-
function w(n) {
|
|
25
|
-
const {
|
|
26
|
-
overflow: t,
|
|
27
|
-
overflowX: e,
|
|
28
|
-
overflowY: o,
|
|
29
|
-
display: r
|
|
30
|
-
} = g(n);
|
|
31
|
-
return /auto|scroll|overlay|hidden|clip/.test(t + o + e) && !["inline", "contents"].includes(r);
|
|
32
|
-
}
|
|
33
|
-
function L(n) {
|
|
34
|
-
return ["table", "td", "th"].includes(l(n));
|
|
35
|
-
}
|
|
36
|
-
function E(n) {
|
|
37
|
-
return [":popover-open", ":modal"].some((t) => {
|
|
38
|
-
try {
|
|
39
|
-
return n.matches(t);
|
|
40
|
-
} catch {
|
|
41
|
-
return !1;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function N(n) {
|
|
46
|
-
const t = T(), e = m(n) ? g(n) : n;
|
|
47
|
-
return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (e.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (e.contain || "").includes(o));
|
|
48
|
-
}
|
|
49
|
-
function D(n) {
|
|
50
|
-
let t = u(n);
|
|
51
|
-
for (; p(t) && !y(t); ) {
|
|
52
|
-
if (N(t))
|
|
53
|
-
return t;
|
|
54
|
-
if (E(t))
|
|
55
|
-
return null;
|
|
56
|
-
t = u(t);
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
function T() {
|
|
61
|
-
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
62
|
-
}
|
|
63
|
-
function y(n) {
|
|
64
|
-
return ["html", "body", "#document"].includes(l(n));
|
|
65
|
-
}
|
|
66
|
-
function g(n) {
|
|
67
|
-
return i(n).getComputedStyle(n);
|
|
68
|
-
}
|
|
69
|
-
function k(n) {
|
|
70
|
-
return m(n) ? {
|
|
71
|
-
scrollLeft: n.scrollLeft,
|
|
72
|
-
scrollTop: n.scrollTop
|
|
73
|
-
} : {
|
|
74
|
-
scrollLeft: n.scrollX,
|
|
75
|
-
scrollTop: n.scrollY
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function u(n) {
|
|
79
|
-
if (l(n) === "html")
|
|
80
|
-
return n;
|
|
81
|
-
const t = (
|
|
82
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
83
|
-
n.assignedSlot || // DOM Element detected.
|
|
84
|
-
n.parentNode || // ShadowRoot detected.
|
|
85
|
-
f(n) && n.host || // Fallback.
|
|
86
|
-
S(n)
|
|
87
|
-
);
|
|
88
|
-
return f(t) ? t.host : t;
|
|
89
|
-
}
|
|
90
|
-
function b(n) {
|
|
91
|
-
const t = u(n);
|
|
92
|
-
return y(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : p(t) && w(t) ? t : b(t);
|
|
93
|
-
}
|
|
94
|
-
function a(n, t, e) {
|
|
95
|
-
var o;
|
|
96
|
-
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
97
|
-
const r = b(n), h = r === ((o = n.ownerDocument) == null ? void 0 : o.body), c = i(r);
|
|
98
|
-
if (h) {
|
|
99
|
-
const s = v(c);
|
|
100
|
-
return t.concat(c, c.visualViewport || [], w(r) ? r : [], s && e ? a(s) : []);
|
|
1
|
+
function u(e, i) {
|
|
2
|
+
const n = /* @__PURE__ */ new Set(), s = [];
|
|
3
|
+
for (let t = 0; t < e.length; t++) {
|
|
4
|
+
const o = e[t], c = i(o);
|
|
5
|
+
n.has(c) || (n.add(c), s.push(o));
|
|
101
6
|
}
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
function v(n) {
|
|
105
|
-
return Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
7
|
+
return s;
|
|
106
8
|
}
|
|
107
9
|
export {
|
|
108
|
-
|
|
109
|
-
D as getContainingBlock,
|
|
110
|
-
S as getDocumentElement,
|
|
111
|
-
v as getFrameElement,
|
|
112
|
-
b as getNearestOverflowAncestor,
|
|
113
|
-
l as getNodeName,
|
|
114
|
-
k as getNodeScroll,
|
|
115
|
-
a as getOverflowAncestors,
|
|
116
|
-
u as getParentNode,
|
|
117
|
-
i as getWindow,
|
|
118
|
-
N as isContainingBlock,
|
|
119
|
-
m as isElement,
|
|
120
|
-
p as isHTMLElement,
|
|
121
|
-
y as isLastTraversableNode,
|
|
122
|
-
d as isNode,
|
|
123
|
-
w as isOverflowElement,
|
|
124
|
-
f as isShadowRoot,
|
|
125
|
-
L as isTableElement,
|
|
126
|
-
E as isTopLayer,
|
|
127
|
-
T as isWebKit
|
|
10
|
+
u as uniqBy
|
|
128
11
|
};
|
|
129
12
|
//# sourceMappingURL=index280.js.map
|
package/dist/index280.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index280.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index280.js","sources":["../src/utilities/functions/uniqBy.ts"],"sourcesContent":["export function uniqBy<T, K>(array: T[], keyFn: (item: T) => K): T[] {\n\tconst seen = new Set<K>();\n\tconst result: T[] = [];\n\n\tfor (let i = 0; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tconst key = keyFn(item);\n\t\tif (!seen.has(key)) {\n\t\t\tseen.add(key);\n\t\t\tresult.push(item);\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"names":["uniqBy","array","keyFn","seen","result","i","item","key"],"mappings":"AAAgB,SAAAA,EAAaC,GAAYC,GAA4B;AAC9D,QAAAC,wBAAW,OACXC,IAAc,CAAA;AAEpB,WAASC,IAAI,GAAGA,IAAIJ,EAAM,QAAQI,KAAK;AAChC,UAAAC,IAAOL,EAAMI,CAAC,GACdE,IAAML,EAAMI,CAAI;AACtB,IAAKH,EAAK,IAAII,CAAG,MAChBJ,EAAK,IAAII,CAAG,GACZH,EAAO,KAAKE,CAAI;AAAA,EAElB;AAEO,SAAAF;AACR;"}
|
package/dist/index281.js
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
gap: { default: 0 }
|
|
8
|
-
},
|
|
9
|
-
setup(t) {
|
|
10
|
-
const a = t, n = i(() => `bb-slide-back-in-${a.direction}`);
|
|
11
|
-
return (e, c) => (r(), d(l, {
|
|
12
|
-
name: n.value,
|
|
13
|
-
style: s({ "--transition-duration": `${e.duration}ms`, "--gap": `${e.gap}px` })
|
|
14
|
-
}, {
|
|
15
|
-
default: u(() => [
|
|
16
|
-
p(e.$slots, "default", {}, void 0, !0)
|
|
17
|
-
]),
|
|
18
|
-
_: 3
|
|
19
|
-
}, 8, ["name", "style"]));
|
|
1
|
+
import { get as o } from "./index299.js";
|
|
2
|
+
const e = () => ({
|
|
3
|
+
getItemValue(n, f) {
|
|
4
|
+
if (typeof f > "u") return n;
|
|
5
|
+
if (typeof f == "function") return f(n);
|
|
6
|
+
if (typeof f == "string") return o(n, f);
|
|
20
7
|
}
|
|
21
8
|
});
|
|
22
9
|
export {
|
|
23
|
-
|
|
10
|
+
e as useItemValue
|
|
24
11
|
};
|
|
25
12
|
//# sourceMappingURL=index281.js.map
|
package/dist/index281.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index281.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index281.js","sources":["../src/composables/useItemValue.ts"],"sourcesContent":["import { get } from '@/utilities/functions/get';\n\nexport const useItemValue = () => ({\n\tgetItemValue<T>(item: T, getter?: string | ((item: T) => any)): any {\n\t\tif (typeof getter === 'undefined') return item;\n\t\tif (typeof getter === 'function') return getter(item);\n\t\tif (typeof getter === 'string') return get(item, getter as any);\n\t},\n});\n"],"names":["useItemValue","item","getter","get"],"mappings":";AAEO,MAAMA,IAAe,OAAO;AAAA,EAClC,aAAgBC,GAASC,GAA2C;AAC/D,QAAA,OAAOA,IAAW,IAAoB,QAAAD;AAC1C,QAAI,OAAOC,KAAW,WAAY,QAAOA,EAAOD,CAAI;AACpD,QAAI,OAAOC,KAAW,SAAiB,QAAAC,EAAIF,GAAMC,CAAa;AAAA,EAC/D;AACD;"}
|
package/dist/index282.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { get as t } from "./index299.js";
|
|
2
|
+
const o = () => ({
|
|
3
|
+
getItemText(r, n) {
|
|
4
|
+
if (typeof r == "string" && !n) return r;
|
|
5
|
+
if (n) {
|
|
6
|
+
if (typeof n == "function") {
|
|
7
|
+
let f = n(r);
|
|
8
|
+
return typeof f != "string" && (f = JSON.stringify(f)), f;
|
|
9
|
+
} else if (typeof n == "string") {
|
|
10
|
+
const f = t(r, n);
|
|
11
|
+
return typeof f == "string" ? f : JSON.stringify(f);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return JSON.stringify(r);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
o as useItemText
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index282.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index282.js","sources":["../src/composables/useItemText.ts"],"sourcesContent":["import { get } from '@/utilities/functions/get';\n\ntype NestedKeyOf<ObjectType extends object> = {\n\t[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object\n\t\t? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}`\n\t\t: `${Key}`;\n}[keyof ObjectType & (string | number)];\n\nexport type Path<T> = T extends object\n\t?\n\t\t\t| NestedKeyOf<T>\n\t\t\t| ((item: T) => string | number)\n\t\t\t| undefined\n\t\t\t| (string & Record<never, never>)\n\t: undefined;\n\nexport const useItemText = () => ({\n\tgetItemText<T>(item: T, getter?: Path<T>): string {\n\t\tif (typeof item === 'string' && !getter) return item;\n\t\telse if (getter) {\n\t\t\tif (typeof getter === 'function') {\n\t\t\t\tlet found = getter(item);\n\t\t\t\tif (typeof found !== 'string') found = JSON.stringify(found);\n\t\t\t\treturn found;\n\t\t\t} else if (typeof getter === 'string') {\n\t\t\t\tconst found = get(item, getter as any);\n\t\t\t\tif (typeof found === 'string') return found;\n\t\t\t\telse return JSON.stringify(found);\n\t\t\t}\n\t\t}\n\t\treturn JSON.stringify(item);\n\t},\n});\n"],"names":["useItemText","item","getter","found","get"],"mappings":";AAgBO,MAAMA,IAAc,OAAO;AAAA,EACjC,YAAeC,GAASC,GAA0B;AACjD,QAAI,OAAOD,KAAS,YAAY,CAACC,EAAe,QAAAD;AAAA,QACvCC;AACJ,UAAA,OAAOA,KAAW,YAAY;AAC7B,YAAAC,IAAQD,EAAOD,CAAI;AACvB,eAAI,OAAOE,KAAU,aAAkBA,IAAA,KAAK,UAAUA,CAAK,IACpDA;AAAA,MAAA,WACG,OAAOD,KAAW,UAAU;AAChC,cAAAC,IAAQC,EAAIH,GAAMC,CAAa;AACjC,eAAA,OAAOC,KAAU,WAAiBA,IAC1B,KAAK,UAAUA,CAAK;AAAA,MACjC;AAAA;AAEM,WAAA,KAAK,UAAUF,CAAI;AAAA,EAC3B;AACD;"}
|