Skip to content

Commit

Permalink
chore(all): prepare release 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Apr 7, 2016
1 parent 4eb9ca0 commit ea0133a
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 34 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-ui-virtualization",
"version": "0.4.0",
"version": "0.4.1",
"description": "A plugin that provides a virtualized repeater and other virtualization services.",
"keywords": [
"aurelia",
Expand Down
2 changes: 1 addition & 1 deletion dist/amd/array-virtual-repeat-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
var viewsLength = repeat.viewCount();
var first = repeat._getIndexOfFirstView();

while (viewsLength > repeat._viewsLength) {
while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
}
Expand Down
1 change: 1 addition & 0 deletions dist/amd/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare module 'aurelia-ui-virtualization' {
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;
export function getElementDistanceToTopViewPort(element: any): any;

/**
* A strategy for repeating a template over an array.
Expand Down
5 changes: 5 additions & 0 deletions dist/amd/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ define(['exports', 'aurelia-templating-resources/repeat-utilities'], function (e
exports.rebindAndMoveView = rebindAndMoveView;
exports.getStyleValue = getStyleValue;
exports.getElementDistanceToBottomViewPort = getElementDistanceToBottomViewPort;
exports.getElementDistanceToTopViewPort = getElementDistanceToTopViewPort;
function calcOuterHeight(element) {
var height = void 0;
height = element.getBoundingClientRect().height;
Expand Down Expand Up @@ -70,4 +71,8 @@ define(['exports', 'aurelia-templating-resources/repeat-utilities'], function (e
function getElementDistanceToBottomViewPort(element) {
return document.documentElement.clientHeight - element.getBoundingClientRect().bottom;
}

function getElementDistanceToTopViewPort(element) {
return element.getBoundingClientRect().top;
}
});
12 changes: 8 additions & 4 deletions dist/amd/virtual-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
this.scrollListener = function () {
return _this2._onScroll();
};
this.distanceToTop = (0, _utilities.getElementDistanceToTopViewPort)(this.topBuffer.nextElementSibling);
var containerStyle = this.scrollContainer.style;
if (containerStyle.overflowY === 'scroll' || containerStyle.overflow === 'scroll' || containerStyle.overflowY === 'auto' || containerStyle.overflow === 'auto') {
this._fixedHeightContainer = true;
Expand Down Expand Up @@ -173,6 +174,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
this.isLastIndex = false;
this.scrollContainer = null;
this.scrollContainerHeight = null;
this.distanceToTop = null;
this.removeAllViews(true);
if (this.scrollHandler) {
this.scrollHandler.dispose();
Expand All @@ -188,7 +190,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
}
var items = this.items;
this.strategy = this.strategyLocator.getStrategy(items);
if (items.length > 0) {
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}
this._calcInitialHeights(items.length);
Expand Down Expand Up @@ -250,7 +252,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
return;
}
var itemHeight = this.itemHeight;
var scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.topBuffer.offsetTop;
var scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.distanceToTop;
this._first = Math.floor(scrollTop / itemHeight);
this._first = this._first < 0 ? 0 : this._first;
if (this._first > this.items.length - this.elementsInView) {
Expand Down Expand Up @@ -352,17 +354,19 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
var items = this.items;
var index = this._scrollingDown ? this._getIndexOfLastView() + 1 : this._getIndexOfFirstView() - 1;
var i = 0;
var viewToMoveLimit = length - childrenLength * 2;
while (i < length && !isAtFirstOrLastIndex()) {
var view = this.view(viewIndex);
var nextIndex = getNextIndex(index, i);
this.isLastIndex = nextIndex >= items.length - 1;
this._isAtTop = nextIndex <= 0;
if (!(isAtFirstOrLastIndex() && childrenLength >= items.length)) {
(0, _utilities.rebindAndMoveView)(this, view, nextIndex, this._scrollingDown);
if (i > viewToMoveLimit) {
(0, _utilities.rebindAndMoveView)(this, view, nextIndex, this._scrollingDown);
}
i++;
}
}

return length - (length - i);
};

Expand Down
1 change: 1 addition & 0 deletions dist/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare module 'aurelia-ui-virtualization' {
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;
export function getElementDistanceToTopViewPort(element: any): any;

/**
* A strategy for repeating a template over an array.
Expand Down
18 changes: 13 additions & 5 deletions dist/aurelia-ui-virtualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export function getElementDistanceToBottomViewPort(element) {
return document.documentElement.clientHeight - element.getBoundingClientRect().bottom;
}

export function getElementDistanceToTopViewPort(element) {
return element.getBoundingClientRect().top;
}

/**
* A strategy for repeating a template over an array.
*/
Expand Down Expand Up @@ -102,7 +106,7 @@ export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy {
let viewsLength = repeat.viewCount();
let first = repeat._getIndexOfFirstView();
// remove unneeded views.
while (viewsLength > repeat._viewsLength) {
while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
}
Expand Down Expand Up @@ -448,6 +452,7 @@ export class VirtualRepeat extends AbstractRepeater {
this.bottomBuffer = this.viewStrategy.createBottomBufferElement(element);
this.itemsChanged();
this.scrollListener = () => this._onScroll();
this.distanceToTop = getElementDistanceToTopViewPort(this.topBuffer.nextElementSibling);
let containerStyle = this.scrollContainer.style;
if (containerStyle.overflowY === 'scroll' || containerStyle.overflow === 'scroll' || containerStyle.overflowY === 'auto' || containerStyle.overflow === 'auto') {
this._fixedHeightContainer = true;
Expand Down Expand Up @@ -484,6 +489,7 @@ export class VirtualRepeat extends AbstractRepeater {
this.isLastIndex = false;
this.scrollContainer = null;
this.scrollContainerHeight = null;
this.distanceToTop = null;
this.removeAllViews(true);
if (this.scrollHandler) {
this.scrollHandler.dispose();
Expand All @@ -499,7 +505,7 @@ export class VirtualRepeat extends AbstractRepeater {
}
let items = this.items;
this.strategy = this.strategyLocator.getStrategy(items);
if (items.length > 0) {
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}
this._calcInitialHeights(items.length);
Expand Down Expand Up @@ -559,7 +565,7 @@ export class VirtualRepeat extends AbstractRepeater {
return;
}
let itemHeight = this.itemHeight;
let scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.topBuffer.offsetTop;
let scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.distanceToTop;
this._first = Math.floor(scrollTop / itemHeight);
this._first = this._first < 0 ? 0 : this._first;
if (this._first > this.items.length - this.elementsInView) {
Expand Down Expand Up @@ -653,17 +659,19 @@ export class VirtualRepeat extends AbstractRepeater {
let items = this.items;
let index = this._scrollingDown ? this._getIndexOfLastView() + 1 : this._getIndexOfFirstView() - 1;
let i = 0;
let viewToMoveLimit = length - (childrenLength * 2);
while (i < length && !isAtFirstOrLastIndex()) {
let view = this.view(viewIndex);
let nextIndex = getNextIndex(index, i);
this.isLastIndex = nextIndex >= items.length - 1;
this._isAtTop = nextIndex <= 0;
if (!(isAtFirstOrLastIndex() && childrenLength >= items.length)) {
rebindAndMoveView(this, view, nextIndex, this._scrollingDown);
if (i > viewToMoveLimit) {
rebindAndMoveView(this, view, nextIndex, this._scrollingDown);
}
i++;
}
}

return length - (length - i);
}

Expand Down
2 changes: 1 addition & 1 deletion dist/commonjs/array-virtual-repeat-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var ArrayVirtualRepeatStrategy = exports.ArrayVirtualRepeatStrategy = function (
var viewsLength = repeat.viewCount();
var first = repeat._getIndexOfFirstView();

while (viewsLength > repeat._viewsLength) {
while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
}
Expand Down
1 change: 1 addition & 0 deletions dist/commonjs/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare module 'aurelia-ui-virtualization' {
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;
export function getElementDistanceToTopViewPort(element: any): any;

/**
* A strategy for repeating a template over an array.
Expand Down
5 changes: 5 additions & 0 deletions dist/commonjs/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exports.updateVirtualOverrideContexts = updateVirtualOverrideContexts;
exports.rebindAndMoveView = rebindAndMoveView;
exports.getStyleValue = getStyleValue;
exports.getElementDistanceToBottomViewPort = getElementDistanceToBottomViewPort;
exports.getElementDistanceToTopViewPort = getElementDistanceToTopViewPort;

var _repeatUtilities = require('aurelia-templating-resources/repeat-utilities');

Expand Down Expand Up @@ -71,4 +72,8 @@ function getStyleValue(element, style) {

function getElementDistanceToBottomViewPort(element) {
return document.documentElement.clientHeight - element.getBoundingClientRect().bottom;
}

function getElementDistanceToTopViewPort(element) {
return element.getBoundingClientRect().top;
}
12 changes: 8 additions & 4 deletions dist/commonjs/virtual-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ var VirtualRepeat = exports.VirtualRepeat = (_dec = (0, _aureliaTemplating.custo
this.scrollListener = function () {
return _this2._onScroll();
};
this.distanceToTop = (0, _utilities.getElementDistanceToTopViewPort)(this.topBuffer.nextElementSibling);
var containerStyle = this.scrollContainer.style;
if (containerStyle.overflowY === 'scroll' || containerStyle.overflow === 'scroll' || containerStyle.overflowY === 'auto' || containerStyle.overflow === 'auto') {
this._fixedHeightContainer = true;
Expand Down Expand Up @@ -166,6 +167,7 @@ var VirtualRepeat = exports.VirtualRepeat = (_dec = (0, _aureliaTemplating.custo
this.isLastIndex = false;
this.scrollContainer = null;
this.scrollContainerHeight = null;
this.distanceToTop = null;
this.removeAllViews(true);
if (this.scrollHandler) {
this.scrollHandler.dispose();
Expand All @@ -181,7 +183,7 @@ var VirtualRepeat = exports.VirtualRepeat = (_dec = (0, _aureliaTemplating.custo
}
var items = this.items;
this.strategy = this.strategyLocator.getStrategy(items);
if (items.length > 0) {
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}
this._calcInitialHeights(items.length);
Expand Down Expand Up @@ -243,7 +245,7 @@ var VirtualRepeat = exports.VirtualRepeat = (_dec = (0, _aureliaTemplating.custo
return;
}
var itemHeight = this.itemHeight;
var scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.topBuffer.offsetTop;
var scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.distanceToTop;
this._first = Math.floor(scrollTop / itemHeight);
this._first = this._first < 0 ? 0 : this._first;
if (this._first > this.items.length - this.elementsInView) {
Expand Down Expand Up @@ -345,17 +347,19 @@ var VirtualRepeat = exports.VirtualRepeat = (_dec = (0, _aureliaTemplating.custo
var items = this.items;
var index = this._scrollingDown ? this._getIndexOfLastView() + 1 : this._getIndexOfFirstView() - 1;
var i = 0;
var viewToMoveLimit = length - childrenLength * 2;
while (i < length && !isAtFirstOrLastIndex()) {
var view = this.view(viewIndex);
var nextIndex = getNextIndex(index, i);
this.isLastIndex = nextIndex >= items.length - 1;
this._isAtTop = nextIndex <= 0;
if (!(isAtFirstOrLastIndex() && childrenLength >= items.length)) {
(0, _utilities.rebindAndMoveView)(this, view, nextIndex, this._scrollingDown);
if (i > viewToMoveLimit) {
(0, _utilities.rebindAndMoveView)(this, view, nextIndex, this._scrollingDown);
}
i++;
}
}

return length - (length - i);
};

Expand Down
2 changes: 1 addition & 1 deletion dist/es2015/array-virtual-repeat-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export let ArrayVirtualRepeatStrategy = class ArrayVirtualRepeatStrategy extends
let viewsLength = repeat.viewCount();
let first = repeat._getIndexOfFirstView();

while (viewsLength > repeat._viewsLength) {
while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
}
Expand Down
1 change: 1 addition & 0 deletions dist/es2015/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare module 'aurelia-ui-virtualization' {
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;
export function getElementDistanceToTopViewPort(element: any): any;

/**
* A strategy for repeating a template over an array.
Expand Down
4 changes: 4 additions & 0 deletions dist/es2015/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ export function getStyleValue(element, style) {

export function getElementDistanceToBottomViewPort(element) {
return document.documentElement.clientHeight - element.getBoundingClientRect().bottom;
}

export function getElementDistanceToTopViewPort(element) {
return element.getBoundingClientRect().top;
}
14 changes: 9 additions & 5 deletions dist/es2015/virtual-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { BoundViewFactory, ViewSlot, TargetInstruction, customAttribute, bindabl
import { AbstractRepeater } from 'aurelia-templating-resources';
import { getItemsSourceExpression, isOneTime, unwrapExpression, updateOneTimeBinding } from 'aurelia-templating-resources/repeat-utilities';
import { viewsRequireLifecycle } from 'aurelia-templating-resources/analyze-view-factory';
import { getStyleValue, calcOuterHeight, rebindAndMoveView } from './utilities';
import { getStyleValue, calcOuterHeight, rebindAndMoveView, getElementDistanceToTopViewPort } from './utilities';
import { VirtualRepeatStrategyLocator } from './virtual-repeat-strategy-locator';
import { ViewStrategyLocator } from './view-strategy';

Expand Down Expand Up @@ -100,6 +100,7 @@ export let VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = in
this.bottomBuffer = this.viewStrategy.createBottomBufferElement(element);
this.itemsChanged();
this.scrollListener = () => this._onScroll();
this.distanceToTop = getElementDistanceToTopViewPort(this.topBuffer.nextElementSibling);
let containerStyle = this.scrollContainer.style;
if (containerStyle.overflowY === 'scroll' || containerStyle.overflow === 'scroll' || containerStyle.overflowY === 'auto' || containerStyle.overflow === 'auto') {
this._fixedHeightContainer = true;
Expand Down Expand Up @@ -136,6 +137,7 @@ export let VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = in
this.isLastIndex = false;
this.scrollContainer = null;
this.scrollContainerHeight = null;
this.distanceToTop = null;
this.removeAllViews(true);
if (this.scrollHandler) {
this.scrollHandler.dispose();
Expand All @@ -151,7 +153,7 @@ export let VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = in
}
let items = this.items;
this.strategy = this.strategyLocator.getStrategy(items);
if (items.length > 0) {
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}
this._calcInitialHeights(items.length);
Expand Down Expand Up @@ -205,7 +207,7 @@ export let VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = in
return;
}
let itemHeight = this.itemHeight;
let scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.topBuffer.offsetTop;
let scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.distanceToTop;
this._first = Math.floor(scrollTop / itemHeight);
this._first = this._first < 0 ? 0 : this._first;
if (this._first > this.items.length - this.elementsInView) {
Expand Down Expand Up @@ -299,17 +301,19 @@ export let VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = in
let items = this.items;
let index = this._scrollingDown ? this._getIndexOfLastView() + 1 : this._getIndexOfFirstView() - 1;
let i = 0;
let viewToMoveLimit = length - childrenLength * 2;
while (i < length && !isAtFirstOrLastIndex()) {
let view = this.view(viewIndex);
let nextIndex = getNextIndex(index, i);
this.isLastIndex = nextIndex >= items.length - 1;
this._isAtTop = nextIndex <= 0;
if (!(isAtFirstOrLastIndex() && childrenLength >= items.length)) {
rebindAndMoveView(this, view, nextIndex, this._scrollingDown);
if (i > viewToMoveLimit) {
rebindAndMoveView(this, view, nextIndex, this._scrollingDown);
}
i++;
}
}

return length - (length - i);
}

Expand Down
2 changes: 1 addition & 1 deletion dist/system/array-virtual-repeat-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ System.register(['aurelia-templating-resources/array-repeat-strategy', 'aurelia-
var viewsLength = repeat.viewCount();
var first = repeat._getIndexOfFirstView();

while (viewsLength > repeat._viewsLength) {
while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
}
Expand Down
1 change: 1 addition & 0 deletions dist/system/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare module 'aurelia-ui-virtualization' {
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;
export function getElementDistanceToTopViewPort(element: any): any;

/**
* A strategy for repeating a template over an array.
Expand Down
6 changes: 6 additions & 0 deletions dist/system/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ System.register(['aurelia-templating-resources/repeat-utilities'], function (_ex
}

_export('getElementDistanceToBottomViewPort', getElementDistanceToBottomViewPort);

function getElementDistanceToTopViewPort(element) {
return element.getBoundingClientRect().top;
}

_export('getElementDistanceToTopViewPort', getElementDistanceToTopViewPort);
}
};
});
Loading

0 comments on commit ea0133a

Please sign in to comment.