@fluentui/react-virtualizer 9.0.0-alpha.85 → 9.0.0-alpha.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -2
- package/dist/index.d.ts +7 -4
- package/lib/Hooks.js.map +1 -1
- package/lib/Utilities.js.map +1 -1
- package/lib/Virtualizer.js.map +1 -1
- package/lib/VirtualizerScrollView.js.map +1 -1
- package/lib/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/index.js.map +1 -1
- package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +24 -15
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js +1 -2
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib/components/VirtualizerScrollView/index.js.map +1 -1
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -2
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/index.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +5 -3
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -2
- package/lib/hooks/hooks.types.js.map +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useDynamicPagination.js.map +1 -1
- package/lib/hooks/useDynamicVirtualizerMeasure.js +17 -10
- package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useMeasureList.js.map +1 -1
- package/lib/hooks/useMutationObserver.js.map +1 -1
- package/lib/hooks/useResizeObserverRef.js.map +1 -1
- package/lib/hooks/useStaticPagination.js.map +1 -1
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/index.js.map +1 -1
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js +1 -5
- package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -1
- package/lib/utilities/VirtualizerContext/index.js.map +1 -1
- package/lib/utilities/VirtualizerContext/types.js.map +1 -1
- package/lib/utilities/createResizeObserverFromDocument.js.map +1 -1
- package/lib/utilities/debounce.js.map +1 -1
- package/lib/utilities/index.js.map +1 -1
- package/lib-commonjs/Hooks.js.map +1 -1
- package/lib-commonjs/Utilities.js.map +1 -1
- package/lib-commonjs/Virtualizer.js.map +1 -1
- package/lib-commonjs/VirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +24 -15
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +5 -3
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -1
- package/lib-commonjs/hooks/hooks.types.js.map +1 -1
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +17 -9
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useMeasureList.js.map +1 -1
- package/lib-commonjs/hooks/useMutationObserver.js.map +1 -1
- package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
- package/lib-commonjs/hooks/useStaticPagination.js.map +1 -1
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -1
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +1 -5
- package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -1
- package/lib-commonjs/utilities/VirtualizerContext/index.js.map +1 -1
- package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -1
- package/lib-commonjs/utilities/createResizeObserverFromDocument.js.map +1 -1
- package/lib-commonjs/utilities/debounce.js.map +1 -1
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/package.json +5 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-virtualizer
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 11 Nov 2024 09:55:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-alpha.87](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.87)
|
|
8
|
+
|
|
9
|
+
Mon, 11 Nov 2024 09:55:03 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.86..@fluentui/react-virtualizer_v9.0.0-alpha.87)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- fix: Enable virtualizer to fall back to most recent IO event if none intersecting ([PR #33125](https://github.com/microsoft/fluentui/pull/33125) by mifraser@microsoft.com)
|
|
15
|
+
- chore: replace npm-scripts and just-scrtips with nx inferred tasks ([PR #33074](https://github.com/microsoft/fluentui/pull/33074) by martinhochel@microsoft.com)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.46 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
17
|
+
- Bump @fluentui/react-utilities to v9.18.17 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
18
|
+
- Bump @fluentui/react-shared-contexts to v9.21.0 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
19
|
+
|
|
20
|
+
## [9.0.0-alpha.86](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.86)
|
|
21
|
+
|
|
22
|
+
Tue, 15 Oct 2024 17:17:53 GMT
|
|
23
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.85..@fluentui/react-virtualizer_v9.0.0-alpha.86)
|
|
24
|
+
|
|
25
|
+
### Changes
|
|
26
|
+
|
|
27
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.45 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
|
|
28
|
+
- Bump @fluentui/react-utilities to v9.18.16 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
|
|
29
|
+
- Bump @fluentui/react-shared-contexts to v9.20.2 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
|
|
30
|
+
|
|
7
31
|
## [9.0.0-alpha.85](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.85)
|
|
8
32
|
|
|
9
|
-
Thu, 26 Sep 2024 14:
|
|
33
|
+
Thu, 26 Sep 2024 14:15:28 GMT
|
|
10
34
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.84..@fluentui/react-virtualizer_v9.0.0-alpha.85)
|
|
11
35
|
|
|
12
36
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export declare const useDynamicVirtualizerMeasure: <TElement extends HTMLElement
|
|
|
71
71
|
bufferSize: number;
|
|
72
72
|
scrollRef: (instance: TElement | null) => void;
|
|
73
73
|
containerSizeRef: React_2.RefObject<number>;
|
|
74
|
+
updateScrollPosition: (scrollPosition: number) => void;
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -204,8 +205,7 @@ declare type VirtualizerConfigProps = {
|
|
|
204
205
|
bufferSize?: number;
|
|
205
206
|
/**
|
|
206
207
|
* Enables users to override the intersectionObserverRoot.
|
|
207
|
-
*
|
|
208
|
-
* when overlapping with other scroll views
|
|
208
|
+
* We recommend passing this in for accurate distance assessment in IO
|
|
209
209
|
*/
|
|
210
210
|
scrollViewRef?: React_2.MutableRefObject<HTMLElement | null>;
|
|
211
211
|
/**
|
|
@@ -246,6 +246,11 @@ declare type VirtualizerConfigProps = {
|
|
|
246
246
|
* Virtualizer Measure hooks provide a suitable reference.
|
|
247
247
|
*/
|
|
248
248
|
containerSizeRef: RefObject<number>;
|
|
249
|
+
/**
|
|
250
|
+
* A callback that enables updating scroll position for calculating required dynamic lengths,
|
|
251
|
+
* this should be passed in from useDynamicVirtualizerMeasure
|
|
252
|
+
*/
|
|
253
|
+
updateScrollPosition?: (position: number) => void;
|
|
249
254
|
};
|
|
250
255
|
|
|
251
256
|
declare type VirtualizerConfigState = {
|
|
@@ -304,8 +309,6 @@ declare type VirtualizerConfigState = {
|
|
|
304
309
|
export declare type VirtualizerContextProps = {
|
|
305
310
|
contextIndex: number;
|
|
306
311
|
setContextIndex: (index: number) => void;
|
|
307
|
-
contextPosition?: number;
|
|
308
|
-
setContextPosition?: (index: number) => void;
|
|
309
312
|
childProgressiveSizes?: React_2.MutableRefObject<number[]>;
|
|
310
313
|
};
|
|
311
314
|
|
package/lib/Hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Hooks.ts"],"sourcesContent":["export * from './hooks/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,gBAAgB"}
|
|
1
|
+
{"version":3,"sources":["../src/Hooks.ts"],"sourcesContent":["export * from './hooks/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,gBAAgB"}
|
package/lib/Utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Utilities.ts"],"sourcesContent":["export * from './utilities/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oBAAoB"}
|
|
1
|
+
{"version":3,"sources":["../src/Utilities.ts"],"sourcesContent":["export * from './utilities/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oBAAoB"}
|
package/lib/Virtualizer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,iCAAiC"}
|
|
1
|
+
{"version":3,"sources":["../src/Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VirtualizerScrollView.ts"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,2CAA2C"}
|
|
1
|
+
{"version":3,"sources":["../src/VirtualizerScrollView.ts"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,2CAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VirtualizerScrollViewDynamic.ts"],"sourcesContent":["export * from './components/VirtualizerScrollViewDynamic/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,kDAAkD"}
|
|
1
|
+
{"version":3,"sources":["../src/VirtualizerScrollViewDynamic.ts"],"sourcesContent":["export * from './components/VirtualizerScrollViewDynamic/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,kDAAkD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\nimport type { FC } from 'react';\n\n/**\n * Virtualizer pseudo-component, this functional wrapper\n * provides a simple interface for reducing the total number\n * of elements rendered at one time in large lists.\n */\nexport const Virtualizer: FC<VirtualizerProps> = (props: VirtualizerProps) => {\n const state = useVirtualizer_unstable(props);\n useVirtualizerStyles_unstable(state);\n\n return renderVirtualizer_unstable(state);\n};\n\nVirtualizer.displayName = 'Virtualizer';\n"],"names":["useVirtualizerStyles_unstable","useVirtualizer_unstable","renderVirtualizer_unstable","Virtualizer","props","state","displayName"],"rangeMappings":";;;;;;;;;;;;","mappings":"AACA,SAASA,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AAGjE;;;;CAIC,GACD,OAAO,MAAMC,cAAoC,CAACC;IAChD,MAAMC,QAAQJ,wBAAwBG;IACtCJ,8BAA8BK;IAE9B,OAAOH,2BAA2BG;AACpC,EAAE;AAEFF,YAAYG,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\nimport type { FC } from 'react';\n\n/**\n * Virtualizer pseudo-component, this functional wrapper\n * provides a simple interface for reducing the total number\n * of elements rendered at one time in large lists.\n */\nexport const Virtualizer: FC<VirtualizerProps> = (props: VirtualizerProps) => {\n const state = useVirtualizer_unstable(props);\n useVirtualizerStyles_unstable(state);\n\n return renderVirtualizer_unstable(state);\n};\n\nVirtualizer.displayName = 'Virtualizer';\n"],"names":["useVirtualizerStyles_unstable","useVirtualizer_unstable","renderVirtualizer_unstable","Virtualizer","props","state","displayName"],"rangeMappings":";;;;;;;;;;;;","mappings":"AACA,SAASA,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AAGjE;;;;CAIC,GACD,OAAO,MAAMC,cAAoC,CAACC;IAChD,MAAMC,QAAQJ,wBAAwBG;IACtCJ,8BAA8BK;IAE9B,OAAOH,2BAA2BG;AACpC,EAAE;AAEFF,YAAYG,WAAW,GAAG"}
|
|
@@ -1 +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 * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n /**\n * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n /**\n * Ref for access to internal size knowledge, can be used to measure updates\n */\n childSizes: React.MutableRefObject<number[]>;\n /**\n * Ref for access to internal progressive size knowledge, can be used to measure updates\n */\n childProgressiveSizes: React.MutableRefObject<number[]>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\n\n/**\n * The main child render method of Virtualization\n * isScrolling will only be enabled when enableScrollLoad is set to true.\n */\nexport type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: 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 (or 1/3rd for dynamic items) of virtualizerLength.\n * RECOMMEND: Override this with a consistent value if using a dynamic virtualizer.\n *\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the virtualizer only renders a few items outside of view.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems * itemSize size (in pixels).\n * RECOMMEND: Override this with a consistent minimum item size value if using a dynamic virtualizer.\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n *
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { VirtualizerContextProps } from '../../Utilities';\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 * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n /**\n * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n /**\n * Ref for access to internal size knowledge, can be used to measure updates\n */\n childSizes: React.MutableRefObject<number[]>;\n /**\n * Ref for access to internal progressive size knowledge, can be used to measure updates\n */\n childProgressiveSizes: React.MutableRefObject<number[]>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\n\n/**\n * The main child render method of Virtualization\n * isScrolling will only be enabled when enableScrollLoad is set to true.\n */\nexport type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: 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 (or 1/3rd for dynamic items) of virtualizerLength.\n * RECOMMEND: Override this with a consistent value if using a dynamic virtualizer.\n *\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the virtualizer only renders a few items outside of view.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems * itemSize size (in pixels).\n * RECOMMEND: Override this with a consistent minimum item size value if using a dynamic virtualizer.\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n * We recommend passing this in for accurate distance assessment in IO\n */\n scrollViewRef?: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n * This value should be flipped in RTL implementation (TBD whether automate RTL).\n */\n reversed?: boolean;\n\n /**\n * Enables the isScrolling property in the child render function\n * Default: false - to prevent nessecary render function calls\n */\n enableScrollLoad?: boolean;\n\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n */\n getItemSize?: (index: number) => number;\n\n /**\n * Virtualizer context can be passed as a prop for extended class use\n */\n virtualizerContext?: VirtualizerContextProps;\n\n /**\n * Callback for notifying when a flagged index has been rendered\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onRenderedFlaggedIndex?: (index: number) => void;\n\n /*\n * Callback for notifying when a flagged index has been rendered\n */\n flaggedIndex?: MutableRefObject<number | null>;\n\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;\n\n /**\n * A ref that provides the size of container (vertical - height, horizontal - width), set by a resize observer.\n * Virtualizer Measure hooks provide a suitable reference.\n */\n containerSizeRef: RefObject<number>;\n\n /**\n * A callback that enables updating scroll position for calculating required dynamic lengths,\n * this should be passed in from useDynamicVirtualizerMeasure\n */\n updateScrollPosition?: (position: number) => void;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,gCAAgC"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { ReactNode } from 'react';\n\nimport { assertSlots } from '@fluentui/react-utilities';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n assertSlots<VirtualizerSlots>(state);\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <state.beforeContainer>\n <state.before />\n </state.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <state.afterContainer>\n <state.after />\n </state.afterContainer>\n </React.Fragment>\n );\n};\n\nexport const renderVirtualizerChildPlaceholder = (child: ReactNode, index: number) => {\n return (\n <React.Suspense key={`fui-virtualizer-placeholder-${index}`} fallback={null}>\n {child}\n </React.Suspense>\n );\n};\n"],"names":["React","assertSlots","renderVirtualizer_unstable","state","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","renderVirtualizerChildPlaceholder","child","index","Suspense","fallback"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAI/B,SAASC,WAAW,QAAQ,4BAA4B;AAExD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAC9B,qBACE,MAACH,MAAMI,QAAQ;;0BAEb,KAACD,MAAME,eAAe;0BACpB,cAAA,KAACF,MAAMG,MAAM;;YAGdH,MAAMI,mBAAmB;0BAE1B,KAACJ,MAAMK,cAAc;0BACnB,cAAA,KAACL,MAAMM,KAAK;;;;AAIpB,EAAE;AAEF,OAAO,MAAMC,oCAAoC,CAACC,OAAkBC;IAClE,qBACE,KAACZ,MAAMa,QAAQ;QAA8CC,UAAU;kBACpEH;OADkB,CAAC,4BAA4B,EAAEC,MAAM,CAAC;AAI/D,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { ReactNode } from 'react';\n\nimport { assertSlots } from '@fluentui/react-utilities';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n assertSlots<VirtualizerSlots>(state);\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <state.beforeContainer>\n <state.before />\n </state.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <state.afterContainer>\n <state.after />\n </state.afterContainer>\n </React.Fragment>\n );\n};\n\nexport const renderVirtualizerChildPlaceholder = (child: ReactNode, index: number) => {\n return (\n <React.Suspense key={`fui-virtualizer-placeholder-${index}`} fallback={null}>\n {child}\n </React.Suspense>\n );\n};\n"],"names":["React","assertSlots","renderVirtualizer_unstable","state","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","renderVirtualizerChildPlaceholder","child","index","Suspense","fallback"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAI/B,SAASC,WAAW,QAAQ,4BAA4B;AAExD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAC9B,qBACE,MAACH,MAAMI,QAAQ;;0BAEb,KAACD,MAAME,eAAe;0BACpB,cAAA,KAACF,MAAMG,MAAM;;YAGdH,MAAMI,mBAAmB;0BAE1B,KAACJ,MAAMK,cAAc;0BACnB,cAAA,KAACL,MAAMM,KAAK;;;;AAIpB,EAAE;AAEF,OAAO,MAAMC,oCAAoC,CAACC,OAAkBC;IAClE,qBACE,KAACZ,MAAMa,QAAQ;QAA8CC,UAAU;kBACpEH;OADkB,CAAC,4BAA4B,EAAEC,MAAM,CAAC;AAI/D,EAAE"}
|
|
@@ -5,7 +5,7 @@ import { slot, useTimeout } from '@fluentui/react-utilities';
|
|
|
5
5
|
import { flushSync } from 'react-dom';
|
|
6
6
|
export function useVirtualizer_unstable(props) {
|
|
7
7
|
'use no memo';
|
|
8
|
-
const { itemSize, numItems, virtualizerLength, children: renderChild, getItemSize, bufferItems = Math.round(virtualizerLength / 4.0), bufferSize = Math.floor(bufferItems / 2.0) * itemSize, axis = 'vertical', reversed = false, virtualizerContext, onRenderedFlaggedIndex, imperativeVirtualizerRef, containerSizeRef, scrollViewRef, enableScrollLoad } = props;
|
|
8
|
+
const { itemSize, numItems, virtualizerLength, children: renderChild, getItemSize, bufferItems = Math.round(virtualizerLength / 4.0), bufferSize = Math.floor(bufferItems / 2.0) * itemSize, axis = 'vertical', reversed = false, virtualizerContext, onRenderedFlaggedIndex, imperativeVirtualizerRef, containerSizeRef, scrollViewRef, enableScrollLoad, updateScrollPosition } = 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
10
|
// We use this ref as a constant source to access the virtualizer's state imperatively
|
|
11
11
|
const actualIndexRef = useRef(_virtualizerContext.contextIndex);
|
|
@@ -255,12 +255,16 @@ export function useVirtualizer_unstable(props) {
|
|
|
255
255
|
// No-op
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return
|
|
258
|
+
if (entries.length === 0) {
|
|
259
|
+
// No entries found, return.
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
// Find the latest entry that is intersecting
|
|
263
|
+
const sortedEntries = entries.sort((entry1, entry2)=>entry2.time - entry1.time);
|
|
264
|
+
const latestEntry = sortedEntries.find((entry)=>{
|
|
265
|
+
return entry.isIntersecting;
|
|
261
266
|
});
|
|
262
|
-
if (!latestEntry
|
|
263
|
-
// If we don't find an intersecting area, ignore for now.
|
|
267
|
+
if (!latestEntry) {
|
|
264
268
|
return;
|
|
265
269
|
}
|
|
266
270
|
// We have to be sure our item sizes are up to date with current indexed ref before calculation
|
|
@@ -330,27 +334,32 @@ export function useVirtualizer_unstable(props) {
|
|
|
330
334
|
// Safety limits
|
|
331
335
|
const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);
|
|
332
336
|
flushSync(()=>{
|
|
333
|
-
|
|
337
|
+
// Callback to allow measure functions to check virtualizer length
|
|
338
|
+
if (newStartIndex + virtualizerLength >= numItems && actualIndex + virtualizerLength >= numItems) {
|
|
339
|
+
// We've already hit the end, no need to update state.
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
updateScrollPosition === null || updateScrollPosition === void 0 ? void 0 : updateScrollPosition(measurementPos);
|
|
334
343
|
if (actualIndex !== newStartIndex) {
|
|
335
344
|
batchUpdateNewIndex(newStartIndex);
|
|
336
345
|
}
|
|
337
346
|
});
|
|
338
347
|
}, [
|
|
339
|
-
_virtualizerContext,
|
|
340
348
|
actualIndex,
|
|
349
|
+
virtualizerLength,
|
|
341
350
|
axis,
|
|
342
|
-
|
|
343
|
-
|
|
351
|
+
reversed,
|
|
352
|
+
numItems,
|
|
344
353
|
bufferSize,
|
|
354
|
+
bufferItems,
|
|
355
|
+
containerSizeRef,
|
|
356
|
+
updateScrollPosition,
|
|
357
|
+
batchUpdateNewIndex,
|
|
345
358
|
calculateAfter,
|
|
346
359
|
calculateBefore,
|
|
347
360
|
calculateTotalSize,
|
|
348
|
-
containerSizeRef,
|
|
349
361
|
getIndexFromScrollPosition,
|
|
350
|
-
|
|
351
|
-
reversed,
|
|
352
|
-
updateCurrentItemSizes,
|
|
353
|
-
virtualizerLength
|
|
362
|
+
updateCurrentItemSizes
|
|
354
363
|
]), {
|
|
355
364
|
root: scrollViewRef ? scrollViewRef === null || scrollViewRef === void 0 ? void 0 : scrollViewRef.current : null,
|
|
356
365
|
rootMargin: '0px',
|
|
@@ -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, useImperativeHandle, useState, useReducer } from 'react';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\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 axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\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 const flaggedIndex = useRef<number | null>(null);\n\n const actualIndex = _virtualizerContext.contextIndex;\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\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 if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\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 if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\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 [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = useRef<number>(0);\n\n const initializeScrollingTimer = useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n return;\n }\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 clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\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] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = useCallback(\n (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 [getItemSize, numItems, virtualizerLength],\n );\n\n const batchUpdateNewIndex = useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = useCallback(\n (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 [actualIndex],\n );\n\n const getIndexFromSizeArray = useCallback(\n (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 [findIndexRecursive],\n );\n const getIndexFromScrollPosition = useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize],\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 // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\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 // 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 || !latestEntry.isIntersecting) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n\n flushSync(() => {\n _virtualizerContext.setContextPosition(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n _virtualizerContext,\n actualIndex,\n axis,\n batchUpdateNewIndex,\n bufferItems,\n bufferSize,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n containerSizeRef,\n getIndexFromScrollPosition,\n numItems,\n reversed,\n updateCurrentItemSizes,\n virtualizerLength,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\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 // 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 /*\n * forceUpdate:\n * We only want to trigger this when scrollLoading is enabled and set to false,\n * it will force re-render all children elements\n */\n const forceUpdate = useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n if (enableScrollLoad && !isScrolling) {\n forceUpdate();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\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: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\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 childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["useEffect","useRef","useCallback","useImperativeHandle","useState","useReducer","useIntersectionObserver","useVirtualizerContextState_unstable","slot","useTimeout","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","_virtualizerContext","actualIndexRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","isScrolling","setIsScrolling","setScrollTimer","clearScrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","setObserverList","entries","observer","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","setContextPosition","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,IAAID,eAAe;IACpE,OAAO;QACLuG,YAAY;YACVC,QAAQ;YACRC,OAAO;YACPC,iBAAiB;YACjBC,gBAAgB;QAClB;QACAC,qBAAqBlG,WAAWT,OAAO;QACvCuG,QAAQpI,KAAKyI,MAAM,CAACrI,MAAMgI,MAAM,EAAE;YAChCM,cAAc;gBACZC,KAAKrB;gBACLsB,MAAM;YACR;YACAC,aAAa;QACf;QACAR,OAAOrI,KAAKyI,MAAM,CAACrI,MAAMiI,KAAK,EAAE;YAC9BK,cAAc;gBACZC,KAAKjB;gBACLkB,MAAM;YACR;YACAC,aAAa;QACf;QACAP,iBAAiBtI,KAAKyI,MAAM,CAACrI,MAAMkI,eAAe,EAAE;YAClDI,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAN,gBAAgBvI,KAAKyI,MAAM,CAACrI,MAAMmI,cAAc,EAAE;YAChDG,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAC,oBAAoBZ,qBAAqBtD,oBAAoB;QAC7DmE,mBAAmBb,qBAAqBpD,mBAAmB;QAC3DkE,wBAAwBd,qBAAqBvD,uBAAuBpE,oBAAoBF;QACxF4I,uBAAuBrH;QACvBZ;QACAF;QACAG;QACAkB;QACAE;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useEffect, useRef, useCallback, useImperativeHandle, useState, useReducer } from 'react';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\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 axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\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\n const flaggedIndex = useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = useRef<HTMLElement | 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 if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\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 if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\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 [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = useRef<number>(0);\n\n const initializeScrollingTimer = useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n return;\n }\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 clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\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] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = useCallback(\n (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 [getItemSize, numItems, virtualizerLength],\n );\n\n const batchUpdateNewIndex = useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = useCallback(\n (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 [actualIndex],\n );\n\n const getIndexFromSizeArray = useCallback(\n (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 [findIndexRecursive],\n );\n const getIndexFromScrollPosition = useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize],\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 // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n // eslint-disable-next-line no-restricted-globals\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 if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (newStartIndex + virtualizerLength >= numItems && actualIndex + virtualizerLength >= numItems) {\n // We've already hit the end, no need to update state.\n return;\n }\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\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 // 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 /*\n * forceUpdate:\n * We only want to trigger this when scrollLoading is enabled and set to false,\n * it will force re-render all children elements\n */\n const forceUpdate = useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n if (enableScrollLoad && !isScrolling) {\n forceUpdate();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\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: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\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 childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["useEffect","useRef","useCallback","useImperativeHandle","useState","useReducer","useIntersectionObserver","useVirtualizerContextState_unstable","slot","useTimeout","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","_virtualizerContext","actualIndexRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","isScrolling","setIsScrolling","setScrollTimer","clearScrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","setObserverList","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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MAAM,GAAGnC,UAAU;QAClG4C,gBAAgBrB;IAClB;IAEA,MAAMqG,qBAAqBP,eAAe7F,OAAO,IAAID,eAAe;IACpE,OAAO;QACLsG,YAAY;YACVC,QAAQ;YACRC,OAAO;YACPC,iBAAiB;YACjBC,gBAAgB;QAClB;QACAC,qBAAqBjG,WAAWT,OAAO;QACvCsG,QAAQpI,KAAKyI,MAAM,CAACrI,MAAMgI,MAAM,EAAE;YAChCM,cAAc;gBACZC,KAAKrB;gBACLsB,MAAM;YACR;YACAC,aAAa;QACf;QACAR,OAAOrI,KAAKyI,MAAM,CAACrI,MAAMiI,KAAK,EAAE;YAC9BK,cAAc;gBACZC,KAAKjB;gBACLkB,MAAM;YACR;YACAC,aAAa;QACf;QACAP,iBAAiBtI,KAAKyI,MAAM,CAACrI,MAAMkI,eAAe,EAAE;YAClDI,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAN,gBAAgBvI,KAAKyI,MAAM,CAACrI,MAAMmI,cAAc,EAAE;YAChDG,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAC,oBAAoBZ,qBAAqBrD,oBAAoB;QAC7DkE,mBAAmBb,qBAAqBnD,mBAAmB;QAC3DiE,wBAAwBd,qBAAqBtD,uBAAuBrE,oBAAoBF;QACxF4I,uBAAuBpH;QACvBb;QACAF;QACAG;QACAmB;QACAE;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
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"],"rangeMappings":";;;;;;;;;;;","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;IAC1E,MAAMC,QAAQN,kCAAkCK;IAEhDH,wCAAwCI;IAExC,OAAOL,qCAAqCK;AAC9C,EAAE;AAEFF,sBAAsBG,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollView/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"],"rangeMappings":";;;;;;;;;;;","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;IAC1E,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 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 * Imperative ref contains our scrollTo index functionality for user control.\n */\n enablePagination?: boolean;\n };\n\nexport type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;\n"],"names":[],"rangeMappings":"","mappings":"AAkDA,WAA6G"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollView/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 * Imperative ref contains our scrollTo index functionality for user control.\n */\n enablePagination?: boolean;\n };\n\nexport type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;\n"],"names":[],"rangeMappings":"","mappings":"AAkDA,WAA6G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './VirtualizerScrollView';\nexport * from './VirtualizerScrollView.types';\nexport * from './useVirtualizerScrollView';\nexport * from './renderVirtualizerScrollView';\nexport * from './useVirtualizerScrollViewStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,0BAA0B;AACxC,cAAc,gCAAgC;AAC9C,cAAc,6BAA6B;AAC3C,cAAc,gCAAgC;AAC9C,cAAc,0CAA0C"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollView/index.ts"],"sourcesContent":["export * from './VirtualizerScrollView';\nexport * from './VirtualizerScrollView.types';\nexport * from './useVirtualizerScrollView';\nexport * from './renderVirtualizerScrollView';\nexport * from './useVirtualizerScrollViewStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,0BAA0B;AACxC,cAAc,gCAAgC;AAC9C,cAAc,6BAA6B;AAC3C,cAAc,gCAAgC;AAC9C,cAAc,0CAA0C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderVirtualizerScrollView.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport type { VirtualizerScrollViewSlots, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollView_unstable = (state: VirtualizerScrollViewState) => {\n assertSlots<VirtualizerScrollViewSlots>(state);\n\n return <state.container>{renderVirtualizer_unstable(state)}</state.container>;\n};\n"],"names":["assertSlots","renderVirtualizer_unstable","renderVirtualizerScrollView_unstable","state","container"],"rangeMappings":";;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAIjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E,OAAO,MAAMC,uCAAuC,CAACC;IACnDH,YAAwCG;IAExC,qBAAO,KAACA,MAAMC,SAAS;kBAAEH,2BAA2BE;;AACtD,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollView/renderVirtualizerScrollView.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport type { VirtualizerScrollViewSlots, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollView_unstable = (state: VirtualizerScrollViewState) => {\n assertSlots<VirtualizerScrollViewSlots>(state);\n\n return <state.container>{renderVirtualizer_unstable(state)}</state.container>;\n};\n"],"names":["assertSlots","renderVirtualizer_unstable","renderVirtualizerScrollView_unstable","state","container"],"rangeMappings":";;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAIjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E,OAAO,MAAMC,uCAAuC,CAACC;IACnDH,YAAwCG;IAExC,qBAAO,KAACA,MAAMC,SAAS;kBAAEH,2BAA2BE;;AACtD,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useVirtualizerScrollView.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot, 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';\nimport { useStaticVirtualizerPagination } from '../../hooks/useStaticPagination';\n\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { imperativeRef, itemSize, numItems, axis = 'vertical', reversed, enablePagination = false } = props;\n const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef } = 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\n const paginationRef = useStaticVirtualizerPagination({ axis, itemSize }, enablePagination);\n const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef) 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 onRenderedFlaggedIndex: handleRenderedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: slot.always(props.container, {\n defaultProps: {\n ref: scrollViewRef as React.RefObject<HTMLDivElement>,\n },\n elementType: 'div',\n }),\n };\n}\n"],"names":["React","slot","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","useImperativeHandle","scrollToItemStatic","useStaticVirtualizerPagination","useVirtualizerScrollView_unstable","props","imperativeRef","itemSize","numItems","axis","reversed","enablePagination","virtualizerLength","bufferItems","bufferSize","scrollRef","containerSizeRef","defaultItemSize","direction","virtualizerLengthRef","useRef","current","paginationRef","scrollViewRef","imperativeVirtualizerRef","scrollCallbackRef","scrollTo","index","behavior","callback","setFlaggedIndex","totalItems","currentIndex","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","components","container","always","defaultProps","ref","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,uBAAuB,QAAQ,gCAAgC;AAExE,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,mBAAmB,QAAQ,QAAQ;AAC5C,SAASC,kBAAkB,QAAQ,kBAAkB;AAErD,SAASC,8BAA8B,QAAQ,kCAAkC;AAEjF,OAAO,SAASC,kCAAkCC,KAAiC;IACjF,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,UAAU,EAAEC,QAAQ,EAAEC,mBAAmB,KAAK,EAAE,GAAGN;QAGxFA;IAFb,MAAM,EAAEO,iBAAiB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,gBAAgB,EAAE,GAAGhB,4BAA4B;QAC9GiB,iBAAiBZ,MAAME,QAAQ;QAC/BW,WAAWb,CAAAA,cAAAA,MAAMI,IAAI,cAAVJ,yBAAAA,cAAc;IAC3B;IAEA,kEAAkE;IAClE,MAAMc,uBAAuBvB,MAAMwB,MAAM,CAASR;IAClD,IAAIO,qBAAqBE,OAAO,KAAKT,mBAAmB;QACtDO,qBAAqBE,OAAO,GAAGT;IACjC;IAEA,MAAMU,gBAAgBnB,+BAA+B;QAAEM;QAAMF;IAAS,GAAGI;IACzE,MAAMY,gBAAgBzB,cAAcO,MAAMkB,aAAa,EAAER,WAAWO;IACpE,MAAME,2BAA2B5B,MAAMwB,MAAM,CAA4B;IACzE,MAAMK,oBAAoB7B,MAAMwB,MAAM,CAAmC;IAEzEnB,oBACEK,eACA;YAekBkB;QAdhB,OAAO;YACLE,UAASC,KAAa,EAAEC,WAAW,MAAM,EAAEC,QAA+C;oBAExFL;gBADAC,kBAAkBJ,OAAO,GAAGQ,qBAAAA,sBAAAA,WAAY;iBACxCL,oCAAAA,yBAAyBH,OAAO,cAAhCG,wDAAAA,kCAAkCM,eAAe,CAACH;gBAClDzB,mBAAmB;oBACjByB;oBACApB;oBACAwB,YAAYvB;oBACZe;oBACAd;oBACAC;oBACAkB;gBACF;YACF;YACAI,YAAY,GAAER,oCAAAA,yBAAyBH,OAAO,cAAhCG,wDAAAA,kCAAkCQ,YAAY;YAC5DpB,mBAAmBO;QACrB;IACF,GACA;QAACV;QAAMc;QAAehB;QAAUC;QAAUE;KAAS;IAGrD,MAAMuB,sBAAsB,CAACN;QAC3B,IAAIF,kBAAkBJ,OAAO,EAAE;YAC7BI,kBAAkBJ,OAAO,CAACM;QAC5B;IACF;IAEA,MAAMO,mBAAmBnC,wBAAwB;QAC/C,GAAGM,KAAK;QACRO;QACAC;QACAC;QACAqB,wBAAwBF;QACxBT;QACAR;IACF;IAEA,OAAO;QACL,GAAGkB,gBAAgB;QACnBE,YAAY;YACV,GAAGF,iBAAiBE,UAAU;YAC9BC,WAAW;QACb;QACAA,WAAWxC,KAAKyC,MAAM,CAACjC,MAAMgC,SAAS,EAAE;YACtCE,cAAc;gBACZC,KAAKjB;YACP;YACAkB,aAAa;QACf;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollView/useVirtualizerScrollView.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot, 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';\nimport { useStaticVirtualizerPagination } from '../../hooks/useStaticPagination';\n\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { imperativeRef, itemSize, numItems, axis = 'vertical', reversed, enablePagination = false } = props;\n const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef } = 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\n const paginationRef = useStaticVirtualizerPagination({ axis, itemSize }, enablePagination);\n const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef) 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 onRenderedFlaggedIndex: handleRenderedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: slot.always(props.container, {\n defaultProps: {\n ref: scrollViewRef as React.RefObject<HTMLDivElement>,\n },\n elementType: 'div',\n }),\n };\n}\n"],"names":["React","slot","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","useImperativeHandle","scrollToItemStatic","useStaticVirtualizerPagination","useVirtualizerScrollView_unstable","props","imperativeRef","itemSize","numItems","axis","reversed","enablePagination","virtualizerLength","bufferItems","bufferSize","scrollRef","containerSizeRef","defaultItemSize","direction","virtualizerLengthRef","useRef","current","paginationRef","scrollViewRef","imperativeVirtualizerRef","scrollCallbackRef","scrollTo","index","behavior","callback","setFlaggedIndex","totalItems","currentIndex","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","components","container","always","defaultProps","ref","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,uBAAuB,QAAQ,gCAAgC;AAExE,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,mBAAmB,QAAQ,QAAQ;AAC5C,SAASC,kBAAkB,QAAQ,kBAAkB;AAErD,SAASC,8BAA8B,QAAQ,kCAAkC;AAEjF,OAAO,SAASC,kCAAkCC,KAAiC;IACjF,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,UAAU,EAAEC,QAAQ,EAAEC,mBAAmB,KAAK,EAAE,GAAGN;QAGxFA;IAFb,MAAM,EAAEO,iBAAiB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,gBAAgB,EAAE,GAAGhB,4BAA4B;QAC9GiB,iBAAiBZ,MAAME,QAAQ;QAC/BW,WAAWb,CAAAA,cAAAA,MAAMI,IAAI,cAAVJ,yBAAAA,cAAc;IAC3B;IAEA,kEAAkE;IAClE,MAAMc,uBAAuBvB,MAAMwB,MAAM,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izerScrollViewStyles_unstable = state => {
|
|
|
43
43
|
// Add container styles
|
|
44
44
|
state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
|
|
45
45
|
return state;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=useVirtualizerScrollViewStyles.styles.js.map
|
|
46
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VirtualizerScrollViewDynamic.ts"],"sourcesContent":["import type { VirtualizerScrollViewDynamicProps } from './VirtualizerScrollViewDynamic.types';\nimport { useVirtualizerScrollViewDynamic_unstable } from './useVirtualizerScrollViewDynamic';\nimport { renderVirtualizerScrollViewDynamic_unstable } from './renderVirtualizerScrollViewDynamic';\nimport { useVirtualizerScrollViewDynamicStyles_unstable } from './useVirtualizerScrollViewDynamicStyles.styles';\nimport * as React from 'react';\nimport type { VirtualizerContextProps } from '../../Utilities';\n\n/**\n * Virtualizer ScrollView\n */\n\nexport const VirtualizerScrollViewDynamic: React.FC<VirtualizerScrollViewDynamicProps> = (\n props: VirtualizerScrollViewDynamicProps,\n context: React.Context<VirtualizerContextProps>,\n) => {\n const state = useVirtualizerScrollViewDynamic_unstable(props);\n\n useVirtualizerScrollViewDynamicStyles_unstable(state);\n\n return renderVirtualizerScrollViewDynamic_unstable(state);\n};\n\nVirtualizerScrollViewDynamic.displayName = 'VirtualizerScrollViewDynamic';\n"],"names":["useVirtualizerScrollViewDynamic_unstable","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable","React","VirtualizerScrollViewDynamic","props","context","state","displayName"],"rangeMappings":";;;;;;;;;;;","mappings":"AACA,SAASA,wCAAwC,QAAQ,oCAAoC;AAC7F,SAASC,2CAA2C,QAAQ,uCAAuC;AACnG,SAASC,8CAA8C,QAAQ,iDAAiD;AAChH,YAAYC,WAAW,QAAQ;AAG/B;;CAEC,GAED,OAAO,MAAMC,+BAA4E,CACvFC,OACAC;IAEA,MAAMC,QAAQP,yCAAyCK;IAEvDH,+CAA+CK;IAE/C,OAAON,4CAA4CM;AACrD,EAAE;AAEFH,6BAA6BI,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.ts"],"sourcesContent":["import type { VirtualizerScrollViewDynamicProps } from './VirtualizerScrollViewDynamic.types';\nimport { useVirtualizerScrollViewDynamic_unstable } from './useVirtualizerScrollViewDynamic';\nimport { renderVirtualizerScrollViewDynamic_unstable } from './renderVirtualizerScrollViewDynamic';\nimport { useVirtualizerScrollViewDynamicStyles_unstable } from './useVirtualizerScrollViewDynamicStyles.styles';\nimport * as React from 'react';\nimport type { VirtualizerContextProps } from '../../Utilities';\n\n/**\n * Virtualizer ScrollView\n */\n\nexport const VirtualizerScrollViewDynamic: React.FC<VirtualizerScrollViewDynamicProps> = (\n props: VirtualizerScrollViewDynamicProps,\n context: React.Context<VirtualizerContextProps>,\n) => {\n const state = useVirtualizerScrollViewDynamic_unstable(props);\n\n useVirtualizerScrollViewDynamicStyles_unstable(state);\n\n return renderVirtualizerScrollViewDynamic_unstable(state);\n};\n\nVirtualizerScrollViewDynamic.displayName = 'VirtualizerScrollViewDynamic';\n"],"names":["useVirtualizerScrollViewDynamic_unstable","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable","React","VirtualizerScrollViewDynamic","props","context","state","displayName"],"rangeMappings":";;;;;;;;;;;","mappings":"AACA,SAASA,wCAAwC,QAAQ,oCAAoC;AAC7F,SAASC,2CAA2C,QAAQ,uCAAuC;AACnG,SAASC,8CAA8C,QAAQ,iDAAiD;AAChH,YAAYC,WAAW,QAAQ;AAG/B;;CAEC,GAED,OAAO,MAAMC,+BAA4E,CACvFC,OACAC;IAEA,MAAMC,QAAQP,yCAAyCK;IAEvDH,+CAA+CK;IAE/C,OAAON,4CAA4CM;AACrD,EAAE;AAEFH,6BAA6BI,WAAW,GAAG"}
|
package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VirtualizerScrollViewDynamic.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type {\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nimport type { VirtualizerScrollViewSlots } from '../VirtualizerScrollView/VirtualizerScrollView.types';\nimport type { RefObject } from 'react';\nimport type { DynamicVirtualizerContextProps, ScrollToInterface } from '../../Utilities';\n\nexport type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;\n\nexport type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> &\n Partial<\n Omit<\n VirtualizerConfigProps,\n 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'virtualizerContext'\n >\n > & {\n /**\n * Set as the minimum item size.\n * Axis: 'vertical' = Height\n * Axis: 'horizontal' = Width\n */\n itemSize: number;\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n * If undefined, Virtualizer will auto-measure by default (performance tradeoff)\n */\n getItemSize?: (index: number) => 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 * Imperative ref contains our scrollTo index functionality for user control.\n */\n enablePagination?: boolean;\n /**\n * Enables override of dynamic virtualizer context if required.\n */\n virtualizerContext?: DynamicVirtualizerContextProps;\n };\n\nexport type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> &\n VirtualizerConfigState;\n"],"names":[],"rangeMappings":"","mappings":"AAwDA,WACyB"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type {\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nimport type { VirtualizerScrollViewSlots } from '../VirtualizerScrollView/VirtualizerScrollView.types';\nimport type { RefObject } from 'react';\nimport type { DynamicVirtualizerContextProps, ScrollToInterface } from '../../Utilities';\n\nexport type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;\n\nexport type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> &\n Partial<\n Omit<\n VirtualizerConfigProps,\n 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'virtualizerContext'\n >\n > & {\n /**\n * Set as the minimum item size.\n * Axis: 'vertical' = Height\n * Axis: 'horizontal' = Width\n */\n itemSize: number;\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n * If undefined, Virtualizer will auto-measure by default (performance tradeoff)\n */\n getItemSize?: (index: number) => 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 * Imperative ref contains our scrollTo index functionality for user control.\n */\n enablePagination?: boolean;\n /**\n * Enables override of dynamic virtualizer context if required.\n */\n virtualizerContext?: DynamicVirtualizerContextProps;\n };\n\nexport type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> &\n VirtualizerConfigState;\n"],"names":[],"rangeMappings":"","mappings":"AAwDA,WACyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './VirtualizerScrollViewDynamic';\nexport * from './VirtualizerScrollViewDynamic.types';\nexport * from './useVirtualizerScrollViewDynamic';\nexport * from './renderVirtualizerScrollViewDynamic';\nexport * from './useVirtualizerScrollViewDynamicStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,iCAAiC;AAC/C,cAAc,uCAAuC;AACrD,cAAc,oCAAoC;AAClD,cAAc,uCAAuC;AACrD,cAAc,iDAAiD"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/index.ts"],"sourcesContent":["export * from './VirtualizerScrollViewDynamic';\nexport * from './VirtualizerScrollViewDynamic.types';\nexport * from './useVirtualizerScrollViewDynamic';\nexport * from './renderVirtualizerScrollViewDynamic';\nexport * from './useVirtualizerScrollViewDynamicStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,iCAAiC;AAC/C,cAAc,uCAAuC;AACrD,cAAc,oCAAoC;AAClD,cAAc,uCAAuC;AACrD,cAAc,iDAAiD"}
|
package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderVirtualizerScrollViewDynamic.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport {\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollViewDynamic_unstable = (state: VirtualizerScrollViewDynamicState) => {\n assertSlots<VirtualizerScrollViewDynamicSlots>(state);\n return <state.container>{renderVirtualizer_unstable(state)}</state.container>;\n};\n"],"names":["assertSlots","renderVirtualizer_unstable","renderVirtualizerScrollViewDynamic_unstable","state","container"],"rangeMappings":";;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E,OAAO,MAAMC,8CAA8C,CAACC;IAC1DH,YAA+CG;IAC/C,qBAAO,KAACA,MAAMC,SAAS;kBAAEH,2BAA2BE;;AACtD,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport {\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollViewDynamic_unstable = (state: VirtualizerScrollViewDynamicState) => {\n assertSlots<VirtualizerScrollViewDynamicSlots>(state);\n return <state.container>{renderVirtualizer_unstable(state)}</state.container>;\n};\n"],"names":["assertSlots","renderVirtualizer_unstable","renderVirtualizerScrollViewDynamic_unstable","state","container"],"rangeMappings":";;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E,OAAO,MAAMC,8CAA8C,CAACC;IAC1DH,YAA+CG;IAC/C,qBAAO,KAACA,MAAMC,SAAS;kBAAEH,2BAA2BE;;AACtD,EAAE"}
|
|
@@ -29,7 +29,7 @@ export function useVirtualizerScrollViewDynamic_unstable(props) {
|
|
|
29
29
|
sizeUpdateCount
|
|
30
30
|
]);
|
|
31
31
|
var _props_axis, _props_getItemSize;
|
|
32
|
-
const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef } = useDynamicVirtualizerMeasure({
|
|
32
|
+
const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef, updateScrollPosition } = useDynamicVirtualizerMeasure({
|
|
33
33
|
defaultItemSize: props.itemSize,
|
|
34
34
|
direction: (_props_axis = props.axis) !== null && _props_axis !== void 0 ? _props_axis : 'vertical',
|
|
35
35
|
getItemSize: (_props_getItemSize = props.getItemSize) !== null && _props_getItemSize !== void 0 ? _props_getItemSize : getChildSizeAuto,
|
|
@@ -67,7 +67,7 @@ export function useVirtualizerScrollViewDynamic_unstable(props) {
|
|
|
67
67
|
index,
|
|
68
68
|
itemSizes: (_imperativeVirtualizerRef_current = _imperativeVirtualizerRef.current) === null || _imperativeVirtualizerRef_current === void 0 ? void 0 : _imperativeVirtualizerRef_current.nodeSizes,
|
|
69
69
|
totalSize,
|
|
70
|
-
scrollViewRef,
|
|
70
|
+
scrollViewRef: scrollViewRef,
|
|
71
71
|
axis,
|
|
72
72
|
reversed,
|
|
73
73
|
behavior
|
|
@@ -98,7 +98,9 @@ export function useVirtualizerScrollViewDynamic_unstable(props) {
|
|
|
98
98
|
virtualizerContext: contextState,
|
|
99
99
|
imperativeVirtualizerRef: _imperativeVirtualizerRef,
|
|
100
100
|
onRenderedFlaggedIndex: handleRenderedIndex,
|
|
101
|
-
containerSizeRef
|
|
101
|
+
containerSizeRef,
|
|
102
|
+
scrollViewRef,
|
|
103
|
+
updateScrollPosition
|
|
102
104
|
});
|
|
103
105
|
const measureObject = useMeasureList(virtualizerState.virtualizerStartIndex, virtualizerLength, props.numItems, props.itemSize);
|
|
104
106
|
if (enablePagination && measureObject.sizeUpdateCount !== sizeUpdateCount) {
|