@v1nt1248/3nclient-lib 0.3.24 → 0.3.27
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/README.md +2 -0
- package/dist/chunks/emoticons-DMgiBINj.js +2517 -0
- package/dist/chunks/plugins-keys-jqAZ5D94.js +4466 -0
- package/dist/chunks/ui3n-notification-DlDM-u-R.js +276 -0
- package/dist/components/index.d.ts +39 -35
- package/dist/components/ui3n-scrollbar-horizontal/types.d.ts +21 -0
- package/dist/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts +40 -0
- package/dist/components/ui3n-scrollbar-vertical/types.d.ts +33 -0
- package/dist/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +40 -0
- package/dist/index.d.ts +37 -33
- package/dist/mixins.scss +102 -0
- package/dist/style.css +1 -1
- package/dist/ui3n-components.d.ts +37 -33
- package/dist/ui3n-components.js +2487 -18934
- package/dist/ui3n-plugins.js +60 -4121
- package/dist/ui3n-utils.js +5 -7911
- package/dist/variables.css +2 -2
- package/package.json +6 -13
- package/src/components/index.ts +24 -0
- package/src/components/ui3n-dialog/ui3n-dialog.vue +12 -10
- package/src/components/ui3n-list/types.ts +1 -1
- package/src/components/ui3n-list/ui3n-list.vue +4 -11
- package/src/components/ui3n-scrollbar-horizontal/types.ts +25 -0
- package/src/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.vue +330 -0
- package/src/components/ui3n-scrollbar-vertical/types.ts +37 -0
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +330 -0
- package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +52 -58
- package/dist/components/ui3n-autocomplete/{ui3n-autocomplete.vue.d.ts → ui3n-autocomplete.d.ts} +0 -0
- package/dist/components/ui3n-badge/{ui3n-badge-simple.vue.d.ts → ui3n-badge-simple.d.ts} +0 -0
- package/dist/components/ui3n-badge/{ui3n-badge.vue.d.ts → ui3n-badge.d.ts} +0 -0
- package/dist/components/ui3n-breadcrumbs/{ui3n-breadcrumb.vue.d.ts → ui3n-breadcrumb.d.ts} +0 -0
- package/dist/components/ui3n-breadcrumbs/{ui3n-breadcrumbs.vue.d.ts → ui3n-breadcrumbs.d.ts} +0 -0
- package/dist/components/ui3n-button/{ui3n-button.vue.d.ts → ui3n-button.d.ts} +0 -0
- package/dist/components/ui3n-checkbox/{ui3n-checkbox.vue.d.ts → ui3n-checkbox.d.ts} +0 -0
- package/dist/components/ui3n-chip/{ui3n-chip.vue.d.ts → ui3n-chip.d.ts} +0 -0
- package/dist/components/ui3n-dialog/{ui3n-dialog-provider.vue.d.ts → ui3n-dialog-provider.d.ts} +0 -0
- package/dist/components/ui3n-dialog/{ui3n-dialog.vue.d.ts → ui3n-dialog.d.ts} +0 -0
- package/dist/components/ui3n-drop-files/{ui3n-drop-files.vue.d.ts → ui3n-drop-files.d.ts} +0 -0
- package/dist/components/ui3n-editable/{ui3n-editable.vue.d.ts → ui3n-editable.d.ts} +0 -0
- package/dist/components/ui3n-emoji/{ui3n-emoji.vue.d.ts → ui3n-emoji.d.ts} +0 -0
- package/dist/components/ui3n-icon/{ui3n-icon.vue.d.ts → ui3n-icon.d.ts} +0 -0
- package/dist/components/ui3n-input/{ui3n-input.vue.d.ts → ui3n-input.d.ts} +0 -0
- package/dist/components/ui3n-input-file/{ui3n-input-file.vue.d.ts → ui3n-input-file.d.ts} +0 -0
- package/dist/components/ui3n-list/{ui3n-list.vue.d.ts → ui3n-list.d.ts} +0 -0
- package/dist/components/ui3n-menu/{ui3n-menu.vue.d.ts → ui3n-menu.d.ts} +0 -0
- package/dist/components/ui3n-mobile-menu/{ui3n-mobile-menu.vue.d.ts → ui3n-mobile-menu.d.ts} +0 -0
- package/dist/components/ui3n-mobile-menu-item/{ui3n-mobile-menu-item.vue.d.ts → ui3n-mobile-menu-item.d.ts} +0 -0
- package/dist/components/ui3n-notification/{ui3n-notification.vue.d.ts → ui3n-notification.d.ts} +0 -0
- package/dist/components/ui3n-progress/{ui3n-progress-circular.vue.d.ts → ui3n-progress-circular.d.ts} +0 -0
- package/dist/components/ui3n-progress/{ui3n-progress-linear.vue.d.ts → ui3n-progress-linear.d.ts} +0 -0
- package/dist/components/ui3n-radio-group/{ui3n-radio-group.vue.d.ts → ui3n-radio-group.d.ts} +0 -0
- package/dist/components/ui3n-radio-group/{ui3n-radio.vue.d.ts → ui3n-radio.d.ts} +0 -0
- package/dist/components/ui3n-selector/{ui3n-selector.vue.d.ts → ui3n-selector.d.ts} +0 -0
- package/dist/components/ui3n-slider/{ui3n-slider.vue.d.ts → ui3n-slider.d.ts} +2 -2
- /package/dist/components/ui3n-step-line-bar/{ui3n-step-line-bar.vue.d.ts → ui3n-step-line-bar.d.ts} +0 -0
- /package/dist/components/ui3n-switch/{ui3n-switch.vue.d.ts → ui3n-switch.d.ts} +0 -0
- /package/dist/components/ui3n-table/{ui3n-table-sort-icon.vue.d.ts → ui3n-table-sort-icon.d.ts} +0 -0
- /package/dist/components/ui3n-table/{ui3n-table.vue.d.ts → ui3n-table.d.ts} +0 -0
- /package/dist/components/ui3n-tabs/{ui3n-tabs.vue.d.ts → ui3n-tabs.d.ts} +0 -0
- /package/dist/components/ui3n-text/{ui3n-text.vue.d.ts → ui3n-text.d.ts} +0 -0
- /package/dist/components/ui3n-tooltip/{ui3n-tooltip.vue.d.ts → ui3n-tooltip.d.ts} +0 -0
- /package/dist/components/ui3n-virtual-scroll/{ui3n-virtual-scroll.vue.d.ts → ui3n-virtual-scroll.d.ts} +0 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
|
|
3
|
+
import type {
|
|
4
|
+
Ui3nScrollbarVerticalProps,
|
|
5
|
+
Ui3nScrollbarVerticalEmits,
|
|
6
|
+
Ui3nScrollbarVerticalSlots,
|
|
7
|
+
Ui3nScrollbarVerticalExpose,
|
|
8
|
+
} from './types';
|
|
9
|
+
|
|
10
|
+
const MIN_HEIGHT = 40;
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<Ui3nScrollbarVerticalProps>(), {
|
|
13
|
+
thumbMinHeight: MIN_HEIGHT,
|
|
14
|
+
thumbHeight: 'auto',
|
|
15
|
+
thumbRadius: 4,
|
|
16
|
+
thumbColor: 'var(--color-bg-control-accent-default)',
|
|
17
|
+
thumbHoverColor: 'var(--color-bg-control-accent-hover)',
|
|
18
|
+
thumbActiveColor: 'var(--color-bg-control-accent-focused)',
|
|
19
|
+
trackWidth: 6,
|
|
20
|
+
trackColor: 'transparent',
|
|
21
|
+
});
|
|
22
|
+
const emits = defineEmits<Ui3nScrollbarVerticalEmits>();
|
|
23
|
+
defineSlots<Ui3nScrollbarVerticalSlots>();
|
|
24
|
+
|
|
25
|
+
const containerRef = ref<HTMLDivElement | null>(null);
|
|
26
|
+
const trackRef = ref<HTMLDivElement | null>(null);
|
|
27
|
+
const thumbRef = ref<HTMLDivElement | null>(null);
|
|
28
|
+
|
|
29
|
+
const scrollHeight = ref(0);
|
|
30
|
+
const clientHeight = ref(0);
|
|
31
|
+
const scrollTop = ref(0);
|
|
32
|
+
|
|
33
|
+
const isDragging = ref(false);
|
|
34
|
+
const isHovered = ref(false);
|
|
35
|
+
const isScrollingNow = ref(false);
|
|
36
|
+
|
|
37
|
+
let resizeObserver: ResizeObserver | null = null;
|
|
38
|
+
let scrollTimeout: number | undefined;
|
|
39
|
+
let startY = 0;
|
|
40
|
+
let startScrollTop = 0;
|
|
41
|
+
|
|
42
|
+
const isScrollable = computed(() => scrollHeight.value > clientHeight.value);
|
|
43
|
+
|
|
44
|
+
const isBarVisible = computed(() => {
|
|
45
|
+
if (isDragging.value) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
return isScrollable.value && (isHovered.value || isScrollingNow.value);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const minHeight = computed(() => {
|
|
52
|
+
const num = Number(props.thumbMinHeight);
|
|
53
|
+
return isNaN(num) ? MIN_HEIGHT : num;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const thumbHeight = computed(() => {
|
|
57
|
+
if (!scrollHeight.value) {
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (props.thumbHeight !== 'auto') {
|
|
62
|
+
const fixedNum = Number(props.thumbHeight);
|
|
63
|
+
return isNaN(fixedNum) ? minHeight.value : fixedNum;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const ratio = clientHeight.value / scrollHeight.value;
|
|
67
|
+
const calculated = clientHeight.value * ratio;
|
|
68
|
+
return Math.max(minHeight.value, calculated);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const thumbTop = computed(() => {
|
|
72
|
+
if (!scrollHeight.value || scrollHeight.value === clientHeight.value) {
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const maxScrollTop = scrollHeight.value - clientHeight.value;
|
|
77
|
+
const maxThumbTop = clientHeight.value - thumbHeight.value;
|
|
78
|
+
return (scrollTop.value / maxScrollTop) * maxThumbTop;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const thumbRadiusCss = computed(() => {
|
|
82
|
+
const num = Number(props.thumbRadius);
|
|
83
|
+
return isNaN(num) ? String(props.thumbRadius) : `${num}px`;
|
|
84
|
+
});
|
|
85
|
+
const thumbColorCss = computed(() => props.thumbColor);
|
|
86
|
+
const thumbHoverColorCss = computed(() => props.thumbHoverColor);
|
|
87
|
+
const thumbActiveColorCss = computed(() => props.thumbActiveColor);
|
|
88
|
+
const trackWidthCss = computed(() => {
|
|
89
|
+
const num = Number(props.trackWidth);
|
|
90
|
+
return isNaN(num) ? String(props.trackWidth) : `${num}px`;
|
|
91
|
+
});
|
|
92
|
+
const trackColorCss = computed(() => props.trackColor);
|
|
93
|
+
|
|
94
|
+
function updateMetrics() {
|
|
95
|
+
if (!containerRef.value) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
scrollHeight.value = containerRef.value.scrollHeight;
|
|
100
|
+
clientHeight.value = containerRef.value.clientHeight;
|
|
101
|
+
scrollTop.value = containerRef.value.scrollTop;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function onScroll(event: Event) {
|
|
105
|
+
if (!isDragging.value) {
|
|
106
|
+
scrollTop.value = (event.target as HTMLDivElement).scrollTop;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
isScrollingNow.value = true;
|
|
110
|
+
window.clearTimeout(scrollTimeout);
|
|
111
|
+
|
|
112
|
+
scrollTimeout = window.setTimeout(() => {
|
|
113
|
+
isScrollingNow.value = false;
|
|
114
|
+
}, 1500);
|
|
115
|
+
|
|
116
|
+
emits('scroll', event);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onTrackClick(e: MouseEvent) {
|
|
120
|
+
if (e.target !== trackRef.value || !containerRef.value || !trackRef.value) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const trackRect = trackRef.value.getBoundingClientRect();
|
|
125
|
+
const clickY = e.clientY - trackRect.top;
|
|
126
|
+
const targetThumbTop = clickY - thumbHeight.value / 2;
|
|
127
|
+
const maxScrollTop = scrollHeight.value - clientHeight.value;
|
|
128
|
+
const maxThumbTop = clientHeight.value - thumbHeight.value;
|
|
129
|
+
|
|
130
|
+
let targetScrollTop = (targetThumbTop / maxThumbTop) * maxScrollTop;
|
|
131
|
+
targetScrollTop = Math.max(0, Math.min(maxScrollTop, targetScrollTop));
|
|
132
|
+
|
|
133
|
+
containerRef.value.scrollTo({
|
|
134
|
+
top: targetScrollTop,
|
|
135
|
+
behavior: 'smooth',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function onThumbPointerDown(e: PointerEvent) {
|
|
140
|
+
if (!thumbRef.value || !containerRef.value) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
e.stopPropagation();
|
|
146
|
+
|
|
147
|
+
thumbRef.value.setPointerCapture(e.pointerId);
|
|
148
|
+
|
|
149
|
+
isDragging.value = true;
|
|
150
|
+
startY = e.clientY;
|
|
151
|
+
startScrollTop = scrollTop.value;
|
|
152
|
+
|
|
153
|
+
document.body.style.userSelect = 'none';
|
|
154
|
+
|
|
155
|
+
thumbRef.value.addEventListener('pointermove', onThumbPointerMove);
|
|
156
|
+
thumbRef.value.addEventListener('pointerup', onThumbPointerUp);
|
|
157
|
+
thumbRef.value.addEventListener('pointercancel', onThumbPointerUp);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function onThumbPointerMove(e: PointerEvent) {
|
|
161
|
+
if (!isDragging.value || !containerRef.value) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const deltaY = e.clientY - startY;
|
|
166
|
+
const maxScrollTop = scrollHeight.value - clientHeight.value;
|
|
167
|
+
const maxThumbTop = clientHeight.value - thumbHeight.value;
|
|
168
|
+
|
|
169
|
+
const scrollDelta = (deltaY / maxThumbTop) * maxScrollTop;
|
|
170
|
+
containerRef.value.scrollTop = startScrollTop + scrollDelta;
|
|
171
|
+
scrollTop.value = containerRef.value.scrollTop;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function onThumbPointerUp(e: PointerEvent) {
|
|
175
|
+
if (!isDragging.value) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
isDragging.value = false;
|
|
180
|
+
document.body.style.userSelect = '';
|
|
181
|
+
|
|
182
|
+
if (thumbRef.value) {
|
|
183
|
+
try {
|
|
184
|
+
thumbRef.value.releasePointerCapture(e.pointerId);
|
|
185
|
+
} catch (err) {}
|
|
186
|
+
|
|
187
|
+
thumbRef.value.removeEventListener('pointermove', onThumbPointerMove);
|
|
188
|
+
thumbRef.value.removeEventListener('pointerup', onThumbPointerUp);
|
|
189
|
+
thumbRef.value.removeEventListener('pointercancel', onThumbPointerUp);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
onMounted(() => {
|
|
194
|
+
updateMetrics();
|
|
195
|
+
if (containerRef.value) {
|
|
196
|
+
resizeObserver = new ResizeObserver(updateMetrics);
|
|
197
|
+
resizeObserver.observe(containerRef.value);
|
|
198
|
+
|
|
199
|
+
if (containerRef.value.firstElementChild) {
|
|
200
|
+
resizeObserver.observe(containerRef.value.firstElementChild);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
onBeforeUnmount(() => {
|
|
206
|
+
resizeObserver?.disconnect();
|
|
207
|
+
window.clearTimeout(scrollTimeout);
|
|
208
|
+
|
|
209
|
+
if (thumbRef.value) {
|
|
210
|
+
thumbRef.value.removeEventListener('pointermove', onThumbPointerMove);
|
|
211
|
+
thumbRef.value.removeEventListener('pointerup', onThumbPointerUp);
|
|
212
|
+
thumbRef.value.removeEventListener('pointercancel', onThumbPointerUp);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
document.body.style.userSelect = '';
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
defineExpose<Ui3nScrollbarVerticalExpose>({
|
|
219
|
+
scrollTo: (options: ScrollToOptions) => {
|
|
220
|
+
containerRef.value?.scrollTo(options);
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
getContainer: () => containerRef.value!,
|
|
224
|
+
});
|
|
225
|
+
</script>
|
|
226
|
+
|
|
227
|
+
<template>
|
|
228
|
+
<div
|
|
229
|
+
:class="$style.ui3nScrollbarVertical"
|
|
230
|
+
:style="{
|
|
231
|
+
'--ui3n-scrollbar-thumb-radius': thumbRadiusCss,
|
|
232
|
+
'--ui3n-scrollbar-thumb-color': thumbColorCss,
|
|
233
|
+
'--ui3n-scrollbar-thumb-hover-color': thumbHoverColorCss,
|
|
234
|
+
'--ui3n-scrollbar-thumb-active-color': thumbActiveColorCss,
|
|
235
|
+
'--ui3n-scrollbar-track-width': trackWidthCss,
|
|
236
|
+
'--ui3n-scrollbar-track-color': trackColorCss,
|
|
237
|
+
}"
|
|
238
|
+
@mouseenter="isHovered = true"
|
|
239
|
+
@mouseleave="isHovered = false"
|
|
240
|
+
>
|
|
241
|
+
<div
|
|
242
|
+
ref="containerRef"
|
|
243
|
+
:class="$style.scrollbarContainer"
|
|
244
|
+
@scroll="onScroll"
|
|
245
|
+
>
|
|
246
|
+
<slot />
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
<div
|
|
250
|
+
ref="trackRef"
|
|
251
|
+
:class="[$style.track, { [$style.trackVisible]: isBarVisible }]"
|
|
252
|
+
@mousedown="onTrackClick"
|
|
253
|
+
>
|
|
254
|
+
<div
|
|
255
|
+
ref="thumbRef"
|
|
256
|
+
:class="[$style.thumb, { [$style.active]: isDragging }]"
|
|
257
|
+
:style="{
|
|
258
|
+
height: `${thumbHeight}px`,
|
|
259
|
+
transform: `translateY(${thumbTop}px)`,
|
|
260
|
+
}"
|
|
261
|
+
@pointerdown="onThumbPointerDown"
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<style lang="scss" module>
|
|
268
|
+
.ui3nScrollbarVertical {
|
|
269
|
+
position: relative;
|
|
270
|
+
width: 100%;
|
|
271
|
+
height: 100%;
|
|
272
|
+
overflow: hidden;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.scrollbarContainer {
|
|
276
|
+
position: relative;
|
|
277
|
+
width: 100%;
|
|
278
|
+
height: 100%;
|
|
279
|
+
overflow-y: auto;
|
|
280
|
+
scrollbar-width: none;
|
|
281
|
+
|
|
282
|
+
&::-webkit-scrollbar {
|
|
283
|
+
display: none !important;
|
|
284
|
+
width: 0 !important;
|
|
285
|
+
height: 0 !important;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.track {
|
|
290
|
+
position: absolute;
|
|
291
|
+
top: 0;
|
|
292
|
+
right: 2px;
|
|
293
|
+
bottom: 0;
|
|
294
|
+
width: var(--ui3n-scrollbar-track-width);
|
|
295
|
+
background: var(--ui3n-scrollbar-track-color);
|
|
296
|
+
z-index: 10;
|
|
297
|
+
visibility: hidden;
|
|
298
|
+
opacity: 0;
|
|
299
|
+
pointer-events: none;
|
|
300
|
+
transition:
|
|
301
|
+
opacity 0.3s ease,
|
|
302
|
+
visibility 0.3s ease;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.trackVisible {
|
|
306
|
+
visibility: visible;
|
|
307
|
+
opacity: 1;
|
|
308
|
+
pointer-events: auto;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.thumb {
|
|
312
|
+
position: absolute;
|
|
313
|
+
left: 0;
|
|
314
|
+
width: 100%;
|
|
315
|
+
border-radius: var(--ui3n-scrollbar-thumb-radius);
|
|
316
|
+
background-color: var(--ui3n-scrollbar-thumb-color);
|
|
317
|
+
cursor: pointer;
|
|
318
|
+
transition: background-color 0.15s ease;
|
|
319
|
+
touch-action: none;
|
|
320
|
+
|
|
321
|
+
&:hover {
|
|
322
|
+
background-color: var(--ui3n-scrollbar-thumb-hover-color);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&:active,
|
|
326
|
+
&.active {
|
|
327
|
+
background-color: var(--ui3n-scrollbar-thumb-active-color);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
</style>
|
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
<script lang="ts" setup generic="T extends { id?: string }">
|
|
2
|
-
import { computed,
|
|
3
|
-
import
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import Ui3nScrollbarVertical from '@/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue';
|
|
4
|
+
import type { Ui3nVirtualScrollProps, Ui3nVirtualScrollSlots } from './types';
|
|
4
5
|
|
|
5
|
-
const props = withDefaults(defineProps<Ui3nVirtualScrollProps<T>>(), {
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
defineSlots<Ui3nVirtualScrollSlots<T>>();
|
|
6
|
+
const props = withDefaults(defineProps<Ui3nVirtualScrollProps<T>>(), {
|
|
7
|
+
renderAhead: 20,
|
|
8
|
+
});
|
|
9
|
+
defineSlots<Ui3nVirtualScrollSlots<T>>();
|
|
9
10
|
|
|
10
|
-
const scrollTop = ref(0);
|
|
11
|
-
const
|
|
12
|
-
const wrapElement = ref<HTMLDivElement | null>(null);
|
|
13
|
-
const wrapElementHeight = computed(() => wrapElement.value
|
|
14
|
-
? wrapElement.value.clientHeight
|
|
15
|
-
: 0,
|
|
16
|
-
);
|
|
17
|
-
const itemCount = computed(() => props.items.length);
|
|
18
|
-
const totalHeight = computed(() => itemCount.value * props.minChildHeight);
|
|
19
|
-
const startNode = computed(() => {
|
|
20
|
-
const val = Math.floor(scrollTop.value / props.minChildHeight) - props.renderAhead;
|
|
21
|
-
return Math.max(0, val);
|
|
22
|
-
});
|
|
23
|
-
const visibleNodeCount = computed(() => {
|
|
24
|
-
const val = Math.ceil(wrapElementHeight.value / props.minChildHeight) + 2 * props.renderAhead;
|
|
25
|
-
return Math.min(itemCount.value - startNode.value, val);
|
|
26
|
-
});
|
|
27
|
-
const offsetY = computed(() => startNode.value * props.minChildHeight);
|
|
28
|
-
const visibleChildren = computed(() => props.items.slice(startNode.value, startNode.value + visibleNodeCount.value));
|
|
11
|
+
const scrollTop = ref(0);
|
|
12
|
+
const scrollbarComponentRef = ref<InstanceType<typeof Ui3nScrollbarVertical> | null>(null);
|
|
29
13
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
cancelAnimationFrame(animationFrame.value);
|
|
33
|
-
}
|
|
14
|
+
const itemCount = computed(() => props.items.length);
|
|
15
|
+
const totalHeight = computed(() => itemCount.value * props.minChildHeight);
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
const wrapElementHeight = computed(() => {
|
|
18
|
+
const el = scrollbarComponentRef.value?.getContainer();
|
|
19
|
+
return el ? el.clientHeight : 0;
|
|
20
|
+
});
|
|
37
21
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
22
|
+
const startNode = computed(() => {
|
|
23
|
+
const val = Math.floor(scrollTop.value / props.minChildHeight) - props.renderAhead;
|
|
24
|
+
return Math.max(0, val);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const visibleNodeCount = computed(() => {
|
|
28
|
+
return Math.ceil(wrapElementHeight.value / props.minChildHeight) + 2 * props.renderAhead;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const offsetY = computed(() => startNode.value * props.minChildHeight);
|
|
32
|
+
const visibleChildren = computed(() =>
|
|
33
|
+
props.items.slice(startNode.value, startNode.value + visibleNodeCount.value),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const onScroll = (event: Event) => {
|
|
37
|
+
scrollTop.value = (event.target as HTMLDivElement).scrollTop;
|
|
38
|
+
};
|
|
43
39
|
</script>
|
|
44
40
|
|
|
45
41
|
<template>
|
|
46
|
-
<
|
|
47
|
-
ref="
|
|
42
|
+
<ui3n-scrollbar-vertical
|
|
43
|
+
ref="scrollbarComponentRef"
|
|
48
44
|
:class="$style.ui3nVirtualScroll"
|
|
49
45
|
@scroll="onScroll"
|
|
50
46
|
>
|
|
@@ -70,30 +66,28 @@ onMounted(() => {
|
|
|
70
66
|
</div>
|
|
71
67
|
</div>
|
|
72
68
|
</div>
|
|
73
|
-
</
|
|
69
|
+
</ui3n-scrollbar-vertical>
|
|
74
70
|
</template>
|
|
75
71
|
|
|
76
72
|
<style lang="scss" module>
|
|
77
|
-
.ui3nVirtualScroll {
|
|
78
|
-
|
|
79
|
-
width: 100%;
|
|
80
|
-
height: 100%;
|
|
81
|
-
overflow-y: auto;
|
|
82
|
-
background-color: var(--color-bg-block-primary-default);
|
|
83
|
-
}
|
|
73
|
+
.ui3nVirtualScroll {
|
|
74
|
+
--ui3n-virtual-scroll-item-min-height: 16px;
|
|
84
75
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
will-change: transform;
|
|
89
|
-
}
|
|
76
|
+
background-color: var(--color-bg-block-primary-default);
|
|
77
|
+
}
|
|
90
78
|
|
|
91
|
-
.
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
.viewport {
|
|
80
|
+
position: relative;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
will-change: transform;
|
|
83
|
+
}
|
|
94
84
|
|
|
95
|
-
.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
.content {
|
|
86
|
+
will-change: transform;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.item {
|
|
90
|
+
position: relative;
|
|
91
|
+
min-height: var(--ui3n-virtual-scroll-item-min-height);
|
|
92
|
+
}
|
|
99
93
|
</style>
|
package/dist/components/ui3n-autocomplete/{ui3n-autocomplete.vue.d.ts → ui3n-autocomplete.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/components/ui3n-breadcrumbs/{ui3n-breadcrumbs.vue.d.ts → ui3n-breadcrumbs.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/components/ui3n-dialog/{ui3n-dialog-provider.vue.d.ts → ui3n-dialog-provider.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/components/ui3n-mobile-menu/{ui3n-mobile-menu.vue.d.ts → ui3n-mobile-menu.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
package/dist/components/ui3n-notification/{ui3n-notification.vue.d.ts → ui3n-notification.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
package/dist/components/ui3n-progress/{ui3n-progress-linear.vue.d.ts → ui3n-progress-linear.d.ts}
RENAMED
|
File without changes
|
package/dist/components/ui3n-radio-group/{ui3n-radio-group.vue.d.ts → ui3n-radio-group.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,15 +5,15 @@ declare const _default: import('vue').DefineComponent<UI3nSliderProps, {}, {}, {
|
|
|
5
5
|
"onUpdate:modelValue"?: ((value: number | [number, number]) => any) | undefined;
|
|
6
6
|
}>, {
|
|
7
7
|
activeColor: string;
|
|
8
|
+
thumbColor: string;
|
|
9
|
+
trackColor: string;
|
|
8
10
|
min: string | number;
|
|
9
11
|
max: string | number;
|
|
10
12
|
labelVisible: "always" | "normal" | "never";
|
|
11
13
|
labelTextColor: string;
|
|
12
14
|
labelColor: string;
|
|
13
|
-
trackColor: string;
|
|
14
15
|
trackHeight: string | number;
|
|
15
16
|
thumbSize: string | number;
|
|
16
|
-
thumbColor: string;
|
|
17
17
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
18
18
|
sliderEl: HTMLDivElement;
|
|
19
19
|
pointerEl1: HTMLDivElement;
|
/package/dist/components/ui3n-step-line-bar/{ui3n-step-line-bar.vue.d.ts → ui3n-step-line-bar.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/components/ui3n-table/{ui3n-table-sort-icon.vue.d.ts → ui3n-table-sort-icon.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|