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-labs.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, withModifiers } from 'vue';
|
|
8
8
|
|
|
9
9
|
// Types
|
|
10
10
|
// eslint-disable-line vue/prefer-import-from-vue
|
|
@@ -1254,8 +1254,9 @@ getUid.reset = () => {
|
|
|
1254
1254
|
};
|
|
1255
1255
|
|
|
1256
1256
|
function getScrollParent(el) {
|
|
1257
|
+
let includeHidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1257
1258
|
while (el) {
|
|
1258
|
-
if (hasScrollbar(el)) return el;
|
|
1259
|
+
if (includeHidden ? isPotentiallyScrollable(el) : hasScrollbar(el)) return el;
|
|
1259
1260
|
el = el.parentElement;
|
|
1260
1261
|
}
|
|
1261
1262
|
return document.scrollingElement;
|
|
@@ -1275,6 +1276,11 @@ function hasScrollbar(el) {
|
|
|
1275
1276
|
const style = window.getComputedStyle(el);
|
|
1276
1277
|
return style.overflowY === 'scroll' || style.overflowY === 'auto' && el.scrollHeight > el.clientHeight;
|
|
1277
1278
|
}
|
|
1279
|
+
function isPotentiallyScrollable(el) {
|
|
1280
|
+
if (!el || el.nodeType !== Node.ELEMENT_NODE) return false;
|
|
1281
|
+
const style = window.getComputedStyle(el);
|
|
1282
|
+
return ['scroll', 'auto'].includes(style.overflowY);
|
|
1283
|
+
}
|
|
1278
1284
|
|
|
1279
1285
|
const IN_BROWSER = typeof window !== 'undefined';
|
|
1280
1286
|
const SUPPORTS_INTERSECTION = IN_BROWSER && 'IntersectionObserver' in window;
|
|
@@ -1320,13 +1326,18 @@ function useRender(render) {
|
|
|
1320
1326
|
// Types
|
|
1321
1327
|
|
|
1322
1328
|
function useResizeObserver(callback) {
|
|
1329
|
+
let box = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'content';
|
|
1323
1330
|
const resizeRef = ref();
|
|
1324
1331
|
const contentRect = ref();
|
|
1325
1332
|
if (IN_BROWSER) {
|
|
1326
1333
|
const observer = new ResizeObserver(entries => {
|
|
1327
1334
|
callback?.(entries, observer);
|
|
1328
1335
|
if (!entries.length) return;
|
|
1329
|
-
|
|
1336
|
+
if (box === 'content') {
|
|
1337
|
+
contentRect.value = entries[0].contentRect;
|
|
1338
|
+
} else {
|
|
1339
|
+
contentRect.value = entries[0].target.getBoundingClientRect();
|
|
1340
|
+
}
|
|
1330
1341
|
});
|
|
1331
1342
|
onBeforeUnmount(() => {
|
|
1332
1343
|
observer.disconnect();
|
|
@@ -3148,7 +3159,9 @@ const VImg = genericComponent()({
|
|
|
3148
3159
|
"class": ['v-img', {
|
|
3149
3160
|
'v-img--booting': !isBooted.value
|
|
3150
3161
|
}, props.class],
|
|
3151
|
-
"style":
|
|
3162
|
+
"style": [{
|
|
3163
|
+
width: convertToUnit(props.width === 'auto' ? naturalWidth.value : props.width)
|
|
3164
|
+
}, props.style]
|
|
3152
3165
|
}, responsiveProps, {
|
|
3153
3166
|
"aspectRatio": aspectRatio.value,
|
|
3154
3167
|
"aria-label": props.alt,
|
|
@@ -5267,7 +5280,7 @@ const VBtn = genericComponent()({
|
|
|
5267
5280
|
return Object(props.value) === props.value ? JSON.stringify(props.value, null, 0) : props.value;
|
|
5268
5281
|
});
|
|
5269
5282
|
function onClick(e) {
|
|
5270
|
-
if (isDisabled.value) return;
|
|
5283
|
+
if (isDisabled.value || link.isLink.value && (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0 || attrs.target === '_blank')) return;
|
|
5271
5284
|
link.navigate?.(e);
|
|
5272
5285
|
group?.toggle();
|
|
5273
5286
|
}
|
|
@@ -5606,7 +5619,10 @@ const VLabel = genericComponent()({
|
|
|
5606
5619
|
const VSelectionControlGroupSymbol = Symbol.for('vuetify:selection-control-group');
|
|
5607
5620
|
const makeSelectionControlGroupProps = propsFactory({
|
|
5608
5621
|
color: String,
|
|
5609
|
-
disabled:
|
|
5622
|
+
disabled: {
|
|
5623
|
+
type: Boolean,
|
|
5624
|
+
default: null
|
|
5625
|
+
},
|
|
5610
5626
|
defaultsTarget: String,
|
|
5611
5627
|
error: Boolean,
|
|
5612
5628
|
id: String,
|
|
@@ -5830,12 +5846,12 @@ const VSelectionControl = genericComponent()({
|
|
|
5830
5846
|
}, null), createVNode("input", mergeProps({
|
|
5831
5847
|
"ref": input,
|
|
5832
5848
|
"checked": model.value,
|
|
5833
|
-
"disabled": props.disabled,
|
|
5849
|
+
"disabled": !!(props.readonly || props.disabled),
|
|
5834
5850
|
"id": id.value,
|
|
5835
5851
|
"onBlur": onBlur,
|
|
5836
5852
|
"onFocus": onFocus,
|
|
5837
5853
|
"onInput": onInput,
|
|
5838
|
-
"aria-disabled": props.readonly,
|
|
5854
|
+
"aria-disabled": !!(props.readonly || props.disabled),
|
|
5839
5855
|
"type": props.type,
|
|
5840
5856
|
"value": trueValue.value,
|
|
5841
5857
|
"name": props.name,
|
|
@@ -8706,7 +8722,9 @@ function blockScrollStrategy(data, props) {
|
|
|
8706
8722
|
scrollElements.forEach((el, i) => {
|
|
8707
8723
|
el.style.setProperty('--v-body-scroll-x', convertToUnit(-el.scrollLeft));
|
|
8708
8724
|
el.style.setProperty('--v-body-scroll-y', convertToUnit(-el.scrollTop));
|
|
8709
|
-
el.
|
|
8725
|
+
if (el !== document.documentElement) {
|
|
8726
|
+
el.style.setProperty('--v-scrollbar-offset', convertToUnit(scrollbarWidth));
|
|
8727
|
+
}
|
|
8710
8728
|
el.classList.add('v-overlay-scroll-blocked');
|
|
8711
8729
|
});
|
|
8712
8730
|
onScopeDispose(() => {
|
|
@@ -10361,12 +10379,16 @@ const VTextField = genericComponent()({
|
|
|
10361
10379
|
}]]);
|
|
10362
10380
|
return createVNode(Fragment, null, [props.prefix && createVNode("span", {
|
|
10363
10381
|
"class": "v-text-field__prefix"
|
|
10364
|
-
}, [
|
|
10382
|
+
}, [createVNode("span", {
|
|
10383
|
+
"class": "v-text-field__prefix__text"
|
|
10384
|
+
}, [props.prefix])]), createVNode("div", {
|
|
10365
10385
|
"class": fieldClass,
|
|
10366
10386
|
"data-no-activator": ""
|
|
10367
10387
|
}, [slots.default ? createVNode(Fragment, null, [slots.default(), inputNode]) : cloneVNode(inputNode)]), props.suffix && createVNode("span", {
|
|
10368
10388
|
"class": "v-text-field__suffix"
|
|
10369
|
-
}, [
|
|
10389
|
+
}, [createVNode("span", {
|
|
10390
|
+
"class": "v-text-field__suffix__text"
|
|
10391
|
+
}, [props.suffix])])]);
|
|
10370
10392
|
}
|
|
10371
10393
|
});
|
|
10372
10394
|
},
|
|
@@ -10383,6 +10405,301 @@ const VTextField = genericComponent()({
|
|
|
10383
10405
|
|
|
10384
10406
|
// Types
|
|
10385
10407
|
|
|
10408
|
+
const makeVVirtualScrollItemProps = propsFactory({
|
|
10409
|
+
renderless: Boolean,
|
|
10410
|
+
...makeComponentProps()
|
|
10411
|
+
}, 'VVirtualScrollItem');
|
|
10412
|
+
const VVirtualScrollItem = genericComponent()({
|
|
10413
|
+
name: 'VVirtualScrollItem',
|
|
10414
|
+
inheritAttrs: false,
|
|
10415
|
+
props: makeVVirtualScrollItemProps(),
|
|
10416
|
+
emits: {
|
|
10417
|
+
'update:height': height => true
|
|
10418
|
+
},
|
|
10419
|
+
setup(props, _ref) {
|
|
10420
|
+
let {
|
|
10421
|
+
attrs,
|
|
10422
|
+
emit,
|
|
10423
|
+
slots
|
|
10424
|
+
} = _ref;
|
|
10425
|
+
const {
|
|
10426
|
+
resizeRef,
|
|
10427
|
+
contentRect
|
|
10428
|
+
} = useResizeObserver(undefined, 'border');
|
|
10429
|
+
watch(() => contentRect.value?.height, height => {
|
|
10430
|
+
if (height != null) emit('update:height', height);
|
|
10431
|
+
});
|
|
10432
|
+
useRender(() => props.renderless ? createVNode(Fragment, null, [slots.default?.({
|
|
10433
|
+
itemRef: resizeRef
|
|
10434
|
+
})]) : createVNode("div", mergeProps({
|
|
10435
|
+
"ref": resizeRef,
|
|
10436
|
+
"class": ['v-virtual-scroll__item', props.class],
|
|
10437
|
+
"style": props.style
|
|
10438
|
+
}, attrs), [slots.default?.()]));
|
|
10439
|
+
}
|
|
10440
|
+
});
|
|
10441
|
+
|
|
10442
|
+
// Composables
|
|
10443
|
+
|
|
10444
|
+
// Types
|
|
10445
|
+
|
|
10446
|
+
const UP = -1;
|
|
10447
|
+
const DOWN = 1;
|
|
10448
|
+
const makeVirtualProps = propsFactory({
|
|
10449
|
+
itemHeight: {
|
|
10450
|
+
type: [Number, String],
|
|
10451
|
+
default: 48
|
|
10452
|
+
}
|
|
10453
|
+
}, 'virtual');
|
|
10454
|
+
function useVirtual(props, items, offset) {
|
|
10455
|
+
const first = shallowRef(0);
|
|
10456
|
+
const baseItemHeight = shallowRef(props.itemHeight);
|
|
10457
|
+
const itemHeight = computed({
|
|
10458
|
+
get: () => parseInt(baseItemHeight.value ?? 0, 10),
|
|
10459
|
+
set(val) {
|
|
10460
|
+
baseItemHeight.value = val;
|
|
10461
|
+
}
|
|
10462
|
+
});
|
|
10463
|
+
const containerRef = ref();
|
|
10464
|
+
const {
|
|
10465
|
+
resizeRef,
|
|
10466
|
+
contentRect
|
|
10467
|
+
} = useResizeObserver();
|
|
10468
|
+
watchEffect(() => {
|
|
10469
|
+
resizeRef.value = containerRef.value;
|
|
10470
|
+
});
|
|
10471
|
+
const display = useDisplay();
|
|
10472
|
+
const sizeMap = new Map();
|
|
10473
|
+
let sizes = Array.from({
|
|
10474
|
+
length: items.value.length
|
|
10475
|
+
});
|
|
10476
|
+
const visibleItems = computed(() => {
|
|
10477
|
+
const height = (!contentRect.value || containerRef.value === document.documentElement ? display.height.value : contentRect.value.height) - (offset?.value ?? 0);
|
|
10478
|
+
return Math.ceil(height / itemHeight.value * 1.7 + 1);
|
|
10479
|
+
});
|
|
10480
|
+
function handleItemResize(index, height) {
|
|
10481
|
+
itemHeight.value = Math.max(itemHeight.value, height);
|
|
10482
|
+
sizes[index] = height;
|
|
10483
|
+
sizeMap.set(items.value[index], height);
|
|
10484
|
+
}
|
|
10485
|
+
function calculateOffset(index) {
|
|
10486
|
+
return sizes.slice(0, index).reduce((acc, val) => acc + (val || itemHeight.value), 0);
|
|
10487
|
+
}
|
|
10488
|
+
function calculateMidPointIndex(scrollTop) {
|
|
10489
|
+
const end = items.value.length;
|
|
10490
|
+
let middle = 0;
|
|
10491
|
+
let middleOffset = 0;
|
|
10492
|
+
while (middleOffset < scrollTop && middle < end) {
|
|
10493
|
+
middleOffset += sizes[middle++] || itemHeight.value;
|
|
10494
|
+
}
|
|
10495
|
+
return middle - 1;
|
|
10496
|
+
}
|
|
10497
|
+
let lastScrollTop = 0;
|
|
10498
|
+
function handleScroll() {
|
|
10499
|
+
if (!containerRef.value || !contentRect.value) return;
|
|
10500
|
+
const height = contentRect.value.height - 56;
|
|
10501
|
+
const scrollTop = containerRef.value.scrollTop;
|
|
10502
|
+
const direction = scrollTop < lastScrollTop ? UP : DOWN;
|
|
10503
|
+
const midPointIndex = calculateMidPointIndex(scrollTop + height / 2);
|
|
10504
|
+
const buffer = Math.round(visibleItems.value / 3);
|
|
10505
|
+
const firstIndex = midPointIndex - buffer;
|
|
10506
|
+
const lastIndex = first.value + buffer * 2 - 1;
|
|
10507
|
+
if (direction === UP && midPointIndex <= lastIndex) {
|
|
10508
|
+
first.value = clamp(firstIndex, 0, items.value.length);
|
|
10509
|
+
} else if (direction === DOWN && midPointIndex >= lastIndex) {
|
|
10510
|
+
first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value);
|
|
10511
|
+
}
|
|
10512
|
+
lastScrollTop = scrollTop;
|
|
10513
|
+
}
|
|
10514
|
+
function scrollToIndex(index) {
|
|
10515
|
+
if (!containerRef.value) return;
|
|
10516
|
+
const offset = calculateOffset(index);
|
|
10517
|
+
containerRef.value.scrollTop = offset;
|
|
10518
|
+
}
|
|
10519
|
+
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
10520
|
+
const computedItems = computed(() => {
|
|
10521
|
+
return items.value.slice(first.value, last.value).map((item, index) => ({
|
|
10522
|
+
raw: item,
|
|
10523
|
+
index: index + first.value
|
|
10524
|
+
}));
|
|
10525
|
+
});
|
|
10526
|
+
const paddingTop = computed(() => calculateOffset(first.value));
|
|
10527
|
+
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
10528
|
+
watch(() => items.value.length, () => {
|
|
10529
|
+
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
10530
|
+
sizeMap.forEach((height, item) => {
|
|
10531
|
+
const index = items.value.indexOf(item);
|
|
10532
|
+
if (index === -1) {
|
|
10533
|
+
sizeMap.delete(item);
|
|
10534
|
+
} else {
|
|
10535
|
+
sizes[index] = height;
|
|
10536
|
+
}
|
|
10537
|
+
});
|
|
10538
|
+
});
|
|
10539
|
+
return {
|
|
10540
|
+
containerRef,
|
|
10541
|
+
computedItems,
|
|
10542
|
+
itemHeight,
|
|
10543
|
+
paddingTop,
|
|
10544
|
+
paddingBottom,
|
|
10545
|
+
scrollToIndex,
|
|
10546
|
+
handleScroll,
|
|
10547
|
+
handleItemResize
|
|
10548
|
+
};
|
|
10549
|
+
}
|
|
10550
|
+
|
|
10551
|
+
// Types
|
|
10552
|
+
|
|
10553
|
+
const makeVVirtualScrollProps = propsFactory({
|
|
10554
|
+
items: {
|
|
10555
|
+
type: Array,
|
|
10556
|
+
default: () => []
|
|
10557
|
+
},
|
|
10558
|
+
renderless: Boolean,
|
|
10559
|
+
...makeVirtualProps(),
|
|
10560
|
+
...makeComponentProps(),
|
|
10561
|
+
...makeDimensionProps()
|
|
10562
|
+
}, 'VVirtualScroll');
|
|
10563
|
+
const VVirtualScroll = genericComponent()({
|
|
10564
|
+
name: 'VVirtualScroll',
|
|
10565
|
+
props: makeVVirtualScrollProps(),
|
|
10566
|
+
setup(props, _ref) {
|
|
10567
|
+
let {
|
|
10568
|
+
slots
|
|
10569
|
+
} = _ref;
|
|
10570
|
+
const vm = getCurrentInstance('VVirtualScroll');
|
|
10571
|
+
const {
|
|
10572
|
+
dimensionStyles
|
|
10573
|
+
} = useDimension(props);
|
|
10574
|
+
const {
|
|
10575
|
+
containerRef,
|
|
10576
|
+
handleScroll,
|
|
10577
|
+
handleItemResize,
|
|
10578
|
+
scrollToIndex,
|
|
10579
|
+
paddingTop,
|
|
10580
|
+
paddingBottom,
|
|
10581
|
+
computedItems
|
|
10582
|
+
} = useVirtual(props, toRef(props, 'items'));
|
|
10583
|
+
useToggleScope(() => props.renderless, () => {
|
|
10584
|
+
onMounted(() => {
|
|
10585
|
+
containerRef.value = getScrollParent(vm.vnode.el, true);
|
|
10586
|
+
containerRef.value?.addEventListener('scroll', handleScroll);
|
|
10587
|
+
});
|
|
10588
|
+
onScopeDispose(() => {
|
|
10589
|
+
containerRef.value?.removeEventListener('scroll', handleScroll);
|
|
10590
|
+
});
|
|
10591
|
+
});
|
|
10592
|
+
useRender(() => {
|
|
10593
|
+
const children = computedItems.value.map(item => createVNode(VVirtualScrollItem, {
|
|
10594
|
+
"key": item.index,
|
|
10595
|
+
"renderless": props.renderless,
|
|
10596
|
+
"onUpdate:height": height => handleItemResize(item.index, height)
|
|
10597
|
+
}, {
|
|
10598
|
+
default: slotProps => slots.default?.({
|
|
10599
|
+
item: item.raw,
|
|
10600
|
+
index: item.index,
|
|
10601
|
+
...slotProps
|
|
10602
|
+
})
|
|
10603
|
+
}));
|
|
10604
|
+
return props.renderless ? createVNode(Fragment, null, [createVNode("div", {
|
|
10605
|
+
"class": "v-virtual-scroll__spacer",
|
|
10606
|
+
"style": {
|
|
10607
|
+
paddingTop: convertToUnit(paddingTop.value)
|
|
10608
|
+
}
|
|
10609
|
+
}, null), children, createVNode("div", {
|
|
10610
|
+
"class": "v-virtual-scroll__spacer",
|
|
10611
|
+
"style": {
|
|
10612
|
+
paddingBottom: convertToUnit(paddingBottom.value)
|
|
10613
|
+
}
|
|
10614
|
+
}, null)]) : createVNode("div", {
|
|
10615
|
+
"ref": containerRef,
|
|
10616
|
+
"class": ['v-virtual-scroll', props.class],
|
|
10617
|
+
"onScroll": handleScroll,
|
|
10618
|
+
"style": [dimensionStyles.value, props.style]
|
|
10619
|
+
}, [createVNode("div", {
|
|
10620
|
+
"class": "v-virtual-scroll__container",
|
|
10621
|
+
"style": {
|
|
10622
|
+
paddingTop: convertToUnit(paddingTop.value),
|
|
10623
|
+
paddingBottom: convertToUnit(paddingBottom.value)
|
|
10624
|
+
}
|
|
10625
|
+
}, [children])]);
|
|
10626
|
+
});
|
|
10627
|
+
return {
|
|
10628
|
+
scrollToIndex
|
|
10629
|
+
};
|
|
10630
|
+
}
|
|
10631
|
+
});
|
|
10632
|
+
|
|
10633
|
+
// Utilities
|
|
10634
|
+
|
|
10635
|
+
// Types
|
|
10636
|
+
|
|
10637
|
+
function useScrolling(listRef, textFieldRef) {
|
|
10638
|
+
const isScrolling = shallowRef(false);
|
|
10639
|
+
let scrollTimeout;
|
|
10640
|
+
function onListScroll(e) {
|
|
10641
|
+
cancelAnimationFrame(scrollTimeout);
|
|
10642
|
+
isScrolling.value = true;
|
|
10643
|
+
scrollTimeout = requestAnimationFrame(() => {
|
|
10644
|
+
scrollTimeout = requestAnimationFrame(() => {
|
|
10645
|
+
isScrolling.value = false;
|
|
10646
|
+
});
|
|
10647
|
+
});
|
|
10648
|
+
}
|
|
10649
|
+
async function finishScrolling() {
|
|
10650
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10651
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10652
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
10653
|
+
await new Promise(resolve => {
|
|
10654
|
+
if (isScrolling.value) {
|
|
10655
|
+
const stop = watch(isScrolling, () => {
|
|
10656
|
+
stop();
|
|
10657
|
+
resolve();
|
|
10658
|
+
});
|
|
10659
|
+
} else resolve();
|
|
10660
|
+
});
|
|
10661
|
+
}
|
|
10662
|
+
async function onListKeydown(e) {
|
|
10663
|
+
if (e.key === 'Tab') {
|
|
10664
|
+
textFieldRef.value?.focus();
|
|
10665
|
+
}
|
|
10666
|
+
if (!['PageDown', 'PageUp', 'Home', 'End'].includes(e.key)) return;
|
|
10667
|
+
const el = listRef.value?.$el;
|
|
10668
|
+
if (!el) return;
|
|
10669
|
+
if (e.key === 'Home' || e.key === 'End') {
|
|
10670
|
+
el.scrollTo({
|
|
10671
|
+
top: e.key === 'Home' ? 0 : el.scrollHeight,
|
|
10672
|
+
behavior: 'smooth'
|
|
10673
|
+
});
|
|
10674
|
+
}
|
|
10675
|
+
await finishScrolling();
|
|
10676
|
+
const children = el.querySelectorAll(':scope > :not(.v-virtual-scroll__spacer)');
|
|
10677
|
+
if (e.key === 'PageDown' || e.key === 'Home') {
|
|
10678
|
+
const top = el.getBoundingClientRect().top;
|
|
10679
|
+
for (const child of children) {
|
|
10680
|
+
if (child.getBoundingClientRect().top >= top) {
|
|
10681
|
+
child.focus();
|
|
10682
|
+
break;
|
|
10683
|
+
}
|
|
10684
|
+
}
|
|
10685
|
+
} else {
|
|
10686
|
+
const bottom = el.getBoundingClientRect().bottom;
|
|
10687
|
+
for (const child of [...children].reverse()) {
|
|
10688
|
+
if (child.getBoundingClientRect().bottom <= bottom) {
|
|
10689
|
+
child.focus();
|
|
10690
|
+
break;
|
|
10691
|
+
}
|
|
10692
|
+
}
|
|
10693
|
+
}
|
|
10694
|
+
}
|
|
10695
|
+
return {
|
|
10696
|
+
onListScroll,
|
|
10697
|
+
onListKeydown
|
|
10698
|
+
};
|
|
10699
|
+
}
|
|
10700
|
+
|
|
10701
|
+
// Types
|
|
10702
|
+
|
|
10386
10703
|
const makeSelectProps = propsFactory({
|
|
10387
10704
|
chips: Boolean,
|
|
10388
10705
|
closableChips: Boolean,
|
|
@@ -10474,6 +10791,10 @@ const VSelect = genericComponent()({
|
|
|
10474
10791
|
});
|
|
10475
10792
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
10476
10793
|
const listRef = ref();
|
|
10794
|
+
const {
|
|
10795
|
+
onListScroll,
|
|
10796
|
+
onListKeydown
|
|
10797
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
10477
10798
|
function onClear(e) {
|
|
10478
10799
|
if (props.openOnClear) {
|
|
10479
10800
|
menu.value = true;
|
|
@@ -10520,11 +10841,6 @@ const VSelect = genericComponent()({
|
|
|
10520
10841
|
model.value = [item];
|
|
10521
10842
|
}
|
|
10522
10843
|
}
|
|
10523
|
-
function onListKeydown(e) {
|
|
10524
|
-
if (e.key === 'Tab') {
|
|
10525
|
-
vTextFieldRef.value?.focus();
|
|
10526
|
-
}
|
|
10527
|
-
}
|
|
10528
10844
|
function select(item) {
|
|
10529
10845
|
if (props.multiple) {
|
|
10530
10846
|
const index = selected.value.findIndex(selection => props.valueComparator(selection, item.value));
|
|
@@ -10607,34 +10923,46 @@ const VSelect = genericComponent()({
|
|
|
10607
10923
|
"onMousedown": e => e.preventDefault(),
|
|
10608
10924
|
"onKeydown": onListKeydown,
|
|
10609
10925
|
"onFocusin": onFocusin,
|
|
10926
|
+
"onScrollPassive": onListScroll,
|
|
10610
10927
|
"tabindex": "-1"
|
|
10611
10928
|
}, {
|
|
10612
10929
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
10613
10930
|
"title": t(props.noDataText)
|
|
10614
|
-
}, null)),
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10931
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
10932
|
+
"renderless": true,
|
|
10933
|
+
"items": displayItems.value
|
|
10934
|
+
}, {
|
|
10935
|
+
default: _ref2 => {
|
|
10936
|
+
let {
|
|
10937
|
+
item,
|
|
10938
|
+
index,
|
|
10939
|
+
itemRef
|
|
10940
|
+
} = _ref2;
|
|
10941
|
+
const itemProps = mergeProps(item.props, {
|
|
10942
|
+
ref: itemRef,
|
|
10943
|
+
key: index,
|
|
10944
|
+
onClick: () => select(item)
|
|
10945
|
+
});
|
|
10946
|
+
return slots.item?.({
|
|
10947
|
+
item,
|
|
10948
|
+
index,
|
|
10949
|
+
props: itemProps
|
|
10950
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
10951
|
+
prepend: _ref3 => {
|
|
10952
|
+
let {
|
|
10953
|
+
isSelected
|
|
10954
|
+
} = _ref3;
|
|
10955
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
10956
|
+
"key": item.value,
|
|
10957
|
+
"modelValue": isSelected,
|
|
10958
|
+
"ripple": false,
|
|
10959
|
+
"tabindex": "-1"
|
|
10960
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
10961
|
+
"icon": item.props.prependIcon
|
|
10962
|
+
}, null)]);
|
|
10963
|
+
}
|
|
10964
|
+
});
|
|
10965
|
+
}
|
|
10638
10966
|
}), slots['append-item']?.()]
|
|
10639
10967
|
})]
|
|
10640
10968
|
}), selections.value.map((item, index) => {
|
|
@@ -10772,14 +11100,12 @@ function filterItems(items, query, options) {
|
|
|
10772
11100
|
return array;
|
|
10773
11101
|
}
|
|
10774
11102
|
function useFilter(props, items, query, options) {
|
|
10775
|
-
const strQuery = computed(() => typeof query?.value !== 'string' && typeof query?.value !== 'number' ? '' : String(query.value));
|
|
10776
11103
|
const filteredItems = ref([]);
|
|
10777
11104
|
const filteredMatches = ref(new Map());
|
|
10778
11105
|
const transformedItems = computed(() => options?.transform ? unref(items).map(options?.transform) : unref(items));
|
|
10779
11106
|
watchEffect(() => {
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
const results = filterItems(transformedItems.value, strQuery.value, {
|
|
11107
|
+
const strQuery = typeof toValue(query) !== 'string' && typeof toValue(query) !== 'number' ? '' : String(toValue(query));
|
|
11108
|
+
const results = filterItems(transformedItems.value, strQuery, {
|
|
10783
11109
|
customKeyFilter: props.customKeyFilter,
|
|
10784
11110
|
default: props.customFilter,
|
|
10785
11111
|
filterKeys: props.filterKeys,
|
|
@@ -10787,15 +11113,19 @@ function useFilter(props, items, query, options) {
|
|
|
10787
11113
|
noFilter: props.noFilter
|
|
10788
11114
|
});
|
|
10789
11115
|
const originalItems = unref(items);
|
|
11116
|
+
const _filteredItems = [];
|
|
11117
|
+
const _filteredMatches = new Map();
|
|
10790
11118
|
results.forEach(_ref => {
|
|
10791
11119
|
let {
|
|
10792
11120
|
index,
|
|
10793
11121
|
matches
|
|
10794
11122
|
} = _ref;
|
|
10795
11123
|
const item = originalItems[index];
|
|
10796
|
-
|
|
10797
|
-
|
|
11124
|
+
_filteredItems.push(item);
|
|
11125
|
+
_filteredMatches.set(item.value, matches);
|
|
10798
11126
|
});
|
|
11127
|
+
filteredItems.value = _filteredItems;
|
|
11128
|
+
filteredMatches.value = _filteredMatches;
|
|
10799
11129
|
});
|
|
10800
11130
|
function getMatches(item) {
|
|
10801
11131
|
return filteredMatches.value.get(item.value);
|
|
@@ -10885,7 +11215,7 @@ const VAutocomplete = genericComponent()({
|
|
|
10885
11215
|
const {
|
|
10886
11216
|
filteredItems,
|
|
10887
11217
|
getMatches
|
|
10888
|
-
} = useFilter(props, items,
|
|
11218
|
+
} = useFilter(props, items, () => isPristine.value ? '' : search.value);
|
|
10889
11219
|
const selections = computed(() => {
|
|
10890
11220
|
return model.value.map(v => {
|
|
10891
11221
|
return items.value.find(item => props.valueComparator(item.value, v.value)) || v;
|
|
@@ -10905,6 +11235,10 @@ const VAutocomplete = genericComponent()({
|
|
|
10905
11235
|
});
|
|
10906
11236
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
10907
11237
|
const listRef = ref();
|
|
11238
|
+
const {
|
|
11239
|
+
onListScroll,
|
|
11240
|
+
onListKeydown
|
|
11241
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
10908
11242
|
function onClear(e) {
|
|
10909
11243
|
if (props.openOnClear) {
|
|
10910
11244
|
menu.value = true;
|
|
@@ -10978,11 +11312,6 @@ const VAutocomplete = genericComponent()({
|
|
|
10978
11312
|
}
|
|
10979
11313
|
}
|
|
10980
11314
|
}
|
|
10981
|
-
function onListKeydown(e) {
|
|
10982
|
-
if (e.key === 'Tab') {
|
|
10983
|
-
vTextFieldRef.value?.focus();
|
|
10984
|
-
}
|
|
10985
|
-
}
|
|
10986
11315
|
function onInput(e) {
|
|
10987
11316
|
search.value = e.target.value;
|
|
10988
11317
|
}
|
|
@@ -11101,38 +11430,50 @@ const VAutocomplete = genericComponent()({
|
|
|
11101
11430
|
"onKeydown": onListKeydown,
|
|
11102
11431
|
"onFocusin": onFocusin,
|
|
11103
11432
|
"onFocusout": onFocusout,
|
|
11433
|
+
"onScrollPassive": onListScroll,
|
|
11104
11434
|
"tabindex": "-1"
|
|
11105
11435
|
}, {
|
|
11106
11436
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
11107
11437
|
"title": t(props.noDataText)
|
|
11108
|
-
}, null)),
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11438
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
11439
|
+
"renderless": true,
|
|
11440
|
+
"items": displayItems.value
|
|
11441
|
+
}, {
|
|
11442
|
+
default: _ref3 => {
|
|
11443
|
+
let {
|
|
11444
|
+
item,
|
|
11445
|
+
index,
|
|
11446
|
+
itemRef
|
|
11447
|
+
} = _ref3;
|
|
11448
|
+
const itemProps = mergeProps(item.props, {
|
|
11449
|
+
ref: itemRef,
|
|
11450
|
+
key: index,
|
|
11451
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
|
11452
|
+
onClick: () => select(item)
|
|
11453
|
+
});
|
|
11454
|
+
return slots.item?.({
|
|
11455
|
+
item,
|
|
11456
|
+
index,
|
|
11457
|
+
props: itemProps
|
|
11458
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
11459
|
+
prepend: _ref4 => {
|
|
11460
|
+
let {
|
|
11461
|
+
isSelected
|
|
11462
|
+
} = _ref4;
|
|
11463
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
11464
|
+
"key": item.value,
|
|
11465
|
+
"modelValue": isSelected,
|
|
11466
|
+
"ripple": false,
|
|
11467
|
+
"tabindex": "-1"
|
|
11468
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
11469
|
+
"icon": item.props.prependIcon
|
|
11470
|
+
}, null)]);
|
|
11471
|
+
},
|
|
11472
|
+
title: () => {
|
|
11473
|
+
return isPristine.value ? item.title : highlightResult$1(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
|
11474
|
+
}
|
|
11475
|
+
});
|
|
11476
|
+
}
|
|
11136
11477
|
}), slots['append-item']?.()]
|
|
11137
11478
|
})]
|
|
11138
11479
|
}), selections.value.map((item, index) => {
|
|
@@ -14426,7 +14767,7 @@ const VCombobox = genericComponent()({
|
|
|
14426
14767
|
const {
|
|
14427
14768
|
filteredItems,
|
|
14428
14769
|
getMatches
|
|
14429
|
-
} = useFilter(props, items,
|
|
14770
|
+
} = useFilter(props, items, () => isPristine.value ? '' : search.value);
|
|
14430
14771
|
const selections = computed(() => {
|
|
14431
14772
|
return model.value.map(v => {
|
|
14432
14773
|
return items.value.find(item => props.valueComparator(item.value, v.value)) || v;
|
|
@@ -14446,6 +14787,10 @@ const VCombobox = genericComponent()({
|
|
|
14446
14787
|
});
|
|
14447
14788
|
const menuDisabled = computed(() => props.hideNoData && !items.value.length || props.readonly || form?.isReadonly.value);
|
|
14448
14789
|
const listRef = ref();
|
|
14790
|
+
const {
|
|
14791
|
+
onListScroll,
|
|
14792
|
+
onListKeydown
|
|
14793
|
+
} = useScrolling(listRef, vTextFieldRef);
|
|
14449
14794
|
function onClear(e) {
|
|
14450
14795
|
cleared = true;
|
|
14451
14796
|
if (props.openOnClear) {
|
|
@@ -14523,11 +14868,6 @@ const VCombobox = genericComponent()({
|
|
|
14523
14868
|
search.value = '';
|
|
14524
14869
|
}
|
|
14525
14870
|
}
|
|
14526
|
-
function onListKeydown(e) {
|
|
14527
|
-
if (e.key === 'Tab') {
|
|
14528
|
-
vTextFieldRef.value?.focus();
|
|
14529
|
-
}
|
|
14530
|
-
}
|
|
14531
14871
|
function onAfterLeave() {
|
|
14532
14872
|
if (isFocused.value) {
|
|
14533
14873
|
isPristine.value = true;
|
|
@@ -14638,38 +14978,50 @@ const VCombobox = genericComponent()({
|
|
|
14638
14978
|
"onKeydown": onListKeydown,
|
|
14639
14979
|
"onFocusin": onFocusin,
|
|
14640
14980
|
"onFocusout": onFocusout,
|
|
14981
|
+
"onScrollPassive": onListScroll,
|
|
14641
14982
|
"tabindex": "-1"
|
|
14642
14983
|
}, {
|
|
14643
14984
|
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? createVNode(VListItem, {
|
|
14644
14985
|
"title": t(props.noDataText)
|
|
14645
|
-
}, null)),
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14986
|
+
}, null)), createVNode(VVirtualScroll, {
|
|
14987
|
+
"renderless": true,
|
|
14988
|
+
"items": displayItems.value
|
|
14989
|
+
}, {
|
|
14990
|
+
default: _ref3 => {
|
|
14991
|
+
let {
|
|
14992
|
+
item,
|
|
14993
|
+
index,
|
|
14994
|
+
itemRef
|
|
14995
|
+
} = _ref3;
|
|
14996
|
+
const itemProps = mergeProps(item.props, {
|
|
14997
|
+
ref: itemRef,
|
|
14998
|
+
key: index,
|
|
14999
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
|
15000
|
+
onClick: () => select(item)
|
|
15001
|
+
});
|
|
15002
|
+
return slots.item?.({
|
|
15003
|
+
item,
|
|
15004
|
+
index,
|
|
15005
|
+
props: itemProps
|
|
15006
|
+
}) ?? createVNode(VListItem, itemProps, {
|
|
15007
|
+
prepend: _ref4 => {
|
|
15008
|
+
let {
|
|
15009
|
+
isSelected
|
|
15010
|
+
} = _ref4;
|
|
15011
|
+
return createVNode(Fragment, null, [props.multiple && !props.hideSelected ? createVNode(VCheckboxBtn, {
|
|
15012
|
+
"key": item.value,
|
|
15013
|
+
"modelValue": isSelected,
|
|
15014
|
+
"ripple": false,
|
|
15015
|
+
"tabindex": "-1"
|
|
15016
|
+
}, null) : undefined, item.props.prependIcon && createVNode(VIcon, {
|
|
15017
|
+
"icon": item.props.prependIcon
|
|
15018
|
+
}, null)]);
|
|
15019
|
+
},
|
|
15020
|
+
title: () => {
|
|
15021
|
+
return isPristine.value ? item.title : highlightResult(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
|
15022
|
+
}
|
|
15023
|
+
});
|
|
15024
|
+
}
|
|
14673
15025
|
}), slots['append-item']?.()]
|
|
14674
15026
|
})]
|
|
14675
15027
|
}), selections.value.map((item, index) => {
|
|
@@ -19013,215 +19365,6 @@ const VValidation = genericComponent()({
|
|
|
19013
19365
|
}
|
|
19014
19366
|
});
|
|
19015
19367
|
|
|
19016
|
-
const makeVVirtualScrollItemProps = propsFactory({
|
|
19017
|
-
dynamicHeight: Boolean,
|
|
19018
|
-
renderless: Boolean,
|
|
19019
|
-
...makeComponentProps()
|
|
19020
|
-
}, 'VVirtualScrollItem');
|
|
19021
|
-
const VVirtualScrollItem = genericComponent()({
|
|
19022
|
-
name: 'VVirtualScrollItem',
|
|
19023
|
-
props: makeVVirtualScrollItemProps(),
|
|
19024
|
-
emits: {
|
|
19025
|
-
'update:height': height => true
|
|
19026
|
-
},
|
|
19027
|
-
setup(props, _ref) {
|
|
19028
|
-
let {
|
|
19029
|
-
emit,
|
|
19030
|
-
slots
|
|
19031
|
-
} = _ref;
|
|
19032
|
-
const {
|
|
19033
|
-
resizeRef,
|
|
19034
|
-
contentRect
|
|
19035
|
-
} = useResizeObserver();
|
|
19036
|
-
useToggleScope(() => props.dynamicHeight, () => {
|
|
19037
|
-
watch(() => contentRect.value?.height, height => {
|
|
19038
|
-
if (height != null) emit('update:height', height);
|
|
19039
|
-
});
|
|
19040
|
-
});
|
|
19041
|
-
function updateHeight() {
|
|
19042
|
-
if (props.dynamicHeight && contentRect.value) {
|
|
19043
|
-
emit('update:height', contentRect.value.height);
|
|
19044
|
-
}
|
|
19045
|
-
}
|
|
19046
|
-
onUpdated(updateHeight);
|
|
19047
|
-
useRender(() => props.renderless ? createVNode(Fragment, null, [slots.default?.({
|
|
19048
|
-
props: {
|
|
19049
|
-
ref: props.dynamicHeight ? resizeRef : undefined
|
|
19050
|
-
}
|
|
19051
|
-
})]) : createVNode("div", {
|
|
19052
|
-
"ref": props.dynamicHeight ? resizeRef : undefined,
|
|
19053
|
-
"class": ['v-virtual-scroll__item', props.class],
|
|
19054
|
-
"style": props.style
|
|
19055
|
-
}, [slots.default?.()]));
|
|
19056
|
-
}
|
|
19057
|
-
});
|
|
19058
|
-
|
|
19059
|
-
// Composables
|
|
19060
|
-
|
|
19061
|
-
// Types
|
|
19062
|
-
|
|
19063
|
-
const UP = -1;
|
|
19064
|
-
const DOWN = 1;
|
|
19065
|
-
const makeVirtualProps = propsFactory({
|
|
19066
|
-
itemHeight: [Number, String]
|
|
19067
|
-
}, 'virtual');
|
|
19068
|
-
function useVirtual(props, items, offset) {
|
|
19069
|
-
const first = shallowRef(0);
|
|
19070
|
-
const baseItemHeight = shallowRef(props.itemHeight);
|
|
19071
|
-
const itemHeight = computed({
|
|
19072
|
-
get: () => parseInt(baseItemHeight.value ?? 0, 10),
|
|
19073
|
-
set(val) {
|
|
19074
|
-
baseItemHeight.value = val;
|
|
19075
|
-
}
|
|
19076
|
-
});
|
|
19077
|
-
const containerRef = ref();
|
|
19078
|
-
const {
|
|
19079
|
-
resizeRef,
|
|
19080
|
-
contentRect
|
|
19081
|
-
} = useResizeObserver();
|
|
19082
|
-
watchEffect(() => {
|
|
19083
|
-
resizeRef.value = containerRef.value;
|
|
19084
|
-
});
|
|
19085
|
-
const display = useDisplay();
|
|
19086
|
-
const sizeMap = new Map();
|
|
19087
|
-
let sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
19088
|
-
const visibleItems = computed(() => {
|
|
19089
|
-
const height = (contentRect.value?.height ?? display.height.value) - (offset?.value ?? 0);
|
|
19090
|
-
return itemHeight.value ? Math.max(12, Math.ceil(height / itemHeight.value * 1.7 + 1)) : 12;
|
|
19091
|
-
});
|
|
19092
|
-
function handleItemResize(index, height) {
|
|
19093
|
-
itemHeight.value = Math.max(itemHeight.value, height);
|
|
19094
|
-
sizes[index] = height;
|
|
19095
|
-
sizeMap.set(items.value[index], height);
|
|
19096
|
-
}
|
|
19097
|
-
function calculateOffset(index) {
|
|
19098
|
-
return sizes.slice(0, index).reduce((curr, value) => curr + (value || itemHeight.value), 0);
|
|
19099
|
-
}
|
|
19100
|
-
function calculateMidPointIndex(scrollTop) {
|
|
19101
|
-
const end = items.value.length;
|
|
19102
|
-
let middle = 0;
|
|
19103
|
-
let middleOffset = 0;
|
|
19104
|
-
while (middleOffset < scrollTop && middle < end) {
|
|
19105
|
-
middleOffset += sizes[middle++] || itemHeight.value;
|
|
19106
|
-
}
|
|
19107
|
-
return middle - 1;
|
|
19108
|
-
}
|
|
19109
|
-
let lastScrollTop = 0;
|
|
19110
|
-
function handleScroll() {
|
|
19111
|
-
if (!containerRef.value || !contentRect.value) return;
|
|
19112
|
-
const height = contentRect.value.height - 56;
|
|
19113
|
-
const scrollTop = containerRef.value.scrollTop;
|
|
19114
|
-
const direction = scrollTop < lastScrollTop ? UP : DOWN;
|
|
19115
|
-
const midPointIndex = calculateMidPointIndex(scrollTop + height / 2);
|
|
19116
|
-
const buffer = Math.round(visibleItems.value / 3);
|
|
19117
|
-
const firstIndex = midPointIndex - buffer;
|
|
19118
|
-
const lastIndex = first.value + buffer * 2 - 1;
|
|
19119
|
-
if (direction === UP && midPointIndex <= lastIndex) {
|
|
19120
|
-
first.value = clamp(firstIndex, 0, items.value.length);
|
|
19121
|
-
} else if (direction === DOWN && midPointIndex >= lastIndex) {
|
|
19122
|
-
first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value);
|
|
19123
|
-
}
|
|
19124
|
-
lastScrollTop = scrollTop;
|
|
19125
|
-
}
|
|
19126
|
-
function scrollToIndex(index) {
|
|
19127
|
-
if (!containerRef.value) return;
|
|
19128
|
-
const offset = calculateOffset(index);
|
|
19129
|
-
containerRef.value.scrollTop = offset;
|
|
19130
|
-
}
|
|
19131
|
-
const allItems = computed(() => items.value.map((item, index) => ({
|
|
19132
|
-
raw: item,
|
|
19133
|
-
index
|
|
19134
|
-
})));
|
|
19135
|
-
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
19136
|
-
const computedItems = computed(() => allItems.value.slice(first.value, last.value));
|
|
19137
|
-
const paddingTop = computed(() => calculateOffset(first.value));
|
|
19138
|
-
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
19139
|
-
onMounted(() => {
|
|
19140
|
-
if (!itemHeight.value) {
|
|
19141
|
-
// If itemHeight prop is not set, then calculate an estimated height from the average of inital items
|
|
19142
|
-
itemHeight.value = sizes.slice(first.value, last.value).reduce((curr, height) => curr + height, 0) / visibleItems.value;
|
|
19143
|
-
}
|
|
19144
|
-
});
|
|
19145
|
-
watch(() => items.value.length, () => {
|
|
19146
|
-
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
19147
|
-
sizeMap.forEach((height, item) => {
|
|
19148
|
-
const index = items.value.indexOf(item);
|
|
19149
|
-
if (index === -1) {
|
|
19150
|
-
sizeMap.delete(item);
|
|
19151
|
-
} else {
|
|
19152
|
-
sizes[index] = height;
|
|
19153
|
-
}
|
|
19154
|
-
});
|
|
19155
|
-
});
|
|
19156
|
-
return {
|
|
19157
|
-
containerRef,
|
|
19158
|
-
computedItems,
|
|
19159
|
-
itemHeight,
|
|
19160
|
-
paddingTop,
|
|
19161
|
-
paddingBottom,
|
|
19162
|
-
scrollToIndex,
|
|
19163
|
-
handleScroll,
|
|
19164
|
-
handleItemResize
|
|
19165
|
-
};
|
|
19166
|
-
}
|
|
19167
|
-
|
|
19168
|
-
// Types
|
|
19169
|
-
|
|
19170
|
-
const makeVVirtualScrollProps = propsFactory({
|
|
19171
|
-
items: {
|
|
19172
|
-
type: Array,
|
|
19173
|
-
default: () => []
|
|
19174
|
-
},
|
|
19175
|
-
...makeVirtualProps(),
|
|
19176
|
-
...makeComponentProps(),
|
|
19177
|
-
...makeDimensionProps()
|
|
19178
|
-
}, 'VVirtualScroll');
|
|
19179
|
-
const VVirtualScroll = genericComponent()({
|
|
19180
|
-
name: 'VVirtualScroll',
|
|
19181
|
-
props: makeVVirtualScrollProps(),
|
|
19182
|
-
setup(props, _ref) {
|
|
19183
|
-
let {
|
|
19184
|
-
slots
|
|
19185
|
-
} = _ref;
|
|
19186
|
-
const {
|
|
19187
|
-
dimensionStyles
|
|
19188
|
-
} = useDimension(props);
|
|
19189
|
-
const {
|
|
19190
|
-
containerRef,
|
|
19191
|
-
handleScroll,
|
|
19192
|
-
handleItemResize,
|
|
19193
|
-
scrollToIndex,
|
|
19194
|
-
paddingTop,
|
|
19195
|
-
paddingBottom,
|
|
19196
|
-
computedItems
|
|
19197
|
-
} = useVirtual(props, toRef(props, 'items'));
|
|
19198
|
-
useRender(() => createVNode("div", {
|
|
19199
|
-
"ref": containerRef,
|
|
19200
|
-
"class": ['v-virtual-scroll', props.class],
|
|
19201
|
-
"onScroll": handleScroll,
|
|
19202
|
-
"style": [dimensionStyles.value, props.style]
|
|
19203
|
-
}, [createVNode("div", {
|
|
19204
|
-
"class": "v-virtual-scroll__container",
|
|
19205
|
-
"style": {
|
|
19206
|
-
paddingTop: convertToUnit(paddingTop.value),
|
|
19207
|
-
paddingBottom: convertToUnit(paddingBottom.value)
|
|
19208
|
-
}
|
|
19209
|
-
}, [computedItems.value.map(item => createVNode(VVirtualScrollItem, {
|
|
19210
|
-
"key": item.index,
|
|
19211
|
-
"dynamicHeight": !props.itemHeight,
|
|
19212
|
-
"onUpdate:height": height => handleItemResize(item.index, height)
|
|
19213
|
-
}, {
|
|
19214
|
-
default: () => [slots.default?.({
|
|
19215
|
-
item: item.raw,
|
|
19216
|
-
index: item.index
|
|
19217
|
-
})]
|
|
19218
|
-
}))])]));
|
|
19219
|
-
return {
|
|
19220
|
-
scrollToIndex
|
|
19221
|
-
};
|
|
19222
|
-
}
|
|
19223
|
-
});
|
|
19224
|
-
|
|
19225
19368
|
// Types
|
|
19226
19369
|
|
|
19227
19370
|
const makeVBottomSheetProps = propsFactory({
|
|
@@ -20340,7 +20483,11 @@ function createHeaders(props, options) {
|
|
|
20340
20483
|
column,
|
|
20341
20484
|
row
|
|
20342
20485
|
} = _ref4;
|
|
20343
|
-
|
|
20486
|
+
let key = column.key;
|
|
20487
|
+
if (key == null) {
|
|
20488
|
+
consoleWarn('The header key value must not be null or undefined');
|
|
20489
|
+
key = '';
|
|
20490
|
+
}
|
|
20344
20491
|
for (let i = row; i <= row + (column.rowspan ?? 1) - 1; i++) {
|
|
20345
20492
|
fixedRows[i].push({
|
|
20346
20493
|
...column,
|
|
@@ -21205,19 +21352,21 @@ const VDataTableVirtual = genericComponent()({
|
|
|
21205
21352
|
...slots,
|
|
21206
21353
|
item: itemSlotProps => createVNode(VVirtualScrollItem, {
|
|
21207
21354
|
"key": itemSlotProps.item.index,
|
|
21208
|
-
"dynamicHeight": true,
|
|
21209
21355
|
"renderless": true,
|
|
21210
21356
|
"onUpdate:height": height => handleItemResize(itemSlotProps.item.index, height)
|
|
21211
21357
|
}, {
|
|
21212
|
-
default:
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
|
|
21358
|
+
default: _ref2 => {
|
|
21359
|
+
let {
|
|
21360
|
+
itemRef
|
|
21361
|
+
} = _ref2;
|
|
21362
|
+
return slots.item?.({
|
|
21363
|
+
...itemSlotProps,
|
|
21364
|
+
itemRef
|
|
21365
|
+
}) ?? createVNode(VDataTableRow, mergeProps(itemSlotProps.props, {
|
|
21366
|
+
"ref": itemRef,
|
|
21367
|
+
"key": itemSlotProps.item.index
|
|
21368
|
+
}), slots);
|
|
21369
|
+
}
|
|
21221
21370
|
})
|
|
21222
21371
|
}), createVNode("tr", {
|
|
21223
21372
|
"style": {
|
|
@@ -23447,7 +23596,7 @@ function createVuetify$1() {
|
|
|
23447
23596
|
date
|
|
23448
23597
|
};
|
|
23449
23598
|
}
|
|
23450
|
-
const version$1 = "3.3.
|
|
23599
|
+
const version$1 = "3.3.7";
|
|
23451
23600
|
createVuetify$1.version = version$1;
|
|
23452
23601
|
|
|
23453
23602
|
// Vue's inject() can only be used in setup
|
|
@@ -23461,7 +23610,7 @@ function inject(key) {
|
|
|
23461
23610
|
|
|
23462
23611
|
/* eslint-disable local-rules/sort-imports */
|
|
23463
23612
|
|
|
23464
|
-
const version = "3.3.
|
|
23613
|
+
const version = "3.3.7";
|
|
23465
23614
|
|
|
23466
23615
|
/* eslint-disable local-rules/sort-imports */
|
|
23467
23616
|
|