x-next 1.19.5 → 1.19.6
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/AI_USAGE/catalog.md +1 -1
- package/AI_USAGE/components/alert-api.md +1 -1
- package/AI_USAGE/components/alert.md +1 -1
- package/AI_USAGE/components/bar-chart-api.md +1 -1
- package/AI_USAGE/components/bar-chart.md +1 -1
- package/AI_USAGE/components/boxicons.md +1 -1
- package/AI_USAGE/components/button-api.md +1 -1
- package/AI_USAGE/components/button.md +1 -1
- package/AI_USAGE/components/charts.md +1 -1
- package/AI_USAGE/components/checkbox-api.md +1 -1
- package/AI_USAGE/components/checkbox.md +1 -1
- package/AI_USAGE/components/color-picker-api.md +1 -1
- package/AI_USAGE/components/color-picker.md +1 -1
- package/AI_USAGE/components/config-provider-api.md +1 -1
- package/AI_USAGE/components/config-provider.md +1 -1
- package/AI_USAGE/components/date-picker-api.md +1 -1
- package/AI_USAGE/components/date-picker.md +1 -1
- package/AI_USAGE/components/dialog-api.md +1 -1
- package/AI_USAGE/components/dialog.md +1 -1
- package/AI_USAGE/components/draggable-api.md +1 -1
- package/AI_USAGE/components/draggable.md +1 -1
- package/AI_USAGE/components/drawer-api.md +1 -1
- package/AI_USAGE/components/drawer.md +1 -1
- package/AI_USAGE/components/dropdown-api.md +1 -1
- package/AI_USAGE/components/dropdown.md +1 -1
- package/AI_USAGE/components/empty-api.md +1 -1
- package/AI_USAGE/components/empty.md +1 -1
- package/AI_USAGE/components/finicon.md +1 -1
- package/AI_USAGE/components/form-api.md +1 -1
- package/AI_USAGE/components/form.md +1 -1
- package/AI_USAGE/components/grid-api.md +1 -1
- package/AI_USAGE/components/grid.md +1 -1
- package/AI_USAGE/components/heatmap-api.md +1 -1
- package/AI_USAGE/components/heatmap.md +1 -1
- package/AI_USAGE/components/icon-api.md +1 -1
- package/AI_USAGE/components/icon.md +1 -1
- package/AI_USAGE/components/image-api.md +1 -1
- package/AI_USAGE/components/image.md +1 -1
- package/AI_USAGE/components/input-api.md +1 -1
- package/AI_USAGE/components/input-number-api.md +1 -1
- package/AI_USAGE/components/input-number.md +1 -1
- package/AI_USAGE/components/input-tag-api.md +1 -1
- package/AI_USAGE/components/input-tag.md +1 -1
- package/AI_USAGE/components/input.md +1 -1
- package/AI_USAGE/components/layout-api.md +1 -1
- package/AI_USAGE/components/layout.md +1 -1
- package/AI_USAGE/components/line-chart-api.md +1 -1
- package/AI_USAGE/components/line-chart.md +1 -1
- package/AI_USAGE/components/link-api.md +1 -1
- package/AI_USAGE/components/link.md +1 -1
- package/AI_USAGE/components/menu-api.md +1 -1
- package/AI_USAGE/components/menu.md +1 -1
- package/AI_USAGE/components/message-api.md +1 -1
- package/AI_USAGE/components/message-box-api.md +1 -1
- package/AI_USAGE/components/message-box.md +1 -1
- package/AI_USAGE/components/message.md +1 -1
- package/AI_USAGE/components/network-api.md +1 -1
- package/AI_USAGE/components/network.md +1 -1
- package/AI_USAGE/components/notification-api.md +1 -1
- package/AI_USAGE/components/notification.md +1 -1
- package/AI_USAGE/components/pagination-api.md +1 -1
- package/AI_USAGE/components/pagination.md +1 -1
- package/AI_USAGE/components/pie-chart-api.md +1 -1
- package/AI_USAGE/components/pie-chart.md +1 -1
- package/AI_USAGE/components/popconfirm-api.md +1 -1
- package/AI_USAGE/components/popconfirm.md +1 -1
- package/AI_USAGE/components/popover-api.md +1 -1
- package/AI_USAGE/components/popover.md +1 -1
- package/AI_USAGE/components/popup-api.md +1 -1
- package/AI_USAGE/components/popup.md +1 -1
- package/AI_USAGE/components/progress-api.md +1 -1
- package/AI_USAGE/components/progress.md +1 -1
- package/AI_USAGE/components/radio-api.md +1 -1
- package/AI_USAGE/components/radio.md +1 -1
- package/AI_USAGE/components/rate-api.md +1 -1
- package/AI_USAGE/components/rate.md +1 -1
- package/AI_USAGE/components/resize-box-api.md +1 -1
- package/AI_USAGE/components/resize-box.md +1 -1
- package/AI_USAGE/components/scrollbar-api.md +1 -1
- package/AI_USAGE/components/scrollbar.md +65 -2
- package/AI_USAGE/components/select-api.md +1 -1
- package/AI_USAGE/components/select.md +1 -1
- package/AI_USAGE/components/skeleton-api.md +1 -1
- package/AI_USAGE/components/skeleton.md +1 -1
- package/AI_USAGE/components/slider-api.md +1 -1
- package/AI_USAGE/components/slider.md +1 -1
- package/AI_USAGE/components/space-api.md +1 -1
- package/AI_USAGE/components/space.md +1 -1
- package/AI_USAGE/components/spin-api.md +1 -1
- package/AI_USAGE/components/spin.md +1 -1
- package/AI_USAGE/components/steps-api.md +1 -1
- package/AI_USAGE/components/steps.md +1 -1
- package/AI_USAGE/components/switch-api.md +1 -1
- package/AI_USAGE/components/switch.md +1 -1
- package/AI_USAGE/components/table-api.md +1 -1
- package/AI_USAGE/components/table.md +1 -1
- package/AI_USAGE/components/tabs-api.md +1 -1
- package/AI_USAGE/components/tabs.md +1 -1
- package/AI_USAGE/components/tag-api.md +1 -1
- package/AI_USAGE/components/tag.md +1 -1
- package/AI_USAGE/components/textarea-api.md +1 -1
- package/AI_USAGE/components/textarea.md +1 -1
- package/AI_USAGE/components/time-picker-api.md +1 -1
- package/AI_USAGE/components/time-picker.md +1 -1
- package/AI_USAGE/components/time-range-selector-api.md +1 -1
- package/AI_USAGE/components/time-range-selector.md +1 -1
- package/AI_USAGE/components/timeline-api.md +1 -1
- package/AI_USAGE/components/timeline.md +1 -1
- package/AI_USAGE/components/tooltip-api.md +1 -1
- package/AI_USAGE/components/tooltip.md +1 -1
- package/AI_USAGE/components/transfer-api.md +1 -1
- package/AI_USAGE/components/transfer.md +1 -1
- package/AI_USAGE/components/tree-select-api.md +1 -1
- package/AI_USAGE/components/tree-select.md +1 -1
- package/AI_USAGE/components/trend-chart-api.md +1 -1
- package/AI_USAGE/components/trend-chart.md +1 -1
- package/AI_USAGE/components/trigger-api.md +1 -1
- package/AI_USAGE/components/trigger.md +1 -1
- package/AI_USAGE/components/upload-api.md +1 -1
- package/AI_USAGE/components/upload.md +1 -1
- package/AI_USAGE/components/virtual-list-api.md +1 -1
- package/AI_USAGE/components/virtual-list.md +1 -1
- package/AI_USAGE/components/watermark-api.md +1 -1
- package/AI_USAGE/components/watermark.md +1 -1
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +1 -1
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +66 -3
- package/CHANGELOG.md +13 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +0 -22
- package/dist/components/date-picker/index.d.ts +0 -44
- package/dist/components/drawer/index.d.ts +0 -44
- package/dist/components/drawer/src/Drawer.vue.d.ts +0 -22
- package/dist/components/dropdown/Dropdown.vue.d.ts +0 -22
- package/dist/components/dropdown/DropdownButton.vue.d.ts +0 -22
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +0 -22
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +0 -22
- package/dist/components/dropdown/index.d.ts +0 -132
- package/dist/components/form-select/SelectDropdown.vue.d.ts +0 -22
- package/dist/components/form-select/index.d.ts +0 -44
- package/dist/components/menu/Menu.d.ts +0 -22
- package/dist/components/menu/base-menu.vue.d.ts +0 -22
- package/dist/components/menu/index.d.ts +0 -66
- package/dist/components/menu/sub-menu-pop.vue.d.ts +0 -22
- package/dist/components/scrollbar-v2/Scrollbar.vue.d.ts +0 -11
- package/dist/components/scrollbar-v2/index.d.ts +0 -22
- package/dist/components/time-picker/TimeColumn.vue.d.ts +0 -22
- package/dist/components/time-picker/TimePanel.vue.d.ts +0 -22
- package/dist/components/time-picker/TimePicker.vue.d.ts +0 -22
- package/dist/components/time-picker/index.d.ts +0 -44
- package/dist/components/tree-select/TreeSelectDropdown.vue.d.ts +0 -22
- package/dist/components/tree-select/index.d.ts +0 -44
- package/dist/components/virtual-list-v2/index.d.ts +0 -44
- package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +0 -22
- package/dist/es/components/scrollbar-v2/Scrollbar.vue.js +24 -34
- package/dist/es/components/scrollbar-v2/Scrollbar.vue2.js +112 -129
- package/dist/es/components/scrollbar-v2/thumb.vue2.js +48 -40
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/scrollbar-v2.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { isObject as
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { defineComponent as q, ref as f, computed as x, onMounted as J, watch as Q, nextTick as A, onBeforeUnmount as ee, normalizeStyle as te } from "vue";
|
|
2
|
+
import le from "../../node_modules/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js";
|
|
3
|
+
import oe from "./thumb.vue.js";
|
|
4
|
+
import { isObject as ae } from "../../_utils/is.js";
|
|
5
|
+
import { toCamelCase as re } from "../../_utils/convert-case.js";
|
|
6
|
+
import { throttleByRaf as ne } from "../../_utils/throttle-by-raf.js";
|
|
7
|
+
import { getClassNameMixin as ie } from "../../_utils/config.js";
|
|
8
|
+
const se = 20, L = 15, ce = /* @__PURE__ */ new Set([
|
|
7
9
|
"width",
|
|
8
10
|
"height",
|
|
9
11
|
"minWidth",
|
|
@@ -17,28 +19,23 @@ const k = 20, z = 15, p = /* @__PURE__ */ new Set([
|
|
|
17
19
|
"flexShrink",
|
|
18
20
|
"alignSelf",
|
|
19
21
|
"justifySelf"
|
|
20
|
-
]),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
return p.has(l) && !(a != null && a.ignoreVerticalLayout && w.has(l)) && (r[l] = n), r;
|
|
35
|
-
},
|
|
36
|
-
{}
|
|
37
|
-
) : {}, D = (e, a) => e <= 0 || a <= 0 ? 1 : e / a, ge = ne({
|
|
22
|
+
]), k = (e, a) => {
|
|
23
|
+
const i = {};
|
|
24
|
+
for (const [r, n] of Object.entries(te([e]) ?? {})) {
|
|
25
|
+
const l = re(r);
|
|
26
|
+
ce.has(l) === a && (i[a ? l : r] = n);
|
|
27
|
+
}
|
|
28
|
+
return i;
|
|
29
|
+
}, j = (e, a, i) => {
|
|
30
|
+
const r = Math.max(0, i);
|
|
31
|
+
if (e <= 0 || a <= e || r <= 0)
|
|
32
|
+
return { ratio: 1, thumbSize: 0, max: 0 };
|
|
33
|
+
const n = Math.min(r, Math.max(se, Math.round(r * e / a))), l = Math.max(0, r - n);
|
|
34
|
+
return { ratio: l > 0 ? (a - e) / l : 1, thumbSize: n, max: l };
|
|
35
|
+
}, I = (e, a) => (e == null ? void 0 : e.ratio) === a.ratio && e.thumbSize === a.thumbSize && e.max === a.max, ye = q({
|
|
38
36
|
name: "Scrollbar",
|
|
39
37
|
components: {
|
|
40
|
-
|
|
41
|
-
Thumb: fe
|
|
38
|
+
Thumb: oe
|
|
42
39
|
},
|
|
43
40
|
inheritAttrs: !1,
|
|
44
41
|
props: {
|
|
@@ -87,132 +84,118 @@ const k = 20, z = 15, p = /* @__PURE__ */ new Set([
|
|
|
87
84
|
*/
|
|
88
85
|
scroll: (e) => !0
|
|
89
86
|
},
|
|
90
|
-
setup(e, { emit: a, attrs:
|
|
91
|
-
const
|
|
92
|
-
() =>
|
|
93
|
-
),
|
|
94
|
-
() =>
|
|
95
|
-
), g = f(!1)
|
|
96
|
-
|
|
87
|
+
setup(e, { emit: a, attrs: i }) {
|
|
88
|
+
const r = ie("scrollbar"), n = f(), l = f(), h = f(), d = f(), R = f(), _ = f(), p = f(!1), E = f(!1), y = x(
|
|
89
|
+
() => p.value && !e.disableHorizontal
|
|
90
|
+
), z = x(
|
|
91
|
+
() => E.value && !e.disableVertical
|
|
92
|
+
), g = f(!1);
|
|
93
|
+
let c, v;
|
|
94
|
+
const m = /* @__PURE__ */ new Set();
|
|
95
|
+
let T = !1;
|
|
96
|
+
const Y = () => {
|
|
97
|
+
const { style: t, ...o } = i;
|
|
97
98
|
return o;
|
|
98
|
-
},
|
|
99
|
-
const t =
|
|
100
|
-
return e.disableHorizontal && (t.overflowX = "hidden"), e.disableVertical && (t.overflowY = "hidden"),
|
|
101
|
-
},
|
|
102
|
-
var t, o, s,
|
|
103
|
-
|
|
99
|
+
}, N = () => {
|
|
100
|
+
const t = k(i.style, !1);
|
|
101
|
+
return e.disableHorizontal && (t.overflowX = "hidden"), e.disableVertical && (t.overflowY = "hidden"), t;
|
|
102
|
+
}, H = () => {
|
|
103
|
+
var t, o, s, u;
|
|
104
|
+
T || !l.value || ((o = _.value) == null || o.setOffset(Math.round(l.value.scrollTop / (((t = d.value) == null ? void 0 : t.ratio) ?? 1))), (u = R.value) == null || u.setOffset(Math.round(l.value.scrollLeft / (((s = h.value) == null ? void 0 : s.ratio) ?? 1))));
|
|
105
|
+
}, M = () => {
|
|
106
|
+
if (l.value && n.value) {
|
|
104
107
|
const {
|
|
105
|
-
clientWidth:
|
|
106
|
-
clientHeight:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
} = l.value, V = ((t = n.value) == null ? void 0 : t.clientWidth) ?? Q, A = ((o = n.value) == null ? void 0 : o.clientHeight) ?? ee;
|
|
114
|
-
_.value = x > m, W.value = M > O, g.value = b.value && S.value;
|
|
115
|
-
const L = g.value ? V - z : V, R = g.value ? A - z : A, E = Math.round(
|
|
116
|
-
L / Math.min(x / m, L / k)
|
|
117
|
-
), $ = Math.max(L - E, 0), ae = D(x - m, $), B = Math.round(
|
|
118
|
-
R / Math.min(M / O, R / k)
|
|
119
|
-
), Y = Math.max(R - B, 0), oe = D(M - O, Y);
|
|
120
|
-
u.value = {
|
|
121
|
-
ratio: ae,
|
|
122
|
-
thumbSize: E,
|
|
123
|
-
max: $
|
|
124
|
-
}, c.value = {
|
|
125
|
-
ratio: oe,
|
|
126
|
-
thumbSize: B,
|
|
127
|
-
max: Y
|
|
128
|
-
};
|
|
129
|
-
const re = Math.round(te / (((s = c.value) == null ? void 0 : s.ratio) ?? 1));
|
|
130
|
-
(d = H.value) == null || d.setOffset(re);
|
|
131
|
-
const ie = Math.round(le / (((v = u.value) == null ? void 0 : v.ratio) ?? 1));
|
|
132
|
-
(h = T.value) == null || h.setOffset(ie);
|
|
108
|
+
clientWidth: t,
|
|
109
|
+
clientHeight: o,
|
|
110
|
+
scrollWidth: s,
|
|
111
|
+
scrollHeight: u
|
|
112
|
+
} = l.value, C = n.value.clientWidth, W = n.value.clientHeight;
|
|
113
|
+
p.value = t > 0 && s > t, E.value = o > 0 && u > o, g.value = y.value && z.value;
|
|
114
|
+
const S = g.value ? L : 0, w = j(t, s, C - S), B = j(o, u, W - S), D = !I(h.value, w), V = !I(d.value, B);
|
|
115
|
+
D && (h.value = w), V && (d.value = B), H(), (D || V) && A(H);
|
|
133
116
|
}
|
|
117
|
+
}, O = ne(M), b = () => {
|
|
118
|
+
T || O();
|
|
119
|
+
}, $ = () => {
|
|
120
|
+
if (!l.value || !c) return;
|
|
121
|
+
const t = new Set(l.value.children);
|
|
122
|
+
for (const o of m) t.has(o) || (c.unobserve(o), m.delete(o));
|
|
123
|
+
for (const o of t) m.has(o) || (c.observe(o), m.add(o));
|
|
134
124
|
};
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
J(() => {
|
|
126
|
+
!l.value || !n.value || (c = new le(b), c.observe(n.value), c.observe(l.value), $(), v = new MutationObserver(() => {
|
|
127
|
+
$(), b();
|
|
128
|
+
}), v.observe(l.value, {
|
|
129
|
+
childList: !0,
|
|
130
|
+
subtree: !0,
|
|
131
|
+
characterData: !0,
|
|
132
|
+
attributes: !0
|
|
133
|
+
}), l.value.addEventListener("load", b, !0), M());
|
|
134
|
+
}), Q(() => [e.type, e.disableHorizontal, e.disableVertical, e.hide], () => {
|
|
135
|
+
A(b);
|
|
136
|
+
}), ee(() => {
|
|
137
|
+
var t;
|
|
138
|
+
T = !0, c == null || c.disconnect(), v == null || v.disconnect(), m.clear(), (t = l.value) == null || t.removeEventListener("load", b, !0), O.cancel();
|
|
137
139
|
});
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
+
const U = (t) => {
|
|
141
|
+
H(), a("scroll", t);
|
|
140
142
|
}, G = (t) => {
|
|
141
|
-
var o, s, d, v;
|
|
142
|
-
if (l.value) {
|
|
143
|
-
if (b.value && !e.disableHorizontal) {
|
|
144
|
-
const h = Math.round(
|
|
145
|
-
l.value.scrollLeft / (((o = u.value) == null ? void 0 : o.ratio) ?? 1)
|
|
146
|
-
);
|
|
147
|
-
(s = T.value) == null || s.setOffset(h);
|
|
148
|
-
}
|
|
149
|
-
if (S.value && !e.disableVertical) {
|
|
150
|
-
const h = Math.round(
|
|
151
|
-
l.value.scrollTop / (((d = c.value) == null ? void 0 : d.ratio) ?? 1)
|
|
152
|
-
);
|
|
153
|
-
(v = H.value) == null || v.setOffset(h);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
a("scroll", t);
|
|
157
|
-
}, X = (t) => {
|
|
158
143
|
var s;
|
|
159
144
|
const o = t.deltaX || t.deltaY;
|
|
160
145
|
return t.deltaMode === WheelEvent.DOM_DELTA_LINE ? o * 16 : t.deltaMode === WheelEvent.DOM_DELTA_PAGE ? o * (((s = l.value) == null ? void 0 : s.clientWidth) ?? 1) : o;
|
|
161
|
-
},
|
|
162
|
-
if (!e.horizontalWheel || !l.value || !
|
|
146
|
+
}, K = (t) => {
|
|
147
|
+
if (!e.horizontalWheel || !l.value || !y.value || z.value || e.disableHorizontal)
|
|
163
148
|
return;
|
|
164
|
-
const o =
|
|
149
|
+
const o = G(t);
|
|
165
150
|
if (o === 0) return;
|
|
166
|
-
const { scrollLeft: s, scrollWidth:
|
|
167
|
-
|
|
168
|
-
},
|
|
151
|
+
const { scrollLeft: s, scrollWidth: u, clientWidth: C } = l.value, W = u - C, S = Math.min(Math.max(s + o, 0), W);
|
|
152
|
+
S !== s && (l.value.scrollLeft = S, t.preventDefault());
|
|
153
|
+
}, X = (t) => {
|
|
169
154
|
var o;
|
|
170
155
|
l.value && l.value.scrollTo({
|
|
171
|
-
left: t * (((o =
|
|
156
|
+
left: t * (((o = h.value) == null ? void 0 : o.ratio) ?? 1)
|
|
172
157
|
});
|
|
173
|
-
},
|
|
158
|
+
}, Z = (t) => {
|
|
174
159
|
var o;
|
|
175
160
|
l.value && l.value.scrollTo({
|
|
176
|
-
top: t * (((o =
|
|
161
|
+
top: t * (((o = d.value) == null ? void 0 : o.ratio) ?? 1)
|
|
177
162
|
});
|
|
178
|
-
}, F =
|
|
163
|
+
}, F = x(() => {
|
|
179
164
|
const t = {};
|
|
180
|
-
return e.type === "track" && (
|
|
165
|
+
return e.type === "track" && (y.value && (t.paddingBottom = `${L}px`), z.value && (t.paddingRight = `${L}px`)), [
|
|
181
166
|
t,
|
|
182
|
-
|
|
183
|
-
ignoreVerticalLayout: !!(e.outerClass || e.outerStyle)
|
|
184
|
-
}),
|
|
167
|
+
k(i.style, !0),
|
|
185
168
|
e.outerStyle
|
|
186
169
|
];
|
|
187
|
-
}),
|
|
188
|
-
|
|
189
|
-
|
|
170
|
+
}), P = x(() => [
|
|
171
|
+
r.block,
|
|
172
|
+
r.modifier(`type-${e.type}`),
|
|
190
173
|
{
|
|
191
|
-
[
|
|
174
|
+
[r.modifier("both")]: g.value
|
|
192
175
|
},
|
|
193
|
-
|
|
176
|
+
i.class,
|
|
194
177
|
e.outerClass
|
|
195
178
|
]);
|
|
196
179
|
return {
|
|
197
|
-
className:
|
|
198
|
-
cls:
|
|
180
|
+
className: r,
|
|
181
|
+
cls: P,
|
|
199
182
|
style: F,
|
|
200
183
|
rootRef: n,
|
|
201
|
-
getContainerAttrs:
|
|
202
|
-
getContainerStyle:
|
|
184
|
+
getContainerAttrs: Y,
|
|
185
|
+
getContainerStyle: N,
|
|
203
186
|
containerRef: l,
|
|
204
|
-
horizontalThumbRef:
|
|
205
|
-
verticalThumbRef:
|
|
206
|
-
horizontalData:
|
|
207
|
-
verticalData:
|
|
187
|
+
horizontalThumbRef: R,
|
|
188
|
+
verticalThumbRef: _,
|
|
189
|
+
horizontalData: h,
|
|
190
|
+
verticalData: d,
|
|
208
191
|
isBoth: g,
|
|
209
|
-
hasHorizontalScrollbar:
|
|
210
|
-
hasVerticalScrollbar:
|
|
211
|
-
handleResize:
|
|
212
|
-
handleScroll:
|
|
213
|
-
handleWheel:
|
|
214
|
-
handleHorizontalScroll:
|
|
215
|
-
handleVerticalScroll:
|
|
192
|
+
hasHorizontalScrollbar: y,
|
|
193
|
+
hasVerticalScrollbar: z,
|
|
194
|
+
handleResize: M,
|
|
195
|
+
handleScroll: U,
|
|
196
|
+
handleWheel: K,
|
|
197
|
+
handleHorizontalScroll: X,
|
|
198
|
+
handleVerticalScroll: Z
|
|
216
199
|
};
|
|
217
200
|
},
|
|
218
201
|
methods: {
|
|
@@ -225,14 +208,14 @@ const k = 20, z = 15, p = /* @__PURE__ */ new Set([
|
|
|
225
208
|
*/
|
|
226
209
|
scrollTo(e, a) {
|
|
227
210
|
var n, l;
|
|
228
|
-
const
|
|
229
|
-
|
|
211
|
+
const i = this.$props.disableHorizontal, r = this.$props.disableVertical;
|
|
212
|
+
ae(e) ? (n = this.$refs.containerRef) == null || n.scrollTo({
|
|
230
213
|
...e,
|
|
231
|
-
left:
|
|
232
|
-
top:
|
|
214
|
+
left: i ? 0 : e.left,
|
|
215
|
+
top: r ? 0 : e.top
|
|
233
216
|
}) : (e !== void 0 || a !== void 0) && ((l = this.$refs.containerRef) == null || l.scrollTo(
|
|
234
|
-
|
|
235
|
-
|
|
217
|
+
i ? 0 : e ?? 0,
|
|
218
|
+
r ? 0 : a ?? 0
|
|
236
219
|
));
|
|
237
220
|
},
|
|
238
221
|
/**
|
|
@@ -264,5 +247,5 @@ const k = 20, z = 15, p = /* @__PURE__ */ new Set([
|
|
|
264
247
|
}
|
|
265
248
|
});
|
|
266
249
|
export {
|
|
267
|
-
|
|
250
|
+
ye as default
|
|
268
251
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { on as
|
|
1
|
+
import { defineComponent as B, ref as c, computed as w, onBeforeUnmount as y } from "vue";
|
|
2
|
+
import { on as m, off as f } from "../../_utils/dom.js";
|
|
3
3
|
import { getClassNameMixin as D } from "../../_utils/config.js";
|
|
4
|
-
const
|
|
4
|
+
const L = B({
|
|
5
5
|
name: "Thumb",
|
|
6
6
|
props: {
|
|
7
7
|
data: {
|
|
@@ -13,8 +13,8 @@ const $ = k({
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
emits: ["scroll"],
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
16
|
+
setup(o, { emit: b }) {
|
|
17
|
+
const r = D("scrollbar--thumb"), s = c(), u = c(), n = w(() => o.direction === "horizontal" ? {
|
|
18
18
|
size: "width",
|
|
19
19
|
direction: "left",
|
|
20
20
|
client: "clientX"
|
|
@@ -22,56 +22,64 @@ const $ = k({
|
|
|
22
22
|
size: "height",
|
|
23
23
|
direction: "top",
|
|
24
24
|
client: "clientY"
|
|
25
|
-
}),
|
|
25
|
+
}), i = c(0), d = c(!1), z = c(0), C = w(() => {
|
|
26
26
|
var e;
|
|
27
27
|
return {
|
|
28
|
-
[
|
|
29
|
-
[
|
|
28
|
+
[n.value.size]: `${((e = o.data) == null ? void 0 : e.thumbSize) ?? 0}px`,
|
|
29
|
+
[n.value.direction]: `${i.value}px`
|
|
30
30
|
};
|
|
31
|
-
}),
|
|
32
|
-
e.preventDefault(),
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
var
|
|
37
|
-
if (e.preventDefault(),
|
|
38
|
-
const
|
|
39
|
-
e[
|
|
31
|
+
}), M = (e) => {
|
|
32
|
+
e.button === 0 && (e.preventDefault(), u.value && (v(), z.value = (e[n.value.client] - u.value.getBoundingClientRect()[n.value.direction]) / p(), d.value = !0, m(window, "mousemove", x), m(window, "mouseup", l), m(window, "contextmenu", l), m(window, "blur", l)));
|
|
33
|
+
}, v = () => {
|
|
34
|
+
f(window, "mousemove", x), f(window, "mouseup", l), f(window, "contextmenu", l), f(window, "blur", l);
|
|
35
|
+
}, S = (e) => {
|
|
36
|
+
var t, a;
|
|
37
|
+
if (e.button === 0 && (e.preventDefault(), u.value)) {
|
|
38
|
+
const g = h(
|
|
39
|
+
e[n.value.client] > u.value.getBoundingClientRect()[n.value.direction] ? i.value + (((t = o.data) == null ? void 0 : t.thumbSize) ?? 0) : i.value - (((a = o.data) == null ? void 0 : a.thumbSize) ?? 0)
|
|
40
40
|
);
|
|
41
|
-
|
|
41
|
+
g !== i.value && (i.value = g, b("scroll", g));
|
|
42
42
|
}
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
}, h = (e) => {
|
|
44
|
+
var t;
|
|
45
|
+
return Math.max(0, Math.min(e, ((t = o.data) == null ? void 0 : t.max) ?? e));
|
|
46
|
+
}, p = () => {
|
|
47
|
+
const e = s.value;
|
|
48
|
+
if (!e) return 1;
|
|
49
|
+
const t = o.direction === "horizontal" ? e.clientWidth : e.clientHeight, a = e.getBoundingClientRect()[n.value.size];
|
|
50
|
+
return t > 0 && a > 0 ? a / t : 1;
|
|
51
|
+
}, x = (e) => {
|
|
52
|
+
if (s.value && u.value) {
|
|
53
|
+
const t = h(
|
|
54
|
+
(e[n.value.client] - s.value.getBoundingClientRect()[n.value.direction]) / p() - z.value
|
|
47
55
|
);
|
|
48
|
-
|
|
56
|
+
t !== i.value && (i.value = t, b("scroll", t));
|
|
49
57
|
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
}, l = () => {
|
|
59
|
+
d.value = !1, v();
|
|
60
|
+
}, k = (e) => {
|
|
61
|
+
d.value || (e = h(e), e !== i.value && (i.value = e));
|
|
62
|
+
}, R = w(() => [
|
|
63
|
+
r.block,
|
|
64
|
+
r.modifier(`direction-${o.direction}`),
|
|
57
65
|
{
|
|
58
|
-
[
|
|
66
|
+
[r.modifier("dragging")]: d.value
|
|
59
67
|
}
|
|
60
68
|
]);
|
|
61
|
-
return
|
|
62
|
-
|
|
69
|
+
return y(() => {
|
|
70
|
+
v();
|
|
63
71
|
}), {
|
|
64
72
|
trackRef: s,
|
|
65
|
-
thumbRef:
|
|
66
|
-
className:
|
|
67
|
-
thumbCls:
|
|
73
|
+
thumbRef: u,
|
|
74
|
+
className: r,
|
|
75
|
+
thumbCls: R,
|
|
68
76
|
thumbStyle: C,
|
|
69
|
-
handleThumbMouseDown:
|
|
70
|
-
handleTrackClick:
|
|
71
|
-
setOffset:
|
|
77
|
+
handleThumbMouseDown: M,
|
|
78
|
+
handleTrackClick: S,
|
|
79
|
+
setOffset: k
|
|
72
80
|
};
|
|
73
81
|
}
|
|
74
82
|
});
|
|
75
83
|
export {
|
|
76
|
-
|
|
84
|
+
L as default
|
|
77
85
|
};
|