@fluentui/react-virtualizer 9.0.0-alpha.22 → 9.0.0-alpha.24
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.json +61 -1
- package/CHANGELOG.md +25 -2
- package/dist/index.d.ts +59 -7
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +83 -13
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +39 -3
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +43 -5
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/hooks/useResizeObserverRef.js +2 -0
- package/lib/hooks/useResizeObserverRef.js.map +1 -1
- package/lib/index.js +1 -1
- 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/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +83 -13
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +38 -3
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +41 -4
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/hooks/useResizeObserverRef.js +2 -0
- package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
- package/lib-commonjs/index.js +2 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js +40 -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 +53 -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/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,67 @@
|
|
|
2
2
|
"name": "@fluentui/react-virtualizer",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 26 Jun 2023 09:51:06 GMT",
|
|
6
|
+
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.24",
|
|
7
|
+
"version": "9.0.0-alpha.24",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-virtualizer",
|
|
13
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8",
|
|
14
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-virtualizer",
|
|
19
|
+
"comment": "Bump @fluentui/react-utilities to v9.9.4",
|
|
20
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Tue, 20 Jun 2023 12:39:06 GMT",
|
|
27
|
+
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.23",
|
|
28
|
+
"version": "9.0.0-alpha.23",
|
|
29
|
+
"comments": {
|
|
30
|
+
"prerelease": [
|
|
31
|
+
{
|
|
32
|
+
"author": "mifraser@microsoft.com",
|
|
33
|
+
"package": "@fluentui/react-virtualizer",
|
|
34
|
+
"commit": "ab901891c51f8bd5d1a5099e66011c9c84372566",
|
|
35
|
+
"comment": "feature: Add scrollTo index hook and callbacks, isScrolling flag"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "martinhochel@microsoft.com",
|
|
39
|
+
"package": "@fluentui/react-virtualizer",
|
|
40
|
+
"commit": "cf6b94ba6559236150bc1f1814b023607edaeb20",
|
|
41
|
+
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "beachball",
|
|
45
|
+
"package": "@fluentui/react-virtualizer",
|
|
46
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.7",
|
|
47
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@fluentui/react-virtualizer",
|
|
52
|
+
"comment": "Bump @fluentui/react-utilities to v9.9.3",
|
|
53
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-virtualizer",
|
|
58
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.23",
|
|
59
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Wed, 31 May 2023 06:46:23 GMT",
|
|
6
66
|
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.22",
|
|
7
67
|
"version": "9.0.0-alpha.22",
|
|
8
68
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-virtualizer
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 26 Jun 2023 09:51:06 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-alpha.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.24)
|
|
8
|
+
|
|
9
|
+
Mon, 26 Jun 2023 09:51:06 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.23..@fluentui/react-virtualizer_v9.0.0-alpha.24)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
15
|
+
- Bump @fluentui/react-utilities to v9.9.4 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
16
|
+
|
|
17
|
+
## [9.0.0-alpha.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.23)
|
|
18
|
+
|
|
19
|
+
Tue, 20 Jun 2023 12:39:06 GMT
|
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.22..@fluentui/react-virtualizer_v9.0.0-alpha.23)
|
|
21
|
+
|
|
22
|
+
### Changes
|
|
23
|
+
|
|
24
|
+
- feature: Add scrollTo index hook and callbacks, isScrolling flag ([PR #27864](https://github.com/microsoft/fluentui/pull/27864) by mifraser@microsoft.com)
|
|
25
|
+
- chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments ([PR #28067](https://github.com/microsoft/fluentui/pull/28067) by martinhochel@microsoft.com)
|
|
26
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.7 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
27
|
+
- Bump @fluentui/react-utilities to v9.9.3 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
28
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.23 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
29
|
+
|
|
7
30
|
## [9.0.0-alpha.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.22)
|
|
8
31
|
|
|
9
|
-
Wed, 31 May 2023 06:
|
|
32
|
+
Wed, 31 May 2023 06:46:23 GMT
|
|
10
33
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.21..@fluentui/react-virtualizer_v9.0.0-alpha.22)
|
|
11
34
|
|
|
12
35
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
-
import { ComponentState } from '@fluentui/react-utilities';
|
|
1
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
3
|
import type { Dispatch } from 'react';
|
|
4
4
|
import type { FC } from 'react';
|
|
5
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
|
-
import { Slot } from '@fluentui/react-utilities';
|
|
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;
|
|
@@ -22,6 +23,34 @@ export declare interface ResizeCallbackWithRef {
|
|
|
22
23
|
(entries: ResizeObserverEntry[], observer: ResizeObserver, scrollRef?: MutableRefObject<HTMLElement | null>): void;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
export declare type ScrollToInterface = {
|
|
27
|
+
scrollTo: (index: number, behavior?: ScrollBehavior, callback?: (index: number) => void) => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export declare const scrollToItemDynamic: (params: ScrollToItemDynamicParams) => void;
|
|
31
|
+
|
|
32
|
+
export declare type ScrollToItemDynamicParams = {
|
|
33
|
+
index: number;
|
|
34
|
+
itemSizes: RefObject<number[]>;
|
|
35
|
+
totalSize: number;
|
|
36
|
+
scrollViewRef: RefObject<HTMLDivElement>;
|
|
37
|
+
axis?: 'horizontal' | 'vertical';
|
|
38
|
+
reversed?: boolean;
|
|
39
|
+
behavior?: ScrollBehavior;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export declare const scrollToItemStatic: (params: ScrollToItemStaticParams) => void;
|
|
43
|
+
|
|
44
|
+
export declare type ScrollToItemStaticParams = {
|
|
45
|
+
index: number;
|
|
46
|
+
itemSize: number;
|
|
47
|
+
totalItems: number;
|
|
48
|
+
scrollViewRef: RefObject<HTMLDivElement>;
|
|
49
|
+
axis?: 'horizontal' | 'vertical';
|
|
50
|
+
reversed?: boolean;
|
|
51
|
+
behavior?: ScrollBehavior;
|
|
52
|
+
};
|
|
53
|
+
|
|
25
54
|
/**
|
|
26
55
|
* React hook that measures virtualized space dynamically to ensure optimized virtualization length.
|
|
27
56
|
*/
|
|
@@ -41,7 +70,7 @@ export declare const useDynamicVirtualizerMeasure: <TElement extends HTMLElement
|
|
|
41
70
|
* @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to
|
|
42
71
|
* update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.
|
|
43
72
|
*/
|
|
44
|
-
export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit
|
|
73
|
+
export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => {
|
|
45
74
|
setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;
|
|
46
75
|
setObserverInit: Dispatch<SetStateAction<IntersectionObserverInit | undefined>>;
|
|
47
76
|
observer: MutableRefObject<IntersectionObserver | undefined>;
|
|
@@ -92,7 +121,7 @@ export declare const useVirtualizerStyles_unstable: (state: VirtualizerState) =>
|
|
|
92
121
|
*/
|
|
93
122
|
export declare const Virtualizer: FC<VirtualizerProps>;
|
|
94
123
|
|
|
95
|
-
export declare type VirtualizerChildRenderFunction = (index: number) => React_2.ReactNode;
|
|
124
|
+
export declare type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React_2.ReactNode;
|
|
96
125
|
|
|
97
126
|
export declare const virtualizerClassNames: SlotClassNames<VirtualizerSlots>;
|
|
98
127
|
|
|
@@ -161,6 +190,15 @@ declare type VirtualizerConfigProps = {
|
|
|
161
190
|
* Virtualizer context can be passed as a prop for extended class use
|
|
162
191
|
*/
|
|
163
192
|
virtualizerContext?: VirtualizerContextProps;
|
|
193
|
+
/**
|
|
194
|
+
* Callback for notifying when a flagged index has been rendered
|
|
195
|
+
*/
|
|
196
|
+
onRenderedFlaggedIndex?: (index: number) => void;
|
|
197
|
+
flaggedIndex?: MutableRefObject<number | null>;
|
|
198
|
+
/**
|
|
199
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
200
|
+
*/
|
|
201
|
+
imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;
|
|
164
202
|
};
|
|
165
203
|
|
|
166
204
|
declare type VirtualizerConfigState = {
|
|
@@ -210,6 +248,12 @@ export declare type VirtualizerContextProps = {
|
|
|
210
248
|
|
|
211
249
|
export declare const VirtualizerContextProvider: React_2.Provider<VirtualizerContextProps>;
|
|
212
250
|
|
|
251
|
+
export declare type VirtualizerDataRef = {
|
|
252
|
+
progressiveSizes: RefObject<number[]>;
|
|
253
|
+
nodeSizes: RefObject<number[]>;
|
|
254
|
+
setFlaggedIndex: (index: number | null) => void;
|
|
255
|
+
};
|
|
256
|
+
|
|
213
257
|
export declare type VirtualizerMeasureDynamicProps = {
|
|
214
258
|
defaultItemSize: number;
|
|
215
259
|
currentIndex: number;
|
|
@@ -239,7 +283,7 @@ export declare const VirtualizerScrollViewDynamic: React_2.FC<VirtualizerScrollV
|
|
|
239
283
|
|
|
240
284
|
export declare const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots>;
|
|
241
285
|
|
|
242
|
-
export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children'>> & {
|
|
286
|
+
export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex'>> & {
|
|
243
287
|
/**
|
|
244
288
|
* Set as the minimum item size.
|
|
245
289
|
* Axis: 'vertical' = Height
|
|
@@ -261,13 +305,17 @@ export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<V
|
|
|
261
305
|
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
262
306
|
*/
|
|
263
307
|
children: VirtualizerChildRenderFunction;
|
|
308
|
+
/**
|
|
309
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
310
|
+
*/
|
|
311
|
+
imperativeRef?: RefObject<ScrollToInterface>;
|
|
264
312
|
};
|
|
265
313
|
|
|
266
314
|
export declare type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;
|
|
267
315
|
|
|
268
316
|
export declare type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> & VirtualizerConfigState;
|
|
269
317
|
|
|
270
|
-
export declare type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children'>> & {
|
|
318
|
+
export declare type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'imperativeVirtualizerRef'>> & {
|
|
271
319
|
/**
|
|
272
320
|
* Virtualizer item size in pixels - static.
|
|
273
321
|
* Axis: 'vertical' = Height
|
|
@@ -284,6 +332,10 @@ export declare type VirtualizerScrollViewProps = ComponentProps<Partial<Virtuali
|
|
|
284
332
|
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
285
333
|
*/
|
|
286
334
|
children: VirtualizerChildRenderFunction;
|
|
335
|
+
/**
|
|
336
|
+
* Imperative ref contains our scrollTo index functionality for user control.
|
|
337
|
+
*/
|
|
338
|
+
imperativeRef?: RefObject<ScrollToInterface>;
|
|
287
339
|
};
|
|
288
340
|
|
|
289
341
|
export declare type VirtualizerScrollViewSlots = VirtualizerSlots & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { 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 * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: 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) => React.ReactNode;\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\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
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\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};\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 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,"sources":["renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport * as React from 'react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { ReactNode } from 'react';\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n const { slots, slotProps } = getSlotsNext<VirtualizerSlots>(state);\n\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <slots.beforeContainer {...slotProps.beforeContainer}>\n <slots.before {...slotProps.before} />\n </slots.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 <slots.afterContainer {...slotProps.afterContainer}>\n <slots.after {...slotProps.after} />\n </slots.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","createElement","getSlotsNext","renderVirtualizer_unstable","state","slots","slotProps","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","renderVirtualizerChildPlaceholder","child","index","Suspense","key","fallback"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,YAAYA,WAAW,QAAQ;AAI/B,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA+BE;IAE5D,qBACE,AAbJ,cAaKJ,MAAMO,QAAQ,sBAEb,AAfN,cAeOF,MAAMG,eAAe,EAAKF,UAAUE,eAAe,gBAClD,AAhBR,cAgBSH,MAAMI,MAAM,EAAKH,UAAUG,MAAM,IAGnCL,MAAMM,mBAAmB,gBAE1B,AArBN,cAqBOL,MAAMM,cAAc,EAAKL,UAAUK,cAAc,gBAChD,AAtBR,cAsBSN,MAAMO,KAAK,EAAKN,UAAUM,KAAK;AAIxC,EAAE;AAEF,OAAO,MAAMC,oCAAoC,CAACC,OAAkBC,QAAkB;IACpF,qBACE,AA9BJ,cA8BKf,MAAMgB,QAAQ;QAACC,KAAK,CAAC,4BAA4B,EAAEF,MAAM,CAAC;QAAEG,UAAU,IAAI;OACxEJ;AAGP,EAAE"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { useEffect, useRef, useCallback, useReducer, useImperativeHandle, useState } from 'react';
|
|
1
2
|
import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
|
|
2
|
-
import { useEffect, useRef, useCallback, useReducer } from 'react';
|
|
3
3
|
import { resolveShorthand } from '@fluentui/react-utilities';
|
|
4
4
|
import { flushSync } from 'react-dom';
|
|
5
5
|
import { useVirtualizerContextState_unstable } from '../../Utilities';
|
|
6
6
|
import { renderVirtualizerChildPlaceholder } from './renderVirtualizer';
|
|
7
7
|
export function useVirtualizer_unstable(props) {
|
|
8
|
-
const { itemSize , numItems , virtualizerLength , children: renderChild , getItemSize , bufferItems =Math.round(virtualizerLength / 4.0) , bufferSize =Math.floor(bufferItems / 2.0) * itemSize , scrollViewRef , axis ='vertical' , reversed =false , virtualizerContext } = props;
|
|
8
|
+
const { itemSize , numItems , virtualizerLength , children: renderChild , getItemSize , bufferItems =Math.round(virtualizerLength / 4.0) , bufferSize =Math.floor(bufferItems / 2.0) * itemSize , scrollViewRef , axis ='vertical' , reversed =false , virtualizerContext , onRenderedFlaggedIndex , imperativeVirtualizerRef } = props;
|
|
9
9
|
/* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/ const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);
|
|
10
|
+
const flaggedIndex = useRef(null);
|
|
10
11
|
const actualIndex = _virtualizerContext.contextIndex;
|
|
11
12
|
const setActualIndex = _virtualizerContext.setContextIndex;
|
|
12
13
|
// Store ref to before padding element
|
|
@@ -42,6 +43,34 @@ export function useVirtualizer_unstable(props) {
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
};
|
|
46
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
47
|
+
const scrollTimer = useRef();
|
|
48
|
+
const scrollCounter = useRef(0);
|
|
49
|
+
const initializeScrollingTimer = ()=>{
|
|
50
|
+
/*
|
|
51
|
+
* This can be considered the 'velocity' required to start 'isScrolling'
|
|
52
|
+
* INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling
|
|
53
|
+
* INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset
|
|
54
|
+
* - Maybe we should let users customize these in the future.
|
|
55
|
+
*/ const INIT_SCROLL_FLAG_REQ = 10;
|
|
56
|
+
const INIT_SCROLL_FLAG_DELAY = 100;
|
|
57
|
+
scrollCounter.current++;
|
|
58
|
+
if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {
|
|
59
|
+
setIsScrolling(true);
|
|
60
|
+
}
|
|
61
|
+
if (scrollTimer.current) {
|
|
62
|
+
clearTimeout(scrollTimer.current);
|
|
63
|
+
}
|
|
64
|
+
scrollTimer.current = setTimeout(()=>{
|
|
65
|
+
setIsScrolling(false);
|
|
66
|
+
scrollCounter.current = 0;
|
|
67
|
+
}, INIT_SCROLL_FLAG_DELAY);
|
|
68
|
+
};
|
|
69
|
+
useEffect(()=>{
|
|
70
|
+
initializeScrollingTimer();
|
|
71
|
+
}, [
|
|
72
|
+
actualIndex
|
|
73
|
+
]);
|
|
45
74
|
const batchUpdateNewIndex = (index)=>{
|
|
46
75
|
// Local updates
|
|
47
76
|
updateChildRows(index);
|
|
@@ -166,14 +195,18 @@ export function useVirtualizer_unstable(props) {
|
|
|
166
195
|
}
|
|
167
196
|
return getIndexFromSizeArray(scrollPos);
|
|
168
197
|
};
|
|
169
|
-
const calculateTotalSize = ()=>{
|
|
198
|
+
const calculateTotalSize = useCallback(()=>{
|
|
170
199
|
if (!getItemSize) {
|
|
171
200
|
return itemSize * numItems;
|
|
172
201
|
}
|
|
173
202
|
// Time for custom size calcs
|
|
174
203
|
return childProgressiveSizes.current[numItems - 1];
|
|
175
|
-
}
|
|
176
|
-
|
|
204
|
+
}, [
|
|
205
|
+
getItemSize,
|
|
206
|
+
itemSize,
|
|
207
|
+
numItems
|
|
208
|
+
]);
|
|
209
|
+
const calculateBefore = useCallback(()=>{
|
|
177
210
|
const currentIndex = Math.min(actualIndex, numItems);
|
|
178
211
|
if (!getItemSize) {
|
|
179
212
|
// The missing items from before virtualization starts height
|
|
@@ -184,8 +217,13 @@ export function useVirtualizer_unstable(props) {
|
|
|
184
217
|
}
|
|
185
218
|
// Time for custom size calcs
|
|
186
219
|
return childProgressiveSizes.current[currentIndex - 1];
|
|
187
|
-
}
|
|
188
|
-
|
|
220
|
+
}, [
|
|
221
|
+
actualIndex,
|
|
222
|
+
getItemSize,
|
|
223
|
+
itemSize,
|
|
224
|
+
numItems
|
|
225
|
+
]);
|
|
226
|
+
const calculateAfter = useCallback(()=>{
|
|
189
227
|
if (numItems === 0) {
|
|
190
228
|
return 0;
|
|
191
229
|
}
|
|
@@ -197,20 +235,28 @@ export function useVirtualizer_unstable(props) {
|
|
|
197
235
|
}
|
|
198
236
|
// Time for custom size calcs
|
|
199
237
|
return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];
|
|
200
|
-
}
|
|
238
|
+
}, [
|
|
239
|
+
actualIndex,
|
|
240
|
+
getItemSize,
|
|
241
|
+
itemSize,
|
|
242
|
+
numItems,
|
|
243
|
+
virtualizerLength
|
|
244
|
+
]);
|
|
201
245
|
const updateChildRows = useCallback((newIndex)=>{
|
|
202
246
|
if (numItems === 0) {
|
|
203
|
-
/* Nothing to virtualize */ return
|
|
204
|
-
}
|
|
205
|
-
if (childArray.current.length !== numItems) {
|
|
206
|
-
childArray.current = new Array(virtualizerLength);
|
|
247
|
+
/* Nothing to virtualize */ return;
|
|
207
248
|
}
|
|
249
|
+
/*
|
|
250
|
+
We reset the array every time to ensure children are re-rendered
|
|
251
|
+
This function should only be called when update is nessecary
|
|
252
|
+
*/ childArray.current = new Array(virtualizerLength);
|
|
208
253
|
const _actualIndex = Math.max(newIndex, 0);
|
|
209
254
|
const end = Math.min(_actualIndex + virtualizerLength, numItems);
|
|
210
255
|
for(let i = _actualIndex; i < end; i++){
|
|
211
|
-
childArray.current[i - _actualIndex] = renderVirtualizerChildPlaceholder(renderChild(i), i);
|
|
256
|
+
childArray.current[i - _actualIndex] = renderVirtualizerChildPlaceholder(renderChild(i, isScrolling), i);
|
|
212
257
|
}
|
|
213
258
|
}, [
|
|
259
|
+
isScrolling,
|
|
214
260
|
numItems,
|
|
215
261
|
renderChild,
|
|
216
262
|
virtualizerLength
|
|
@@ -278,6 +324,16 @@ export function useVirtualizer_unstable(props) {
|
|
|
278
324
|
populateSizeArrays();
|
|
279
325
|
}
|
|
280
326
|
};
|
|
327
|
+
useImperativeHandle(imperativeVirtualizerRef, ()=>{
|
|
328
|
+
return {
|
|
329
|
+
progressiveSizes: childProgressiveSizes,
|
|
330
|
+
nodeSizes: childSizes,
|
|
331
|
+
setFlaggedIndex: (index)=>flaggedIndex.current = index
|
|
332
|
+
};
|
|
333
|
+
}, [
|
|
334
|
+
childProgressiveSizes,
|
|
335
|
+
childSizes
|
|
336
|
+
]);
|
|
281
337
|
// Initialization on mount - update array index to 0 (ready state).
|
|
282
338
|
// Only fire on mount (no deps).
|
|
283
339
|
useEffect(()=>{
|
|
@@ -305,6 +361,20 @@ export function useVirtualizer_unstable(props) {
|
|
|
305
361
|
}, [
|
|
306
362
|
getItemSize
|
|
307
363
|
]);
|
|
364
|
+
// Effect to check flag index on updates
|
|
365
|
+
useEffect(()=>{
|
|
366
|
+
if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {
|
|
370
|
+
onRenderedFlaggedIndex(flaggedIndex.current);
|
|
371
|
+
flaggedIndex.current = null;
|
|
372
|
+
}
|
|
373
|
+
}, [
|
|
374
|
+
actualIndex,
|
|
375
|
+
onRenderedFlaggedIndex,
|
|
376
|
+
virtualizerLength
|
|
377
|
+
]);
|
|
308
378
|
// Ensure we have run through and updated the whole size list array at least once.
|
|
309
379
|
initializeSizeArray();
|
|
310
380
|
if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useVirtualizer.ts"],"sourcesContent":["import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport type { ReactNode } from 'react';\nimport { useEffect, useRef, useCallback, useReducer } from 'react';\n\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { renderVirtualizerChildPlaceholder } from './renderVirtualizer';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n scrollViewRef,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n const actualIndex = _virtualizerContext.contextIndex;\n const setActualIndex = _virtualizerContext.setContextIndex;\n\n // Store ref to before padding element\n const beforeElementRef = useRef<Element | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = useRef<Element | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\n\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n\n const horizontal = axis === 'horizontal';\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n }\n\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const batchUpdateNewIndex = (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n };\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n\n // Grab latest entry that is intersecting\n const latestEntry =\n entries.length === 1\n ? entries[0]\n : entries\n .sort((entry1, entry2) => entry2.time - entry1.time)\n .find(entry => {\n return entry.intersectionRatio > 0;\n });\n\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n const bufferedIndex = Math.max(startIndex - bufferCount, 0);\n\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n\n if (actualIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n },\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const findIndexRecursive = (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n };\n\n const getIndexFromSizeArray = (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n };\n\n const getIndexFromScrollPosition = (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n };\n\n const calculateTotalSize = () => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n };\n\n const calculateBefore = () => {\n const currentIndex = Math.min(actualIndex, numItems);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * itemSize;\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n };\n\n const calculateAfter = () => {\n if (numItems === 0) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n };\n\n const updateChildRows = useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n\n return [];\n }\n\n if (childArray.current.length !== numItems) {\n childArray.current = new Array(virtualizerLength);\n }\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderVirtualizerChildPlaceholder(renderChild(i), i);\n }\n },\n [numItems, renderChild, virtualizerLength],\n );\n\n const setBeforeRef = useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const updateCurrentItemSizes = (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const newSize = getItemSize(i);\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n };\n\n // Initialize the size array before first render.\n const hasInitialized = useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, updateChildRows]);\n\n useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n };\n}\n"],"names":["useIntersectionObserver","useEffect","useRef","useCallback","useReducer","resolveShorthand","flushSync","useVirtualizerContextState_unstable","renderVirtualizerChildPlaceholder","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","scrollViewRef","axis","reversed","virtualizerContext","_virtualizerContext","actualIndex","contextIndex","setActualIndex","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","horizontal","populateSizeArrays","current","length","index","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","currentIndex","lastItemIndex","remainingItems","newIndex","_actualIndex","end","i","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,sCAAsC;AAE9E,SAASC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,UAAU,QAAQ,QAAQ;AAGnE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,SAAS,QAAQ,YAAY;AAEtC,SAASC,mCAAmC,QAAQ,kBAAkB;AACtE,SAASC,iCAAiC,QAAQ,sBAAsB;AAExE,OAAO,SAASC,wBAAwBC,KAAuB,EAAoB;IACjF,MAAM,EACJC,SAAQ,EACRC,SAAQ,EACRC,kBAAiB,EACjBC,UAAUC,YAAW,EACrBC,YAAW,EACXC,aAAcC,KAAKC,KAAK,CAACN,oBAAoB,KAAI,EACjDO,YAAaF,KAAKG,KAAK,CAACJ,cAAc,OAAON,SAAQ,EACrDW,cAAa,EACbC,MAAO,WAAU,EACjBC,UAAW,KAAK,CAAA,EAChBC,mBAAkB,EACnB,GAAGf;IAEJ,iHAAiH,GACjH,MAAMgB,sBAAsBnB,oCAAoCkB;IAEhE,MAAME,cAAcD,oBAAoBE,YAAY;IACpD,MAAMC,iBAAiBH,oBAAoBI,eAAe;IAE1D,sCAAsC;IACtC,MAAMC,mBAAmB7B,OAAuB,IAAI;IAEpD,sCAAsC;IACtC,MAAM8B,kBAAkB9B,OAAuB,IAAI;IAEnD,oGAAoG;IACpG,MAAM+B,aAAa/B,OAAiB,IAAIgC,MAAclB,cAAcJ,WAAW,CAAC;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B,CAAC;IAED,MAAMkF,qBAAqBH,eAAelE,OAAO,IAAIb,eAAe;IACpE,OAAO;QACLmF,YAAY;YACVC,QAAQ;YACRC,OAAO;YACPC,iBAAiB;YACjBC,gBAAgB;QAClB;QACAC,qBAAqB/E,WAAWI,OAAO;QACvCuE,QAAQ1G,iBAAiBK,MAAMqG,MAAM,EAAE;YACrCK,UAAU,IAAI;YACdC,cAAc;gBACZC,KAAKrB;gBACLsB,MAAM;YACR;QACF;QACAP,OAAO3G,iBAAiBK,MAAMsG,KAAK,EAAE;YACnCI,UAAU,IAAI;YACdC,cAAc;gBACZC,KAAKjB;gBACLkB,MAAM;YACR;QACF;QACAN,iBAAiB5G,iBAAiBK,MAAMuG,eAAe,EAAE;YACvDG,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAL,gBAAgB7G,iBAAiBK,MAAMwG,cAAc,EAAE;YACrDE,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAC,oBAAoBX,qBAAqBzC,oBAAoB,CAAC;QAC9DqD,mBAAmBZ,qBAAqBjD,mBAAmB,CAAC;QAC5D8D,wBAAwBb,qBAAqBhD,uBAAuBhD,oBAAoBF,QAAQ;QAChGgH,uBAAuBhG;QACvBJ;QACAH;QACAI;IACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"sources":["useVirtualizer.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useEffect, useRef, useCallback, useReducer, useImperativeHandle, useState } from 'react';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { renderVirtualizerChildPlaceholder } from './renderVirtualizer';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n scrollViewRef,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n const flaggedIndex = useRef<number | null>(null);\n\n const actualIndex = _virtualizerContext.contextIndex;\n const setActualIndex = _virtualizerContext.setContextIndex;\n\n // Store ref to before padding element\n const beforeElementRef = useRef<Element | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = useRef<Element | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\n\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n\n const horizontal = axis === 'horizontal';\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n }\n\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = useState<boolean>(false);\n const scrollTimer = useRef<ReturnType<typeof setTimeout> | null>();\n const scrollCounter = useRef<number>(0);\n\n const initializeScrollingTimer = () => {\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n if (scrollTimer.current) {\n clearTimeout(scrollTimer.current);\n }\n scrollTimer.current = setTimeout(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n };\n\n useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex]);\n\n const batchUpdateNewIndex = (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n };\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n\n // Grab latest entry that is intersecting\n const latestEntry =\n entries.length === 1\n ? entries[0]\n : entries\n .sort((entry1, entry2) => entry2.time - entry1.time)\n .find(entry => {\n return entry.intersectionRatio > 0;\n });\n\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n const bufferedIndex = Math.max(startIndex - bufferCount, 0);\n\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n\n if (actualIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n },\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const findIndexRecursive = (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n };\n\n const getIndexFromSizeArray = (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n };\n\n const getIndexFromScrollPosition = (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n };\n\n const calculateTotalSize = useCallback(() => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems]);\n\n const calculateBefore = useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * itemSize;\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems]);\n\n const calculateAfter = useCallback(() => {\n if (numItems === 0) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength]);\n\n const updateChildRows = useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderVirtualizerChildPlaceholder(renderChild(i, isScrolling), i);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const setBeforeRef = useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const updateCurrentItemSizes = (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const newSize = getItemSize(i);\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n };\n\n // Initialize the size array before first render.\n const hasInitialized = useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, updateChildRows]);\n\n useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize]);\n\n // Effect to check flag index on updates\n useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n };\n}\n"],"names":["useEffect","useRef","useCallback","useReducer","useImperativeHandle","useState","useIntersectionObserver","resolveShorthand","flushSync","useVirtualizerContextState_unstable","renderVirtualizerChildPlaceholder","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","scrollViewRef","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","_virtualizerContext","flaggedIndex","actualIndex","contextIndex","setActualIndex","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","horizontal","populateSizeArrays","current","length","index","isScrolling","setIsScrolling","scrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","clearTimeout","setTimeout","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","currentIndex","lastItemIndex","remainingItems","newIndex","_actualIndex","end","i","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","progressiveSizes","nodeSizes","setFlaggedIndex","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"mappings":"AAGA,SAASA,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,UAAU,EAAEC,mBAAmB,EAAEC,QAAQ,QAAQ,QAAQ;AAClG,SAASC,uBAAuB,QAAQ,sCAAsC;AAC9E,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,mCAAmC,QAAQ,kBAAkB;AACtE,SAASC,iCAAiC,QAAQ,sBAAsB;AAExE,OAAO,SAASC,wBAAwBC,KAAuB,EAAoB;IACjF,MAAM,EACJC,SAAQ,EACRC,SAAQ,EACRC,kBAAiB,EACjBC,UAAUC,YAAW,EACrBC,YAAW,EACXC,aAAcC,KAAKC,KAAK,CAACN,oBAAoB,KAAI,EACjDO,YAAaF,KAAKG,KAAK,CAACJ,cAAc,OAAON,SAAQ,EACrDW,cAAa,EACbC,MAAO,WAAU,EACjBC,UAAW,KAAK,CAAA,EAChBC,mBAAkB,EAClBC,uBAAsB,EACtBC,yBAAwB,EACzB,GAAGjB;IAEJ,iHAAiH,GACjH,MAAMkB,sBA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IAED,iDAAiD;IACjD,MAAMiF,aAAazG,KAAKqE,GAAG,CAAC1E,mBAAmBD;IAC/C,IAAI2B,WAAWI,OAAO,CAACC,MAAM,KAAK+E,cAAc7F,cAAcS,WAAWI,OAAO,CAACC,MAAM,GAAGhC,UAAU;QAClG4C,gBAAgB1B;IAClB,CAAC;IAED,MAAM8F,qBAAqBN,eAAe3E,OAAO,IAAIb,eAAe;IACpE,OAAO;QACL+F,YAAY;YACVC,QAAQ;YACRC,OAAO;YACPC,iBAAiB;YACjBC,gBAAgB;QAClB;QACAC,qBAAqB3F,WAAWI,OAAO;QACvCmF,QAAQzH,iBAAiBK,MAAMoH,MAAM,EAAE;YACrCK,UAAU,IAAI;YACdC,cAAc;gBACZC,KAAKxB;gBACLyB,MAAM;YACR;QACF;QACAP,OAAO1H,iBAAiBK,MAAMqH,KAAK,EAAE;YACnCI,UAAU,IAAI;YACdC,cAAc;gBACZC,KAAKpB;gBACLqB,MAAM;YACR;QACF;QACAN,iBAAiB3H,iBAAiBK,MAAMsH,eAAe,EAAE;YACvDG,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAL,gBAAgB5H,iBAAiBK,MAAMuH,cAAc,EAAE;YACrDE,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAC,oBAAoBX,qBAAqB5C,oBAAoB,CAAC;QAC9DwD,mBAAmBZ,qBAAqBpD,mBAAmB,CAAC;QAC5DiE,wBAAwBb,qBAAqBnD,uBAAuB5D,oBAAoBF,QAAQ;QAChG+H,uBAAuB5G;QACvBP;QACAH;QACAI;IACF;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VirtualizerScrollView.ts"],"sourcesContent":["import { VirtualizerScrollViewProps } from './VirtualizerScrollView.types';\nimport { useVirtualizerScrollView_unstable } from './useVirtualizerScrollView';\nimport { renderVirtualizerScrollView_unstable } from './renderVirtualizerScrollView';\nimport { useVirtualizerScrollViewStyles_unstable } from './useVirtualizerScrollViewStyles.styles';\nimport * as React from 'react';\n\n/**\n * Virtualizer ScrollView\n */\n\nexport const VirtualizerScrollView: React.FC<VirtualizerScrollViewProps> = (props: VirtualizerScrollViewProps) => {\n const state = useVirtualizerScrollView_unstable(props);\n\n useVirtualizerScrollViewStyles_unstable(state);\n\n return renderVirtualizerScrollView_unstable(state);\n};\n\nVirtualizerScrollView.displayName = 'VirtualizerScrollView';\n"],"names":["useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","React","VirtualizerScrollView","props","state","displayName"],"mappings":"AACA,SAASA,iCAAiC,QAAQ,6BAA6B;AAC/E,SAASC,oCAAoC,QAAQ,gCAAgC;AACrF,SAASC,uCAAuC,QAAQ,0CAA0C;AAClG,YAAYC,WAAW,QAAQ;AAE/B;;CAEC,GAED,OAAO,MAAMC,wBAA8D,CAACC,QAAsC;IAChH,MAAMC,QAAQN,kCAAkCK;IAEhDH,wCAAwCI;IAExC,OAAOL,qCAAqCK;AAC9C,EAAE;AAEFF,sBAAsBG,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["VirtualizerScrollView.ts"],"sourcesContent":["import type { VirtualizerScrollViewProps } from './VirtualizerScrollView.types';\nimport { useVirtualizerScrollView_unstable } from './useVirtualizerScrollView';\nimport { renderVirtualizerScrollView_unstable } from './renderVirtualizerScrollView';\nimport { useVirtualizerScrollViewStyles_unstable } from './useVirtualizerScrollViewStyles.styles';\nimport * as React from 'react';\n\n/**\n * Virtualizer ScrollView\n */\n\nexport const VirtualizerScrollView: React.FC<VirtualizerScrollViewProps> = (props: VirtualizerScrollViewProps) => {\n const state = useVirtualizerScrollView_unstable(props);\n\n useVirtualizerScrollViewStyles_unstable(state);\n\n return renderVirtualizerScrollView_unstable(state);\n};\n\nVirtualizerScrollView.displayName = 'VirtualizerScrollView';\n"],"names":["useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","React","VirtualizerScrollView","props","state","displayName"],"mappings":"AACA,SAASA,iCAAiC,QAAQ,6BAA6B;AAC/E,SAASC,oCAAoC,QAAQ,gCAAgC;AACrF,SAASC,uCAAuC,QAAQ,0CAA0C;AAClG,YAAYC,WAAW,QAAQ;AAE/B;;CAEC,GAED,OAAO,MAAMC,wBAA8D,CAACC,QAAsC;IAChH,MAAMC,QAAQN,kCAAkCK;IAEhDH,wCAAwCI;IAExC,OAAOL,qCAAqCK;AAC9C,EAAE;AAEFF,sBAAsBG,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VirtualizerScrollView.types.ts"],"sourcesContent":["import { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport {\n VirtualizerSlots,\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nexport type VirtualizerScrollViewSlots = VirtualizerSlots & {\n /**\n * The root container that provides embedded scrolling.\n */\n container: NonNullable<Slot<'div'>>;\n};\n\nexport type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> &\n Partial
|
|
1
|
+
{"version":3,"sources":["VirtualizerScrollView.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type {\n VirtualizerSlots,\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\nimport type { ScrollToInterface } from '../../Utilities';\nimport type { RefObject } from 'react';\n\nexport type VirtualizerScrollViewSlots = VirtualizerSlots & {\n /**\n * The root container that provides embedded scrolling.\n */\n container: NonNullable<Slot<'div'>>;\n};\n\nexport type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> &\n Partial<\n Omit<\n VirtualizerConfigProps,\n 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'imperativeVirtualizerRef'\n >\n > & {\n /**\n * Virtualizer item size in pixels - static.\n * Axis: 'vertical' = Height\n * Axis: 'horizontal' = Width\n */\n itemSize: number;\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\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 */\n children: VirtualizerChildRenderFunction;\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeRef?: RefObject<ScrollToInterface>;\n };\n\nexport type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;\n"],"names":[],"mappings":"AAAA,WA8C6G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderVirtualizerScrollView.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["renderVirtualizerScrollView.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport type { VirtualizerScrollViewSlots, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollView_unstable = (state: VirtualizerScrollViewState) => {\n const { slots, slotProps } = getSlotsNext<VirtualizerScrollViewSlots>(state);\n\n return <slots.container {...slotProps.container}>{renderVirtualizer_unstable(state)}</slots.container>;\n};\n"],"names":["createElement","getSlotsNext","renderVirtualizer_unstable","renderVirtualizerScrollView_unstable","state","slots","slotProps","container"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAI5D,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E,OAAO,MAAMC,uCAAuC,CAACC,QAAsC;IACzF,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGL,aAAyCG;IAEtE,qBAAO,AAZT,cAYUC,MAAME,SAAS,EAAKD,UAAUC,SAAS,EAAGL,2BAA2BE;AAC/E,EAAE"}
|