@rebilly/revel 13.10.1 → 13.10.3
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/CHANGELOG.md +2 -2
- package/dist/components/r-tabs/r-tabs.vue.d.ts +10 -0
- package/dist/components/r-tabs/r-tabs.vue.mjs +23 -14
- package/dist/components/r-tabs/r-tabs.vue_vue_type_script_lang.mjs +124 -24
- package/dist/revel.umd.js +11 -11
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -67,6 +67,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
67
67
|
layoutVersion: import("vue").Ref<number, number>;
|
|
68
68
|
recomputeIndicator: () => void;
|
|
69
69
|
isStuck: import("vue").Ref<boolean, boolean>;
|
|
70
|
+
canScrollStart: import("vue").Ref<boolean, boolean>;
|
|
71
|
+
canScrollEnd: import("vue").Ref<boolean, boolean>;
|
|
72
|
+
isDraggingTabs: import("vue").Ref<boolean, boolean>;
|
|
73
|
+
measureScrollEdges: () => void;
|
|
74
|
+
scrollActiveTabIntoView: () => void;
|
|
75
|
+
observeTablistSize: () => void;
|
|
76
|
+
onTablistPointerDown: (event: PointerEvent) => void;
|
|
77
|
+
onTablistPointerMove: (event: PointerEvent) => void;
|
|
78
|
+
endTablistDrag: (event: PointerEvent) => void;
|
|
79
|
+
onTablistClickCapture: (event: MouseEvent) => void;
|
|
70
80
|
}, State, {
|
|
71
81
|
visibleTabs(): {
|
|
72
82
|
tabId: string;
|
|
@@ -3,27 +3,27 @@ import t from "./r-tabs.vue_vue_type_script_lang.mjs";
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { Fragment as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, normalizeClass as s, normalizeStyle as c, openBlock as l, renderList as u, renderSlot as d, resolveDirective as f, toDisplayString as p, vShow as m, withDirectives as h } from "vue";
|
|
5
5
|
//#region src/components/r-tabs/r-tabs.vue
|
|
6
|
-
var g = {
|
|
6
|
+
var g = { class: "r-tabs" }, _ = {
|
|
7
7
|
key: 0,
|
|
8
8
|
ref: "stickySentinelRef",
|
|
9
9
|
class: "r-tab-sticky-sentinel",
|
|
10
10
|
"aria-hidden": "true"
|
|
11
|
-
},
|
|
11
|
+
}, v = [
|
|
12
12
|
"id",
|
|
13
13
|
"to",
|
|
14
14
|
"aria-selected",
|
|
15
15
|
"aria-controls",
|
|
16
16
|
"onClick"
|
|
17
|
-
],
|
|
17
|
+
], y = [
|
|
18
18
|
"id",
|
|
19
19
|
"aria-selected",
|
|
20
20
|
"aria-controls",
|
|
21
21
|
"onClick"
|
|
22
22
|
];
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
return l(), i("div",
|
|
26
|
-
e.sticky ? (l(), i("div",
|
|
23
|
+
function b(e, t, b, x, S, C) {
|
|
24
|
+
let w = f("tooltip");
|
|
25
|
+
return l(), i("div", g, [
|
|
26
|
+
e.sticky ? (l(), i("div", _, null, 512)) : r("", !0),
|
|
27
27
|
a("div", {
|
|
28
28
|
ref: "stickyHostRef",
|
|
29
29
|
class: s(["r-tab-sticky-host", {
|
|
@@ -34,9 +34,18 @@ function y(e, t, y, b, x, S) {
|
|
|
34
34
|
ref: "tablistRef",
|
|
35
35
|
class: s(["r-tab", [{
|
|
36
36
|
"r-tab-divided": e.divided,
|
|
37
|
-
"r-is-sticky": e.sticky
|
|
37
|
+
"r-is-sticky": e.sticky,
|
|
38
|
+
"r-can-scroll-start": e.canScrollStart,
|
|
39
|
+
"r-can-scroll-end": e.canScrollEnd,
|
|
40
|
+
"r-is-dragging": e.isDraggingTabs
|
|
38
41
|
}, e.menuClass]]),
|
|
39
|
-
role: "tablist"
|
|
42
|
+
role: "tablist",
|
|
43
|
+
onScroll: t[0] ||= (...t) => e.measureScrollEdges && e.measureScrollEdges(...t),
|
|
44
|
+
onPointerdown: t[1] ||= (...t) => e.onTablistPointerDown && e.onTablistPointerDown(...t),
|
|
45
|
+
onPointermove: t[2] ||= (...t) => e.onTablistPointerMove && e.onTablistPointerMove(...t),
|
|
46
|
+
onPointerup: t[3] ||= (...t) => e.endTablistDrag && e.endTablistDrag(...t),
|
|
47
|
+
onPointercancel: t[4] ||= (...t) => e.endTablistDrag && e.endTablistDrag(...t),
|
|
48
|
+
onClickCapture: t[5] ||= (...t) => e.onTablistClickCapture && e.onTablistClickCapture(...t)
|
|
40
49
|
}, [(l(!0), i(n, null, u(e.visibleTabs, (t, n) => h((l(), i("div", {
|
|
41
50
|
key: t.tabId,
|
|
42
51
|
class: "r-tab-item"
|
|
@@ -58,7 +67,7 @@ function y(e, t, y, b, x, S) {
|
|
|
58
67
|
}, [d(e.$slots, "label", {
|
|
59
68
|
tab: t,
|
|
60
69
|
index: n
|
|
61
|
-
}, () => [o(p(e.getTabName(t, n)), 1)])], 10,
|
|
70
|
+
}, () => [o(p(e.getTabName(t, n)), 1)])], 10, v)) : (l(), i("button", {
|
|
62
71
|
key: 1,
|
|
63
72
|
id: t.tabId,
|
|
64
73
|
ref_for: !0,
|
|
@@ -75,16 +84,16 @@ function y(e, t, y, b, x, S) {
|
|
|
75
84
|
}, [d(e.$slots, "label", {
|
|
76
85
|
tab: t,
|
|
77
86
|
index: n
|
|
78
|
-
}, () => [o(p(e.getTabName(t, n)), 1)])], 10,
|
|
87
|
+
}, () => [o(p(e.getTabName(t, n)), 1)])], 10, y))])), [[w, { text: t.isInvalid && e.showValidateMessages ? t.validateErrorMessages.join("\n") : null }]])), 128)), h(a("div", {
|
|
79
88
|
class: s(["r-tab-item-indicator", { "r-is-error": e.isInvalidTab }]),
|
|
80
89
|
style: c({
|
|
81
90
|
width: e.visibleTabIndicatorWidth + "px",
|
|
82
91
|
left: e.visibleTabIndicatorPosition + "px"
|
|
83
92
|
})
|
|
84
|
-
}, null, 6), [[m, e.isIndicatorReady]])],
|
|
93
|
+
}, null, 6), [[m, e.isIndicatorReady]])], 34)], 2),
|
|
85
94
|
a("div", { class: s(["r-tab-content", e.contentClass]) }, [d(e.$slots, "default")], 2)
|
|
86
95
|
]);
|
|
87
96
|
}
|
|
88
|
-
var
|
|
97
|
+
var x = /*#__PURE__*/ e(t, [["render", b]]);
|
|
89
98
|
//#endregion
|
|
90
|
-
export {
|
|
99
|
+
export { x as default };
|
|
@@ -61,18 +61,99 @@ var p = a({
|
|
|
61
61
|
},
|
|
62
62
|
emits: ["tab-selected"],
|
|
63
63
|
setup(e) {
|
|
64
|
-
let n = l([]), r = l(null), i = l(null), a = l(null), p = l(0), m = l(!1), h =
|
|
64
|
+
let n = l([]), r = l(null), i = l(null), a = l(null), p = l(0), m = l(!1), h = l(!1), g = l(!1), _ = l(!1), v = null, y = null, b = null, x = !1, S = null, C = 0, w = 0, T = !1, E = !1, D = () => {
|
|
65
65
|
p.value += 1;
|
|
66
|
-
},
|
|
67
|
-
function
|
|
68
|
-
|
|
66
|
+
}, O = t(D, 100);
|
|
67
|
+
function k() {
|
|
68
|
+
let e = r.value;
|
|
69
|
+
if (!e) {
|
|
70
|
+
h.value = !1, g.value = !1;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let t = e.scrollWidth - e.clientWidth;
|
|
74
|
+
h.value = e.scrollLeft > 1, g.value = t > 1 && e.scrollLeft < t - 1;
|
|
69
75
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
76
|
+
function A(e) {
|
|
77
|
+
let t = window.getComputedStyle(e).getPropertyValue("--r-tab-fade").trim();
|
|
78
|
+
if (!t) return 0;
|
|
79
|
+
if (t.endsWith("px")) {
|
|
80
|
+
let e = Number.parseFloat(t);
|
|
81
|
+
return Number.isFinite(e) ? e : 0;
|
|
82
|
+
}
|
|
83
|
+
let n = document.createElement("div");
|
|
84
|
+
n.style.cssText = `position:absolute;visibility:hidden;pointer-events:none;width:${t}`, e.appendChild(n);
|
|
85
|
+
let r = n.getBoundingClientRect().width;
|
|
86
|
+
return n.remove(), Number.isFinite(r) ? r : 0;
|
|
87
|
+
}
|
|
88
|
+
function j() {
|
|
89
|
+
let e = r.value;
|
|
90
|
+
if (!e) return;
|
|
91
|
+
let t = e.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
|
|
92
|
+
if (!t) return;
|
|
93
|
+
let n = A(e), i = t.getBoundingClientRect(), a = e.getBoundingClientRect(), o = a.left + n, s = a.right - n;
|
|
94
|
+
i.left < o ? e.scrollLeft -= o - i.left : i.right > s && (e.scrollLeft += i.right - s), k();
|
|
95
|
+
}
|
|
96
|
+
function M() {
|
|
97
|
+
b?.disconnect(), b = null;
|
|
98
|
+
let e = r.value;
|
|
99
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
100
|
+
let t = new ResizeObserver(() => k());
|
|
101
|
+
b = t, t.observe(e), e.querySelectorAll(".r-tab-item").forEach((e) => {
|
|
102
|
+
t.observe(e);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function N(e) {
|
|
106
|
+
return e.scrollWidth - e.clientWidth > 1;
|
|
107
|
+
}
|
|
108
|
+
function P(e) {
|
|
109
|
+
if (e.pointerType !== "mouse" || e.button !== 0) return;
|
|
110
|
+
let t = r.value;
|
|
111
|
+
t && N(t) && (S = e.pointerId, C = e.clientX, w = t.scrollLeft, T = !1, F(), window.addEventListener("pointerup", L), window.addEventListener("pointercancel", L));
|
|
112
|
+
}
|
|
113
|
+
function F() {
|
|
114
|
+
window.removeEventListener("pointerup", L), window.removeEventListener("pointercancel", L);
|
|
115
|
+
}
|
|
116
|
+
function I(e) {
|
|
117
|
+
if (e.pointerId !== S) return;
|
|
118
|
+
let t = r.value;
|
|
119
|
+
if (!t || e.buttons !== 1) {
|
|
120
|
+
L(e);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
let n = e.clientX - C;
|
|
124
|
+
if (!(!T && Math.abs(n) < 5)) {
|
|
125
|
+
if (!T) try {
|
|
126
|
+
t.setPointerCapture(e.pointerId);
|
|
127
|
+
} catch {}
|
|
128
|
+
T = !0, _.value = !0, t.scrollLeft = w - n, e.preventDefault();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function L(e) {
|
|
132
|
+
if (e.pointerId !== S) return;
|
|
133
|
+
let t = r.value, n = T;
|
|
134
|
+
S = null, T = !1, _.value = !1, F();
|
|
135
|
+
try {
|
|
136
|
+
t?.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId);
|
|
137
|
+
} catch {}
|
|
138
|
+
n && (E = !0, window.setTimeout(() => {
|
|
139
|
+
E = !1;
|
|
140
|
+
}, 0));
|
|
141
|
+
}
|
|
142
|
+
function R(e) {
|
|
143
|
+
E && (E = !1, e.preventDefault(), e.stopPropagation());
|
|
144
|
+
}
|
|
145
|
+
let z = () => {
|
|
146
|
+
O(), k();
|
|
147
|
+
};
|
|
148
|
+
function B() {
|
|
149
|
+
v?.disconnect(), v = null, y?.disconnect(), y = null, m.value = !1, i.value?.style.removeProperty("--r-tabs-sticky-offset");
|
|
150
|
+
}
|
|
151
|
+
function V(e, t) {
|
|
152
|
+
y?.disconnect(), y = null;
|
|
72
153
|
let n = a.value;
|
|
73
154
|
if (!n || typeof IntersectionObserver > "u") return;
|
|
74
155
|
let r = e === document.documentElement ? null : e, i = new IntersectionObserver(([e]) => {
|
|
75
|
-
if (
|
|
156
|
+
if (y !== i) return;
|
|
76
157
|
let t = e?.rootBounds?.top;
|
|
77
158
|
m.value = !!(e && !e.isIntersecting && t != null && e.boundingClientRect.bottom <= t);
|
|
78
159
|
}, {
|
|
@@ -80,32 +161,42 @@ var p = a({
|
|
|
80
161
|
rootMargin: `-${Math.round(t)}px 0px 0px 0px`,
|
|
81
162
|
threshold: 0
|
|
82
163
|
});
|
|
83
|
-
|
|
164
|
+
y = i, i.observe(n);
|
|
84
165
|
}
|
|
85
|
-
function
|
|
86
|
-
if (
|
|
166
|
+
function H() {
|
|
167
|
+
if (B(), !e.sticky) return;
|
|
87
168
|
let t = i.value;
|
|
88
169
|
if (!t) return;
|
|
89
170
|
let n = d(t) ?? document.documentElement, r = f(n), a = () => {
|
|
90
171
|
let e = r ? r.getBoundingClientRect().height : 0;
|
|
91
|
-
t.style.setProperty("--r-tabs-sticky-offset", `${e}px`),
|
|
172
|
+
t.style.setProperty("--r-tabs-sticky-offset", `${e}px`), V(n, e);
|
|
92
173
|
};
|
|
93
|
-
a(), r && typeof ResizeObserver < "u" && (
|
|
174
|
+
a(), r && typeof ResizeObserver < "u" && (v = new ResizeObserver(() => a()), v.observe(r));
|
|
94
175
|
}
|
|
95
176
|
return c(() => {
|
|
96
|
-
window.addEventListener("resize",
|
|
177
|
+
window.addEventListener("resize", z), x = !0, H(), M(), k();
|
|
97
178
|
}), s(() => {
|
|
98
|
-
window.removeEventListener("resize",
|
|
179
|
+
window.removeEventListener("resize", z), O.cancel?.(), b?.disconnect(), b = null, F(), x = !1, B();
|
|
99
180
|
}), u(() => e.sticky, () => {
|
|
100
|
-
|
|
181
|
+
x && o(() => H());
|
|
101
182
|
}), {
|
|
102
183
|
tabItemLinkRefs: n,
|
|
103
184
|
tablistRef: r,
|
|
104
185
|
stickyHostRef: i,
|
|
105
186
|
stickySentinelRef: a,
|
|
106
187
|
layoutVersion: p,
|
|
107
|
-
recomputeIndicator:
|
|
108
|
-
isStuck: m
|
|
188
|
+
recomputeIndicator: D,
|
|
189
|
+
isStuck: m,
|
|
190
|
+
canScrollStart: h,
|
|
191
|
+
canScrollEnd: g,
|
|
192
|
+
isDraggingTabs: _,
|
|
193
|
+
measureScrollEdges: k,
|
|
194
|
+
scrollActiveTabIntoView: j,
|
|
195
|
+
observeTablistSize: M,
|
|
196
|
+
onTablistPointerDown: P,
|
|
197
|
+
onTablistPointerMove: I,
|
|
198
|
+
endTablistDrag: L,
|
|
199
|
+
onTablistClickCapture: R
|
|
109
200
|
};
|
|
110
201
|
},
|
|
111
202
|
data: () => ({
|
|
@@ -137,15 +228,22 @@ var p = a({
|
|
|
137
228
|
return this.visibleTabs[this.visibleTabIndicatorIndex]?.isInvalid;
|
|
138
229
|
}
|
|
139
230
|
},
|
|
140
|
-
watch: {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
231
|
+
watch: {
|
|
232
|
+
visibleTabs() {
|
|
233
|
+
this.$nextTick(() => {
|
|
234
|
+
this.observeTablistSize(), this.measureScrollEdges(), this.scrollActiveTabIntoView();
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
$route(e, t) {
|
|
238
|
+
if (e.name === t.name) {
|
|
239
|
+
let e = this.getRouteTab();
|
|
240
|
+
e && this.selectTab(e);
|
|
241
|
+
}
|
|
144
242
|
}
|
|
145
|
-
}
|
|
243
|
+
},
|
|
146
244
|
mounted() {
|
|
147
245
|
this.bootstrap(), this.$nextTick(() => {
|
|
148
|
-
this.isIndicatorReady = !0;
|
|
246
|
+
this.isIndicatorReady = !0, this.observeTablistSize(), this.measureScrollEdges(), this.scrollActiveTabIntoView();
|
|
149
247
|
});
|
|
150
248
|
},
|
|
151
249
|
methods: {
|
|
@@ -162,7 +260,9 @@ var p = a({
|
|
|
162
260
|
e.isActive = r === e.tabId;
|
|
163
261
|
}) : this.tabs.forEach((t) => {
|
|
164
262
|
t.isActive = t.name === e;
|
|
165
|
-
}), this.$nextTick(() =>
|
|
263
|
+
}), this.$nextTick(() => {
|
|
264
|
+
this.recomputeIndicator(), this.scrollActiveTabIntoView();
|
|
265
|
+
}));
|
|
166
266
|
},
|
|
167
267
|
getRouteTab() {
|
|
168
268
|
return this.tabs.filter((e) => e.to).find((e) => this.goingToSameRoute(e.to));
|