@fluentui/react-virtualizer 9.0.0-alpha.26 → 9.0.0-alpha.28
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 +60 -3
- package/CHANGELOG.md +24 -4
- package/dist/index.d.ts +3 -0
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +15 -6
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js +2 -2
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +9 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +2 -4
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +9 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +2 -3
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -1
- package/lib/hooks/useDynamicVirtualizerMeasure.js +2 -2
- package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +15 -6
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +2 -2
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +9 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -4
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +9 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -3
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +2 -2
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,64 @@
|
|
|
2
2
|
"name": "@fluentui/react-virtualizer",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Mon,
|
|
5
|
+
"date": "Mon, 17 Jul 2023 21:26:51 GMT",
|
|
6
|
+
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.28",
|
|
7
|
+
"version": "9.0.0-alpha.28",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "mifraser@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-virtualizer",
|
|
13
|
+
"commit": "2971c4f9e3273db1e46e14c424ec32db0f67f8d5",
|
|
14
|
+
"comment": "Feat: Add imperative ref access to both virtualizer length and current index"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Thu, 13 Jul 2023 21:25:48 GMT",
|
|
21
|
+
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.27",
|
|
22
|
+
"version": "9.0.0-alpha.27",
|
|
23
|
+
"comments": {
|
|
24
|
+
"none": [
|
|
25
|
+
{
|
|
26
|
+
"author": "martinhochel@microsoft.com",
|
|
27
|
+
"package": "@fluentui/react-virtualizer",
|
|
28
|
+
"commit": "8a9e1018f2abb2c7608c49d32acf44e93c43cba6",
|
|
29
|
+
"comment": "chore: update devDependencies to use * for inner workspace dependencies"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Tue, 11 Jul 2023 18:46:36 GMT",
|
|
36
|
+
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.27",
|
|
37
|
+
"version": "9.0.0-alpha.27",
|
|
38
|
+
"comments": {
|
|
39
|
+
"prerelease": [
|
|
40
|
+
{
|
|
41
|
+
"author": "mifraser@microsoft.com",
|
|
42
|
+
"package": "@fluentui/react-virtualizer",
|
|
43
|
+
"commit": "2fa67922261c28392dbe659fff44f3e86eff2efb",
|
|
44
|
+
"comment": "Fix: Ensure 'start buffer' is margin padded into the non-virtualized space on horizontal layouts"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-virtualizer",
|
|
49
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.11",
|
|
50
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-virtualizer",
|
|
55
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0",
|
|
56
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Mon, 03 Jul 2023 11:57:14 GMT",
|
|
6
63
|
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.26",
|
|
7
64
|
"version": "9.0.0-alpha.26",
|
|
8
65
|
"comments": {
|
|
@@ -11,13 +68,13 @@
|
|
|
11
68
|
"author": "beachball",
|
|
12
69
|
"package": "@fluentui/react-virtualizer",
|
|
13
70
|
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.10",
|
|
14
|
-
"commit": "
|
|
71
|
+
"commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
|
|
15
72
|
},
|
|
16
73
|
{
|
|
17
74
|
"author": "beachball",
|
|
18
75
|
"package": "@fluentui/react-virtualizer",
|
|
19
76
|
"comment": "Bump @fluentui/react-utilities to v9.10.1",
|
|
20
|
-
"commit": "
|
|
77
|
+
"commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
|
|
21
78
|
}
|
|
22
79
|
]
|
|
23
80
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-virtualizer
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 17 Jul 2023 21:26:51 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-alpha.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.28)
|
|
8
|
+
|
|
9
|
+
Mon, 17 Jul 2023 21:26:51 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.27..@fluentui/react-virtualizer_v9.0.0-alpha.28)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Feat: Add imperative ref access to both virtualizer length and current index ([PR #28450](https://github.com/microsoft/fluentui/pull/28450) by mifraser@microsoft.com)
|
|
15
|
+
|
|
16
|
+
## [9.0.0-alpha.27](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.27)
|
|
17
|
+
|
|
18
|
+
Tue, 11 Jul 2023 18:46:36 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.26..@fluentui/react-virtualizer_v9.0.0-alpha.27)
|
|
20
|
+
|
|
21
|
+
### Changes
|
|
22
|
+
|
|
23
|
+
- Fix: Ensure 'start buffer' is margin padded into the non-virtualized space on horizontal layouts ([PR #28437](https://github.com/microsoft/fluentui/pull/28437) by mifraser@microsoft.com)
|
|
24
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.11 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
25
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
26
|
+
|
|
7
27
|
## [9.0.0-alpha.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.26)
|
|
8
28
|
|
|
9
|
-
Mon, 03 Jul 2023 11:
|
|
29
|
+
Mon, 03 Jul 2023 11:57:14 GMT
|
|
10
30
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.25..@fluentui/react-virtualizer_v9.0.0-alpha.26)
|
|
11
31
|
|
|
12
32
|
### Changes
|
|
13
33
|
|
|
14
|
-
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.10 ([PR #
|
|
15
|
-
- Bump @fluentui/react-utilities to v9.10.1 ([PR #
|
|
34
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.10 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
|
|
35
|
+
- Bump @fluentui/react-utilities to v9.10.1 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
|
|
16
36
|
|
|
17
37
|
## [9.0.0-alpha.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.25)
|
|
18
38
|
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export declare interface ResizeCallbackWithRef {
|
|
|
25
25
|
|
|
26
26
|
export declare type ScrollToInterface = {
|
|
27
27
|
scrollTo: (index: number, behavior?: ScrollBehavior, callback?: (index: number) => void) => void;
|
|
28
|
+
virtualizerLength: RefObject<number>;
|
|
29
|
+
currentIndex: RefObject<number> | undefined;
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
export declare const scrollToItemDynamic: (params: ScrollToItemDynamicParams) => void;
|
|
@@ -252,6 +254,7 @@ export declare type VirtualizerDataRef = {
|
|
|
252
254
|
progressiveSizes: RefObject<number[]>;
|
|
253
255
|
nodeSizes: RefObject<number[]>;
|
|
254
256
|
setFlaggedIndex: (index: number | null) => void;
|
|
257
|
+
currentIndex: RefObject<number>;
|
|
255
258
|
};
|
|
256
259
|
|
|
257
260
|
export declare type VirtualizerMeasureDynamicProps = {
|
|
@@ -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 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
|
+
{"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 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 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"}
|
|
@@ -7,6 +7,11 @@ import { renderVirtualizerChildPlaceholder } from './renderVirtualizer';
|
|
|
7
7
|
export function useVirtualizer_unstable(props) {
|
|
8
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
|
+
// We use this ref as a constant source to access the virtualizer's state imperatively
|
|
11
|
+
const actualIndexRef = useRef(_virtualizerContext.contextIndex);
|
|
12
|
+
if (actualIndexRef.current !== _virtualizerContext.contextIndex) {
|
|
13
|
+
actualIndexRef.current = _virtualizerContext.contextIndex;
|
|
14
|
+
}
|
|
10
15
|
const flaggedIndex = useRef(null);
|
|
11
16
|
const actualIndex = _virtualizerContext.contextIndex;
|
|
12
17
|
const setActualIndex = _virtualizerContext.setContextIndex;
|
|
@@ -75,6 +80,9 @@ export function useVirtualizer_unstable(props) {
|
|
|
75
80
|
// Local updates
|
|
76
81
|
updateChildRows(index);
|
|
77
82
|
updateCurrentItemSizes(index);
|
|
83
|
+
// Set before 'setActualIndex' call
|
|
84
|
+
// If it changes before render, or injected via context, re-render will update ref.
|
|
85
|
+
actualIndexRef.current = index;
|
|
78
86
|
// State setters
|
|
79
87
|
setActualIndex(index);
|
|
80
88
|
};
|
|
@@ -207,7 +215,7 @@ export function useVirtualizer_unstable(props) {
|
|
|
207
215
|
numItems
|
|
208
216
|
]);
|
|
209
217
|
const calculateBefore = useCallback(()=>{
|
|
210
|
-
const currentIndex = Math.min(actualIndex, numItems);
|
|
218
|
+
const currentIndex = Math.min(actualIndex, numItems - 1);
|
|
211
219
|
if (!getItemSize) {
|
|
212
220
|
// The missing items from before virtualization starts height
|
|
213
221
|
return currentIndex * itemSize;
|
|
@@ -224,17 +232,17 @@ export function useVirtualizer_unstable(props) {
|
|
|
224
232
|
numItems
|
|
225
233
|
]);
|
|
226
234
|
const calculateAfter = useCallback(()=>{
|
|
227
|
-
if (numItems === 0) {
|
|
235
|
+
if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {
|
|
228
236
|
return 0;
|
|
229
237
|
}
|
|
230
|
-
const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems
|
|
238
|
+
const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);
|
|
231
239
|
if (!getItemSize) {
|
|
232
240
|
// The missing items from after virtualization ends height
|
|
233
|
-
const remainingItems = numItems - lastItemIndex
|
|
241
|
+
const remainingItems = numItems - lastItemIndex;
|
|
234
242
|
return remainingItems * itemSize;
|
|
235
243
|
}
|
|
236
244
|
// Time for custom size calcs
|
|
237
|
-
return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];
|
|
245
|
+
return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];
|
|
238
246
|
}, [
|
|
239
247
|
actualIndex,
|
|
240
248
|
getItemSize,
|
|
@@ -328,7 +336,8 @@ export function useVirtualizer_unstable(props) {
|
|
|
328
336
|
return {
|
|
329
337
|
progressiveSizes: childProgressiveSizes,
|
|
330
338
|
nodeSizes: childSizes,
|
|
331
|
-
setFlaggedIndex: (index)=>flaggedIndex.current = index
|
|
339
|
+
setFlaggedIndex: (index)=>flaggedIndex.current = index,
|
|
340
|
+
currentIndex: actualIndexRef
|
|
332
341
|
};
|
|
333
342
|
}, [
|
|
334
343
|
childProgressiveSizes,
|
|
@@ -1 +1 @@
|
|
|
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,E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AAgBJ,CAAAA,aAAawB,WAAWO,OAAO,CAACC,MAAM,IAAIhC,aAAa0B,sBAAsBK,OAAO,CAACC,MAAM,AAAD,GAAI;QAChH,iDAAiD;QACjDF;IACF,CAAC;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
|
+
{"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 // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = useRef<number>(_virtualizerContext.contextIndex);\n if (actualIndexRef.current !== _virtualizerContext.contextIndex) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\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 // Set before 'setActualIndex' call\n // If it changes before render, or injected via context, re-render will update ref.\n actualIndexRef.current = 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 - 1);\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 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * itemSize;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\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 currentIndex: actualIndexRef,\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","actualIndexRef","contextIndex","current","flaggedIndex","actualIndex","setActualIndex","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","horizontal","populateSizeArrays","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,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QACAC,qBAAqB1F,WAAWV,OAAO;QACvCgG,QAAQ1H,iBAAiBK,MAAMqH,MAAM,EAAE;YACrCK,UAAU,IAAI;YACdC,cAAc;gBACZC,KAAKxB;gBACLyB,MAAM;YACR;QACF;QACAP,OAAO3H,iBAAiBK,MAAMsH,KAAK,EAAE;YACnCI,UAAU,IAAI;YACdC,cAAc;gBACZC,KAAKpB;gBACLqB,MAAM;YACR;QACF;QACAN,iBAAiB5H,iBAAiBK,MAAMuH,eAAe,EAAE;YACvDG,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAL,gBAAgB7H,iBAAiBK,MAAMwH,cAAc,EAAE;YACrDE,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAC,oBAAoBX,qBAAqB5C,oBAAoB,CAAC;QAC9DwD,mBAAmBZ,qBAAqBpD,mBAAmB,CAAC;QAC5DiE,wBAAwBb,qBAAqBnD,uBAAuB7D,oBAAoBF,QAAQ;QAChGgI,uBAAuB1G;QACvBV;QACAH;QACAI;IACF;AACF,CAAC"}
|
|
@@ -56,11 +56,11 @@ export const useVirtualizerStyles_unstable = state => {
|
|
|
56
56
|
}),
|
|
57
57
|
// Row
|
|
58
58
|
...(!reversed && horizontal && {
|
|
59
|
-
|
|
59
|
+
marginRight: `-${bufferPx}`
|
|
60
60
|
}),
|
|
61
61
|
// Row-Reverse
|
|
62
62
|
...(reversed && horizontal && {
|
|
63
|
-
|
|
63
|
+
marginLeft: `-${bufferPx}`
|
|
64
64
|
})
|
|
65
65
|
};
|
|
66
66
|
const afterBuffer = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","mc9l5x","Bkecrkj","relative","qhf8xq","horizontal","sshi5w","vertical","Bf4jedk","d","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","mc9l5x","Bkecrkj","relative","qhf8xq","horizontal","sshi5w","vertical","Bf4jedk","d","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginRight","marginLeft","afterBuffer","style","height","width"],"sources":["useVirtualizerStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerClassName = 'fui-Virtualizer';\nexport const virtualizerClassNames = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`\n};\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none'\n },\n relative: {\n position: 'relative'\n },\n horizontal: {\n minHeight: '100%'\n },\n vertical: {\n minWidth: '100%'\n }\n});\n/**\n * Apply styling to the Virtualizer states\n */ export const useVirtualizerStyles_unstable = (state)=>{\n const styles = useStyles();\n const { reversed , axis , beforeBufferHeight , afterBufferHeight , bufferSize } = state;\n const horizontal = axis === 'horizontal';\n state.before.className = mergeClasses(virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);\n state.after.className = mergeClasses(virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);\n state.beforeContainer.className = mergeClasses(virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);\n state.afterContainer.className = mergeClasses(virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n const beforeBuffer = {\n // Column\n ...!reversed && !horizontal && {\n marginBottom: `-${bufferPx}`\n },\n // Column-Reverse\n ...reversed && !horizontal && {\n marginTop: `-${bufferPx}`\n },\n // Row\n ...!reversed && horizontal && {\n marginRight: `-${bufferPx}`\n },\n // Row-Reverse\n ...reversed && horizontal && {\n marginLeft: `-${bufferPx}`\n }\n };\n const afterBuffer = {\n // Column\n ...!reversed && !horizontal && {\n marginTop: `-${bufferPx}`\n },\n // Column-Reverse\n ...reversed && !horizontal && {\n marginBottom: `-${bufferPx}`\n },\n // Row\n ...!reversed && horizontal && {\n marginLeft: `-${bufferPx}`\n },\n // Row-Reverse\n ...reversed && horizontal && {\n marginRight: `-${bufferPx}`\n }\n };\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style\n };\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style\n };\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style\n };\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style\n };\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,OAAO,MAAMC,qBAAqB,GAAG;EACjCC,MAAM,EAAG,GAAEF,oBAAqB,UAAS;EACzCG,eAAe,EAAG,GAAEH,oBAAqB,mBAAkB;EAC3DI,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,QAAS;IAC7B,CAAC;IACD;IACA,IAAGV,QAAQ,IAAIR,UAAU,IAAI;MACzBsB,WAAW,EAAG,IAAGJ,QAAS;IAC9B,CAAC;EACL,CAAC;EACDZ,KAAK,CAAChB,MAAM,CAACmC,KAAK,GAAG;IACjBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGgB,oBAAoB;IAClDW,KAAK,EAAE3B,UAAU,GAAGgB,oBAAoB,GAAG,MAAM;IACjD,GAAGG,YAAY;IACf,GAAGb,KAAK,CAAChB,MAAM,CAACmC;EACpB,CAAC;EACDnB,KAAK,CAACf,eAAe,CAACkC,KAAK,GAAG;IAC1BC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGc,cAAc;IAC5Ca,KAAK,EAAE3B,UAAU,GAAGc,cAAc,GAAG,MAAM;IAC3C,GAAGR,KAAK,CAACf,eAAe,CAACkC;EAC7B,CAAC;EACDnB,KAAK,CAACd,KAAK,CAACiC,KAAK,GAAG;IAChBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGiB,mBAAmB;IACjDU,KAAK,EAAE3B,UAAU,GAAGiB,mBAAmB,GAAG,MAAM;IAChD,GAAGO,WAAW;IACd,GAAGlB,KAAK,CAACd,KAAK,CAACiC;EACnB,CAAC;EACDnB,KAAK,CAACb,cAAc,CAACgC,KAAK,GAAG;IACzBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGe,aAAa;IAC3CY,KAAK,EAAE3B,UAAU,GAAGe,aAAa,GAAG,MAAM;IAC1C,GAAGT,KAAK,CAACb,cAAc,CAACgC;EAC5B,CAAC;EACD,OAAOnB,KAAK;AAChB,CAAC"}
|
|
@@ -11,10 +11,16 @@ export function useVirtualizerScrollView_unstable(props) {
|
|
|
11
11
|
defaultItemSize: props.itemSize,
|
|
12
12
|
direction: (_props_axis = props.axis) !== null && _props_axis !== void 0 ? _props_axis : 'vertical'
|
|
13
13
|
});
|
|
14
|
+
// Store the virtualizer length as a ref for imperative ref access
|
|
15
|
+
const virtualizerLengthRef = React.useRef(virtualizerLength);
|
|
16
|
+
if (virtualizerLengthRef.current !== virtualizerLength) {
|
|
17
|
+
virtualizerLengthRef.current = virtualizerLength;
|
|
18
|
+
}
|
|
14
19
|
const scrollViewRef = useMergedRefs(React.useRef(null), scrollRef);
|
|
15
20
|
const imperativeVirtualizerRef = React.useRef(null);
|
|
16
21
|
const scrollCallbackRef = React.useRef(null);
|
|
17
22
|
useImperativeHandle(imperativeRef, ()=>{
|
|
23
|
+
var _imperativeVirtualizerRef_current;
|
|
18
24
|
return {
|
|
19
25
|
scrollTo (index, behavior = 'auto', callback) {
|
|
20
26
|
var _imperativeVirtualizerRef_current;
|
|
@@ -29,7 +35,9 @@ export function useVirtualizerScrollView_unstable(props) {
|
|
|
29
35
|
reversed,
|
|
30
36
|
behavior
|
|
31
37
|
});
|
|
32
|
-
}
|
|
38
|
+
},
|
|
39
|
+
currentIndex: (_imperativeVirtualizerRef_current = imperativeVirtualizerRef.current) === null || _imperativeVirtualizerRef_current === void 0 ? void 0 : _imperativeVirtualizerRef_current.currentIndex,
|
|
40
|
+
virtualizerLength: virtualizerLengthRef
|
|
33
41
|
};
|
|
34
42
|
}, [
|
|
35
43
|
axis,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useVirtualizerScrollView.ts"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport type { VirtualizerScrollViewProps, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { useStaticVirtualizerMeasure } from '../../Hooks';\nimport { useImperativeHandle } from 'react';\nimport { scrollToItemStatic } from '../../Utilities';\nimport type { VirtualizerDataRef } from '../Virtualizer/Virtualizer.types';\n\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { imperativeRef, itemSize, numItems, axis = 'vertical', reversed } = props;\n const { virtualizerLength, bufferItems, bufferSize, scrollRef } = useStaticVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n });\n\n const scrollViewRef = useMergedRefs(React.useRef<HTMLDivElement>(null), scrollRef) as React.RefObject<HTMLDivElement>;\n const imperativeVirtualizerRef = React.useRef<VirtualizerDataRef | null>(null);\n const scrollCallbackRef = React.useRef<null | ((index: number) => void)>(null);\n\n useImperativeHandle(\n imperativeRef,\n () => {\n return {\n scrollTo(index: number, behavior = 'auto', callback: ((index: number) => void) | undefined) {\n scrollCallbackRef.current = callback ?? null;\n imperativeVirtualizerRef.current?.setFlaggedIndex(index);\n scrollToItemStatic({\n index,\n itemSize,\n totalItems: numItems,\n scrollViewRef,\n axis,\n reversed,\n behavior,\n });\n },\n };\n },\n [axis, scrollViewRef, itemSize, numItems, reversed],\n );\n\n const handleRenderedIndex = (index: number) => {\n if (scrollCallbackRef.current) {\n scrollCallbackRef.current(index);\n }\n };\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollViewRef,\n onRenderedFlaggedIndex: handleRenderedIndex,\n imperativeVirtualizerRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: resolveShorthand(props.container, {\n required: true,\n defaultProps: {\n ref: scrollViewRef as React.RefObject<HTMLDivElement>,\n },\n }),\n };\n}\n"],"names":["React","resolveShorthand","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","useImperativeHandle","scrollToItemStatic","useVirtualizerScrollView_unstable","props","imperativeRef","itemSize","numItems","axis","reversed","virtualizerLength","bufferItems","bufferSize","scrollRef","defaultItemSize","direction","
|
|
1
|
+
{"version":3,"sources":["useVirtualizerScrollView.ts"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport type { VirtualizerScrollViewProps, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { useStaticVirtualizerMeasure } from '../../Hooks';\nimport { useImperativeHandle } from 'react';\nimport { scrollToItemStatic } from '../../Utilities';\nimport type { VirtualizerDataRef } from '../Virtualizer/Virtualizer.types';\n\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { imperativeRef, itemSize, numItems, axis = 'vertical', reversed } = props;\n const { virtualizerLength, bufferItems, bufferSize, scrollRef } = useStaticVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n });\n\n // Store the virtualizer length as a ref for imperative ref access\n const virtualizerLengthRef = React.useRef<number>(virtualizerLength);\n if (virtualizerLengthRef.current !== virtualizerLength) {\n virtualizerLengthRef.current = virtualizerLength;\n }\n const scrollViewRef = useMergedRefs(React.useRef<HTMLDivElement>(null), scrollRef) as React.RefObject<HTMLDivElement>;\n const imperativeVirtualizerRef = React.useRef<VirtualizerDataRef | null>(null);\n const scrollCallbackRef = React.useRef<null | ((index: number) => void)>(null);\n\n useImperativeHandle(\n imperativeRef,\n () => {\n return {\n scrollTo(index: number, behavior = 'auto', callback: ((index: number) => void) | undefined) {\n scrollCallbackRef.current = callback ?? null;\n imperativeVirtualizerRef.current?.setFlaggedIndex(index);\n scrollToItemStatic({\n index,\n itemSize,\n totalItems: numItems,\n scrollViewRef,\n axis,\n reversed,\n behavior,\n });\n },\n currentIndex: imperativeVirtualizerRef.current?.currentIndex,\n virtualizerLength: virtualizerLengthRef,\n };\n },\n [axis, scrollViewRef, itemSize, numItems, reversed],\n );\n\n const handleRenderedIndex = (index: number) => {\n if (scrollCallbackRef.current) {\n scrollCallbackRef.current(index);\n }\n };\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollViewRef,\n onRenderedFlaggedIndex: handleRenderedIndex,\n imperativeVirtualizerRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: resolveShorthand(props.container, {\n required: true,\n defaultProps: {\n ref: scrollViewRef as React.RefObject<HTMLDivElement>,\n },\n }),\n };\n}\n"],"names":["React","resolveShorthand","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","useImperativeHandle","scrollToItemStatic","useVirtualizerScrollView_unstable","props","imperativeRef","itemSize","numItems","axis","reversed","virtualizerLength","bufferItems","bufferSize","scrollRef","defaultItemSize","direction","virtualizerLengthRef","useRef","current","scrollViewRef","imperativeVirtualizerRef","scrollCallbackRef","scrollTo","index","behavior","callback","setFlaggedIndex","totalItems","currentIndex","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","components","container","required","defaultProps","ref"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAC5E,SAASC,uBAAuB,QAAQ,gCAAgC;AAExE,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,mBAAmB,QAAQ,QAAQ;AAC5C,SAASC,kBAAkB,QAAQ,kBAAkB;AAGrD,OAAO,SAASC,kCAAkCC,KAAiC,EAA8B;IAC/G,MAAM,EAAEC,cAAa,EAAEC,SAAQ,EAAEC,SAAQ,EAAEC,MAAO,WAAU,EAAEC,SAAQ,EAAE,GAAGL;QAG9DA;IAFb,MAAM,EAAEM,kBAAiB,EAAEC,YAAW,EAAEC,WAAU,EAAEC,UAAS,EAAE,GAAGb,4BAA4B;QAC5Fc,iBAAiBV,MAAME,QAAQ;QAC/BS,WAAWX,CAAAA,cAAAA,MAAMI,IAAI,cAAVJ,yBAAAA,cAAc,UAAU;IACrC;IAEA,kEAAkE;IAClE,MAAMY,uBAAuBpB,MAAMqB,MAAM,CAASP;IAClD,IAAIM,qBAAqBE,OAAO,KAAKR,mBAAmB;QACtDM,qBAAqBE,OAAO,GAAGR;IACjC,CAAC;IACD,MAAMS,gBAAgBrB,cAAcF,MAAMqB,MAAM,CAAiB,IA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f1l02sjl"
|
|
13
|
-
Eiaeu8: "f1115ve7"
|
|
12
|
+
Bqenvij: "f1l02sjl"
|
|
14
13
|
},
|
|
15
14
|
vertical: {
|
|
16
15
|
Beiy3e4: "f1vx9l62",
|
|
17
|
-
Eiaeu8: "f1115ve7",
|
|
18
16
|
Bmxbyg5: "f5zp4f"
|
|
19
17
|
},
|
|
20
18
|
horizontal: {
|
|
@@ -30,7 +28,7 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
30
28
|
B68tc82: "f1oy3dpc"
|
|
31
29
|
}
|
|
32
30
|
}, {
|
|
33
|
-
d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".
|
|
31
|
+
d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f5zp4f{overflow-y:auto;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".f1oy3dpc{overflow-x:auto;}", ".f1gkdon0{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;}", ".f1oztnx0{-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;}"]
|
|
34
32
|
});
|
|
35
33
|
/**
|
|
36
34
|
* Apply styling to the Virtualizer states
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","
|
|
1
|
+
{"version":3,"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"sources":["useVirtualizerScrollViewStyles.styles.js"],"sourcesContent":["import { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\nexport const virtualizerScrollViewClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`\n};\nconst useStyles = makeStyles({\n base: {\n display: 'flex',\n width: '100%',\n height: '100%'\n },\n vertical: {\n flexDirection: 'column',\n overflowY: 'auto'\n },\n horizontal: {\n flexDirection: 'row',\n overflowX: 'auto'\n },\n verticalReversed: {\n flexDirection: 'column-reverse',\n overflowY: 'auto'\n },\n horizontalReversed: {\n flexDirection: 'row-reverse',\n overflowX: 'auto'\n }\n});\n/**\n * Apply styling to the Virtualizer states\n */ export const useVirtualizerScrollViewStyles_unstable = (state)=>{\n const styles = useStyles();\n // Default virtualizer styles base\n useVirtualizerStyles_unstable(state);\n const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;\n // Add container styles\n state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);\n return state;\n};\n"],"mappings":"AAAA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,4CAA4C;AACjH,SAAAC,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,8BAA8B,GAAG,6BAA6B;AACpE,OAAO,MAAMC,+BAA+B,GAAG;EAC3C,GAAGJ,qBAAqB;EACxBK,SAAS,EAAG,GAAEF,8BAA+B;AACjD,CAAC;AACD,MAAMG,SAAS,gBAAGL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,UAAA;IAAAF,OAAA;IAAAG,OAAA;EAAA;EAAAC,gBAAA;IAAAJ,OAAA;IAAAC,OAAA;EAAA;EAAAI,kBAAA;IAAAL,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAG,CAAA;AAAA,CAsBjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,uCAAuC,GAAIC,KAAK,IAAG;EAChE,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B;EACAP,6BAA6B,CAACqB,KAAK,CAAC;EACpC,MAAME,cAAc,GAAGF,KAAK,CAACG,IAAI,KAAK,YAAY,GAAGH,KAAK,CAACI,QAAQ,GAAGH,MAAM,CAACJ,kBAAkB,GAAGI,MAAM,CAACP,UAAU,GAAGM,KAAK,CAACI,QAAQ,GAAGH,MAAM,CAACL,gBAAgB,GAAGK,MAAM,CAACV,QAAQ;EAChL;EACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,GAAGvB,YAAY,CAACE,+BAA+B,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;EAC3I,OAAOL,KAAK;AAChB,CAAC"}
|
|
@@ -15,10 +15,16 @@ export function useVirtualizerScrollViewDynamic_unstable(props) {
|
|
|
15
15
|
currentIndex: (_contextState_contextIndex = contextState === null || contextState === void 0 ? void 0 : contextState.contextIndex) !== null && _contextState_contextIndex !== void 0 ? _contextState_contextIndex : 0,
|
|
16
16
|
numItems: props.numItems
|
|
17
17
|
});
|
|
18
|
+
// Store the virtualizer length as a ref for imperative ref access
|
|
19
|
+
const virtualizerLengthRef = React.useRef(virtualizerLength);
|
|
20
|
+
if (virtualizerLengthRef.current !== virtualizerLength) {
|
|
21
|
+
virtualizerLengthRef.current = virtualizerLength;
|
|
22
|
+
}
|
|
18
23
|
const scrollViewRef = useMergedRefs(React.useRef(null), scrollRef);
|
|
19
24
|
const scrollCallbackRef = React.useRef(null);
|
|
20
25
|
const _imperativeVirtualizerRef = useMergedRefs(React.useRef(null), imperativeVirtualizerRef);
|
|
21
26
|
useImperativeHandle(imperativeRef, ()=>{
|
|
27
|
+
var _imperativeVirtualizerRef_current;
|
|
22
28
|
return {
|
|
23
29
|
scrollTo (index, behavior = 'auto', callback) {
|
|
24
30
|
scrollCallbackRef.current = callback !== null && callback !== void 0 ? callback : null;
|
|
@@ -37,7 +43,9 @@ export function useVirtualizerScrollViewDynamic_unstable(props) {
|
|
|
37
43
|
behavior
|
|
38
44
|
});
|
|
39
45
|
}
|
|
40
|
-
}
|
|
46
|
+
},
|
|
47
|
+
currentIndex: (_imperativeVirtualizerRef_current = _imperativeVirtualizerRef.current) === null || _imperativeVirtualizerRef_current === void 0 ? void 0 : _imperativeVirtualizerRef_current.currentIndex,
|
|
48
|
+
virtualizerLength: virtualizerLengthRef
|
|
41
49
|
};
|
|
42
50
|
}, [
|
|
43
51
|
axis,
|