Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-ui-scroll

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ui-scroll - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

demo/adapter/adapter.html

4

bower.json
{
"name": "angular-ui-scroll",
"version": "1.3.2",
"version": "1.4.0",
"homepage": "https://github.com/angular-ui/ui-scroll.git",

@@ -27,5 +27,5 @@ "description": "AngularJS infinite scrolling module",

"**/.*",
"Gruntfile.coffee",
"Gruntfile.js",
"package.json"
]
}
/*!
* angular-ui-scroll
* https://github.com/angular-ui/ui-scroll.git
* Version: 1.3.2 -- 2015-09-03T13:52:16.202Z
* Version: 1.4.0 -- 2016-04-04T13:10:12.966Z
* License: MIT

@@ -11,229 +11,284 @@ */

'use strict';
angular.module('ui.scroll.jqlite', ['ui.scroll']).service('jqLiteExtras', [
'$log', '$window', function(console, window) {
return {
registerFor: function(element) {
var convertToPx, css, getMeasurements, getStyle, getWidthHeight, isWindow, scrollTo;
css = angular.element.prototype.css;
element.prototype.css = function(name, value) {
var elem, self;
self = this;
elem = self[0];
if (!(!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style)) {
return css.call(self, name, value);
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; }();
angular.module('ui.scroll.jqlite', ['ui.scroll']).service('jqLiteExtras', ['$log', '$window', function (console, window) {
return {
registerFor: function registerFor(element) {
var convertToPx, css, getStyle, isWindow;
// angular implementation blows up if elem is the window
css = angular.element.prototype.css;
element.prototype.css = function (name, value) {
var self = this;
var elem = self[0];
if (!(!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style)) {
return css.call(self, name, value);
}
};
// as defined in angularjs v1.0.5
isWindow = function isWindow(obj) {
return obj && obj.document && obj.location && obj.alert && obj.setInterval;
};
function scrollTo(self, direction, value) {
var elem = self[0];
var _top$left$direction = _slicedToArray({
top: ['scrollTop', 'pageYOffset', 'scrollLeft'],
left: ['scrollLeft', 'pageXOffset', 'scrollTop']
}[direction], 3);
var method = _top$left$direction[0];
var prop = _top$left$direction[1];
var preserve = _top$left$direction[2];
if (isWindow(elem)) {
if (angular.isDefined(value)) {
return elem.scrollTo(self[preserve].call(self), value);
}
return prop in elem ? elem[prop] : elem.document.documentElement[method];
} else {
if (angular.isDefined(value)) {
elem[method] = value;
}
return elem[method];
}
}
if (window.getComputedStyle) {
getStyle = function getStyle(elem) {
return window.getComputedStyle(elem, null);
};
isWindow = function(obj) {
return obj && obj.document && obj.location && obj.alert && obj.setInterval;
convertToPx = function convertToPx(elem, value) {
return parseFloat(value);
};
scrollTo = function(self, direction, value) {
var elem, method, preserve, prop, ref;
elem = self[0];
ref = {
top: ['scrollTop', 'pageYOffset', 'scrollLeft'],
left: ['scrollLeft', 'pageXOffset', 'scrollTop']
}[direction], method = ref[0], prop = ref[1], preserve = ref[2];
if (isWindow(elem)) {
if (angular.isDefined(value)) {
return elem.scrollTo(self[preserve].call(self), value);
} else {
if (prop in elem) {
return elem[prop];
} else {
return elem.document.documentElement[method];
}
}
} else {
if (angular.isDefined(value)) {
return elem[method] = value;
} else {
return elem[method];
}
}
} else {
getStyle = function getStyle(elem) {
return elem.currentStyle;
};
if (window.getComputedStyle) {
getStyle = function(elem) {
return window.getComputedStyle(elem, null);
};
convertToPx = function(elem, value) {
convertToPx = function convertToPx(elem, value) {
var left = undefined,
result = undefined,
rs = undefined,
rsLeft = undefined,
style = undefined;
var core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
var rnumnonpx = new RegExp('^(' + core_pnum + ')(?!px)[a-z%]+$', 'i');
if (!rnumnonpx.test(value)) {
return parseFloat(value);
};
} else {
getStyle = function(elem) {
return elem.currentStyle;
};
convertToPx = function(elem, value) {
var core_pnum, left, result, rnumnonpx, rs, rsLeft, style;
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
rnumnonpx = new RegExp('^(' + core_pnum + ')(?!px)[a-z%]+$', 'i');
if (!rnumnonpx.test(value)) {
return parseFloat(value);
} else {
style = elem.style;
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
if (rs) {
rs.left = style.left;
}
style.left = value;
result = style.pixelLeft;
style.left = left;
if (rsLeft) {
rs.left = rsLeft;
}
return result;
}
};
}
getMeasurements = function(elem, measure) {
var base, borderA, borderB, computedMarginA, computedMarginB, computedStyle, dirA, dirB, marginA, marginB, paddingA, paddingB, ref;
if (isWindow(elem)) {
base = document.documentElement[{
height: 'clientHeight',
width: 'clientWidth'
}[measure]];
return {
base: base,
padding: 0,
border: 0,
margin: 0
};
}
ref = {
width: [elem.offsetWidth, 'Left', 'Right'],
height: [elem.offsetHeight, 'Top', 'Bottom']
}[measure], base = ref[0], dirA = ref[1], dirB = ref[2];
computedStyle = getStyle(elem);
paddingA = convertToPx(elem, computedStyle['padding' + dirA]) || 0;
paddingB = convertToPx(elem, computedStyle['padding' + dirB]) || 0;
borderA = convertToPx(elem, computedStyle['border' + dirA + 'Width']) || 0;
borderB = convertToPx(elem, computedStyle['border' + dirB + 'Width']) || 0;
computedMarginA = computedStyle['margin' + dirA];
computedMarginB = computedStyle['margin' + dirB];
marginA = convertToPx(elem, computedMarginA) || 0;
marginB = convertToPx(elem, computedMarginB) || 0;
// ported from JQuery
style = elem.style;
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
if (rs) {
rs.left = style.left;
}
// put in the new values to get a computed style out
style.left = value;
result = style.pixelLeft;
style.left = left;
if (rsLeft) {
rs.left = rsLeft;
}
return result;
};
}
function getMeasurements(elem, measure) {
var base = undefined,
borderA = undefined,
borderB = undefined,
computedMarginA = undefined,
computedMarginB = undefined,
computedStyle = undefined,
dirA = undefined,
dirB = undefined,
marginA = undefined,
marginB = undefined,
paddingA = undefined,
paddingB = undefined;
if (isWindow(elem)) {
base = document.documentElement[{ height: 'clientHeight', width: 'clientWidth' }[measure]];
return {
base: base,
padding: paddingA + paddingB,
border: borderA + borderB,
margin: marginA + marginB
padding: 0,
border: 0,
margin: 0
};
}
// Start with offset property
var _width$height$measure = _slicedToArray({
width: [elem.offsetWidth, 'Left', 'Right'],
height: [elem.offsetHeight, 'Top', 'Bottom']
}[measure], 3);
base = _width$height$measure[0];
dirA = _width$height$measure[1];
dirB = _width$height$measure[2];
computedStyle = getStyle(elem);
paddingA = convertToPx(elem, computedStyle['padding' + dirA]) || 0;
paddingB = convertToPx(elem, computedStyle['padding' + dirB]) || 0;
borderA = convertToPx(elem, computedStyle['border' + dirA + 'Width']) || 0;
borderB = convertToPx(elem, computedStyle['border' + dirB + 'Width']) || 0;
computedMarginA = computedStyle['margin' + dirA];
computedMarginB = computedStyle['margin' + dirB];
// I do not care for width for now, so this hack is irrelevant
// if ( !supportsPercentMargin )
// computedMarginA = hackPercentMargin( elem, computedStyle, computedMarginA )
// computedMarginB = hackPercentMargin( elem, computedStyle, computedMarginB )
marginA = convertToPx(elem, computedMarginA) || 0;
marginB = convertToPx(elem, computedMarginB) || 0;
return {
base: base,
padding: paddingA + paddingB,
border: borderA + borderB,
margin: marginA + marginB
};
getWidthHeight = function(elem, direction, measure) {
var computedStyle, measurements, result;
measurements = getMeasurements(elem, direction);
if (measurements.base > 0) {
return {
base: measurements.base - measurements.padding - measurements.border,
outer: measurements.base,
outerfull: measurements.base + measurements.margin
}[measure];
}
function getWidthHeight(elem, direction, measure) {
var computedStyle = undefined,
result = undefined;
var measurements = getMeasurements(elem, direction);
if (measurements.base > 0) {
return {
base: measurements.base - measurements.padding - measurements.border,
outer: measurements.base,
outerfull: measurements.base + measurements.margin
}[measure];
}
// Fall back to computed then uncomputed css if necessary
computedStyle = getStyle(elem);
result = computedStyle[direction];
if (result < 0 || result === null) {
result = elem.style[direction] || 0;
}
// Normalize '', auto, and prepare for extra
result = parseFloat(result) || 0;
return {
base: result - measurements.padding - measurements.border,
outer: result,
outerfull: result + measurements.padding + measurements.border + measurements.margin
}[measure];
}
// define missing methods
return angular.forEach({
before: function before(newElem) {
var children, elem, i, j, parent, ref, self;
self = this;
elem = self[0];
parent = self.parent();
children = parent.contents();
if (children[0] === elem) {
return parent.prepend(newElem);
} else {
computedStyle = getStyle(elem);
result = computedStyle[direction];
if (result < 0 || result === null) {
result = elem.style[direction] || 0;
for (i = j = 1, ref = children.length - 1; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {
if (children[i] === elem) {
angular.element(children[i - 1]).after(newElem);
return;
}
}
result = parseFloat(result) || 0;
return {
base: result - measurements.padding - measurements.border,
outer: result,
outerfull: result + measurements.padding + measurements.border + measurements.margin
}[measure];
throw new Error('invalid DOM structure ' + elem.outerHTML);
}
};
return angular.forEach({
before: function(newElem) {
var children, elem, i, j, parent, ref, self;
self = this;
elem = self[0];
parent = self.parent();
children = parent.contents();
if (children[0] === elem) {
return parent.prepend(newElem);
} else {
for (i = j = 1, ref = children.length - 1; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {
if (children[i] === elem) {
angular.element(children[i - 1]).after(newElem);
return;
}
}
throw new Error('invalid DOM structure ' + elem.outerHTML);
},
height: function height(value) {
var self;
self = this;
if (angular.isDefined(value)) {
if (angular.isNumber(value)) {
value = value + 'px';
}
},
height: function(value) {
var self;
self = this;
if (angular.isDefined(value)) {
if (angular.isNumber(value)) {
value = value + 'px';
}
return css.call(self, 'height', value);
} else {
return getWidthHeight(this[0], 'height', 'base');
}
},
outerHeight: function(option) {
return getWidthHeight(this[0], 'height', option ? 'outerfull' : 'outer');
},
return css.call(self, 'height', value);
} else {
return getWidthHeight(this[0], 'height', 'base');
}
},
outerHeight: function outerHeight(option) {
return getWidthHeight(this[0], 'height', option ? 'outerfull' : 'outer');
},
/*
The offset setter method is not implemented
*/
offset: function(value) {
var box, doc, docElem, elem, self, win;
self = this;
if (arguments.length) {
if (value === void 0) {
return self;
} else {
throw new Error('offset setter method is not implemented');
}
/*
The offset setter method is not implemented
*/
offset: function offset(value) {
var docElem = undefined,
win = undefined;
var self = this;
var box = {
top: 0,
left: 0
};
var elem = self[0];
var doc = elem && elem.ownerDocument;
if (arguments.length) {
if (value === undefined) {
return self;
}
box = {
top: 0,
left: 0
};
elem = self[0];
doc = elem && elem.ownerDocument;
if (!doc) {
return;
}
docElem = doc.documentElement;
if (elem.getBoundingClientRect != null) {
box = elem.getBoundingClientRect();
}
win = doc.defaultView || doc.parentWindow;
return {
top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
};
},
scrollTop: function(value) {
return scrollTo(this, 'top', value);
},
scrollLeft: function(value) {
return scrollTo(this, 'left', value);
// TODO: implement setter
throw new Error('offset setter method is not implemented');
}
}, function(value, key) {
if (!element.prototype[key]) {
return element.prototype[key] = value;
if (!doc) {
return;
}
});
}
};
}
]).run([
'$log', '$window', 'jqLiteExtras', function(console, window, jqLiteExtras) {
if (!window.jQuery) {
return jqLiteExtras.registerFor(angular.element);
docElem = doc.documentElement;
// TODO: Make sure it's not a disconnected DOM node
if (elem.getBoundingClientRect != null) {
box = elem.getBoundingClientRect();
}
win = doc.defaultView || doc.parentWindow;
return {
top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
};
},
scrollTop: function scrollTop(value) {
return scrollTo(this, 'top', value);
},
scrollLeft: function scrollLeft(value) {
return scrollTo(this, 'left', value);
}
}, function (value, key) {
if (!element.prototype[key]) {
return element.prototype[key] = value;
}
});
}
};
}]).run(['$log', '$window', 'jqLiteExtras', function (console, window, jqLiteExtras) {
if (!window.jQuery) {
return jqLiteExtras.registerFor(angular.element);
}
]);
/*
//# sourceURL=src/ui-scroll-jqlite.js
*/
}]);
}());
/*!
* angular-ui-scroll
* https://github.com/angular-ui/ui-scroll.git
* Version: 1.3.2 -- 2015-09-03T13:52:16.202Z
* Version: 1.4.0 -- 2016-04-04T13:10:12.966Z
* License: MIT
*/
!function(){"use strict";angular.module("ui.scroll.jqlite",["ui.scroll"]).service("jqLiteExtras",["$log","$window",function(a,b){return{registerFor:function(a){var c,d,e,f,g,h,i;return d=angular.element.prototype.css,a.prototype.css=function(a,b){var c,e;return e=this,c=e[0],c&&3!==c.nodeType&&8!==c.nodeType&&c.style?d.call(e,a,b):void 0},h=function(a){return a&&a.document&&a.location&&a.alert&&a.setInterval},i=function(a,b,c){var d,e,f,g,i;return d=a[0],i={top:["scrollTop","pageYOffset","scrollLeft"],left:["scrollLeft","pageXOffset","scrollTop"]}[b],e=i[0],g=i[1],f=i[2],h(d)?angular.isDefined(c)?d.scrollTo(a[f].call(a),c):g in d?d[g]:d.document.documentElement[e]:angular.isDefined(c)?d[e]=c:d[e]},b.getComputedStyle?(f=function(a){return b.getComputedStyle(a,null)},c=function(a,b){return parseFloat(b)}):(f=function(a){return a.currentStyle},c=function(a,b){var c,d,e,f,g,h,i;return c=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,f=new RegExp("^("+c+")(?!px)[a-z%]+$","i"),f.test(b)?(i=a.style,d=i.left,g=a.runtimeStyle,h=g&&g.left,g&&(g.left=i.left),i.left=b,e=i.pixelLeft,i.left=d,h&&(g.left=h),e):parseFloat(b)}),e=function(a,b){var d,e,g,i,j,k,l,m,n,o,p,q,r;return h(a)?(d=document.documentElement[{height:"clientHeight",width:"clientWidth"}[b]],{base:d,padding:0,border:0,margin:0}):(r={width:[a.offsetWidth,"Left","Right"],height:[a.offsetHeight,"Top","Bottom"]}[b],d=r[0],l=r[1],m=r[2],k=f(a),p=c(a,k["padding"+l])||0,q=c(a,k["padding"+m])||0,e=c(a,k["border"+l+"Width"])||0,g=c(a,k["border"+m+"Width"])||0,i=k["margin"+l],j=k["margin"+m],n=c(a,i)||0,o=c(a,j)||0,{base:d,padding:p+q,border:e+g,margin:n+o})},g=function(a,b,c){var d,g,h;return g=e(a,b),g.base>0?{base:g.base-g.padding-g.border,outer:g.base,outerfull:g.base+g.margin}[c]:(d=f(a),h=d[b],(0>h||null===h)&&(h=a.style[b]||0),h=parseFloat(h)||0,{base:h-g.padding-g.border,outer:h,outerfull:h+g.padding+g.border+g.margin}[c])},angular.forEach({before:function(a){var b,c,d,e,f,g,h;if(h=this,c=h[0],f=h.parent(),b=f.contents(),b[0]===c)return f.prepend(a);for(d=e=1,g=b.length-1;g>=1?g>=e:e>=g;d=g>=1?++e:--e)if(b[d]===c)return void angular.element(b[d-1]).after(a);throw new Error("invalid DOM structure "+c.outerHTML)},height:function(a){var b;return b=this,angular.isDefined(a)?(angular.isNumber(a)&&(a+="px"),d.call(b,"height",a)):g(this[0],"height","base")},outerHeight:function(a){return g(this[0],"height",a?"outerfull":"outer")},offset:function(a){var b,c,d,e,f,g;if(f=this,arguments.length){if(void 0===a)return f;throw new Error("offset setter method is not implemented")}return b={top:0,left:0},e=f[0],(c=e&&e.ownerDocument)?(d=c.documentElement,null!=e.getBoundingClientRect&&(b=e.getBoundingClientRect()),g=c.defaultView||c.parentWindow,{top:b.top+(g.pageYOffset||d.scrollTop)-(d.clientTop||0),left:b.left+(g.pageXOffset||d.scrollLeft)-(d.clientLeft||0)}):void 0},scrollTop:function(a){return i(this,"top",a)},scrollLeft:function(a){return i(this,"left",a)}},function(b,c){return a.prototype[c]?void 0:a.prototype[c]=b})}}}]).run(["$log","$window","jqLiteExtras",function(a,b,c){return b.jQuery?void 0:c.registerFor(angular.element)}])}();
!function(){"use strict";var a=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(i){e=!0,f=i}finally{try{!d&&h["return"]&&h["return"]()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();angular.module("ui.scroll.jqlite",["ui.scroll"]).service("jqLiteExtras",["$log","$window",function(b,c){return{registerFor:function(b){function d(b,c,d){var e=b[0],f=a({top:["scrollTop","pageYOffset","scrollLeft"],left:["scrollLeft","pageXOffset","scrollTop"]}[c],3),g=f[0],h=f[1],i=f[2];return j(e)?angular.isDefined(d)?e.scrollTo(b[i].call(b),d):h in e?e[h]:e.document.documentElement[g]:(angular.isDefined(d)&&(e[g]=d),e[g])}function e(b,c){var d=void 0,e=void 0,f=void 0,h=void 0,k=void 0,l=void 0,m=void 0,n=void 0,o=void 0,p=void 0,q=void 0,r=void 0;if(j(b))return d=document.documentElement[{height:"clientHeight",width:"clientWidth"}[c]],{base:d,padding:0,border:0,margin:0};var s=a({width:[b.offsetWidth,"Left","Right"],height:[b.offsetHeight,"Top","Bottom"]}[c],3);return d=s[0],m=s[1],n=s[2],l=i(b),q=g(b,l["padding"+m])||0,r=g(b,l["padding"+n])||0,e=g(b,l["border"+m+"Width"])||0,f=g(b,l["border"+n+"Width"])||0,h=l["margin"+m],k=l["margin"+n],o=g(b,h)||0,p=g(b,k)||0,{base:d,padding:q+r,border:e+f,margin:o+p}}function f(a,b,c){var d=void 0,f=void 0,g=e(a,b);return g.base>0?{base:g.base-g.padding-g.border,outer:g.base,outerfull:g.base+g.margin}[c]:(d=i(a),f=d[b],(0>f||null===f)&&(f=a.style[b]||0),f=parseFloat(f)||0,{base:f-g.padding-g.border,outer:f,outerfull:f+g.padding+g.border+g.margin}[c])}var g,h,i,j;return h=angular.element.prototype.css,b.prototype.css=function(a,b){var c=this,d=c[0];return d&&3!==d.nodeType&&8!==d.nodeType&&d.style?h.call(c,a,b):void 0},j=function(a){return a&&a.document&&a.location&&a.alert&&a.setInterval},c.getComputedStyle?(i=function(a){return c.getComputedStyle(a,null)},g=function(a,b){return parseFloat(b)}):(i=function(a){return a.currentStyle},g=function(a,b){var c=void 0,d=void 0,e=void 0,f=void 0,g=void 0,h=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,i=new RegExp("^("+h+")(?!px)[a-z%]+$","i");return i.test(b)?(g=a.style,c=g.left,e=a.runtimeStyle,f=e&&e.left,e&&(e.left=g.left),g.left=b,d=g.pixelLeft,g.left=c,f&&(e.left=f),d):parseFloat(b)}),angular.forEach({before:function(a){var b,c,d,e,f,g,h;if(h=this,c=h[0],f=h.parent(),b=f.contents(),b[0]===c)return f.prepend(a);for(d=e=1,g=b.length-1;g>=1?g>=e:e>=g;d=g>=1?++e:--e)if(b[d]===c)return void angular.element(b[d-1]).after(a);throw new Error("invalid DOM structure "+c.outerHTML)},height:function(a){var b;return b=this,angular.isDefined(a)?(angular.isNumber(a)&&(a+="px"),h.call(b,"height",a)):f(this[0],"height","base")},outerHeight:function(a){return f(this[0],"height",a?"outerfull":"outer")},offset:function(a){var b=void 0,c=void 0,d=this,e={top:0,left:0},f=d[0],g=f&&f.ownerDocument;if(arguments.length){if(void 0===a)return d;throw new Error("offset setter method is not implemented")}return g?(b=g.documentElement,null!=f.getBoundingClientRect&&(e=f.getBoundingClientRect()),c=g.defaultView||g.parentWindow,{top:e.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:e.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):void 0},scrollTop:function(a){return d(this,"top",a)},scrollLeft:function(a){return d(this,"left",a)}},function(a,c){return b.prototype[c]?void 0:b.prototype[c]=a})}}}]).run(["$log","$window","jqLiteExtras",function(a,b,c){return b.jQuery?void 0:c.registerFor(angular.element)}])}();
/*!
* angular-ui-scroll
* https://github.com/angular-ui/ui-scroll.git
* Version: 1.3.2 -- 2015-09-03T13:52:16.202Z
* Version: 1.4.0 -- 2016-04-04T13:10:12.966Z
* License: MIT

@@ -12,647 +12,885 @@ */

var _typeof = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === 'function' && obj.constructor === Symbol ? 'symbol' : typeof obj; };
/*!
globals: angular, window
globals: angular, window
List of used element methods available in JQuery but not in JQuery Lite
List of used element methods available in JQuery but not in JQuery Lite
element.before(elem)
element.height()
element.outerHeight(true)
element.height(value) = only for Top/Bottom padding elements
element.scrollTop()
element.scrollTop(value)
element.before(elem)
element.height()
element.outerHeight(true)
element.height(value) = only for Top/Bottom padding elements
element.scrollTop()
element.scrollTop(value)
*/
angular.module('ui.scroll', []).directive('uiScrollViewport', function() {
angular.module('ui.scroll', []).directive('uiScrollViewport', function () {
return {
controller: [
'$scope', '$element', function(scope, element) {
this.viewport = element;
return this;
}
]
controller: ['$scope', '$element', function (scope, element) {
this.viewport = element;
return this;
}]
};
}).directive('uiScroll', [
'$log', '$injector', '$rootScope', '$timeout', '$q', '$parse', function(console, $injector, $rootScope, $timeout, $q, $parse) {
var $animate;
if ($injector.has && $injector.has('$animate')) {
$animate = $injector.get('$animate');
}).directive('uiScroll', ['$log', '$injector', '$rootScope', '$timeout', '$q', '$parse', function (console, $injector, $rootScope, $timeout, $q, $parse) {
var $animate = $injector.has && $injector.has('$animate') ? $injector.get('$animate') : null;
var isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;
//const log = console.debug || console.log;
return {
require: ['?^uiScrollViewport'],
transclude: 'element',
priority: 1000,
terminal: true,
compile: compile
};
// Element manipulation routines
function _insertElement(newElement, previousElement) {
previousElement.after(newElement);
return [];
}
function removeElement(wrapper) {
wrapper.element.remove();
wrapper.scope.$destroy();
return [];
}
function _insertElementAnimated(newElement, previousElement) {
if (!$animate) {
return _insertElement(newElement, previousElement);
}
return {
require: ['?^uiScrollViewport'],
transclude: 'element',
priority: 1000,
terminal: true,
compile: function(elementTemplate, attr, linker) {
return function($scope, element, $attr, controllers) {
var adapter, adapterOnScope, adjustBuffer, adjustBufferAfterFetch, applyUpdate, bof, bottomVisiblePos, buffer, bufferPadding, bufferSize, builder, calculateTopProperties, clipBottom, clipTop, datasource, datasourceName, dismissPendingRequests, enqueueFetch, eof, eventListener, fetch, first, insertElement, insertElementAnimated, insertItem, insertWrapperContent, isAngularVersionLessThen1_3, isDatasourceValid, isElementVisible, itemName, loading, log, match, next, pending, processBufferedItems, reload, removeFromBuffer, removeItem, resizeAndScrollHandler, ridActual, scrollHeight, shouldLoadBottom, shouldLoadTop, topVisible, topVisiblePos, unsupportedMethod, viewport, viewportScope, visibilityWatcher, wheelHandler;
log = console.debug || console.log;
if (!(match = $attr.uiScroll.match(/^\s*(\w+)\s+in\s+([\w\.]+)\s*$/))) {
throw new Error('Expected uiScroll in form of \'_item_ in _datasource_\' but got \' + $attr.uiScroll + \'');
if (isAngularVersionLessThen1_3) {
var _ret = function () {
var deferred = $q.defer();
// no need for parent - previous element is never null
$animate.enter(newElement, null, previousElement, function () {
return deferred.resolve();
});
return {
v: [deferred.promise]
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === 'object') return _ret.v;
}
// no need for parent - previous element is never null
return [$animate.enter(newElement, null, previousElement)];
}
function removeElementAnimated(wrapper) {
if (!$animate) {
return removeElement(wrapper);
}
if (isAngularVersionLessThen1_3) {
var _ret2 = function () {
var deferred = $q.defer();
$animate.leave(wrapper.element, function () {
wrapper.scope.$destroy();
return deferred.resolve();
});
return {
v: [deferred.promise]
};
}();
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === 'object') return _ret2.v;
}
return [$animate.leave(wrapper.element).then(function () {
return wrapper.scope.$destroy();
})];
}
function Buffer(itemName, $scope, linker, bufferSize) {
var buffer = Object.create(Array.prototype);
function reset(origin) {
buffer.eof = false;
buffer.bof = false;
buffer.first = origin;
buffer.next = origin;
buffer.minIndex = Number.MAX_VALUE;
buffer.maxIndex = Number.MIN_VALUE;
}
angular.extend(buffer, {
size: bufferSize,
append: function append(items) {
items.forEach(function (item) {
++buffer.next;
buffer.insert('append', item);
});
},
prepend: function prepend(items) {
items.reverse().forEach(function (item) {
--buffer.first;
buffer.insert('prepend', item);
});
},
/**
* inserts wrapped element in the buffer
* the first argument is either operation keyword (see below) or a number for operation 'insert'
* for insert the number is the index for the buffer element the new one have to be inserted after
* operations: 'append', 'prepend', 'insert', 'remove', 'update', 'none'
*/
insert: function insert(operation, item) {
var itemScope = $scope.$new();
var wrapper = {
item: item,
scope: itemScope
};
itemScope[itemName] = item;
linker(itemScope, function (clone) {
return wrapper.element = clone;
});
if (operation % 1 === 0) {
// it is an insert
wrapper.op = 'insert';
buffer.splice(operation, 0, wrapper);
} else {
wrapper.op = operation;
switch (operation) {
case 'append':
buffer.push(wrapper);
break;
case 'prepend':
buffer.unshift(wrapper);
break;
}
itemName = match[1];
datasourceName = match[2];
datasource = $parse(datasourceName)($scope);
isDatasourceValid = function() {
return angular.isObject(datasource) && angular.isFunction(datasource.get);
};
}
},
// removes elements from buffer
remove: function remove(arg1, arg2) {
if (angular.isNumber(arg1)) {
// removes items from arg1 (including) through arg2 (excluding)
for (var i = arg1; i < arg2; i++) {
removeElement(buffer[i]);
}
return buffer.splice(arg1, arg2 - arg1);
}
// removes single item(wrapper) from the buffer
buffer.splice(buffer.indexOf(arg1), 1);
return removeElementAnimated(arg1);
},
setUpper: function setUpper() {
buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex);
},
setLower: function setLower() {
buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex);
},
syncDatasource: function syncDatasource(datasource) {
var offset = buffer.minIndex - Math.min(buffer.minIndex, datasource.minIndex || Number.MAX_VALUE);
datasource.minIndex = buffer.minIndex -= offset;
datasource.maxIndex = buffer.maxIndex = Math.max(buffer.maxIndex, datasource.maxIndex || Number.MIN_VALUE);
return offset;
},
// clears the buffer
clear: function clear() {
buffer.remove(0, buffer.length);
arguments.length ? reset(arguments[0]) : reset(1);
}
});
reset(1);
return buffer;
}
function Viewport(buffer, element, controllers, attrs) {
var PADDING_MIN = 0.3;
var PADDING_DEFAULT = 0.5;
var topPadding = null;
var bottomPadding = null;
var averageItemHeight = 0;
var viewport = controllers[0] && controllers[0].viewport ? controllers[0].viewport : angular.element(window);
viewport.css({
'overflow-y': 'auto',
'display': 'block'
});
var viewportOffset = viewport.offset() ? function () {
return viewport.offset();
} : function () {
return { top: 0 };
};
function bufferPadding() {
return viewport.outerHeight() * Math.max(PADDING_MIN, +attrs.padding || PADDING_DEFAULT); // some extra space to initiate preload
}
angular.extend(viewport, {
createPaddingElements: function createPaddingElements(template) {
topPadding = new Padding(template);
bottomPadding = new Padding(template);
element.before(topPadding);
element.after(bottomPadding);
function Padding(template) {
var result = undefined;
var tagName = template.localName;
switch (tagName) {
case 'dl':
throw new Error('ui-scroll directive does not support <' + tagName + '> as a repeating tag: ' + template.outerHTML);
case 'tr':
var table = angular.element('<table><tr><td><div></div></td></tr></table>');
result = table.find('tr');
break;
case 'li':
result = angular.element('<li></li>');
break;
default:
result = angular.element('<div></div>');
}
return result;
}
},
bottomDataPos: function bottomDataPos() {
var scrollHeight = viewport[0].scrollHeight;
scrollHeight = scrollHeight != null ? scrollHeight : viewport[0].document.documentElement.scrollHeight;
return scrollHeight - bottomPadding.height();
},
topDataPos: function topDataPos() {
return topPadding.height();
},
bottomVisiblePos: function bottomVisiblePos() {
return viewport.scrollTop() + viewport.outerHeight();
},
topVisiblePos: function topVisiblePos() {
return viewport.scrollTop();
},
insertElement: function insertElement(e, sibling) {
return _insertElement(e, sibling || topPadding);
},
insertElementAnimated: function insertElementAnimated(e, sibling) {
return _insertElementAnimated(e, sibling || topPadding);
},
shouldLoadBottom: function shouldLoadBottom() {
return !buffer.eof && viewport.bottomDataPos() < viewport.bottomVisiblePos() + bufferPadding();
},
clipBottom: function clipBottom() {
// clip the invisible items off the bottom
var overage = 0;
for (var i = buffer.length - 1; i >= 0; i--) {
if (buffer[i].element.offset().top - viewportOffset().top <= viewport.outerHeight() + bufferPadding()) {
break;
}
overage++;
}
if (overage > 0) {
buffer.eof = false;
buffer.remove(buffer.length - overage, buffer.length);
buffer.next -= overage;
viewport.adjustPadding();
}
},
shouldLoadTop: function shouldLoadTop() {
return !buffer.bof && viewport.topDataPos() > viewport.topVisiblePos() - bufferPadding();
},
clipTop: function clipTop() {
// clip the invisible items off the top
var overage = 0;
var overageHeight = 0;
for (var i = 0; i < buffer.length; i++) {
if (buffer[i].element.offset().top - viewportOffset().top + buffer[i].element.outerHeight(true) >= -1 * bufferPadding()) {
break;
}
overageHeight += buffer[i].element.outerHeight(true);
overage++;
}
if (overage > 0) {
// we need to adjust top padding element before items are removed from top
// to avoid strange behaviour of scroll bar during remove top items when we are at the very bottom
topPadding.height(topPadding.height() + overageHeight);
buffer.bof = false;
buffer.remove(0, overage);
buffer.first += overage;
}
},
adjustPadding: function adjustPadding() {
if (!buffer.length) {
return;
}
var bufferFirstEl = buffer[0].element;
var bufferLastEl = buffer[buffer.length - 1].element;
averageItemHeight = (bufferLastEl.offset().top + bufferLastEl.outerHeight(true) - bufferFirstEl.offset().top) / buffer.length;
topPadding.height((buffer.first - buffer.minIndex) * averageItemHeight);
return bottomPadding.height((buffer.maxIndex - buffer.next + 1) * averageItemHeight);
},
syncDatasource: function syncDatasource(datasource) {
if (!buffer.length) {
return;
}
var delta = buffer.syncDatasource(datasource) * averageItemHeight;
topPadding.height(topPadding.height() + delta);
viewport.scrollTop(viewport.scrollTop() + delta);
viewport.adjustPadding();
},
adjustScrollTop: function adjustScrollTop(height) {
var paddingHeight = topPadding.height() - height;
if (paddingHeight >= 0) {
topPadding.height(paddingHeight);
} else {
topPadding.height(0);
viewport.scrollTop(viewport.scrollTop() - paddingHeight);
}
},
resetTopPaddingHeight: function resetTopPaddingHeight() {
topPadding.height(0);
},
resetBottomPaddingHeight: function resetBottomPaddingHeight() {
bottomPadding.height(0);
}
});
return viewport;
}
function Adapter($attr, viewport, buffer, adjustBuffer) {
var viewportScope = viewport.scope() || $rootScope;
var setTopVisible = $attr.topVisible ? $parse($attr.topVisible).assign : angular.noop;
var setTopVisibleElement = $attr.topVisibleElement ? $parse($attr.topVisibleElement).assign : angular.noop;
var setTopVisibleScope = $attr.topVisibleScope ? $parse($attr.topVisibleScope).assign : angular.noop;
var setIsLoading = $attr.isLoading ? $parse($attr.isLoading).assign : angular.noop;
this.isLoading = false;
function applyUpdate(wrapper, newItems) {
if (!angular.isArray(newItems)) {
return;
}
var keepIt = undefined;
var pos = buffer.indexOf(wrapper) + 1;
newItems.reverse().forEach(function (newItem) {
if (newItem === wrapper.item) {
keepIt = true;
pos--;
} else {
buffer.insert(pos, newItem);
}
});
if (!keepIt) {
wrapper.op = 'remove';
}
}
this.applyUpdates = function (arg1, arg2) {
if (angular.isFunction(arg1)) {
// arg1 is the updater function, arg2 is ignored
buffer.slice(0).forEach(function (wrapper) {
// we need to do it on the buffer clone, because buffer content
// may change as we iterate through
applyUpdate(wrapper, arg1(wrapper.item, wrapper.scope, wrapper.element));
});
} else {
// arg1 is item index, arg2 is the newItems array
if (arg1 % 1 !== 0) {
// checking if it is an integer
throw new Error('applyUpdates - ' + arg1 + ' is not a valid index');
}
var index = arg1 - buffer.first;
if (index >= 0 && index < buffer.length) {
applyUpdate(buffer[index], arg2);
}
}
adjustBuffer();
};
this.append = function (newItems) {
buffer.append(newItems);
adjustBuffer();
};
this.prepend = function (newItems) {
buffer.prepend(newItems);
adjustBuffer();
};
this.loading = function (value) {
this.isLoading = value;
setIsLoading(viewportScope, value);
};
this.calculateProperties = function () {
var i = undefined,
item = undefined,
itemHeight = undefined,
itemTop = undefined,
isNewRow = undefined,
rowTop = undefined;
var topHeight = 0;
for (i = 0; i < buffer.length; i++) {
item = buffer[i];
itemTop = item.element.offset().top;
isNewRow = rowTop !== itemTop;
rowTop = itemTop;
if (isNewRow) {
itemHeight = item.element.outerHeight(true);
}
if (isNewRow && viewport.topDataPos() + topHeight + itemHeight <= viewport.topVisiblePos()) {
topHeight += itemHeight;
} else {
if (isNewRow) {
this.topVisible = item.item;
this.topVisibleElement = item.element;
this.topVisibleScope = item.scope;
setTopVisible(viewportScope, item.item);
setTopVisibleElement(viewportScope, item.element);
setTopVisibleScope(viewportScope, item.scope);
}
break;
}
}
};
}
function compile(elementTemplate, attr, compileLinker) {
var match = attr.uiScroll.match(/^\s*(\w+)\s+in\s+([\w\.]+)\s*$/);
if (!match) {
throw new Error('Expected uiScroll in form of \'_item_ in _datasource_\' but got \'' + attr.uiScroll + '\'');
}
var itemName = match[1];
var datasourceName = match[2];
var bufferSize = Math.max(3, +attr.bufferSize || 10);
return function link($scope, element, $attr, controllers, linker) {
// starting from angular 1.2 compileLinker usage is deprecated
linker = linker || compileLinker;
var datasource = function () {
var _datasource = $parse(datasourceName)($scope);
if (!isDatasourceValid()) {
_datasource = $injector.get(datasourceName);
if (!isDatasourceValid()) {
datasource = $injector.get(datasourceName);
if (!isDatasourceValid()) {
throw new Error(datasourceName + ' is not a valid datasource');
}
throw new Error(datasourceName + ' is not a valid datasource');
}
bufferSize = Math.max(3, +$attr.bufferSize || 10);
bufferPadding = function() {
return viewport.outerHeight() * Math.max(0.1, +$attr.padding || 0.1);
}
return _datasource;
function isDatasourceValid() {
// then try to inject datasource as service
return angular.isObject(_datasource) && angular.isFunction(_datasource.get);
}
}();
var ridActual = 0; // current data revision id
var pending = [];
var buffer = new Buffer(itemName, $scope, linker, bufferSize);
var viewport = new Viewport(buffer, element, controllers, $attr);
var adapter = new Adapter($attr, viewport, buffer, function () {
dismissPendingRequests();
return adjustBuffer(ridActual);
});
var fetchNext = function () {
if (datasource.get.length !== 2) {
return function (success) {
return datasource.get(buffer.next, bufferSize, success);
};
scrollHeight = function(elem) {
var ref;
return (ref = elem[0].scrollHeight) != null ? ref : elem[0].document.documentElement.scrollHeight;
}
return function (success) {
return datasource.get({
index: buffer.next,
append: buffer.length ? buffer[buffer.length - 1].item : void 0,
count: bufferSize
}, success);
};
}();
var fetchPrevious = function () {
if (datasource.get.length !== 2) {
return function (success) {
return datasource.get(buffer.first - bufferSize, bufferSize, success);
};
builder = null;
ridActual = 0;
first = 1;
next = 1;
buffer = [];
pending = [];
eof = false;
bof = false;
isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;
removeItem = $animate ? isAngularVersionLessThen1_3 ? function(wrapper) {
var deferred;
buffer.splice(buffer.indexOf(wrapper), 1);
deferred = $q.defer();
$animate.leave(wrapper.element, function() {
wrapper.scope.$destroy();
return deferred.resolve();
});
return [deferred.promise];
} : function(wrapper) {
buffer.splice(buffer.indexOf(wrapper), 1);
return [
($animate.leave(wrapper.element)).then(function() {
return wrapper.scope.$destroy();
})
];
} : function(wrapper) {
buffer.splice(buffer.indexOf(wrapper), 1);
wrapper.element.remove();
wrapper.scope.$destroy();
return [];
};
insertElement = function(newElement, previousElement) {
element.after.apply(previousElement, [newElement]);
return [];
};
insertElementAnimated = $animate ? isAngularVersionLessThen1_3 ? function(newElement, previousElement) {
var deferred;
deferred = $q.defer();
$animate.enter(newElement, element, previousElement, function() {
return deferred.resolve();
});
return [deferred.promise];
} : function(newElement, previousElement) {
return [$animate.enter(newElement, element, previousElement)];
} : insertElement;
linker($scope.$new(), function(template, scope) {
var bottomPadding, padding, repeaterType, topPadding, viewport;
scope.$destroy();
repeaterType = template[0].localName;
if (repeaterType === 'dl') {
throw new Error('ui-scroll directive does not support <' + template[0].localName + '> as a repeating tag: ' + template[0].outerHTML);
}
if (repeaterType !== 'li' && repeaterType !== 'tr') {
repeaterType = 'div';
}
viewport = controllers[0] && controllers[0].viewport ? controllers[0].viewport : angular.element(window);
viewport.css({
'overflow-y': 'auto',
'display': 'block'
});
padding = function(repeaterType) {
var div, result, table;
switch (repeaterType) {
case 'tr':
table = angular.element('<table><tr><td><div></div></td></tr></table>');
div = table.find('div');
result = table.find('tr');
result.paddingHeight = function() {
return div.height.apply(div, arguments);
};
break;
default:
result = angular.element('<' + repeaterType + '></' + repeaterType + '>');
result.paddingHeight = result.height;
}
return result;
};
topPadding = padding(repeaterType);
element.before(topPadding);
bottomPadding = padding(repeaterType);
element.after(bottomPadding);
$scope.$on('$destroy', function() {
return template.remove();
});
return builder = {
viewport: viewport,
topPadding: function() {
return topPadding.paddingHeight.apply(topPadding, arguments);
},
bottomPadding: function() {
return bottomPadding.paddingHeight.apply(bottomPadding, arguments);
},
bottomDataPos: function() {
return scrollHeight(viewport) - bottomPadding.paddingHeight();
},
topDataPos: function() {
return topPadding.paddingHeight();
},
insertElement: function(e, sibling) {
return insertElement(e, sibling || topPadding);
},
insertElementAnimated: function(e, sibling) {
return insertElementAnimated(e, sibling || topPadding);
}
};
}
return function (success) {
return datasource.get({
index: buffer.first - bufferSize,
prepend: buffer.length ? buffer[0].item : void 0,
count: bufferSize
}, success);
};
}();
if ($attr.adapter) {
// so we have an adapter on $scope
var adapterOnScope = $parse($attr.adapter)($scope);
if (!angular.isObject(adapterOnScope)) {
$parse($attr.adapter).assign($scope, {});
adapterOnScope = $parse($attr.adapter)($scope);
}
adapter = angular.extend(adapterOnScope, adapter);
}
/**
* Build padding elements
*
* Calling linker is the only way I found to get access to the tag name of the template
* to prevent the directive scope from pollution a new scope is created and destroyed
* right after the builder creation is completed
*/
linker($scope.$new(), function (template, scope) {
viewport.createPaddingElements(template[0]);
// Destroy template's scope to remove any watchers on it.
scope.$destroy();
// We don't need template anymore.
template.remove();
});
adapter.reload = reload;
// events and bindings
function bindEvents() {
viewport.bind('resize', resizeAndScrollHandler);
viewport.bind('scroll', resizeAndScrollHandler);
}
viewport.bind('mousewheel', wheelHandler);
function unbindEvents() {
viewport.unbind('resize', resizeAndScrollHandler);
viewport.unbind('scroll', resizeAndScrollHandler);
}
$scope.$on('$destroy', function () {
// clear the buffer. It is necessary to remove the elements and $destroy the scopes
buffer.clear();
unbindEvents();
viewport.unbind('mousewheel', wheelHandler);
});
// update events (deprecated since v1.1.0, unsupported since 1.2.0)
(function () {
var eventListener = datasource.scope ? datasource.scope.$new() : $scope.$new();
eventListener.$on('insert.item', function () {
return unsupportedMethod('insert');
});
eventListener.$on('update.items', function () {
return unsupportedMethod('update');
});
eventListener.$on('delete.items', function () {
return unsupportedMethod('delete');
});
function unsupportedMethod(token) {
throw new Error(token + ' event is no longer supported - use applyUpdates instead');
}
})();
reload();
/* Functions definitions */
function dismissPendingRequests() {
ridActual++;
pending = [];
}
function reload() {
dismissPendingRequests();
viewport.resetTopPaddingHeight();
viewport.resetBottomPaddingHeight();
adapter.abCount = 0;
adapter.abfCount = 0;
adapter.sCount = 0;
if (arguments.length) {
buffer.clear(arguments[0]);
} else {
buffer.clear();
}
return adjustBuffer(ridActual);
}
function enqueueFetch(rid, direction) {
if (!adapter.isLoading) {
adapter.loading(true);
}
if (pending.push(direction) === 1) {
return fetch(rid);
}
}
function isElementVisible(wrapper) {
return wrapper.element.height() && wrapper.element[0].offsetParent;
}
function visibilityWatcher(wrapper) {
if (!isElementVisible(wrapper)) {
return;
}
buffer.forEach(function (item) {
if (angular.isFunction(item.unregisterVisibilityWatcher)) {
item.unregisterVisibilityWatcher();
delete item.unregisterVisibilityWatcher;
}
});
return adjustBuffer();
}
function insertWrapperContent(wrapper, sibling) {
viewport.insertElement(wrapper.element, sibling);
if (isElementVisible(wrapper)) {
return true;
}
wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(function () {
return visibilityWatcher(wrapper);
});
return false;
}
function processBufferedItems(rid) {
var keepFetching = false;
var promises = [];
var toBePrepended = [];
var toBeRemoved = [];
function getPreSibling(i) {
return i > 0 ? buffer[i - 1].element : undefined;
}
buffer.forEach(function (wrapper, i) {
switch (wrapper.op) {
case 'prepend':
toBePrepended.unshift(wrapper);
break;
case 'append':
keepFetching = insertWrapperContent(wrapper, getPreSibling(i)) || keepFetching;
wrapper.op = 'none';
break;
case 'insert':
promises = promises.concat(viewport.insertElementAnimated(wrapper.element, getPreSibling(i)));
wrapper.op = 'none';
break;
case 'remove':
toBeRemoved.push(wrapper);
}
});
toBeRemoved.forEach(function (wrapper) {
return promises = promises.concat(buffer.remove(wrapper));
});
if (toBePrepended.length) {
var adjustedPaddingHeight = 0;
toBePrepended.forEach(function (wrapper) {
keepFetching = insertWrapperContent(wrapper) || keepFetching;
wrapper.op = 'none';
adjustedPaddingHeight += wrapper.element.outerHeight(true);
});
viewport = builder.viewport;
viewportScope = viewport.scope() || $rootScope;
topVisible = function(item) {
adapter.topVisible = item.scope[itemName];
adapter.topVisibleElement = item.element;
adapter.topVisibleScope = item.scope;
if ($attr.topVisible) {
$parse($attr.topVisible).assign(viewportScope, adapter.topVisible);
viewport.adjustScrollTop(adjustedPaddingHeight);
}
// re-index the buffer
buffer.forEach(function (item, i) {
return item.scope.$index = buffer.first + i;
});
// schedule another adjustBuffer after animation completion
if (promises.length) {
$q.all(promises).then(function () {
viewport.adjustPadding();
// log 'Animation completed rid #{rid}'
return adjustBuffer(rid);
});
} else {
viewport.adjustPadding();
if (!pending.length) {
viewport.syncDatasource(datasource);
}
}
return keepFetching;
}
function adjustBuffer(rid) {
// We need the item bindings to be processed before we can do adjustment
return $timeout(function () {
adapter.abCount++;
processBufferedItems(rid);
if (viewport.shouldLoadBottom()) {
enqueueFetch(rid, true);
} else if (viewport.shouldLoadTop()) {
enqueueFetch(rid, false);
}
if (!pending.length) {
return adapter.calculateProperties();
}
});
}
function adjustBufferAfterFetch(rid) {
// We need the item bindings to be processed before we can do adjustment
return $timeout(function () {
adapter.abfCount++;
var keepFetching = processBufferedItems(rid);
if (viewport.shouldLoadBottom() && keepFetching) {
// keepFetching = true means that at least one item app/prepended in the last batch had height > 0
enqueueFetch(rid, true);
} else if (viewport.shouldLoadTop() && (keepFetching || pending[0])) {
// pending[0] = true means that previous fetch was appending. We need to force at least one prepend
// BTW there will always be at least 1 element in the pending array because bottom is fetched first
enqueueFetch(rid, false);
}
pending.shift();
if (!pending.length) {
adapter.loading(false);
bindEvents();
return adapter.calculateProperties();
}
return fetch(rid);
});
}
function fetch(rid) {
if (pending[0]) {
// scrolling down
if (buffer.length && !viewport.shouldLoadBottom()) {
return adjustBufferAfterFetch(rid);
}
return fetchNext(function (result) {
if (rid && rid !== ridActual || $scope.$$destroyed) {
return;
}
if ($attr.topVisibleElement) {
$parse($attr.topVisibleElement).assign(viewportScope, adapter.topVisibleElement);
if (result.length < bufferSize) {
buffer.eof = true;
// log 'eof is reached'
}
if ($attr.topVisibleScope) {
$parse($attr.topVisibleScope).assign(viewportScope, adapter.topVisibleScope);
if (result.length > 0) {
viewport.clipTop();
buffer.append(result);
}
if (angular.isFunction(datasource.topVisible)) {
return datasource.topVisible(item);
}
};
loading = function(value) {
adapter.isLoading = value;
if ($attr.isLoading) {
$parse($attr.isLoading).assign($scope, value);
}
if (angular.isFunction(datasource.loading)) {
return datasource.loading(value);
}
};
removeFromBuffer = function(start, stop) {
var i, j, ref, ref1;
for (i = j = ref = start, ref1 = stop; ref <= ref1 ? j < ref1 : j > ref1; i = ref <= ref1 ? ++j : --j) {
buffer[i].scope.$destroy();
buffer[i].element.remove();
}
return buffer.splice(start, stop - start);
};
dismissPendingRequests = function() {
ridActual++;
return pending = [];
};
reload = function() {
dismissPendingRequests();
first = 1;
next = 1;
removeFromBuffer(0, buffer.length);
builder.topPadding(0);
builder.bottomPadding(0);
eof = false;
bof = false;
return adjustBuffer(ridActual);
};
bottomVisiblePos = function() {
return viewport.scrollTop() + viewport.outerHeight();
};
topVisiblePos = function() {
return viewport.scrollTop();
};
shouldLoadBottom = function() {
return !eof && builder.bottomDataPos() < bottomVisiblePos() + bufferPadding();
};
clipBottom = function() {
var bottomHeight, i, item, itemHeight, itemTop, j, newRow, overage, ref, rowTop;
bottomHeight = 0;
overage = 0;
for (i = j = ref = buffer.length - 1; ref <= 0 ? j <= 0 : j >= 0; i = ref <= 0 ? ++j : --j) {
item = buffer[i];
itemTop = item.element.offset().top;
newRow = rowTop !== itemTop;
rowTop = itemTop;
if (newRow) {
itemHeight = item.element.outerHeight(true);
}
if (builder.bottomDataPos() - bottomHeight - itemHeight > bottomVisiblePos() + bufferPadding()) {
if (newRow) {
bottomHeight += itemHeight;
}
overage++;
eof = false;
} else {
if (newRow) {
break;
}
overage++;
}
}
if (overage > 0) {
builder.bottomPadding(builder.bottomPadding() + bottomHeight);
removeFromBuffer(buffer.length - overage, buffer.length);
return next -= overage;
}
};
shouldLoadTop = function() {
return !bof && (builder.topDataPos() > topVisiblePos() - bufferPadding());
};
clipTop = function() {
var item, itemHeight, itemTop, j, len, newRow, overage, rowTop, topHeight;
topHeight = 0;
overage = 0;
for (j = 0, len = buffer.length; j < len; j++) {
item = buffer[j];
itemTop = item.element.offset().top;
newRow = rowTop !== itemTop;
rowTop = itemTop;
if (newRow) {
itemHeight = item.element.outerHeight(true);
}
if (builder.topDataPos() + topHeight + itemHeight < topVisiblePos() - bufferPadding()) {
if (newRow) {
topHeight += itemHeight;
}
overage++;
bof = false;
} else {
if (newRow) {
break;
}
overage++;
}
}
if (overage > 0) {
builder.topPadding(builder.topPadding() + topHeight);
removeFromBuffer(0, overage);
return first += overage;
}
};
enqueueFetch = function(rid, direction) {
if (!adapter.isLoading) {
loading(true);
}
if (pending.push(direction) === 1) {
return fetch(rid);
}
};
insertItem = function(operation, item) {
var itemScope, wrapper;
itemScope = $scope.$new();
itemScope[itemName] = item;
wrapper = {
scope: itemScope
};
linker(itemScope, function(clone) {
return wrapper.element = clone;
});
if (operation % 1 === 0) {
wrapper.op = 'insert';
return buffer.splice(operation, 0, wrapper);
} else {
wrapper.op = operation;
switch (operation) {
case 'append':
return buffer.push(wrapper);
case 'prepend':
return buffer.unshift(wrapper);
}
}
};
isElementVisible = function(wrapper) {
return wrapper.element.height() && wrapper.element[0].offsetParent;
};
visibilityWatcher = function(wrapper) {
var item, j, len;
if (isElementVisible(wrapper)) {
for (j = 0, len = buffer.length; j < len; j++) {
item = buffer[j];
item.unregisterVisibilityWatcher();
delete item.unregisterVisibilityWatcher;
}
return adjustBuffer();
}
};
insertWrapperContent = function(wrapper, sibling) {
builder.insertElement(wrapper.element, sibling);
if (isElementVisible(wrapper)) {
return true;
}
wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(function() {
return visibilityWatcher(wrapper);
});
return false;
};
processBufferedItems = function(rid) {
var bottomPos, heightIncrement, i, item, j, k, keepFetching, l, len, len1, len2, len3, m, promises, toBePrepended, toBeRemoved, wrapper;
promises = [];
toBePrepended = [];
toBeRemoved = [];
bottomPos = builder.bottomDataPos();
for (i = j = 0, len = buffer.length; j < len; i = ++j) {
wrapper = buffer[i];
switch (wrapper.op) {
case 'prepend':
toBePrepended.unshift(wrapper);
break;
case 'append':
if (i === 0) {
keepFetching = insertWrapperContent(wrapper) || keepFetching;
} else {
keepFetching = insertWrapperContent(wrapper, buffer[i - 1].element) || keepFetching;
}
wrapper.op = 'none';
break;
case 'insert':
if (i === 0) {
promises = promises.concat(builder.insertElementAnimated(wrapper.element));
} else {
promises = promises.concat(builder.insertElementAnimated(wrapper.element, buffer[i - 1].element));
}
wrapper.op = 'none';
break;
case 'remove':
toBeRemoved.push(wrapper);
}
}
for (k = 0, len1 = toBeRemoved.length; k < len1; k++) {
wrapper = toBeRemoved[k];
promises = promises.concat(removeItem(wrapper));
}
builder.bottomPadding(Math.max(0, builder.bottomPadding() - (builder.bottomDataPos() - bottomPos)));
if (toBePrepended.length) {
bottomPos = builder.bottomDataPos();
for (l = 0, len2 = toBePrepended.length; l < len2; l++) {
wrapper = toBePrepended[l];
keepFetching = insertWrapperContent(wrapper) || keepFetching;
wrapper.op = 'none';
}
heightIncrement = builder.bottomDataPos() - bottomPos;
if (builder.topPadding() >= heightIncrement) {
builder.topPadding(builder.topPadding() - heightIncrement);
} else {
viewport.scrollTop(viewport.scrollTop() + heightIncrement);
}
}
for (i = m = 0, len3 = buffer.length; m < len3; i = ++m) {
item = buffer[i];
item.scope.$index = first + i;
}
if (promises.length) {
$q.all(promises).then(function() {
return adjustBuffer(rid);
});
}
return keepFetching;
};
calculateTopProperties = function() {
var item, itemHeight, itemTop, j, len, newRow, results, rowTop, topHeight;
topHeight = 0;
results = [];
for (j = 0, len = buffer.length; j < len; j++) {
item = buffer[j];
itemTop = item.element.offset().top;
newRow = rowTop !== itemTop;
rowTop = itemTop;
if (newRow) {
itemHeight = item.element.outerHeight(true);
}
if (newRow && (builder.topDataPos() + topHeight + itemHeight < topVisiblePos())) {
results.push(topHeight += itemHeight);
} else {
if (newRow) {
topVisible(item);
}
break;
}
}
return results;
};
adjustBuffer = function(rid) {
return $timeout(function() {
processBufferedItems(rid);
if (shouldLoadBottom()) {
enqueueFetch(rid, true);
} else {
if (shouldLoadTop()) {
enqueueFetch(rid, false);
}
}
if (pending.length === 0) {
return calculateTopProperties();
}
});
};
adjustBufferAfterFetch = function(rid) {
return $timeout(function() {
var keepFetching;
keepFetching = processBufferedItems(rid);
if (shouldLoadBottom()) {
if (keepFetching) {
enqueueFetch(rid, true);
}
} else {
if (shouldLoadTop()) {
if (keepFetching || pending[0]) {
enqueueFetch(rid, false);
}
}
}
pending.shift();
if (pending.length === 0) {
loading(false);
return calculateTopProperties();
} else {
return fetch(rid);
}
});
};
fetch = function(rid) {
if (pending[0]) {
if (buffer.length && !shouldLoadBottom()) {
return adjustBufferAfterFetch(rid);
} else {
return datasource.get(next, bufferSize, function(result) {
var item, j, len;
if ((rid && rid !== ridActual) || $scope.$$destroyed) {
return;
}
if (result.length < bufferSize) {
eof = true;
builder.bottomPadding(0);
}
if (result.length > 0) {
clipTop();
for (j = 0, len = result.length; j < len; j++) {
item = result[j];
++next;
insertItem('append', item);
}
}
return adjustBufferAfterFetch(rid);
});
}
} else {
if (buffer.length && !shouldLoadTop()) {
return adjustBufferAfterFetch(rid);
} else {
return datasource.get(first - bufferSize, bufferSize, function(result) {
var i, j, ref;
if ((rid && rid !== ridActual) || $scope.$$destroyed) {
return;
}
if (result.length < bufferSize) {
bof = true;
builder.topPadding(0);
}
if (result.length > 0) {
if (buffer.length) {
clipBottom();
}
for (i = j = ref = result.length - 1; ref <= 0 ? j <= 0 : j >= 0; i = ref <= 0 ? ++j : --j) {
--first;
insertItem('prepend', result[i]);
}
}
return adjustBufferAfterFetch(rid);
});
}
}
};
resizeAndScrollHandler = function() {
if (!$rootScope.$$phase && !adapter.isLoading) {
adjustBuffer();
return $scope.$apply();
}
};
wheelHandler = function(event) {
var scrollTop, yMax;
scrollTop = viewport[0].scrollTop;
yMax = viewport[0].scrollHeight - viewport[0].clientHeight;
if ((scrollTop === 0 && !bof) || (scrollTop === yMax && !eof)) {
return event.preventDefault();
}
};
viewport.bind('resize', resizeAndScrollHandler);
viewport.bind('scroll', resizeAndScrollHandler);
viewport.bind('mousewheel', wheelHandler);
$scope.$watch(datasource.revision, reload);
$scope.$on('$destroy', function() {
var item, j, len;
for (j = 0, len = buffer.length; j < len; j++) {
item = buffer[j];
item.scope.$destroy();
item.element.remove();
}
viewport.unbind('resize', resizeAndScrollHandler);
viewport.unbind('scroll', resizeAndScrollHandler);
return viewport.unbind('mousewheel', wheelHandler);
buffer.setUpper();
return adjustBufferAfterFetch(rid);
});
adapter = {};
adapter.isLoading = false;
adapter.reload = reload;
applyUpdate = function(wrapper, newItems) {
var i, j, keepIt, len, newItem, pos, ref;
if (angular.isArray(newItems)) {
pos = (buffer.indexOf(wrapper)) + 1;
ref = newItems.reverse();
for (i = j = 0, len = ref.length; j < len; i = ++j) {
newItem = ref[i];
if (newItem === wrapper.scope[itemName]) {
keepIt = true;
pos--;
} else {
insertItem(pos, newItem);
}
}
if (!keepIt) {
return wrapper.op = 'remove';
}
}
// scrolling up
if (buffer.length && !viewport.shouldLoadTop()) {
return adjustBufferAfterFetch(rid);
}
return fetchPrevious(function (result) {
if (rid && rid !== ridActual || $scope.$$destroyed) {
return;
}
if (result.length < bufferSize) {
buffer.bof = true;
// log 'bof is reached'
}
if (result.length > 0) {
if (buffer.length) {
viewport.clipBottom();
}
};
adapter.applyUpdates = function(arg1, arg2) {
var bufferClone, i, j, len, ref, wrapper;
dismissPendingRequests();
if (angular.isFunction(arg1)) {
bufferClone = buffer.slice(0);
for (i = j = 0, len = bufferClone.length; j < len; i = ++j) {
wrapper = bufferClone[i];
applyUpdate(wrapper, arg1(wrapper.scope[itemName], wrapper.scope, wrapper.element));
}
} else {
if (arg1 % 1 === 0) {
if ((0 <= (ref = arg1 - first) && ref < buffer.length)) {
applyUpdate(buffer[arg1 - first], arg2);
}
} else {
throw new Error('applyUpdates - ' + arg1 + ' is not a valid index');
}
}
return adjustBuffer(ridActual);
};
adapter.append = function(newItems) {
var item, j, len;
dismissPendingRequests();
for (j = 0, len = newItems.length; j < len; j++) {
item = newItems[j];
++next;
insertItem('append', item);
}
return adjustBuffer(ridActual);
};
adapter.prepend = function(newItems) {
var item, j, len, ref;
dismissPendingRequests();
ref = newItems.reverse();
for (j = 0, len = ref.length; j < len; j++) {
item = ref[j];
--first;
insertItem('prepend', item);
}
return adjustBuffer(ridActual);
};
if ($attr.adapter) {
adapterOnScope = $parse($attr.adapter)($scope);
if (!adapterOnScope) {
$parse($attr.adapter).assign($scope, {});
adapterOnScope = $parse($attr.adapter)($scope);
}
angular.extend(adapterOnScope, adapter);
adapter = adapterOnScope;
buffer.prepend(result);
}
unsupportedMethod = function(token) {
throw new Error(token + ' event is no longer supported - use applyUpdates instead');
};
eventListener = datasource.scope ? datasource.scope.$new() : $scope.$new();
eventListener.$on('insert.item', function() {
return unsupportedMethod('insert');
});
eventListener.$on('update.items', function() {
return unsupportedMethod('update');
});
return eventListener.$on('delete.items', function() {
return unsupportedMethod('delete');
});
};
buffer.setLower();
return adjustBufferAfterFetch(rid);
});
}
function resizeAndScrollHandler() {
if (!$rootScope.$$phase && !adapter.isLoading) {
adapter.sCount++;
if (viewport.shouldLoadBottom()) {
enqueueFetch(ridActual, true);
} else if (viewport.shouldLoadTop()) {
enqueueFetch(ridActual, false);
}
if (pending.length) {
unbindEvents();
} else {
adapter.calculateProperties();
$scope.$apply();
}
}
}
function wheelHandler(event) {
var scrollTop = viewport[0].scrollTop;
var yMax = viewport[0].scrollHeight - viewport[0].clientHeight;
if (scrollTop === 0 && !buffer.bof || scrollTop === yMax && !buffer.eof) {
event.preventDefault();
}
}
};
}
]);
/*
//# sourceURL=src/ui-scroll.js
*/
}]);
}());
/*!
* angular-ui-scroll
* https://github.com/angular-ui/ui-scroll.git
* Version: 1.3.2 -- 2015-09-03T13:52:16.202Z
* Version: 1.4.0 -- 2016-04-04T13:10:12.966Z
* License: MIT
*/
!function(){"use strict";angular.module("ui.scroll",[]).directive("uiScrollViewport",function(){return{controller:["$scope","$element",function(a,b){return this.viewport=b,this}]}}).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$q","$parse",function(a,b,c,d,e,f){var g;return b.has&&b.has("$animate")&&(g=b.get("$animate")),{require:["?^uiScrollViewport"],transclude:"element",priority:1e3,terminal:!0,compile:function(h,i,j){return function(h,i,k,l){var m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia;if(R=a.debug||a.log,!(S=k.uiScroll.match(/^\s*(\w+)\s+in\s+([\w\.]+)\s*$/)))throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got ' + $attr.uiScroll + '");if(P=S[1],B=S[2],A=f(B)(h),N=function(){return angular.isObject(A)&&angular.isFunction(A.get)},!N()&&(A=b.get(B),!N()))throw new Error(B+" is not a valid datasource");return v=Math.max(3,+k.bufferSize||10),u=function(){return fa.outerHeight()*Math.max(.1,+k.padding||.1)},_=function(a){var b;return null!=(b=a[0].scrollHeight)?b:a[0].document.documentElement.scrollHeight},w=null,$=0,H=1,T=1,t=[],U=[],E=!1,r=!1,M=1===angular.version.major&&angular.version.minor<3,Y=g?M?function(a){var b;return t.splice(t.indexOf(a),1),b=e.defer(),g.leave(a.element,function(){return a.scope.$destroy(),b.resolve()}),[b.promise]}:function(a){return t.splice(t.indexOf(a),1),[g.leave(a.element).then(function(){return a.scope.$destroy()})]}:function(a){return t.splice(t.indexOf(a),1),a.element.remove(),a.scope.$destroy(),[]},I=function(a,b){return i.after.apply(b,[a]),[]},J=g?M?function(a,b){var c;return c=e.defer(),g.enter(a,i,b,function(){return c.resolve()}),[c.promise]}:function(a,b){return[g.enter(a,i,b)]}:I,j(h.$new(),function(a,b){var c,d,e,f,g;if(b.$destroy(),e=a[0].localName,"dl"===e)throw new Error("ui-scroll directive does not support <"+a[0].localName+"> as a repeating tag: "+a[0].outerHTML);return"li"!==e&&"tr"!==e&&(e="div"),g=l[0]&&l[0].viewport?l[0].viewport:angular.element(window),g.css({"overflow-y":"auto",display:"block"}),d=function(a){var b,c,d;switch(a){case"tr":d=angular.element("<table><tr><td><div></div></td></tr></table>"),b=d.find("div"),c=d.find("tr"),c.paddingHeight=function(){return b.height.apply(b,arguments)};break;default:c=angular.element("<"+a+"></"+a+">"),c.paddingHeight=c.height}return c},f=d(e),i.before(f),c=d(e),i.after(c),h.$on("$destroy",function(){return a.remove()}),w={viewport:g,topPadding:function(){return f.paddingHeight.apply(f,arguments)},bottomPadding:function(){return c.paddingHeight.apply(c,arguments)},bottomDataPos:function(){return _(g)-c.paddingHeight()},topDataPos:function(){return f.paddingHeight()},insertElement:function(a,b){return I(a,b||f)},insertElementAnimated:function(a,b){return J(a,b||f)}}}),fa=w.viewport,ga=fa.scope()||c,ca=function(a){return m.topVisible=a.scope[P],m.topVisibleElement=a.element,m.topVisibleScope=a.scope,k.topVisible&&f(k.topVisible).assign(ga,m.topVisible),k.topVisibleElement&&f(k.topVisibleElement).assign(ga,m.topVisibleElement),k.topVisibleScope&&f(k.topVisibleScope).assign(ga,m.topVisibleScope),angular.isFunction(A.topVisible)?A.topVisible(a):void 0},Q=function(a){return m.isLoading=a,k.isLoading&&f(k.isLoading).assign(h,a),angular.isFunction(A.loading)?A.loading(a):void 0},X=function(a,b){var c,d,e,f;for(c=d=e=a,f=b;f>=e?f>d:d>f;c=f>=e?++d:--d)t[c].scope.$destroy(),t[c].element.remove();return t.splice(a,b-a)},C=function(){return $++,U=[]},W=function(){return C(),H=1,T=1,X(0,t.length),w.topPadding(0),w.bottomPadding(0),E=!1,r=!1,o($)},s=function(){return fa.scrollTop()+fa.outerHeight()},da=function(){return fa.scrollTop()},aa=function(){return!E&&w.bottomDataPos()<s()+u()},y=function(){var a,b,c,d,e,f,g,h,i,j;for(a=0,h=0,b=f=i=t.length-1;0>=i?0>=f:f>=0;b=0>=i?++f:--f)if(c=t[b],e=c.element.offset().top,g=j!==e,j=e,g&&(d=c.element.outerHeight(!0)),w.bottomDataPos()-a-d>s()+u())g&&(a+=d),h++,E=!1;else{if(g)break;h++}return h>0?(w.bottomPadding(w.bottomPadding()+a),X(t.length-h,t.length),T-=h):void 0},ba=function(){return!r&&w.topDataPos()>da()-u()},z=function(){var a,b,c,d,e,f,g,h,i;for(i=0,g=0,d=0,e=t.length;e>d;d++)if(a=t[d],c=a.element.offset().top,f=h!==c,h=c,f&&(b=a.element.outerHeight(!0)),w.topDataPos()+i+b<da()-u())f&&(i+=b),g++,r=!1;else{if(f)break;g++}return g>0?(w.topPadding(w.topPadding()+i),X(0,g),H+=g):void 0},D=function(a,b){return m.isLoading||Q(!0),1===U.push(b)?G(a):void 0},K=function(a,b){var c,d;if(c=h.$new(),c[P]=b,d={scope:c},j(c,function(a){return d.element=a}),a%1===0)return d.op="insert",t.splice(a,0,d);switch(d.op=a,a){case"append":return t.push(d);case"prepend":return t.unshift(d)}},O=function(a){return a.element.height()&&a.element[0].offsetParent},ha=function(a){var b,c,d;if(O(a)){for(c=0,d=t.length;d>c;c++)b=t[c],b.unregisterVisibilityWatcher(),delete b.unregisterVisibilityWatcher;return o()}},L=function(a,b){return w.insertElement(a.element,b),O(a)?!0:(a.unregisterVisibilityWatcher=a.scope.$watch(function(){return ha(a)}),!1)},V=function(a){var b,c,d,f,g,h,i,j,k,l,m,n,p,q,r,s,u;for(q=[],r=[],s=[],b=w.bottomDataPos(),d=g=0,k=t.length;k>g;d=++g)switch(u=t[d],u.op){case"prepend":r.unshift(u);break;case"append":i=0===d?L(u)||i:L(u,t[d-1].element)||i,u.op="none";break;case"insert":q=0===d?q.concat(w.insertElementAnimated(u.element)):q.concat(w.insertElementAnimated(u.element,t[d-1].element)),u.op="none";break;case"remove":s.push(u)}for(h=0,l=s.length;l>h;h++)u=s[h],q=q.concat(Y(u));if(w.bottomPadding(Math.max(0,w.bottomPadding()-(w.bottomDataPos()-b))),r.length){for(b=w.bottomDataPos(),j=0,m=r.length;m>j;j++)u=r[j],i=L(u)||i,u.op="none";c=w.bottomDataPos()-b,w.topPadding()>=c?w.topPadding(w.topPadding()-c):fa.scrollTop(fa.scrollTop()+c)}for(d=p=0,n=t.length;n>p;d=++p)f=t[d],f.scope.$index=H+d;return q.length&&e.all(q).then(function(){return o(a)}),i},x=function(){var a,b,c,d,e,f,g,h,i;for(i=0,g=[],d=0,e=t.length;e>d;d++){if(a=t[d],c=a.element.offset().top,f=h!==c,h=c,f&&(b=a.element.outerHeight(!0)),!(f&&w.topDataPos()+i+b<da())){f&&ca(a);break}g.push(i+=b)}return g},o=function(a){return d(function(){return V(a),aa()?D(a,!0):ba()&&D(a,!1),0===U.length?x():void 0})},p=function(a){return d(function(){var b;return b=V(a),aa()?b&&D(a,!0):ba()&&(b||U[0])&&D(a,!1),U.shift(),0===U.length?(Q(!1),x()):G(a)})},G=function(a){return U[0]?t.length&&!aa()?p(a):A.get(T,v,function(b){var c,d,e;if(!(a&&a!==$||h.$$destroyed)){if(b.length<v&&(E=!0,w.bottomPadding(0)),b.length>0)for(z(),d=0,e=b.length;e>d;d++)c=b[d],++T,K("append",c);return p(a)}}):t.length&&!ba()?p(a):A.get(H-v,v,function(b){var c,d,e;if(!(a&&a!==$||h.$$destroyed)){if(b.length<v&&(r=!0,w.topPadding(0)),b.length>0)for(t.length&&y(),c=d=e=b.length-1;0>=e?0>=d:d>=0;c=0>=e?++d:--d)--H,K("prepend",b[c]);return p(a)}})},Z=function(){return c.$$phase||m.isLoading?void 0:(o(),h.$apply())},ia=function(a){var b,c;return b=fa[0].scrollTop,c=fa[0].scrollHeight-fa[0].clientHeight,0===b&&!r||b===c&&!E?a.preventDefault():void 0},fa.bind("resize",Z),fa.bind("scroll",Z),fa.bind("mousewheel",ia),h.$watch(A.revision,W),h.$on("$destroy",function(){var a,b,c;for(b=0,c=t.length;c>b;b++)a=t[b],a.scope.$destroy(),a.element.remove();return fa.unbind("resize",Z),fa.unbind("scroll",Z),fa.unbind("mousewheel",ia)}),m={},m.isLoading=!1,m.reload=W,q=function(a,b){var c,d,e,f,g,h,i;if(angular.isArray(b)){for(h=t.indexOf(a)+1,i=b.reverse(),c=d=0,f=i.length;f>d;c=++d)g=i[c],g===a.scope[P]?(e=!0,h--):K(h,g);if(!e)return a.op="remove"}},m.applyUpdates=function(a,b){var c,d,e,f,g,h;if(C(),angular.isFunction(a))for(c=t.slice(0),d=e=0,f=c.length;f>e;d=++e)h=c[d],q(h,a(h.scope[P],h.scope,h.element));else{if(a%1!==0)throw new Error("applyUpdates - "+a+" is not a valid index");0<=(g=a-H)&&g<t.length&&q(t[a-H],b)}return o($)},m.append=function(a){var b,c,d;for(C(),c=0,d=a.length;d>c;c++)b=a[c],++T,K("append",b);return o($)},m.prepend=function(a){var b,c,d,e;for(C(),e=a.reverse(),c=0,d=e.length;d>c;c++)b=e[c],--H,K("prepend",b);return o($)},k.adapter&&(n=f(k.adapter)(h),n||(f(k.adapter).assign(h,{}),n=f(k.adapter)(h)),angular.extend(n,m),m=n),ea=function(a){throw new Error(a+" event is no longer supported - use applyUpdates instead")},F=A.scope?A.scope.$new():h.$new(),F.$on("insert.item",function(){return ea("insert")}),F.$on("update.items",function(){return ea("update")}),F.$on("delete.items",function(){return ea("delete")})}}}}])}();
!function(){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol?"symbol":typeof a};angular.module("ui.scroll",[]).directive("uiScrollViewport",function(){return{controller:["$scope","$element",function(a,b){return this.viewport=b,this}]}}).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$q","$parse",function(b,c,d,e,f,g){function h(a,b){return b.after(a),[]}function i(a){return a.element.remove(),a.scope.$destroy(),[]}function j(b,c){if(!p)return h(b,c);if(q){var d=function(){var a=f.defer();return p.enter(b,null,c,function(){return a.resolve()}),{v:[a.promise]}}();if("object"===("undefined"==typeof d?"undefined":a(d)))return d.v}return[p.enter(b,null,c)]}function k(b){if(!p)return i(b);if(q){var c=function(){var a=f.defer();return p.leave(b.element,function(){return b.scope.$destroy(),a.resolve()}),{v:[a.promise]}}();if("object"===("undefined"==typeof c?"undefined":a(c)))return c.v}return[p.leave(b.element).then(function(){return b.scope.$destroy()})]}function l(a,b,c,d){function e(a){f.eof=!1,f.bof=!1,f.first=a,f.next=a,f.minIndex=Number.MAX_VALUE,f.maxIndex=Number.MIN_VALUE}var f=Object.create(Array.prototype);return angular.extend(f,{size:d,append:function(a){a.forEach(function(a){++f.next,f.insert("append",a)})},prepend:function(a){a.reverse().forEach(function(a){--f.first,f.insert("prepend",a)})},insert:function(d,e){var g=b.$new(),h={item:e,scope:g};if(g[a]=e,c(g,function(a){return h.element=a}),d%1===0)h.op="insert",f.splice(d,0,h);else switch(h.op=d,d){case"append":f.push(h);break;case"prepend":f.unshift(h)}},remove:function(a,b){if(angular.isNumber(a)){for(var c=a;b>c;c++)i(f[c]);return f.splice(a,b-a)}return f.splice(f.indexOf(a),1),k(a)},setUpper:function(){f.maxIndex=f.eof?f.next-1:Math.max(f.next-1,f.maxIndex)},setLower:function(){f.minIndex=f.bof?f.minIndex=f.first:Math.min(f.first,f.minIndex)},syncDatasource:function(a){var b=f.minIndex-Math.min(f.minIndex,a.minIndex||Number.MAX_VALUE);return a.minIndex=f.minIndex-=b,a.maxIndex=f.maxIndex=Math.max(f.maxIndex,a.maxIndex||Number.MIN_VALUE),b},clear:function(){f.remove(0,f.length),e(arguments.length?arguments[0]:1)}}),e(1),f}function m(a,b,c,d){function e(){return m.outerHeight()*Math.max(f,+d.padding||g)}var f=.3,g=.5,i=null,k=null,l=0,m=c[0]&&c[0].viewport?c[0].viewport:angular.element(window);m.css({"overflow-y":"auto",display:"block"});var n=m.offset()?function(){return m.offset()}:function(){return{top:0}};return angular.extend(m,{createPaddingElements:function(a){function c(a){var b=void 0,c=a.localName;switch(c){case"dl":throw new Error("ui-scroll directive does not support <"+c+"> as a repeating tag: "+a.outerHTML);case"tr":var d=angular.element("<table><tr><td><div></div></td></tr></table>");b=d.find("tr");break;case"li":b=angular.element("<li></li>");break;default:b=angular.element("<div></div>")}return b}i=new c(a),k=new c(a),b.before(i),b.after(k)},bottomDataPos:function(){var a=m[0].scrollHeight;return a=null!=a?a:m[0].document.documentElement.scrollHeight,a-k.height()},topDataPos:function(){return i.height()},bottomVisiblePos:function(){return m.scrollTop()+m.outerHeight()},topVisiblePos:function(){return m.scrollTop()},insertElement:function(a,b){return h(a,b||i)},insertElementAnimated:function(a,b){return j(a,b||i)},shouldLoadBottom:function(){return!a.eof&&m.bottomDataPos()<m.bottomVisiblePos()+e()},clipBottom:function(){for(var b=0,c=a.length-1;c>=0&&!(a[c].element.offset().top-n().top<=m.outerHeight()+e());c--)b++;b>0&&(a.eof=!1,a.remove(a.length-b,a.length),a.next-=b,m.adjustPadding())},shouldLoadTop:function(){return!a.bof&&m.topDataPos()>m.topVisiblePos()-e()},clipTop:function(){for(var b=0,c=0,d=0;d<a.length&&!(a[d].element.offset().top-n().top+a[d].element.outerHeight(!0)>=-1*e());d++)c+=a[d].element.outerHeight(!0),b++;b>0&&(i.height(i.height()+c),a.bof=!1,a.remove(0,b),a.first+=b)},adjustPadding:function(){if(a.length){var b=a[0].element,c=a[a.length-1].element;return l=(c.offset().top+c.outerHeight(!0)-b.offset().top)/a.length,i.height((a.first-a.minIndex)*l),k.height((a.maxIndex-a.next+1)*l)}},syncDatasource:function(b){if(a.length){var c=a.syncDatasource(b)*l;i.height(i.height()+c),m.scrollTop(m.scrollTop()+c),m.adjustPadding()}},adjustScrollTop:function(a){var b=i.height()-a;b>=0?i.height(b):(i.height(0),m.scrollTop(m.scrollTop()-b))},resetTopPaddingHeight:function(){i.height(0)},resetBottomPaddingHeight:function(){k.height(0)}}),m}function n(a,b,c,e){function f(a,b){if(angular.isArray(b)){var d=void 0,e=c.indexOf(a)+1;b.reverse().forEach(function(b){b===a.item?(d=!0,e--):c.insert(e,b)}),d||(a.op="remove")}}var h=b.scope()||d,i=a.topVisible?g(a.topVisible).assign:angular.noop,j=a.topVisibleElement?g(a.topVisibleElement).assign:angular.noop,k=a.topVisibleScope?g(a.topVisibleScope).assign:angular.noop,l=a.isLoading?g(a.isLoading).assign:angular.noop;this.isLoading=!1,this.applyUpdates=function(a,b){if(angular.isFunction(a))c.slice(0).forEach(function(b){f(b,a(b.item,b.scope,b.element))});else{if(a%1!==0)throw new Error("applyUpdates - "+a+" is not a valid index");var d=a-c.first;d>=0&&d<c.length&&f(c[d],b)}e()},this.append=function(a){c.append(a),e()},this.prepend=function(a){c.prepend(a),e()},this.loading=function(a){this.isLoading=a,l(h,a)},this.calculateProperties=function(){var a=void 0,d=void 0,e=void 0,f=void 0,g=void 0,l=void 0,m=0;for(a=0;a<c.length;a++){if(d=c[a],f=d.element.offset().top,g=l!==f,l=f,g&&(e=d.element.outerHeight(!0)),!(g&&b.topDataPos()+m+e<=b.topVisiblePos())){g&&(this.topVisible=d.item,this.topVisibleElement=d.element,this.topVisibleScope=d.scope,i(h,d.item),j(h,d.element),k(h,d.scope));break}m+=e}}}function o(a,b,h){var i=b.uiScroll.match(/^\s*(\w+)\s+in\s+([\w\.]+)\s*$/);if(!i)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+b.uiScroll+"'");var j=i[1],k=i[2],o=Math.max(3,+b.bufferSize||10);return function(a,b,i,p,q){function r(){J.bind("resize",D),J.bind("scroll",D)}function s(){J.unbind("resize",D),J.unbind("scroll",D)}function t(){G++,H=[]}function u(){return t(),J.resetTopPaddingHeight(),J.resetBottomPaddingHeight(),K.abCount=0,K.abfCount=0,K.sCount=0,arguments.length?I.clear(arguments[0]):I.clear(),A(G)}function v(a,b){return K.isLoading||K.loading(!0),1===H.push(b)?C(a):void 0}function w(a){return a.element.height()&&a.element[0].offsetParent}function x(a){return w(a)?(I.forEach(function(a){angular.isFunction(a.unregisterVisibilityWatcher)&&(a.unregisterVisibilityWatcher(),delete a.unregisterVisibilityWatcher)}),A()):void 0}function y(a,b){return J.insertElement(a.element,b),w(a)?!0:(a.unregisterVisibilityWatcher=a.scope.$watch(function(){return x(a)}),!1)}function z(a){function b(a){return a>0?I[a-1].element:void 0}var c=!1,d=[],e=[],g=[];if(I.forEach(function(a,f){switch(a.op){case"prepend":e.unshift(a);break;case"append":c=y(a,b(f))||c,a.op="none";break;case"insert":d=d.concat(J.insertElementAnimated(a.element,b(f))),a.op="none";break;case"remove":g.push(a)}}),g.forEach(function(a){return d=d.concat(I.remove(a))}),e.length){var h=0;e.forEach(function(a){c=y(a)||c,a.op="none",h+=a.element.outerHeight(!0)}),J.adjustScrollTop(h)}return I.forEach(function(a,b){return a.scope.$index=I.first+b}),d.length?f.all(d).then(function(){return J.adjustPadding(),A(a)}):(J.adjustPadding(),H.length||J.syncDatasource(F)),c}function A(a){return e(function(){return K.abCount++,z(a),J.shouldLoadBottom()?v(a,!0):J.shouldLoadTop()&&v(a,!1),H.length?void 0:K.calculateProperties()})}function B(a){return e(function(){K.abfCount++;var b=z(a);return J.shouldLoadBottom()&&b?v(a,!0):J.shouldLoadTop()&&(b||H[0])&&v(a,!1),H.shift(),H.length?C(a):(K.loading(!1),r(),K.calculateProperties())})}function C(b){return H[0]?I.length&&!J.shouldLoadBottom()?B(b):L(function(c){return b&&b!==G||a.$$destroyed?void 0:(c.length<o&&(I.eof=!0),c.length>0&&(J.clipTop(),I.append(c)),I.setUpper(),B(b))}):I.length&&!J.shouldLoadTop()?B(b):M(function(c){return b&&b!==G||a.$$destroyed?void 0:(c.length<o&&(I.bof=!0),c.length>0&&(I.length&&J.clipBottom(),I.prepend(c)),I.setLower(),B(b))})}function D(){d.$$phase||K.isLoading||(K.sCount++,J.shouldLoadBottom()?v(G,!0):J.shouldLoadTop()&&v(G,!1),H.length?s():(K.calculateProperties(),a.$apply()))}function E(a){var b=J[0].scrollTop,c=J[0].scrollHeight-J[0].clientHeight;(0===b&&!I.bof||b===c&&!I.eof)&&a.preventDefault()}q=q||h;var F=function(){function b(){return angular.isObject(d)&&angular.isFunction(d.get)}var d=g(k)(a);if(!b()&&(d=c.get(k),!b()))throw new Error(k+" is not a valid datasource");return d}(),G=0,H=[],I=new l(j,a,q,o),J=new m(I,b,p,i),K=new n(i,J,I,function(){return t(),A(G)}),L=function(){return 2!==F.get.length?function(a){return F.get(I.next,o,a)}:function(a){return F.get({index:I.next,append:I.length?I[I.length-1].item:void 0,count:o},a)}}(),M=function(){return 2!==F.get.length?function(a){return F.get(I.first-o,o,a)}:function(a){return F.get({index:I.first-o,prepend:I.length?I[0].item:void 0,count:o},a)}}();if(i.adapter){var N=g(i.adapter)(a);angular.isObject(N)||(g(i.adapter).assign(a,{}),N=g(i.adapter)(a)),K=angular.extend(N,K)}q(a.$new(),function(a,b){J.createPaddingElements(a[0]),b.$destroy(),a.remove()}),K.reload=u,J.bind("mousewheel",E),a.$on("$destroy",function(){I.clear(),s(),J.unbind("mousewheel",E)}),function(){function b(a){throw new Error(a+" event is no longer supported - use applyUpdates instead")}var c=F.scope?F.scope.$new():a.$new();c.$on("insert.item",function(){return b("insert")}),c.$on("update.items",function(){return b("update")}),c.$on("delete.items",function(){return b("delete")})}(),u()}}var p=c.has&&c.has("$animate")?c.get("$animate"):null,q=1===angular.version.major&&angular.version.minor<3;return{require:["?^uiScrollViewport"],transclude:"element",priority:1e3,terminal:!0,compile:o}}])}();
{
"name": "angular-ui-scroll",
"description": "two way infinite scroll",
"version": "1.3.2",
"version": "1.4.0",
"src": "./src/",

@@ -30,18 +30,18 @@ "public": "./public/",

"devDependencies": {
"babel-preset-es2015": "^6.5.0",
"express": "~3.4.8",
"grunt": "~0.4.5",
"grunt-babel": "^6.0.0",
"grunt-contrib-concat": "~0.5.1",
"grunt-contrib-connect": "~0.10.1",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-uglify": "0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-coffee": "~0.13.0",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-concat": "~0.5.1",
"grunt-contrib-uglify": "0.9.1",
"coffee-script": "~1.9.3",
"express": "~3.4.8",
"grunt-karma": "~0.12.0",
"jasmine-core": "^2.4.1",
"karma": "~0.13",
"karma-coffee-preprocessor": "~0.3",
"karma-chrome-launcher": "~0.2",
"karma-firefox-launcher": "~0.1",
"karma-chrome-launcher": "~0.2",
"karma-ie-launcher": "~0.2",
"karma-jasmine": "~0.3",
"grunt-karma": "~0.12.0"
"karma-jasmine": "~0.3"
},

@@ -62,2 +62,2 @@ "keywords": [

]
}
}

@@ -50,3 +50,3 @@ The common way to present to the user a list of data elements of undefined length is to start with a small portion at the top of the

This module is only necessary if you plan to use ui-scroll without jQuery. If jQuery implementation is present it will not override them.
This module is only necessary if you plan to use ui-scroll without jQuery. If full jQuery is loaded, uiScroll will use the jQuery implementatin of the above methods, the ui.scroll.jqlite implementation of them will be ignored.
If you plan to use ui-scroll over jQuery feel free to skip ui-scroll-jqlite.

@@ -57,3 +57,3 @@

```html
<ANY ui-scroll="{scroll_expression}" buffer-size="value" padding="value">
<ANY ui-scroll="{scroll_expression}" buffer-size="value" padding="value" adapter="name">
...

@@ -93,6 +93,9 @@ </ANY>

The datasource object implements methods and properties to be used by the directive to access the data:
The data source object implements methods and properties to be used by the directive to access the data:
* Method `get`
get(descriptor, success)
or
get(index, count, success)

@@ -103,6 +106,6 @@

#### Parameters
* **descriptor** is an object defining the portion of the dataset requested. The object will have 3 properties. Two of them named `index` and `count`. They have the same meaning as in the alternative signature when the parameters passed explicitly (see below). The third one will be named either `append` if the items will be appended to the last item in the buffer, or `prepend` if they are to be prepended to the first item in the buffer. The value of the property in either case will be the item the new items will be appended/prepended to. This is useful if it is easier to identify the items to be added based on the previously requested items rather than on the index. Keep in mind that in certain use cases (i.e. on initial load) the value of the append/prepend property can be undefined.
* **index** indicates the first data row requested
* **count** indicates number of data rows requested
* **success** function to call when the data are retrieved. The implementation of the service has to call this function when the data
are retrieved and pass it an array of the items retrieved. If no items are retrieved, an empty array has to be passed.
* **success** function to call when the data are retrieved. The implementation of the data source has to call this function when the data are retrieved and pass it an array of the items retrieved. If no items are retrieved, an empty array has to be passed.

@@ -112,21 +115,9 @@ **Important:** Make sure to respect the `index` and `count` parameters of the request. The array passed to the success method should have

* Method `loading`
* Properties `minIndex` and `maxIndex`
loading(value)
#### Description
this is an optional method. If supplied this function will be called with a value indicating whether there is data loading request pending
As the scroller recieves the items requested by the `get` method, the value of minimum and maximum values of the item index are placed in the `minIndex` and `maxIndex` properties respectively. The values of the properties are cumulative - the value of the `minIndex` will never increase, and the value of the `maIndex` will never decrease - except the values are reset in response to a call to the adapter `reload` method. The values of the properties are used to maintain the appearance of the scroller scrollBar.
Values of the properties can be assigned programmatically. If the range of the index values is known in advance, assigneing them programmatically would improve the usability of the scrollBar.
**Deprecated:** Method `loading` is deprecated - use `is-loading` attribute instead
* Method `revision`
revision()
#### Description
this is an optional method. If supplied the scroller will $watch its value and will refresh the content if the value has changed
**Deprecated:** Method `revision` is deprecated - use `reload()` method on the adapter instead
###Adapter

@@ -147,6 +138,11 @@ The adapter object is an internal object created for every instance of the scroller. Properties and methods of the adapter can be used to manipulate and assess the scroller the adapter was created for. Adapter based API replaces old (undocumented) event based API introduced earlier for this purpose. The event based API is now deprecated and no longer supported.

reload()
or
reload(startIndex)
#### Description
calling this method reinitializes and reloads the scroller content. This method is introduced as a replacement for the revision method of the datasource, which is now deprecated.
Calling this method reinitializes and reloads the scroller content. `startIndex` is an integer indicating what item index the scroller will use to start the load process. Calling `reload()` is equivalent to calling `reload(1)`.
**important: `startIndex` should fall within underlying datset boundaries** The scroller will request two batches of items one starting from the `startIndex` and another one preceding the first one (starting from `startIndex - bufferSize`). If both requests come back empty, the scroller will consider the dataset to be empty and will place no further data requests.
* Method `applyUpdates`

@@ -212,3 +208,2 @@

###Examples

@@ -225,4 +220,14 @@

###v1.4.0
* Migrated sources from CoffeeScript to ES6
* Optimized scroll events handling, removed odd $digest cycles
* Examples (demo) refactoring
###v1.3.3
* Implemented new signature of the Datasource get(descriptor, success) method. See the documentation.
* Implemented new signature of the Adapter reload(startIndex) method. See the documentation.
* Changed the logic of scroll bar adjustment (minIndex, maxIndex).
###v1.3.2
* Implemented logic for adjustBuffer triggering during invisible items became visible.
* Implemented the logic for adjustBuffer triggering during invisible items became visible.

@@ -229,0 +234,0 @@ ###v1.3.1

@@ -1065,2 +1065,64 @@ /*global describe, beforeEach, module, it, expect, runTest */

describe('adapter reload tests', function () {
var scrollSettings = {datasource: 'myInfiniteDatasource', adapter: 'adapter'};
it ('initial load should be positioned at item#1', function () {
runTest (scrollSettings,
function (viewport, scope) {
expect(scope.adapter.topVisible).toBe('item1');
}
);
});
it ('reload(100) should position it at item#100', function () {
runTest (scrollSettings,
function (viewport, scope, $timeout) {
expect(scope.adapter.topVisible).toBe('item1');
scope.adapter.reload(100);
$timeout.flush();
expect(scope.adapter.topVisible).toBe('item100');
}
);
});
it ('reload() should position it at item#1', function () {
runTest (scrollSettings,
function (viewport, scope, $timeout) {
expect(scope.adapter.topVisible).toBe('item1');
scope.adapter.reload(100);
$timeout.flush();
expect(scope.adapter.topVisible).toBe('item100');
scope.adapter.reload();
$timeout.flush();
expect(scope.adapter.topVisible).toBe('item1');
}
);
});
it ('reload(0) should position it at item#0', function () {
runTest (scrollSettings,
function (viewport, scope, $timeout) {
expect(scope.adapter.topVisible).toBe('item1');
scope.adapter.reload(100);
$timeout.flush();
expect(scope.adapter.topVisible).toBe('item100');
scope.adapter.reload(0);
$timeout.flush();
expect(scope.adapter.topVisible).toBe('item0');
}
);
});
});
});

@@ -17,7 +17,7 @@ /*global describe, beforeEach, module, inject, it, spyOn, expect, $, runTest */

expect($.fn.bind.calls.all().length).toBe(3);
expect($.fn.bind.calls.all()[0].args[0]).toBe('resize');
expect($.fn.bind.calls.all()[0].args[0]).toBe('mousewheel');
expect($.fn.bind.calls.all()[0].object[0]).toBe(viewport[0]);
expect($.fn.bind.calls.all()[1].args[0]).toBe('scroll');
expect($.fn.bind.calls.all()[1].args[0]).toBe('resize');
expect($.fn.bind.calls.all()[1].object[0]).toBe(viewport[0]);
expect($.fn.bind.calls.all()[2].args[0]).toBe('mousewheel');
expect($.fn.bind.calls.all()[2].args[0]).toBe('scroll');
expect($.fn.bind.calls.all()[2].object[0]).toBe(viewport[0]);

@@ -56,3 +56,3 @@ }, {

it('should call get on the datasource 1 time ', function () {
it('should call get on the datasource 2 times ', function () {
var spy;

@@ -65,4 +65,8 @@ inject(function (myEmptyDatasource) {

expect(spy.calls.all().length).toBe(2);
expect(spy.calls.all()[0].args.length).toBe(3);
expect(spy.calls.all()[0].args[0]).toBe(1);
expect(spy.calls.all()[0].args[1]).toBe(10);
expect(spy.calls.all()[1].args.length).toBe(3);
expect(spy.calls.all()[1].args[0]).toBe(-9);
expect(spy.calls.all()[1].args[1]).toBe(10);
}

@@ -73,2 +77,29 @@ );

describe('basic setup (new datasource get signature)', function () {
var scrollSettings = {datasource: 'myNewEmptyDatasource'};
it('should call get on the datasource 2 times ', function () {
var spy;
inject(function (myNewEmptyDatasource) {
spy = spyOn(myNewEmptyDatasource, 'actualGet').and.callThrough();
});
runTest(scrollSettings,
function () {
expect(spy.calls.all().length).toBe(2);
expect(spy.calls.all()[0].args.length).toBe(2);
expect(spy.calls.all()[0].args[0].index).toBe(1);
expect(spy.calls.all()[0].args[0].count).toBe(10);
expect('append' in spy.calls.all()[0].args[0]).toBe(true);
expect(spy.calls.all()[0].args[0].append).toBeUndefined();
expect('prepend' in spy.calls.all()[0].args[0]).toBe(false);
expect(spy.calls.all()[1].args.length).toBe(2);
expect(spy.calls.all()[1].args[0].index).toBe(-9);
expect(spy.calls.all()[1].args[0].count).toBe(10);
expect('append' in spy.calls.all()[1].args[0]).toBe(false);
expect('prepend' in spy.calls.all()[1].args[0]).toBe(true);
expect(spy.calls.all()[1].args[0].prepend).toBeUndefined();
}
);
});
});
});

@@ -45,2 +45,32 @@ /*global describe, beforeEach, module, inject, it, spyOn, expect, runTest */

describe('datasource with 3 elements and buffersize 3 (new get signature)', function() {
var scrollSettings = { datasource: 'myNewOnePageDatasource', bufferSize: 3 };
it('should call get on the datasource 3 times ', function () {
var spy;
inject(function (myNewOnePageDatasource) {
spy = spyOn(myNewOnePageDatasource, 'actualGet').and.callThrough();
runTest(scrollSettings,
function () {
expect(spy.calls.all().length).toBe(3);
expect(spy.calls.all()[0].args[0].index).toBe(1); // gets 3 rows (no eof)
expect(spy.calls.all()[0].args[0].count).toBe(3);
expect('append' in spy.calls.all()[0].args[0]).toBe(true);
expect(spy.calls.all()[0].args[0].append).toBeUndefined();
expect('prepend' in spy.calls.all()[0].args[0]).toBe(false);
expect(spy.calls.all()[1].args[0].index).toBe(4); // gets 0 rows (and eof)
expect(spy.calls.all()[1].args[0].count).toBe(3);
expect('append' in spy.calls.all()[1].args[0]).toBe(true);
expect(spy.calls.all()[1].args[0].append).toBe('three');
expect('prepend' in spy.calls.all()[1].args[0]).toBe(false);
expect(spy.calls.all()[2].args[0].index).toBe(-2); // gets 0 rows (and bof)
expect(spy.calls.all()[2].args[0].count).toBe(3);
expect('append' in spy.calls.all()[2].args[0]).toBe(false);
expect('prepend' in spy.calls.all()[2].args[0]).toBe(true);
expect(spy.calls.all()[2].args[0].prepend).toBe('one');
});
});
});
});
describe('datasource with only 3 elements (negative index)', function () {

@@ -84,33 +114,38 @@ var scrollSettings = { datasource: 'anotherDatasource' };

describe('datasource with 20 elements and buffer size 3 - constrained viewport', function () {
var scrollSettings = { datasource: 'myMultipageDatasource', itemHeight: 40, bufferSize: 3 };
var scrollSettings = { datasource: 'myMultipageDatasource', viewportHeight: 200, itemHeight: 40, bufferSize: 3 };
it('should create 6 divs with data (+ 2 padding divs)', function () {
it('should create 9 divs with data (+ 2 padding divs)', function () {
runTest(scrollSettings,
function (viewport) {
expect(viewport.children().length).toBe(8);
expect(viewport.scrollTop()).toBe(0);
expect(viewport.children().css('height')).toBe('0px');
expect(angular.element(viewport.children()[7]).css('height')).toBe('0px');
function (viewport) {
var itemsLoaded = 9;
var itemsWithPaddings = itemsLoaded + 2;
expect(viewport.children().length).toBe(itemsWithPaddings);
expect(viewport.scrollTop()).toBe(0);
expect(viewport.children().css('height')).toBe('0px');
expect(angular.element(viewport.children()[itemsWithPaddings - 1]).css('height')).toBe('0px');
for (var i = 1; i < 7; i++) {
var row = viewport.children()[i];
expect(row.tagName.toLowerCase()).toBe('div');
expect(row.innerHTML).toBe(i + ': item' + i);
}
for (var i = 1; i < itemsLoaded; i++) {
var row = viewport.children()[i];
expect(row.tagName.toLowerCase()).toBe('div');
expect(row.innerHTML).toBe(i + ': item' + i);
}
}
);
});
it('should call get on the datasource 3 times ', function () {
var spy;
inject(function (myMultipageDatasource) {
spy = spyOn(myMultipageDatasource, 'get').and.callThrough();
});
it('should call get on the datasource 4 times ', function () {
var spy;
inject(function (myMultipageDatasource) {
spy = spyOn(myMultipageDatasource, 'get').and.callThrough();
});
runTest(scrollSettings,
function () {
expect(spy.calls.all().length).toBe(3);
// There are 9 loaded items, so there were 3 data calls
// Additional call was for top items resulted with 0 items.
expect(spy.calls.all().length).toBe(4);
expect(spy.calls.all()[0].args[0]).toBe(1);
expect(spy.calls.all()[1].args[0]).toBe(4);
expect(spy.calls.all()[2].args[0]).toBe(-2);
expect(spy.calls.all()[2].args[0]).toBe(7);
expect(spy.calls.all()[3].args[0]).toBe(-2);
}

@@ -120,3 +155,5 @@ );

it('should create 3 more divs (9 divs total) with data (+ 2 padding divs)', function () {
it('should create 3 more divs (12 divs total) with data (+ 2 padding divs)', function () {
var itemsLoaded = 12;
var itemsWithPaddings = itemsLoaded + 2;
runTest(scrollSettings,

@@ -128,8 +165,8 @@ function (viewport) {

$timeout.flush();
expect(viewport.children().length).toBe(11);
expect(viewport.scrollTop()).toBe(40);
expect(viewport.children().length).toBe(itemsWithPaddings);
expect(viewport.scrollTop()).toBe(100);
expect(viewport.children().css('height')).toBe('0px');
expect(angular.element(viewport.children()[10]).css('height')).toBe('0px');
expect(angular.element(viewport.children()[itemsWithPaddings-1]).css('height')).toBe('0px');
for (var i = 1; i < 10; i++) {
for (var i = 1; i < itemsLoaded; i++) {
var row = viewport.children()[i];

@@ -144,3 +181,3 @@ expect(row.tagName.toLowerCase()).toBe('div');

it('should call get on the datasource 1 extra time (4 total) ', function () {
it('should call get on the datasource 1 extra time (5 total) ', function () {
var spy;

@@ -156,8 +193,9 @@ inject(function (myMultipageDatasource) {

expect(spy.calls.all().length).toBe(4);
expect(spy.calls.all().length).toBe(5);
expect(spy.calls.all()[0].args[0]).toBe(1);
expect(spy.calls.all()[1].args[0]).toBe(4);
expect(spy.calls.all()[2].args[0]).toBe(-2);
expect(spy.calls.all()[3].args[0]).toBe(7);
expect(spy.calls.all()[2].args[0]).toBe(7);
expect(spy.calls.all()[3].args[0]).toBe(-2);
expect(spy.calls.all()[4].args[0]).toBe(10);
}

@@ -167,6 +205,8 @@ );

it('should clip 3 divs from the top and add 3 more divs to the bottom (9 divs total) (+ 2 padding divs)', function () {
it('should clip 4 divs from the top and add 3 more divs to the bottom (11 divs total) (+ 2 padding divs)', function () {
runTest(scrollSettings,
function (viewport, scope, $timeout) {
var itemsLoaded = 11;
var itemsWithPaddings = itemsLoaded + 2;
var clippedDivs = 4;
viewport.scrollTop(100);

@@ -180,11 +220,11 @@ viewport.trigger('scroll');

expect(viewport.children().length).toBe(11);
expect(viewport.scrollTop()).toBe(160);
expect(viewport.children().css('height')).toBe('120px');
expect(angular.element(viewport.children()[10]).css('height')).toBe('0px');
expect(viewport.children().length).toBe(itemsWithPaddings);
expect(viewport.scrollTop()).toBe(280);
expect(viewport.children().css('height')).toBe('160px');
expect(angular.element(viewport.children()[itemsWithPaddings-1]).css('height')).toBe('0px');
for (var i = 1; i < 10; i++) {
for (var i = 1; i <= itemsLoaded; i++) {
var row = viewport.children()[i];
expect(row.tagName.toLowerCase()).toBe('div');
expect(row.innerHTML).toBe((i + 3) + ': item' + (i + 3));
expect(row.innerHTML).toBe((i + clippedDivs) + ': item' + (i + clippedDivs));
}

@@ -195,3 +235,3 @@ }

it('should call get on the datasource 1 more time (4 total) ', function () {
it('should call get on the datasource 1 more time (6 total) ', function () {
var spy;

@@ -203,2 +243,3 @@ inject(function (myMultipageDatasource) {

function (viewport, scope, $timeout) {
var calls = 6;

@@ -213,8 +254,9 @@ viewport.scrollTop(100);

expect(spy.calls.all().length).toBe(5);
expect(spy.calls.all().length).toBe(calls);
expect(spy.calls.all()[0].args[0]).toBe(1);
expect(spy.calls.all()[1].args[0]).toBe(4);
expect(spy.calls.all()[2].args[0]).toBe(-2);
expect(spy.calls.all()[3].args[0]).toBe(7);
expect(spy.calls.all()[2].args[0]).toBe(7);
expect(spy.calls.all()[3].args[0]).toBe(-2);
expect(spy.calls.all()[4].args[0]).toBe(10);
expect(spy.calls.all()[5].args[0]).toBe(13);
}

@@ -224,6 +266,8 @@ );

it('should re-add 3 divs at the top and clip 3 divs from the bottom (9 divs total) (+ 2 padding divs)', function () {
it('should re-add 3 divs at the top and clip 2 divs from the bottom (9 divs total) (+ 2 padding divs)', function () {
runTest(scrollSettings,
function (viewport, scope, $timeout) {
var flush = $timeout.flush;
var itemsLoaded = 8;
var itemsWithPaddings = itemsLoaded + 2;

@@ -236,3 +280,2 @@ viewport.scrollTop(100);

viewport.trigger('scroll');
flush();

@@ -243,8 +286,8 @@ viewport.scrollTop(0);

expect(viewport.children().length).toBe(8);
expect(viewport.children().length).toBe(itemsWithPaddings);
expect(viewport.scrollTop()).toBe(0);
expect(viewport.children().css('height')).toBe('0px');
expect(angular.element(viewport.children()[7]).css('height')).toBe('240px');
expect(angular.element(viewport.children()[itemsWithPaddings-1]).css('height')).toBe('280px');
for (var i = 1; i < 7; i++) {
for (var i = 1; i <= itemsLoaded; i++) {
var row = viewport.children()[i];

@@ -258,3 +301,3 @@ expect(row.tagName.toLowerCase()).toBe('div');

it('should call get on the datasource 1 more time (4 total) ', function () {
it('should call get on the datasource 1 more time (8 total) ', function () {
var spy;

@@ -264,5 +307,7 @@ inject(function (myMultipageDatasource) {

});
runTest(scrollSettings,
function (viewport, scope, $timeout) {
var flush = $timeout.flush;
var totalCallsNumber = 8;

@@ -275,3 +320,2 @@ viewport.scrollTop(100);

viewport.trigger('scroll');
flush();

@@ -282,11 +326,11 @@ viewport.scrollTop(0);

expect(spy.calls.all().length).toBe(7);
expect(spy.calls.all().length).toBe(totalCallsNumber);
expect(spy.calls.all()[0].args[0]).toBe(1);
expect(spy.calls.all()[1].args[0]).toBe(4);
expect(spy.calls.all()[2].args[0]).toBe(-2);
expect(spy.calls.all()[3].args[0]).toBe(7);
expect(spy.calls.all()[2].args[0]).toBe(7);
expect(spy.calls.all()[3].args[0]).toBe(-2);
expect(spy.calls.all()[4].args[0]).toBe(10);
expect(spy.calls.all()[5].args[0]).toBe(1);
expect(spy.calls.all()[6].args[0]).toBe(-2);
expect(spy.calls.all()[5].args[0]).toBe(13);
expect(spy.calls.all()[6].args[0]).toBe(2);
expect(spy.calls.all()[7].args[0]).toBe(-1);
}

@@ -372,7 +416,6 @@ );

viewport.trigger('scroll');
flush();
viewport.scrollTop(viewportHeight + itemHeight * 2);
viewport.trigger('scroll');
flush();
expect(flush).toThrow();

@@ -384,3 +427,3 @@ expect(spy.calls.all().length).toBe(4);

expect(spy.calls.all()[2].args[0]).toBe(-2);
expect(spy.calls.all()[3].args[0]).toBe(5); //empty
expect(spy.calls.all()[3].args[0]).toBe(6); //empty

@@ -411,3 +454,2 @@ }

viewport.trigger('scroll');
flush();

@@ -418,3 +460,2 @@ viewport.scrollTop(0); //last full, scroll to -5, bof is reached

expect(flush).toThrow();
viewport.scrollTop(0); //empty, no scroll occurred (-8)

@@ -424,4 +465,2 @@ viewport.trigger('scroll');

expect(flush).toThrow();
expect(spy.calls.all().length).toBe(5);

@@ -478,8 +517,8 @@ expect(spy.calls.all()[0].args[0]).toBe(1);

wheelEventElement.dispatchEvent(getNewWheelEvent()); //now we are at the top but preventDefault is occurred because of bof will be reached only after next scroll trigger
expect(documentScrollBubblingCount).toBe(1); //here! the only one prevented wheel-event
expect(documentScrollBubblingCount).toBe(2); //here! the only one prevented wheel-event
flush();
//flush();
wheelEventElement.dispatchEvent(getNewWheelEvent()); //preventDefault will not occurred but document will not scroll because of viewport will be scrolled
expect(documentScrollBubblingCount).toBe(2);
expect(documentScrollBubblingCount).toBe(3);

@@ -489,6 +528,6 @@ viewport.scrollTop(0);

flush();
//flush();
wheelEventElement.dispatchEvent(getNewWheelEvent()); //preventDefault will not occurred because of we are at the top and bof is reached
expect(documentScrollBubblingCount).toBe(3);
expect(documentScrollBubblingCount).toBe(4);

@@ -498,3 +537,3 @@ expect(flush).toThrow(); //there is no new data, bof is reached

wheelEventElement.dispatchEvent(getNewWheelEvent()); //preventDefault will not occurred because of we are at the top and bof is reached
expect(documentScrollBubblingCount).toBe(4);
expect(documentScrollBubblingCount).toBe(5);

@@ -543,9 +582,6 @@ }, {

scope.$watch('container2.isLoading', function(newValue, oldValue) {
switch(++isLoadingChangeCount) {
case 1: expect(newValue).toBe(false); expect(oldValue).toBe(false); break;
case 2: expect(newValue).toBe(true); expect(oldValue).toBe(false); break;
case 3: expect(newValue).toBe(false); expect(oldValue).toBe(true); break;
}
expect(scope.container1.adapter.isLoading).toBe(newValue);
// need to review: isLoading=true can't be catched since subscribe/unsibscribe optimization
scope.$watch('container1.adapter.isLoading', function(newValue) {
isLoadingChangeCount++;
expect(scope.container2.isLoading).toBe(newValue);
});

@@ -557,3 +593,3 @@

expect(isLoadingChangeCount).toBe(3);
expect(isLoadingChangeCount).toBe(1);
}

@@ -622,3 +658,2 @@ );

viewport.trigger('scroll');
$timeout.flush();
}

@@ -630,5 +665,6 @@

viewport.trigger('scroll');
$timeout.flush();
}
$timeout.flush();
// scroll down + expectation

@@ -671,3 +707,2 @@ for(i = 0; i < limit; i++) {

viewport.trigger('scroll');
$timeout.flush();
}

@@ -679,7 +714,8 @@

viewport.trigger('scroll');
$timeout.flush();
}
$timeout.flush();
// unstable delta passing
viewport.scrollTop(viewport.scrollTop() - 5);
viewport.scrollTop(viewport.scrollTop());

@@ -712,2 +748,98 @@ // scroll up + expectation

describe('topVisible property: deep access and sync', function () {
it('should get topVisible as an adapter property', function () {
runTest({datasource: 'myMultipageDatasource', adapter: 'adapterContainer.innerContainer.adapter'},
function (viewport, scope) {
expect(!!scope.adapterContainer && !!scope.adapterContainer.innerContainer && !!scope.adapterContainer.innerContainer.adapter).toBe(true);
expect(angular.isString(scope.adapterContainer.innerContainer.adapter.topVisible)).toBe(true);
}
);
});
it('should get topVisible as a scope property', function () {
runTest({datasource: 'myMultipageDatasource', topVisible: 'scopeContainer.innerContainer.topVisible'},
function (viewport, scope) {
expect(!!scope.scopeContainer && !!scope.scopeContainer.innerContainer).toBe(true);
expect(angular.isString(scope.scopeContainer.innerContainer.topVisible)).toBe(true);
}
);
});
it('should sync scope-topVisible with adapter-topVisible', function () {
runTest({
datasource: 'myMultipageDatasource',
itemHeight: 40,
bufferSize: 3,
adapter: 'container1.adapter',
topVisible: 'container2.topVisible'
},
function (viewport, scope, $timeout) {
var topVisibleChangeCount = 0;
scope.$watch('container1.adapter.topVisible', function(newValue) {
topVisibleChangeCount++;
expect(scope.container1.adapter.topVisible).toBe(newValue);
expect(scope.container2.topVisible).toBe(newValue);
if(topVisibleChangeCount === 1) {
expect(newValue).toBe('item3');
}
else if(topVisibleChangeCount === 2) {
expect(newValue).toBe('item8');
}
});
viewport.scrollTop(100); // 100 : 40 = 2.5 --> item3
viewport.trigger('scroll');
$timeout.flush();
viewport.scrollTop(300); // 300 : 40 = 7.5 --> item8
viewport.trigger('scroll');
$timeout.flush();
expect(topVisibleChangeCount).toBe(2);
}
);
});
it('should sync scope-topVisible with adapter-topVisible in case of single fetch', function () {
runTest({
datasource: 'myOneBigPageDatasource',
itemHeight: 40,
bufferSize: 3,
adapter: 'container1.adapter',
topVisible: 'container2.topVisible'
},
function (viewport, scope) {
var topVisibleChangeCount = 0;
scope.$watch('container1.adapter.topVisible', function(newValue) {
topVisibleChangeCount++;
expect(scope.container1.adapter.topVisible).toBe(newValue);
expect(scope.container2.topVisible).toBe(newValue);
if(topVisibleChangeCount === 1) {
expect(newValue).toBe('item3');
}
else if(topVisibleChangeCount === 2) {
expect(newValue).toBe('item8');
}
});
viewport.scrollTop(100); // 100 : 40 = 2.5 --> item3
viewport.trigger('scroll');
viewport.scrollTop(300); // 300 : 40 = 7.5 --> item8
viewport.trigger('scroll');
expect(topVisibleChangeCount).toBe(2);
}
);
});
});
});

@@ -13,2 +13,21 @@ angular.module('ui.scroll.test.datasources', [])

.factory('myNewEmptyDatasource', [
'$log', '$timeout', '$rootScope', function () {
// another layer of indirection introduced by the actualGet
// is a workaround for the jasmine issue #1007 https://github.com/jasmine/jasmine/issues/1007
var result = {
get: function (descriptor, success) {
result.actualGet(descriptor, success);
},
actualGet: function (descriptor, success) {
success([]);
}
};
return result;
}
])
.factory('myOnePageDatasource', [

@@ -28,2 +47,43 @@ '$log', '$timeout', '$rootScope', function () {

.factory('myOneBigPageDatasource', [
'$log', '$timeout', '$rootScope', function () {
return {
get: function (index, count, success) {
if (index === 1) {
var resultList = [];
for(var i = 1; i < 100; i++) {
resultList.push('item' + i);
}
success(resultList);
} else {
success([]);
}
}
};
}
])
.factory('myNewOnePageDatasource', [
'$log', '$timeout', '$rootScope', function () {
// another layer of indirection introduced by the actualGet
// is a workaround for the jasmine issue #1007 https://github.com/jasmine/jasmine/issues/1007
var result = {
get: function (descriptor, success) {
result.actualGet(descriptor, success);
},
actualGet: function (descriptor, success) {
if (descriptor.index === 1) {
success(['one', 'two', 'three']);
} else {
success([]);
}
}
};
return result;
}
])
.factory('myObjectDatasource', [

@@ -30,0 +90,0 @@ '$log', '$timeout', '$rootScope', function () {

@@ -20,3 +20,3 @@ // Karma configuration

'https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-mocks.js',
'../src/ui-scroll*.coffee',
'../temp/ui-scroll*.js',
'datasources.js',

@@ -27,16 +27,2 @@ 'scaffolding.js',

preprocessors: {
'../src/ui-scroll*.coffee': ['coffee']
},
coffeePreprocessor: {
options: {
bare: true,
sourceMap: false
},
transformPath: function(path) {
return path.replace(/\.js$/, '.coffee');
}
},
// list of files to exclude

@@ -43,0 +29,0 @@ exclude: [

@@ -6,2 +6,3 @@ var createHtml = function (settings) {

var isLoading = settings.isLoading ? ' is-loading="' + settings.isLoading + '"' : '';
var topVisible = settings.topVisible ? ' top-visible="' + settings.topVisible + '"' : '';
var adapter = settings.adapter ? ' adapter="' + settings.adapter + '"' : '';

@@ -12,3 +13,3 @@ var template = settings.template ? settings.template : '{{$index}}: {{item}}';

adapter +
itemStyle + bufferSize + isLoading + '>' +
itemStyle + bufferSize + isLoading + topVisible + '>' +
template +

@@ -23,2 +24,6 @@ '</div>' +

var scope = $rootScope.$new();
//if (angular.element(document).find('body').find('div').children().length)
//debugger
angular.element(document).find('body').append(scroller);

@@ -31,11 +36,14 @@

run(scroller, scope, $timeout);
try {
run(scroller, scope, $timeout);
} finally {
scroller.remove();
scroller.remove();
if (options && typeof options.cleanupTest === 'function') {
options.cleanupTest(scroller, scope, $timeout);
}
}
if (options && typeof options.cleanupTest === 'function') {
options.cleanupTest(scroller, scope, $timeout);
}
}
);
};

@@ -19,5 +19,5 @@ /*global describe, beforeEach, module, it, expect, runTest */

var onePackItemsCount = 3 + 2;
var twoPacksItemsCount = 3 * 2 + 2;
var twoPacksItemsCount = 3 * 3 + 2;
it('should create 6 divs with data (+ 2 padding divs)', function () {
it('should create 9 divs with data (+ 2 padding divs)', function () {
runTest(scrollSettings,

@@ -24,0 +24,0 @@ function (viewport) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc