@fluentui/react-virtualizer 9.0.0-alpha.13 → 9.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +11 -2
- package/dist/index.d.ts +90 -27
- package/lib/VirtualizerScrollView.js +2 -0
- package/lib/VirtualizerScrollView.js.map +1 -0
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +10 -5
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +14 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +2 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib/components/VirtualizerScrollView/index.js +6 -0
- package/lib/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +11 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +38 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +46 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useIntersectionObserver.js +0 -8
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useVirtualizerMeasure.js +76 -0
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib/hooks/useVirtualizerMeasure.types.js +2 -0
- package/lib/hooks/useVirtualizerMeasure.types.js.map +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/utilities/debounce.js +20 -0
- package/lib/utilities/debounce.js.map +1 -0
- package/lib-commonjs/VirtualizerScrollView.js +9 -0
- package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +15 -5
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +21 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +7 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js +13 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +18 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +43 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +69 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -0
- package/lib-commonjs/hooks/index.js +1 -0
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useIntersectionObserver.js +0 -8
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useVirtualizerMeasure.js +75 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.types.js +7 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.types.js.map +1 -0
- package/lib-commonjs/index.js +8 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/debounce.js +29 -0
- package/lib-commonjs/utilities/debounce.js.map +1 -0
- package/package.json +2 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@fluentui/react-virtualizer",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 24 Mar 2023 10:15:03 GMT",
|
|
6
|
+
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.14",
|
|
7
|
+
"version": "9.0.0-alpha.14",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "mifraser@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-virtualizer",
|
|
13
|
+
"commit": "19801e7edc22f433eeace3cf636f4722ea02a36b",
|
|
14
|
+
"comment": "[feat] Add static measurement hooks and embedded scroll option"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 21 Mar 2023 21:23:16 GMT",
|
|
6
21
|
"tag": "@fluentui/react-virtualizer_v9.0.0-alpha.13",
|
|
7
22
|
"version": "9.0.0-alpha.13",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-virtualizer
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 24 Mar 2023 10:15:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-alpha.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.14)
|
|
8
|
+
|
|
9
|
+
Fri, 24 Mar 2023 10:15:03 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.13..@fluentui/react-virtualizer_v9.0.0-alpha.14)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- [feat] Add static measurement hooks and embedded scroll option ([PR #26985](https://github.com/microsoft/fluentui/pull/26985) by mifraser@microsoft.com)
|
|
15
|
+
|
|
7
16
|
## [9.0.0-alpha.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-virtualizer_v9.0.0-alpha.13)
|
|
8
17
|
|
|
9
|
-
Tue, 21 Mar 2023 21:
|
|
18
|
+
Tue, 21 Mar 2023 21:23:16 GMT
|
|
10
19
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-virtualizer_v9.0.0-alpha.12..@fluentui/react-virtualizer_v9.0.0-alpha.13)
|
|
11
20
|
|
|
12
21
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
+
import { ComponentState } from '@fluentui/react-utilities';
|
|
3
3
|
import type { Dispatch } from 'react';
|
|
4
4
|
import type { FC } from 'react';
|
|
5
5
|
import type { MutableRefObject } from 'react';
|
|
6
6
|
import * as React_2 from 'react';
|
|
7
7
|
import type { SetStateAction } from 'react';
|
|
8
|
-
import
|
|
8
|
+
import { Slot } from '@fluentui/react-utilities';
|
|
9
9
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
10
10
|
|
|
11
11
|
export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JSX.Element;
|
|
12
12
|
|
|
13
|
+
export declare const renderVirtualizerScrollView_unstable: (state: VirtualizerScrollViewState) => JSX.Element;
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* React hook that allows easy usage of the browser API IntersectionObserver within React
|
|
15
17
|
* @param callback - A function called when the percentage of the target element is visible crosses a threshold.
|
|
@@ -25,8 +27,25 @@ export declare const useIntersectionObserver: (callback: IntersectionObserverCal
|
|
|
25
27
|
observer: MutableRefObject<IntersectionObserver | undefined>;
|
|
26
28
|
};
|
|
27
29
|
|
|
30
|
+
/**
|
|
31
|
+
* React hook that measures virtualized space based on a static size to ensure optimized virtualization length.
|
|
32
|
+
*/
|
|
33
|
+
export declare const useStaticVirtualizerMeasure: (virtualizerProps: VirtualizerMeasureProps) => {
|
|
34
|
+
virtualizerLength: number;
|
|
35
|
+
bufferItems: number;
|
|
36
|
+
bufferSize: number;
|
|
37
|
+
scrollRef: (instance: HTMLElement | HTMLDivElement | null) => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
28
40
|
export declare function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState;
|
|
29
41
|
|
|
42
|
+
export declare function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Apply styling to the Virtualizer states
|
|
46
|
+
*/
|
|
47
|
+
export declare const useVirtualizerScrollViewStyles_unstable: (state: VirtualizerScrollViewState) => VirtualizerScrollViewState;
|
|
48
|
+
|
|
30
49
|
/**
|
|
31
50
|
* Apply styling to the Virtualizer states
|
|
32
51
|
*/
|
|
@@ -43,7 +62,7 @@ export declare type VirtualizerChildRenderFunction = (index: number) => React_2.
|
|
|
43
62
|
|
|
44
63
|
export declare const virtualizerClassNames: SlotClassNames<VirtualizerSlots>;
|
|
45
64
|
|
|
46
|
-
|
|
65
|
+
declare type VirtualizerConfigProps = {
|
|
47
66
|
/**
|
|
48
67
|
* Child render function.
|
|
49
68
|
* Iteratively called to return current virtualizer DOM children.
|
|
@@ -87,9 +106,8 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
87
106
|
bufferSize?: number;
|
|
88
107
|
/**
|
|
89
108
|
* Enables users to override the intersectionObserverRoot.
|
|
90
|
-
* @default null
|
|
91
109
|
*/
|
|
92
|
-
|
|
110
|
+
scrollViewRef?: React_2.MutableRefObject<HTMLElement | null>;
|
|
93
111
|
/**
|
|
94
112
|
* The scroll direction
|
|
95
113
|
* @default vertical
|
|
@@ -115,26 +133,7 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
|
|
|
115
133
|
onCalculateIndex?: (newIndex: number) => number;
|
|
116
134
|
};
|
|
117
135
|
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* The intersection observed 'before' element will detect when scrolling towards the beginning.
|
|
121
|
-
*/
|
|
122
|
-
before: NonNullable<Slot<'div', 'td'>>;
|
|
123
|
-
/**
|
|
124
|
-
* A block place holding whitespace at the beginning of current DOM children.
|
|
125
|
-
*/
|
|
126
|
-
beforeContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
127
|
-
/**
|
|
128
|
-
* The intersection observed 'after' element will detect when scrolling towards the end.
|
|
129
|
-
*/
|
|
130
|
-
after: NonNullable<Slot<'div', 'td'>>;
|
|
131
|
-
/**
|
|
132
|
-
* A block place holding whitespace after the end of current DOM children.
|
|
133
|
-
*/
|
|
134
|
-
afterContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export declare type VirtualizerState = ComponentState<VirtualizerSlots> & {
|
|
136
|
+
declare type VirtualizerConfigState = {
|
|
138
137
|
/**
|
|
139
138
|
* The current virtualized array of children to show in the DOM.
|
|
140
139
|
*/
|
|
@@ -165,9 +164,73 @@ export declare type VirtualizerState = ComponentState<VirtualizerSlots> & {
|
|
|
165
164
|
*/
|
|
166
165
|
reversed?: boolean;
|
|
167
166
|
/**
|
|
168
|
-
*
|
|
167
|
+
* Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.
|
|
168
|
+
* Minimum 1px.
|
|
169
169
|
*/
|
|
170
170
|
bufferSize: number;
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
+
declare type VirtualizerMeasureProps = {
|
|
174
|
+
defaultItemSize: number;
|
|
175
|
+
direction?: 'vertical' | 'horizontal';
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Virtualizer ScrollView
|
|
182
|
+
*/
|
|
183
|
+
export declare const VirtualizerScrollView: React_2.FC<VirtualizerScrollViewProps>;
|
|
184
|
+
|
|
185
|
+
export declare const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots>;
|
|
186
|
+
|
|
187
|
+
export declare type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children'>> & {
|
|
188
|
+
/**
|
|
189
|
+
* Virtualizer item size in pixels - static.
|
|
190
|
+
* Axis: 'vertical' = Height
|
|
191
|
+
* Axis: 'horizontal' = Width
|
|
192
|
+
*/
|
|
193
|
+
itemSize: number;
|
|
194
|
+
/**
|
|
195
|
+
* The total number of items to be virtualized.
|
|
196
|
+
*/
|
|
197
|
+
numItems: number;
|
|
198
|
+
/**
|
|
199
|
+
* Child render function.
|
|
200
|
+
* Iteratively called to return current virtualizer DOM children.
|
|
201
|
+
* Will act as a row or column indexer depending on Virtualizer settings.
|
|
202
|
+
*/
|
|
203
|
+
children: VirtualizerChildRenderFunction;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export declare type VirtualizerScrollViewSlots = VirtualizerSlots & {
|
|
207
|
+
/**
|
|
208
|
+
* The root container that provides embedded scrolling.
|
|
209
|
+
*/
|
|
210
|
+
container: NonNullable<Slot<'div'>>;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export declare type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;
|
|
214
|
+
|
|
215
|
+
export declare type VirtualizerSlots = {
|
|
216
|
+
/**
|
|
217
|
+
* The intersection observed 'before' element will detect when scrolling towards the beginning.
|
|
218
|
+
*/
|
|
219
|
+
before: NonNullable<Slot<'div', 'td'>>;
|
|
220
|
+
/**
|
|
221
|
+
* A block place holding whitespace at the beginning of current DOM children.
|
|
222
|
+
*/
|
|
223
|
+
beforeContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
224
|
+
/**
|
|
225
|
+
* The intersection observed 'after' element will detect when scrolling towards the end.
|
|
226
|
+
*/
|
|
227
|
+
after: NonNullable<Slot<'div', 'td'>>;
|
|
228
|
+
/**
|
|
229
|
+
* A block place holding whitespace after the end of current DOM children.
|
|
230
|
+
*/
|
|
231
|
+
afterContainer: NonNullable<Slot<'div', 'tr'>>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export declare type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;
|
|
235
|
+
|
|
173
236
|
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../src/VirtualizerScrollView.ts"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n"],"mappings":"AAAA,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React"],"sources":["../../../src/components/Virtualizer/Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type VirtualizerSlots = {\n /**\n * The intersection observed 'before' element will detect when scrolling towards the beginning.\n */\n before: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace at the beginning of current DOM children.\n */\n beforeContainer: NonNullable<Slot<'div', 'tr'>>;\n /**\n * The intersection observed 'after' element will detect when scrolling towards the end.\n */\n after: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace after the end of current DOM children.\n */\n afterContainer: NonNullable<Slot<'div', 'tr'>>;\n};\n\nexport type
|
|
1
|
+
{"version":3,"names":["React"],"sources":["../../../src/components/Virtualizer/Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type VirtualizerSlots = {\n /**\n * The intersection observed 'before' element will detect when scrolling towards the beginning.\n */\n before: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace at the beginning of current DOM children.\n */\n beforeContainer: NonNullable<Slot<'div', 'tr'>>;\n /**\n * The intersection observed 'after' element will detect when scrolling towards the end.\n */\n after: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace after the end of current DOM children.\n */\n afterContainer: NonNullable<Slot<'div', 'tr'>>;\n};\n\nexport type VirtualizerConfigState = {\n /**\n * The current virtualized array of children to show in the DOM.\n */\n virtualizedChildren: React.ReactNode[];\n /**\n * The current start index for the virtualizer, all previous index's will be removed from DOM.\n */\n virtualizerStartIndex: number;\n /**\n * Current buffer height required at beginning of array.\n */\n afterBufferHeight: number;\n /**\n * Current buffer height required at end of array.\n */\n beforeBufferHeight: number;\n /**\n * The total current height of the scrollView/child content.\n */\n totalVirtualizerHeight: number;\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n */\n reversed?: boolean;\n /**\n * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\n\n// Virtualizer render function to procedurally generate children elements as rows or columns via index.\n// Q: Use generic typing and passing through object data or a simple index system?\nexport type VirtualizerChildRenderFunction = (index: number) => React.ReactNode;\n\nexport type VirtualizerConfigProps = {\n /**\n * Child render function.\n * Iteratively called to return current virtualizer DOM children.\n * Will act as a row or column indexer depending on Virtualizer settings.\n * Can be used dynamically.\n */\n children: VirtualizerChildRenderFunction;\n\n /**\n * Default cell size to use if no custom callback provided.\n * If implementing `getItemSize` this should be the initial and ideally minimum cell size.\n */\n itemSize: number;\n\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n\n /**\n * Number of children to render in the DOM during virtualization.\n * Constraints:\n * - Large enough that the items rendered in DOM cover the viewport\n * and intersection observer buffers (buffersize) at both ends.\n */\n virtualizerLength: number;\n\n /**\n * Defaults to 1/4th of virtualizerLength.\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the end buffer and end index (start index + virtualizerLength) is not within viewport at rest.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems size (in pixels).\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n */\n scrollViewRef?: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n * This value should be flipped in RTL implementation (TBD whether automate RTL).\n */\n reversed?: boolean;\n\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n */\n getItemSize?: (index: number) => number;\n\n /**\n * Notify users of index changes\n */\n onUpdateIndex?: (index: number, prevIndex: number) => void;\n\n /**\n * Allow users to intervene in index calculation changes\n */\n onCalculateIndex?: (newIndex: number) => number;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
|
@@ -11,7 +11,7 @@ export function useVirtualizer_unstable(props) {
|
|
|
11
11
|
getItemSize,
|
|
12
12
|
bufferItems = Math.round(virtualizerLength / 4.0),
|
|
13
13
|
bufferSize = Math.floor(bufferItems / 2.0) * itemSize,
|
|
14
|
-
|
|
14
|
+
scrollViewRef,
|
|
15
15
|
axis = 'vertical',
|
|
16
16
|
reversed = false,
|
|
17
17
|
onUpdateIndex,
|
|
@@ -145,7 +145,7 @@ export function useVirtualizer_unstable(props) {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
}, {
|
|
148
|
-
root:
|
|
148
|
+
root: scrollViewRef ? scrollViewRef === null || scrollViewRef === void 0 ? void 0 : scrollViewRef.current : null,
|
|
149
149
|
rootMargin: '0px',
|
|
150
150
|
threshold: 0
|
|
151
151
|
});
|
|
@@ -219,7 +219,7 @@ export function useVirtualizer_unstable(props) {
|
|
|
219
219
|
// Time for custom size calcs
|
|
220
220
|
return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];
|
|
221
221
|
};
|
|
222
|
-
const updateChildRows = newIndex => {
|
|
222
|
+
const updateChildRows = useCallback(newIndex => {
|
|
223
223
|
if (numItems === 0) {
|
|
224
224
|
/* Nothing to virtualize */return [];
|
|
225
225
|
}
|
|
@@ -231,7 +231,7 @@ export function useVirtualizer_unstable(props) {
|
|
|
231
231
|
for (let i = actualIndex; i < end; i++) {
|
|
232
232
|
childArray.current[i - actualIndex] = renderChild(i);
|
|
233
233
|
}
|
|
234
|
-
};
|
|
234
|
+
}, [numItems, renderChild, virtualizerLength]);
|
|
235
235
|
const setBeforeRef = useCallback(element => {
|
|
236
236
|
if (!element || beforeElementRef.current === element) {
|
|
237
237
|
return;
|
|
@@ -306,13 +306,18 @@ export function useVirtualizer_unstable(props) {
|
|
|
306
306
|
forceUpdate();
|
|
307
307
|
}
|
|
308
308
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
309
|
-
}, [renderChild]);
|
|
309
|
+
}, [renderChild, updateChildRows]);
|
|
310
310
|
// Ensure we have run through and updated the whole size list array at least once.
|
|
311
311
|
initializeSizeArray();
|
|
312
312
|
if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {
|
|
313
313
|
// Child length mismatch, repopulate size arrays.
|
|
314
314
|
populateSizeArrays();
|
|
315
315
|
}
|
|
316
|
+
// Ensure we recalc if virtualizer length changes
|
|
317
|
+
const maxCompare = Math.min(virtualizerLength, numItems);
|
|
318
|
+
if (childArray.current.length !== maxCompare && virtualizerStartIndex + childArray.current.length < numItems) {
|
|
319
|
+
updateChildRows(virtualizerStartIndex);
|
|
320
|
+
}
|
|
316
321
|
const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;
|
|
317
322
|
return {
|
|
318
323
|
components: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useIntersectionObserver","useEffect","useRef","useState","useCallback","useReducer","resolveShorthand","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","intersectionObserverRoot","axis","reversed","onUpdateIndex","onCalculateIndex","virtualizerStartIndex","setVirtualizerStartIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","horizontal","populateSizeArrays","current","length","index","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","lastItemIndex","remainingItems","newIndex","actualIndex","end","i","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight"],"sources":["../../../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport type { ReactNode } from 'react';\nimport { useEffect, useRef, useState, useCallback, useReducer } from 'react';\n\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n intersectionObserverRoot,\n axis = 'vertical',\n reversed = false,\n onUpdateIndex,\n onCalculateIndex,\n } = props;\n\n // Tracks the initial item to start virtualizer at, -1 implies first render cycle\n const [virtualizerStartIndex, setVirtualizerStartIndex] = useState<number>(-1);\n\n // Store ref to before padding element\n const beforeElementRef = useRef<Element | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = useRef<Element | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\n\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n\n const horizontal = axis === 'horizontal';\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n }\n\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\n\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const batchUpdateNewIndex = (index: number) => {\n // Local updates\n onUpdateIndex?.(index, virtualizerStartIndex);\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setVirtualizerStartIndex(index);\n };\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (virtualizerStartIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n\n // Grab latest entry that is intersecting\n const latestEntry =\n entries.length === 1\n ? entries[0]\n : entries\n .sort((entry1, entry2) => entry2.time - entry1.time)\n .find(entry => {\n return entry.intersectionRatio > 0;\n });\n\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n let bufferedIndex = Math.max(startIndex - bufferCount, 0);\n\n if (onCalculateIndex) {\n // User has chance to intervene/customize prior to render\n // They may want to normalize this value.\n bufferedIndex = onCalculateIndex(bufferedIndex);\n }\n\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n\n if (virtualizerStartIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n // due to virtualizerStartIndex invalidation.\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n },\n {\n root: intersectionObserverRoot ? intersectionObserverRoot?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const findIndexRecursive = (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return virtualizerStartIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n };\n\n const getIndexFromSizeArray = (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n };\n\n const getIndexFromScrollPosition = (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n };\n\n const calculateTotalSize = () => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n };\n\n const calculateBefore = () => {\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return virtualizerStartIndex * itemSize;\n }\n\n if (virtualizerStartIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[virtualizerStartIndex - 1];\n };\n\n const calculateAfter = () => {\n if (numItems === 0) {\n return 0;\n }\n\n const lastItemIndex = Math.min(virtualizerStartIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n };\n\n const updateChildRows = (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n\n return [];\n }\n\n if (childArray.current.length !== numItems) {\n childArray.current = new Array(virtualizerLength);\n }\n const actualIndex = Math.max(newIndex, 0);\n const end = Math.min(actualIndex + virtualizerLength, numItems);\n\n for (let i = actualIndex; i < end; i++) {\n childArray.current[i - actualIndex] = renderChild(i);\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 const updateCurrentItemSizes = (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const newSize = getItemSize(i);\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n };\n\n // Initialize the size array before first render.\n const hasInitialized = useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (virtualizerStartIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (virtualizerStartIndex >= 0) {\n updateChildRows(virtualizerStartIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild]);\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 const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex,\n axis,\n bufferSize,\n reversed,\n };\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AAExC,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ;AAGrE,SAASC,gBAAgB,QAAQ;AACjC,SAASC,SAAS,QAAQ;AAE1B,OAAO,SAASC,wBAAwBC,KAAuB,EAAoB;EACjF,MAAM;IACJC,QAAA;IACAC,QAAA;IACAC,iBAAA;IACAC,QAAA,EAAUC,WAAA;IACVC,WAAA;IACAC,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAACN,iBAAA,GAAoB;IAC7CO,UAAA,GAAaF,IAAA,CAAKG,KAAK,CAACJ,WAAA,GAAc,OAAON,QAAA;IAC7CW,wBAAA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9DmD,iBAAA,EAAmBZ,kBAAA,GAAqB/C,cAAA,KAAmB,CAAC;IAC5D4D,sBAAA,EAAwBb,kBAAA,GAAqB9C,kBAAA,KAAuB9C,iBAAA,GAAoBF,QAAQ;IAChGgB,qBAAA;IACAJ,IAAA;IACAH,UAAA;IACAI;EACF;AACF"}
|
|
1
|
+
{"version":3,"names":["useIntersectionObserver","useEffect","useRef","useState","useCallback","useReducer","resolveShorthand","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","scrollViewRef","axis","reversed","onUpdateIndex","onCalculateIndex","virtualizerStartIndex","setVirtualizerStartIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","horizontal","populateSizeArrays","current","length","index","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","lastItemIndex","remainingItems","newIndex","actualIndex","end","i","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight"],"sources":["../../../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport type { ReactNode } from 'react';\nimport { useEffect, useRef, useState, useCallback, useReducer } from 'react';\n\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n scrollViewRef,\n axis = 'vertical',\n reversed = false,\n onUpdateIndex,\n onCalculateIndex,\n } = props;\n\n // Tracks the initial item to start virtualizer at, -1 implies first render cycle\n const [virtualizerStartIndex, setVirtualizerStartIndex] = useState<number>(-1);\n\n // Store ref to before padding element\n const beforeElementRef = useRef<Element | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = useRef<Element | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n // The internal tracking REF for child array (updates often).\n const childArray = useRef<ReactNode[]>(new Array(virtualizerLength));\n\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n\n const horizontal = axis === 'horizontal';\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n }\n\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\n\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const batchUpdateNewIndex = (index: number) => {\n // Local updates\n onUpdateIndex?.(index, virtualizerStartIndex);\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setVirtualizerStartIndex(index);\n };\n\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (virtualizerStartIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n\n // Grab latest entry that is intersecting\n const latestEntry =\n entries.length === 1\n ? entries[0]\n : entries\n .sort((entry1, entry2) => entry2.time - entry1.time)\n .find(entry => {\n return entry.intersectionRatio > 0;\n });\n\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n let bufferedIndex = Math.max(startIndex - bufferCount, 0);\n\n if (onCalculateIndex) {\n // User has chance to intervene/customize prior to render\n // They may want to normalize this value.\n bufferedIndex = onCalculateIndex(bufferedIndex);\n }\n\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n\n if (virtualizerStartIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n // due to virtualizerStartIndex invalidation.\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n },\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const findIndexRecursive = (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return virtualizerStartIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n };\n\n const getIndexFromSizeArray = (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n };\n\n const getIndexFromScrollPosition = (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n\n return getIndexFromSizeArray(scrollPos);\n };\n\n const calculateTotalSize = () => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n };\n\n const calculateBefore = () => {\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return virtualizerStartIndex * itemSize;\n }\n\n if (virtualizerStartIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[virtualizerStartIndex - 1];\n };\n\n const calculateAfter = () => {\n if (numItems === 0) {\n return 0;\n }\n\n const lastItemIndex = Math.min(virtualizerStartIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n };\n\n const updateChildRows = useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n\n return [];\n }\n\n if (childArray.current.length !== numItems) {\n childArray.current = new Array(virtualizerLength);\n }\n const actualIndex = Math.max(newIndex, 0);\n const end = Math.min(actualIndex + virtualizerLength, numItems);\n\n for (let i = actualIndex; i < end; i++) {\n childArray.current[i - actualIndex] = renderChild(i);\n }\n },\n [numItems, renderChild, virtualizerLength],\n );\n\n const setBeforeRef = useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const updateCurrentItemSizes = (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const newSize = getItemSize(i);\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n };\n\n // Initialize the size array before first render.\n const hasInitialized = useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (virtualizerStartIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (virtualizerStartIndex >= 0) {\n updateChildRows(virtualizerStartIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, updateChildRows]);\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 && virtualizerStartIndex + childArray.current.length < numItems) {\n updateChildRows(virtualizerStartIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none',\n },\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex,\n axis,\n bufferSize,\n reversed,\n };\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AAExC,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ;AAGrE,SAASC,gBAAgB,QAAQ;AACjC,SAASC,SAAS,QAAQ;AAE1B,OAAO,SAASC,wBAAwBC,KAAuB,EAAoB;EACjF,MAAM;IACJC,QAAA;IACAC,QAAA;IACAC,iBAAA;IACAC,QAAA,EAAUC,WAAA;IACVC,WAAA;IACAC,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAAC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,EAAE;MACnCI,QAAA,EAAU,IAAI;MACdC,YAAA,EAAc;QACZC,GAAA,EAAKjB,WAAA;QACLkB,IAAA,EAAM;MACR;IACF;IACAN,eAAA,EAAiBvG,gBAAA,CAAiBG,KAAA,CAAMoG,eAAe,EAAE;MACvDG,QAAA,EAAU,IAAI;MACdC,YAAA,EAAc;QACZE,IAAA,EAAM;MACR;IACF;IACAL,cAAA,EAAgBxG,gBAAA,CAAiBG,KAAA,CAAMqG,cAAc,EAAE;MACrDE,QAAA,EAAU,IAAI;MACdC,YAAA,EAAc;QACZE,IAAA,EAAM;MACR;IACF;IACAC,kBAAA,EAAoBX,kBAAA,GAAqBxC,eAAA,KAAoB,CAAC;IAC9DoD,iBAAA,EAAmBZ,kBAAA,GAAqBhD,cAAA,KAAmB,CAAC;IAC5D6D,sBAAA,EAAwBb,kBAAA,GAAqB/C,kBAAA,KAAuB9C,iBAAA,GAAoBF,QAAQ;IAChGgB,qBAAA;IACAJ,IAAA;IACAH,UAAA;IACAI;EACF;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useVirtualizerScrollView_unstable } from './useVirtualizerScrollView';
|
|
2
|
+
import { renderVirtualizerScrollView_unstable } from './renderVirtualizerScrollView';
|
|
3
|
+
import { useVirtualizerScrollViewStyles_unstable } from './useVirtualizerScrollViewStyles';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Virtualizer ScrollView
|
|
7
|
+
*/
|
|
8
|
+
export const VirtualizerScrollView = props => {
|
|
9
|
+
const state = useVirtualizerScrollView_unstable(props);
|
|
10
|
+
useVirtualizerScrollViewStyles_unstable(state);
|
|
11
|
+
return renderVirtualizerScrollView_unstable(state);
|
|
12
|
+
};
|
|
13
|
+
VirtualizerScrollView.displayName = 'VirtualizerScrollView';
|
|
14
|
+
//# sourceMappingURL=VirtualizerScrollView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","React","VirtualizerScrollView","props","state","displayName"],"sources":["../../../src/components/VirtualizerScrollView/VirtualizerScrollView.ts"],"sourcesContent":["import { VirtualizerScrollViewProps } from './VirtualizerScrollView.types';\nimport { useVirtualizerScrollView_unstable } from './useVirtualizerScrollView';\nimport { renderVirtualizerScrollView_unstable } from './renderVirtualizerScrollView';\nimport { useVirtualizerScrollViewStyles_unstable } from './useVirtualizerScrollViewStyles';\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"],"mappings":"AACA,SAASA,iCAAiC,QAAQ;AAClD,SAASC,oCAAoC,QAAQ;AACrD,SAASC,uCAAuC,QAAQ;AACxD,YAAYC,KAAA,MAAW;AAEvB;;;AAIA,OAAO,MAAMC,qBAAA,GAA+DC,KAAA,IAAsC;EAChH,MAAMC,KAAA,GAAQN,iCAAA,CAAkCK,KAAA;EAEhDH,uCAAA,CAAwCI,KAAA;EAExC,OAAOL,oCAAA,CAAqCK,KAAA;AAC9C;AAEAF,qBAAA,CAAsBG,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/VirtualizerScrollView/VirtualizerScrollView.types.ts"],"sourcesContent":["import { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport {\n VirtualizerSlots,\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nexport type VirtualizerScrollViewSlots = VirtualizerSlots & {\n /**\n * The root container that provides embedded scrolling.\n */\n container: NonNullable<Slot<'div'>>;\n};\n\nexport type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> &\n Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children'>> & {\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\nexport type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './VirtualizerScrollView';
|
|
2
|
+
export * from './VirtualizerScrollView.types';
|
|
3
|
+
export * from './useVirtualizerScrollView';
|
|
4
|
+
export * from './renderVirtualizerScrollView';
|
|
5
|
+
export * from './useVirtualizerScrollViewStyles';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/VirtualizerScrollView/index.ts"],"sourcesContent":["export * from './VirtualizerScrollView';\nexport * from './VirtualizerScrollView.types';\nexport * from './useVirtualizerScrollView';\nexport * from './renderVirtualizerScrollView';\nexport * from './useVirtualizerScrollViewStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
3
|
+
import { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';
|
|
4
|
+
export const renderVirtualizerScrollView_unstable = state => {
|
|
5
|
+
const {
|
|
6
|
+
slots,
|
|
7
|
+
slotProps
|
|
8
|
+
} = getSlots(state);
|
|
9
|
+
return /*#__PURE__*/React.createElement(slots.container, slotProps.container, renderVirtualizer_unstable(state));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=renderVirtualizerScrollView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","getSlots","renderVirtualizer_unstable","renderVirtualizerScrollView_unstable","state","slots","slotProps","createElement","container"],"sources":["../../../src/components/VirtualizerScrollView/renderVirtualizerScrollView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { VirtualizerScrollViewSlots, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollView_unstable = (state: VirtualizerScrollViewState) => {\n const { slots, slotProps } = getSlots<VirtualizerScrollViewSlots>(state);\n\n return <slots.container {...slotProps.container}>{renderVirtualizer_unstable(state)}</slots.container>;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,0BAA0B,QAAQ;AAE3C,OAAO,MAAMC,oCAAA,GAAwCC,KAAA,IAAsC;EACzF,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGL,QAAA,CAAqCG,KAAA;EAElE,oBAAOJ,KAAA,CAAAO,aAAA,CAACF,KAAA,CAAMG,SAAS,EAAKF,SAAA,CAAUE,SAAS,EAAGN,0BAAA,CAA2BE,KAAA;AAC/E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';
|
|
3
|
+
import { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';
|
|
4
|
+
import { useStaticVirtualizerMeasure } from '../../Hooks';
|
|
5
|
+
export function useVirtualizerScrollView_unstable(props) {
|
|
6
|
+
var _props_axis;
|
|
7
|
+
const {
|
|
8
|
+
virtualizerLength,
|
|
9
|
+
bufferItems,
|
|
10
|
+
bufferSize,
|
|
11
|
+
scrollRef
|
|
12
|
+
} = useStaticVirtualizerMeasure({
|
|
13
|
+
defaultItemSize: props.itemSize,
|
|
14
|
+
direction: (_props_axis = props.axis) !== null && _props_axis !== void 0 ? _props_axis : 'vertical'
|
|
15
|
+
});
|
|
16
|
+
const iScrollRef = useMergedRefs(React.useRef(null), scrollRef);
|
|
17
|
+
const virtualizerState = useVirtualizer_unstable({
|
|
18
|
+
...props,
|
|
19
|
+
virtualizerLength,
|
|
20
|
+
bufferItems,
|
|
21
|
+
bufferSize,
|
|
22
|
+
scrollViewRef: iScrollRef
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
...virtualizerState,
|
|
26
|
+
components: {
|
|
27
|
+
...virtualizerState.components,
|
|
28
|
+
container: 'div'
|
|
29
|
+
},
|
|
30
|
+
container: resolveShorthand(props.container, {
|
|
31
|
+
required: true,
|
|
32
|
+
defaultProps: {
|
|
33
|
+
ref: iScrollRef
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useVirtualizerScrollView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","resolveShorthand","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","useVirtualizerScrollView_unstable","props","_props_axis","virtualizerLength","bufferItems","bufferSize","scrollRef","defaultItemSize","itemSize","direction","axis","iScrollRef","useRef","virtualizerState","scrollViewRef","components","container","required","defaultProps","ref"],"sources":["../../../src/components/VirtualizerScrollView/useVirtualizerScrollView.ts"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport { VirtualizerScrollViewProps, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { useStaticVirtualizerMeasure } from '../../Hooks';\n\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { virtualizerLength, bufferItems, bufferSize, scrollRef } = useStaticVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n });\n\n const iScrollRef = useMergedRefs(React.useRef<HTMLDivElement>(null), scrollRef);\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollViewRef: iScrollRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: resolveShorthand(props.container, {\n required: true,\n defaultProps: {\n ref: iScrollRef as React.RefObject<HTMLDivElement>,\n },\n }),\n };\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,EAAEC,aAAa,QAAQ;AAChD,SAASC,uBAAuB,QAAQ;AAExC,SAASC,2BAA2B,QAAQ;AAE5C,OAAO,SAASC,kCAAkCC,KAAiC,EAA8B;MAGlGC,WAAA;EAFb,MAAM;IAAEC,iBAAA;IAAmBC,WAAA;IAAaC,UAAA;IAAYC;EAAS,CAAE,GAAGP,2BAAA,CAA4B;IAC5FQ,eAAA,EAAiBN,KAAA,CAAMO,QAAQ;IAC/BC,SAAA,EAAW,CAAAP,WAAA,GAAAD,KAAA,CAAMS,IAAI,cAAVR,WAAA,cAAAA,WAAA,GAAc;EAC3B;EAEA,MAAMS,UAAA,GAAad,aAAA,CAAcF,KAAA,CAAMiB,MAAM,CAAiB,IAAI,GAAGN,SAAA;EAErE,MAAMO,gBAAA,GAAmBf,uBAAA,CAAwB;IAC/C,GAAGG,KAAK;IACRE,iBAAA;IACAC,WAAA;IACAC,UAAA;IACAS,aAAA,EAAeH;EACjB;EAEA,OAAO;IACL,GAAGE,gBAAgB;IACnBE,UAAA,EAAY;MACV,GAAGF,gBAAA,CAAiBE,UAAU;MAC9BC,SAAA,EAAW;IACb;IACAA,SAAA,EAAWpB,gBAAA,CAAiBK,KAAA,CAAMe,SAAS,EAAE;MAC3CC,QAAA,EAAU,IAAI;MACdC,YAAA,EAAc;QACZC,GAAA,EAAKR;MACP;IACF;EACF;AACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles';
|
|
2
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
3
|
+
const virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';
|
|
4
|
+
export const virtualizerScrollViewClassNames = {
|
|
5
|
+
...virtualizerClassNames,
|
|
6
|
+
container: `${virtualizerScrollViewClassName}__container`
|
|
7
|
+
};
|
|
8
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
9
|
+
base: {
|
|
10
|
+
mc9l5x: "f22iagw",
|
|
11
|
+
a9b677: "fly5x3f",
|
|
12
|
+
Bqenvij: "f1l02sjl",
|
|
13
|
+
Eiaeu8: "f1115ve7"
|
|
14
|
+
},
|
|
15
|
+
vertical: {
|
|
16
|
+
Beiy3e4: "f1vx9l62",
|
|
17
|
+
Eiaeu8: "f1115ve7",
|
|
18
|
+
Bmxbyg5: "f5zp4f"
|
|
19
|
+
},
|
|
20
|
+
horizontal: {
|
|
21
|
+
Beiy3e4: "f1063pyq",
|
|
22
|
+
B68tc82: "f1oy3dpc"
|
|
23
|
+
},
|
|
24
|
+
verticalReversed: {
|
|
25
|
+
Beiy3e4: "f1gkdon0",
|
|
26
|
+
Bmxbyg5: "f5zp4f"
|
|
27
|
+
},
|
|
28
|
+
horizontalReversed: {
|
|
29
|
+
Beiy3e4: "f1oztnx0",
|
|
30
|
+
B68tc82: "f1oy3dpc"
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1115ve7{overflow-anchor:none;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f5zp4f{overflow-y:auto;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".f1oy3dpc{overflow-x:auto;}", ".f1gkdon0{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;}", ".f1oztnx0{-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;}"]
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Apply styling to the Virtualizer states
|
|
37
|
+
*/
|
|
38
|
+
export const useVirtualizerScrollViewStyles_unstable = state => {
|
|
39
|
+
const styles = useStyles();
|
|
40
|
+
// For now - just return default style mods
|
|
41
|
+
useVirtualizerStyles_unstable(state);
|
|
42
|
+
const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
|
|
43
|
+
state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
|
|
44
|
+
return state;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=useVirtualizerScrollViewStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","Eiaeu8","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"sources":["../../../src/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.ts"],"sourcesContent":["import { VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { VirtualizerScrollViewSlots } from './VirtualizerScrollView.types';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\n\nexport const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots> = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'flex',\n width: '100%',\n height: '100%',\n overflowAnchor: 'none',\n },\n vertical: {\n flexDirection: 'column',\n overflowAnchor: 'none',\n overflowY: 'auto',\n },\n horizontal: {\n flexDirection: 'row',\n overflowX: 'auto',\n },\n verticalReversed: {\n flexDirection: 'column-reverse',\n overflowY: 'auto',\n },\n horizontalReversed: {\n flexDirection: 'row-reverse',\n overflowX: 'auto',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n */\nexport const useVirtualizerScrollViewStyles_unstable = (\n state: VirtualizerScrollViewState,\n): VirtualizerScrollViewState => {\n const styles = useStyles();\n\n // For now - just return default style mods\n useVirtualizerStyles_unstable(state);\n\n const containerStyle =\n state.axis === 'horizontal'\n ? state.reversed\n ? styles.horizontalReversed\n : styles.horizontal\n : state.reversed\n ? styles.verticalReversed\n : styles.vertical;\n\n state.container.className = mergeClasses(\n virtualizerScrollViewClassNames.container,\n styles.base,\n containerStyle,\n state.container.className,\n );\n\n return state;\n};\n"],"mappings":"AAGA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ;AACrE,SAAAC,QAAA,EAAqBC,YAAY,QAAQ;AAEzC,MAAMC,8BAAA,GAAiC;AAEvC,OAAO,MAAMC,+BAAA,GAA8E;EACzF,GAAGJ,qBAAqB;EACxBK,SAAA,EAAY,GAAEF,8BAA+B;AAC/C;AAEA,MAAMG,SAAA,gBAAYL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAF,MAAA;IAAAG,OAAA;EAAA;EAAAC,UAAA;IAAAF,OAAA;IAAAG,OAAA;EAAA;EAAAC,gBAAA;IAAAJ,OAAA;IAAAC,OAAA;EAAA;EAAAI,kBAAA;IAAAL,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAG,CAAA;AAAA,EAwBlB;AAEA;;;AAGA,OAAO,MAAMC,uCAAA,GACXC,KAAA,IAC+B;EAC/B,MAAMC,MAAA,GAAShB,SAAA;EAEf;EACAP,6BAAA,CAA8BsB,KAAA;EAE9B,MAAME,cAAA,GACJF,KAAA,CAAMG,IAAI,KAAK,eACXH,KAAA,CAAMI,QAAQ,GACZH,MAAA,CAAOJ,kBAAkB,GACzBI,MAAA,CAAOP,UAAU,GACnBM,KAAA,CAAMI,QAAQ,GACdH,MAAA,CAAOL,gBAAgB,GACvBK,MAAA,CAAOV,QAAQ;EAErBS,KAAA,CAAMhB,SAAS,CAACqB,SAAS,GAAGxB,YAAA,CAC1BE,+BAAA,CAAgCC,SAAS,EACzCiB,MAAA,CAAOf,IAAI,EACXgB,cAAA,EACAF,KAAA,CAAMhB,SAAS,CAACqB,SAAS;EAG3B,OAAOL,KAAA;AACT"}
|
package/lib/hooks/index.js
CHANGED
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/hooks/index.ts"],"sourcesContent":["export * from './useIntersectionObserver';\n"],"mappings":"AAAA,cAAc"}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/hooks/index.ts"],"sourcesContent":["export * from './useIntersectionObserver';\nexport * from './useVirtualizerMeasure';\n"],"mappings":"AAAA,cAAc;AACd,cAAc"}
|