vuetify 3.3.6 → 3.3.7
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/json/attributes.json +14 -10
- package/dist/json/importMap.json +76 -76
- package/dist/json/tags.json +1 -0
- package/dist/json/web-types.json +26 -24
- package/dist/vuetify-labs.css +127 -111
- package/dist/vuetify-labs.d.ts +178 -76
- package/dist/vuetify-labs.esm.js +486 -337
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +485 -336
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +36 -20
- package/dist/vuetify.d.ts +157 -93
- package/dist/vuetify.esm.js +469 -326
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +468 -325
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +688 -669
- 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/VBtn/VBtn.mjs +1 -1
- package/lib/components/VBtn/VBtn.mjs.map +1 -1
- package/lib/components/VCheckbox/index.d.mts +28 -16
- package/lib/components/VCombobox/VCombobox.mjs +48 -35
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VField/VField.css +17 -6
- package/lib/components/VField/VField.sass +17 -6
- package/lib/components/VField/_variables.scss +2 -2
- package/lib/components/VIcon/VIcon.css +1 -0
- package/lib/components/VIcon/VIcon.sass +1 -0
- package/lib/components/VImg/VImg.css +4 -2
- package/lib/components/VImg/VImg.mjs +4 -2
- package/lib/components/VImg/VImg.mjs.map +1 -1
- package/lib/components/VImg/VImg.sass +3 -4
- package/lib/components/VOverlay/VOverlay.css +2 -0
- package/lib/components/VOverlay/VOverlay.sass +3 -1
- package/lib/components/VOverlay/scrollStrategies.mjs +3 -1
- package/lib/components/VOverlay/scrollStrategies.mjs.map +1 -1
- package/lib/components/VRadio/index.d.mts +14 -8
- package/lib/components/VRadioGroup/index.d.mts +14 -8
- package/lib/components/VResponsive/VResponsive.css +6 -11
- package/lib/components/VResponsive/VResponsive.sass +5 -10
- 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/VSelectionControl/VSelectionControl.mjs +2 -2
- package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
- package/lib/components/VSelectionControl/index.d.mts +14 -8
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +4 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
- package/lib/components/VSelectionControlGroup/index.d.mts +14 -8
- package/lib/components/VSwitch/index.d.mts +14 -8
- package/lib/components/VTextField/VTextField.css +5 -0
- package/lib/components/VTextField/VTextField.mjs +6 -2
- package/lib/components/VTextField/VTextField.mjs.map +1 -1
- package/lib/components/VTextField/VTextField.sass +5 -0
- package/lib/components/VTextField/_variables.scss +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 +134 -70
- package/lib/composables/filter.mjs +9 -7
- 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/framework.mjs +1 -1
- package/lib/index.d.mts +23 -23
- package/lib/labs/VDataTable/VDataTableVirtual.mjs +12 -10
- package/lib/labs/VDataTable/VDataTableVirtual.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/headers.mjs +6 -2
- package/lib/labs/VDataTable/composables/headers.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 +2 -2
package/dist/vuetify.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vuetify v3.3.
|
|
2
|
+
* Vuetify v3.3.7
|
|
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, toValue, 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;
|
|
@@ -1313,13 +1319,18 @@ function useRender(render) {
|
|
|
1313
1319
|
// Types
|
|
1314
1320
|
|
|
1315
1321
|
function useResizeObserver(callback) {
|
|
1322
|
+
let box = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'content';
|
|
1316
1323
|
const resizeRef = ref();
|
|
1317
1324
|
const contentRect = ref();
|
|
1318
1325
|
if (IN_BROWSER) {
|
|
1319
1326
|
const observer = new ResizeObserver(entries => {
|
|
1320
1327
|
callback?.(entries, observer);
|
|
1321
1328
|
if (!entries.length) return;
|
|
1322
|
-
|
|
1329
|
+
if (box === 'content') {
|
|
1330
|
+
contentRect.value = entries[0].contentRect;
|
|
1331
|
+
} else {
|
|
1332
|
+
contentRect.value = entries[0].target.getBoundingClientRect();
|
|
1333
|
+
}
|
|
1323
1334
|
});
|
|
1324
1335
|
onBeforeUnmount(() => {
|
|
1325
1336
|
observer.disconnect();
|
|
@@ -3141,7 +3152,9 @@ const VImg = genericComponent()({
|
|
|
3141
3152
|
"class": ['v-img', {
|
|
3142
3153
|
'v-img--booting': !isBooted.value
|
|
3143
3154
|
}, props.class],
|
|
3144
|
-
"style":
|
|
3155
|
+
"style": [{
|
|
3156
|
+
width: convertToUnit(props.width === 'auto' ? naturalWidth.value : props.width)
|
|
3157
|
+
}, props.style]
|
|
3145
3158
|
}, responsiveProps, {
|
|
3146
3159
|
"aspectRatio": aspectRatio.value,
|
|
3147
3160
|
"aria-label": props.alt,
|
|
@@ -5260,7 +5273,7 @@ const VBtn = genericComponent()({
|
|
|
5260
5273
|
return Object(props.value) === props.value ? JSON.stringify(props.value, null, 0) : props.value;
|
|
5261
5274
|
});
|
|
5262
5275
|
function onClick(e) {
|
|
5263
|
-
if (isDisabled.value) return;
|
|
5276
|
+
if (isDisabled.value || link.isLink.value && (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0 || attrs.target === '_blank')) return;
|
|
5264
5277
|
link.navigate?.(e);
|
|
5265
5278
|
group?.toggle();
|
|
5266
5279
|
}
|
|
@@ -5599,7 +5612,10 @@ const VLabel = genericComponent()({
|
|
|
5599
5612
|
const VSelectionControlGroupSymbol = Symbol.for('vuetify:selection-control-group');
|
|
5600
5613
|
const makeSelectionControlGroupProps = propsFactory({
|
|
5601
5614
|
color: String,
|
|
5602
|
-
disabled:
|
|
5615
|
+
disabled: {
|
|
5616
|
+
type: Boolean,
|
|
5617
|
+
default: null
|
|
5618
|
+
},
|
|
5603
5619
|
defaultsTarget: String,
|
|
5604
5620
|
error: Boolean,
|
|
5605
5621
|
id: String,
|
|
@@ -5823,12 +5839,12 @@ const VSelectionControl = genericComponent()({
|
|
|
5823
5839
|
}, null), createVNode("input", mergeProps({
|
|
5824
5840
|
"ref": input,
|
|
5825
5841
|
"checked": model.value,
|
|
5826
|
-
"disabled": props.disabled,
|
|
5842
|
+
"disabled": !!(props.readonly || props.disabled),
|
|
5827
5843
|
"id": id.value,
|
|
5828
5844
|
"onBlur": onBlur,
|
|
5829
5845
|
"onFocus": onFocus,
|
|
5830
5846
|
"onInput": onInput,
|
|
5831
|
-
"aria-disabled": props.readonly,
|
|
5847
|
+
"aria-disabled": !!(props.readonly || props.disabled),
|
|
5832
5848
|
"type": props.type,
|
|
5833
5849
|
"value": trueValue.value,
|
|
5834
5850
|
"name": props.name,
|
|
@@ -8699,7 +8715,9 @@ function blockScrollStrategy(data, props) {
|
|
|
8699
8715
|
scrollElements.forEach((el, i) => {
|
|
8700
8716
|
el.style.setProperty('--v-body-scroll-x', convertToUnit(-el.scrollLeft));
|
|
8701
8717
|
el.style.setProperty('--v-body-scroll-y', convertToUnit(-el.scrollTop));
|
|
8702
|
-
el.
|
|
8718
|
+
if (el !== document.documentElement) {
|
|
8719
|
+
el.style.setProperty('--v-scrollbar-offset', convertToUnit(scrollbarWidth));
|
|
8720
|
+
}
|
|
8703
8721
|
el.classList.add('v-overlay-scroll-blocked');
|
|
8704
8722
|
});
|
|
8705
8723
|
onScopeDispose(() => {
|
|
@@ -10354,12 +10372,16 @@ const VTextField = genericComponent()({
|
|
|
10354
10372
|
}]]);
|
|
10355
10373
|
return createVNode(Fragment, null, [props.prefix && createVNode("span", {
|
|
10356
10374
|
"class": "v-text-field__prefix"
|
|
10357
|
-
}, [
|
|
10375
|
+
}, [createVNode("span", {
|
|
10376
|
+
"class": "v-text-field__prefix__text"
|
|
10377
|
+
}, [props.prefix])]), createVNode("div", {
|
|
10358
10378
|
"class": fieldClass,
|
|
10359
10379
|
"data-no-activator": ""
|
|
10360
10380
|
}, [slots.default ? createVNode(Fragment, null, [slots.default(), inputNode]) : cloneVNode(inputNode)]), props.suffix && createVNode("span", {
|
|
10361
10381
|
"class": "v-text-field__suffix"
|
|
10362
|
-
}, [
|
|
10382
|
+
}, [createVNode("span", {
|
|
10383
|
+
"class": "v-text-field__suffix__text"
|
|
10384
|
+
}, [props.suffix])])]);
|
|
10363
10385
|
}
|
|
10364
10386
|
});
|
|
10365
10387
|
},
|
|
@@ -10376,6 +10398,301 @@ const VTextField = genericComponent()({
|
|
|
10376
10398
|
|
|
10377
10399
|
// Types
|
|
10378
10400
|
|
|
10401
|
+
const makeVVirtualScrollItemProps = propsFactory({
|
|
10402
|
+
renderless: Boolean,
|
|
10403
|
+
...makeComponentProps()
|
|
10404
|
+
}, 'VVirtualScrollItem');
|
|
10405
|
+
const VVirtualScrollItem = genericComponent()({
|
|
10406
|
+
name: 'VVirtualScrollItem',
|
|
10407
|
+
inheritAttrs: false,
|
|
10408
|
+
props: makeVVirtualScrollItemProps(),
|
|
10409
|
+
emits: {
|
|
10410
|
+
'update:height': height => true
|
|
10411
|
+
},
|
|
10412
|
+
setup(props, _ref) {
|
|
10413
|
+
let {
|
|
10414
|
+
attrs,
|
|
10415
|
+
emit,
|
|
10416
|
+
slots
|
|
10417
|
+
} = _ref;
|
|
10418
|
+
const {
|
|
10419
|
+
resizeRef,
|
|
10420
|
+
contentRect
|
|
10421
|
+
} = useResizeObserver(undefined, 'border');
|
|
10422
|
+
watch(() => contentRect.value?.height, height => {
|
|
10423
|
+
if (height != null) emit('update:height', height);
|
|
10424
|
+
});
|
|
10425
|
+
useRender(() => props.renderless ? createVNode(Fragment, null, [slots.default?.({
|
|
10426
|
+
itemRef: resizeRef
|
|
10427
|
+
})]) : createVNode("div", mergeProps({
|
|
10428
|
+
"ref": resizeRef,
|
|
10429
|
+
"class": ['v-virtual-scroll__item', props.class],
|
|
10430
|
+
"style": props.style
|
|
10431
|
+
}, attrs), [slots.default?.()]));
|
|
10432
|
+
}
|
|
10433
|
+
});
|
|
10434
|
+
|
|
10435
|
+
// Composables
|
|
10436
|
+
|
|
10437
|
+
// Types
|
|
10438
|
+
|
|
10439
|
+
const UP = -1;
|
|
10440
|
+
const DOWN = 1;
|
|
10441
|
+
const makeVirtualProps = propsFactory({
|
|
10442
|
+
itemHeight: {
|
|
10443
|
+
type: [Number, String],
|
|
10444
|
+
default: 48
|
|
10445
|
+
}
|
|
10446
|
+
}, 'virtual');
|
|
10447
|
+
function useVirtual(props, items, offset) {
|
|
10448
|
+
const first = shallowRef(0);
|
|
10449
|
+
const baseItemHeight = shallowRef(props.itemHeight);
|
|
10450
|
+
const itemHeight = computed({
|
|
10451
|
+
get: () => parseInt(baseItemHeight.value ?? 0, 10),
|
|
10452
|
+
set(val) {
|
|
10453
|
+
baseItemHeight.value = val;
|
|
10454
|
+
}
|
|
10455
|
+
});
|
|
10456
|
+
const containerRef = ref();
|
|
10457
|
+
const {
|
|
10458
|
+
resizeRef,
|
|
10459
|
+
contentRect
|
|
10460
|
+
} = useResizeObserver();
|
|
10461
|
+
watchEffect(() => {
|
|
10462
|
+
resizeRef.value = containerRef.value;
|
|
10463
|
+
});
|
|
10464
|
+
const display = useDisplay();
|
|
10465
|
+
const sizeMap = new Map();
|
|
10466
|
+
let sizes = Array.from({
|
|
10467
|
+
length: items.value.length
|
|
10468
|
+
});
|
|
10469
|
+
const visibleItems = computed(() => {
|
|
10470
|
+
const height = (!contentRect.value || containerRef.value === document.documentElement ? display.height.value : contentRect.value.height) - (offset?.value ?? 0);
|
|
10471
|
+
return Math.ceil(height / itemHeight.value * 1.7 + 1);
|
|
10472
|
+
});
|
|
10473
|
+
function handleItemResize(index, height) {
|
|
10474
|
+
itemHeight.value = Math.max(itemHeight.value, height);
|
|
10475
|
+
sizes[index] = height;
|
|
10476
|
+
sizeMap.set(items.value[index], height);
|
|
10477
|
+
}
|
|
10478
|
+
function calculateOffset(index) {
|
|
10479
|
+
return sizes.slice(0, index).reduce((acc, val) => acc + (val || itemHeight.value), 0);
|
|
10480
|
+
}
|
|
10481
|
+
function calculateMidPointIndex(scrollTop) {
|
|
10482
|
+
const end = items.value.length;
|
|
10483
|
+
let middle = 0;
|
|
10484
|
+
let middleOffset = 0;
|
|
10485
|
+
while (middleOffset < scrollTop && middle < end) {
|
|
10486
|
+
middleOffset += sizes[middle++] || itemHeight.value;
|
|
10487
|
+
}
|
|
10488
|
+
return middle - 1;
|
|
10489
|
+
}
|
|
10490
|
+
let lastScrollTop = 0;
|
|
10491
|
+
function handleScroll() {
|
|
10492
|
+
if (!containerRef.value || !contentRect.value) return;
|
|
10493
|
+
const height = contentRect.value.height - 56;
|
|
10494
|
+
const scrollTop = containerRef.value.scrollTop;
|
|
10495
|
+
const direction = scrollTop < lastScrollTop ? UP : DOWN;
|
|
10496
|
+
const midPointIndex = calculateMidPointIndex(scrollTop + height / 2);
|
|
10497
|
+
const buffer = Math.round(visibleItems.value / 3);
|
|
10498
|
+
const firstIndex = midPointIndex - buffer;
|
|
10499
|
+
const lastIndex = first.value + buffer * 2 - 1;
|
|
10500
|
+
if (direction === UP && midPointIndex <= lastIndex) {
|
|
10501
|
+
first.value = clamp(firstIndex, 0, items.value.length);
|
|
10502
|
+
} else if (direction === DOWN && midPointIndex >= lastIndex) {
|
|
10503
|
+
first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value);
|
|
10504
|
+
}
|
|
10505
|
+
lastScrollTop = scrollTop;
|
|
10506
|
+
}
|
|
10507
|
+
function scrollToIndex(index) {
|
|
10508
|
+
if (!containerRef.value) return;
|
|
10509
|
+
const offset = calculateOffset(index);
|
|
10510
|
+
containerRef.value.scrollTop = offset;
|
|
10511
|
+
}
|
|
10512
|
+
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
10513
|
+
const computedItems = computed(() => {
|
|
10514
|
+
return items.value.slice(first.value, last.value).map((item, index) => ({
|
|
10515
|
+
raw: item,
|
|
10516
|
+
index: index + first.value
|
|
10517
|
+
}));
|
|
10518
|
+
});
|
|
10519
|
+
const paddingTop = computed(() => calculateOffset(first.value));
|
|
10520
|
+
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
10521
|
+
watch(() => items.value.length, () => {
|
|
10522
|
+
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
10523
|
+
sizeMap.forEach((height, item) => {
|
|
10524
|
+
const index = items.value.indexOf(item);
|
|
10525
|
+
if (index === -1) {
|
|
10526
|
+
sizeMap.delete(item);
|
|
10527
|
+
} else {
|
|
10528
|
+
sizes[index] = height;
|
|
10529
|
+
}
|
|
10530
|
+
});
|
|
10531
|
+
});
|
|
10532
|
+
return {
|
|
10533
|
+
containerRef,
|
|
10534
|
+
computedItems,
|
|
10535
|
+
itemHeight,
|
|
10536
|
+
paddingTop,
|
|
10537
|
+
paddingBottom,
|
|
10538
|
+
scrollToIndex,
|
|
10539
|
+
handleScroll,
|
|
10540
|
+
handleItemResize
|
|
10541
|
+
};
|
|
10542
|
+
}
|
|
10543
|
+
|
|
10544
|
+
// Types
|
|
10545
|
+
|
|
10546
|
+
const makeVVirtualScrollProps = propsFactory({
|
|
10547
|
+
items: {
|
|
10548
|
+
type: Array,
|
|
10549
|
+
default: () => []
|
|
10550
|
+
},
|
|
10551
|
+
renderless: Boolean,
|
|
10552
|
+
...makeVirtualProps(),
|
|
10553
|
+
...makeComponentProps(),
|
|
10554
|
+
...makeDimensionProps()
|
|
10555
|
+
}, 'VVirtualScroll');
|
|
10556
|
+
const VVirtualScroll = genericComponent()({
|
|
10557
|
+
name: 'VVirtualScroll',
|
|
10558
|
+
props: makeVVirtualScrollProps(),
|
|
10559
|
+
setup(props, _ref) {
|
|
10560
|
+
let {
|
|
10561
|
+
slots
|
|
10562
|
+
} = _ref;
|
|
10563
|
+
const vm = getCurrentInstance('VVirtualScroll');
|
|
10564
|
+
const {
|
|
10565
|
+
dimensionStyles
|
|
10566
|
+
} = useDimension(props);
|
|
10567
|
+
const {
|
|
10568
|
+
containerRef,
|
|
10569
|
+
handleScroll,
|
|
10570
|
+
handleItemResize,
|
|
10571
|
+
scrollToIndex,
|
|
10572
|
+
paddingTop,
|
|
10573
|
+
paddingBottom,
|
|
10574
|
+
computedItems
|
|
10575
|
+
} = useVirtual(props, toRef(props, 'items'));
|
|
10576
|
+
useToggleScope(() => props.renderless, () => {
|
|
10577
|
+
onMounted(() => {
|
|
10578
|
+
containerRef.value = getScrollParent(vm.vnode.el, true);
|
|
10579
|
+
containerRef.value?.addEventListener('scroll', handleScroll);
|
|
10580
|
+
});
|
|
10581
|
+
onScopeDispose(() => {
|
|
10582
|
+
containerRef.value?.removeEventListener('scroll', handleScroll);
|
|
10583
|
+
});
|
|
10584
|
+
});
|
|
10585
|
+
useRender(() => {
|
|
10586
|
+
const children = computedItems.value.map(item => createVNode(VVirtualScrollItem, {
|
|
10587
|
+
"key": item.index,
|
|
10588
|
+
"renderless": props.renderless,
|
|
10589
|
+
"onUpdate:height": height => handleItemResize(item.index, height)
|
|
10590
|
+
}, {
|
|
10591
|
+
default: slotProps => slots.default?.({
|
|
10592
|
+
item: item.raw,
|
|
10593
|
+
index: item.index,
|
|
10594
|
+
...slotProps
|
|
10595
|
+
})
|
|
10596
|
+
}));
|
|
10597
|
+
return props.renderless ? createVNode(Fragment, null, [createVNode("div", {
|
|
10598
|
+
"class": "v-virtual-scroll__spacer",
|
|
10599
|
+
"style": {
|
|
10600
|
+
paddingTop: convertToUnit(paddingTop.value)
|
|
10601
|
+
}
|
|
10602
|
+
}, null), children, createVNode("div", {
|
|
10603
|
+
"class": "v-virtual-scroll__spacer",
|
|
10604
|
+
"style": {
|
|
10605
|
+
paddingBottom: convertToUnit(paddingBottom.value)
|
|
10606
|
+
}
|
|
10607
|
+
}, null)]) : createVNode("div", {
|
|
10608
|
+
"ref": containerRef,
|
|
10609
|
+
"class": ['v-virtual-scroll', props.class],
|
|
10610
|
+
"onScroll": handleScroll,
|
|
10611
|
+
"style": [dimensionStyles.value, props.style]
|
|
10612
|
+
}, [createVNode("div", {
|
|
10613
|
+
"class": "v-virtual-scroll__container",
|
|
10614
|
+
"style": {
|
|
10615
|
+
paddingTop: convertToUnit(paddingTop.value),
|
|
10616
|
+
paddingBottom: convertToUnit(paddingBottom.value)
|
|
10617
|
+
}
|
|
10618
|
+
}, [children])]);
|
|
10619
|
+
});
|
|
10620
|
+
return {
|
|
10621
|
+
scrollToIndex
|
|
10622
|
+
};
|
|
10623
|
+
}
|
|
10624
|
+
});
|
|
10625
|
+
|
|
10626
|
+
// Utilities
|
|
10627
|
+
|
|
10628
|
+
// Types
|
|
10629
|
+
|
|
10630
|
+
function useScrolling(listRef, textFieldRef) {
|
|
10631
|
+
const isScrolling = shallowRef(false);
|
|
10632
|
+
let scrollTimeout;
|
|
10633
|
+
function onListScroll(e) {
|
|
10634
|
+
cancelAnimationFrame(scrollTimeout);
|
|
10635
|
+
isScrolling.value = true;
|
|
10636
|
+
scrollTimeout = requestAnimationFrame(() => {
|
|
10637
|
+
scrollTimeout = requestAnimationFrame(() => {
|
|
10638
|
+
isScrolling.value = false;
|
|
10639
|
+
});
|
|
10640
|
+
});
|
|
10641
|
+
}
|
|
10642
|
+
async function finishScrolling() {
|
|
10643
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10644
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10645
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10646
|
+
await new Promise(resolve => {
|
|
10647
|
+
if (isScrolling.value) {
|
|
10648
|
+
const stop = watch(isScrolling, () => {
|
|
10649
|
+
stop();
|
|
10650
|
+
resolve();
|
|
10651
|
+
});
|
|
10652
|
+
} else resolve();
|
|
10653
|
+
});
|
|
10654
|
+
}
|
|
10655
|
+
async function onListKeydown(e) {
|
|
10656
|
+
if (e.key === 'Tab') {
|
|
10657
|
+
textFieldRef.value?.focus();
|
|
10658
|
+
}
|
|
10659
|
+
if (!['PageDown', 'PageUp', 'Home', 'End'].includes(e.key)) return;
|
|
10660
|
+
const el = listRef.value?.$el;
|
|
10661
|
+
if (!el) return;
|
|
10662
|
+
if (e.key === 'Home' || e.key === 'End') {
|
|
10663
|
+
el.scrollTo({
|
|
10664
|
+
top: e.key === 'Home' ? 0 : el.scrollHeight,
|
|
10665
|
+
behavior: 'smooth'
|
|
10666
|
+
});
|
|
10667
|
+
}
|
|
10668
|
+
await finishScrolling();
|
|
10669
|
+
const children = el.querySelectorAll(':scope > :not(.v-virtual-scroll__spacer)');
|
|
10670
|
+
if (e.key === 'PageDown' || e.key === 'Home') {
|
|
10671
|
+
const top = el.getBoundingClientRect().top;
|
|
10672
|
+
for (const child of children) {
|
|
10673
|
+
if (child.getBoundingClientRect().top >= top) {
|
|
10674
|
+
child.focus();
|
|
10675
|
+
break;
|
|
10676
|
+
}
|
|
10677
|
+
}
|
|
10678
|
+
} else {
|
|
10679
|
+
const bottom = el.getBoundingClientRect().bottom;
|
|
10680
|
+
for (const child of [...children].reverse()) {
|
|
10681
|
+
if (child.getBoundingClientRect().bottom <= bottom) {
|
|
10682
|
+
child.focus();
|
|
10683
|
+
break;
|
|
10684
|
+
}
|
|
10685
|
+
}
|
|
10686
|
+
}
|
|
10687
|
+
}
|
|
10688
|
+
return {
|
|
10689
|
+
onListScroll,
|
|
10690
|
+
onListKeydown
|
|
10691
|
+
};
|
|
10692
|
+
}
|
|
10693
|
+
|
|
10694
|
+
// Types
|
|
10695
|
+
|
|
10379
10696
|
const makeSelectProps = propsFactory({
|
|
10380
10697
|
chips: Boolean,
|
|
10381
10698
|
closableChips: Boolean,
|
|
@@ -10467,6 +10784,10 @@ const VSelect = genericComponent()({
|
|
|
10467
10784
|
});
|
|
10468
10785
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
10469
10786
|
const listRef = ref();
|
|
10787
|
+
const {
|
|
10788
|
+
onListScroll,
|
|
10789
|
+
onListKeydown
|
|
10790
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
10470
10791
|
function onClear(e) {
|
|
10471
10792
|
if (props.openOnClear) {
|
|
10472
10793
|
menu.value = true;
|
|
@@ -10513,11 +10834,6 @@ const VSelect = genericComponent()({
|
|
|
10513
10834
|
model.value = [item];
|
|
10514
10835
|
}
|
|
10515
10836
|
}
|
|
10516
|
-
function onListKeydown(e) {
|
|
10517
|
-
if (e.key === 'Tab') {
|
|
10518
|
-
vTextFieldRef.value?.focus();
|
|
10519
|
-
}
|
|
10520
|
-
}
|
|
10521
10837
|
function select(item) {
|
|
10522
10838
|
if (props.multiple) {
|
|
10523
10839
|
const index = selected.value.findIndex(selection => props.valueComparator(selection, item.value));
|
|
@@ -10600,34 +10916,46 @@ const VSelect = genericComponent()({
|
|
|
10600
10916
|
"onMousedown": e => e.preventDefault(),
|
|
10601
10917
|
"onKeydown": onListKeydown,
|
|
10602
10918
|
"onFocusin": onFocusin,
|
|
10919
|
+
"onScrollPassive": onListScroll,
|
|
10603
10920
|
"tabindex": "-1"
|
|
10604
10921
|
}, {
|
|
10605
10922
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
10606
10923
|
"title": t(props.noDataText)
|
|
10607
|
-
}, null)),
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10924
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
10925
|
+
"renderless": true,
|
|
10926
|
+
"items": displayItems.value
|
|
10927
|
+
}, {
|
|
10928
|
+
default: _ref2 => {
|
|
10929
|
+
let {
|
|
10930
|
+
item,
|
|
10931
|
+
index,
|
|
10932
|
+
itemRef
|
|
10933
|
+
} = _ref2;
|
|
10934
|
+
const itemProps = mergeProps(item.props, {
|
|
10935
|
+
ref: itemRef,
|
|
10936
|
+
key: index,
|
|
10937
|
+
onClick: () => select(item)
|
|
10938
|
+
});
|
|
10939
|
+
return slots.item?.({
|
|
10940
|
+
item,
|
|
10941
|
+
index,
|
|
10942
|
+
props: itemProps
|
|
10943
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
10944
|
+
prepend: _ref3 => {
|
|
10945
|
+
let {
|
|
10946
|
+
isSelected
|
|
10947
|
+
} = _ref3;
|
|
10948
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
10949
|
+
"key": item.value,
|
|
10950
|
+
"modelValue": isSelected,
|
|
10951
|
+
"ripple": false,
|
|
10952
|
+
"tabindex": "-1"
|
|
10953
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
10954
|
+
"icon": item.props.prependIcon
|
|
10955
|
+
}, null)]);
|
|
10956
|
+
}
|
|
10957
|
+
});
|
|
10958
|
+
}
|
|
10631
10959
|
}), slots['append-item']?.()]
|
|
10632
10960
|
})]
|
|
10633
10961
|
}), selections.value.map((item, index) => {
|
|
@@ -10765,14 +11093,12 @@ function filterItems(items, query, options) {
|
|
|
10765
11093
|
return array;
|
|
10766
11094
|
}
|
|
10767
11095
|
function useFilter(props, items, query, options) {
|
|
10768
|
-
const strQuery = computed(() => typeof query?.value !== 'string' && typeof query?.value !== 'number' ? '' : String(query.value));
|
|
10769
11096
|
const filteredItems = ref([]);
|
|
10770
11097
|
const filteredMatches = ref(new Map());
|
|
10771
11098
|
const transformedItems = computed(() => options?.transform ? unref(items).map(options?.transform) : unref(items));
|
|
10772
11099
|
watchEffect(() => {
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
const results = filterItems(transformedItems.value, strQuery.value, {
|
|
11100
|
+
const strQuery = typeof toValue(query) !== 'string' && typeof toValue(query) !== 'number' ? '' : String(toValue(query));
|
|
11101
|
+
const results = filterItems(transformedItems.value, strQuery, {
|
|
10776
11102
|
customKeyFilter: props.customKeyFilter,
|
|
10777
11103
|
default: props.customFilter,
|
|
10778
11104
|
filterKeys: props.filterKeys,
|
|
@@ -10780,15 +11106,19 @@ function useFilter(props, items, query, options) {
|
|
|
10780
11106
|
noFilter: props.noFilter
|
|
10781
11107
|
});
|
|
10782
11108
|
const originalItems = unref(items);
|
|
11109
|
+
const _filteredItems = [];
|
|
11110
|
+
const _filteredMatches = new Map();
|
|
10783
11111
|
results.forEach(_ref => {
|
|
10784
11112
|
let {
|
|
10785
11113
|
index,
|
|
10786
11114
|
matches
|
|
10787
11115
|
} = _ref;
|
|
10788
11116
|
const item = originalItems[index];
|
|
10789
|
-
|
|
10790
|
-
|
|
11117
|
+
_filteredItems.push(item);
|
|
11118
|
+
_filteredMatches.set(item.value, matches);
|
|
10791
11119
|
});
|
|
11120
|
+
filteredItems.value = _filteredItems;
|
|
11121
|
+
filteredMatches.value = _filteredMatches;
|
|
10792
11122
|
});
|
|
10793
11123
|
function getMatches(item) {
|
|
10794
11124
|
return filteredMatches.value.get(item.value);
|
|
@@ -10878,7 +11208,7 @@ const VAutocomplete = genericComponent()({
|
|
|
10878
11208
|
const {
|
|
10879
11209
|
filteredItems,
|
|
10880
11210
|
getMatches
|
|
10881
|
-
} = useFilter(props, items,
|
|
11211
|
+
} = useFilter(props, items, () => isPristine.value ? '' : search.value);
|
|
10882
11212
|
const selections = computed(() => {
|
|
10883
11213
|
return model.value.map(v => {
|
|
10884
11214
|
return items.value.find(item => props.valueComparator(item.value, v.value)) || v;
|
|
@@ -10898,6 +11228,10 @@ const VAutocomplete = genericComponent()({
|
|
|
10898
11228
|
});
|
|
10899
11229
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
10900
11230
|
const listRef = ref();
|
|
11231
|
+
const {
|
|
11232
|
+
onListScroll,
|
|
11233
|
+
onListKeydown
|
|
11234
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
10901
11235
|
function onClear(e) {
|
|
10902
11236
|
if (props.openOnClear) {
|
|
10903
11237
|
menu.value = true;
|
|
@@ -10971,11 +11305,6 @@ const VAutocomplete = genericComponent()({
|
|
|
10971
11305
|
}
|
|
10972
11306
|
}
|
|
10973
11307
|
}
|
|
10974
|
-
function onListKeydown(e) {
|
|
10975
|
-
if (e.key === 'Tab') {
|
|
10976
|
-
vTextFieldRef.value?.focus();
|
|
10977
|
-
}
|
|
10978
|
-
}
|
|
10979
11308
|
function onInput(e) {
|
|
10980
11309
|
search.value = e.target.value;
|
|
10981
11310
|
}
|
|
@@ -11094,38 +11423,50 @@ const VAutocomplete = genericComponent()({
|
|
|
11094
11423
|
"onKeydown": onListKeydown,
|
|
11095
11424
|
"onFocusin": onFocusin,
|
|
11096
11425
|
"onFocusout": onFocusout,
|
|
11426
|
+
"onScrollPassive": onListScroll,
|
|
11097
11427
|
"tabindex": "-1"
|
|
11098
11428
|
}, {
|
|
11099
11429
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
11100
11430
|
"title": t(props.noDataText)
|
|
11101
|
-
}, null)),
|
|
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
|
-
|
|
11128
|
-
|
|
11431
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
11432
|
+
"renderless": true,
|
|
11433
|
+
"items": displayItems.value
|
|
11434
|
+
}, {
|
|
11435
|
+
default: _ref3 => {
|
|
11436
|
+
let {
|
|
11437
|
+
item,
|
|
11438
|
+
index,
|
|
11439
|
+
itemRef
|
|
11440
|
+
} = _ref3;
|
|
11441
|
+
const itemProps = mergeProps(item.props, {
|
|
11442
|
+
ref: itemRef,
|
|
11443
|
+
key: index,
|
|
11444
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
|
11445
|
+
onClick: () => select(item)
|
|
11446
|
+
});
|
|
11447
|
+
return slots.item?.({
|
|
11448
|
+
item,
|
|
11449
|
+
index,
|
|
11450
|
+
props: itemProps
|
|
11451
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
11452
|
+
prepend: _ref4 => {
|
|
11453
|
+
let {
|
|
11454
|
+
isSelected
|
|
11455
|
+
} = _ref4;
|
|
11456
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
11457
|
+
"key": item.value,
|
|
11458
|
+
"modelValue": isSelected,
|
|
11459
|
+
"ripple": false,
|
|
11460
|
+
"tabindex": "-1"
|
|
11461
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
11462
|
+
"icon": item.props.prependIcon
|
|
11463
|
+
}, null)]);
|
|
11464
|
+
},
|
|
11465
|
+
title: () => {
|
|
11466
|
+
return isPristine.value ? item.title : highlightResult$1(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
|
11467
|
+
}
|
|
11468
|
+
});
|
|
11469
|
+
}
|
|
11129
11470
|
}), slots['append-item']?.()]
|
|
11130
11471
|
})]
|
|
11131
11472
|
}), selections.value.map((item, index) => {
|
|
@@ -14419,7 +14760,7 @@ const VCombobox = genericComponent()({
|
|
|
14419
14760
|
const {
|
|
14420
14761
|
filteredItems,
|
|
14421
14762
|
getMatches
|
|
14422
|
-
} = useFilter(props, items,
|
|
14763
|
+
} = useFilter(props, items, () => isPristine.value ? '' : search.value);
|
|
14423
14764
|
const selections = computed(() => {
|
|
14424
14765
|
return model.value.map(v => {
|
|
14425
14766
|
return items.value.find(item => props.valueComparator(item.value, v.value)) || v;
|
|
@@ -14439,6 +14780,10 @@ const VCombobox = genericComponent()({
|
|
|
14439
14780
|
});
|
|
14440
14781
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
14441
14782
|
const listRef = ref();
|
|
14783
|
+
const {
|
|
14784
|
+
onListScroll,
|
|
14785
|
+
onListKeydown
|
|
14786
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
14442
14787
|
function onClear(e) {
|
|
14443
14788
|
cleared = true;
|
|
14444
14789
|
if (props.openOnClear) {
|
|
@@ -14516,11 +14861,6 @@ const VCombobox = genericComponent()({
|
|
|
14516
14861
|
search.value = '';
|
|
14517
14862
|
}
|
|
14518
14863
|
}
|
|
14519
|
-
function onListKeydown(e) {
|
|
14520
|
-
if (e.key === 'Tab') {
|
|
14521
|
-
vTextFieldRef.value?.focus();
|
|
14522
|
-
}
|
|
14523
|
-
}
|
|
14524
14864
|
function onAfterLeave() {
|
|
14525
14865
|
if (isFocused.value) {
|
|
14526
14866
|
isPristine.value = true;
|
|
@@ -14631,38 +14971,50 @@ const VCombobox = genericComponent()({
|
|
|
14631
14971
|
"onKeydown": onListKeydown,
|
|
14632
14972
|
"onFocusin": onFocusin,
|
|
14633
14973
|
"onFocusout": onFocusout,
|
|
14974
|
+
"onScrollPassive": onListScroll,
|
|
14634
14975
|
"tabindex": "-1"
|
|
14635
14976
|
}, {
|
|
14636
14977
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
14637
14978
|
"title": t(props.noDataText)
|
|
14638
|
-
}, null)),
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14979
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
14980
|
+
"renderless": true,
|
|
14981
|
+
"items": displayItems.value
|
|
14982
|
+
}, {
|
|
14983
|
+
default: _ref3 => {
|
|
14984
|
+
let {
|
|
14985
|
+
item,
|
|
14986
|
+
index,
|
|
14987
|
+
itemRef
|
|
14988
|
+
} = _ref3;
|
|
14989
|
+
const itemProps = mergeProps(item.props, {
|
|
14990
|
+
ref: itemRef,
|
|
14991
|
+
key: index,
|
|
14992
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
|
14993
|
+
onClick: () => select(item)
|
|
14994
|
+
});
|
|
14995
|
+
return slots.item?.({
|
|
14996
|
+
item,
|
|
14997
|
+
index,
|
|
14998
|
+
props: itemProps
|
|
14999
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
15000
|
+
prepend: _ref4 => {
|
|
15001
|
+
let {
|
|
15002
|
+
isSelected
|
|
15003
|
+
} = _ref4;
|
|
15004
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
15005
|
+
"key": item.value,
|
|
15006
|
+
"modelValue": isSelected,
|
|
15007
|
+
"ripple": false,
|
|
15008
|
+
"tabindex": "-1"
|
|
15009
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
15010
|
+
"icon": item.props.prependIcon
|
|
15011
|
+
}, null)]);
|
|
15012
|
+
},
|
|
15013
|
+
title: () => {
|
|
15014
|
+
return isPristine.value ? item.title : highlightResult(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
|
15015
|
+
}
|
|
15016
|
+
});
|
|
15017
|
+
}
|
|
14666
15018
|
}), slots['append-item']?.()]
|
|
14667
15019
|
})]
|
|
14668
15020
|
}), selections.value.map((item, index) => {
|
|
@@ -19006,215 +19358,6 @@ const VValidation = genericComponent()({
|
|
|
19006
19358
|
}
|
|
19007
19359
|
});
|
|
19008
19360
|
|
|
19009
|
-
const makeVVirtualScrollItemProps = propsFactory({
|
|
19010
|
-
dynamicHeight: Boolean,
|
|
19011
|
-
renderless: Boolean,
|
|
19012
|
-
...makeComponentProps()
|
|
19013
|
-
}, 'VVirtualScrollItem');
|
|
19014
|
-
const VVirtualScrollItem = genericComponent()({
|
|
19015
|
-
name: 'VVirtualScrollItem',
|
|
19016
|
-
props: makeVVirtualScrollItemProps(),
|
|
19017
|
-
emits: {
|
|
19018
|
-
'update:height': height => true
|
|
19019
|
-
},
|
|
19020
|
-
setup(props, _ref) {
|
|
19021
|
-
let {
|
|
19022
|
-
emit,
|
|
19023
|
-
slots
|
|
19024
|
-
} = _ref;
|
|
19025
|
-
const {
|
|
19026
|
-
resizeRef,
|
|
19027
|
-
contentRect
|
|
19028
|
-
} = useResizeObserver();
|
|
19029
|
-
useToggleScope(() => props.dynamicHeight, () => {
|
|
19030
|
-
watch(() => contentRect.value?.height, height => {
|
|
19031
|
-
if (height != null) emit('update:height', height);
|
|
19032
|
-
});
|
|
19033
|
-
});
|
|
19034
|
-
function updateHeight() {
|
|
19035
|
-
if (props.dynamicHeight && contentRect.value) {
|
|
19036
|
-
emit('update:height', contentRect.value.height);
|
|
19037
|
-
}
|
|
19038
|
-
}
|
|
19039
|
-
onUpdated(updateHeight);
|
|
19040
|
-
useRender(() => props.renderless ? createVNode(Fragment, null, [slots.default?.({
|
|
19041
|
-
props: {
|
|
19042
|
-
ref: props.dynamicHeight ? resizeRef : undefined
|
|
19043
|
-
}
|
|
19044
|
-
})]) : createVNode("div", {
|
|
19045
|
-
"ref": props.dynamicHeight ? resizeRef : undefined,
|
|
19046
|
-
"class": ['v-virtual-scroll__item', props.class],
|
|
19047
|
-
"style": props.style
|
|
19048
|
-
}, [slots.default?.()]));
|
|
19049
|
-
}
|
|
19050
|
-
});
|
|
19051
|
-
|
|
19052
|
-
// Composables
|
|
19053
|
-
|
|
19054
|
-
// Types
|
|
19055
|
-
|
|
19056
|
-
const UP = -1;
|
|
19057
|
-
const DOWN = 1;
|
|
19058
|
-
const makeVirtualProps = propsFactory({
|
|
19059
|
-
itemHeight: [Number, String]
|
|
19060
|
-
}, 'virtual');
|
|
19061
|
-
function useVirtual(props, items, offset) {
|
|
19062
|
-
const first = shallowRef(0);
|
|
19063
|
-
const baseItemHeight = shallowRef(props.itemHeight);
|
|
19064
|
-
const itemHeight = computed({
|
|
19065
|
-
get: () => parseInt(baseItemHeight.value ?? 0, 10),
|
|
19066
|
-
set(val) {
|
|
19067
|
-
baseItemHeight.value = val;
|
|
19068
|
-
}
|
|
19069
|
-
});
|
|
19070
|
-
const containerRef = ref();
|
|
19071
|
-
const {
|
|
19072
|
-
resizeRef,
|
|
19073
|
-
contentRect
|
|
19074
|
-
} = useResizeObserver();
|
|
19075
|
-
watchEffect(() => {
|
|
19076
|
-
resizeRef.value = containerRef.value;
|
|
19077
|
-
});
|
|
19078
|
-
const display = useDisplay();
|
|
19079
|
-
const sizeMap = new Map();
|
|
19080
|
-
let sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
19081
|
-
const visibleItems = computed(() => {
|
|
19082
|
-
const height = (contentRect.value?.height ?? display.height.value) - (offset?.value ?? 0);
|
|
19083
|
-
return itemHeight.value ? Math.max(12, Math.ceil(height / itemHeight.value * 1.7 + 1)) : 12;
|
|
19084
|
-
});
|
|
19085
|
-
function handleItemResize(index, height) {
|
|
19086
|
-
itemHeight.value = Math.max(itemHeight.value, height);
|
|
19087
|
-
sizes[index] = height;
|
|
19088
|
-
sizeMap.set(items.value[index], height);
|
|
19089
|
-
}
|
|
19090
|
-
function calculateOffset(index) {
|
|
19091
|
-
return sizes.slice(0, index).reduce((curr, value) => curr + (value || itemHeight.value), 0);
|
|
19092
|
-
}
|
|
19093
|
-
function calculateMidPointIndex(scrollTop) {
|
|
19094
|
-
const end = items.value.length;
|
|
19095
|
-
let middle = 0;
|
|
19096
|
-
let middleOffset = 0;
|
|
19097
|
-
while (middleOffset < scrollTop && middle < end) {
|
|
19098
|
-
middleOffset += sizes[middle++] || itemHeight.value;
|
|
19099
|
-
}
|
|
19100
|
-
return middle - 1;
|
|
19101
|
-
}
|
|
19102
|
-
let lastScrollTop = 0;
|
|
19103
|
-
function handleScroll() {
|
|
19104
|
-
if (!containerRef.value || !contentRect.value) return;
|
|
19105
|
-
const height = contentRect.value.height - 56;
|
|
19106
|
-
const scrollTop = containerRef.value.scrollTop;
|
|
19107
|
-
const direction = scrollTop < lastScrollTop ? UP : DOWN;
|
|
19108
|
-
const midPointIndex = calculateMidPointIndex(scrollTop + height / 2);
|
|
19109
|
-
const buffer = Math.round(visibleItems.value / 3);
|
|
19110
|
-
const firstIndex = midPointIndex - buffer;
|
|
19111
|
-
const lastIndex = first.value + buffer * 2 - 1;
|
|
19112
|
-
if (direction === UP && midPointIndex <= lastIndex) {
|
|
19113
|
-
first.value = clamp(firstIndex, 0, items.value.length);
|
|
19114
|
-
} else if (direction === DOWN && midPointIndex >= lastIndex) {
|
|
19115
|
-
first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value);
|
|
19116
|
-
}
|
|
19117
|
-
lastScrollTop = scrollTop;
|
|
19118
|
-
}
|
|
19119
|
-
function scrollToIndex(index) {
|
|
19120
|
-
if (!containerRef.value) return;
|
|
19121
|
-
const offset = calculateOffset(index);
|
|
19122
|
-
containerRef.value.scrollTop = offset;
|
|
19123
|
-
}
|
|
19124
|
-
const allItems = computed(() => items.value.map((item, index) => ({
|
|
19125
|
-
raw: item,
|
|
19126
|
-
index
|
|
19127
|
-
})));
|
|
19128
|
-
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
19129
|
-
const computedItems = computed(() => allItems.value.slice(first.value, last.value));
|
|
19130
|
-
const paddingTop = computed(() => calculateOffset(first.value));
|
|
19131
|
-
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
19132
|
-
onMounted(() => {
|
|
19133
|
-
if (!itemHeight.value) {
|
|
19134
|
-
// If itemHeight prop is not set, then calculate an estimated height from the average of inital items
|
|
19135
|
-
itemHeight.value = sizes.slice(first.value, last.value).reduce((curr, height) => curr + height, 0) / visibleItems.value;
|
|
19136
|
-
}
|
|
19137
|
-
});
|
|
19138
|
-
watch(() => items.value.length, () => {
|
|
19139
|
-
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
19140
|
-
sizeMap.forEach((height, item) => {
|
|
19141
|
-
const index = items.value.indexOf(item);
|
|
19142
|
-
if (index === -1) {
|
|
19143
|
-
sizeMap.delete(item);
|
|
19144
|
-
} else {
|
|
19145
|
-
sizes[index] = height;
|
|
19146
|
-
}
|
|
19147
|
-
});
|
|
19148
|
-
});
|
|
19149
|
-
return {
|
|
19150
|
-
containerRef,
|
|
19151
|
-
computedItems,
|
|
19152
|
-
itemHeight,
|
|
19153
|
-
paddingTop,
|
|
19154
|
-
paddingBottom,
|
|
19155
|
-
scrollToIndex,
|
|
19156
|
-
handleScroll,
|
|
19157
|
-
handleItemResize
|
|
19158
|
-
};
|
|
19159
|
-
}
|
|
19160
|
-
|
|
19161
|
-
// Types
|
|
19162
|
-
|
|
19163
|
-
const makeVVirtualScrollProps = propsFactory({
|
|
19164
|
-
items: {
|
|
19165
|
-
type: Array,
|
|
19166
|
-
default: () => []
|
|
19167
|
-
},
|
|
19168
|
-
...makeVirtualProps(),
|
|
19169
|
-
...makeComponentProps(),
|
|
19170
|
-
...makeDimensionProps()
|
|
19171
|
-
}, 'VVirtualScroll');
|
|
19172
|
-
const VVirtualScroll = genericComponent()({
|
|
19173
|
-
name: 'VVirtualScroll',
|
|
19174
|
-
props: makeVVirtualScrollProps(),
|
|
19175
|
-
setup(props, _ref) {
|
|
19176
|
-
let {
|
|
19177
|
-
slots
|
|
19178
|
-
} = _ref;
|
|
19179
|
-
const {
|
|
19180
|
-
dimensionStyles
|
|
19181
|
-
} = useDimension(props);
|
|
19182
|
-
const {
|
|
19183
|
-
containerRef,
|
|
19184
|
-
handleScroll,
|
|
19185
|
-
handleItemResize,
|
|
19186
|
-
scrollToIndex,
|
|
19187
|
-
paddingTop,
|
|
19188
|
-
paddingBottom,
|
|
19189
|
-
computedItems
|
|
19190
|
-
} = useVirtual(props, toRef(props, 'items'));
|
|
19191
|
-
useRender(() => createVNode("div", {
|
|
19192
|
-
"ref": containerRef,
|
|
19193
|
-
"class": ['v-virtual-scroll', props.class],
|
|
19194
|
-
"onScroll": handleScroll,
|
|
19195
|
-
"style": [dimensionStyles.value, props.style]
|
|
19196
|
-
}, [createVNode("div", {
|
|
19197
|
-
"class": "v-virtual-scroll__container",
|
|
19198
|
-
"style": {
|
|
19199
|
-
paddingTop: convertToUnit(paddingTop.value),
|
|
19200
|
-
paddingBottom: convertToUnit(paddingBottom.value)
|
|
19201
|
-
}
|
|
19202
|
-
}, [computedItems.value.map(item => createVNode(VVirtualScrollItem, {
|
|
19203
|
-
"key": item.index,
|
|
19204
|
-
"dynamicHeight": !props.itemHeight,
|
|
19205
|
-
"onUpdate:height": height => handleItemResize(item.index, height)
|
|
19206
|
-
}, {
|
|
19207
|
-
default: () => [slots.default?.({
|
|
19208
|
-
item: item.raw,
|
|
19209
|
-
index: item.index
|
|
19210
|
-
})]
|
|
19211
|
-
}))])]));
|
|
19212
|
-
return {
|
|
19213
|
-
scrollToIndex
|
|
19214
|
-
};
|
|
19215
|
-
}
|
|
19216
|
-
});
|
|
19217
|
-
|
|
19218
19361
|
var components = /*#__PURE__*/Object.freeze({
|
|
19219
19362
|
__proto__: null,
|
|
19220
19363
|
VAlert: VAlert,
|
|
@@ -20013,7 +20156,7 @@ function createVuetify$1() {
|
|
|
20013
20156
|
date
|
|
20014
20157
|
};
|
|
20015
20158
|
}
|
|
20016
|
-
const version$1 = "3.3.
|
|
20159
|
+
const version$1 = "3.3.7";
|
|
20017
20160
|
createVuetify$1.version = version$1;
|
|
20018
20161
|
|
|
20019
20162
|
// Vue's inject() can only be used in setup
|
|
@@ -20038,7 +20181,7 @@ const createVuetify = function () {
|
|
|
20038
20181
|
...options
|
|
20039
20182
|
});
|
|
20040
20183
|
};
|
|
20041
|
-
const version = "3.3.
|
|
20184
|
+
const version = "3.3.7";
|
|
20042
20185
|
createVuetify.version = version;
|
|
20043
20186
|
|
|
20044
20187
|
export { components, createVuetify, directives, useDefaults, useDisplay, useLayout, useLocale, useRtl, useTheme, version };
|