-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6038310
commit 931f8c0
Showing
48 changed files
with
4,762 additions
and
1,976 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
declare module 'aurelia-ui-virtualization' { | ||
import { | ||
updateOverrideContext, | ||
createFullOverrideContext, | ||
getItemsSourceExpression, | ||
isOneTime, | ||
unwrapExpression, | ||
updateOneTimeBinding | ||
} from 'aurelia-templating-resources/repeat-utilities'; | ||
import { | ||
ArrayRepeatStrategy | ||
} from 'aurelia-templating-resources/array-repeat-strategy'; | ||
import { | ||
RepeatStrategyLocator | ||
} from 'aurelia-templating-resources/repeat-strategy-locator'; | ||
import { | ||
inject | ||
} from 'aurelia-dependency-injection'; | ||
import { | ||
ObserverLocator | ||
} from 'aurelia-binding'; | ||
import { | ||
BoundViewFactory, | ||
ViewSlot, | ||
TargetInstruction, | ||
customAttribute, | ||
bindable, | ||
templateController | ||
} from 'aurelia-templating'; | ||
import { | ||
AbstractRepeater | ||
} from 'aurelia-templating-resources'; | ||
import { | ||
viewsRequireLifecycle | ||
} from 'aurelia-templating-resources/analyze-view-factory'; | ||
export function calcOuterHeight(element: any): any; | ||
export function insertBeforeNode(view: any, bottomBuffer: any): any; | ||
|
||
/** | ||
* Update the override context. | ||
* @param startIndex index in collection where to start updating. | ||
*/ | ||
export function updateVirtualOverrideContexts(repeat: any, startIndex: any): any; | ||
export function rebindAndMoveView(repeat: VirtualRepeat, view: View, index: number, moveToBottom: boolean): void; | ||
export function getStyleValue(element: any, style: any): any; | ||
export function getElementDistanceToBottomViewPort(element: any): any; | ||
|
||
/** | ||
* A strategy for repeating a template over an array. | ||
*/ | ||
export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy { | ||
|
||
// create first item to calculate the heights | ||
createFirstItem(repeat: any): any; | ||
|
||
/** | ||
* Handle the repeat's collection instance changing. | ||
* @param repeat The repeater instance. | ||
* @param items The new array instance. | ||
*/ | ||
instanceChanged(repeat: any, items: any): any; | ||
|
||
/** | ||
* Handle the repeat's collection instance mutating. | ||
* @param repeat The repeat instance. | ||
* @param array The modified array. | ||
* @param splices Records of array changes. | ||
*/ | ||
instanceMutated(repeat: any, array: any, splices: any): any; | ||
} | ||
export class ViewStrategyLocator { | ||
getStrategy(element: any): any; | ||
} | ||
export class TableStrategy { | ||
getScrollContainer(element: any): any; | ||
moveViewFirst(view: any, topBuffer: any): any; | ||
moveViewLast(view: any, bottomBuffer: any): any; | ||
createTopBufferElement(element: any): any; | ||
createBottomBufferElement(element: any): any; | ||
removeBufferElements(element: any, topBuffer: any, bottomBuffer: any): any; | ||
} | ||
export class DefaultStrategy { | ||
getScrollContainer(element: any): any; | ||
moveViewFirst(view: any, topBuffer: any): any; | ||
moveViewLast(view: any, bottomBuffer: any): any; | ||
createTopBufferElement(element: any): any; | ||
createBottomBufferElement(element: any): any; | ||
removeBufferElements(element: any, topBuffer: any, bottomBuffer: any): any; | ||
} | ||
export class VirtualRepeatStrategyLocator extends RepeatStrategyLocator { | ||
constructor(); | ||
} | ||
export class VirtualRepeat extends AbstractRepeater { | ||
_first: any; | ||
_previousFirst: any; | ||
_viewsLength: any; | ||
_lastRebind: any; | ||
_topBufferHeight: any; | ||
_bottomBufferHeight: any; | ||
_bufferSize: any; | ||
_scrollingDown: any; | ||
_scrollingUp: any; | ||
_switchedDirection: any; | ||
_isAttached: any; | ||
_ticking: any; | ||
_fixedHeightContainer: any; | ||
_hasCalculatedSizes: any; | ||
_isAtTop: any; | ||
items: any; | ||
local: any; | ||
constructor(element: any, viewFactory: any, instruction: any, viewSlot: any, observerLocator: any, strategyLocator: any, viewStrategyLocator: any); | ||
attached(): any; | ||
bind(bindingContext: any, overrideContext: any): any; | ||
call(context: any, changes: any): any; | ||
detached(): any; | ||
itemsChanged(): any; | ||
unbind(): any; | ||
handleCollectionMutated(collection: any, changes: any): any; | ||
handleInnerCollectionMutated(collection: any, changes: any): any; | ||
|
||
// @override AbstractRepeater | ||
viewCount(): any; | ||
views(): any; | ||
view(index: any): any; | ||
addView(bindingContext: any, overrideContext: any): any; | ||
insertView(index: any, bindingContext: any, overrideContext: any): any; | ||
removeAllViews(returnToCache: any, skipAnimation: any): any; | ||
removeView(index: any, returnToCache: any, skipAnimation: any): any; | ||
updateBindings(view: View): any; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
define(['exports', './virtual-repeat', './virtual-list'], function (exports, _virtualRepeat, _virtualList) { | ||
define(['exports', './virtual-repeat'], function (exports, _virtualRepeat) { | ||
'use strict'; | ||
|
||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.VirtualRepeat = undefined; | ||
exports.configure = configure; | ||
|
||
function configure(config) { | ||
config.globalResources('./virtual-repeat', './virtual-list'); | ||
config.globalResources('./virtual-repeat'); | ||
} | ||
|
||
exports.VirtualRepeat = _virtualRepeat.VirtualRepeat; | ||
exports.VirtualList = _virtualList.VirtualList; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,73 @@ | ||
define(['exports'], function (exports) { | ||
define(['exports', 'aurelia-templating-resources/repeat-utilities'], function (exports, _repeatUtilities) { | ||
'use strict'; | ||
|
||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.calcOuterHeight = calcOuterHeight; | ||
exports.calcScrollHeight = calcScrollHeight; | ||
exports.insertBeforeNode = insertBeforeNode; | ||
|
||
exports.updateVirtualOverrideContexts = updateVirtualOverrideContexts; | ||
exports.rebindAndMoveView = rebindAndMoveView; | ||
exports.getStyleValue = getStyleValue; | ||
exports.getElementDistanceToBottomViewPort = getElementDistanceToBottomViewPort; | ||
function calcOuterHeight(element) { | ||
var height; | ||
var height = void 0; | ||
height = element.getBoundingClientRect().height; | ||
height += getStyleValue(element, 'marginTop'); | ||
height += getStyleValue(element, 'marginBottom'); | ||
return height; | ||
} | ||
|
||
function calcScrollHeight(element) { | ||
var height; | ||
height = element.getBoundingClientRect().height; | ||
height -= getStyleValue(element, 'borderTopWidth'); | ||
height -= getStyleValue(element, 'borderBottomWidth'); | ||
return height; | ||
} | ||
|
||
function insertBeforeNode(view, scrollView, node) { | ||
function insertBeforeNode(view, bottomBuffer) { | ||
var viewStart = view.firstChild; | ||
var element = viewStart.nextSibling; | ||
var viewEnd = view.lastChild; | ||
var parentElement = bottomBuffer.parentElement; | ||
|
||
parentElement.insertBefore(viewEnd, bottomBuffer); | ||
parentElement.insertBefore(element, viewEnd); | ||
parentElement.insertBefore(viewStart, element); | ||
} | ||
|
||
scrollView.insertBefore(viewEnd, node); | ||
scrollView.insertBefore(element, viewEnd); | ||
scrollView.insertBefore(viewStart, element); | ||
function updateVirtualOverrideContexts(repeat, startIndex) { | ||
var views = repeat.viewSlot.children; | ||
var viewLength = views.length; | ||
var collectionLength = repeat.items.length; | ||
|
||
if (startIndex > 0) { | ||
startIndex = startIndex - 1; | ||
} | ||
|
||
var delta = repeat._topBufferHeight / repeat.itemHeight; | ||
|
||
for (; startIndex < viewLength; ++startIndex) { | ||
(0, _repeatUtilities.updateOverrideContext)(views[startIndex].overrideContext, startIndex + delta, collectionLength); | ||
} | ||
} | ||
|
||
function rebindAndMoveView(repeat, view, index, moveToBottom) { | ||
var items = repeat.items; | ||
var viewSlot = repeat.viewSlot; | ||
(0, _repeatUtilities.updateOverrideContext)(view.overrideContext, index, items.length); | ||
view.bindingContext[repeat.local] = items[index]; | ||
if (moveToBottom) { | ||
viewSlot.children.push(viewSlot.children.shift()); | ||
repeat.viewStrategy.moveViewLast(view, repeat.bottomBuffer); | ||
} else { | ||
viewSlot.children.unshift(viewSlot.children.splice(-1, 1)[0]); | ||
repeat.viewStrategy.moveViewFirst(view, repeat.topBuffer); | ||
} | ||
} | ||
|
||
function getStyleValue(element, style) { | ||
var currentStyle, styleValue; | ||
var currentStyle = void 0; | ||
var styleValue = void 0; | ||
currentStyle = element.currentStyle || window.getComputedStyle(element); | ||
styleValue = parseInt(currentStyle[style]); | ||
styleValue = parseInt(currentStyle[style], 10); | ||
return Number.isNaN(styleValue) ? 0 : styleValue; | ||
} | ||
|
||
function getElementDistanceToBottomViewPort(element) { | ||
return document.documentElement.clientHeight - element.getBoundingClientRect().bottom; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.