@fluentui/react-virtualizer 9.0.0-alpha.9 → 9.0.0-alpha.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +844 -9
- package/dist/index.d.ts +326 -33
- package/lib/Hooks.js +1 -2
- package/lib/Hooks.js.map +1 -1
- package/lib/Utilities.js +1 -0
- package/lib/Utilities.js.map +1 -0
- package/lib/Virtualizer.js +1 -2
- package/lib/Virtualizer.js.map +1 -1
- package/lib/VirtualizerScrollView.js +1 -0
- package/lib/VirtualizerScrollView.js.map +1 -0
- package/lib/VirtualizerScrollViewDynamic.js +1 -0
- package/lib/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/Virtualizer/Virtualizer.js +6 -7
- package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib/components/Virtualizer/Virtualizer.types.js +1 -2
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/index.js +4 -6
- package/lib/components/Virtualizer/index.js.map +1 -1
- package/lib/components/Virtualizer/renderVirtualizer.js +21 -16
- package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +522 -356
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +5 -4
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +12 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib/components/VirtualizerScrollView/index.js +4 -0
- package/lib/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +9 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +80 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +46 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +12 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/index.js +4 -0
- package/lib/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +9 -0
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +152 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +46 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
- package/lib/hooks/hooks.types.js +1 -0
- package/lib/hooks/hooks.types.js.map +1 -0
- package/lib/hooks/index.js +5 -2
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useDynamicPagination.js +126 -0
- package/lib/hooks/useDynamicPagination.js.map +1 -0
- package/lib/hooks/useDynamicVirtualizerMeasure.js +126 -0
- package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
- package/lib/hooks/useIntersectionObserver.js +117 -40
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useMeasureList.js +127 -0
- package/lib/hooks/useMeasureList.js.map +1 -0
- package/lib/hooks/useMutationObserver.js +38 -0
- package/lib/hooks/useMutationObserver.js.map +1 -0
- package/lib/hooks/useResizeObserverRef.js +60 -0
- package/lib/hooks/useResizeObserverRef.js.map +1 -0
- package/lib/hooks/useStaticPagination.js +102 -0
- package/lib/hooks/useStaticPagination.js.map +1 -0
- package/lib/hooks/useVirtualizerMeasure.js +62 -0
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js +32 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js +1 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +45 -0
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
- package/lib/utilities/ImperativeScrolling/index.js +2 -0
- package/lib/utilities/ImperativeScrolling/index.js.map +1 -0
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js +26 -0
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
- package/lib/utilities/VirtualizerContext/index.js +1 -0
- package/lib/utilities/VirtualizerContext/index.js.map +1 -0
- package/lib/utilities/VirtualizerContext/types.js +1 -0
- package/lib/utilities/VirtualizerContext/types.js.map +1 -0
- package/lib/utilities/createResizeObserverFromDocument.js +13 -0
- package/lib/utilities/createResizeObserverFromDocument.js.map +1 -0
- package/lib/utilities/debounce.js +19 -0
- package/lib/utilities/debounce.js.map +1 -0
- package/lib/utilities/index.js +2 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib-commonjs/Hooks.js +31 -5
- package/lib-commonjs/Hooks.js.map +1 -1
- package/lib-commonjs/Utilities.js +28 -0
- package/lib-commonjs/Utilities.js.map +1 -0
- package/lib-commonjs/Virtualizer.js +28 -5
- package/lib-commonjs/Virtualizer.js.map +1 -1
- package/lib-commonjs/VirtualizerScrollView.js +28 -0
- package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/VirtualizerScrollViewDynamic.js +28 -0
- package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/Virtualizer/Virtualizer.js +17 -18
- package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +3 -3
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/index.js +31 -9
- package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +38 -21
- package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +531 -362
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +123 -0
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +21 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +6 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js +31 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +19 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +91 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +70 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +21 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +6 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +31 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +19 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +162 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +70 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
- package/lib-commonjs/hooks/hooks.types.js +6 -0
- package/lib-commonjs/hooks/hooks.types.js.map +1 -0
- package/lib-commonjs/hooks/index.js +35 -5
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicPagination.js +131 -0
- package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -0
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +134 -0
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/hooks/useIntersectionObserver.js +129 -53
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useMeasureList.js +134 -0
- package/lib-commonjs/hooks/useMeasureList.js.map +1 -0
- package/lib-commonjs/hooks/useMutationObserver.js +48 -0
- package/lib-commonjs/hooks/useMutationObserver.js.map +1 -0
- package/lib-commonjs/hooks/useResizeObserverRef.js +69 -0
- package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -0
- package/lib-commonjs/hooks/useStaticPagination.js +107 -0
- package/lib-commonjs/hooks/useStaticPagination.js.map +1 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js +70 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/index.js +85 -41
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js +42 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js +6 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +55 -0
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
- package/lib-commonjs/utilities/ImperativeScrolling/index.js +20 -0
- package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +48 -0
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/index.js +22 -0
- package/lib-commonjs/utilities/VirtualizerContext/index.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/types.js +6 -0
- package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -0
- package/lib-commonjs/utilities/createResizeObserverFromDocument.js +23 -0
- package/lib-commonjs/utilities/createResizeObserverFromDocument.js.map +1 -0
- package/lib-commonjs/utilities/debounce.js +29 -0
- package/lib-commonjs/utilities/debounce.js.map +1 -0
- package/lib-commonjs/utilities/index.js +29 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/package.json +20 -24
- package/CHANGELOG.json +0 -140
- package/lib/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js +0 -115
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,74 @@
|
|
|
1
1
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
2
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
|
-
import type { Dispatch } from 'react';
|
|
4
|
-
import type { FC } from 'react';
|
|
5
|
-
import type { MutableRefObject } from 'react';
|
|
6
3
|
import * as React_2 from 'react';
|
|
7
|
-
import type { SetStateAction } from 'react';
|
|
8
4
|
import type { Slot } from '@fluentui/react-utilities';
|
|
9
5
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
10
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Some props are optional on static virtualizer, but required for dynamic.
|
|
9
|
+
*/
|
|
10
|
+
export declare type DynamicVirtualizerContextProps = Required<VirtualizerContextProps>;
|
|
11
|
+
|
|
12
|
+
export declare interface IndexedResizeCallbackElement {
|
|
13
|
+
handleResize: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JSX.Element;
|
|
12
17
|
|
|
18
|
+
export declare const renderVirtualizerScrollView_unstable: (state: VirtualizerScrollViewState) => JSX.Element;
|
|
19
|
+
|
|
20
|
+
export declare const renderVirtualizerScrollViewDynamic_unstable: (state: VirtualizerScrollViewDynamicState) => JSX.Element;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Additional direct Ref prevents reading old resize entry data
|
|
24
|
+
* Backwards compatible with ResizeObserverCallback if preferred
|
|
25
|
+
*/
|
|
26
|
+
export declare interface ResizeCallbackWithRef {
|
|
27
|
+
(entries: ResizeObserverEntry[], observer: ResizeObserver, scrollRef?: React_2.MutableRefObject<HTMLElement | null>): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare type ScrollToInterface = {
|
|
31
|
+
scrollTo: (index: number, behavior?: ScrollBehavior, callback?: (index: number) => void) => void;
|
|
32
|
+
virtualizerLength: React_2.RefObject<number>;
|
|
33
|
+
currentIndex: React_2.RefObject<number> | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export declare const scrollToItemDynamic: (params: ScrollToItemDynamicParams) => void;
|
|
37
|
+
|
|
38
|
+
export declare type ScrollToItemDynamicParams = {
|
|
39
|
+
index: number;
|
|
40
|
+
itemSizes: React_2.RefObject<number[]>;
|
|
41
|
+
totalSize: number;
|
|
42
|
+
scrollViewRef: React_2.RefObject<HTMLDivElement>;
|
|
43
|
+
axis?: 'horizontal' | 'vertical';
|
|
44
|
+
reversed?: boolean;
|
|
45
|
+
behavior?: ScrollBehavior;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export declare const scrollToItemStatic: (params: ScrollToItemStaticParams) => void;
|
|
49
|
+
|
|
50
|
+
export declare type ScrollToItemStaticParams = {
|
|
51
|
+
index: number;
|
|
52
|
+
itemSize: number;
|
|
53
|
+
totalItems: number;
|
|
54
|
+
scrollViewRef: React_2.RefObject<HTMLDivElement>;
|
|
55
|
+
axis?: 'horizontal' | 'vertical';
|
|
56
|
+
reversed?: boolean;
|
|
57
|
+
behavior?: ScrollBehavior;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* React hook that measures virtualized space dynamically to ensure optimized virtualization length.
|
|
62
|
+
*/
|
|
63
|
+
export declare const useDynamicVirtualizerMeasure: <TElement extends HTMLElement>(virtualizerProps: VirtualizerMeasureDynamicProps) => {
|
|
64
|
+
virtualizerLength: number;
|
|
65
|
+
bufferItems: number;
|
|
66
|
+
bufferSize: number;
|
|
67
|
+
scrollRef: (instance: TElement | null) => void;
|
|
68
|
+
containerSizeRef: React_2.RefObject<number>;
|
|
69
|
+
updateScrollPosition: (scrollPosition: number) => void;
|
|
70
|
+
};
|
|
71
|
+
|
|
13
72
|
/**
|
|
14
73
|
* React hook that allows easy usage of the browser API IntersectionObserver within React
|
|
15
74
|
* @param callback - A function called when the percentage of the target element is visible crosses a threshold.
|
|
@@ -19,14 +78,61 @@ export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JS
|
|
|
19
78
|
* @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to
|
|
20
79
|
* update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.
|
|
21
80
|
*/
|
|
22
|
-
export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit
|
|
23
|
-
setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;
|
|
24
|
-
setObserverInit:
|
|
25
|
-
observer: MutableRefObject<IntersectionObserver | undefined>;
|
|
81
|
+
export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => {
|
|
82
|
+
setObserverList: React_2.Dispatch<React_2.SetStateAction<Element[] | undefined>>;
|
|
83
|
+
setObserverInit: (newInit: IntersectionObserverInit | undefined) => void;
|
|
84
|
+
observer: React_2.MutableRefObject<IntersectionObserver | undefined>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Provides a way of automating size in the virtualizer
|
|
89
|
+
* Returns
|
|
90
|
+
* `width` - element width ref (0 by default),
|
|
91
|
+
* `height` - element height ref (0 by default),
|
|
92
|
+
* `measureElementRef` - a ref function to be passed as `ref` to the element you want to measure
|
|
93
|
+
*/
|
|
94
|
+
export declare function useMeasureList<TElement extends HTMLElement & IndexedResizeCallbackElement = HTMLElement & IndexedResizeCallbackElement>(currentIndex: number, refLength: number, totalLength: number, defaultItemSize: number): {
|
|
95
|
+
widthArray: React_2.MutableRefObject<any[]>;
|
|
96
|
+
heightArray: React_2.MutableRefObject<any[]>;
|
|
97
|
+
createIndexedRef: (index: number) => (el: TElement) => void;
|
|
98
|
+
refArray: React_2.MutableRefObject<(TElement | null | undefined)[]>;
|
|
99
|
+
sizeUpdateCount: number;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* useResizeObserverRef_unstable simplifies resize observer connection and ensures debounce/cleanup
|
|
104
|
+
*/
|
|
105
|
+
export declare const useResizeObserverRef_unstable: (resizeCallback: ResizeCallbackWithRef) => (instance: HTMLElement | HTMLDivElement | null) => void;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* React hook that measures virtualized space based on a static size to ensure optimized virtualization length.
|
|
109
|
+
*/
|
|
110
|
+
export declare const useStaticVirtualizerMeasure: <TElement extends HTMLElement>(virtualizerProps: VirtualizerMeasureProps) => {
|
|
111
|
+
virtualizerLength: number;
|
|
112
|
+
bufferItems: number;
|
|
113
|
+
bufferSize: number;
|
|
114
|
+
scrollRef: (instance: TElement | null) => void;
|
|
115
|
+
containerSizeRef: React_2.MutableRefObject<number>;
|
|
26
116
|
};
|
|
27
117
|
|
|
28
118
|
export declare function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState;
|
|
29
119
|
|
|
120
|
+
export declare const useVirtualizerContext_unstable: () => VirtualizerContextProps;
|
|
121
|
+
|
|
122
|
+
export declare function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState;
|
|
123
|
+
|
|
124
|
+
export declare function useVirtualizerScrollViewDynamic_unstable(props: VirtualizerScrollViewDynamicProps): VirtualizerScrollViewDynamicState;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Apply styling to the Virtualizer states
|
|
128
|
+
*/
|
|
129
|
+
export declare const useVirtualizerScrollViewDynamicStyles_unstable: (state: VirtualizerScrollViewDynamicState) => VirtualizerScrollViewDynamicState;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Apply styling to the Virtualizer states
|
|
133
|
+
*/
|
|
134
|
+
export declare const useVirtualizerScrollViewStyles_unstable: (state: VirtualizerScrollViewState) => VirtualizerScrollViewState;
|
|
135
|
+
|
|
30
136
|
/**
|
|
31
137
|
* Apply styling to the Virtualizer states
|
|
32
138
|
*/
|
|
@@ -37,13 +143,17 @@ export declare const useVirtualizerStyles_unstable: (state: VirtualizerState) =>
|
|
|
37
143
|
* provides a simple interface for reducing the total number
|
|
38
144
|
* of elements rendered at one time in large lists.
|
|
39
145
|
*/
|
|
40
|
-
export declare const Virtualizer: FC<VirtualizerProps>;
|
|
146
|
+
export declare const Virtualizer: React_2.FC<VirtualizerProps>;
|
|
41
147
|
|
|
42
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The main child render method of Virtualization
|
|
150
|
+
* isScrolling will only be enabled when enableScrollLoad is set to true.
|
|
151
|
+
*/
|
|
152
|
+
export declare type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React_2.ReactNode;
|
|
43
153
|
|
|
44
154
|
export declare const virtualizerClassNames: SlotClassNames<VirtualizerSlots>;
|
|
45
155
|
|
|
46
|
-
|
|
156
|
+
declare type VirtualizerConfigProps = {
|
|
47
157
|
/**
|
|
48
158
|
* Child render function.
|
|
49
159
|
* Iteratively called to return current virtualizer DOM children.
|
|
@@ -68,15 +178,18 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
68
178
|
*/
|
|
69
179
|
virtualizerLength: number;
|
|
70
180
|
/**
|
|
71
|
-
* Defaults to 1/4th of virtualizerLength.
|
|
181
|
+
* Defaults to 1/4th (or 1/3rd for dynamic items) of virtualizerLength.
|
|
182
|
+
* RECOMMEND: Override this with a consistent value if using a dynamic virtualizer.
|
|
183
|
+
*
|
|
72
184
|
* Controls the number of elements rendered before the current index entering the virtualized viewport.
|
|
73
185
|
* Constraints:
|
|
74
186
|
* - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).
|
|
75
|
-
* - Small enough that the
|
|
187
|
+
* - Small enough that the virtualizer only renders a few items outside of view.
|
|
76
188
|
*/
|
|
77
189
|
bufferItems?: number;
|
|
78
190
|
/**
|
|
79
|
-
* Defaults to half of bufferItems size (in pixels).
|
|
191
|
+
* Defaults to half of bufferItems * itemSize size (in pixels).
|
|
192
|
+
* RECOMMEND: Override this with a consistent minimum item size value if using a dynamic virtualizer.
|
|
80
193
|
* The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.
|
|
81
194
|
* Increasing this reduces whitespace on ultra-fast scroll, as additional elements
|
|
82
195
|
* are buffered to appear while virtualization recalculates.
|
|
@@ -87,9 +200,9 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
87
200
|
bufferSize?: number;
|
|
88
201
|
/**
|
|
89
202
|
* Enables users to override the intersectionObserverRoot.
|
|
90
|
-
*
|
|
203
|
+
* We recommend passing this in for accurate distance assessment in IO
|
|
91
204
|
*/
|
|
92
|
-
|
|
205
|
+
scrollViewRef?: React_2.MutableRefObject<HTMLElement | null>;
|
|
93
206
|
/**
|
|
94
207
|
* The scroll direction
|
|
95
208
|
* @default vertical
|
|
@@ -100,41 +213,46 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
100
213
|
* This value should be flipped in RTL implementation (TBD whether automate RTL).
|
|
101
214
|
*/
|
|
102
215
|
reversed?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Enables the isScrolling property in the child render function
|
|
218
|
+
* Default: false - to prevent nessecary render function calls
|
|
219
|
+
*/
|
|
220
|
+
enableScrollLoad?: boolean;
|
|
103
221
|
/**
|
|
104
222
|
* Callback for acquiring size of individual items
|
|
105
223
|
* @param index - the index of the requested size's child
|
|
106
224
|
*/
|
|
107
225
|
getItemSize?: (index: number) => number;
|
|
108
226
|
/**
|
|
109
|
-
*
|
|
227
|
+
* Virtualizer context can be passed as a prop for extended class use
|
|
110
228
|
*/
|
|
111
|
-
|
|
229
|
+
virtualizerContext?: VirtualizerContextProps;
|
|
112
230
|
/**
|
|
113
|
-
*
|
|
231
|
+
* Callback for notifying when a flagged index has been rendered
|
|
114
232
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
export declare type VirtualizerSlots = {
|
|
233
|
+
onRenderedFlaggedIndex?: (index: number) => void;
|
|
234
|
+
flaggedIndex?: React_2.MutableRefObject<number | null>;
|
|
119
235
|
/**
|
|
120
|
-
*
|
|
236
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
121
237
|
*/
|
|
122
|
-
|
|
238
|
+
imperativeVirtualizerRef?: React_2.RefObject<VirtualizerDataRef>;
|
|
123
239
|
/**
|
|
124
|
-
* A
|
|
240
|
+
* A ref that provides the size of container (vertical - height, horizontal - width), set by a resize observer.
|
|
241
|
+
* Virtualizer Measure hooks provide a suitable reference.
|
|
125
242
|
*/
|
|
126
|
-
|
|
243
|
+
containerSizeRef: React_2.RefObject<number>;
|
|
127
244
|
/**
|
|
128
|
-
*
|
|
245
|
+
* A callback that enables updating scroll position for calculating required dynamic lengths,
|
|
246
|
+
* this should be passed in from useDynamicVirtualizerMeasure
|
|
129
247
|
*/
|
|
130
|
-
|
|
248
|
+
updateScrollPosition?: (position: number) => void;
|
|
131
249
|
/**
|
|
132
|
-
*
|
|
250
|
+
* Spacing between rendered children for calculation, should match the container's gap CSS value.
|
|
133
251
|
*/
|
|
134
|
-
|
|
252
|
+
gap?: number;
|
|
135
253
|
};
|
|
136
254
|
|
|
137
|
-
|
|
255
|
+
declare type VirtualizerConfigState = {
|
|
138
256
|
/**
|
|
139
257
|
* The current virtualized array of children to show in the DOM.
|
|
140
258
|
*/
|
|
@@ -165,9 +283,184 @@ export declare type VirtualizerState = ComponentState<VirtualizerSlots> & {
|
|
|
165
283
|
*/
|
|
166
284
|
reversed?: boolean;
|
|
167
285
|
/**
|
|
168
|
-
*
|
|
286
|
+
* Enables the isScrolling property in the child render function
|
|
287
|
+
* Default: false - to prevent nessecary render function calls
|
|
288
|
+
*/
|
|
289
|
+
enableScrollLoad?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.
|
|
292
|
+
* Minimum 1px.
|
|
169
293
|
*/
|
|
170
294
|
bufferSize: number;
|
|
295
|
+
/**
|
|
296
|
+
* Ref for access to internal size knowledge, can be used to measure updates
|
|
297
|
+
*/
|
|
298
|
+
childSizes: React_2.MutableRefObject<number[]>;
|
|
299
|
+
/**
|
|
300
|
+
* Ref for access to internal progressive size knowledge, can be used to measure updates
|
|
301
|
+
*/
|
|
302
|
+
childProgressiveSizes: React_2.MutableRefObject<number[]>;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* {@docCategory Virtualizer}
|
|
307
|
+
*/
|
|
308
|
+
export declare type VirtualizerContextProps = {
|
|
309
|
+
contextIndex: number;
|
|
310
|
+
setContextIndex: (index: number) => void;
|
|
311
|
+
childProgressiveSizes?: React_2.MutableRefObject<number[]>;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
export declare const VirtualizerContextProvider: React_2.Provider<VirtualizerContextProps>;
|
|
315
|
+
|
|
316
|
+
export declare type VirtualizerDataRef = {
|
|
317
|
+
progressiveSizes: React_2.RefObject<number[]>;
|
|
318
|
+
nodeSizes: React_2.RefObject<number[]>;
|
|
319
|
+
setFlaggedIndex: (index: number | null) => void;
|
|
320
|
+
currentIndex: React_2.RefObject<number>;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export declare type VirtualizerMeasureDynamicProps = {
|
|
324
|
+
defaultItemSize: number;
|
|
325
|
+
virtualizerContext: DynamicVirtualizerContextProps;
|
|
326
|
+
numItems: number;
|
|
327
|
+
getItemSize: (index: number) => number;
|
|
328
|
+
direction?: 'vertical' | 'horizontal';
|
|
329
|
+
/**
|
|
330
|
+
* Override recommended number of buffer items
|
|
331
|
+
*/
|
|
332
|
+
bufferItems?: number;
|
|
333
|
+
/**
|
|
334
|
+
* Override recommended buffer size (px)
|
|
335
|
+
*/
|
|
336
|
+
bufferSize?: number;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export declare type VirtualizerMeasureProps = {
|
|
340
|
+
defaultItemSize: number;
|
|
341
|
+
direction?: 'vertical' | 'horizontal';
|
|
342
|
+
/**
|
|
343
|
+
* Override recommended number of buffer items
|
|
344
|
+
*/
|
|
345
|
+
bufferItems?: number;
|
|
346
|
+
/**
|
|
347
|
+
* Override recommended buffer size (px)
|
|
348
|
+
*/
|
|
349
|
+
bufferSize?: number;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Virtualizer ScrollView
|
|
356
|
+
*/
|
|
357
|
+
export declare const VirtualizerScrollView: React_2.FC<VirtualizerScrollViewProps>;
|
|
358
|
+
|
|
359
|
+
export declare const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots>;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Virtualizer ScrollView
|
|
363
|
+
*/
|
|
364
|
+
export declare const VirtualizerScrollViewDynamic: React_2.FC<VirtualizerScrollViewDynamicProps>;
|
|
365
|
+
|
|
366
|
+
export declare const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots>;
|
|
367
|
+
|
|
368
|
+
export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'virtualizerContext'>> & {
|
|
369
|
+
/**
|
|
370
|
+
* Set as the minimum item size.
|
|
371
|
+
* Axis: 'vertical' = Height
|
|
372
|
+
* Axis: 'horizontal' = Width
|
|
373
|
+
*/
|
|
374
|
+
itemSize: number;
|
|
375
|
+
/**
|
|
376
|
+
* Callback for acquiring size of individual items
|
|
377
|
+
* @param index - the index of the requested size's child
|
|
378
|
+
* If undefined, Virtualizer will auto-measure by default (performance tradeoff)
|
|
379
|
+
*/
|
|
380
|
+
getItemSize?: (index: number) => number;
|
|
381
|
+
/**
|
|
382
|
+
* The total number of items to be virtualized.
|
|
383
|
+
*/
|
|
384
|
+
numItems: number;
|
|
385
|
+
/**
|
|
386
|
+
* Child render function.
|
|
387
|
+
* Iteratively called to return current virtualizer DOM children.
|
|
388
|
+
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
389
|
+
*/
|
|
390
|
+
children: VirtualizerChildRenderFunction;
|
|
391
|
+
/**
|
|
392
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
393
|
+
*/
|
|
394
|
+
imperativeRef?: React_2.RefObject<ScrollToInterface>;
|
|
395
|
+
/**
|
|
396
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
397
|
+
*/
|
|
398
|
+
enablePagination?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Enables override of dynamic virtualizer context if required.
|
|
401
|
+
*/
|
|
402
|
+
virtualizerContext?: DynamicVirtualizerContextProps;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export declare type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;
|
|
406
|
+
|
|
407
|
+
export declare type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> & VirtualizerConfigState;
|
|
408
|
+
|
|
409
|
+
export declare type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'imperativeVirtualizerRef'>> & {
|
|
410
|
+
/**
|
|
411
|
+
* Virtualizer item size in pixels - static.
|
|
412
|
+
* Axis: 'vertical' = Height
|
|
413
|
+
* Axis: 'horizontal' = Width
|
|
414
|
+
*/
|
|
415
|
+
itemSize: number;
|
|
416
|
+
/**
|
|
417
|
+
* The total number of items to be virtualized.
|
|
418
|
+
*/
|
|
419
|
+
numItems: number;
|
|
420
|
+
/**
|
|
421
|
+
* Child render function.
|
|
422
|
+
* Iteratively called to return current virtualizer DOM children.
|
|
423
|
+
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
424
|
+
*/
|
|
425
|
+
children: VirtualizerChildRenderFunction;
|
|
426
|
+
/**
|
|
427
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
428
|
+
*/
|
|
429
|
+
imperativeRef?: React_2.RefObject<ScrollToInterface>;
|
|
430
|
+
/**
|
|
431
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
432
|
+
*/
|
|
433
|
+
enablePagination?: boolean;
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
export declare type VirtualizerScrollViewSlots = VirtualizerSlots & {
|
|
437
|
+
/**
|
|
438
|
+
* The root container that provides embedded scrolling.
|
|
439
|
+
*/
|
|
440
|
+
container: NonNullable<Slot<'div'>>;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
export declare type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;
|
|
444
|
+
|
|
445
|
+
export declare type VirtualizerSlots = {
|
|
446
|
+
/**
|
|
447
|
+
* The intersection observed 'before' element will detect when scrolling towards the beginning.
|
|
448
|
+
*/
|
|
449
|
+
before: NonNullable<Slot<'div', 'td'>>;
|
|
450
|
+
/**
|
|
451
|
+
* A block place holding whitespace at the beginning of current DOM children.
|
|
452
|
+
*/
|
|
453
|
+
beforeContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
454
|
+
/**
|
|
455
|
+
* The intersection observed 'after' element will detect when scrolling towards the end.
|
|
456
|
+
*/
|
|
457
|
+
after: NonNullable<Slot<'div', 'td'>>;
|
|
458
|
+
/**
|
|
459
|
+
* A block place holding whitespace after the end of current DOM children.
|
|
460
|
+
*/
|
|
461
|
+
afterContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
171
462
|
};
|
|
172
463
|
|
|
464
|
+
export declare type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;
|
|
465
|
+
|
|
173
466
|
export { }
|
package/lib/Hooks.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Hooks.js.map
|
|
1
|
+
export { createResizeObserverFromDocument, getRTLRootMargin, useDynamicVirtualizerMeasure, useIntersectionObserver, useMeasureList, useResizeObserverRef_unstable, useStaticVirtualizerMeasure } from './hooks/index';
|
package/lib/Hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/Hooks.ts"],"sourcesContent":["export type {\n IndexedResizeCallbackElement,\n ResizeCallbackWithRef,\n VirtualizerDynamicPaginationProps,\n VirtualizerMeasureDynamicProps,\n VirtualizerMeasureProps,\n VirtualizerStaticPaginationProps,\n} from './hooks/index';\nexport {\n createResizeObserverFromDocument,\n getRTLRootMargin,\n useDynamicVirtualizerMeasure,\n useIntersectionObserver,\n useMeasureList,\n useResizeObserverRef_unstable,\n useStaticVirtualizerMeasure,\n} from './hooks/index';\n"],"names":["createResizeObserverFromDocument","getRTLRootMargin","useDynamicVirtualizerMeasure","useIntersectionObserver","useMeasureList","useResizeObserverRef_unstable","useStaticVirtualizerMeasure"],"rangeMappings":"","mappings":"AAQA,SACEA,gCAAgC,EAChCC,gBAAgB,EAChBC,4BAA4B,EAC5BC,uBAAuB,EACvBC,cAAc,EACdC,6BAA6B,EAC7BC,2BAA2B,QACtB,gBAAgB"}
|
package/lib/Utilities.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VirtualizerContextProvider, scrollToItemDynamic, scrollToItemStatic, useVirtualizerContextState_unstable, useVirtualizerContext_unstable } from './utilities/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Utilities.ts"],"sourcesContent":["export type {\n DynamicVirtualizerContextProps,\n ScrollToInterface,\n ScrollToItemDynamicParams,\n ScrollToItemStaticParams,\n VirtualizerContextProps,\n} from './utilities/index';\nexport {\n VirtualizerContextProvider,\n scrollToItemDynamic,\n scrollToItemStatic,\n useVirtualizerContextState_unstable,\n useVirtualizerContext_unstable,\n} from './utilities/index';\n"],"names":["VirtualizerContextProvider","scrollToItemDynamic","scrollToItemStatic","useVirtualizerContextState_unstable","useVirtualizerContext_unstable"],"rangeMappings":"","mappings":"AAOA,SACEA,0BAA0B,EAC1BC,mBAAmB,EACnBC,kBAAkB,EAClBC,mCAAmC,EACnCC,8BAA8B,QACzB,oBAAoB"}
|
package/lib/Virtualizer.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Virtualizer.js.map
|
|
1
|
+
export { Virtualizer, renderVirtualizerChildPlaceholder, renderVirtualizer_unstable, useVirtualizerStyles_unstable, useVirtualizer_unstable, virtualizerClassNames } from './components/Virtualizer/index';
|
package/lib/Virtualizer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/Virtualizer.ts"],"sourcesContent":["export type {\n VirtualizerChildRenderFunction,\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerDataRef,\n VirtualizerProps,\n VirtualizerSlots,\n VirtualizerState,\n} from './components/Virtualizer/index';\nexport {\n Virtualizer,\n renderVirtualizerChildPlaceholder,\n renderVirtualizer_unstable,\n useVirtualizerStyles_unstable,\n useVirtualizer_unstable,\n virtualizerClassNames,\n} from './components/Virtualizer/index';\n"],"names":["Virtualizer","renderVirtualizerChildPlaceholder","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useVirtualizer_unstable","virtualizerClassNames"],"rangeMappings":"","mappings":"AASA,SACEA,WAAW,EACXC,iCAAiC,EACjCC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,qBAAqB,QAChB,iCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VirtualizerScrollView, renderVirtualizerScrollView_unstable, useVirtualizerScrollViewStyles_unstable, useVirtualizerScrollView_unstable, virtualizerScrollViewClassNames } from './components/VirtualizerScrollView/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/VirtualizerScrollView.ts"],"sourcesContent":["export type {\n VirtualizerScrollViewProps,\n VirtualizerScrollViewSlots,\n VirtualizerScrollViewState,\n} from './components/VirtualizerScrollView/index';\nexport {\n VirtualizerScrollView,\n renderVirtualizerScrollView_unstable,\n useVirtualizerScrollViewStyles_unstable,\n useVirtualizerScrollView_unstable,\n virtualizerScrollViewClassNames,\n} from './components/VirtualizerScrollView/index';\n"],"names":["VirtualizerScrollView","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","useVirtualizerScrollView_unstable","virtualizerScrollViewClassNames"],"rangeMappings":"","mappings":"AAKA,SACEA,qBAAqB,EACrBC,oCAAoC,EACpCC,uCAAuC,EACvCC,iCAAiC,EACjCC,+BAA+B,QAC1B,2CAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VirtualizerScrollViewDynamic, renderVirtualizerScrollViewDynamic_unstable, useVirtualizerScrollViewDynamicStyles_unstable, useVirtualizerScrollViewDynamic_unstable, virtualizerScrollViewDynamicClassNames } from './components/VirtualizerScrollViewDynamic/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/VirtualizerScrollViewDynamic.ts"],"sourcesContent":["export type {\n VirtualizerScrollViewDynamicProps,\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './components/VirtualizerScrollViewDynamic/index';\nexport {\n VirtualizerScrollViewDynamic,\n renderVirtualizerScrollViewDynamic_unstable,\n useVirtualizerScrollViewDynamicStyles_unstable,\n useVirtualizerScrollViewDynamic_unstable,\n virtualizerScrollViewDynamicClassNames,\n} from './components/VirtualizerScrollViewDynamic/index';\n"],"names":["VirtualizerScrollViewDynamic","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable","useVirtualizerScrollViewDynamic_unstable","virtualizerScrollViewDynamicClassNames"],"rangeMappings":"","mappings":"AAKA,SACEA,4BAA4B,EAC5BC,2CAA2C,EAC3CC,8CAA8C,EAC9CC,wCAAwC,EACxCC,sCAAsC,QACjC,kDAAkD"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';
|
|
2
3
|
import { useVirtualizer_unstable } from './useVirtualizer';
|
|
3
4
|
import { renderVirtualizer_unstable } from './renderVirtualizer';
|
|
4
5
|
/**
|
|
5
6
|
* Virtualizer pseudo-component, this functional wrapper
|
|
6
7
|
* provides a simple interface for reducing the total number
|
|
7
8
|
* of elements rendered at one time in large lists.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return renderVirtualizer_unstable(state);
|
|
9
|
+
*/ export const Virtualizer = (props)=>{
|
|
10
|
+
const state = useVirtualizer_unstable(props);
|
|
11
|
+
useVirtualizerStyles_unstable(state);
|
|
12
|
+
return renderVirtualizer_unstable(state);
|
|
13
13
|
};
|
|
14
14
|
Virtualizer.displayName = 'Virtualizer';
|
|
15
|
-
//# sourceMappingURL=Virtualizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/Virtualizer.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\n\n/**\n * Virtualizer pseudo-component, this functional wrapper\n * provides a simple interface for reducing the total number\n * of elements rendered at one time in large lists.\n */\nexport const Virtualizer: React.FC<VirtualizerProps> = (props: VirtualizerProps) => {\n const state = useVirtualizer_unstable(props);\n useVirtualizerStyles_unstable(state);\n\n return renderVirtualizer_unstable(state);\n};\n\nVirtualizer.displayName = 'Virtualizer';\n"],"names":["React","useVirtualizerStyles_unstable","useVirtualizer_unstable","renderVirtualizer_unstable","Virtualizer","props","state","displayName"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AAEjE;;;;CAIC,GACD,OAAO,MAAMC,cAA0C,CAACC;IACtD,MAAMC,QAAQJ,wBAAwBG;IACtCJ,8BAA8BK;IAE9B,OAAOH,2BAA2BG;AACpC,EAAE;AAEFF,YAAYG,WAAW,GAAG"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=Virtualizer.types.js.map
|
|
1
|
+
import * as React from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { VirtualizerContextProps } from '../../Utilities';\n\nexport type VirtualizerSlots = {\n /**\n * The intersection observed 'before' element will detect when scrolling towards the beginning.\n */\n before: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace at the beginning of current DOM children.\n */\n beforeContainer: NonNullable<Slot<'div', 'tr'>>;\n /**\n * The intersection observed 'after' element will detect when scrolling towards the end.\n */\n after: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace after the end of current DOM children.\n */\n afterContainer: NonNullable<Slot<'div', 'tr'>>;\n};\n\nexport type VirtualizerConfigState = {\n /**\n * The current virtualized array of children to show in the DOM.\n */\n virtualizedChildren: React.ReactNode[];\n /**\n * The current start index for the virtualizer, all previous index's will be removed from DOM.\n */\n virtualizerStartIndex: number;\n /**\n * Current buffer height required at beginning of array.\n */\n afterBufferHeight: number;\n /**\n * Current buffer height required at end of array.\n */\n beforeBufferHeight: number;\n /**\n * The total current height of the scrollView/child content.\n */\n totalVirtualizerHeight: number;\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n */\n reversed?: boolean;\n /**\n * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n /**\n * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n /**\n * Ref for access to internal size knowledge, can be used to measure updates\n */\n childSizes: React.MutableRefObject<number[]>;\n /**\n * Ref for access to internal progressive size knowledge, can be used to measure updates\n */\n childProgressiveSizes: React.MutableRefObject<number[]>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\n\n/**\n * The main child render method of Virtualization\n * isScrolling will only be enabled when enableScrollLoad is set to true.\n */\nexport type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: React.RefObject<number[]>;\n nodeSizes: React.RefObject<number[]>;\n setFlaggedIndex: (index: number | null) => void;\n currentIndex: React.RefObject<number>;\n};\n\nexport type VirtualizerConfigProps = {\n /**\n * Child render function.\n * Iteratively called to return current virtualizer DOM children.\n * Will act as a row or column indexer depending on Virtualizer settings.\n * Can be used dynamically.\n */\n children: VirtualizerChildRenderFunction;\n\n /**\n * Default cell size to use if no custom callback provided.\n * If implementing `getItemSize` this should be the initial and ideally minimum cell size.\n */\n itemSize: number;\n\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n\n /**\n * Number of children to render in the DOM during virtualization.\n * Constraints:\n * - Large enough that the items rendered in DOM cover the viewport\n * and intersection observer buffers (buffersize) at both ends.\n */\n virtualizerLength: number;\n\n /**\n * Defaults to 1/4th (or 1/3rd for dynamic items) of virtualizerLength.\n * RECOMMEND: Override this with a consistent value if using a dynamic virtualizer.\n *\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the virtualizer only renders a few items outside of view.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems * itemSize size (in pixels).\n * RECOMMEND: Override this with a consistent minimum item size value if using a dynamic virtualizer.\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n * We recommend passing this in for accurate distance assessment in IO\n */\n scrollViewRef?: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n * This value should be flipped in RTL implementation (TBD whether automate RTL).\n */\n reversed?: boolean;\n\n /**\n * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n */\n getItemSize?: (index: number) => number;\n\n /**\n * Virtualizer context can be passed as a prop for extended class use\n */\n virtualizerContext?: VirtualizerContextProps;\n\n /**\n * Callback for notifying when a flagged index has been rendered\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onRenderedFlaggedIndex?: (index: number) => void;\n\n /*\n * Callback for notifying when a flagged index has been rendered\n */\n flaggedIndex?: React.MutableRefObject<number | null>;\n\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeVirtualizerRef?: React.RefObject<VirtualizerDataRef>;\n\n /**\n * A ref that provides the size of container (vertical - height, horizontal - width), set by a resize observer.\n * Virtualizer Measure hooks provide a suitable reference.\n */\n containerSizeRef: React.RefObject<number>;\n\n /**\n * A callback that enables updating scroll position for calculating required dynamic lengths,\n * this should be passed in from useDynamicVirtualizerMeasure\n */\n updateScrollPosition?: (position: number) => void;\n\n /**\n * Spacing between rendered children for calculation, should match the container's gap CSS value.\n */\n gap?: number;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './useVirtualizerStyles';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { Virtualizer } from './Virtualizer';
|
|
2
|
+
export { useVirtualizer_unstable } from './useVirtualizer';
|
|
3
|
+
export { renderVirtualizerChildPlaceholder, renderVirtualizer_unstable } from './renderVirtualizer';
|
|
4
|
+
export { useVirtualizerStyles_unstable, virtualizerClassNames } from './useVirtualizerStyles.styles';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/index.ts"],"sourcesContent":["export { Virtualizer } from './Virtualizer';\nexport type {\n VirtualizerChildRenderFunction,\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerDataRef,\n VirtualizerProps,\n VirtualizerSlots,\n VirtualizerState,\n} from './Virtualizer.types';\nexport { useVirtualizer_unstable } from './useVirtualizer';\nexport { renderVirtualizerChildPlaceholder, renderVirtualizer_unstable } from './renderVirtualizer';\nexport { useVirtualizerStyles_unstable, virtualizerClassNames } from './useVirtualizerStyles.styles';\n"],"names":["Virtualizer","useVirtualizer_unstable","renderVirtualizerChildPlaceholder","renderVirtualizer_unstable","useVirtualizerStyles_unstable","virtualizerClassNames"],"rangeMappings":";;;","mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAU5C,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,iCAAiC,EAAEC,0BAA0B,QAAQ,sBAAsB;AACpG,SAASC,6BAA6B,EAAEC,qBAAqB,QAAQ,gCAAgC"}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export const renderVirtualizer_unstable = state
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
4
|
+
export const renderVirtualizer_unstable = (state)=>{
|
|
5
|
+
assertSlots(state);
|
|
6
|
+
return /*#__PURE__*/ _jsxs(React.Fragment, {
|
|
7
|
+
children: [
|
|
8
|
+
/*#__PURE__*/ _jsx(state.beforeContainer, {
|
|
9
|
+
children: /*#__PURE__*/ _jsx(state.before, {})
|
|
10
|
+
}),
|
|
11
|
+
state.virtualizedChildren,
|
|
12
|
+
/*#__PURE__*/ _jsx(state.afterContainer, {
|
|
13
|
+
children: /*#__PURE__*/ _jsx(state.after, {})
|
|
14
|
+
})
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export const renderVirtualizerChildPlaceholder = (child, index)=>{
|
|
19
|
+
return /*#__PURE__*/ _jsx(React.Suspense, {
|
|
20
|
+
fallback: null,
|
|
21
|
+
children: child
|
|
22
|
+
}, `fui-virtualizer-placeholder-${index}`);
|
|
17
23
|
};
|
|
18
|
-
//# sourceMappingURL=renderVirtualizer.js.map
|