Skip to content

Commit

Permalink
chore(all): prepare release 0.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed May 10, 2016
1 parent 1eda5e2 commit f311d24
Show file tree
Hide file tree
Showing 26 changed files with 305 additions and 227 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.4",
"version": "0.4.5",
"description": "A plugin that provides a virtualized repeater and other virtualization services.",
"keywords": [
"aurelia",
Expand Down
38 changes: 23 additions & 15 deletions dist/amd/array-virtual-repeat-strategy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aurelia-templating-resources/repeat-utilities', './utilities'], function (exports, _arrayRepeatStrategy, _repeatUtilities, _utilities) {
define(['exports', 'aurelia-templating-resources', './utilities'], function (exports, _aureliaTemplatingResources, _utilities) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -46,7 +46,7 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
}

ArrayVirtualRepeatStrategy.prototype.createFirstItem = function createFirstItem(repeat) {
var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, repeat.items[0], 0, 1);
var overrideContext = (0, _aureliaTemplatingResources.createFullOverrideContext)(repeat, repeat.items[0], 0, 1);
repeat.addView(overrideContext.bindingContext, overrideContext);
};

Expand All @@ -56,7 +56,7 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli

ArrayVirtualRepeatStrategy.prototype._standardProcessInstanceChanged = function _standardProcessInstanceChanged(repeat, items) {
for (var i = 1, ii = repeat._viewsLength; i < ii; ++i) {
var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[i], i, ii);
var overrideContext = (0, _aureliaTemplatingResources.createFullOverrideContext)(repeat, items[i], i, ii);
repeat.addView(overrideContext.bindingContext, overrideContext);
}
};
Expand Down Expand Up @@ -90,7 +90,7 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli

var minLength = Math.min(repeat._viewsLength, items.length);
for (var _i = viewsLength; _i < minLength; _i++) {
var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_i], _i, itemsLength);
var overrideContext = (0, _aureliaTemplatingResources.createFullOverrideContext)(repeat, items[_i], _i, itemsLength);
repeat.addView(overrideContext.bindingContext, overrideContext);
}
};
Expand Down Expand Up @@ -145,8 +145,9 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
for (var i = 0, ii = splices.length; i < ii; ++i) {
var splice = splices[i];
var removed = splice.removed;
for (var j = 0, jj = removed.length; j < jj; ++j) {
var viewOrPromise = this._removeViewAt(repeat, splice.index + removeDelta + rmPromises.length, true);
var removedLength = removed.length;
for (var j = 0, jj = removedLength; j < jj; ++j) {
var viewOrPromise = this._removeViewAt(repeat, splice.index + removeDelta + rmPromises.length, true, j, removedLength);
if (viewOrPromise instanceof Promise) {
rmPromises.push(viewOrPromise);
}
Expand All @@ -164,12 +165,18 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
(0, _utilities.updateVirtualOverrideContexts)(repeat, 0);
};

ArrayVirtualRepeatStrategy.prototype._removeViewAt = function _removeViewAt(repeat, collectionIndex, returnToCache) {
ArrayVirtualRepeatStrategy.prototype._removeViewAt = function _removeViewAt(repeat, collectionIndex, returnToCache, j, removedLength) {
var viewOrPromise = void 0;
var view = void 0;
var viewSlot = repeat.viewSlot;
var viewCount = repeat.viewCount();
var viewAddIndex = void 0;
var removeMoreThanInDom = removedLength > viewCount;
if (repeat._viewsLength <= j) {
repeat._bottomBufferHeight = repeat._bottomBufferHeight - repeat.itemHeight;
repeat._adjustBufferHeights();
return;
}

if (!this._isIndexBeforeViewSlot(repeat, viewSlot, collectionIndex) && !this._isIndexAfterViewSlot(repeat, viewSlot, collectionIndex)) {
var viewIndex = this._getViewIndex(repeat, viewSlot, collectionIndex);
Expand All @@ -178,7 +185,12 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
var collectionAddIndex = void 0;
if (repeat._bottomBufferHeight > repeat.itemHeight) {
viewAddIndex = viewCount;
collectionAddIndex = repeat._getIndexOfLastView() + 1;
if (!removeMoreThanInDom) {
var lastViewItem = repeat._getLastViewItem();
collectionAddIndex = repeat.items.indexOf(lastViewItem) + 1;
} else {
collectionAddIndex = j;
}
repeat._bottomBufferHeight = repeat._bottomBufferHeight - repeat.itemHeight;
} else if (repeat._topBufferHeight > 0) {
viewAddIndex = 0;
Expand All @@ -187,12 +199,10 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
}
var data = repeat.items[collectionAddIndex];
if (data) {
var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, repeat.items[collectionAddIndex], collectionAddIndex, repeat.items.length);
var overrideContext = (0, _aureliaTemplatingResources.createFullOverrideContext)(repeat, data, collectionAddIndex, repeat.items.length);
view = repeat.viewFactory.create();
view.bind(overrideContext.bindingContext, overrideContext);
}
} else {
return viewOrPromise;
}
} else if (this._isIndexBeforeViewSlot(repeat, viewSlot, collectionIndex)) {
if (repeat._bottomBufferHeight > 0) {
Expand All @@ -210,11 +220,9 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
repeat.viewSlot.insert(viewAddIndex, view);
repeat._adjustBufferHeights();
});
return undefined;
} else if (view) {
repeat.viewSlot.insert(viewAddIndex, view);
}

repeat._adjustBufferHeights();
};

Expand Down Expand Up @@ -247,7 +255,7 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
for (; addIndex < end; ++addIndex) {
var hasDistanceToBottomViewPort = (0, _utilities.getElementDistanceToBottomViewPort)(repeat.viewStrategy.getLastElement(repeat.bottomBuffer)) > 0;
if (repeat.viewCount() === 0 || !this._isIndexBeforeViewSlot(repeat, viewSlot, addIndex) && !this._isIndexAfterViewSlot(repeat, viewSlot, addIndex) || hasDistanceToBottomViewPort) {
var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, array[addIndex], addIndex, arrayLength);
var overrideContext = (0, _aureliaTemplatingResources.createFullOverrideContext)(repeat, array[addIndex], addIndex, arrayLength);
repeat.insertView(addIndex, overrideContext.bindingContext, overrideContext);
if (!repeat._hasCalculatedSizes) {
repeat._calcInitialHeights(1);
Expand All @@ -273,5 +281,5 @@ define(['exports', 'aurelia-templating-resources/array-repeat-strategy', 'aureli
};

return ArrayVirtualRepeatStrategy;
}(_arrayRepeatStrategy.ArrayRepeatStrategy);
}(_aureliaTemplatingResources.ArrayRepeatStrategy);
});
20 changes: 6 additions & 14 deletions dist/amd/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
declare module 'aurelia-ui-virtualization' {
import {
updateOverrideContext,
ArrayRepeatStrategy,
createFullOverrideContext,
RepeatStrategyLocator,
AbstractRepeater,
getItemsSourceExpression,
isOneTime,
unwrapExpression,
updateOneTimeBinding
} from 'aurelia-templating-resources/repeat-utilities';
import {
ArrayRepeatStrategy
} from 'aurelia-templating-resources/array-repeat-strategy';
updateOneTimeBinding,
viewsRequireLifecycle
} from 'aurelia-templating-resources';
import {
DOM
} from 'aurelia-pal';
import {
RepeatStrategyLocator
} from 'aurelia-templating-resources/repeat-strategy-locator';
import {
inject
} from 'aurelia-dependency-injection';
Expand All @@ -31,12 +29,6 @@ declare module 'aurelia-ui-virtualization' {
bindable,
templateController
} from 'aurelia-templating';
import {
AbstractRepeater
} from 'aurelia-templating-resources';
import {
viewsRequireLifecycle
} from 'aurelia-templating-resources/analyze-view-factory';
export interface ViewStrategy {
getScrollContainer(element: Element): Element;
moveViewFirst(view: View, topBuffer: Element): void;
Expand Down
6 changes: 3 additions & 3 deletions dist/amd/utilities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-templating-resources/repeat-utilities'], function (exports, _repeatUtilities) {
define(['exports', 'aurelia-templating-resources'], function (exports, _aureliaTemplatingResources) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -48,14 +48,14 @@ define(['exports', 'aurelia-templating-resources/repeat-utilities'], function (e
var delta = repeat._topBufferHeight / repeat.itemHeight;

for (; startIndex < viewLength; ++startIndex) {
(0, _repeatUtilities.updateOverrideContext)(views[startIndex].overrideContext, startIndex + delta, collectionLength);
(0, _aureliaTemplatingResources.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);
(0, _aureliaTemplatingResources.updateOverrideContext)(view.overrideContext, index, items.length);
view.bindingContext[repeat.local] = items[index];
if (moveToBottom) {
viewSlot.children.push(viewSlot.children.shift());
Expand Down
4 changes: 2 additions & 2 deletions dist/amd/virtual-repeat-strategy-locator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-templating-resources/repeat-strategy-locator', './array-virtual-repeat-strategy'], function (exports, _repeatStrategyLocator, _arrayVirtualRepeatStrategy) {
define(['exports', 'aurelia-templating-resources', './array-virtual-repeat-strategy'], function (exports, _aureliaTemplatingResources, _arrayVirtualRepeatStrategy) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -54,5 +54,5 @@ define(['exports', 'aurelia-templating-resources/repeat-strategy-locator', './ar
}

return VirtualRepeatStrategyLocator;
}(_repeatStrategyLocator.RepeatStrategyLocator);
}(_aureliaTemplatingResources.RepeatStrategyLocator);
});
30 changes: 22 additions & 8 deletions dist/amd/virtual-repeat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating', 'aurelia-templating-resources', 'aurelia-templating-resources/repeat-utilities', 'aurelia-templating-resources/analyze-view-factory', 'aurelia-pal', './utilities', './dom-helper', './virtual-repeat-strategy-locator', './view-strategy'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaTemplating, _aureliaTemplatingResources, _repeatUtilities, _analyzeViewFactory, _aureliaPal, _utilities, _domHelper, _virtualRepeatStrategyLocator, _viewStrategy) {
define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating', 'aurelia-templating-resources', 'aurelia-pal', './utilities', './dom-helper', './virtual-repeat-strategy-locator', './view-strategy'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaTemplating, _aureliaTemplatingResources, _aureliaPal, _utilities, _domHelper, _virtualRepeatStrategyLocator, _viewStrategy) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -89,7 +89,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t

var _this = _possibleConstructorReturn(this, _AbstractRepeater.call(this, {
local: 'item',
viewsRequireLifecycle: (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory)
viewsRequireLifecycle: (0, _aureliaTemplatingResources.viewsRequireLifecycle)(viewFactory)
}));

_this._first = 0;
Expand Down Expand Up @@ -120,8 +120,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
_this.observerLocator = observerLocator;
_this.strategyLocator = strategyLocator;
_this.viewStrategyLocator = viewStrategyLocator;
_this.sourceExpression = (0, _repeatUtilities.getItemsSourceExpression)(_this.instruction, 'virtual-repeat.for');
_this.isOneTime = (0, _repeatUtilities.isOneTime)(_this.sourceExpression);
_this.sourceExpression = (0, _aureliaTemplatingResources.getItemsSourceExpression)(_this.instruction, 'virtual-repeat.for');
_this.isOneTime = (0, _aureliaTemplatingResources.isOneTime)(_this.sourceExpression);
_this.domHelper = domHelper;
return _this;
}
Expand Down Expand Up @@ -382,7 +382,21 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
};

VirtualRepeat.prototype._getIndexOfLastView = function _getIndexOfLastView() {
return this.view(this.viewCount() - 1).overrideContext.$index;
var view = this.view(this.viewCount() - 1);
if (view) {
return view.overrideContext.$index;
}

return -1;
};

VirtualRepeat.prototype._getLastViewItem = function _getLastViewItem() {
var children = this.viewSlot.children;
if (!children.length) {
return undefined;
}
var lastViewItem = children[children.length - 1].bindingContext[this.local];
return lastViewItem;
};

VirtualRepeat.prototype._getIndexOfFirstView = function _getIndexOfFirstView() {
Expand Down Expand Up @@ -439,7 +453,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
};

VirtualRepeat.prototype._getInnerCollection = function _getInnerCollection() {
var expression = (0, _repeatUtilities.unwrapExpression)(this.sourceExpression);
var expression = (0, _aureliaTemplatingResources.unwrapExpression)(this.sourceExpression);
if (!expression) {
return null;
}
Expand Down Expand Up @@ -490,14 +504,14 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
VirtualRepeat.prototype.updateBindings = function updateBindings(view) {
var j = view.bindings.length;
while (j--) {
(0, _repeatUtilities.updateOneTimeBinding)(view.bindings[j]);
(0, _aureliaTemplatingResources.updateOneTimeBinding)(view.bindings[j]);
}
j = view.controllers.length;
while (j--) {
var k = view.controllers[j].boundProperties.length;
while (k--) {
var binding = view.controllers[j].boundProperties[k].binding;
(0, _repeatUtilities.updateOneTimeBinding)(binding);
(0, _aureliaTemplatingResources.updateOneTimeBinding)(binding);
}
}
};
Expand Down
20 changes: 6 additions & 14 deletions dist/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
declare module 'aurelia-ui-virtualization' {
import {
updateOverrideContext,
ArrayRepeatStrategy,
createFullOverrideContext,
RepeatStrategyLocator,
AbstractRepeater,
getItemsSourceExpression,
isOneTime,
unwrapExpression,
updateOneTimeBinding
} from 'aurelia-templating-resources/repeat-utilities';
import {
ArrayRepeatStrategy
} from 'aurelia-templating-resources/array-repeat-strategy';
updateOneTimeBinding,
viewsRequireLifecycle
} from 'aurelia-templating-resources';
import {
DOM
} from 'aurelia-pal';
import {
RepeatStrategyLocator
} from 'aurelia-templating-resources/repeat-strategy-locator';
import {
inject
} from 'aurelia-dependency-injection';
Expand All @@ -31,12 +29,6 @@ declare module 'aurelia-ui-virtualization' {
bindable,
templateController
} from 'aurelia-templating';
import {
AbstractRepeater
} from 'aurelia-templating-resources';
import {
viewsRequireLifecycle
} from 'aurelia-templating-resources/analyze-view-factory';
export interface ViewStrategy {
getScrollContainer(element: Element): Element;
moveViewFirst(view: View, topBuffer: Element): void;
Expand Down
Loading

0 comments on commit f311d24

Please sign in to comment.