pxd 0.1.6 → 0.1.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/components/backtop/index.d.vue.ts +1 -1
- package/dist/components/bubble/index.d.vue.ts +1 -1
- package/dist/components/bubble-group/index.d.vue.ts +10 -3
- package/dist/components/bubble-group/index.vue +23 -3
- package/dist/components/bubble-group/types.d.ts +1 -0
- package/dist/components/checkbox/index.vue +1 -1
- package/dist/components/choicebox-item/index.vue +1 -1
- package/dist/components/code-block/index.vue +3 -3
- package/dist/components/collapse/index.vue +4 -4
- package/dist/components/date-picker/index.d.vue.ts +11 -1
- package/dist/components/date-picker/index.vue +4 -2
- package/dist/components/link-button/index.d.vue.ts +1 -1
- package/dist/components/list/index.d.vue.ts +1 -1
- package/dist/components/marching-ants/index.d.vue.ts +1 -1
- package/dist/components/marquee/index.d.vue.ts +3 -3
- package/dist/components/mention/index.d.vue.ts +3 -1
- package/dist/components/mention/index.vue +4 -0
- package/dist/components/menu/index.d.vue.ts +3 -1
- package/dist/components/menu/index.vue +4 -0
- package/dist/components/message/index.d.vue.ts +1 -1
- package/dist/components/pin-input/index.d.vue.ts +1 -1
- package/dist/components/questionnaire/index.vue +17 -10
- package/dist/components/radio/index.vue +1 -1
- package/dist/components/rating/index.d.vue.ts +1 -1
- package/dist/components/reveal/index.d.vue.ts +1 -1
- package/dist/components/select/index.d.vue.ts +8 -4
- package/dist/components/select/index.vue +13 -6
- package/dist/components/shimmer-text/index.d.vue.ts +1 -1
- package/dist/components/split-button/index.d.vue.ts +3 -1
- package/dist/components/split-button/index.vue +4 -0
- package/dist/components/time-picker/index.d.vue.ts +11 -1
- package/dist/components/time-picker/index.vue +4 -2
- package/dist/components/toc/index.d.vue.ts +4 -1
- package/dist/components/toc/index.vue +65 -8
- package/dist/components/toc/types.d.ts +10 -1
- package/dist/components/tooltip/index.d.vue.ts +1 -1
- package/dist/components/tour/index.d.vue.ts +2 -2
- package/dist/components/tree/index.d.vue.ts +1 -1
- package/dist/components/virtual-list/index.d.vue.ts +1 -0
- package/dist/components/virtual-list/index.vue +2 -1
- package/dist/composables/use-virtual-list.d.ts +20 -0
- package/dist/composables/use-virtual-list.js +30 -9
- package/dist/styles/styles.css +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ type __VLS_Slots = {} & {
|
|
|
11
11
|
item?: (props: typeof __VLS_2) => any;
|
|
12
12
|
};
|
|
13
13
|
declare const __VLS_base: import("vue").DefineComponent<TocProps, {
|
|
14
|
-
activeId: import("vue").ComputedRef<string
|
|
14
|
+
activeId: import("vue").ComputedRef<string>;
|
|
15
15
|
items: import("vue").ComputedRef<TocItem[]>;
|
|
16
16
|
scrollTo: typeof scrollTo;
|
|
17
17
|
update: () => void;
|
|
@@ -22,8 +22,11 @@ declare const __VLS_base: import("vue").DefineComponent<TocProps, {
|
|
|
22
22
|
"onItem-click"?: ((item: TocItem, event: MouseEvent) => any) | undefined;
|
|
23
23
|
"onActive-change"?: ((item: TocItem | null) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
|
+
data: TocItem[] | null;
|
|
26
|
+
source: import("../../composables/use-virtual-list.js").VirtualListScrollSource | null;
|
|
25
27
|
scrollTarget: HTMLElement | null;
|
|
26
28
|
scrollBehavior: ScrollBehavior;
|
|
29
|
+
selector: string;
|
|
27
30
|
offset: number;
|
|
28
31
|
scrollActiveIntoView: boolean;
|
|
29
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -13,18 +13,30 @@ defineOptions({
|
|
|
13
13
|
});
|
|
14
14
|
const INDENT_BASE = 8;
|
|
15
15
|
const INDENT_STEP = 14;
|
|
16
|
+
const BOTTOM_TOLERANCE = 2;
|
|
16
17
|
const ITEM_ACTIVE_CLASS = "pxd-toc--item_active bg-gray-200 text-primary";
|
|
17
18
|
const ITEM_IDLE_CLASS = "text-foreground-secondary hover:bg-gray-100 hover:text-gray-900";
|
|
18
19
|
const props = defineProps({
|
|
20
|
+
data: {
|
|
21
|
+
type: [Array, null],
|
|
22
|
+
required: false,
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
19
25
|
selector: {
|
|
20
26
|
type: String,
|
|
21
|
-
required:
|
|
27
|
+
required: false,
|
|
28
|
+
default: ""
|
|
22
29
|
},
|
|
23
30
|
scrollTarget: {
|
|
24
31
|
type: null,
|
|
25
32
|
required: false,
|
|
26
33
|
default: null
|
|
27
34
|
},
|
|
35
|
+
source: {
|
|
36
|
+
type: [Object, null],
|
|
37
|
+
required: false,
|
|
38
|
+
default: null
|
|
39
|
+
},
|
|
28
40
|
offset: {
|
|
29
41
|
type: Number,
|
|
30
42
|
required: false,
|
|
@@ -46,6 +58,7 @@ const motionReduce = useMotionReduced();
|
|
|
46
58
|
const { attrs, classes } = useTailwindVariant({ base: "pxd-toc text-sm w-full max-w-full" });
|
|
47
59
|
const listEl = ref(null);
|
|
48
60
|
const entries = shallowRef([]);
|
|
61
|
+
const isDataMode = computed(() => props.data != null);
|
|
49
62
|
function outlineRoot() {
|
|
50
63
|
return props.scrollTarget ?? document.body;
|
|
51
64
|
}
|
|
@@ -56,6 +69,12 @@ function isSameOutline(next, current) {
|
|
|
56
69
|
});
|
|
57
70
|
}
|
|
58
71
|
function readOutline() {
|
|
72
|
+
if (isDataMode.value || !props.selector) {
|
|
73
|
+
if (entries.value.length) {
|
|
74
|
+
entries.value = [];
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
59
78
|
const next = Array.from(outlineRoot().querySelectorAll(props.selector)).filter((el) => el.id).map((el) => ({
|
|
60
79
|
el,
|
|
61
80
|
item: {
|
|
@@ -70,12 +89,43 @@ function readOutline() {
|
|
|
70
89
|
entries.value = next;
|
|
71
90
|
}
|
|
72
91
|
const scheduleRead = scheduleByRaf(readOutline);
|
|
73
|
-
const {
|
|
92
|
+
const { activeIndex: spyActiveIndex, update } = useScrollspy(computed(() => isDataMode.value ? [] : entries.value.map((entry) => entry.el)), {
|
|
74
93
|
scrollTarget: () => props.scrollTarget,
|
|
75
94
|
topOffset: () => props.offset
|
|
76
95
|
});
|
|
77
|
-
const items = computed(() => entries.value.map((entry) => entry.item));
|
|
78
|
-
|
|
96
|
+
const items = computed(() => isDataMode.value ? props.data : entries.value.map((entry) => entry.item));
|
|
97
|
+
// Data mode bisects the source's cached offsets instead of DOM rects: the active entry sits at
|
|
98
|
+
// the probe line, where the owning list has it rendered and measured; distant entries may be
|
|
99
|
+
// estimates, which only ever shifts the jump target, never the highlight.
|
|
100
|
+
const activeIndex = computed(() => {
|
|
101
|
+
const source = props.source;
|
|
102
|
+
const count = items.value.length;
|
|
103
|
+
if (!isDataMode.value || !source || !count) {
|
|
104
|
+
return spyActiveIndex.value;
|
|
105
|
+
}
|
|
106
|
+
const scrollOffset = source.getScrollOffset();
|
|
107
|
+
if (scrollOffset == null) {
|
|
108
|
+
return -1;
|
|
109
|
+
}
|
|
110
|
+
const maxScroll = source.getMaxScrollOffset();
|
|
111
|
+
// A short trailing entry can never be scrolled up to the probe line.
|
|
112
|
+
if (maxScroll > 1 && scrollOffset >= maxScroll - BOTTOM_TOLERANCE) {
|
|
113
|
+
return count - 1;
|
|
114
|
+
}
|
|
115
|
+
let low = 0;
|
|
116
|
+
let high = count;
|
|
117
|
+
while (low < high) {
|
|
118
|
+
const mid = low + high >> 1;
|
|
119
|
+
const start = source.getOffsetForIndex(mid);
|
|
120
|
+
if (start == null || start - props.offset > scrollOffset) {
|
|
121
|
+
high = mid;
|
|
122
|
+
} else {
|
|
123
|
+
low = mid + 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return Math.max(low - 1, 0);
|
|
127
|
+
});
|
|
128
|
+
const activeId = computed(() => items.value[activeIndex.value]?.id ?? null);
|
|
79
129
|
const tocItems = computed(() => {
|
|
80
130
|
if (!items.value.length) {
|
|
81
131
|
return [];
|
|
@@ -88,8 +138,6 @@ const tocItems = computed(() => {
|
|
|
88
138
|
depth: item.level - minLevel
|
|
89
139
|
}));
|
|
90
140
|
});
|
|
91
|
-
// Indexed by the outline, not the spy's targets, so a dropped element can't shift later rows.
|
|
92
|
-
const activeRowIndex = computed(() => items.value.findIndex((item) => item.id === activeId.value));
|
|
93
141
|
function getScrollTop(target, container) {
|
|
94
142
|
const top = target.getBoundingClientRect().top;
|
|
95
143
|
if (isViewportScroll(container)) {
|
|
@@ -98,6 +146,11 @@ function getScrollTop(target, container) {
|
|
|
98
146
|
return top - container.getBoundingClientRect().top + container.scrollTop - props.offset;
|
|
99
147
|
}
|
|
100
148
|
function scrollTo(id) {
|
|
149
|
+
const index = items.value.findIndex((item) => item.id === id);
|
|
150
|
+
if (index >= 0 && isDataMode.value && props.source) {
|
|
151
|
+
props.source.scrollToIndex(index, { behavior: resolveScrollBehavior(props.scrollBehavior, motionReduce) });
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
101
154
|
const target = document.getElementById(id);
|
|
102
155
|
if (!target) {
|
|
103
156
|
return false;
|
|
@@ -121,7 +174,7 @@ function onItemClick(item, event) {
|
|
|
121
174
|
}
|
|
122
175
|
function keepActiveVisible() {
|
|
123
176
|
const list = listEl.value;
|
|
124
|
-
const index =
|
|
177
|
+
const index = activeIndex.value;
|
|
125
178
|
if (!props.scrollActiveIntoView || !list || index < 0) {
|
|
126
179
|
return;
|
|
127
180
|
}
|
|
@@ -145,7 +198,11 @@ if (!isServer()) {
|
|
|
145
198
|
attributes: true,
|
|
146
199
|
attributeFilter: ["id"]
|
|
147
200
|
});
|
|
148
|
-
watch(() => [
|
|
201
|
+
watch(() => [
|
|
202
|
+
props.selector,
|
|
203
|
+
props.scrollTarget,
|
|
204
|
+
props.data
|
|
205
|
+
], scheduleRead, {
|
|
149
206
|
immediate: true,
|
|
150
207
|
flush: "post"
|
|
151
208
|
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
VirtualListScrollSource,
|
|
3
|
+
VirtualListScrollToOptions,
|
|
4
|
+
} from '../../composables/use-virtual-list'
|
|
5
|
+
|
|
1
6
|
export interface TocItem {
|
|
2
7
|
/** `id` of the heading element this entry scrolls to. */
|
|
3
8
|
id: string
|
|
@@ -8,10 +13,14 @@ export interface TocItem {
|
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
export interface TocProps {
|
|
16
|
+
/** Outline entries as data, for lists that do not keep every entry in the DOM; overrides `selector`. */
|
|
17
|
+
data?: TocItem[] | null
|
|
11
18
|
/** Headings that make up the outline, as a CSS selector. */
|
|
12
|
-
selector
|
|
19
|
+
selector?: string
|
|
13
20
|
/** Scrollable container holding the headings; leave empty to read the document. */
|
|
14
21
|
scrollTarget?: HTMLElement | null
|
|
22
|
+
/** Position and scroll source for a data-driven outline; without it the outline renders without tracking. */
|
|
23
|
+
source?: VirtualListScrollSource | null
|
|
15
24
|
/** Pixels kept above the heading when scrolling to it, and the spy probe line. */
|
|
16
25
|
offset?: number
|
|
17
26
|
/** Scroll animation when an entry is activated; `auto` follows the system motion preference. */
|
|
@@ -9,7 +9,7 @@ type __VLS_Slots = {} & {
|
|
|
9
9
|
content?: (props: typeof __VLS_10) => any;
|
|
10
10
|
};
|
|
11
11
|
declare const __VLS_base: import("vue").DefineComponent<TooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TooltipProps> & Readonly<{}>, {
|
|
12
|
-
variant: "default" | "
|
|
12
|
+
variant: "default" | "inverted" | "error" | "warning" | "success" | "violet";
|
|
13
13
|
position: import("../../types/shared/props.js").ComponentPosition;
|
|
14
14
|
showDelay: number;
|
|
15
15
|
hideDelay: number;
|
|
@@ -9,15 +9,15 @@ declare const __VLS_export: import("vue").DefineComponent<TourProps, {
|
|
|
9
9
|
goTo: typeof goToStep;
|
|
10
10
|
close: typeof close;
|
|
11
11
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
-
change: (index: number, step: import("./types").TourStep) => any;
|
|
13
12
|
error: (error: unknown, index: number) => any;
|
|
13
|
+
change: (index: number, step: import("./types").TourStep) => any;
|
|
14
14
|
"update:model-value": (args_0: boolean) => any;
|
|
15
15
|
skip: () => any;
|
|
16
16
|
finish: () => any;
|
|
17
17
|
"update:current": (args_0: number) => any;
|
|
18
18
|
}, string, import("vue").PublicProps, Readonly<TourProps> & Readonly<{
|
|
19
|
-
onChange?: ((index: number, step: import("./types").TourStep) => any) | undefined;
|
|
20
19
|
onError?: ((error: unknown, index: number) => any) | undefined;
|
|
20
|
+
onChange?: ((index: number, step: import("./types").TourStep) => any) | undefined;
|
|
21
21
|
"onUpdate:model-value"?: ((args_0: boolean) => any) | undefined;
|
|
22
22
|
onSkip?: (() => any) | undefined;
|
|
23
23
|
onFinish?: (() => any) | undefined;
|
|
@@ -90,9 +90,9 @@ declare const __VLS_base: import("vue").DefineComponent<TreeProps, {
|
|
|
90
90
|
disabled: boolean;
|
|
91
91
|
lazy: boolean;
|
|
92
92
|
itemSize: number;
|
|
93
|
+
virtual: boolean;
|
|
93
94
|
overScan: number;
|
|
94
95
|
multiple: boolean;
|
|
95
|
-
virtual: boolean;
|
|
96
96
|
draggable: boolean;
|
|
97
97
|
searchPlaceholder: string;
|
|
98
98
|
filterable: boolean;
|
|
@@ -13,6 +13,7 @@ declare const __VLS_base: import("vue").DefineComponent<VirtualListProps, {
|
|
|
13
13
|
totalSize: import("vue").ComputedRef<number>;
|
|
14
14
|
virtualItems: import("vue").ComputedRef<VirtualListItem[]>;
|
|
15
15
|
getVirtualizer: () => import("@tanstack/virtual-core").Virtualizer<HTMLElement, HTMLElement>;
|
|
16
|
+
scrollSource: import("../../composables/use-virtual-list.js").VirtualListScrollSource;
|
|
16
17
|
scrollToIndex: (index: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
|
|
17
18
|
scrollToOffset: (toOffset: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
|
|
18
19
|
scrollBy: (delta: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
|
|
@@ -93,7 +93,7 @@ const props = defineProps({
|
|
|
93
93
|
});
|
|
94
94
|
const emits = defineEmits(["retry"]);
|
|
95
95
|
const containerRef = shallowRef();
|
|
96
|
-
const { totalSize, virtualItems, measureElement, getVirtualizer, scrollToIndex, scrollToOffset, scrollBy } = useVirtualList(containerRef, props);
|
|
96
|
+
const { totalSize, virtualItems, measureElement, getVirtualizer, scrollSource, scrollToIndex, scrollToOffset, scrollBy } = useVirtualList(containerRef, props);
|
|
97
97
|
function getItemStyle(virtualItem) {
|
|
98
98
|
const lanes = Math.max(1, Math.floor(props.columnCount));
|
|
99
99
|
const gap = props.columnGap;
|
|
@@ -120,6 +120,7 @@ defineExpose({
|
|
|
120
120
|
totalSize,
|
|
121
121
|
virtualItems,
|
|
122
122
|
getVirtualizer,
|
|
123
|
+
scrollSource,
|
|
123
124
|
scrollToIndex,
|
|
124
125
|
scrollToOffset,
|
|
125
126
|
scrollBy
|
|
@@ -19,6 +19,25 @@ export interface VirtualListOptions {
|
|
|
19
19
|
onBottom?: () => void | Promise<void>;
|
|
20
20
|
bottomThreshold?: number;
|
|
21
21
|
}
|
|
22
|
+
export interface VirtualListScrollToOptions {
|
|
23
|
+
/** Scroll animation for the jump. */
|
|
24
|
+
behavior?: ScrollBehavior;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Position and scroll operations for a data-driven outline. Implementations must read reactive
|
|
28
|
+
* state (e.g. a layout version) inside the getters, so `PToc` re-evaluates tracking whenever the
|
|
29
|
+
* scroll position or item measurements change.
|
|
30
|
+
*/
|
|
31
|
+
export interface VirtualListScrollSource {
|
|
32
|
+
/** Scroll offset that aligns `index` with the top of the viewport, or undefined while unknown. */
|
|
33
|
+
getOffsetForIndex: (index: number) => number | undefined;
|
|
34
|
+
/** Current scroll offset of the container, or null while unavailable. */
|
|
35
|
+
getScrollOffset: () => number | null;
|
|
36
|
+
/** Furthest scroll offset the container can reach. */
|
|
37
|
+
getMaxScrollOffset: () => number;
|
|
38
|
+
/** Scroll `index` to the top of the viewport. */
|
|
39
|
+
scrollToIndex: (index: number, options?: VirtualListScrollToOptions) => void;
|
|
40
|
+
}
|
|
22
41
|
export declare function useVirtualList<Options extends VirtualListOptions>(containerRef: MaybeElementRef<HTMLElement>, options: Options): {
|
|
23
42
|
virtualItems: import("vue").ComputedRef<VirtualListItem[]>;
|
|
24
43
|
totalSize: import("vue").ComputedRef<number>;
|
|
@@ -26,5 +45,6 @@ export declare function useVirtualList<Options extends VirtualListOptions>(conta
|
|
|
26
45
|
scrollToIndex: (index: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
|
|
27
46
|
scrollToOffset: (toOffset: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
|
|
28
47
|
scrollBy: (delta: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
|
|
48
|
+
scrollSource: VirtualListScrollSource;
|
|
29
49
|
getVirtualizer: () => Virtualizer<HTMLElement, HTMLElement>;
|
|
30
50
|
};
|
|
@@ -73,6 +73,28 @@ export function useVirtualList(containerRef, options) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
function refreshMeasurements() {
|
|
77
|
+
void triggerVersion.value;
|
|
78
|
+
virtualizer.getVirtualItems();
|
|
79
|
+
}
|
|
80
|
+
const scrollSource = {
|
|
81
|
+
getOffsetForIndex(index) {
|
|
82
|
+
refreshMeasurements();
|
|
83
|
+
return virtualizer.getOffsetForIndex(index, "start")?.[0];
|
|
84
|
+
},
|
|
85
|
+
getScrollOffset() {
|
|
86
|
+
refreshMeasurements();
|
|
87
|
+
return virtualizer.scrollOffset;
|
|
88
|
+
},
|
|
89
|
+
getMaxScrollOffset() {
|
|
90
|
+
refreshMeasurements();
|
|
91
|
+
return Math.max(virtualizer.getTotalSize() - (virtualizer.scrollRect?.height ?? 0), 0);
|
|
92
|
+
},
|
|
93
|
+
scrollToIndex(index, options2) {
|
|
94
|
+
virtualizer.getVirtualItems();
|
|
95
|
+
virtualizer.scrollToIndex(index, { align: "start", behavior: options2?.behavior });
|
|
96
|
+
}
|
|
97
|
+
};
|
|
76
98
|
const virtualItems = computed(() => {
|
|
77
99
|
void triggerVersion.value;
|
|
78
100
|
if (!getEnabled()) {
|
|
@@ -88,13 +110,13 @@ export function useVirtualList(containerRef, options) {
|
|
|
88
110
|
return virtualizer.getTotalSize();
|
|
89
111
|
});
|
|
90
112
|
function measureElement(el) {
|
|
91
|
-
if (!getEnabled()) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
113
|
if (!el) {
|
|
95
114
|
virtualizer.measureElement(null);
|
|
96
115
|
return;
|
|
97
116
|
}
|
|
117
|
+
if (!getEnabled()) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
98
120
|
const htmlEl = el instanceof HTMLElement ? el : el.$el;
|
|
99
121
|
virtualizer.measureElement(htmlEl);
|
|
100
122
|
}
|
|
@@ -103,12 +125,9 @@ export function useVirtualList(containerRef, options) {
|
|
|
103
125
|
virtualizer.setOptions({
|
|
104
126
|
...virtualizer.options,
|
|
105
127
|
count: enabled ? options.items?.length ?? 0 : 0,
|
|
106
|
-
estimateSize: () => options.itemSize ?? DEFAULTS.itemSize,
|
|
107
|
-
getItemKey,
|
|
108
128
|
overscan: options.overScan ?? DEFAULTS.overScan,
|
|
109
129
|
lanes: options.columnCount ?? DEFAULTS.columnCount,
|
|
110
|
-
gap: options.columnGap ?? DEFAULTS.columnGap
|
|
111
|
-
getScrollElement: () => enabled ? toValue(containerRef) ?? null : null
|
|
130
|
+
gap: options.columnGap ?? DEFAULTS.columnGap
|
|
112
131
|
});
|
|
113
132
|
if (enabled) {
|
|
114
133
|
virtualizer._willUpdate();
|
|
@@ -134,7 +153,9 @@ export function useVirtualList(containerRef, options) {
|
|
|
134
153
|
options.dataKey,
|
|
135
154
|
options.columnCount,
|
|
136
155
|
options.columnGap,
|
|
137
|
-
options.overScan
|
|
156
|
+
options.overScan,
|
|
157
|
+
options.items,
|
|
158
|
+
options.items?.length
|
|
138
159
|
],
|
|
139
160
|
() => {
|
|
140
161
|
if (getEnabled()) {
|
|
@@ -146,7 +167,6 @@ export function useVirtualList(containerRef, options) {
|
|
|
146
167
|
}
|
|
147
168
|
}
|
|
148
169
|
);
|
|
149
|
-
watch(() => [options.items, options.items?.length], updateVirtualizer);
|
|
150
170
|
onMounted(() => {
|
|
151
171
|
if (getEnabled()) {
|
|
152
172
|
mountObservers();
|
|
@@ -181,6 +201,7 @@ export function useVirtualList(containerRef, options) {
|
|
|
181
201
|
scrollToIndex,
|
|
182
202
|
scrollToOffset,
|
|
183
203
|
scrollBy,
|
|
204
|
+
scrollSource,
|
|
184
205
|
getVirtualizer: () => virtualizer
|
|
185
206
|
};
|
|
186
207
|
}
|