@fluentui/react-virtualizer 9.0.0-alpha.8 → 9.0.0-alpha.80
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 +742 -8
- package/dist/index.d.ts +248 -30
- package/lib/Hooks.js +0 -1
- package/lib/Hooks.js.map +1 -1
- package/lib/Utilities.js +1 -0
- package/lib/Utilities.js.map +1 -0
- package/lib/Virtualizer.js +0 -1
- 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 +5 -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 +1 -2
- 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 +439 -355
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +5 -3
- 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 +5 -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 +81 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +47 -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 +5 -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 +149 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +47 -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 +4 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useDynamicPagination.js +127 -0
- package/lib/hooks/useDynamicPagination.js.map +1 -0
- package/lib/hooks/useDynamicVirtualizerMeasure.js +101 -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 +116 -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 +50 -0
- package/lib/hooks/useResizeObserverRef.js.map +1 -0
- package/lib/hooks/useStaticPagination.js +103 -0
- package/lib/hooks/useStaticPagination.js.map +1 -0
- package/lib/hooks/useVirtualizerMeasure.js +46 -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 +3 -0
- package/lib/utilities/ImperativeScrolling/index.js.map +1 -0
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js +33 -0
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
- package/lib/utilities/VirtualizerContext/index.js +2 -0
- package/lib/utilities/VirtualizerContext/index.js.map +1 -0
- package/lib/utilities/VirtualizerContext/types.js +3 -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 +3 -5
- package/lib-commonjs/Hooks.js.map +1 -1
- package/lib-commonjs/Utilities.js +6 -0
- package/lib-commonjs/Utilities.js.map +1 -0
- package/lib-commonjs/Virtualizer.js +3 -5
- package/lib-commonjs/Virtualizer.js.map +1 -1
- package/lib-commonjs/VirtualizerScrollView.js +6 -0
- package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/VirtualizerScrollViewDynamic.js +6 -0
- package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -0
- package/lib-commonjs/components/Virtualizer/Virtualizer.js +15 -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 +7 -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 +447 -361
- 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 +4 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js +10 -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 +4 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +10 -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 +158 -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 +4 -0
- package/lib-commonjs/hooks/hooks.types.js.map +1 -0
- package/lib-commonjs/hooks/index.js +7 -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 +108 -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 +122 -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 +59 -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 +54 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/index.js +82 -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 +4 -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 +8 -0
- package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +54 -0
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
- package/lib-commonjs/utilities/VirtualizerContext/index.js +7 -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 +7 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/package.json +22 -13
- package/CHANGELOG.json +0 -125
- 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
|
@@ -2,14 +2,67 @@ import type { ComponentProps } from '@fluentui/react-utilities';
|
|
|
2
2
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
3
|
import type { Dispatch } from 'react';
|
|
4
4
|
import type { FC } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { MutableRefObject } from 'react';
|
|
6
6
|
import * as React_2 from 'react';
|
|
7
|
+
import type { RefObject } from 'react';
|
|
7
8
|
import type { SetStateAction } from 'react';
|
|
8
9
|
import type { Slot } from '@fluentui/react-utilities';
|
|
9
10
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
10
11
|
|
|
11
12
|
export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JSX.Element;
|
|
12
13
|
|
|
14
|
+
export declare const renderVirtualizerScrollView_unstable: (state: VirtualizerScrollViewState) => JSX.Element;
|
|
15
|
+
|
|
16
|
+
export declare const renderVirtualizerScrollViewDynamic_unstable: (state: VirtualizerScrollViewDynamicState) => JSX.Element;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Additional direct Ref prevents reading old resize entry data
|
|
20
|
+
* Backwards compatible with ResizeObserverCallback if preferred
|
|
21
|
+
*/
|
|
22
|
+
export declare interface ResizeCallbackWithRef {
|
|
23
|
+
(entries: ResizeObserverEntry[], observer: ResizeObserver, scrollRef?: MutableRefObject<HTMLElement | null>): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare type ScrollToInterface = {
|
|
27
|
+
scrollTo: (index: number, behavior?: ScrollBehavior, callback?: (index: number) => void) => void;
|
|
28
|
+
virtualizerLength: RefObject<number>;
|
|
29
|
+
currentIndex: RefObject<number> | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export declare const scrollToItemDynamic: (params: ScrollToItemDynamicParams) => void;
|
|
33
|
+
|
|
34
|
+
export declare type ScrollToItemDynamicParams = {
|
|
35
|
+
index: number;
|
|
36
|
+
itemSizes: RefObject<number[]>;
|
|
37
|
+
totalSize: number;
|
|
38
|
+
scrollViewRef: RefObject<HTMLDivElement>;
|
|
39
|
+
axis?: 'horizontal' | 'vertical';
|
|
40
|
+
reversed?: boolean;
|
|
41
|
+
behavior?: ScrollBehavior;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export declare const scrollToItemStatic: (params: ScrollToItemStaticParams) => void;
|
|
45
|
+
|
|
46
|
+
export declare type ScrollToItemStaticParams = {
|
|
47
|
+
index: number;
|
|
48
|
+
itemSize: number;
|
|
49
|
+
totalItems: number;
|
|
50
|
+
scrollViewRef: RefObject<HTMLDivElement>;
|
|
51
|
+
axis?: 'horizontal' | 'vertical';
|
|
52
|
+
reversed?: boolean;
|
|
53
|
+
behavior?: ScrollBehavior;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* React hook that measures virtualized space dynamically to ensure optimized virtualization length.
|
|
58
|
+
*/
|
|
59
|
+
export declare const useDynamicVirtualizerMeasure: <TElement extends HTMLElement>(virtualizerProps: VirtualizerMeasureDynamicProps) => {
|
|
60
|
+
virtualizerLength: number;
|
|
61
|
+
bufferItems: number;
|
|
62
|
+
bufferSize: number;
|
|
63
|
+
scrollRef: (instance: TElement | null) => void;
|
|
64
|
+
};
|
|
65
|
+
|
|
13
66
|
/**
|
|
14
67
|
* React hook that allows easy usage of the browser API IntersectionObserver within React
|
|
15
68
|
* @param callback - A function called when the percentage of the target element is visible crosses a threshold.
|
|
@@ -19,14 +72,45 @@ export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JS
|
|
|
19
72
|
* @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to
|
|
20
73
|
* update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.
|
|
21
74
|
*/
|
|
22
|
-
export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit
|
|
75
|
+
export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => {
|
|
23
76
|
setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;
|
|
24
|
-
setObserverInit:
|
|
77
|
+
setObserverInit: (newInit: IntersectionObserverInit | undefined) => void;
|
|
25
78
|
observer: MutableRefObject<IntersectionObserver | undefined>;
|
|
26
79
|
};
|
|
27
80
|
|
|
81
|
+
/**
|
|
82
|
+
* useResizeObserverRef_unstable simplifies resize observer connection and ensures debounce/cleanup
|
|
83
|
+
*/
|
|
84
|
+
export declare const useResizeObserverRef_unstable: (resizeCallback: ResizeCallbackWithRef) => (instance: HTMLElement | HTMLDivElement | null) => void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* React hook that measures virtualized space based on a static size to ensure optimized virtualization length.
|
|
88
|
+
*/
|
|
89
|
+
export declare const useStaticVirtualizerMeasure: <TElement extends HTMLElement>(virtualizerProps: VirtualizerMeasureProps) => {
|
|
90
|
+
virtualizerLength: number;
|
|
91
|
+
bufferItems: number;
|
|
92
|
+
bufferSize: number;
|
|
93
|
+
scrollRef: (instance: TElement | null) => void;
|
|
94
|
+
};
|
|
95
|
+
|
|
28
96
|
export declare function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState;
|
|
29
97
|
|
|
98
|
+
export declare const useVirtualizerContext_unstable: () => VirtualizerContextProps;
|
|
99
|
+
|
|
100
|
+
export declare function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState;
|
|
101
|
+
|
|
102
|
+
export declare function useVirtualizerScrollViewDynamic_unstable(props: VirtualizerScrollViewDynamicProps): VirtualizerScrollViewDynamicState;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Apply styling to the Virtualizer states
|
|
106
|
+
*/
|
|
107
|
+
export declare const useVirtualizerScrollViewDynamicStyles_unstable: (state: VirtualizerScrollViewDynamicState) => VirtualizerScrollViewDynamicState;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Apply styling to the Virtualizer states
|
|
111
|
+
*/
|
|
112
|
+
export declare const useVirtualizerScrollViewStyles_unstable: (state: VirtualizerScrollViewState) => VirtualizerScrollViewState;
|
|
113
|
+
|
|
30
114
|
/**
|
|
31
115
|
* Apply styling to the Virtualizer states
|
|
32
116
|
*/
|
|
@@ -39,11 +123,11 @@ export declare const useVirtualizerStyles_unstable: (state: VirtualizerState) =>
|
|
|
39
123
|
*/
|
|
40
124
|
export declare const Virtualizer: FC<VirtualizerProps>;
|
|
41
125
|
|
|
42
|
-
export declare type VirtualizerChildRenderFunction = (index: number) => React_2.ReactNode;
|
|
126
|
+
export declare type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React_2.ReactNode;
|
|
43
127
|
|
|
44
128
|
export declare const virtualizerClassNames: SlotClassNames<VirtualizerSlots>;
|
|
45
129
|
|
|
46
|
-
|
|
130
|
+
declare type VirtualizerConfigProps = {
|
|
47
131
|
/**
|
|
48
132
|
* Child render function.
|
|
49
133
|
* Iteratively called to return current virtualizer DOM children.
|
|
@@ -87,9 +171,8 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
87
171
|
bufferSize?: number;
|
|
88
172
|
/**
|
|
89
173
|
* Enables users to override the intersectionObserverRoot.
|
|
90
|
-
* @default null
|
|
91
174
|
*/
|
|
92
|
-
|
|
175
|
+
scrollViewRef?: React_2.MutableRefObject<HTMLElement | null>;
|
|
93
176
|
/**
|
|
94
177
|
* The scroll direction
|
|
95
178
|
* @default vertical
|
|
@@ -106,35 +189,21 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
106
189
|
*/
|
|
107
190
|
getItemSize?: (index: number) => number;
|
|
108
191
|
/**
|
|
109
|
-
*
|
|
110
|
-
*/
|
|
111
|
-
onUpdateIndex?: (index: number, prevIndex: number) => void;
|
|
112
|
-
/**
|
|
113
|
-
* Allow users to intervene in index calculation changes
|
|
192
|
+
* Virtualizer context can be passed as a prop for extended class use
|
|
114
193
|
*/
|
|
115
|
-
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export declare type VirtualizerSlots = {
|
|
194
|
+
virtualizerContext?: VirtualizerContextProps;
|
|
119
195
|
/**
|
|
120
|
-
*
|
|
196
|
+
* Callback for notifying when a flagged index has been rendered
|
|
121
197
|
*/
|
|
122
|
-
|
|
198
|
+
onRenderedFlaggedIndex?: (index: number) => void;
|
|
199
|
+
flaggedIndex?: MutableRefObject<number | null>;
|
|
123
200
|
/**
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
beforeContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
127
|
-
/**
|
|
128
|
-
* The intersection observed 'after' element will detect when scrolling towards the end.
|
|
129
|
-
*/
|
|
130
|
-
after: NonNullable<Slot<'div', 'td'>>;
|
|
131
|
-
/**
|
|
132
|
-
* A block place holding whitespace after the end of current DOM children.
|
|
201
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
133
202
|
*/
|
|
134
|
-
|
|
203
|
+
imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;
|
|
135
204
|
};
|
|
136
205
|
|
|
137
|
-
|
|
206
|
+
declare type VirtualizerConfigState = {
|
|
138
207
|
/**
|
|
139
208
|
* The current virtualized array of children to show in the DOM.
|
|
140
209
|
*/
|
|
@@ -165,9 +234,158 @@ export declare type VirtualizerState = ComponentState<VirtualizerSlots> & {
|
|
|
165
234
|
*/
|
|
166
235
|
reversed?: boolean;
|
|
167
236
|
/**
|
|
168
|
-
*
|
|
237
|
+
* Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.
|
|
238
|
+
* Minimum 1px.
|
|
169
239
|
*/
|
|
170
240
|
bufferSize: number;
|
|
241
|
+
/**
|
|
242
|
+
* Ref for access to internal size knowledge, can be used to measure updates
|
|
243
|
+
*/
|
|
244
|
+
childSizes: React_2.MutableRefObject<number[]>;
|
|
245
|
+
/**
|
|
246
|
+
* Ref for access to internal progressive size knowledge, can be used to measure updates
|
|
247
|
+
*/
|
|
248
|
+
childProgressiveSizes: React_2.MutableRefObject<number[]>;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* {@docCategory Virtualizer}
|
|
253
|
+
*/
|
|
254
|
+
export declare type VirtualizerContextProps = {
|
|
255
|
+
contextIndex: number;
|
|
256
|
+
setContextIndex: (index: number) => void;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export declare const VirtualizerContextProvider: React_2.Provider<VirtualizerContextProps>;
|
|
260
|
+
|
|
261
|
+
export declare type VirtualizerDataRef = {
|
|
262
|
+
progressiveSizes: RefObject<number[]>;
|
|
263
|
+
nodeSizes: RefObject<number[]>;
|
|
264
|
+
setFlaggedIndex: (index: number | null) => void;
|
|
265
|
+
currentIndex: RefObject<number>;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export declare type VirtualizerMeasureDynamicProps = {
|
|
269
|
+
defaultItemSize: number;
|
|
270
|
+
currentIndex: number;
|
|
271
|
+
numItems: number;
|
|
272
|
+
getItemSize: (index: number) => number;
|
|
273
|
+
direction?: 'vertical' | 'horizontal';
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export declare type VirtualizerMeasureProps = {
|
|
277
|
+
defaultItemSize: number;
|
|
278
|
+
direction?: 'vertical' | 'horizontal';
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Virtualizer ScrollView
|
|
285
|
+
*/
|
|
286
|
+
export declare const VirtualizerScrollView: React_2.FC<VirtualizerScrollViewProps>;
|
|
287
|
+
|
|
288
|
+
export declare const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Virtualizer ScrollView
|
|
292
|
+
*/
|
|
293
|
+
export declare const VirtualizerScrollViewDynamic: React_2.FC<VirtualizerScrollViewDynamicProps>;
|
|
294
|
+
|
|
295
|
+
export declare const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots>;
|
|
296
|
+
|
|
297
|
+
export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex'>> & {
|
|
298
|
+
/**
|
|
299
|
+
* Set as the minimum item size.
|
|
300
|
+
* Axis: 'vertical' = Height
|
|
301
|
+
* Axis: 'horizontal' = Width
|
|
302
|
+
*/
|
|
303
|
+
itemSize: number;
|
|
304
|
+
/**
|
|
305
|
+
* Callback for acquiring size of individual items
|
|
306
|
+
* @param index - the index of the requested size's child
|
|
307
|
+
* If undefined, Virtualizer will auto-measure by default (performance tradeoff)
|
|
308
|
+
*/
|
|
309
|
+
getItemSize?: (index: number) => number;
|
|
310
|
+
/**
|
|
311
|
+
* The total number of items to be virtualized.
|
|
312
|
+
*/
|
|
313
|
+
numItems: number;
|
|
314
|
+
/**
|
|
315
|
+
* Child render function.
|
|
316
|
+
* Iteratively called to return current virtualizer DOM children.
|
|
317
|
+
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
318
|
+
*/
|
|
319
|
+
children: VirtualizerChildRenderFunction;
|
|
320
|
+
/**
|
|
321
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
322
|
+
*/
|
|
323
|
+
imperativeRef?: RefObject<ScrollToInterface>;
|
|
324
|
+
/**
|
|
325
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
326
|
+
*/
|
|
327
|
+
enablePagination?: boolean;
|
|
171
328
|
};
|
|
172
329
|
|
|
330
|
+
export declare type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;
|
|
331
|
+
|
|
332
|
+
export declare type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> & VirtualizerConfigState;
|
|
333
|
+
|
|
334
|
+
export declare type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'imperativeVirtualizerRef'>> & {
|
|
335
|
+
/**
|
|
336
|
+
* Virtualizer item size in pixels - static.
|
|
337
|
+
* Axis: 'vertical' = Height
|
|
338
|
+
* Axis: 'horizontal' = Width
|
|
339
|
+
*/
|
|
340
|
+
itemSize: number;
|
|
341
|
+
/**
|
|
342
|
+
* The total number of items to be virtualized.
|
|
343
|
+
*/
|
|
344
|
+
numItems: number;
|
|
345
|
+
/**
|
|
346
|
+
* Child render function.
|
|
347
|
+
* Iteratively called to return current virtualizer DOM children.
|
|
348
|
+
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
349
|
+
*/
|
|
350
|
+
children: VirtualizerChildRenderFunction;
|
|
351
|
+
/**
|
|
352
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
353
|
+
*/
|
|
354
|
+
imperativeRef?: RefObject<ScrollToInterface>;
|
|
355
|
+
/**
|
|
356
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
357
|
+
*/
|
|
358
|
+
enablePagination?: boolean;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
export declare type VirtualizerScrollViewSlots = VirtualizerSlots & {
|
|
362
|
+
/**
|
|
363
|
+
* The root container that provides embedded scrolling.
|
|
364
|
+
*/
|
|
365
|
+
container: NonNullable<Slot<'div'>>;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
export declare type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;
|
|
369
|
+
|
|
370
|
+
export declare type VirtualizerSlots = {
|
|
371
|
+
/**
|
|
372
|
+
* The intersection observed 'before' element will detect when scrolling towards the beginning.
|
|
373
|
+
*/
|
|
374
|
+
before: NonNullable<Slot<'div', 'td'>>;
|
|
375
|
+
/**
|
|
376
|
+
* A block place holding whitespace at the beginning of current DOM children.
|
|
377
|
+
*/
|
|
378
|
+
beforeContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
379
|
+
/**
|
|
380
|
+
* The intersection observed 'after' element will detect when scrolling towards the end.
|
|
381
|
+
*/
|
|
382
|
+
after: NonNullable<Slot<'div', 'td'>>;
|
|
383
|
+
/**
|
|
384
|
+
* A block place holding whitespace after the end of current DOM children.
|
|
385
|
+
*/
|
|
386
|
+
afterContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
export declare type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;
|
|
390
|
+
|
|
173
391
|
export { }
|
package/lib/Hooks.js
CHANGED
package/lib/Hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Hooks.ts"],"sourcesContent":["export * from './hooks/index';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB"}
|
package/lib/Utilities.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utilities/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Utilities.ts"],"sourcesContent":["export * from './utilities/index';\n"],"names":[],"mappings":"AAAA,cAAc,oBAAoB"}
|
package/lib/Virtualizer.js
CHANGED
package/lib/Virtualizer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"],"names":[],"mappings":"AAAA,cAAc,iCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/VirtualizerScrollView/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VirtualizerScrollView.ts"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n"],"names":[],"mappings":"AAAA,cAAc,2CAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/VirtualizerScrollViewDynamic/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VirtualizerScrollViewDynamic.ts"],"sourcesContent":["export * from './components/VirtualizerScrollViewDynamic/index';\n"],"names":[],"mappings":"AAAA,cAAc,kDAAkD"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { useVirtualizerStyles_unstable } from './useVirtualizerStyles';
|
|
1
|
+
import { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';
|
|
2
2
|
import { useVirtualizer_unstable } from './useVirtualizer';
|
|
3
3
|
import { renderVirtualizer_unstable } from './renderVirtualizer';
|
|
4
4
|
/**
|
|
5
5
|
* Virtualizer pseudo-component, this functional wrapper
|
|
6
6
|
* provides a simple interface for reducing the total number
|
|
7
7
|
* of elements rendered at one time in large lists.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return renderVirtualizer_unstable(state);
|
|
8
|
+
*/ export const Virtualizer = (props)=>{
|
|
9
|
+
const state = useVirtualizer_unstable(props);
|
|
10
|
+
useVirtualizerStyles_unstable(state);
|
|
11
|
+
return renderVirtualizer_unstable(state);
|
|
13
12
|
};
|
|
14
13
|
Virtualizer.displayName = 'Virtualizer';
|
|
15
|
-
//# sourceMappingURL=Virtualizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\nimport type { FC } from 'react';\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: 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":["useVirtualizerStyles_unstable","useVirtualizer_unstable","renderVirtualizer_unstable","Virtualizer","props","state","displayName"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AAGjE;;;;CAIC,GACD,OAAO,MAAMC,cAAoC,CAACC;IAChD,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":["Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { VirtualizerContextProps } from '../../Utilities';\nimport type { RefObject, MutableRefObject } from 'react';\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 * 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// Virtualizer render function to procedurally generate children elements as rows or columns via index.\n// Q: Use generic typing and passing through object data or a simple index system?\nexport type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: RefObject<number[]>;\n nodeSizes: RefObject<number[]>;\n setFlaggedIndex: (index: number | null) => void;\n currentIndex: 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 of virtualizerLength.\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 end buffer and end index (start index + virtualizerLength) is not within viewport at rest.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems size (in pixels).\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 */\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 * 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?: MutableRefObject<number | null>;\n\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { ReactNode } from 'react';\n\nimport { assertSlots } from '@fluentui/react-utilities';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n assertSlots<VirtualizerSlots>(state);\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <state.beforeContainer>\n <state.before />\n </state.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <state.afterContainer>\n <state.after />\n </state.afterContainer>\n </React.Fragment>\n );\n};\n\nexport const renderVirtualizerChildPlaceholder = (child: ReactNode, index: number) => {\n return (\n <React.Suspense key={`fui-virtualizer-placeholder-${index}`} fallback={null}>\n {child}\n </React.Suspense>\n );\n};\n"],"names":["React","assertSlots","renderVirtualizer_unstable","state","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","renderVirtualizerChildPlaceholder","child","index","Suspense","fallback"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAI/B,SAASC,WAAW,QAAQ,4BAA4B;AAExD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAC9B,qBACE,MAACH,MAAMI,QAAQ;;0BAEb,KAACD,MAAME,eAAe;0BACpB,cAAA,KAACF,MAAMG,MAAM;;YAGdH,MAAMI,mBAAmB;0BAE1B,KAACJ,MAAMK,cAAc;0BACnB,cAAA,KAACL,MAAMM,KAAK;;;;AAIpB,EAAE;AAEF,OAAO,MAAMC,oCAAoC,CAACC,OAAkBC;IAClE,qBACE,KAACZ,MAAMa,QAAQ;QAA8CC,UAAU;kBACpEH;OADkB,CAAC,4BAA4B,EAAEC,MAAM,CAAC;AAI/D,EAAE"}
|