55 * which was forked from react-virtualized.
66 */
77
8- import { ALIGNMENT , type SizingCalculatorFn , type VirtualRange } from '..' ;
8+ import { ALIGNMENT , type SizingCalculatorFn , type VLRange } from '..' ;
99
1010export default class SizeAndPositionManager {
1111 private model : Array < any > ;
1212
1313 // calculate the size of a given index
14- private sizingCalculator ?: SizingCalculatorFn ;
14+ private sizingCalculatorFn ?: SizingCalculatorFn ;
1515 private estimatedSize ?: number ;
1616
1717 private indexToSizeAndPosition : Record <
@@ -32,14 +32,14 @@ export default class SizeAndPositionManager {
3232
3333 constructor ( model : Array < any > , sizingCalculator ?: SizingCalculatorFn , estimatedSize ?: number ) {
3434 this . model = model ;
35- this . sizingCalculator = sizingCalculator ;
35+ this . sizingCalculatorFn = sizingCalculator ;
3636 this . estimatedSize = estimatedSize ;
3737 this . indexToSizeAndPosition = { } ;
3838 this . lastMeasuredIndex = - 1 ;
3939
4040 this . checkForMismatchItemSizeAndItemCount ( ) ;
4141
42- if ( ! this . sizingCalculator ) this . computeTotalSizeAndPositionData ( ) ;
42+ if ( ! this . sizingCalculatorFn ) this . computeTotalSizeAndPositionData ( ) ;
4343 }
4444
4545 //TODO add model update
@@ -49,20 +49,20 @@ export default class SizeAndPositionManager {
4949 }
5050
5151 if ( sizingCalculator !== undefined ) {
52- this . sizingCalculator = sizingCalculator ;
52+ this . sizingCalculatorFn = sizingCalculator ;
5353 }
5454
5555 this . checkForMismatchItemSizeAndItemCount ( ) ;
5656
57- if ( this . sizingCalculator && this . totalSize !== undefined ) {
57+ if ( this . sizingCalculatorFn && this . totalSize !== undefined ) {
5858 this . totalSize = undefined ;
5959 } else {
6060 this . computeTotalSizeAndPositionData ( ) ;
6161 }
6262 }
6363
6464 private checkForMismatchItemSizeAndItemCount ( ) {
65- if ( Array . isArray ( this . sizingCalculator ) && this . sizingCalculator . length < this . model . length ) {
65+ if ( Array . isArray ( this . sizingCalculatorFn ) && this . sizingCalculatorFn . length < this . model . length ) {
6666 throw Error ( `When itemSize is an array, itemSize.length can't be smaller than itemCount` ) ;
6767 }
6868 }
@@ -71,8 +71,8 @@ export default class SizeAndPositionManager {
7171 private getSize ( index : number ) : number {
7272 // const { sizingCalculator: itemSize } = this;
7373
74- if ( this . sizingCalculator ) {
75- return this . sizingCalculator ( index , this . model [ index ] ) ;
74+ if ( this . sizingCalculatorFn ) {
75+ return this . sizingCalculatorFn ( index , this . model [ index ] ) ;
7676 }
7777
7878 //return Array.isArray(itemSize) ? itemSize[index] : itemSize;
@@ -107,7 +107,7 @@ export default class SizeAndPositionManager {
107107 throw Error ( `Requested index ${ index } is outside of range 0..${ this . model . length } ` ) ;
108108 }
109109
110- return this . sizingCalculator
110+ return this . sizingCalculatorFn
111111 ? this . getJustInTimeSizeAndPositionForIndex ( index )
112112 : this . indexToSizeAndPosition [ index ] ;
113113 }
@@ -151,7 +151,7 @@ export default class SizeAndPositionManager {
151151 private getEstimatedItemSize ( ) : number {
152152 return (
153153 this . estimatedSize ||
154- ( typeof this . sizingCalculator === 'number' && this . sizingCalculator ) ||
154+ ( typeof this . sizingCalculatorFn === 'number' && this . sizingCalculatorFn ) ||
155155 50
156156 ) ;
157157 }
@@ -224,7 +224,7 @@ export default class SizeAndPositionManager {
224224 containerSize : number = 0 ,
225225 offset : number ,
226226 windowOverPaddingCount : number
227- ) : VirtualRange {
227+ ) : VLRange {
228228 const totalSize = this . getTotalSize ( ) ;
229229
230230 if ( totalSize === 0 ) {
0 commit comments