@vuetify/nightly 3.3.5-master.2023-06-21 → 3.3.5-pr-17265.042d482
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 +21 -2
- package/dist/json/attributes.json +4 -0
- package/dist/json/importMap.json +4 -4
- package/dist/json/tags.json +1 -0
- package/dist/json/web-types.json +16 -14
- package/dist/vuetify-labs.css +57 -57
- package/dist/vuetify-labs.d.ts +80 -20
- package/dist/vuetify-labs.esm.js +460 -326
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +459 -325
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +19 -19
- package/dist/vuetify.d.ts +37 -15
- package/dist/vuetify.esm.js +448 -316
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +447 -315
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +675 -656
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.mjs +48 -35
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VCombobox/VCombobox.mjs +48 -35
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VSelect/VSelect.mjs +43 -31
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/useScrolling.mjs +69 -0
- package/lib/components/VSelect/useScrolling.mjs.map +1 -0
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs +50 -24
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs.map +1 -1
- package/lib/components/VVirtualScroll/VVirtualScrollItem.mjs +13 -23
- package/lib/components/VVirtualScroll/VVirtualScrollItem.mjs.map +1 -1
- package/lib/components/VVirtualScroll/index.d.mts +37 -15
- package/lib/components/index.d.mts +36 -14
- package/lib/composables/filter.mjs +6 -4
- package/lib/composables/filter.mjs.map +1 -1
- package/lib/composables/resizeObserver.mjs +6 -1
- package/lib/composables/resizeObserver.mjs.map +1 -1
- package/lib/composables/virtual.mjs +17 -17
- package/lib/composables/virtual.mjs.map +1 -1
- package/lib/entry-bundler.mjs +1 -1
- package/lib/entry-bundler.mjs.map +1 -1
- package/lib/framework.mjs +1 -1
- package/lib/framework.mjs.map +1 -1
- package/lib/index.d.mts +1 -1
- package/lib/labs/VDataTable/VDataTableVirtual.mjs +12 -10
- package/lib/labs/VDataTable/VDataTableVirtual.mjs.map +1 -1
- package/lib/labs/VDataTable/index.d.mts +44 -6
- package/lib/labs/components.d.mts +44 -6
- package/lib/util/getScrollParent.mjs +7 -1
- package/lib/util/getScrollParent.mjs.map +1 -1
- package/package.json +1 -1
package/dist/vuetify.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vuetify v3.3.5-
|
|
2
|
+
* Vuetify v3.3.5-pr-17265.042d482
|
|
3
3
|
* Forged by John Leider
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Fragment, reactive, computed, watchEffect, toRefs, capitalize, warn, watch, onScopeDispose, effectScope, ref, unref, provide, shallowRef, inject as inject$1, defineComponent as defineComponent$1, camelize, h, getCurrentInstance as getCurrentInstance$1, onBeforeUnmount, readonly, onDeactivated, onActivated, onMounted, toRaw, createVNode, TransitionGroup, Transition, mergeProps, onBeforeMount, nextTick, withDirectives, resolveDirective, vShow, isRef, toRef, Text, resolveDynamicComponent, Teleport, cloneVNode, createTextVNode, onBeforeUpdate, vModelText
|
|
7
|
+
import { Fragment, reactive, computed, watchEffect, toRefs, capitalize, warn, watch, onScopeDispose, effectScope, ref, unref, provide, shallowRef, inject as inject$1, defineComponent as defineComponent$1, camelize, h, getCurrentInstance as getCurrentInstance$1, onBeforeUnmount, readonly, onDeactivated, onActivated, onMounted, toRaw, createVNode, TransitionGroup, Transition, mergeProps, onBeforeMount, nextTick, withDirectives, resolveDirective, vShow, isRef, toRef, Text, resolveDynamicComponent, Teleport, cloneVNode, createTextVNode, onBeforeUpdate, vModelText } from 'vue';
|
|
8
8
|
|
|
9
9
|
// Types
|
|
10
10
|
// eslint-disable-line vue/prefer-import-from-vue
|
|
@@ -1247,8 +1247,9 @@ getUid.reset = () => {
|
|
|
1247
1247
|
};
|
|
1248
1248
|
|
|
1249
1249
|
function getScrollParent(el) {
|
|
1250
|
+
let includeHidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1250
1251
|
while (el) {
|
|
1251
|
-
if (hasScrollbar(el)) return el;
|
|
1252
|
+
if (includeHidden ? isPotentiallyScrollable(el) : hasScrollbar(el)) return el;
|
|
1252
1253
|
el = el.parentElement;
|
|
1253
1254
|
}
|
|
1254
1255
|
return document.scrollingElement;
|
|
@@ -1268,6 +1269,11 @@ function hasScrollbar(el) {
|
|
|
1268
1269
|
const style = window.getComputedStyle(el);
|
|
1269
1270
|
return style.overflowY === 'scroll' || style.overflowY === 'auto' && el.scrollHeight > el.clientHeight;
|
|
1270
1271
|
}
|
|
1272
|
+
function isPotentiallyScrollable(el) {
|
|
1273
|
+
if (!el || el.nodeType !== Node.ELEMENT_NODE) return false;
|
|
1274
|
+
const style = window.getComputedStyle(el);
|
|
1275
|
+
return ['scroll', 'auto'].includes(style.overflowY);
|
|
1276
|
+
}
|
|
1271
1277
|
|
|
1272
1278
|
const IN_BROWSER = typeof window !== 'undefined';
|
|
1273
1279
|
const SUPPORTS_INTERSECTION = IN_BROWSER && 'IntersectionObserver' in window;
|
|
@@ -1312,13 +1318,18 @@ function useRender(render) {
|
|
|
1312
1318
|
// Types
|
|
1313
1319
|
|
|
1314
1320
|
function useResizeObserver(callback) {
|
|
1321
|
+
let box = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'content';
|
|
1315
1322
|
const resizeRef = ref();
|
|
1316
1323
|
const contentRect = ref();
|
|
1317
1324
|
if (IN_BROWSER) {
|
|
1318
1325
|
const observer = new ResizeObserver(entries => {
|
|
1319
1326
|
callback?.(entries, observer);
|
|
1320
1327
|
if (!entries.length) return;
|
|
1321
|
-
|
|
1328
|
+
if (box === 'content') {
|
|
1329
|
+
contentRect.value = entries[0].contentRect;
|
|
1330
|
+
} else {
|
|
1331
|
+
contentRect.value = entries[0].target.getBoundingClientRect();
|
|
1332
|
+
}
|
|
1322
1333
|
});
|
|
1323
1334
|
onBeforeUnmount(() => {
|
|
1324
1335
|
observer.disconnect();
|
|
@@ -10375,6 +10386,301 @@ const VTextField = genericComponent()({
|
|
|
10375
10386
|
|
|
10376
10387
|
// Types
|
|
10377
10388
|
|
|
10389
|
+
const makeVVirtualScrollItemProps = propsFactory({
|
|
10390
|
+
renderless: Boolean,
|
|
10391
|
+
...makeComponentProps()
|
|
10392
|
+
}, 'VVirtualScrollItem');
|
|
10393
|
+
const VVirtualScrollItem = genericComponent()({
|
|
10394
|
+
name: 'VVirtualScrollItem',
|
|
10395
|
+
inheritAttrs: false,
|
|
10396
|
+
props: makeVVirtualScrollItemProps(),
|
|
10397
|
+
emits: {
|
|
10398
|
+
'update:height': height => true
|
|
10399
|
+
},
|
|
10400
|
+
setup(props, _ref) {
|
|
10401
|
+
let {
|
|
10402
|
+
attrs,
|
|
10403
|
+
emit,
|
|
10404
|
+
slots
|
|
10405
|
+
} = _ref;
|
|
10406
|
+
const {
|
|
10407
|
+
resizeRef,
|
|
10408
|
+
contentRect
|
|
10409
|
+
} = useResizeObserver(undefined, 'border');
|
|
10410
|
+
watch(() => contentRect.value?.height, height => {
|
|
10411
|
+
if (height != null) emit('update:height', height);
|
|
10412
|
+
});
|
|
10413
|
+
useRender(() => props.renderless ? createVNode(Fragment, null, [slots.default?.({
|
|
10414
|
+
itemRef: resizeRef
|
|
10415
|
+
})]) : createVNode("div", mergeProps({
|
|
10416
|
+
"ref": resizeRef,
|
|
10417
|
+
"class": ['v-virtual-scroll__item', props.class],
|
|
10418
|
+
"style": props.style
|
|
10419
|
+
}, attrs), [slots.default?.()]));
|
|
10420
|
+
}
|
|
10421
|
+
});
|
|
10422
|
+
|
|
10423
|
+
// Composables
|
|
10424
|
+
|
|
10425
|
+
// Types
|
|
10426
|
+
|
|
10427
|
+
const UP = -1;
|
|
10428
|
+
const DOWN = 1;
|
|
10429
|
+
const makeVirtualProps = propsFactory({
|
|
10430
|
+
itemHeight: {
|
|
10431
|
+
type: [Number, String],
|
|
10432
|
+
default: 48
|
|
10433
|
+
}
|
|
10434
|
+
}, 'virtual');
|
|
10435
|
+
function useVirtual(props, items, offset) {
|
|
10436
|
+
const first = shallowRef(0);
|
|
10437
|
+
const baseItemHeight = shallowRef(props.itemHeight);
|
|
10438
|
+
const itemHeight = computed({
|
|
10439
|
+
get: () => parseInt(baseItemHeight.value ?? 0, 10),
|
|
10440
|
+
set(val) {
|
|
10441
|
+
baseItemHeight.value = val;
|
|
10442
|
+
}
|
|
10443
|
+
});
|
|
10444
|
+
const containerRef = ref();
|
|
10445
|
+
const {
|
|
10446
|
+
resizeRef,
|
|
10447
|
+
contentRect
|
|
10448
|
+
} = useResizeObserver();
|
|
10449
|
+
watchEffect(() => {
|
|
10450
|
+
resizeRef.value = containerRef.value;
|
|
10451
|
+
});
|
|
10452
|
+
const display = useDisplay();
|
|
10453
|
+
const sizeMap = new Map();
|
|
10454
|
+
let sizes = Array.from({
|
|
10455
|
+
length: items.value.length
|
|
10456
|
+
});
|
|
10457
|
+
const visibleItems = computed(() => {
|
|
10458
|
+
const height = (!contentRect.value || containerRef.value === document.documentElement ? display.height.value : contentRect.value.height) - (offset?.value ?? 0);
|
|
10459
|
+
return Math.ceil(height / itemHeight.value * 1.7 + 1);
|
|
10460
|
+
});
|
|
10461
|
+
function handleItemResize(index, height) {
|
|
10462
|
+
itemHeight.value = Math.max(itemHeight.value, height);
|
|
10463
|
+
sizes[index] = height;
|
|
10464
|
+
sizeMap.set(items.value[index], height);
|
|
10465
|
+
}
|
|
10466
|
+
function calculateOffset(index) {
|
|
10467
|
+
return sizes.slice(0, index).reduce((acc, val) => acc + (val || itemHeight.value), 0);
|
|
10468
|
+
}
|
|
10469
|
+
function calculateMidPointIndex(scrollTop) {
|
|
10470
|
+
const end = items.value.length;
|
|
10471
|
+
let middle = 0;
|
|
10472
|
+
let middleOffset = 0;
|
|
10473
|
+
while (middleOffset < scrollTop && middle < end) {
|
|
10474
|
+
middleOffset += sizes[middle++] || itemHeight.value;
|
|
10475
|
+
}
|
|
10476
|
+
return middle - 1;
|
|
10477
|
+
}
|
|
10478
|
+
let lastScrollTop = 0;
|
|
10479
|
+
function handleScroll() {
|
|
10480
|
+
if (!containerRef.value || !contentRect.value) return;
|
|
10481
|
+
const height = contentRect.value.height - 56;
|
|
10482
|
+
const scrollTop = containerRef.value.scrollTop;
|
|
10483
|
+
const direction = scrollTop < lastScrollTop ? UP : DOWN;
|
|
10484
|
+
const midPointIndex = calculateMidPointIndex(scrollTop + height / 2);
|
|
10485
|
+
const buffer = Math.round(visibleItems.value / 3);
|
|
10486
|
+
const firstIndex = midPointIndex - buffer;
|
|
10487
|
+
const lastIndex = first.value + buffer * 2 - 1;
|
|
10488
|
+
if (direction === UP && midPointIndex <= lastIndex) {
|
|
10489
|
+
first.value = clamp(firstIndex, 0, items.value.length);
|
|
10490
|
+
} else if (direction === DOWN && midPointIndex >= lastIndex) {
|
|
10491
|
+
first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value);
|
|
10492
|
+
}
|
|
10493
|
+
lastScrollTop = scrollTop;
|
|
10494
|
+
}
|
|
10495
|
+
function scrollToIndex(index) {
|
|
10496
|
+
if (!containerRef.value) return;
|
|
10497
|
+
const offset = calculateOffset(index);
|
|
10498
|
+
containerRef.value.scrollTop = offset;
|
|
10499
|
+
}
|
|
10500
|
+
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
10501
|
+
const computedItems = computed(() => {
|
|
10502
|
+
return items.value.slice(first.value, last.value).map((item, index) => ({
|
|
10503
|
+
raw: item,
|
|
10504
|
+
index: index + first.value
|
|
10505
|
+
}));
|
|
10506
|
+
});
|
|
10507
|
+
const paddingTop = computed(() => calculateOffset(first.value));
|
|
10508
|
+
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
10509
|
+
watch(() => items.value.length, () => {
|
|
10510
|
+
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
10511
|
+
sizeMap.forEach((height, item) => {
|
|
10512
|
+
const index = items.value.indexOf(item);
|
|
10513
|
+
if (index === -1) {
|
|
10514
|
+
sizeMap.delete(item);
|
|
10515
|
+
} else {
|
|
10516
|
+
sizes[index] = height;
|
|
10517
|
+
}
|
|
10518
|
+
});
|
|
10519
|
+
});
|
|
10520
|
+
return {
|
|
10521
|
+
containerRef,
|
|
10522
|
+
computedItems,
|
|
10523
|
+
itemHeight,
|
|
10524
|
+
paddingTop,
|
|
10525
|
+
paddingBottom,
|
|
10526
|
+
scrollToIndex,
|
|
10527
|
+
handleScroll,
|
|
10528
|
+
handleItemResize
|
|
10529
|
+
};
|
|
10530
|
+
}
|
|
10531
|
+
|
|
10532
|
+
// Types
|
|
10533
|
+
|
|
10534
|
+
const makeVVirtualScrollProps = propsFactory({
|
|
10535
|
+
items: {
|
|
10536
|
+
type: Array,
|
|
10537
|
+
default: () => []
|
|
10538
|
+
},
|
|
10539
|
+
renderless: Boolean,
|
|
10540
|
+
...makeVirtualProps(),
|
|
10541
|
+
...makeComponentProps(),
|
|
10542
|
+
...makeDimensionProps()
|
|
10543
|
+
}, 'VVirtualScroll');
|
|
10544
|
+
const VVirtualScroll = genericComponent()({
|
|
10545
|
+
name: 'VVirtualScroll',
|
|
10546
|
+
props: makeVVirtualScrollProps(),
|
|
10547
|
+
setup(props, _ref) {
|
|
10548
|
+
let {
|
|
10549
|
+
slots
|
|
10550
|
+
} = _ref;
|
|
10551
|
+
const vm = getCurrentInstance('VVirtualScroll');
|
|
10552
|
+
const {
|
|
10553
|
+
dimensionStyles
|
|
10554
|
+
} = useDimension(props);
|
|
10555
|
+
const {
|
|
10556
|
+
containerRef,
|
|
10557
|
+
handleScroll,
|
|
10558
|
+
handleItemResize,
|
|
10559
|
+
scrollToIndex,
|
|
10560
|
+
paddingTop,
|
|
10561
|
+
paddingBottom,
|
|
10562
|
+
computedItems
|
|
10563
|
+
} = useVirtual(props, toRef(props, 'items'));
|
|
10564
|
+
useToggleScope(() => props.renderless, () => {
|
|
10565
|
+
onMounted(() => {
|
|
10566
|
+
containerRef.value = getScrollParent(vm.vnode.el, true);
|
|
10567
|
+
containerRef.value?.addEventListener('scroll', handleScroll);
|
|
10568
|
+
});
|
|
10569
|
+
onScopeDispose(() => {
|
|
10570
|
+
containerRef.value?.removeEventListener('scroll', handleScroll);
|
|
10571
|
+
});
|
|
10572
|
+
});
|
|
10573
|
+
useRender(() => {
|
|
10574
|
+
const children = computedItems.value.map(item => createVNode(VVirtualScrollItem, {
|
|
10575
|
+
"key": item.index,
|
|
10576
|
+
"renderless": props.renderless,
|
|
10577
|
+
"onUpdate:height": height => handleItemResize(item.index, height)
|
|
10578
|
+
}, {
|
|
10579
|
+
default: slotProps => slots.default?.({
|
|
10580
|
+
item: item.raw,
|
|
10581
|
+
index: item.index,
|
|
10582
|
+
...slotProps
|
|
10583
|
+
})
|
|
10584
|
+
}));
|
|
10585
|
+
return props.renderless ? createVNode(Fragment, null, [createVNode("div", {
|
|
10586
|
+
"class": "v-virtual-scroll__spacer",
|
|
10587
|
+
"style": {
|
|
10588
|
+
paddingTop: convertToUnit(paddingTop.value)
|
|
10589
|
+
}
|
|
10590
|
+
}, null), children, createVNode("div", {
|
|
10591
|
+
"class": "v-virtual-scroll__spacer",
|
|
10592
|
+
"style": {
|
|
10593
|
+
paddingBottom: convertToUnit(paddingBottom.value)
|
|
10594
|
+
}
|
|
10595
|
+
}, null)]) : createVNode("div", {
|
|
10596
|
+
"ref": containerRef,
|
|
10597
|
+
"class": ['v-virtual-scroll', props.class],
|
|
10598
|
+
"onScroll": handleScroll,
|
|
10599
|
+
"style": [dimensionStyles.value, props.style]
|
|
10600
|
+
}, [createVNode("div", {
|
|
10601
|
+
"class": "v-virtual-scroll__container",
|
|
10602
|
+
"style": {
|
|
10603
|
+
paddingTop: convertToUnit(paddingTop.value),
|
|
10604
|
+
paddingBottom: convertToUnit(paddingBottom.value)
|
|
10605
|
+
}
|
|
10606
|
+
}, [children])]);
|
|
10607
|
+
});
|
|
10608
|
+
return {
|
|
10609
|
+
scrollToIndex
|
|
10610
|
+
};
|
|
10611
|
+
}
|
|
10612
|
+
});
|
|
10613
|
+
|
|
10614
|
+
// Utilities
|
|
10615
|
+
|
|
10616
|
+
// Types
|
|
10617
|
+
|
|
10618
|
+
function useScrolling(listRef, textFieldRef) {
|
|
10619
|
+
const isScrolling = shallowRef(false);
|
|
10620
|
+
let scrollTimeout;
|
|
10621
|
+
function onListScroll(e) {
|
|
10622
|
+
cancelAnimationFrame(scrollTimeout);
|
|
10623
|
+
isScrolling.value = true;
|
|
10624
|
+
scrollTimeout = requestAnimationFrame(() => {
|
|
10625
|
+
scrollTimeout = requestAnimationFrame(() => {
|
|
10626
|
+
isScrolling.value = false;
|
|
10627
|
+
});
|
|
10628
|
+
});
|
|
10629
|
+
}
|
|
10630
|
+
async function finishScrolling() {
|
|
10631
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10632
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10633
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10634
|
+
await new Promise(resolve => {
|
|
10635
|
+
if (isScrolling.value) {
|
|
10636
|
+
const stop = watch(isScrolling, () => {
|
|
10637
|
+
stop();
|
|
10638
|
+
resolve();
|
|
10639
|
+
});
|
|
10640
|
+
} else resolve();
|
|
10641
|
+
});
|
|
10642
|
+
}
|
|
10643
|
+
async function onListKeydown(e) {
|
|
10644
|
+
if (e.key === 'Tab') {
|
|
10645
|
+
textFieldRef.value?.focus();
|
|
10646
|
+
}
|
|
10647
|
+
if (!['PageDown', 'PageUp', 'Home', 'End'].includes(e.key)) return;
|
|
10648
|
+
const el = listRef.value?.$el;
|
|
10649
|
+
if (!el) return;
|
|
10650
|
+
if (e.key === 'Home' || e.key === 'End') {
|
|
10651
|
+
el.scrollTo({
|
|
10652
|
+
top: e.key === 'Home' ? 0 : el.scrollHeight,
|
|
10653
|
+
behavior: 'smooth'
|
|
10654
|
+
});
|
|
10655
|
+
}
|
|
10656
|
+
await finishScrolling();
|
|
10657
|
+
const children = el.querySelectorAll(':scope > :not(.v-virtual-scroll__spacer)');
|
|
10658
|
+
if (e.key === 'PageDown' || e.key === 'Home') {
|
|
10659
|
+
const top = el.getBoundingClientRect().top;
|
|
10660
|
+
for (const child of children) {
|
|
10661
|
+
if (child.getBoundingClientRect().top >= top) {
|
|
10662
|
+
child.focus();
|
|
10663
|
+
break;
|
|
10664
|
+
}
|
|
10665
|
+
}
|
|
10666
|
+
} else {
|
|
10667
|
+
const bottom = el.getBoundingClientRect().bottom;
|
|
10668
|
+
for (const child of [...children].reverse()) {
|
|
10669
|
+
if (child.getBoundingClientRect().bottom <= bottom) {
|
|
10670
|
+
child.focus();
|
|
10671
|
+
break;
|
|
10672
|
+
}
|
|
10673
|
+
}
|
|
10674
|
+
}
|
|
10675
|
+
}
|
|
10676
|
+
return {
|
|
10677
|
+
onListScroll,
|
|
10678
|
+
onListKeydown
|
|
10679
|
+
};
|
|
10680
|
+
}
|
|
10681
|
+
|
|
10682
|
+
// Types
|
|
10683
|
+
|
|
10378
10684
|
const makeSelectProps = propsFactory({
|
|
10379
10685
|
chips: Boolean,
|
|
10380
10686
|
closableChips: Boolean,
|
|
@@ -10466,6 +10772,10 @@ const VSelect = genericComponent()({
|
|
|
10466
10772
|
});
|
|
10467
10773
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
10468
10774
|
const listRef = ref();
|
|
10775
|
+
const {
|
|
10776
|
+
onListScroll,
|
|
10777
|
+
onListKeydown
|
|
10778
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
10469
10779
|
function onClear(e) {
|
|
10470
10780
|
if (props.openOnClear) {
|
|
10471
10781
|
menu.value = true;
|
|
@@ -10512,11 +10822,6 @@ const VSelect = genericComponent()({
|
|
|
10512
10822
|
model.value = [item];
|
|
10513
10823
|
}
|
|
10514
10824
|
}
|
|
10515
|
-
function onListKeydown(e) {
|
|
10516
|
-
if (e.key === 'Tab') {
|
|
10517
|
-
vTextFieldRef.value?.focus();
|
|
10518
|
-
}
|
|
10519
|
-
}
|
|
10520
10825
|
function select(item) {
|
|
10521
10826
|
if (props.multiple) {
|
|
10522
10827
|
const index = selected.value.findIndex(selection => props.valueComparator(selection, item.value));
|
|
@@ -10599,34 +10904,46 @@ const VSelect = genericComponent()({
|
|
|
10599
10904
|
"onMousedown": e => e.preventDefault(),
|
|
10600
10905
|
"onKeydown": onListKeydown,
|
|
10601
10906
|
"onFocusin": onFocusin,
|
|
10907
|
+
"onScrollPassive": onListScroll,
|
|
10602
10908
|
"tabindex": "-1"
|
|
10603
10909
|
}, {
|
|
10604
10910
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
10605
10911
|
"title": t(props.noDataText)
|
|
10606
|
-
}, null)),
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10912
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
10913
|
+
"renderless": true,
|
|
10914
|
+
"items": displayItems.value
|
|
10915
|
+
}, {
|
|
10916
|
+
default: _ref2 => {
|
|
10917
|
+
let {
|
|
10918
|
+
item,
|
|
10919
|
+
index,
|
|
10920
|
+
itemRef
|
|
10921
|
+
} = _ref2;
|
|
10922
|
+
const itemProps = mergeProps(item.props, {
|
|
10923
|
+
ref: itemRef,
|
|
10924
|
+
key: index,
|
|
10925
|
+
onClick: () => select(item)
|
|
10926
|
+
});
|
|
10927
|
+
return slots.item?.({
|
|
10928
|
+
item,
|
|
10929
|
+
index,
|
|
10930
|
+
props: itemProps
|
|
10931
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
10932
|
+
prepend: _ref3 => {
|
|
10933
|
+
let {
|
|
10934
|
+
isSelected
|
|
10935
|
+
} = _ref3;
|
|
10936
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
10937
|
+
"key": item.value,
|
|
10938
|
+
"modelValue": isSelected,
|
|
10939
|
+
"ripple": false,
|
|
10940
|
+
"tabindex": "-1"
|
|
10941
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
10942
|
+
"icon": item.props.prependIcon
|
|
10943
|
+
}, null)]);
|
|
10944
|
+
}
|
|
10945
|
+
});
|
|
10946
|
+
}
|
|
10630
10947
|
}), slots['append-item']?.()]
|
|
10631
10948
|
})]
|
|
10632
10949
|
}), selections.value.map((item, index) => {
|
|
@@ -10769,8 +11086,6 @@ function useFilter(props, items, query, options) {
|
|
|
10769
11086
|
const filteredMatches = ref(new Map());
|
|
10770
11087
|
const transformedItems = computed(() => options?.transform ? unref(items).map(options?.transform) : unref(items));
|
|
10771
11088
|
watchEffect(() => {
|
|
10772
|
-
filteredItems.value = [];
|
|
10773
|
-
filteredMatches.value = new Map();
|
|
10774
11089
|
const results = filterItems(transformedItems.value, strQuery.value, {
|
|
10775
11090
|
customKeyFilter: props.customKeyFilter,
|
|
10776
11091
|
default: props.customFilter,
|
|
@@ -10779,15 +11094,19 @@ function useFilter(props, items, query, options) {
|
|
|
10779
11094
|
noFilter: props.noFilter
|
|
10780
11095
|
});
|
|
10781
11096
|
const originalItems = unref(items);
|
|
11097
|
+
const _filteredItems = [];
|
|
11098
|
+
const _filteredMatches = new Map();
|
|
10782
11099
|
results.forEach(_ref => {
|
|
10783
11100
|
let {
|
|
10784
11101
|
index,
|
|
10785
11102
|
matches
|
|
10786
11103
|
} = _ref;
|
|
10787
11104
|
const item = originalItems[index];
|
|
10788
|
-
|
|
10789
|
-
|
|
11105
|
+
_filteredItems.push(item);
|
|
11106
|
+
_filteredMatches.set(item.value, matches);
|
|
10790
11107
|
});
|
|
11108
|
+
filteredItems.value = _filteredItems;
|
|
11109
|
+
filteredMatches.value = _filteredMatches;
|
|
10791
11110
|
});
|
|
10792
11111
|
function getMatches(item) {
|
|
10793
11112
|
return filteredMatches.value.get(item.value);
|
|
@@ -10877,7 +11196,7 @@ const VAutocomplete = genericComponent()({
|
|
|
10877
11196
|
const {
|
|
10878
11197
|
filteredItems,
|
|
10879
11198
|
getMatches
|
|
10880
|
-
} = useFilter(props, items,
|
|
11199
|
+
} = useFilter(props, items, search);
|
|
10881
11200
|
const selections = computed(() => {
|
|
10882
11201
|
return model.value.map(v => {
|
|
10883
11202
|
return items.value.find(item => props.valueComparator(item.value, v.value)) || v;
|
|
@@ -10897,6 +11216,10 @@ const VAutocomplete = genericComponent()({
|
|
|
10897
11216
|
});
|
|
10898
11217
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
10899
11218
|
const listRef = ref();
|
|
11219
|
+
const {
|
|
11220
|
+
onListScroll,
|
|
11221
|
+
onListKeydown
|
|
11222
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
10900
11223
|
function onClear(e) {
|
|
10901
11224
|
if (props.openOnClear) {
|
|
10902
11225
|
menu.value = true;
|
|
@@ -10970,11 +11293,6 @@ const VAutocomplete = genericComponent()({
|
|
|
10970
11293
|
}
|
|
10971
11294
|
}
|
|
10972
11295
|
}
|
|
10973
|
-
function onListKeydown(e) {
|
|
10974
|
-
if (e.key === 'Tab') {
|
|
10975
|
-
vTextFieldRef.value?.focus();
|
|
10976
|
-
}
|
|
10977
|
-
}
|
|
10978
11296
|
function onInput(e) {
|
|
10979
11297
|
search.value = e.target.value;
|
|
10980
11298
|
}
|
|
@@ -11093,38 +11411,50 @@ const VAutocomplete = genericComponent()({
|
|
|
11093
11411
|
"onKeydown": onListKeydown,
|
|
11094
11412
|
"onFocusin": onFocusin,
|
|
11095
11413
|
"onFocusout": onFocusout,
|
|
11414
|
+
"onScrollPassive": onListScroll,
|
|
11096
11415
|
"tabindex": "-1"
|
|
11097
11416
|
}, {
|
|
11098
11417
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
11099
11418
|
"title": t(props.noDataText)
|
|
11100
|
-
}, null)),
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11419
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
11420
|
+
"renderless": true,
|
|
11421
|
+
"items": displayItems.value
|
|
11422
|
+
}, {
|
|
11423
|
+
default: _ref3 => {
|
|
11424
|
+
let {
|
|
11425
|
+
item,
|
|
11426
|
+
index,
|
|
11427
|
+
itemRef
|
|
11428
|
+
} = _ref3;
|
|
11429
|
+
const itemProps = mergeProps(item.props, {
|
|
11430
|
+
ref: itemRef,
|
|
11431
|
+
key: index,
|
|
11432
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
|
11433
|
+
onClick: () => select(item)
|
|
11434
|
+
});
|
|
11435
|
+
return slots.item?.({
|
|
11436
|
+
item,
|
|
11437
|
+
index,
|
|
11438
|
+
props: itemProps
|
|
11439
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
11440
|
+
prepend: _ref4 => {
|
|
11441
|
+
let {
|
|
11442
|
+
isSelected
|
|
11443
|
+
} = _ref4;
|
|
11444
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
11445
|
+
"key": item.value,
|
|
11446
|
+
"modelValue": isSelected,
|
|
11447
|
+
"ripple": false,
|
|
11448
|
+
"tabindex": "-1"
|
|
11449
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
11450
|
+
"icon": item.props.prependIcon
|
|
11451
|
+
}, null)]);
|
|
11452
|
+
},
|
|
11453
|
+
title: () => {
|
|
11454
|
+
return isPristine.value ? item.title : highlightResult$1(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
|
11455
|
+
}
|
|
11456
|
+
});
|
|
11457
|
+
}
|
|
11128
11458
|
}), slots['append-item']?.()]
|
|
11129
11459
|
})]
|
|
11130
11460
|
}), selections.value.map((item, index) => {
|
|
@@ -14414,7 +14744,7 @@ const VCombobox = genericComponent()({
|
|
|
14414
14744
|
const {
|
|
14415
14745
|
filteredItems,
|
|
14416
14746
|
getMatches
|
|
14417
|
-
} = useFilter(props, items,
|
|
14747
|
+
} = useFilter(props, items, search);
|
|
14418
14748
|
const selections = computed(() => {
|
|
14419
14749
|
return model.value.map(v => {
|
|
14420
14750
|
return items.value.find(item => props.valueComparator(item.value, v.value)) || v;
|
|
@@ -14434,6 +14764,10 @@ const VCombobox = genericComponent()({
|
|
|
14434
14764
|
});
|
|
14435
14765
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
14436
14766
|
const listRef = ref();
|
|
14767
|
+
const {
|
|
14768
|
+
onListScroll,
|
|
14769
|
+
onListKeydown
|
|
14770
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
14437
14771
|
function onClear(e) {
|
|
14438
14772
|
cleared = true;
|
|
14439
14773
|
if (props.openOnClear) {
|
|
@@ -14511,11 +14845,6 @@ const VCombobox = genericComponent()({
|
|
|
14511
14845
|
search.value = '';
|
|
14512
14846
|
}
|
|
14513
14847
|
}
|
|
14514
|
-
function onListKeydown(e) {
|
|
14515
|
-
if (e.key === 'Tab') {
|
|
14516
|
-
vTextFieldRef.value?.focus();
|
|
14517
|
-
}
|
|
14518
|
-
}
|
|
14519
14848
|
function onAfterLeave() {
|
|
14520
14849
|
if (isFocused.value) {
|
|
14521
14850
|
isPristine.value = true;
|
|
@@ -14626,38 +14955,50 @@ const VCombobox = genericComponent()({
|
|
|
14626
14955
|
"onKeydown": onListKeydown,
|
|
14627
14956
|
"onFocusin": onFocusin,
|
|
14628
14957
|
"onFocusout": onFocusout,
|
|
14958
|
+
"onScrollPassive": onListScroll,
|
|
14629
14959
|
"tabindex": "-1"
|
|
14630
14960
|
}, {
|
|
14631
14961
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
14632
14962
|
"title": t(props.noDataText)
|
|
14633
|
-
}, null)),
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14963
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
14964
|
+
"renderless": true,
|
|
14965
|
+
"items": displayItems.value
|
|
14966
|
+
}, {
|
|
14967
|
+
default: _ref3 => {
|
|
14968
|
+
let {
|
|
14969
|
+
item,
|
|
14970
|
+
index,
|
|
14971
|
+
itemRef
|
|
14972
|
+
} = _ref3;
|
|
14973
|
+
const itemProps = mergeProps(item.props, {
|
|
14974
|
+
ref: itemRef,
|
|
14975
|
+
key: index,
|
|
14976
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
|
14977
|
+
onClick: () => select(item)
|
|
14978
|
+
});
|
|
14979
|
+
return slots.item?.({
|
|
14980
|
+
item,
|
|
14981
|
+
index,
|
|
14982
|
+
props: itemProps
|
|
14983
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
14984
|
+
prepend: _ref4 => {
|
|
14985
|
+
let {
|
|
14986
|
+
isSelected
|
|
14987
|
+
} = _ref4;
|
|
14988
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
14989
|
+
"key": item.value,
|
|
14990
|
+
"modelValue": isSelected,
|
|
14991
|
+
"ripple": false,
|
|
14992
|
+
"tabindex": "-1"
|
|
14993
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
14994
|
+
"icon": item.props.prependIcon
|
|
14995
|
+
}, null)]);
|
|
14996
|
+
},
|
|
14997
|
+
title: () => {
|
|
14998
|
+
return isPristine.value ? item.title : highlightResult(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
|
14999
|
+
}
|
|
15000
|
+
});
|
|
15001
|
+
}
|
|
14661
15002
|
}), slots['append-item']?.()]
|
|
14662
15003
|
})]
|
|
14663
15004
|
}), selections.value.map((item, index) => {
|
|
@@ -18999,215 +19340,6 @@ const VValidation = genericComponent()({
|
|
|
18999
19340
|
}
|
|
19000
19341
|
});
|
|
19001
19342
|
|
|
19002
|
-
const makeVVirtualScrollItemProps = propsFactory({
|
|
19003
|
-
dynamicHeight: Boolean,
|
|
19004
|
-
renderless: Boolean,
|
|
19005
|
-
...makeComponentProps()
|
|
19006
|
-
}, 'VVirtualScrollItem');
|
|
19007
|
-
const VVirtualScrollItem = genericComponent()({
|
|
19008
|
-
name: 'VVirtualScrollItem',
|
|
19009
|
-
props: makeVVirtualScrollItemProps(),
|
|
19010
|
-
emits: {
|
|
19011
|
-
'update:height': height => true
|
|
19012
|
-
},
|
|
19013
|
-
setup(props, _ref) {
|
|
19014
|
-
let {
|
|
19015
|
-
emit,
|
|
19016
|
-
slots
|
|
19017
|
-
} = _ref;
|
|
19018
|
-
const {
|
|
19019
|
-
resizeRef,
|
|
19020
|
-
contentRect
|
|
19021
|
-
} = useResizeObserver();
|
|
19022
|
-
useToggleScope(() => props.dynamicHeight, () => {
|
|
19023
|
-
watch(() => contentRect.value?.height, height => {
|
|
19024
|
-
if (height != null) emit('update:height', height);
|
|
19025
|
-
});
|
|
19026
|
-
});
|
|
19027
|
-
function updateHeight() {
|
|
19028
|
-
if (props.dynamicHeight && contentRect.value) {
|
|
19029
|
-
emit('update:height', contentRect.value.height);
|
|
19030
|
-
}
|
|
19031
|
-
}
|
|
19032
|
-
onUpdated(updateHeight);
|
|
19033
|
-
useRender(() => props.renderless ? createVNode(Fragment, null, [slots.default?.({
|
|
19034
|
-
props: {
|
|
19035
|
-
ref: props.dynamicHeight ? resizeRef : undefined
|
|
19036
|
-
}
|
|
19037
|
-
})]) : createVNode("div", {
|
|
19038
|
-
"ref": props.dynamicHeight ? resizeRef : undefined,
|
|
19039
|
-
"class": ['v-virtual-scroll__item', props.class],
|
|
19040
|
-
"style": props.style
|
|
19041
|
-
}, [slots.default?.()]));
|
|
19042
|
-
}
|
|
19043
|
-
});
|
|
19044
|
-
|
|
19045
|
-
// Composables
|
|
19046
|
-
|
|
19047
|
-
// Types
|
|
19048
|
-
|
|
19049
|
-
const UP = -1;
|
|
19050
|
-
const DOWN = 1;
|
|
19051
|
-
const makeVirtualProps = propsFactory({
|
|
19052
|
-
itemHeight: [Number, String]
|
|
19053
|
-
}, 'virtual');
|
|
19054
|
-
function useVirtual(props, items, offset) {
|
|
19055
|
-
const first = shallowRef(0);
|
|
19056
|
-
const baseItemHeight = shallowRef(props.itemHeight);
|
|
19057
|
-
const itemHeight = computed({
|
|
19058
|
-
get: () => parseInt(baseItemHeight.value ?? 0, 10),
|
|
19059
|
-
set(val) {
|
|
19060
|
-
baseItemHeight.value = val;
|
|
19061
|
-
}
|
|
19062
|
-
});
|
|
19063
|
-
const containerRef = ref();
|
|
19064
|
-
const {
|
|
19065
|
-
resizeRef,
|
|
19066
|
-
contentRect
|
|
19067
|
-
} = useResizeObserver();
|
|
19068
|
-
watchEffect(() => {
|
|
19069
|
-
resizeRef.value = containerRef.value;
|
|
19070
|
-
});
|
|
19071
|
-
const display = useDisplay();
|
|
19072
|
-
const sizeMap = new Map();
|
|
19073
|
-
let sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
19074
|
-
const visibleItems = computed(() => {
|
|
19075
|
-
const height = (contentRect.value?.height ?? display.height.value) - (offset?.value ?? 0);
|
|
19076
|
-
return itemHeight.value ? Math.max(12, Math.ceil(height / itemHeight.value * 1.7 + 1)) : 12;
|
|
19077
|
-
});
|
|
19078
|
-
function handleItemResize(index, height) {
|
|
19079
|
-
itemHeight.value = Math.max(itemHeight.value, height);
|
|
19080
|
-
sizes[index] = height;
|
|
19081
|
-
sizeMap.set(items.value[index], height);
|
|
19082
|
-
}
|
|
19083
|
-
function calculateOffset(index) {
|
|
19084
|
-
return sizes.slice(0, index).reduce((curr, value) => curr + (value || itemHeight.value), 0);
|
|
19085
|
-
}
|
|
19086
|
-
function calculateMidPointIndex(scrollTop) {
|
|
19087
|
-
const end = items.value.length;
|
|
19088
|
-
let middle = 0;
|
|
19089
|
-
let middleOffset = 0;
|
|
19090
|
-
while (middleOffset < scrollTop && middle < end) {
|
|
19091
|
-
middleOffset += sizes[middle++] || itemHeight.value;
|
|
19092
|
-
}
|
|
19093
|
-
return middle - 1;
|
|
19094
|
-
}
|
|
19095
|
-
let lastScrollTop = 0;
|
|
19096
|
-
function handleScroll() {
|
|
19097
|
-
if (!containerRef.value || !contentRect.value) return;
|
|
19098
|
-
const height = contentRect.value.height - 56;
|
|
19099
|
-
const scrollTop = containerRef.value.scrollTop;
|
|
19100
|
-
const direction = scrollTop < lastScrollTop ? UP : DOWN;
|
|
19101
|
-
const midPointIndex = calculateMidPointIndex(scrollTop + height / 2);
|
|
19102
|
-
const buffer = Math.round(visibleItems.value / 3);
|
|
19103
|
-
const firstIndex = midPointIndex - buffer;
|
|
19104
|
-
const lastIndex = first.value + buffer * 2 - 1;
|
|
19105
|
-
if (direction === UP && midPointIndex <= lastIndex) {
|
|
19106
|
-
first.value = clamp(firstIndex, 0, items.value.length);
|
|
19107
|
-
} else if (direction === DOWN && midPointIndex >= lastIndex) {
|
|
19108
|
-
first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value);
|
|
19109
|
-
}
|
|
19110
|
-
lastScrollTop = scrollTop;
|
|
19111
|
-
}
|
|
19112
|
-
function scrollToIndex(index) {
|
|
19113
|
-
if (!containerRef.value) return;
|
|
19114
|
-
const offset = calculateOffset(index);
|
|
19115
|
-
containerRef.value.scrollTop = offset;
|
|
19116
|
-
}
|
|
19117
|
-
const allItems = computed(() => items.value.map((item, index) => ({
|
|
19118
|
-
raw: item,
|
|
19119
|
-
index
|
|
19120
|
-
})));
|
|
19121
|
-
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
19122
|
-
const computedItems = computed(() => allItems.value.slice(first.value, last.value));
|
|
19123
|
-
const paddingTop = computed(() => calculateOffset(first.value));
|
|
19124
|
-
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
19125
|
-
onMounted(() => {
|
|
19126
|
-
if (!itemHeight.value) {
|
|
19127
|
-
// If itemHeight prop is not set, then calculate an estimated height from the average of inital items
|
|
19128
|
-
itemHeight.value = sizes.slice(first.value, last.value).reduce((curr, height) => curr + height, 0) / visibleItems.value;
|
|
19129
|
-
}
|
|
19130
|
-
});
|
|
19131
|
-
watch(() => items.value.length, () => {
|
|
19132
|
-
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
19133
|
-
sizeMap.forEach((height, item) => {
|
|
19134
|
-
const index = items.value.indexOf(item);
|
|
19135
|
-
if (index === -1) {
|
|
19136
|
-
sizeMap.delete(item);
|
|
19137
|
-
} else {
|
|
19138
|
-
sizes[index] = height;
|
|
19139
|
-
}
|
|
19140
|
-
});
|
|
19141
|
-
});
|
|
19142
|
-
return {
|
|
19143
|
-
containerRef,
|
|
19144
|
-
computedItems,
|
|
19145
|
-
itemHeight,
|
|
19146
|
-
paddingTop,
|
|
19147
|
-
paddingBottom,
|
|
19148
|
-
scrollToIndex,
|
|
19149
|
-
handleScroll,
|
|
19150
|
-
handleItemResize
|
|
19151
|
-
};
|
|
19152
|
-
}
|
|
19153
|
-
|
|
19154
|
-
// Types
|
|
19155
|
-
|
|
19156
|
-
const makeVVirtualScrollProps = propsFactory({
|
|
19157
|
-
items: {
|
|
19158
|
-
type: Array,
|
|
19159
|
-
default: () => []
|
|
19160
|
-
},
|
|
19161
|
-
...makeVirtualProps(),
|
|
19162
|
-
...makeComponentProps(),
|
|
19163
|
-
...makeDimensionProps()
|
|
19164
|
-
}, 'VVirtualScroll');
|
|
19165
|
-
const VVirtualScroll = genericComponent()({
|
|
19166
|
-
name: 'VVirtualScroll',
|
|
19167
|
-
props: makeVVirtualScrollProps(),
|
|
19168
|
-
setup(props, _ref) {
|
|
19169
|
-
let {
|
|
19170
|
-
slots
|
|
19171
|
-
} = _ref;
|
|
19172
|
-
const {
|
|
19173
|
-
dimensionStyles
|
|
19174
|
-
} = useDimension(props);
|
|
19175
|
-
const {
|
|
19176
|
-
containerRef,
|
|
19177
|
-
handleScroll,
|
|
19178
|
-
handleItemResize,
|
|
19179
|
-
scrollToIndex,
|
|
19180
|
-
paddingTop,
|
|
19181
|
-
paddingBottom,
|
|
19182
|
-
computedItems
|
|
19183
|
-
} = useVirtual(props, toRef(props, 'items'));
|
|
19184
|
-
useRender(() => createVNode("div", {
|
|
19185
|
-
"ref": containerRef,
|
|
19186
|
-
"class": ['v-virtual-scroll', props.class],
|
|
19187
|
-
"onScroll": handleScroll,
|
|
19188
|
-
"style": [dimensionStyles.value, props.style]
|
|
19189
|
-
}, [createVNode("div", {
|
|
19190
|
-
"class": "v-virtual-scroll__container",
|
|
19191
|
-
"style": {
|
|
19192
|
-
paddingTop: convertToUnit(paddingTop.value),
|
|
19193
|
-
paddingBottom: convertToUnit(paddingBottom.value)
|
|
19194
|
-
}
|
|
19195
|
-
}, [computedItems.value.map(item => createVNode(VVirtualScrollItem, {
|
|
19196
|
-
"key": item.index,
|
|
19197
|
-
"dynamicHeight": !props.itemHeight,
|
|
19198
|
-
"onUpdate:height": height => handleItemResize(item.index, height)
|
|
19199
|
-
}, {
|
|
19200
|
-
default: () => [slots.default?.({
|
|
19201
|
-
item: item.raw,
|
|
19202
|
-
index: item.index
|
|
19203
|
-
})]
|
|
19204
|
-
}))])]));
|
|
19205
|
-
return {
|
|
19206
|
-
scrollToIndex
|
|
19207
|
-
};
|
|
19208
|
-
}
|
|
19209
|
-
});
|
|
19210
|
-
|
|
19211
19343
|
var components = /*#__PURE__*/Object.freeze({
|
|
19212
19344
|
__proto__: null,
|
|
19213
19345
|
VAlert: VAlert,
|
|
@@ -20006,7 +20138,7 @@ function createVuetify$1() {
|
|
|
20006
20138
|
date
|
|
20007
20139
|
};
|
|
20008
20140
|
}
|
|
20009
|
-
const version$1 = "3.3.5-
|
|
20141
|
+
const version$1 = "3.3.5-pr-17265.042d482";
|
|
20010
20142
|
createVuetify$1.version = version$1;
|
|
20011
20143
|
|
|
20012
20144
|
// Vue's inject() can only be used in setup
|
|
@@ -20031,7 +20163,7 @@ const createVuetify = function () {
|
|
|
20031
20163
|
...options
|
|
20032
20164
|
});
|
|
20033
20165
|
};
|
|
20034
|
-
const version = "3.3.5-
|
|
20166
|
+
const version = "3.3.5-pr-17265.042d482";
|
|
20035
20167
|
createVuetify.version = version;
|
|
20036
20168
|
|
|
20037
20169
|
export { components, createVuetify, directives, useDefaults, useDisplay, useLayout, useLocale, useRtl, useTheme, version };
|