@uzum-tech/ui 1.10.1 → 1.11.1
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/index.js +1248 -263
- package/dist/index.prod.js +3 -3
- package/es/_internal/index.d.ts +2 -0
- package/es/_internal/index.js +1 -0
- package/es/_internal/safe-top-scrollbar/index.d.ts +2 -0
- package/es/_internal/safe-top-scrollbar/index.js +1 -0
- package/es/_internal/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +356 -0
- package/es/_internal/safe-top-scrollbar/src/SafeTopScrollbar.js +708 -0
- package/es/_internal/safe-top-scrollbar/src/styles/index.cssr.d.ts +2 -0
- package/es/_internal/safe-top-scrollbar/src/styles/index.cssr.js +80 -0
- package/es/_internal/safe-top-scrollbar/src/styles/rtl.cssr.d.ts +2 -0
- package/es/_internal/safe-top-scrollbar/src/styles/rtl.cssr.js +10 -0
- package/es/_internal/safe-top-scrollbar/styles/common.d.ts +7 -0
- package/es/_internal/safe-top-scrollbar/styles/common.js +7 -0
- package/es/_internal/safe-top-scrollbar/styles/dark.d.ts +3 -0
- package/es/_internal/safe-top-scrollbar/styles/dark.js +8 -0
- package/es/_internal/safe-top-scrollbar/styles/index.d.ts +4 -0
- package/es/_internal/safe-top-scrollbar/styles/index.js +3 -0
- package/es/_internal/safe-top-scrollbar/styles/light.d.ts +18 -0
- package/es/_internal/safe-top-scrollbar/styles/light.js +12 -0
- package/es/_internal/safe-top-scrollbar/styles/rtl.d.ts +3 -0
- package/es/_internal/safe-top-scrollbar/styles/rtl.js +6 -0
- package/es/chat/src/Chat.d.ts +14 -1
- package/es/chat/src/Chat.js +5 -0
- package/es/chat/src/ChatParts/ChatAttachment.js +31 -3
- package/es/chat/src/ChatParts/MainArea.js +37 -41
- package/es/chat/src/interface.d.ts +6 -2
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/drawer/src/Drawer.d.ts +18 -0
- package/es/drawer/src/Drawer.js +28 -26
- package/es/drawer/src/DrawerBodyWrapper.d.ts +8 -0
- package/es/drawer/src/DrawerBodyWrapper.js +36 -8
- package/es/modal-fullscreen/src/ModalFull.d.ts +2 -2
- package/es/modal-fullscreen/src/ModalFull.js +31 -24
- package/es/modal-fullscreen/src/styles/index.cssr.js +11 -11
- package/es/safe-top-scrollbar/index.d.ts +2 -0
- package/es/safe-top-scrollbar/index.js +1 -0
- package/es/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +177 -0
- package/es/safe-top-scrollbar/src/SafeTopScrollbar.js +38 -0
- package/es/themes/dark.js +2 -0
- package/es/themes/light.js +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/index.d.ts +2 -0
- package/lib/_internal/index.js +4 -1
- package/lib/_internal/safe-top-scrollbar/index.d.ts +2 -0
- package/lib/_internal/safe-top-scrollbar/index.js +9 -0
- package/lib/_internal/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +356 -0
- package/lib/_internal/safe-top-scrollbar/src/SafeTopScrollbar.js +714 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/index.cssr.d.ts +2 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/index.cssr.js +85 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/rtl.cssr.js +15 -0
- package/lib/_internal/safe-top-scrollbar/styles/common.d.ts +7 -0
- package/lib/_internal/safe-top-scrollbar/styles/common.js +10 -0
- package/lib/_internal/safe-top-scrollbar/styles/dark.d.ts +3 -0
- package/lib/_internal/safe-top-scrollbar/styles/dark.js +10 -0
- package/lib/_internal/safe-top-scrollbar/styles/index.d.ts +4 -0
- package/lib/_internal/safe-top-scrollbar/styles/index.js +12 -0
- package/lib/_internal/safe-top-scrollbar/styles/light.d.ts +18 -0
- package/lib/_internal/safe-top-scrollbar/styles/light.js +16 -0
- package/lib/_internal/safe-top-scrollbar/styles/rtl.d.ts +3 -0
- package/lib/_internal/safe-top-scrollbar/styles/rtl.js +12 -0
- package/lib/chat/src/Chat.d.ts +14 -1
- package/lib/chat/src/Chat.js +5 -0
- package/lib/chat/src/ChatParts/ChatAttachment.js +30 -2
- package/lib/chat/src/ChatParts/MainArea.js +37 -41
- package/lib/chat/src/interface.d.ts +6 -2
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/drawer/src/Drawer.d.ts +18 -0
- package/lib/drawer/src/Drawer.js +28 -26
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +8 -0
- package/lib/drawer/src/DrawerBodyWrapper.js +36 -8
- package/lib/modal-fullscreen/src/ModalFull.d.ts +2 -2
- package/lib/modal-fullscreen/src/ModalFull.js +30 -23
- package/lib/modal-fullscreen/src/styles/index.cssr.js +11 -11
- package/lib/safe-top-scrollbar/index.d.ts +2 -0
- package/lib/safe-top-scrollbar/index.js +9 -0
- package/lib/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +177 -0
- package/lib/safe-top-scrollbar/src/SafeTopScrollbar.js +41 -0
- package/lib/themes/dark.js +5 -0
- package/lib/themes/light.js +5 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +1 -0
- package/web-types.json +58 -2
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.XSafeTopScrollbar = void 0;
|
|
7
|
+
const evtd_1 = require("evtd");
|
|
8
|
+
const seemly_1 = require("seemly");
|
|
9
|
+
const vooks_1 = require("vooks");
|
|
10
|
+
const vue_1 = require("vue");
|
|
11
|
+
const vueuc_1 = require("vueuc");
|
|
12
|
+
const _mixins_1 = require("../../../_mixins");
|
|
13
|
+
const _utils_1 = require("../../../_utils");
|
|
14
|
+
const styles_1 = require("../styles");
|
|
15
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
16
|
+
const safeTopscrollbarProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { duration: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0
|
|
19
|
+
}, scrollable: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: true
|
|
22
|
+
}, xScrollable: Boolean, trigger: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'hover'
|
|
25
|
+
}, useUnifiedContainer: Boolean, triggerDisplayManually: Boolean,
|
|
26
|
+
// If container is set, resize observer won't not attached
|
|
27
|
+
container: Function, content: Function, containerClass: String, containerStyle: [String, Object], contentClass: [String, Array], contentStyle: [String, Object], horizontalRailStyle: [String, Object], verticalRailStyle: [String, Object], onScroll: Function, onWheel: Function, onResize: Function, internalOnUpdateScrollLeft: Function, internalHoistYRail: Boolean, yPlacement: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'right'
|
|
30
|
+
}, xPlacement: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'bottom'
|
|
33
|
+
} });
|
|
34
|
+
const SafeTopScrollbar = (0, vue_1.defineComponent)({
|
|
35
|
+
name: 'SafeTopScrollbar',
|
|
36
|
+
props: safeTopscrollbarProps,
|
|
37
|
+
inheritAttrs: false,
|
|
38
|
+
setup(props) {
|
|
39
|
+
const { mergedClsPrefixRef, inlineThemeDisabled, mergedRtlRef } = (0, _mixins_1.useConfig)(props);
|
|
40
|
+
const rtlEnabledRef = (0, _mixins_1.useRtl)('SafeTopScrollbar', mergedRtlRef, mergedClsPrefixRef);
|
|
41
|
+
// dom ref
|
|
42
|
+
const wrapperRef = (0, vue_1.ref)(null);
|
|
43
|
+
const containerRef = (0, vue_1.ref)(null);
|
|
44
|
+
const contentRef = (0, vue_1.ref)(null);
|
|
45
|
+
const yRailRef = (0, vue_1.ref)(null);
|
|
46
|
+
const xRailRef = (0, vue_1.ref)(null);
|
|
47
|
+
// data ref
|
|
48
|
+
const contentHeightRef = (0, vue_1.ref)(null);
|
|
49
|
+
const contentWidthRef = (0, vue_1.ref)(null);
|
|
50
|
+
const containerHeightRef = (0, vue_1.ref)(null);
|
|
51
|
+
const containerWidthRef = (0, vue_1.ref)(null);
|
|
52
|
+
const yRailSizeRef = (0, vue_1.ref)(null);
|
|
53
|
+
const xRailSizeRef = (0, vue_1.ref)(null);
|
|
54
|
+
const containerScrollTopRef = (0, vue_1.ref)(0);
|
|
55
|
+
const containerScrollLeftRef = (0, vue_1.ref)(0);
|
|
56
|
+
const isShowXBarRef = (0, vue_1.ref)(false);
|
|
57
|
+
const isShowYBarRef = (0, vue_1.ref)(false);
|
|
58
|
+
let yBarPressed = false;
|
|
59
|
+
let xBarPressed = false;
|
|
60
|
+
let xBarVanishTimerId;
|
|
61
|
+
let yBarVanishTimerId;
|
|
62
|
+
let memoYTop = 0;
|
|
63
|
+
let memoXLeft = 0;
|
|
64
|
+
let memoMouseX = 0;
|
|
65
|
+
let memoMouseY = 0;
|
|
66
|
+
let previousScrollHeight = 0;
|
|
67
|
+
let previousScrollTop = 0;
|
|
68
|
+
const isIos = (0, vooks_1.useIsIos)();
|
|
69
|
+
const themeRef = (0, _mixins_1.useTheme)('SafeTopScrollbar', '-safe-top-scrollbar', index_cssr_1.default, styles_1.scrollbarLight, props, mergedClsPrefixRef);
|
|
70
|
+
const yBarSizeRef = (0, vue_1.computed)(() => {
|
|
71
|
+
const { value: containerHeight } = containerHeightRef;
|
|
72
|
+
const { value: contentHeight } = contentHeightRef;
|
|
73
|
+
const { value: yRailSize } = yRailSizeRef;
|
|
74
|
+
if (containerHeight === null ||
|
|
75
|
+
contentHeight === null ||
|
|
76
|
+
yRailSize === null) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
return Math.min(containerHeight, (yRailSize * containerHeight) / contentHeight +
|
|
81
|
+
(0, seemly_1.depx)(themeRef.value.self.width) * 1.5);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const yBarSizePxRef = (0, vue_1.computed)(() => {
|
|
85
|
+
return `${yBarSizeRef.value}px`;
|
|
86
|
+
});
|
|
87
|
+
const xBarSizeRef = (0, vue_1.computed)(() => {
|
|
88
|
+
const { value: containerWidth } = containerWidthRef;
|
|
89
|
+
const { value: contentWidth } = contentWidthRef;
|
|
90
|
+
const { value: xRailSize } = xRailSizeRef;
|
|
91
|
+
if (containerWidth === null ||
|
|
92
|
+
contentWidth === null ||
|
|
93
|
+
xRailSize === null) {
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return ((xRailSize * containerWidth) / contentWidth +
|
|
98
|
+
(0, seemly_1.depx)(themeRef.value.self.height) * 1.5);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const xBarSizePxRef = (0, vue_1.computed)(() => {
|
|
102
|
+
return `${xBarSizeRef.value}px`;
|
|
103
|
+
});
|
|
104
|
+
const yBarTopRef = (0, vue_1.computed)(() => {
|
|
105
|
+
const { value: containerHeight } = containerHeightRef;
|
|
106
|
+
const { value: containerScrollTop } = containerScrollTopRef;
|
|
107
|
+
const { value: contentHeight } = contentHeightRef;
|
|
108
|
+
const { value: yRailSize } = yRailSizeRef;
|
|
109
|
+
if (containerHeight === null ||
|
|
110
|
+
contentHeight === null ||
|
|
111
|
+
yRailSize === null) {
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const heightDiff = contentHeight - containerHeight;
|
|
116
|
+
if (!heightDiff)
|
|
117
|
+
return 0;
|
|
118
|
+
return ((containerScrollTop / heightDiff) * (yRailSize - yBarSizeRef.value));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const yBarTopPxRef = (0, vue_1.computed)(() => {
|
|
122
|
+
return `${yBarTopRef.value}px`;
|
|
123
|
+
});
|
|
124
|
+
const xBarLeftRef = (0, vue_1.computed)(() => {
|
|
125
|
+
const { value: containerWidth } = containerWidthRef;
|
|
126
|
+
const { value: containerScrollLeft } = containerScrollLeftRef;
|
|
127
|
+
const { value: contentWidth } = contentWidthRef;
|
|
128
|
+
const { value: xRailSize } = xRailSizeRef;
|
|
129
|
+
if (containerWidth === null ||
|
|
130
|
+
contentWidth === null ||
|
|
131
|
+
xRailSize === null) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const widthDiff = contentWidth - containerWidth;
|
|
136
|
+
if (!widthDiff)
|
|
137
|
+
return 0;
|
|
138
|
+
return ((containerScrollLeft / widthDiff) * (xRailSize - xBarSizeRef.value));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const xBarLeftPxRef = (0, vue_1.computed)(() => {
|
|
142
|
+
return `${xBarLeftRef.value}px`;
|
|
143
|
+
});
|
|
144
|
+
const needYBarRef = (0, vue_1.computed)(() => {
|
|
145
|
+
const { value: containerHeight } = containerHeightRef;
|
|
146
|
+
const { value: contentHeight } = contentHeightRef;
|
|
147
|
+
return (containerHeight !== null &&
|
|
148
|
+
contentHeight !== null &&
|
|
149
|
+
contentHeight > containerHeight);
|
|
150
|
+
});
|
|
151
|
+
const needXBarRef = (0, vue_1.computed)(() => {
|
|
152
|
+
const { value: containerWidth } = containerWidthRef;
|
|
153
|
+
const { value: contentWidth } = contentWidthRef;
|
|
154
|
+
return (containerWidth !== null &&
|
|
155
|
+
contentWidth !== null &&
|
|
156
|
+
contentWidth > containerWidth);
|
|
157
|
+
});
|
|
158
|
+
const mergedShowXBarRef = (0, vue_1.computed)(() => {
|
|
159
|
+
const { trigger } = props;
|
|
160
|
+
return trigger === 'none' || isShowXBarRef.value;
|
|
161
|
+
});
|
|
162
|
+
const mergedShowYBarRef = (0, vue_1.computed)(() => {
|
|
163
|
+
const { trigger } = props;
|
|
164
|
+
return trigger === 'none' || isShowYBarRef.value;
|
|
165
|
+
});
|
|
166
|
+
const mergedContainerRef = (0, vue_1.computed)(() => {
|
|
167
|
+
const { container } = props;
|
|
168
|
+
if (container)
|
|
169
|
+
return container();
|
|
170
|
+
return containerRef.value;
|
|
171
|
+
});
|
|
172
|
+
const mergedContentRef = (0, vue_1.computed)(() => {
|
|
173
|
+
const { content } = props;
|
|
174
|
+
if (content)
|
|
175
|
+
return content();
|
|
176
|
+
return contentRef.value;
|
|
177
|
+
});
|
|
178
|
+
const scrollTo = (options, y) => {
|
|
179
|
+
if (!props.scrollable)
|
|
180
|
+
return;
|
|
181
|
+
if (typeof options === 'number') {
|
|
182
|
+
scrollToPosition(options, y !== null && y !== void 0 ? y : 0, 0, false, 'auto');
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const { left, top, index, elSize, position, behavior, el, debounce = true } = options;
|
|
186
|
+
if (left !== undefined || top !== undefined) {
|
|
187
|
+
scrollToPosition(left !== null && left !== void 0 ? left : 0, top !== null && top !== void 0 ? top : 0, 0, false, behavior);
|
|
188
|
+
}
|
|
189
|
+
if (el !== undefined) {
|
|
190
|
+
scrollToPosition(0, el.offsetTop, el.offsetHeight, debounce, behavior);
|
|
191
|
+
}
|
|
192
|
+
else if (index !== undefined && elSize !== undefined) {
|
|
193
|
+
scrollToPosition(0, index * elSize, elSize, debounce, behavior);
|
|
194
|
+
}
|
|
195
|
+
else if (position === 'bottom') {
|
|
196
|
+
scrollToPosition(0, Number.MAX_SAFE_INTEGER, 0, false, behavior);
|
|
197
|
+
}
|
|
198
|
+
else if (position === 'top') {
|
|
199
|
+
scrollToPosition(0, 0, 0, false, behavior);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const activateState = (0, _utils_1.useReactivated)(() => {
|
|
203
|
+
// Only restore for builtin container & content
|
|
204
|
+
if (!props.container) {
|
|
205
|
+
// remount
|
|
206
|
+
scrollTo({
|
|
207
|
+
top: containerScrollTopRef.value,
|
|
208
|
+
left: containerScrollLeftRef.value
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const handleContentResize = () => {
|
|
213
|
+
if (activateState.isDeactivated)
|
|
214
|
+
return;
|
|
215
|
+
const { value: container } = mergedContainerRef;
|
|
216
|
+
if (container && previousScrollHeight > 0) {
|
|
217
|
+
const currentScrollHeight = container.scrollHeight;
|
|
218
|
+
const currentScrollTop = container.scrollTop;
|
|
219
|
+
const savedScrollHeight = previousScrollHeight;
|
|
220
|
+
const savedScrollTop = previousScrollTop;
|
|
221
|
+
const heightDiff = currentScrollHeight - savedScrollHeight;
|
|
222
|
+
if (heightDiff > 0 && currentScrollTop === savedScrollTop) {
|
|
223
|
+
container.scrollTop = savedScrollTop + heightDiff;
|
|
224
|
+
}
|
|
225
|
+
sync();
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
sync();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const handleContainerResize = (e) => {
|
|
232
|
+
if (activateState.isDeactivated)
|
|
233
|
+
return;
|
|
234
|
+
const { onResize } = props;
|
|
235
|
+
if (onResize) {
|
|
236
|
+
onResize(e);
|
|
237
|
+
}
|
|
238
|
+
sync();
|
|
239
|
+
};
|
|
240
|
+
const scrollBy = (options, y) => {
|
|
241
|
+
if (!props.scrollable)
|
|
242
|
+
return;
|
|
243
|
+
const { value: container } = mergedContainerRef;
|
|
244
|
+
if (!container)
|
|
245
|
+
return;
|
|
246
|
+
if (typeof options === 'object') {
|
|
247
|
+
container.scrollBy(options);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
container.scrollBy(options, y || 0);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
function scrollToPosition(left, top, elSize, debounce, behavior) {
|
|
254
|
+
const { value: container } = mergedContainerRef;
|
|
255
|
+
if (!container)
|
|
256
|
+
return;
|
|
257
|
+
if (debounce) {
|
|
258
|
+
const { scrollTop, offsetHeight } = container;
|
|
259
|
+
if (top > scrollTop) {
|
|
260
|
+
if (top + elSize <= scrollTop + offsetHeight) {
|
|
261
|
+
// do nothing
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
container.scrollTo({
|
|
265
|
+
left,
|
|
266
|
+
top: top + elSize - offsetHeight,
|
|
267
|
+
behavior
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
container.scrollTo({
|
|
274
|
+
left,
|
|
275
|
+
top,
|
|
276
|
+
behavior
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function handleMouseEnterWrapper() {
|
|
280
|
+
showXBar();
|
|
281
|
+
showYBar();
|
|
282
|
+
sync();
|
|
283
|
+
}
|
|
284
|
+
function handleMouseLeaveWrapper() {
|
|
285
|
+
hideBar();
|
|
286
|
+
}
|
|
287
|
+
function hideBar() {
|
|
288
|
+
hideYBar();
|
|
289
|
+
hideXBar();
|
|
290
|
+
}
|
|
291
|
+
function hideYBar() {
|
|
292
|
+
if (yBarVanishTimerId !== undefined) {
|
|
293
|
+
window.clearTimeout(yBarVanishTimerId);
|
|
294
|
+
}
|
|
295
|
+
yBarVanishTimerId = window.setTimeout(() => {
|
|
296
|
+
isShowYBarRef.value = false;
|
|
297
|
+
}, props.duration);
|
|
298
|
+
}
|
|
299
|
+
function hideXBar() {
|
|
300
|
+
if (xBarVanishTimerId !== undefined) {
|
|
301
|
+
window.clearTimeout(xBarVanishTimerId);
|
|
302
|
+
}
|
|
303
|
+
xBarVanishTimerId = window.setTimeout(() => {
|
|
304
|
+
isShowXBarRef.value = false;
|
|
305
|
+
}, props.duration);
|
|
306
|
+
}
|
|
307
|
+
function showXBar() {
|
|
308
|
+
if (xBarVanishTimerId !== undefined) {
|
|
309
|
+
window.clearTimeout(xBarVanishTimerId);
|
|
310
|
+
}
|
|
311
|
+
isShowXBarRef.value = true;
|
|
312
|
+
}
|
|
313
|
+
function showYBar() {
|
|
314
|
+
if (yBarVanishTimerId !== undefined) {
|
|
315
|
+
window.clearTimeout(yBarVanishTimerId);
|
|
316
|
+
}
|
|
317
|
+
isShowYBarRef.value = true;
|
|
318
|
+
}
|
|
319
|
+
function handleScroll(e) {
|
|
320
|
+
const { onScroll } = props;
|
|
321
|
+
if (onScroll)
|
|
322
|
+
onScroll(e);
|
|
323
|
+
// Save scroll state before syncing
|
|
324
|
+
const { value: container } = mergedContainerRef;
|
|
325
|
+
if (container) {
|
|
326
|
+
previousScrollHeight = container.scrollHeight;
|
|
327
|
+
previousScrollTop = container.scrollTop;
|
|
328
|
+
}
|
|
329
|
+
syncScrollState();
|
|
330
|
+
}
|
|
331
|
+
function syncScrollState() {
|
|
332
|
+
// only collect scroll state, do not trigger any dom event
|
|
333
|
+
const { value: container } = mergedContainerRef;
|
|
334
|
+
if (container) {
|
|
335
|
+
containerScrollTopRef.value = container.scrollTop;
|
|
336
|
+
containerScrollLeftRef.value =
|
|
337
|
+
container.scrollLeft * ((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? -1 : 1);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function syncPositionState() {
|
|
341
|
+
// only collect position state, do not trigger any dom event
|
|
342
|
+
// Don't use getClientBoundingRect because element may be scale transformed
|
|
343
|
+
const { value: content } = mergedContentRef;
|
|
344
|
+
if (content) {
|
|
345
|
+
contentHeightRef.value = content.offsetHeight;
|
|
346
|
+
contentWidthRef.value = content.offsetWidth;
|
|
347
|
+
}
|
|
348
|
+
const { value: container } = mergedContainerRef;
|
|
349
|
+
if (container) {
|
|
350
|
+
containerHeightRef.value = container.offsetHeight;
|
|
351
|
+
containerWidthRef.value = container.offsetWidth;
|
|
352
|
+
}
|
|
353
|
+
const { value: xRailEl } = xRailRef;
|
|
354
|
+
const { value: yRailEl } = yRailRef;
|
|
355
|
+
if (xRailEl) {
|
|
356
|
+
xRailSizeRef.value = xRailEl.offsetWidth;
|
|
357
|
+
}
|
|
358
|
+
if (yRailEl) {
|
|
359
|
+
yRailSizeRef.value = yRailEl.offsetHeight;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Sometimes there's only one element that we can scroll,
|
|
364
|
+
* For example for textarea, there won't be a content element.
|
|
365
|
+
*/
|
|
366
|
+
function syncUnifiedContainer() {
|
|
367
|
+
const { value: container } = mergedContainerRef;
|
|
368
|
+
if (container) {
|
|
369
|
+
containerScrollTopRef.value = container.scrollTop;
|
|
370
|
+
containerScrollLeftRef.value =
|
|
371
|
+
container.scrollLeft * ((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? -1 : 1);
|
|
372
|
+
containerHeightRef.value = container.offsetHeight;
|
|
373
|
+
containerWidthRef.value = container.offsetWidth;
|
|
374
|
+
contentHeightRef.value = container.scrollHeight;
|
|
375
|
+
contentWidthRef.value = container.scrollWidth;
|
|
376
|
+
}
|
|
377
|
+
const { value: xRailEl } = xRailRef;
|
|
378
|
+
const { value: yRailEl } = yRailRef;
|
|
379
|
+
if (xRailEl) {
|
|
380
|
+
xRailSizeRef.value = xRailEl.offsetWidth;
|
|
381
|
+
}
|
|
382
|
+
if (yRailEl) {
|
|
383
|
+
yRailSizeRef.value = yRailEl.offsetHeight;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
function sync() {
|
|
387
|
+
if (!props.scrollable)
|
|
388
|
+
return;
|
|
389
|
+
if (props.useUnifiedContainer) {
|
|
390
|
+
syncUnifiedContainer();
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
syncPositionState();
|
|
394
|
+
syncScrollState();
|
|
395
|
+
}
|
|
396
|
+
// Save current scroll state after sync for next comparison
|
|
397
|
+
const { value: container } = mergedContainerRef;
|
|
398
|
+
if (container) {
|
|
399
|
+
previousScrollHeight = container.scrollHeight;
|
|
400
|
+
previousScrollTop = container.scrollTop;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function isMouseUpAway(e) {
|
|
404
|
+
var _a;
|
|
405
|
+
return !((_a = wrapperRef.value) === null || _a === void 0 ? void 0 : _a.contains((0, seemly_1.getPreciseEventTarget)(e)));
|
|
406
|
+
}
|
|
407
|
+
function handleXScrollMouseDown(e) {
|
|
408
|
+
e.preventDefault();
|
|
409
|
+
e.stopPropagation();
|
|
410
|
+
xBarPressed = true;
|
|
411
|
+
(0, evtd_1.on)('mousemove', window, handleXScrollMouseMove, true);
|
|
412
|
+
(0, evtd_1.on)('mouseup', window, handleXScrollMouseUp, true);
|
|
413
|
+
memoXLeft = containerScrollLeftRef.value;
|
|
414
|
+
memoMouseX = (rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value)
|
|
415
|
+
? window.innerWidth - e.clientX
|
|
416
|
+
: e.clientX;
|
|
417
|
+
}
|
|
418
|
+
function handleXScrollMouseMove(e) {
|
|
419
|
+
if (!xBarPressed)
|
|
420
|
+
return;
|
|
421
|
+
if (xBarVanishTimerId !== undefined) {
|
|
422
|
+
window.clearTimeout(xBarVanishTimerId);
|
|
423
|
+
}
|
|
424
|
+
if (yBarVanishTimerId !== undefined) {
|
|
425
|
+
window.clearTimeout(yBarVanishTimerId);
|
|
426
|
+
}
|
|
427
|
+
const { value: containerWidth } = containerWidthRef;
|
|
428
|
+
const { value: contentWidth } = contentWidthRef;
|
|
429
|
+
const { value: xBarSize } = xBarSizeRef;
|
|
430
|
+
if (containerWidth === null || contentWidth === null)
|
|
431
|
+
return;
|
|
432
|
+
const dX = (rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value)
|
|
433
|
+
? window.innerWidth - e.clientX - memoMouseX
|
|
434
|
+
: e.clientX - memoMouseX;
|
|
435
|
+
const dScrollLeft = (dX * (contentWidth - containerWidth)) / (containerWidth - xBarSize);
|
|
436
|
+
const toScrollLeftUpperBound = contentWidth - containerWidth;
|
|
437
|
+
let toScrollLeft = memoXLeft + dScrollLeft;
|
|
438
|
+
toScrollLeft = Math.min(toScrollLeftUpperBound, toScrollLeft);
|
|
439
|
+
toScrollLeft = Math.max(toScrollLeft, 0);
|
|
440
|
+
const { value: container } = mergedContainerRef;
|
|
441
|
+
if (container) {
|
|
442
|
+
container.scrollLeft = toScrollLeft * ((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? -1 : 1);
|
|
443
|
+
const { internalOnUpdateScrollLeft } = props;
|
|
444
|
+
if (internalOnUpdateScrollLeft)
|
|
445
|
+
internalOnUpdateScrollLeft(toScrollLeft);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function handleXScrollMouseUp(e) {
|
|
449
|
+
e.preventDefault();
|
|
450
|
+
e.stopPropagation();
|
|
451
|
+
(0, evtd_1.off)('mousemove', window, handleXScrollMouseMove, true);
|
|
452
|
+
(0, evtd_1.off)('mouseup', window, handleXScrollMouseUp, true);
|
|
453
|
+
xBarPressed = false;
|
|
454
|
+
sync();
|
|
455
|
+
if (isMouseUpAway(e)) {
|
|
456
|
+
hideBar();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function handleYScrollMouseDown(e) {
|
|
460
|
+
e.preventDefault();
|
|
461
|
+
e.stopPropagation();
|
|
462
|
+
yBarPressed = true;
|
|
463
|
+
(0, evtd_1.on)('mousemove', window, handleYScrollMouseMove, true);
|
|
464
|
+
(0, evtd_1.on)('mouseup', window, handleYScrollMouseUp, true);
|
|
465
|
+
memoYTop = containerScrollTopRef.value;
|
|
466
|
+
memoMouseY = e.clientY;
|
|
467
|
+
}
|
|
468
|
+
function handleYScrollMouseMove(e) {
|
|
469
|
+
if (!yBarPressed)
|
|
470
|
+
return;
|
|
471
|
+
if (xBarVanishTimerId !== undefined) {
|
|
472
|
+
window.clearTimeout(xBarVanishTimerId);
|
|
473
|
+
}
|
|
474
|
+
if (yBarVanishTimerId !== undefined) {
|
|
475
|
+
window.clearTimeout(yBarVanishTimerId);
|
|
476
|
+
}
|
|
477
|
+
const { value: containerHeight } = containerHeightRef;
|
|
478
|
+
const { value: contentHeight } = contentHeightRef;
|
|
479
|
+
const { value: yBarSize } = yBarSizeRef;
|
|
480
|
+
if (containerHeight === null || contentHeight === null)
|
|
481
|
+
return;
|
|
482
|
+
const dY = e.clientY - memoMouseY;
|
|
483
|
+
const dScrollTop = (dY * (contentHeight - containerHeight)) / (containerHeight - yBarSize);
|
|
484
|
+
const toScrollTopUpperBound = contentHeight - containerHeight;
|
|
485
|
+
let toScrollTop = memoYTop + dScrollTop;
|
|
486
|
+
toScrollTop = Math.min(toScrollTopUpperBound, toScrollTop);
|
|
487
|
+
toScrollTop = Math.max(toScrollTop, 0);
|
|
488
|
+
const { value: container } = mergedContainerRef;
|
|
489
|
+
if (container) {
|
|
490
|
+
container.scrollTop = toScrollTop;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function handleYScrollMouseUp(e) {
|
|
494
|
+
e.preventDefault();
|
|
495
|
+
e.stopPropagation();
|
|
496
|
+
(0, evtd_1.off)('mousemove', window, handleYScrollMouseMove, true);
|
|
497
|
+
(0, evtd_1.off)('mouseup', window, handleYScrollMouseUp, true);
|
|
498
|
+
yBarPressed = false;
|
|
499
|
+
sync();
|
|
500
|
+
if (isMouseUpAway(e)) {
|
|
501
|
+
hideBar();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
(0, vue_1.watchEffect)(() => {
|
|
505
|
+
const { value: needXBar } = needXBarRef;
|
|
506
|
+
const { value: needYBar } = needYBarRef;
|
|
507
|
+
const { value: mergedClsPrefix } = mergedClsPrefixRef;
|
|
508
|
+
const { value: xRailEl } = xRailRef;
|
|
509
|
+
const { value: yRailEl } = yRailRef;
|
|
510
|
+
if (xRailEl) {
|
|
511
|
+
if (!needXBar) {
|
|
512
|
+
xRailEl.classList.add(`${mergedClsPrefix}-scrollbar-rail--disabled`);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
xRailEl.classList.remove(`${mergedClsPrefix}-scrollbar-rail--disabled`);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (yRailEl) {
|
|
519
|
+
if (!needYBar) {
|
|
520
|
+
yRailEl.classList.add(`${mergedClsPrefix}-scrollbar-rail--disabled`);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
yRailEl.classList.remove(`${mergedClsPrefix}-scrollbar-rail--disabled`);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
(0, vue_1.onMounted)(() => {
|
|
528
|
+
// if container exist, it always can't be resolved when scrollbar is mounted
|
|
529
|
+
// for example:
|
|
530
|
+
// - component
|
|
531
|
+
// - scrollbar
|
|
532
|
+
// - inner
|
|
533
|
+
// if you pass inner to scrollbar, you may use a ref inside component
|
|
534
|
+
// however, when scrollbar is mounted, ref is not ready at component
|
|
535
|
+
// you need to init by yourself
|
|
536
|
+
if (props.container)
|
|
537
|
+
return;
|
|
538
|
+
sync();
|
|
539
|
+
// Initialize previous values
|
|
540
|
+
const { value: container } = mergedContainerRef;
|
|
541
|
+
if (container) {
|
|
542
|
+
previousScrollHeight = container.scrollHeight;
|
|
543
|
+
previousScrollTop = container.scrollTop;
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
(0, vue_1.onBeforeUnmount)(() => {
|
|
547
|
+
if (xBarVanishTimerId !== undefined) {
|
|
548
|
+
window.clearTimeout(xBarVanishTimerId);
|
|
549
|
+
}
|
|
550
|
+
if (yBarVanishTimerId !== undefined) {
|
|
551
|
+
window.clearTimeout(yBarVanishTimerId);
|
|
552
|
+
}
|
|
553
|
+
(0, evtd_1.off)('mousemove', window, handleYScrollMouseMove, true);
|
|
554
|
+
(0, evtd_1.off)('mouseup', window, handleYScrollMouseUp, true);
|
|
555
|
+
});
|
|
556
|
+
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
557
|
+
const { common: { cubicBezierEaseInOut }, self: { color, colorHover, height, width, borderRadius, railInsetHorizontalTop, railInsetHorizontalBottom, railInsetVerticalRight, railInsetVerticalLeft, railColor } } = themeRef.value;
|
|
558
|
+
const { top: railTopHorizontalTop, right: railRightHorizontalTop, bottom: railBottomHorizontalTop, left: railLeftHorizontalTop } = (0, seemly_1.getPadding)(railInsetHorizontalTop);
|
|
559
|
+
const { top: railTopHorizontalBottom, right: railRightHorizontalBottom, bottom: railBottomHorizontalBottom, left: railLeftHorizontalBottom } = (0, seemly_1.getPadding)(railInsetHorizontalBottom);
|
|
560
|
+
const { top: railTopVerticalRight, right: railRightVerticalRight, bottom: railBottomVerticalRight, left: railLeftVerticalRight } = (0, seemly_1.getPadding)((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value)
|
|
561
|
+
? (0, _utils_1.rtlInset)(railInsetVerticalRight)
|
|
562
|
+
: railInsetVerticalRight);
|
|
563
|
+
const { top: railTopVerticalLeft, right: railRightVerticalLeft, bottom: railBottomVerticalLeft, left: railLeftVerticalLeft } = (0, seemly_1.getPadding)((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value)
|
|
564
|
+
? (0, _utils_1.rtlInset)(railInsetVerticalLeft)
|
|
565
|
+
: railInsetVerticalLeft);
|
|
566
|
+
return {
|
|
567
|
+
'--u-scrollbar-bezier': cubicBezierEaseInOut,
|
|
568
|
+
'--u-scrollbar-color': color,
|
|
569
|
+
'--u-scrollbar-color-hover': colorHover,
|
|
570
|
+
'--u-scrollbar-border-radius': borderRadius,
|
|
571
|
+
'--u-scrollbar-width': width,
|
|
572
|
+
'--u-scrollbar-height': height,
|
|
573
|
+
'--u-scrollbar-rail-top-horizontal-top': railTopHorizontalTop,
|
|
574
|
+
'--u-scrollbar-rail-right-horizontal-top': railRightHorizontalTop,
|
|
575
|
+
'--u-scrollbar-rail-bottom-horizontal-top': railBottomHorizontalTop,
|
|
576
|
+
'--u-scrollbar-rail-left-horizontal-top': railLeftHorizontalTop,
|
|
577
|
+
'--u-scrollbar-rail-top-horizontal-bottom': railTopHorizontalBottom,
|
|
578
|
+
'--u-scrollbar-rail-right-horizontal-bottom': railRightHorizontalBottom,
|
|
579
|
+
'--u-scrollbar-rail-bottom-horizontal-bottom': railBottomHorizontalBottom,
|
|
580
|
+
'--u-scrollbar-rail-left-horizontal-bottom': railLeftHorizontalBottom,
|
|
581
|
+
'--u-scrollbar-rail-top-vertical-right': railTopVerticalRight,
|
|
582
|
+
'--u-scrollbar-rail-right-vertical-right': railRightVerticalRight,
|
|
583
|
+
'--u-scrollbar-rail-bottom-vertical-right': railBottomVerticalRight,
|
|
584
|
+
'--u-scrollbar-rail-left-vertical-right': railLeftVerticalRight,
|
|
585
|
+
'--u-scrollbar-rail-top-vertical-left': railTopVerticalLeft,
|
|
586
|
+
'--u-scrollbar-rail-right-vertical-left': railRightVerticalLeft,
|
|
587
|
+
'--u-scrollbar-rail-bottom-vertical-left': railBottomVerticalLeft,
|
|
588
|
+
'--u-scrollbar-rail-left-vertical-left': railLeftVerticalLeft,
|
|
589
|
+
'--u-scrollbar-rail-color': railColor
|
|
590
|
+
};
|
|
591
|
+
});
|
|
592
|
+
const themeClassHandle = inlineThemeDisabled
|
|
593
|
+
? (0, _mixins_1.useThemeClass)('scrollbar', undefined, cssVarsRef, props)
|
|
594
|
+
: undefined;
|
|
595
|
+
function getScrollState() {
|
|
596
|
+
const { value: container } = mergedContainerRef;
|
|
597
|
+
if (!container) {
|
|
598
|
+
return { scrollHeight: 0, scrollTop: 0, clientHeight: 0 };
|
|
599
|
+
}
|
|
600
|
+
return {
|
|
601
|
+
scrollHeight: container.scrollHeight,
|
|
602
|
+
scrollTop: container.scrollTop,
|
|
603
|
+
clientHeight: container.clientHeight
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function adjustScrollTop(heightDiff) {
|
|
607
|
+
const { value: container } = mergedContainerRef;
|
|
608
|
+
if (!container)
|
|
609
|
+
return;
|
|
610
|
+
container.scrollTop = container.scrollTop + heightDiff;
|
|
611
|
+
}
|
|
612
|
+
const exposedMethods = {
|
|
613
|
+
scrollTo,
|
|
614
|
+
scrollBy,
|
|
615
|
+
sync,
|
|
616
|
+
syncUnifiedContainer,
|
|
617
|
+
handleMouseEnterWrapper,
|
|
618
|
+
handleMouseLeaveWrapper,
|
|
619
|
+
getScrollState,
|
|
620
|
+
adjustScrollTop
|
|
621
|
+
};
|
|
622
|
+
return Object.assign(Object.assign({}, exposedMethods), { mergedClsPrefix: mergedClsPrefixRef, rtlEnabled: rtlEnabledRef, containerScrollTop: containerScrollTopRef, wrapperRef,
|
|
623
|
+
containerRef,
|
|
624
|
+
contentRef,
|
|
625
|
+
yRailRef,
|
|
626
|
+
xRailRef, needYBar: needYBarRef, needXBar: needXBarRef, yBarSizePx: yBarSizePxRef, xBarSizePx: xBarSizePxRef, yBarTopPx: yBarTopPxRef, xBarLeftPx: xBarLeftPxRef, isShowXBar: mergedShowXBarRef, isShowYBar: mergedShowYBarRef, isIos,
|
|
627
|
+
handleScroll,
|
|
628
|
+
handleContentResize,
|
|
629
|
+
handleContainerResize,
|
|
630
|
+
handleYScrollMouseDown,
|
|
631
|
+
handleXScrollMouseDown, cssVars: inlineThemeDisabled ? undefined : cssVarsRef, themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender });
|
|
632
|
+
},
|
|
633
|
+
render() {
|
|
634
|
+
var _a;
|
|
635
|
+
const { $slots, mergedClsPrefix, triggerDisplayManually, rtlEnabled, internalHoistYRail, yPlacement, xPlacement, xScrollable } = this;
|
|
636
|
+
if (!this.scrollable)
|
|
637
|
+
return (_a = $slots.default) === null || _a === void 0 ? void 0 : _a.call($slots);
|
|
638
|
+
const triggerIsNone = this.trigger === 'none';
|
|
639
|
+
const createYRail = (className, style) => {
|
|
640
|
+
return ((0, vue_1.h)("div", { ref: "yRailRef", class: [
|
|
641
|
+
`${mergedClsPrefix}-scrollbar-rail`,
|
|
642
|
+
`${mergedClsPrefix}-scrollbar-rail--vertical`,
|
|
643
|
+
`${mergedClsPrefix}-scrollbar-rail--vertical--${yPlacement}`,
|
|
644
|
+
className
|
|
645
|
+
], "data-scrollbar-rail": true, style: [style || '', this.verticalRailStyle], "aria-hidden": true }, (0, vue_1.h)((triggerIsNone ? _utils_1.Wrapper : vue_1.Transition), triggerIsNone ? null : { name: 'fade-in-transition' }, {
|
|
646
|
+
default: () => this.needYBar && this.isShowYBar && !this.isIos ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, style: {
|
|
647
|
+
height: this.yBarSizePx,
|
|
648
|
+
top: this.yBarTopPx
|
|
649
|
+
}, onMousedown: this.handleYScrollMouseDown })) : null
|
|
650
|
+
})));
|
|
651
|
+
};
|
|
652
|
+
const createChildren = () => {
|
|
653
|
+
var _a, _b;
|
|
654
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
655
|
+
return (0, vue_1.h)('div', (0, vue_1.mergeProps)(this.$attrs, {
|
|
656
|
+
role: 'none',
|
|
657
|
+
ref: 'wrapperRef',
|
|
658
|
+
class: [
|
|
659
|
+
`${mergedClsPrefix}-safe-top-scrollbar`,
|
|
660
|
+
this.themeClass,
|
|
661
|
+
rtlEnabled && `${mergedClsPrefix}-scrollbar--rtl`
|
|
662
|
+
],
|
|
663
|
+
style: this.cssVars,
|
|
664
|
+
onMouseenter: triggerDisplayManually
|
|
665
|
+
? undefined
|
|
666
|
+
: this.handleMouseEnterWrapper,
|
|
667
|
+
onMouseleave: triggerDisplayManually
|
|
668
|
+
? undefined
|
|
669
|
+
: this.handleMouseLeaveWrapper
|
|
670
|
+
}), [
|
|
671
|
+
this.container ? ((_b = $slots.default) === null || _b === void 0 ? void 0 : _b.call($slots)) : ((0, vue_1.h)("div", { role: "none", ref: "containerRef", class: [
|
|
672
|
+
`${mergedClsPrefix}-scrollbar-container`,
|
|
673
|
+
this.containerClass
|
|
674
|
+
], style: this.containerStyle, onScroll: this.handleScroll, onWheel: this.onWheel },
|
|
675
|
+
(0, vue_1.h)(vueuc_1.VResizeObserver, { onResize: this.handleContentResize }, {
|
|
676
|
+
default: () => ((0, vue_1.h)("div", { ref: "contentRef", role: "none", style: [
|
|
677
|
+
{
|
|
678
|
+
width: this.xScrollable ? 'fit-content' : null
|
|
679
|
+
},
|
|
680
|
+
this.contentStyle
|
|
681
|
+
], class: [
|
|
682
|
+
`${mergedClsPrefix}-scrollbar-content`,
|
|
683
|
+
this.contentClass
|
|
684
|
+
] }, $slots))
|
|
685
|
+
}))),
|
|
686
|
+
internalHoistYRail ? null : createYRail(undefined, undefined),
|
|
687
|
+
xScrollable && ((0, vue_1.h)("div", { ref: "xRailRef", class: [
|
|
688
|
+
`${mergedClsPrefix}-scrollbar-rail`,
|
|
689
|
+
`${mergedClsPrefix}-scrollbar-rail--horizontal`,
|
|
690
|
+
`${mergedClsPrefix}-scrollbar-rail--horizontal--${xPlacement}`
|
|
691
|
+
], style: this.horizontalRailStyle, "data-scrollbar-rail": true, "aria-hidden": true }, (0, vue_1.h)((triggerIsNone ? _utils_1.Wrapper : vue_1.Transition), triggerIsNone ? null : { name: 'fade-in-transition' }, {
|
|
692
|
+
default: () => this.needXBar && this.isShowXBar && !this.isIos ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, style: {
|
|
693
|
+
width: this.xBarSizePx,
|
|
694
|
+
right: rtlEnabled ? this.xBarLeftPx : undefined,
|
|
695
|
+
left: rtlEnabled ? undefined : this.xBarLeftPx
|
|
696
|
+
}, onMousedown: this.handleXScrollMouseDown })) : null
|
|
697
|
+
})))
|
|
698
|
+
]);
|
|
699
|
+
};
|
|
700
|
+
const scrollbarNode = this.container ? (createChildren()) : ((0, vue_1.h)(vueuc_1.VResizeObserver, { onResize: this.handleContainerResize }, {
|
|
701
|
+
default: createChildren
|
|
702
|
+
}));
|
|
703
|
+
if (internalHoistYRail) {
|
|
704
|
+
return ((0, vue_1.h)(vue_1.Fragment, null,
|
|
705
|
+
scrollbarNode,
|
|
706
|
+
createYRail(this.themeClass, this.cssVars)));
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
return scrollbarNode;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
exports.default = SafeTopScrollbar;
|
|
714
|
+
exports.XSafeTopScrollbar = SafeTopScrollbar;
|