bitboss-ui 0.1.2 → 0.1.4
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/BaseDatePicker/BaseDatePicker.vue.d.ts +1 -0
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +151 -0
- package/dist/components/BbPopover/BbPopover.vue.d.ts +96 -0
- package/dist/components/BbRatio/BbRatio.vue.d.ts +12 -0
- package/dist/components/BbSpinner/BbSpinner.vue.d.ts +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +104 -98
- package/dist/index.js.map +1 -1
- package/dist/index10.js +123 -95
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +43 -3
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +2 -2
- package/dist/index102.js +2 -2
- package/dist/index103.js +2 -2
- package/dist/index104.js +2 -2
- package/dist/index105.js +2 -2
- package/dist/index106.js +2 -2
- package/dist/index107.js +2 -2
- package/dist/index108.js +2 -2
- package/dist/index109.js +2 -2
- package/dist/index110.js +2 -2
- package/dist/index111.js +2 -2
- package/dist/index112.js +2 -2
- package/dist/index113.js +2 -2
- package/dist/index114.js +2 -2
- package/dist/index115.js +2 -2
- package/dist/index116.js +2 -2
- package/dist/index117.js +2 -2
- package/dist/index118.js +2 -2
- package/dist/index119.js +3 -2
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +4 -4
- package/dist/index120.js +2 -2
- package/dist/index121.js +3 -2
- package/dist/index121.js.map +1 -1
- package/dist/index123.js +2 -2
- package/dist/index124.js +2 -3
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +2 -2
- package/dist/index126.js +2 -3
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +2 -2
- package/dist/index128.js +2 -2
- package/dist/index129.js +3 -2
- package/dist/index129.js.map +1 -1
- package/dist/index130.js +2 -2
- package/dist/index131.js +2 -2
- package/dist/index132.js +2 -2
- package/dist/index133.js +2 -2
- package/dist/index134.js +2 -3
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +2 -2
- package/dist/index136.js +2 -2
- package/dist/index137.js +2 -2
- package/dist/index138.js +2 -2
- package/dist/index139.js +2 -2
- package/dist/index14.js +6 -6
- package/dist/index140.js +3 -2
- package/dist/index140.js.map +1 -1
- package/dist/index141.js +2 -2
- package/dist/index142.js +3 -2
- package/dist/index142.js.map +1 -1
- package/dist/index145.js +2 -2
- package/dist/index146.js +2 -3
- package/dist/index146.js.map +1 -1
- package/dist/index147.js +2 -2
- package/dist/index148.js +2 -3
- package/dist/index148.js.map +1 -1
- package/dist/index149.js +2 -2
- package/dist/index150.js +2 -2
- package/dist/index151.js +3 -2
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +3 -4
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +3 -8
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +3 -2
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +3 -2
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +3 -5
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +348 -17
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +131 -17
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +5 -29
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +1 -1
- package/dist/index160.js +19 -2
- package/dist/index160.js.map +1 -1
- package/dist/index162.js +2 -2
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +184 -14
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +2 -13
- package/dist/index164.js.map +1 -1
- package/dist/index165.js +23 -2
- package/dist/index165.js.map +1 -1
- package/dist/index166.js +328 -3
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +16 -2
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +12 -5
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +2 -350
- package/dist/index169.js.map +1 -1
- package/dist/index170.js +2 -134
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +2 -186
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +4 -23
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +8 -328
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +20 -2
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +29 -21
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +2 -3
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +3 -3
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +6 -38
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +2 -28
- package/dist/index179.js.map +1 -1
- package/dist/index18.js +2 -2
- package/dist/index180.js +2 -13
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +20 -8
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +3 -96
- package/dist/index182.js.map +1 -1
- package/dist/index183.js +3 -4
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +38 -295
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +9 -6
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +96 -2
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +28 -2
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +13 -2
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +6 -2
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +2 -235
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +294 -88
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +2 -2
- package/dist/index193.js +2 -117
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +111 -100
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +105 -78
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +4 -224
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +226 -249
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +2 -38
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +2 -2
- package/dist/index199.js.map +1 -1
- package/dist/index20.js +4 -4
- package/dist/index200.js +89 -2
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +79 -2
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +49 -8
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +223 -5
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +261 -0
- package/dist/index204.js.map +1 -0
- package/dist/index205.js +41 -0
- package/dist/index205.js.map +1 -0
- package/dist/index206.js +5 -0
- package/dist/index206.js.map +1 -0
- package/dist/index207.js +5 -0
- package/dist/index207.js.map +1 -0
- package/dist/index208.js +12 -0
- package/dist/index208.js.map +1 -0
- package/dist/index209.js +9 -0
- package/dist/index209.js.map +1 -0
- package/dist/index210.js +5 -0
- package/dist/index210.js.map +1 -0
- package/dist/index211.js +14 -0
- package/dist/index211.js.map +1 -0
- package/dist/index212.js +434 -0
- package/dist/index212.js.map +1 -0
- package/dist/index213.js +12 -0
- package/dist/index213.js.map +1 -0
- package/dist/index214.js +203 -0
- package/dist/index214.js.map +1 -0
- package/dist/index22.js +14 -14
- package/dist/index24.js +4 -4
- package/dist/index26.js +2 -2
- package/dist/index28.js +4 -4
- package/dist/index34.js +2 -2
- package/dist/index36.js +50 -37
- package/dist/index36.js.map +1 -1
- package/dist/index38.js +39 -39
- package/dist/index38.js.map +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.js +36 -82
- package/dist/index40.js.map +1 -1
- package/dist/index42.js +44 -57
- package/dist/index42.js.map +1 -1
- package/dist/index44.js +98 -79
- package/dist/index44.js.map +1 -1
- package/dist/index46.js +79 -81
- package/dist/index46.js.map +1 -1
- package/dist/index48.js +80 -40
- package/dist/index48.js.map +1 -1
- package/dist/index50.js +40 -283
- package/dist/index50.js.map +1 -1
- package/dist/index52.js +279 -95
- package/dist/index52.js.map +1 -1
- package/dist/index54.js +98 -212
- package/dist/index54.js.map +1 -1
- package/dist/index56.js +213 -44
- package/dist/index56.js.map +1 -1
- package/dist/index58.js +45 -40
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +2 -96
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +4 -4
- package/dist/index60.js +44 -2
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +89 -211
- package/dist/index61.js.map +1 -1
- package/dist/index63.js +210 -130
- package/dist/index63.js.map +1 -1
- package/dist/index65.js +134 -18
- package/dist/index65.js.map +1 -1
- package/dist/index67.js +145 -74
- package/dist/index67.js.map +1 -1
- package/dist/index69.js +18 -98
- package/dist/index69.js.map +1 -1
- package/dist/index71.js +77 -17
- package/dist/index71.js.map +1 -1
- package/dist/index73.js +48 -66
- package/dist/index73.js.map +1 -1
- package/dist/index75.js +21 -78
- package/dist/index75.js.map +1 -1
- package/dist/index77.js +77 -46
- package/dist/index77.js.map +1 -1
- package/dist/index79.js +44 -61
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +188 -181
- package/dist/index8.js.map +1 -1
- package/dist/index81.js +82 -106
- package/dist/index81.js.map +1 -1
- package/dist/index83.js +88 -370
- package/dist/index83.js.map +1 -1
- package/dist/index85.js +106 -74
- package/dist/index85.js.map +1 -1
- package/dist/index87.js +371 -68
- package/dist/index87.js.map +1 -1
- package/dist/index89.js +75 -111
- package/dist/index89.js.map +1 -1
- package/dist/index91.js +76 -87
- package/dist/index91.js.map +1 -1
- package/dist/index93.js +111 -32
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +2 -37
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +87 -42
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +2 -43
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +38 -3
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +37 -3
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +47 -3
- package/dist/index99.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index63.js
CHANGED
|
@@ -1,141 +1,221 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defineComponent as q, ref as s, useAttrs as G, computed as y, onMounted as L, onBeforeUnmount as J, watch as Q, openBlock as _, createBlock as X, Teleport as Y, createElementVNode as o, mergeProps as D, createElementBlock as z, renderSlot as l, createTextVNode as Z, toDisplayString as B, createCommentVNode as V } from "vue";
|
|
2
|
+
import { nanoid as N } from "./index176.js";
|
|
3
|
+
import { wait as O } from "./index164.js";
|
|
4
|
+
const ee = { class: "bb-offcanvas-close" }, te = { class: "bb-offcanvas-close__content" }, oe = { class: "bb-offcanvas-close__label" }, se = /* @__PURE__ */ o("span", { class: "bb-offcanvas-close__icon" }, [
|
|
5
|
+
/* @__PURE__ */ o("svg", {
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, [
|
|
10
|
+
/* @__PURE__ */ o("path", {
|
|
11
|
+
d: "M23 23L1 1M23 1L1 23",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
"stroke-width": "2",
|
|
14
|
+
"stroke-linecap": "round"
|
|
15
|
+
})
|
|
16
|
+
])
|
|
17
|
+
], -1), ae = /* @__PURE__ */ o("div", { style: { flex: "10000 10000 0%" } }, null, -1), re = /* @__PURE__ */ q({
|
|
18
|
+
__name: "BbOffCanvas",
|
|
5
19
|
props: {
|
|
6
|
-
|
|
20
|
+
closeLabel: { default: "Chiudi" },
|
|
21
|
+
compact: { type: Boolean },
|
|
22
|
+
description: {},
|
|
7
23
|
disabled: { type: Boolean },
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
eager: { type: Boolean },
|
|
25
|
+
fullscreen: { type: Boolean },
|
|
26
|
+
modelValue: { type: [Boolean, null] },
|
|
27
|
+
panelClasses: { default: () => [] },
|
|
28
|
+
overlayClasses: { default: () => [] },
|
|
29
|
+
persistent: { type: Boolean },
|
|
30
|
+
position: { default: "left" },
|
|
31
|
+
showClose: { type: Boolean, default: !0 },
|
|
32
|
+
size: { default: "sm" },
|
|
33
|
+
title: {},
|
|
34
|
+
transition: { default: "fade" },
|
|
35
|
+
transitionDuration: { default: 350 }
|
|
12
36
|
},
|
|
13
|
-
emits: ["update:modelValue"],
|
|
14
|
-
setup(
|
|
15
|
-
const e =
|
|
16
|
-
|
|
17
|
-
|
|
37
|
+
emits: ["shown", "hidden", "update:modelValue"],
|
|
38
|
+
setup(S, { emit: c }) {
|
|
39
|
+
const e = S, v = `title_${N()}`, h = `description_${N()}`, p = s(null), i = s(null), A = s(null), M = s(null), T = s(null), W = s(null), x = G(), R = y(() => e.closeLabel);
|
|
40
|
+
L(async () => {
|
|
41
|
+
document.addEventListener("keydown", E);
|
|
42
|
+
}), J(() => {
|
|
43
|
+
document.removeEventListener("keydown", E), document.removeEventListener("focus", F);
|
|
44
|
+
});
|
|
45
|
+
const u = s(!1), f = s(!1), g = s(!0), d = s(!1), k = s(e.eager || e.modelValue), C = s(null), w = y(() => f.value || d.value), E = (t) => {
|
|
46
|
+
w.value || u.value && !e.persistent && !e.disabled && t.key === "Escape" && c("update:modelValue", !1);
|
|
47
|
+
}, F = (t) => {
|
|
48
|
+
w.value || i.value && u.value && t.target instanceof Node && (i.value.contains(t.target) || (t.preventDefault(), i.value.focus()));
|
|
18
49
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const C = y(() => {
|
|
37
|
-
if (i.value <= 0 || isNaN(i.value) || i.value > Number.MAX_SAFE_INTEGER)
|
|
38
|
-
return [];
|
|
39
|
-
if (t.value <= 1)
|
|
40
|
-
return [e.modelValue];
|
|
41
|
-
if (i.value <= t.value)
|
|
42
|
-
return b(i.value, r.value);
|
|
43
|
-
const a = t.value % 2 === 0, l = a ? t.value / 2 : Math.floor(t.value / 2), n = a ? l : l + 1, v = i.value - l;
|
|
44
|
-
if (n - e.modelValue >= 0)
|
|
45
|
-
return [
|
|
46
|
-
...b(Math.max(1, t.value - 1), r.value),
|
|
47
|
-
e.ellipsis,
|
|
48
|
-
i.value
|
|
49
|
-
];
|
|
50
|
-
if (e.modelValue - v >= (a ? 1 : 0)) {
|
|
51
|
-
const s = t.value - 1, V = i.value - s + r.value;
|
|
52
|
-
return [
|
|
53
|
-
r.value,
|
|
54
|
-
e.ellipsis,
|
|
55
|
-
...b(s, V)
|
|
56
|
-
];
|
|
50
|
+
L(() => {
|
|
51
|
+
e.modelValue && $();
|
|
52
|
+
}), Q(
|
|
53
|
+
() => e.modelValue,
|
|
54
|
+
() => {
|
|
55
|
+
$();
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
const $ = async () => {
|
|
59
|
+
if (e.modelValue) {
|
|
60
|
+
k.value || (k.value = !0), document.activeElement && (C.value = document.activeElement), g.value = !1, d.value = !1, f.value = !0;
|
|
61
|
+
let t = Number(
|
|
62
|
+
document.body.dataset.openCanvases ?? "0"
|
|
63
|
+
);
|
|
64
|
+
t++, document.body.dataset.openCanvases = t.toString();
|
|
65
|
+
const a = window.innerWidth - document.documentElement.clientWidth;
|
|
66
|
+
document.body.style.overflow = "hidden", document.body.style.paddingRight = `${a}px`, await O(e.transitionDuration), f.value = !1, u.value = !0, c("shown"), i.value && i.value.focus();
|
|
57
67
|
} else {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
e.ellipsis,
|
|
64
|
-
i.value
|
|
65
|
-
];
|
|
68
|
+
f.value = !1, u.value = !1, d.value = !0, await O(e.transitionDuration);
|
|
69
|
+
let t = Number(
|
|
70
|
+
document.body.dataset.openCanvases ?? "0"
|
|
71
|
+
);
|
|
72
|
+
t--, document.body.dataset.openCanvases = t.toString(), t || (document.body.style.overflow = "auto", document.body.style.paddingRight = "0px"), d.value = !1, g.value = !0, c("hidden"), C.value instanceof HTMLElement && C.value.focus();
|
|
66
73
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
74
|
+
}, b = (t) => {
|
|
75
|
+
t.target === p.value && t.preventDefault();
|
|
76
|
+
}, H = (t) => {
|
|
77
|
+
e.disabled || w.value || p.value && t.target === p.value && (e.persistent || c("update:modelValue", !1));
|
|
78
|
+
}, I = () => {
|
|
79
|
+
e.disabled || c("update:modelValue", !1);
|
|
80
|
+
}, K = y(() => {
|
|
81
|
+
const t = [
|
|
82
|
+
{
|
|
83
|
+
"bb-offcanvas bb-offcanvas__overlay": !0,
|
|
84
|
+
"bb-offcanvas--fullscreen": e.fullscreen,
|
|
85
|
+
"bb-offcanvas--open": u.value,
|
|
86
|
+
"bb-offcanvas--opening": f.value,
|
|
87
|
+
"bb-offcanvas--closed": g.value,
|
|
88
|
+
"bb-offcanvas--closing": d.value,
|
|
89
|
+
[`bb-offcanvas--transition-${e.transition}`]: !0,
|
|
90
|
+
[`bb-offcanvas--${e.position}`]: !0
|
|
91
|
+
},
|
|
92
|
+
e.overlayClasses
|
|
93
|
+
].flat(), a = {
|
|
94
|
+
onClick: H,
|
|
95
|
+
onScroll: b,
|
|
96
|
+
onTouchmove: b,
|
|
97
|
+
onWheel: b,
|
|
98
|
+
onKeydown: b
|
|
99
|
+
}, n = {
|
|
100
|
+
transitionDuration: e.transitionDuration / 1e3 + "s"
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
class: t,
|
|
104
|
+
style: n,
|
|
105
|
+
...a,
|
|
106
|
+
...x
|
|
107
|
+
};
|
|
108
|
+
}), P = y(() => {
|
|
109
|
+
const t = [
|
|
110
|
+
{
|
|
111
|
+
"bb-offcanvas__panel": !0,
|
|
112
|
+
"bb-offcanvas__panel--compact": e.compact
|
|
113
|
+
},
|
|
114
|
+
e.panelClasses
|
|
115
|
+
].flat(), a = {
|
|
116
|
+
role: "dialog",
|
|
117
|
+
"aria-modal": !0,
|
|
118
|
+
"aria-labelledby": v
|
|
119
|
+
};
|
|
120
|
+
e.description && (a["aria-describedby"] = h);
|
|
121
|
+
let n, U, r;
|
|
122
|
+
const m = {
|
|
123
|
+
sm: 384,
|
|
124
|
+
md: 652,
|
|
125
|
+
lg: 896
|
|
126
|
+
};
|
|
127
|
+
e.position === "left" || e.position === "right" ? e.fullscreen ? n = "100%" : typeof e.size == "number" ? n = e.size + "px" : e.size in m ? n = m[e.size] + "px" : n = e.size + "px" : e.fullscreen ? r = "100%" : typeof e.size == "number" ? r = e.size + "px" : e.size in m ? r = m[e.size] + "px" : Number.isNaN(Number(e.size)) ? e.size === "auto" && (r = "auto") : r = e.size + "px";
|
|
128
|
+
const j = {
|
|
129
|
+
maxWidth: n,
|
|
130
|
+
maxHeight: U,
|
|
131
|
+
height: r,
|
|
132
|
+
transitionDuration: e.transitionDuration / 1e3 + "s"
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
class: t,
|
|
136
|
+
style: j,
|
|
137
|
+
...a
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
return (t, a) => (_(), X(Y, { to: "body" }, [
|
|
141
|
+
o("div", D(K.value, {
|
|
142
|
+
ref_key: "overlay",
|
|
143
|
+
ref: p
|
|
144
|
+
}), [
|
|
145
|
+
o("div", D(P.value, {
|
|
146
|
+
ref_key: "panel",
|
|
147
|
+
ref: i
|
|
148
|
+
}), [
|
|
149
|
+
k.value ? (_(), z("div", {
|
|
150
|
+
key: 0,
|
|
151
|
+
class: "bb-offcanvas__content",
|
|
152
|
+
ref_key: "content",
|
|
153
|
+
ref: A
|
|
154
|
+
}, [
|
|
155
|
+
l(t.$slots, "content", {}, () => [
|
|
156
|
+
o("div", {
|
|
157
|
+
class: "bb-offcanvas__header",
|
|
158
|
+
ref_key: "header",
|
|
159
|
+
ref: M
|
|
160
|
+
}, [
|
|
161
|
+
l(t.$slots, "header", { titleId: v }, () => [
|
|
162
|
+
o("span", {
|
|
163
|
+
class: "bb-offcanvas__title",
|
|
164
|
+
id: v
|
|
165
|
+
}, [
|
|
166
|
+
l(t.$slots, "title", { titleId: v }, () => [
|
|
167
|
+
Z(B(t.title), 1)
|
|
168
|
+
])
|
|
169
|
+
]),
|
|
170
|
+
o("span", ee, [
|
|
171
|
+
t.showClose ? (_(), z("button", {
|
|
172
|
+
key: 0,
|
|
173
|
+
onClick: I,
|
|
174
|
+
type: "button"
|
|
175
|
+
}, [
|
|
176
|
+
l(t.$slots, "close", {}, () => [
|
|
177
|
+
o("span", te, [
|
|
178
|
+
o("span", oe, B(R.value), 1),
|
|
179
|
+
se
|
|
180
|
+
])
|
|
181
|
+
])
|
|
182
|
+
])) : V("", !0)
|
|
183
|
+
])
|
|
184
|
+
])
|
|
185
|
+
], 512),
|
|
186
|
+
o("div", {
|
|
187
|
+
class: "bb-offcanvas__body",
|
|
188
|
+
ref_key: "body",
|
|
189
|
+
ref: T
|
|
190
|
+
}, [
|
|
191
|
+
l(t.$slots, "description", {
|
|
192
|
+
descriptionId: h,
|
|
193
|
+
description: t.description
|
|
194
|
+
}, () => [
|
|
195
|
+
t.description ? (_(), z("div", {
|
|
196
|
+
key: 0,
|
|
197
|
+
id: h,
|
|
198
|
+
class: "bb-offcanvas__description"
|
|
199
|
+
}, B(t.description), 1)) : V("", !0)
|
|
200
|
+
]),
|
|
201
|
+
l(t.$slots, "default")
|
|
202
|
+
], 512),
|
|
203
|
+
ae,
|
|
204
|
+
o("div", {
|
|
205
|
+
class: "bb-offcanvas__footer",
|
|
206
|
+
ref_key: "footer",
|
|
207
|
+
ref: W
|
|
208
|
+
}, [
|
|
209
|
+
l(t.$slots, "footer")
|
|
210
|
+
], 512)
|
|
211
|
+
])
|
|
212
|
+
], 512)) : V("", !0)
|
|
213
|
+
], 16)
|
|
214
|
+
], 16)
|
|
215
|
+
]));
|
|
136
216
|
}
|
|
137
217
|
});
|
|
138
218
|
export {
|
|
139
|
-
|
|
219
|
+
re as default
|
|
140
220
|
};
|
|
141
221
|
//# sourceMappingURL=index63.js.map
|
package/dist/index63.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index63.js","sources":["../src/components/BbPagination/BbPagination.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass } from \"vue\"\n\nconst _hoisted_1 = { \"aria-label\": \"Navigazione\" }\nconst _hoisted_2 = [\"disabled\"]\nconst _hoisted_3 = [\"onClick\", \"disabled\"]\nconst _hoisted_4 = [\"disabled\"]\n\nimport { debounce } from \"@/utilities/functions/debounce\";\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nexport interface BbPaginationProps {\n modelValue?: number;\n disabled?: boolean;\n totalPages?: number | string;\n maxSize?: number | string;\n ellipsis?: string;\n loading?: boolean;\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BbPagination',\n props: {\n modelValue: { default: 1 },\n disabled: { type: Boolean },\n totalPages: { default: 1 },\n maxSize: { default: 5 },\n ellipsis: { default: \"...\" },\n loading: { type: Boolean }\n },\n emits: [\"update:modelValue\"],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n\n\nconst totalPages = computed(() => +props.totalPages);\nconst start = ref(1);\nconst maxSize = ref(+props.maxSize);\n\nconst outercontainer = ref<HTMLElement>();\nconst innercontainer = ref<HTMLElement>();\n\nconst buttonFootprint = ref<number>(Infinity);\n\n/** \n* Adjusts how many buttons to show.\n* if current buttons can't fit subtract maxSize until they do or until minimum is reached\n* if more buttons could fit add buttons until the don't\n* If minimum or maximum is reached just quit until next resize\n*/\nconst adjustMaxElements = () => {\n if (outercontainer.value && innercontainer.value) {\n /* If some buttons do not fit */\n if (outercontainer.value.clientWidth < innercontainer.value.clientWidth) {\n if (maxSize.value - 1 > 3) {\n maxSize.value--;\n nextTick(adjustMaxElements);\n } else {\n maxSize.value = 3;\n }\n /* If all current buttons do fit */\n } else {\n /* If some buttons have been hidden */\n if (maxSize.value < +props.maxSize) {\n if (\n /* If there is enought space to fit one */\n outercontainer.value.clientWidth - innercontainer.value.clientWidth >\n buttonFootprint.value\n ) {\n maxSize.value = Math.min(maxSize.value + 1, +props.maxSize);\n nextTick(adjustMaxElements);\n }\n }\n }\n }\n};\nif(globalThis.ResizeObserver) {\n const observer = new ResizeObserver(debounce(adjustMaxElements, 200));\n onMounted(() => {\n if (outercontainer.value && innercontainer.value) {\n const button = outercontainer.value.querySelectorAll(\n \".base-pagination__page\"\n )[1];\n if (button) {\n /* Compute the footprint necessary to render a new button */\n const gapString = getComputedStyle(innercontainer.value).columnGap;\n const numberAsString = gapString.replaceAll(/\\D/g, \"\");\n const gap = Number(numberAsString);\n buttonFootprint.value = button.clientWidth + gap;\n }\n observer.observe(outercontainer.value);\n }\n });\n onBeforeUnmount(() => {\n observer.disconnect()\n })\n}\n\nconst range = computed(() => {\n if (\n totalPages.value <= 0 ||\n isNaN(totalPages.value) ||\n totalPages.value > Number.MAX_SAFE_INTEGER\n )\n return [];\n\n if (maxSize.value <= 1) return [props.modelValue];\n\n if (totalPages.value <= maxSize.value) {\n return createRange(totalPages.value, start.value);\n }\n\n const even = maxSize.value % 2 === 0;\n const middle = even ? maxSize.value / 2 : Math.floor(maxSize.value / 2);\n const left = even ? middle : middle + 1;\n const right = totalPages.value - middle;\n\n if (left - props.modelValue >= 0) {\n return [\n ...createRange(Math.max(1, maxSize.value - 1), start.value),\n props.ellipsis,\n totalPages.value,\n ];\n } else if (props.modelValue - right >= (even ? 1 : 0)) {\n const rangeLength = maxSize.value - 1;\n const rangeStart = totalPages.value - rangeLength + start.value;\n return [\n start.value,\n props.ellipsis,\n ...createRange(rangeLength, rangeStart),\n ];\n } else {\n const rangeLength = Math.max(1, maxSize.value - 3);\n const rangeStart =\n rangeLength === 1\n ? props.modelValue\n : props.modelValue - Math.ceil(rangeLength / 2) + start.value;\n return [\n start.value,\n props.ellipsis,\n ...createRange(rangeLength, rangeStart),\n props.ellipsis,\n totalPages.value,\n ];\n }\n});\n\nconst items = computed(() => {\n return range.value.map((item, index) => {\n if (typeof item === \"string\") {\n return {\n active: false,\n key: `ellipsis-${index}`,\n page: item,\n ellipsis: true,\n icon: true,\n disabled: true,\n };\n } else {\n const active = item === props.modelValue;\n return {\n active,\n key: item,\n page: item,\n ellipsis: false,\n icon: true,\n disabled: !!props.disabled || +props.totalPages < 2 || props.loading,\n };\n }\n });\n});\n\nconst createRange = (length: number, start = 0): number[] => {\n return Array.from({ length }, (_, k) => start + k);\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n class: \"base-pagination\",\n ref_key: \"outercontainer\",\n ref: outercontainer\n }, [\n _createElementVNode(\"nav\", _hoisted_1, [\n _createElementVNode(\"ul\", {\n class: \"base-pagination__pages\",\n ref_key: \"innercontainer\",\n ref: innercontainer\n }, [\n _createElementVNode(\"li\", null, [\n _createElementVNode(\"button\", {\n class: \"base-pagination__page base-pagination__page--previous\",\n onClick: _cache[0] || (_cache[0] = ($event: any) => (emit('update:modelValue', props.modelValue - 1))),\n disabled: props.modelValue <= 1 || _ctx.loading || _ctx.disabled\n }, [\n _renderSlot(_ctx.$slots, \"previous\", {}, () => [\n _createTextVNode(\"Precedente\")\n ])\n ], 8, _hoisted_2)\n ]),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items.value, (item) => {\n return (_openBlock(), _createElementBlock(\"li\", null, [\n _createElementVNode(\"button\", {\n class: _normalizeClass([\"base-pagination__page\", {\n 'base-pagination__page--active': item.active,\n 'base-pagination__page--ellipsis': item.ellipsis,\n }]),\n onClick: ($event: any) => (emit('update:modelValue', item.key)),\n disabled: item.disabled\n }, [\n _renderSlot(_ctx.$slots, \"item\", {}, () => [\n (item.ellipsis)\n ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [\n _createTextVNode(_toDisplayString(props.ellipsis), 1)\n ], 64))\n : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [\n _createTextVNode(_toDisplayString(item.key), 1)\n ], 64))\n ])\n ], 10, _hoisted_3)\n ]))\n }), 256)),\n _createElementVNode(\"li\", null, [\n _createElementVNode(\"button\", {\n class: \"base-pagination__page base-pagination__page--next\",\n onClick: _cache[1] || (_cache[1] = ($event: any) => (emit('update:modelValue', props.modelValue + 1))),\n disabled: props.modelValue >= +totalPages.value || _ctx.loading || _ctx.disabled\n }, [\n _renderSlot(_ctx.$slots, \"previous\", {}, () => [\n _createTextVNode(\"Successivi\")\n ])\n ], 8, _hoisted_4)\n ])\n ], 512)\n ])\n ], 512))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_sfc_main","_defineComponent","__props","emit","props","totalPages","computed","start","ref","maxSize","outercontainer","innercontainer","buttonFootprint","adjustMaxElements","nextTick","observer","debounce","onMounted","button","numberAsString","gap","onBeforeUnmount","range","createRange","even","middle","left","right","rangeLength","rangeStart","items","item","index","length","_","k","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","$event","_renderSlot","_createTextVNode","_Fragment","_renderList","_normalizeClass","_toDisplayString"],"mappings":";;AAGA,MAAMA,IAAa,EAAE,cAAc,iBAC7BC,IAAa,CAAC,UAAU,GACxBC,IAAa,CAAC,WAAW,UAAU,GACnCC,IAAa,CAAC,UAAU,GAeFC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,YAAY,EAAE,SAAS,EAAE;AAAA,IACzB,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,YAAY,EAAE,SAAS,EAAE;AAAA,IACzB,SAAS,EAAE,SAAS,EAAE;AAAA,IACtB,UAAU,EAAE,SAAS,MAAM;AAAA,IAC3B,SAAS,EAAE,MAAM,QAAQ;AAAA,EAC3B;AAAA,EACA,OAAO,CAAC,mBAAmB;AAAA,EAC3B,MAAMC,GAAc,EAAE,MAAAC,KAAQ;AAEhC,UAAMC,IAAQF,GAMRG,IAAaC,EAAS,MAAM,CAACF,EAAM,UAAU,GAC7CG,IAAQC,EAAI,CAAC,GACbC,IAAUD,EAAI,CAACJ,EAAM,OAAO,GAE5BM,IAAiBF,KACjBG,IAAiBH,KAEjBI,IAAkBJ,EAAY,KAAQ,GAQtCK,IAAoB,MAAM;AAC1B,MAAAH,EAAe,SAASC,EAAe,UAErCD,EAAe,MAAM,cAAcC,EAAe,MAAM,cACtDF,EAAQ,QAAQ,IAAI,KACdA,EAAA,SACRK,EAASD,CAAiB,KAE1BJ,EAAQ,QAAQ,IAKdA,EAAQ,QAAQ,CAACL,EA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,GAAW,EAAE,KAAK,KAAK;AAAA,kBACxDD,EAAiBI,EAAiBhB,EAAK,GAAG,GAAG,CAAC;AAAA,mBAC7C,EAAE;AAAA,cAAA,CACV;AAAA,YAAA,GACA,IAAIjC,CAAU;AAAA,UAAA,CAClB,EACF,GAAG,GAAG;AAAA,UACP0C,EAAoB,MAAM,MAAM;AAAA,YAC9BA,EAAoB,UAAU;AAAA,cAC5B,OAAO;AAAA,cACP,SAASH,EAAO,CAAC,MAAMA,EAAO,CAAC,IAAI,CAACI,MAAiBtC,EAAK,qBAAqBC,EAAM,aAAa,CAAC;AAAA,cACnG,UAAUA,EAAM,cAAc,CAACC,EAAW,SAAS+B,EAAK,WAAWA,EAAK;AAAA,YAAA,GACvE;AAAA,cACDM,EAAYN,EAAK,QAAQ,YAAY,IAAI,MAAM;AAAA,gBAC7CO,EAAiB,YAAY;AAAA,cAAA,CAC9B;AAAA,YAAA,GACA,GAAG5C,CAAU;AAAA,UAAA,CACjB;AAAA,WACA,GAAG;AAAA,MAAA,CACP;AAAA,OACA,GAAG;AAAA,EAER;AAEA,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index63.js","sources":["../src/components/BbOffCanvas/BbOffCanvas.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, mergeProps as _mergeProps, Teleport as _Teleport, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-offcanvas-close\" }\nconst _hoisted_2 = { class: \"bb-offcanvas-close__content\" }\nconst _hoisted_3 = { class: \"bb-offcanvas-close__label\" }\nconst _hoisted_4 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"bb-offcanvas-close__icon\" }, [\n /*#__PURE__*/_createElementVNode(\"svg\", {\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, [\n /*#__PURE__*/_createElementVNode(\"path\", {\n d: \"M23 23L1 1M23 1L1 23\",\n stroke: \"currentColor\",\n \"stroke-width\": \"2\",\n \"stroke-linecap\": \"round\"\n })\n ])\n], -1)\nconst _hoisted_5 = /*#__PURE__*/_createElementVNode(\"div\", { style: {\"flex\":\"10000 10000 0%\"} }, null, -1)\n\nimport { nanoid } from \"nanoid\";\nimport { wait } from \"@/utilities/functions/wait\";\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport BbIcon from \"../BbIcon/BbIcon.vue\";\nimport type { Classes } from \"@/types/Classes\";\n\nexport type Sizes = {\n sm: number;\n md: number;\n lg: number;\n};\n\nexport interface BbOffCanvasProps {\n closeLabel?: string;\n compact?: boolean;\n description?: string;\n disabled?: boolean;\n eager?: boolean;\n fullscreen?: boolean;\n modelValue?: boolean | null;\n panelClasses?: Classes;\n overlayClasses?: Classes;\n persistent?: boolean;\n position?: \"left\" | \"top\" | \"right\" | \"bottom\";\n showClose?: boolean;\n size?: keyof Sizes | string | number;\n title?: string;\n transition?: string;\n transitionDuration?: number;\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BbOffCanvas',\n props: {\n closeLabel: { default: \"Chiudi\" },\n compact: { type: Boolean },\n description: {},\n disabled: { type: Boolean },\n eager: { type: Boolean },\n fullscreen: { type: Boolean },\n modelValue: { type: [Boolean, null] },\n panelClasses: { default: () => [] },\n overlayClasses: { default: () => [] },\n persistent: { type: Boolean },\n position: { default: \"left\" },\n showClose: { type: Boolean, default: true },\n size: { default: \"sm\" },\n title: {},\n transition: { default: \"fade\" },\n transitionDuration: { default: 350 }\n },\n emits: [\"shown\", \"hidden\", \"update:modelValue\"],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n\n\nconst titleId = `title_${nanoid()}`;\nconst descriptionId = `description_${nanoid()}`;\n\nconst overlay = ref<HTMLElement | null>(null);\nconst panel = ref<HTMLElement | null>(null);\nconst content = ref<HTMLElement | null>(null);\nconst header = ref<HTMLElement | null>(null);\nconst body = ref<HTMLElement | null>(null);\nconst footer = ref<HTMLElement | null>(null);\nconst attrs = useAttrs();\n\nconst closeLabel = computed(() => props.closeLabel);\n\nonMounted(async () => {\n document.addEventListener(\"keydown\", onEsc);\n});\nonBeforeUnmount(() => {\n document.removeEventListener(\"keydown\", onEsc);\n document.removeEventListener(\"focus\", onFocus);\n});\n\nconst open = ref(false);\nconst opening = ref(false);\nconst closed = ref(true);\nconst closing = ref(false);\nconst hasRenderedAtLeastOnce = ref(props.eager || props.modelValue);\nconst lastFocusedElement = ref<Element | null>(null);\n\nconst busy = computed(() => opening.value || closing.value);\n\n/**\n * Listen to esc key and close the modal.\n * If disabled the modal can only be controlled from outside.\n * If persistent ignore escape key.\n */\nconst onEsc = (event: KeyboardEvent) => {\n if (busy.value) return;\n if (open.value) {\n if (!props.persistent && !props.disabled) {\n if (event.key === \"Escape\") {\n emit(\"update:modelValue\", false);\n }\n }\n }\n};\n\n/**\n * Every time focus changes if the focussed element is not in the modal\n * bring the focus to the modal itself (This makes\n * the focus cycle among the content of the modal)\n */\nconst onFocus = (event: FocusEvent) => {\n if (busy.value) return;\n if (panel.value && open.value) {\n if (event.target instanceof Node) {\n if (!panel.value.contains(event.target)) {\n event.preventDefault();\n panel.value.focus();\n }\n }\n }\n};\n\nonMounted(() => {\n if (props.modelValue) {\n alignToModelValue();\n }\n});\n\n/**\n * Every time modelValue changes align the display to it\n */\nwatch(\n () => props.modelValue,\n () => {\n alignToModelValue();\n }\n);\n\n/**\n * When modelValue becomes true if the component wasn't rendered render it\n * and wait for it to be on the page (or transitions would not work).\n * Stash the latest focused element so we can return it later when it closes.\n * Focus on the panel upon opening.\n * ---\n * Notice all interactions update modelValue and then this function aligns the display to it\n */\nconst alignToModelValue = async () => {\n if (props.modelValue) {\n if (!hasRenderedAtLeastOnce.value) {\n hasRenderedAtLeastOnce.value = true;\n }\n if (document.activeElement) {\n lastFocusedElement.value = document.activeElement;\n }\n\n closed.value = false;\n closing.value = false;\n opening.value = true;\n\n // This prevents overscroll chaining (additional scrolling to the body when the modal has been completely scrolled)\n\n let currentlyOpenCanvases = Number(\n document.body.dataset[\"openCanvases\"] ?? \"0\"\n );\n currentlyOpenCanvases++;\n document.body.dataset[\"openCanvases\"] = currentlyOpenCanvases.toString();\n const scrollBarWidth =\n window.innerWidth - document.documentElement.clientWidth;\n document.body.style.overflow = \"hidden\";\n document.body.style.paddingRight = `${scrollBarWidth}px`;\n\n await wait(props.transitionDuration);\n\n opening.value = false;\n open.value = true;\n emit(\"shown\");\n if (panel.value) {\n panel.value.focus();\n }\n } else {\n opening.value = false;\n open.value = false;\n closing.value = true;\n\n await wait(props.transitionDuration);\n\n let currentlyOpenCanvases = Number(\n document.body.dataset[\"openCanvases\"] ?? \"0\"\n );\n // This prevents overscroll chaining (additional scrolling to the body when the modal has been completely scrolled)\n currentlyOpenCanvases--;\n document.body.dataset[\"openCanvases\"] = currentlyOpenCanvases.toString();\n if (!currentlyOpenCanvases) {\n document.body.style.overflow = \"auto\";\n document.body.style.paddingRight = \"0px\";\n }\n closing.value = false;\n closed.value = true;\n emit(\"hidden\");\n if (lastFocusedElement.value instanceof HTMLElement) {\n lastFocusedElement.value.focus();\n }\n }\n};\n\n/**\n * Disable scrolling\n */\nconst onOverlayScroll = (event: UIEvent) => {\n if (event.target === overlay.value) {\n event.preventDefault();\n }\n};\n\n/**\n * Close the modal on overlay click if not persistent\n */\nconst onOverlayClick = (event: MouseEvent) => {\n if (props.disabled || busy.value) return;\n if (overlay.value) {\n if (event.target === overlay.value) {\n if (!props.persistent) {\n emit(\"update:modelValue\", false);\n }\n }\n }\n};\n\n/**\n * On click on the X button\n */\nconst onCloseClick = () => {\n if (props.disabled) return;\n emit(\"update:modelValue\", false);\n};\n\nconst overlayAttributes = computed(() => {\n const classes = [\n {\n \"bb-offcanvas bb-offcanvas__overlay\": true,\n \"bb-offcanvas--fullscreen\": props.fullscreen,\n \"bb-offcanvas--open\": open.value,\n \"bb-offcanvas--opening\": opening.value,\n \"bb-offcanvas--closed\": closed.value,\n \"bb-offcanvas--closing\": closing.value,\n [`bb-offcanvas--transition-${props.transition}`]: true,\n [`bb-offcanvas--${props.position}`]: true,\n },\n props.overlayClasses,\n ].flat();\n const eventListeners = {\n onClick: onOverlayClick,\n onScroll: onOverlayScroll,\n onTouchmove: onOverlayScroll,\n onWheel: onOverlayScroll,\n onKeydown: onOverlayScroll,\n };\n\n const style = {\n transitionDuration: props.transitionDuration / 1000 + \"s\",\n };\n return {\n class: classes,\n style,\n ...eventListeners,\n ...attrs,\n };\n});\n\nconst panelAttributes = computed(() => {\n const classes = [\n {\n \"bb-offcanvas__panel\": true,\n \"bb-offcanvas__panel--compact\": props.compact,\n },\n props.panelClasses,\n ].flat();\n\n const accessibilityAttrs: {\n [key: string]: string | boolean;\n } = {\n role: \"dialog\",\n \"aria-modal\": true,\n \"aria-labelledby\": titleId,\n };\n if (props.description) accessibilityAttrs[\"aria-describedby\"] = descriptionId;\n\n let maxWidth;\n let maxHeight;\n let height;\n const sizes: Sizes = {\n sm: 384,\n md: 652,\n lg: 896,\n };\n if (props.position === \"left\" || props.position === \"right\") {\n if (props.fullscreen) maxWidth = \"100%\";\n else if (typeof props.size === \"number\") maxWidth = props.size + \"px\";\n else if (props.size in sizes)\n maxWidth = sizes[props.size as keyof Sizes] + \"px\";\n else maxWidth = props.size + \"px\";\n } else {\n if (props.fullscreen) height = \"100%\";\n else if (typeof props.size === \"number\") height = props.size + \"px\";\n else if (props.size in sizes)\n height = sizes[props.size as keyof Sizes] + \"px\";\n else if (!Number.isNaN(Number(props.size))) height = props.size + \"px\";\n else if (props.size === \"auto\") height = \"auto\";\n }\n\n const style = {\n maxWidth,\n maxHeight,\n height,\n transitionDuration: props.transitionDuration / 1000 + \"s\",\n };\n\n return {\n class: classes,\n style,\n ...accessibilityAttrs,\n };\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createBlock(_Teleport, { to: \"body\" }, [\n _createElementVNode(\"div\", _mergeProps(overlayAttributes.value, {\n ref_key: \"overlay\",\n ref: overlay\n }), [\n _createElementVNode(\"div\", _mergeProps(panelAttributes.value, {\n ref_key: \"panel\",\n ref: panel\n }), [\n (hasRenderedAtLeastOnce.value)\n ? (_openBlock(), _createElementBlock(\"div\", {\n key: 0,\n class: \"bb-offcanvas__content\",\n ref_key: \"content\",\n ref: content\n }, [\n _renderSlot(_ctx.$slots, \"content\", {}, () => [\n _createElementVNode(\"div\", {\n class: \"bb-offcanvas__header\",\n ref_key: \"header\",\n ref: header\n }, [\n _renderSlot(_ctx.$slots, \"header\", { titleId: titleId }, () => [\n _createElementVNode(\"span\", {\n class: \"bb-offcanvas__title\",\n id: titleId\n }, [\n _renderSlot(_ctx.$slots, \"title\", { titleId: titleId }, () => [\n _createTextVNode(_toDisplayString(_ctx.title), 1)\n ])\n ]),\n _createElementVNode(\"span\", _hoisted_1, [\n (_ctx.showClose)\n ? (_openBlock(), _createElementBlock(\"button\", {\n key: 0,\n onClick: onCloseClick,\n type: \"button\"\n }, [\n _renderSlot(_ctx.$slots, \"close\", {}, () => [\n _createElementVNode(\"span\", _hoisted_2, [\n _createElementVNode(\"span\", _hoisted_3, _toDisplayString(closeLabel.value), 1),\n _hoisted_4\n ])\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ])\n ])\n ], 512),\n _createElementVNode(\"div\", {\n class: \"bb-offcanvas__body\",\n ref_key: \"body\",\n ref: body\n }, [\n _renderSlot(_ctx.$slots, \"description\", {\n descriptionId: descriptionId,\n description: _ctx.description\n }, () => [\n (_ctx.description)\n ? (_openBlock(), _createElementBlock(\"div\", {\n key: 0,\n id: descriptionId,\n class: \"bb-offcanvas__description\"\n }, _toDisplayString(_ctx.description), 1))\n : _createCommentVNode(\"\", true)\n ]),\n _renderSlot(_ctx.$slots, \"default\")\n ], 512),\n _hoisted_5,\n _createElementVNode(\"div\", {\n class: \"bb-offcanvas__footer\",\n ref_key: \"footer\",\n ref: footer\n }, [\n _renderSlot(_ctx.$slots, \"footer\")\n ], 512)\n ])\n ], 512))\n : _createCommentVNode(\"\", true)\n ], 16)\n ], 16)\n ]))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_createElementVNode","_hoisted_5","_sfc_main","_defineComponent","__props","emit","props","titleId","nanoid","descriptionId","overlay","ref","panel","content","header","body","footer","attrs","useAttrs","closeLabel","computed","onMounted","onEsc","onBeforeUnmount","onFocus","open","opening","closed","closing","hasRenderedAtLeastOnce","lastFocusedElement","busy","event","alignToModelValue","watch","currentlyOpenCanvases","scrollBarWidth","wait","onOverlayScroll","onOverlayClick","onCloseClick","overlayAttributes","classes","eventListeners","style","panelAttributes","accessibilityAttrs","maxWidth","maxHeight","height","sizes","_ctx","_cache","_openBlock","_createBlock","_Teleport","_mergeProps","_createElementBlock","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode"],"mappings":";;;AAGA,MAAMA,KAAa,EAAE,OAAO,wBACtBC,KAAa,EAAE,OAAO,iCACtBC,KAAa,EAAE,OAAO,+BACtBC,KAA8CC,gBAAAA,EAAA,QAAQ,EAAE,OAAO,8BAA8B;AAAA,oBAChE,OAAO;AAAA,IACtC,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,EAAA,GACN;AAAA,sBACgC,QAAQ;AAAA,MACvC,GAAG;AAAA,MACH,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,kBAAkB;AAAA,IAAA,CACnB;AAAA,EAAA,CACF;AACH,GAAG,EAAE,GACCC,KAA8CD,gBAAAA,EAAA,OAAO,EAAE,OAAO,EAAC,MAAO,mBAAqB,GAAA,MAAM,EAAE,GAyC7EE,KAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,YAAY,EAAE,SAAS,SAAS;AAAA,IAChC,S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AAAA,wBAC1CnD,EAAoB,QAAQH,IAAY;AAAA,0BACtCG,EAAoB,QAAQF,IAAY8D,EAAiBzC,EAAW,KAAK,GAAG,CAAC;AAAA,0BAC7EpB;AAAA,wBAAA,CACD;AAAA,sBAAA,CACF;AAAA,oBAAA,CACF,KACD8D,EAAoB,IAAI,EAAI;AAAA,kBAAA,CACjC;AAAA,gBAAA,CACF;AAAA,iBACA,GAAG;AAAA,cACN7D,EAAoB,OAAO;AAAA,gBACzB,OAAO;AAAA,gBACP,SAAS;AAAA,gBACT,KAAKe;AAAA,cAAA,GACJ;AAAA,gBACD2C,EAAYP,EAAK,QAAQ,eAAe;AAAA,kBACtC,eAAA1C;AAAA,kBACA,aAAa0C,EAAK;AAAA,gBAAA,GACjB,MAAM;AAAA,kBACNA,EAAK,eACDE,KAAcI,EAAoB,OAAO;AAAA,oBACxC,KAAK;AAAA,oBACL,IAAIhD;AAAA,oBACJ,OAAO;AAAA,kBAAA,GACNmD,EAAiBT,EAAK,WAAW,GAAG,CAAC,KACxCU,EAAoB,IAAI,EAAI;AAAA,gBAAA,CACjC;AAAA,gBACDH,EAAYP,EAAK,QAAQ,SAAS;AAAA,iBACjC,GAAG;AAAA,cACNlD;AAAA,cACAD,EAAoB,OAAO;AAAA,gBACzB,OAAO;AAAA,gBACP,SAAS;AAAA,gBACT,KAAKgB;AAAA,cAAA,GACJ;AAAA,gBACD0C,EAAYP,EAAK,QAAQ,QAAQ;AAAA,iBAChC,GAAG;AAAA,YAAA,CACP;AAAA,UACA,GAAA,GAAG,KACNU,EAAoB,IAAI,EAAI;AAAA,WAC/B,EAAE;AAAA,SACJ,EAAE;AAAA,IAAA,CACN;AAAA,EAEH;AAEA,CAAC;"}
|
package/dist/index65.js
CHANGED
|
@@ -1,25 +1,141 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
__name: "
|
|
1
|
+
import { defineComponent as x, computed as y, ref as p, onMounted as A, onBeforeUnmount as B, openBlock as c, createElementBlock as g, createElementVNode as u, renderSlot as S, createTextVNode as m, Fragment as h, renderList as E, normalizeClass as P, toDisplayString as z, nextTick as M } from "vue";
|
|
2
|
+
import W from "./index201.js";
|
|
3
|
+
const R = { "aria-label": "Navigazione" }, T = ["disabled"], F = ["onClick", "disabled"], L = ["disabled"], I = /* @__PURE__ */ x({
|
|
4
|
+
__name: "BbPagination",
|
|
5
5
|
props: {
|
|
6
|
-
modelValue: { default:
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
modelValue: { default: 1 },
|
|
7
|
+
disabled: { type: Boolean },
|
|
8
|
+
totalPages: { default: 1 },
|
|
9
|
+
maxSize: { default: 5 },
|
|
10
|
+
ellipsis: { default: "..." },
|
|
11
|
+
loading: { type: Boolean }
|
|
9
12
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
emits: ["update:modelValue"],
|
|
14
|
+
setup(N, { emit: f }) {
|
|
15
|
+
const e = N, i = y(() => +e.totalPages), r = p(1), t = p(+e.maxSize), o = p(), d = p(), k = p(1 / 0), _ = () => {
|
|
16
|
+
o.value && d.value && (o.value.clientWidth < d.value.clientWidth ? t.value - 1 > 3 ? (t.value--, M(_)) : t.value = 3 : t.value < +e.maxSize && /* If there is enought space to fit one */
|
|
17
|
+
o.value.clientWidth - d.value.clientWidth > k.value && (t.value = Math.min(t.value + 1, +e.maxSize), M(_)));
|
|
18
|
+
};
|
|
19
|
+
if (globalThis.ResizeObserver) {
|
|
20
|
+
const a = new ResizeObserver(W(_, 200));
|
|
21
|
+
A(() => {
|
|
22
|
+
if (o.value && d.value) {
|
|
23
|
+
const l = o.value.querySelectorAll(
|
|
24
|
+
".base-pagination__page"
|
|
25
|
+
)[1];
|
|
26
|
+
if (l) {
|
|
27
|
+
const v = getComputedStyle(d.value).columnGap.replaceAll(/\D/g, ""), s = Number(v);
|
|
28
|
+
k.value = l.clientWidth + s;
|
|
29
|
+
}
|
|
30
|
+
a.observe(o.value);
|
|
31
|
+
}
|
|
32
|
+
}), B(() => {
|
|
33
|
+
a.disconnect();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const C = y(() => {
|
|
37
|
+
if (i.value <= 0 || isNaN(i.value) || i.value > Number.MAX_SAFE_INTEGER)
|
|
38
|
+
return [];
|
|
39
|
+
if (t.value <= 1)
|
|
40
|
+
return [e.modelValue];
|
|
41
|
+
if (i.value <= t.value)
|
|
42
|
+
return b(i.value, r.value);
|
|
43
|
+
const a = t.value % 2 === 0, l = a ? t.value / 2 : Math.floor(t.value / 2), n = a ? l : l + 1, v = i.value - l;
|
|
44
|
+
if (n - e.modelValue >= 0)
|
|
45
|
+
return [
|
|
46
|
+
...b(Math.max(1, t.value - 1), r.value),
|
|
47
|
+
e.ellipsis,
|
|
48
|
+
i.value
|
|
49
|
+
];
|
|
50
|
+
if (e.modelValue - v >= (a ? 1 : 0)) {
|
|
51
|
+
const s = t.value - 1, V = i.value - s + r.value;
|
|
52
|
+
return [
|
|
53
|
+
r.value,
|
|
54
|
+
e.ellipsis,
|
|
55
|
+
...b(s, V)
|
|
56
|
+
];
|
|
57
|
+
} else {
|
|
58
|
+
const s = Math.max(1, t.value - 3), V = s === 1 ? e.modelValue : e.modelValue - Math.ceil(s / 2) + r.value;
|
|
59
|
+
return [
|
|
60
|
+
r.value,
|
|
61
|
+
e.ellipsis,
|
|
62
|
+
...b(s, V),
|
|
63
|
+
e.ellipsis,
|
|
64
|
+
i.value
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
}), $ = y(() => C.value.map((a, l) => typeof a == "string" ? {
|
|
68
|
+
active: !1,
|
|
69
|
+
key: `ellipsis-${l}`,
|
|
70
|
+
page: a,
|
|
71
|
+
ellipsis: !0,
|
|
72
|
+
icon: !0,
|
|
73
|
+
disabled: !0
|
|
74
|
+
} : {
|
|
75
|
+
active: a === e.modelValue,
|
|
76
|
+
key: a,
|
|
77
|
+
page: a,
|
|
78
|
+
ellipsis: !1,
|
|
79
|
+
icon: !0,
|
|
80
|
+
disabled: !!e.disabled || +e.totalPages < 2 || e.loading
|
|
81
|
+
})), b = (a, l = 0) => Array.from({ length: a }, (n, v) => l + v);
|
|
82
|
+
return (a, l) => (c(), g("div", {
|
|
83
|
+
class: "base-pagination",
|
|
84
|
+
ref_key: "outercontainer",
|
|
85
|
+
ref: o
|
|
86
|
+
}, [
|
|
87
|
+
u("nav", R, [
|
|
88
|
+
u("ul", {
|
|
89
|
+
class: "base-pagination__pages",
|
|
90
|
+
ref_key: "innercontainer",
|
|
91
|
+
ref: d
|
|
92
|
+
}, [
|
|
93
|
+
u("li", null, [
|
|
94
|
+
u("button", {
|
|
95
|
+
class: "base-pagination__page base-pagination__page--previous",
|
|
96
|
+
onClick: l[0] || (l[0] = (n) => f("update:modelValue", e.modelValue - 1)),
|
|
97
|
+
disabled: e.modelValue <= 1 || a.loading || a.disabled
|
|
98
|
+
}, [
|
|
99
|
+
S(a.$slots, "previous", {}, () => [
|
|
100
|
+
m("Precedente")
|
|
101
|
+
])
|
|
102
|
+
], 8, T)
|
|
103
|
+
]),
|
|
104
|
+
(c(!0), g(h, null, E($.value, (n) => (c(), g("li", null, [
|
|
105
|
+
u("button", {
|
|
106
|
+
class: P(["base-pagination__page", {
|
|
107
|
+
"base-pagination__page--active": n.active,
|
|
108
|
+
"base-pagination__page--ellipsis": n.ellipsis
|
|
109
|
+
}]),
|
|
110
|
+
onClick: (v) => f("update:modelValue", n.key),
|
|
111
|
+
disabled: n.disabled
|
|
112
|
+
}, [
|
|
113
|
+
S(a.$slots, "item", {}, () => [
|
|
114
|
+
n.ellipsis ? (c(), g(h, { key: 0 }, [
|
|
115
|
+
m(z(e.ellipsis), 1)
|
|
116
|
+
], 64)) : (c(), g(h, { key: 1 }, [
|
|
117
|
+
m(z(n.key), 1)
|
|
118
|
+
], 64))
|
|
119
|
+
])
|
|
120
|
+
], 10, F)
|
|
121
|
+
]))), 256)),
|
|
122
|
+
u("li", null, [
|
|
123
|
+
u("button", {
|
|
124
|
+
class: "base-pagination__page base-pagination__page--next",
|
|
125
|
+
onClick: l[1] || (l[1] = (n) => f("update:modelValue", e.modelValue + 1)),
|
|
126
|
+
disabled: e.modelValue >= +i.value || a.loading || a.disabled
|
|
127
|
+
}, [
|
|
128
|
+
S(a.$slots, "previous", {}, () => [
|
|
129
|
+
m("Successivi")
|
|
130
|
+
])
|
|
131
|
+
], 8, L)
|
|
132
|
+
])
|
|
133
|
+
], 512)
|
|
134
|
+
])
|
|
135
|
+
], 512));
|
|
20
136
|
}
|
|
21
137
|
});
|
|
22
138
|
export {
|
|
23
|
-
|
|
139
|
+
I as default
|
|
24
140
|
};
|
|
25
141
|
//# sourceMappingURL=index65.js.map
|