@@ -10,6 +10,9 @@ declare module 'aurelia-ui-virtualization' {
1010 import {
1111 ArrayRepeatStrategy
1212 } from 'aurelia-templating-resources/array-repeat-strategy' ;
13+ import {
14+ DOM
15+ } from 'aurelia-pal' ;
1316 import {
1417 RepeatStrategyLocator
1518 } from 'aurelia-templating-resources/repeat-strategy-locator' ;
@@ -33,60 +36,72 @@ declare module 'aurelia-ui-virtualization' {
3336 import {
3437 viewsRequireLifecycle
3538 } from 'aurelia-templating-resources/analyze-view-factory' ;
36- export function calcOuterHeight ( element : any ) : any ;
37- export function insertBeforeNode ( view : any , bottomBuffer : any ) : any ;
39+ export interface ViewStrategy {
40+ getScrollContainer ( element : Element ) : Element ;
41+ moveViewFirst ( view : View , topBuffer : Element ) : void ;
42+ moveViewLast ( view : View , bottomBuffer : Element ) : void ;
43+ createTopBufferElement ( element : Element ) : Element ;
44+ createBottomBufferElement ( element : Element ) : Element ;
45+ removeBufferElements ( element : Element , topBuffer : Element , bottomBuffer : Element ) : void ;
46+ }
47+ export class DomHelper {
48+ getElementDistanceToTopViewPort ( element : Element ) : number ;
49+ hasOverflowScroll ( element : Element ) : boolean ;
50+ }
51+ export function calcOuterHeight ( element : Element ) : number ;
52+ export function insertBeforeNode ( view : View , bottomBuffer : number ) : void ;
3853
3954 /**
4055 * Update the override context.
4156 * @param startIndex index in collection where to start updating.
4257 */
43- export function updateVirtualOverrideContexts ( repeat : any , startIndex : any ) : any ;
58+ export function updateVirtualOverrideContexts ( repeat : VirtualRepeat , startIndex : number ) : void ;
4459 export function rebindAndMoveView ( repeat : VirtualRepeat , view : View , index : number , moveToBottom : boolean ) : void ;
45- export function getStyleValue ( element : any , style : any ) : any ;
46- export function getElementDistanceToBottomViewPort ( element : any ) : any ;
47- export function getElementDistanceToTopViewPort ( element : any ) : any ;
60+ export function getStyleValue ( element : Element , style : string ) : any ;
61+ export function getElementDistanceToBottomViewPort ( element : Element ) : number ;
62+ export function getElementDistanceToTopViewPort ( element : Element ) : number ;
4863
4964 /**
5065 * A strategy for repeating a template over an array.
5166 */
5267 export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy {
5368
5469 // create first item to calculate the heights
55- createFirstItem ( repeat : any ) : any ;
70+ createFirstItem ( repeat : VirtualRepeat ) : void ;
5671
5772 /**
5873 * Handle the repeat's collection instance changing.
5974 * @param repeat The repeater instance.
6075 * @param items The new array instance.
6176 */
62- instanceChanged ( repeat : any , items : any ) : any ;
77+ instanceChanged ( repeat : VirtualRepeat , items : Array < any > ) : void ;
6378
6479 /**
6580 * Handle the repeat's collection instance mutating.
6681 * @param repeat The repeat instance.
6782 * @param array The modified array.
6883 * @param splices Records of array changes.
6984 */
70- instanceMutated ( repeat : any , array : any , splices : any ) : any ;
85+ instanceMutated ( repeat : VirtualRepeat , array : Array < any > , splices : any ) : void ;
7186 }
7287 export class ViewStrategyLocator {
73- getStrategy ( element : any ) : any ;
88+ getStrategy ( element : Element ) : ViewStrategy ;
7489 }
7590 export class TableStrategy {
76- getScrollContainer ( element : any ) : any ;
77- moveViewFirst ( view : any , topBuffer : any ) : any ;
78- moveViewLast ( view : any , bottomBuffer : any ) : any ;
79- createTopBufferElement ( element : any ) : any ;
80- createBottomBufferElement ( element : any ) : any ;
81- removeBufferElements ( element : any , topBuffer : any , bottomBuffer : any ) : any ;
91+ getScrollContainer ( element : Element ) : Element ;
92+ moveViewFirst ( view : View , topBuffer : Element ) : void ;
93+ moveViewLast ( view : View , bottomBuffer : Element ) : void ;
94+ createTopBufferElement ( element : Element ) : Element ;
95+ createBottomBufferElement ( element : Element ) : Element ;
96+ removeBufferElements ( element : Element , topBuffer : Element , bottomBuffer : Element ) : void ;
8297 }
83- export class DefaultStrategy {
84- getScrollContainer ( element : any ) : any ;
85- moveViewFirst ( view : any , topBuffer : any ) : any ;
86- moveViewLast ( view : any , bottomBuffer : any ) : any ;
87- createTopBufferElement ( element : any ) : any ;
88- createBottomBufferElement ( element : any ) : any ;
89- removeBufferElements ( element : any , topBuffer : any , bottomBuffer : any ) : any ;
98+ export class DefaultViewStrategy {
99+ getScrollContainer ( element : Element ) : Element ;
100+ moveViewFirst ( view : View , topBuffer : Element ) : void ;
101+ moveViewLast ( view : View , bottomBuffer : Element ) : void ;
102+ createTopBufferElement ( element : Element ) : Element ;
103+ createBottomBufferElement ( element : Element ) : Element ;
104+ removeBufferElements ( element : Element , topBuffer : Element , bottomBuffer : Element ) : void ;
90105 }
91106 export class VirtualRepeatStrategyLocator extends RepeatStrategyLocator {
92107 constructor ( ) ;
@@ -109,15 +124,15 @@ declare module 'aurelia-ui-virtualization' {
109124 _isAtTop : any ;
110125 items : any ;
111126 local : any ;
112- constructor ( element : any , viewFactory : any , instruction : any , viewSlot : any , observerLocator : any , strategyLocator : any , viewStrategyLocator : any ) ;
113- attached ( ) : any ;
114- bind ( bindingContext : any , overrideContext : any ) : any ;
115- call ( context : any , changes : any ) : any ;
116- detached ( ) : any ;
117- itemsChanged ( ) : any ;
118- unbind ( ) : any ;
119- handleCollectionMutated ( collection : any , changes : any ) : any ;
120- handleInnerCollectionMutated ( collection : any , changes : any ) : any ;
127+ constructor ( element : Element , viewFactory : BoundViewFactory , instruction : TargetInstruction , viewSlot : ViewSlot , observerLocator : ObserverLocator , strategyLocator : VirtualRepeatStrategyLocator , viewStrategyLocator : ViewStrategyLocator , domHelper : DomHelper ) ;
128+ attached ( ) : void ;
129+ bind ( bindingContext : any , overrideContext : any ) : void ;
130+ call ( context : any , changes : any ) : void ;
131+ detached ( ) : void ;
132+ itemsChanged ( ) : void ;
133+ unbind ( ) : void ;
134+ handleCollectionMutated ( collection : any , changes : any ) : void ;
135+ handleInnerCollectionMutated ( collection : any , changes : any ) : void ;
121136
122137 // @override AbstractRepeater
123138 viewCount ( ) : any ;
0 commit comments