Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 3, 2018
1 parent 932d92d commit f906318
Show file tree
Hide file tree
Showing 32 changed files with 781 additions and 393 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": "1.0.0-beta.3.2.0",
"version": "1.0.0-beta.3.3.0",
"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 @@ -84,7 +84,7 @@ define(['exports', 'aurelia-templating-resources', './utilities'], function (exp
repeat.updateBindings(view);
}

var minLength = Math.min(repeat._viewsLength, items.length);
var minLength = Math.min(repeat._viewsLength, itemsLength);
for (var _i = viewsLength; _i < minLength; _i++) {
var overrideContext = (0, _aureliaTemplatingResources.createFullOverrideContext)(repeat, items[_i], _i, itemsLength);
repeat.addView(overrideContext.bindingContext, overrideContext);
Expand Down
51 changes: 51 additions & 0 deletions dist/amd/null-virtual-repeat-strategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
define(['exports', 'aurelia-templating-resources'], function (exports, _aureliaTemplatingResources) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NullVirtualRepeatStrategy = undefined;



function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}

return call && (typeof call === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}

subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}

var NullVirtualRepeatStrategy = exports.NullVirtualRepeatStrategy = function (_NullRepeatStrategy) {
_inherits(NullVirtualRepeatStrategy, _NullRepeatStrategy);

function NullVirtualRepeatStrategy() {


return _possibleConstructorReturn(this, _NullRepeatStrategy.apply(this, arguments));
}

NullVirtualRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat) {
_NullRepeatStrategy.prototype.instanceChanged.call(this, repeat);
repeat._resetCalculation();
};

return NullVirtualRepeatStrategy;
}(_aureliaTemplatingResources.NullRepeatStrategy);
});
8 changes: 4 additions & 4 deletions dist/amd/template-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-pal', 'aurelia-templ
};

TableStrategy.prototype.createTopBufferElement = function createTopBufferElement(element) {
var elementName = element.parentNode.localName === 'ul' ? 'li' : 'div';
var elementName = /^[uo]l$/.test(element.parentNode.localName) ? 'li' : 'div';
var buffer = _aureliaPal.DOM.createElement(elementName);
var tableElement = element.parentNode.parentNode;
tableElement.parentNode.insertBefore(buffer, tableElement);
Expand All @@ -73,7 +73,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-pal', 'aurelia-templ
};

TableStrategy.prototype.createBottomBufferElement = function createBottomBufferElement(element) {
var elementName = element.parentNode.localName === 'ul' ? 'li' : 'div';
var elementName = /^[uo]l$/.test(element.parentNode.localName) ? 'li' : 'div';
var buffer = _aureliaPal.DOM.createElement(elementName);
var tableElement = element.parentNode.parentNode;
tableElement.parentNode.insertBefore(buffer, tableElement.nextSibling);
Expand Down Expand Up @@ -137,14 +137,14 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-pal', 'aurelia-templ
};

DefaultTemplateStrategy.prototype.createTopBufferElement = function createTopBufferElement(element) {
var elementName = element.parentNode.localName === 'ul' ? 'li' : 'div';
var elementName = /^[uo]l$/.test(element.parentNode.localName) ? 'li' : 'div';
var buffer = _aureliaPal.DOM.createElement(elementName);
element.parentNode.insertBefore(buffer, element);
return buffer;
};

DefaultTemplateStrategy.prototype.createBottomBufferElement = function createBottomBufferElement(element) {
var elementName = element.parentNode.localName === 'ul' ? 'li' : 'div';
var elementName = /^[uo]l$/.test(element.parentNode.localName) ? 'li' : 'div';
var buffer = _aureliaPal.DOM.createElement(elementName);
element.parentNode.insertBefore(buffer, element.nextSibling);
return buffer;
Expand Down
5 changes: 4 additions & 1 deletion 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', './array-virtual-repeat-strategy'], function (exports, _aureliaTemplatingResources, _arrayVirtualRepeatStrategy) {
define(['exports', 'aurelia-templating-resources', './array-virtual-repeat-strategy', './null-virtual-repeat-strategy'], function (exports, _aureliaTemplatingResources, _arrayVirtualRepeatStrategy, _nullVirtualRepeatStrategy) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -43,6 +43,9 @@ define(['exports', 'aurelia-templating-resources', './array-virtual-repeat-strat
_this.matchers = [];
_this.strategies = [];

_this.addStrategy(function (items) {
return items === null || items === undefined;
}, new _nullVirtualRepeatStrategy.NullVirtualRepeatStrategy());
_this.addStrategy(function (items) {
return items instanceof Array;
}, new _arrayVirtualRepeatStrategy.ArrayVirtualRepeatStrategy());
Expand Down
94 changes: 58 additions & 36 deletions dist/amd/virtual-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,9 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t

VirtualRepeat.prototype.detached = function detached() {
this.scrollContainer.removeEventListener('scroll', this.scrollListener);
this._first = 0;
this._previousFirst = 0;
this._viewsLength = 0;
this._lastRebind = 0;
this._topBufferHeight = 0;
this._bottomBufferHeight = 0;
this._scrollingDown = false;
this._scrollingUp = false;
this._switchedDirection = false;
this._resetCalculation();
this._isAttached = false;
this._ticking = false;
this._hasCalculatedSizes = false;
this.templateStrategy.removeBufferElements(this.element, this.topBuffer, this.bottomBuffer);
this.isLastIndex = false;
this.scrollContainer = null;
this.scrollContainerHeight = null;
this.distanceToTop = null;
Expand All @@ -210,40 +199,47 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
var previousLastViewIndex = this._getIndexOfLastView();

var items = this.items;
var shouldCalculateSize = !!items;
this.strategy = this.strategyLocator.getStrategy(items);
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}

if (this._itemsLength >= items.length) {
this._skipNextScrollHandle = true;
reducingItems = true;
if (shouldCalculateSize) {
if (items.length > 0 && this.viewCount() === 0) {
this.strategy.createFirstItem(this);
}

if (this._itemsLength >= items.length) {
this._skipNextScrollHandle = true;
reducingItems = true;
}
this._checkFixedHeightContainer();
this._calcInitialHeights(items.length);
}
this._checkFixedHeightContainer();
this._calcInitialHeights(items.length);
if (!this.isOneTime && !this._observeInnerCollection()) {
this._observeCollection();
}
this.strategy.instanceChanged(this, items, this._first);
this._lastRebind = this._first;

if (reducingItems && previousLastViewIndex > this.items.length - 1) {
if (this.scrollContainer.tagName === 'TBODY') {
var realScrollContainer = this.scrollContainer.parentNode.parentNode;
realScrollContainer.scrollTop = realScrollContainer.scrollTop + this.viewCount() * this.itemHeight;
} else {
this.scrollContainer.scrollTop = this.scrollContainer.scrollTop + this.viewCount() * this.itemHeight;
if (shouldCalculateSize) {
this._lastRebind = this._first;

if (reducingItems && previousLastViewIndex > this.items.length - 1) {
if (this.scrollContainer.tagName === 'TBODY') {
var realScrollContainer = this.scrollContainer.parentNode.parentNode;
realScrollContainer.scrollTop = realScrollContainer.scrollTop + this.viewCount() * this.itemHeight;
} else {
this.scrollContainer.scrollTop = this.scrollContainer.scrollTop + this.viewCount() * this.itemHeight;
}
}
}
if (!reducingItems) {
this._previousFirst = this._first;
this._scrollingDown = true;
this._scrollingUp = false;
if (!reducingItems) {
this._previousFirst = this._first;
this._scrollingDown = true;
this._scrollingUp = false;

this.isLastIndex = this._getIndexOfLastView() >= this.items.length - 1;
}
this.isLastIndex = this._getIndexOfLastView() >= this.items.length - 1;
}

this._handleScroll();
this._handleScroll();
}
};

VirtualRepeat.prototype.unbind = function unbind() {
Expand Down Expand Up @@ -277,6 +273,24 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
}
};

VirtualRepeat.prototype._resetCalculation = function _resetCalculation() {
this._first = 0;
this._previousFirst = 0;
this._viewsLength = 0;
this._lastRebind = 0;
this._topBufferHeight = 0;
this._bottomBufferHeight = 0;
this._scrollingDown = false;
this._scrollingUp = false;
this._switchedDirection = false;
this._ticking = false;
this._hasCalculatedSizes = false;
this._isAtTop = true;
this.isLastIndex = false;
this.elementsInView = 0;
this._adjustBufferHeights();
};

VirtualRepeat.prototype._onScroll = function _onScroll() {
var _this4 = this;

Expand All @@ -300,6 +314,9 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
this._skipNextScrollHandle = false;
return;
}
if (!this.items) {
return;
}
var itemHeight = this.itemHeight;
var scrollTop = this._fixedHeightContainer ? this.scrollContainer.scrollTop : pageYOffset - this.distanceToTop;
this._first = Math.floor(scrollTop / itemHeight);
Expand Down Expand Up @@ -510,7 +527,12 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
VirtualRepeat.prototype._calcInitialHeights = function _calcInitialHeights(itemsLength) {
var _this7 = this;

if (this._viewsLength > 0 && this._itemsLength === itemsLength || this._viewsLength > 0 && itemsLength < 0) {
var isSameLength = this._viewsLength > 0 && this._itemsLength === itemsLength;
if (isSameLength) {
return;
}
if (itemsLength < 1) {
this._resetCalculation();
return;
}
this._hasCalculatedSizes = true;
Expand Down
24 changes: 14 additions & 10 deletions dist/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import {
customAttribute,
View,
BoundViewFactory,
ViewSlot,
ViewResources,
TargetInstruction,
bindable,
templateController
} from 'aurelia-templating';
import {
NullRepeatStrategy,
updateOverrideContext,
ArrayRepeatStrategy,
createFullOverrideContext,
Expand All @@ -20,6 +11,16 @@ import {
updateOneTimeBinding,
viewsRequireLifecycle
} from 'aurelia-templating-resources';
import {
customAttribute,
View,
BoundViewFactory,
ViewSlot,
ViewResources,
TargetInstruction,
bindable,
templateController
} from 'aurelia-templating';
import {
inject,
Container
Expand All @@ -41,6 +42,9 @@ export declare interface TemplateStrategy {
getLastView(bottomBuffer: Element): Element;
getTopBufferDistance(topBuffer: Element): number;
}
export declare class NullVirtualRepeatStrategy extends NullRepeatStrategy {
instanceChanged(repeat?: any): any;
}
export declare class DomHelper {
getElementDistanceToTopOfDocument(element: Element): number;
hasOverflowScroll(element: Element): boolean;
Expand Down
Loading

0 comments on commit f906318

Please sign in to comment.