From d9b3f9c77ef8c1e37f1599a94ef0622db3510046 Mon Sep 17 00:00:00 2001 From: dhilt Date: Fri, 4 Nov 2016 03:19:20 +0300 Subject: [PATCH] distributives + demo updates --- demo/insideDirective/insideDirective.html | 6 +++- demo/insideDirective/insideDirective.js | 3 ++ dist/ui-scroll.js | 34 +++++++++++++++++------ dist/ui-scroll.min.js | 4 +-- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/demo/insideDirective/insideDirective.html b/demo/insideDirective/insideDirective.html index 6bed5b71..2b8c3f4f 100644 --- a/demo/insideDirective/insideDirective.html +++ b/demo/insideDirective/insideDirective.html @@ -21,7 +21,11 @@

Scroller inside the directive

This sample demonstrates encapsulation of the ui-scroll directive inside another custom directive wich has it's own controller and wich uses "Controller As" syntax in it's template. - +
+
+ +
+
diff --git a/demo/insideDirective/insideDirective.js b/demo/insideDirective/insideDirective.js index eb541364..ce875900 100644 --- a/demo/insideDirective/insideDirective.js +++ b/demo/insideDirective/insideDirective.js @@ -1,4 +1,7 @@ angular.module('application', ['ui.scroll', 'ui.scroll.jqlite']) + .controller('mainController', ['$scope', function($scope) { + $scope.show = true; + }]) .directive('myDir', function() { return { restrict: 'E', diff --git a/dist/ui-scroll.js b/dist/ui-scroll.js index abc6c684..34902201 100644 --- a/dist/ui-scroll.js +++ b/dist/ui-scroll.js @@ -1,7 +1,7 @@ /*! * angular-ui-scroll * https://github.com/angular-ui/ui-scroll.git - * Version: 1.5.1 -- 2016-10-30T12:41:33.695Z + * Version: 1.5.1 -- 2016-11-04T01:55:55.663Z * License: MIT */ @@ -415,6 +415,7 @@ angular.module('ui.scroll', []).directive('uiScrollViewport', function () { } function Adapter($attr, viewport, buffer, adjustBuffer, element) { + var hasViewport = !!viewport.scope(); var viewportScope = viewport.scope() || $rootScope; var disabled = false; var self = this; @@ -524,34 +525,51 @@ angular.module('ui.scroll', []).directive('uiScrollViewport', function () { var target = match[1]; var onControllerName = match[2]; - var parseControllers = function parseControllers(controllerName) { + // ng-controller attr based DOM parsing + var parseNgCtrlAttrs = function parseNgCtrlAttrs(controllerName) { var as = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; var candidate = element; while (candidate.length) { + var candidateScope = candidate.scope(); var candidateName = (candidate.attr('ng-controller') || '').match(/(\w(?:\w|\d)*)(?:\s+as\s+(\w(?:\w|\d)*))?/); if (candidateName && candidateName[as ? 2 : 1] === controllerName) { - scope = candidate.scope(); - break; + scope = candidateScope; + return true; + } + candidate = candidate.parent(); + } + }; + + // scope based DOM pasrsing + var parseScopes = function parseScopes(controllerName) { + var candidate = element; + while (candidate.length) { + var candidateScope = candidate.scope(); + if (candidateScope && candidateScope.hasOwnProperty(controllerName) && candidateScope[controllerName].constructor.name === 'controller') { + scope = candidateScope; + return true; } candidate = candidate.parent(); } }; if (onControllerName) { - // 'on' syntax parsing + // 'on' syntax DOM parsing (adapter='adapter on ctrl') scope = null; - parseControllers(onControllerName); + parseNgCtrlAttrs(onControllerName); if (!scope) { throw new Error('Failed to locate target controller \'' + onControllerName + '\' to inject \'' + target + '\''); } } else { - // try to parse with 'Controller As' syntax + // try to parse DOM with 'Controller As' syntax (adapter='ctrl.adapter') var controllerAsName = undefined; var dotIndex = target.indexOf('.'); if (dotIndex > 0) { controllerAsName = target.substr(0, dotIndex); - parseControllers(controllerAsName, true); + if (!parseNgCtrlAttrs(controllerAsName, true) && !hasViewport) { + parseScopes(controllerAsName); // the case of custom Directive/Component + } } } diff --git a/dist/ui-scroll.min.js b/dist/ui-scroll.min.js index 33fff99b..a9b144e5 100644 --- a/dist/ui-scroll.min.js +++ b/dist/ui-scroll.min.js @@ -1,7 +1,7 @@ /*! * angular-ui-scroll * https://github.com/angular-ui/ui-scroll.git - * Version: 1.5.1 -- 2016-10-30T12:41:33.695Z + * Version: 1.5.1 -- 2016-11-04T01:55:55.663Z * License: MIT */ -!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{restrict:"A",controller:["$log","$scope","$element",function(a,b,c){var d=this;d.container=c,d.viewport=c,angular.forEach(c.children(),function(a){"tbody"===a.tagName.toLowerCase()&&(d.viewport=angular.element(a))})}]}}).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){var b=Object.create(Array.prototype);return angular.extend(b,{size:a,reset:function(a){b.remove(0,b.length),b.eof=!1,b.bof=!1,b.first=a,b.next=a,b.minIndex=a,b.maxIndex=a,b.minIndexUser=null,b.maxIndexUser=null},append:function(a){a.forEach(function(a){++b.next,b.insert("append",a)}),b.maxIndex=b.eof?b.next-1:Math.max(b.next-1,b.maxIndex)},prepend:function(a){a.reverse().forEach(function(a){--b.first,b.insert("prepend",a)}),b.minIndex=b.bof?b.minIndex=b.first:Math.min(b.first,b.minIndex)},insert:function(a,c){var d={item:c};if(a%1===0)d.op="insert",b.splice(a,0,d);else switch(d.op=a,a){case"append":b.push(d);break;case"prepend":b.unshift(d)}},remove:function(a,c){if(angular.isNumber(a)){for(var d=a;c>d;d++)i(b[d]);return b.splice(a,c-a)}return b.splice(b.indexOf(a),1),k(a)},effectiveHeight:function(a){if(!a.length)return 0;var b=Number.MAX_VALUE,c=Number.MIN_VALUE;return a.forEach(function(a){a.element[0].offsetParent&&(b=Math.min(b,a.element.offset().top),c=Math.max(c,a.element.offset().top+a.element.outerHeight(!0)))}),Math.max(0,c-b)}}),b}function m(a,b,c,d){function e(){var a=Object.create(Array.prototype);return angular.extend(a,{add:function(b){for(var c=a.length-1;c>=0;c--)if(a[c].index===b.scope.$index)return void(a[c].height=b.element.outerHeight());a.push({index:b.scope.$index,height:b.element.outerHeight()})},clear:function(){a.length=0}}),a}function f(a){var b=void 0;switch(a.tagName){case"dl":throw new Error("ui-scroll directive does not support <"+a.tagName+"> as a repeating tag: "+a.outerHTML);case"tr":var c=angular.element("
");b=c.find("tr");break;case"li":b=angular.element("
  • ");break;default:b=angular.element("
    ")}return b.cache=new e,b}function g(){return l.outerHeight()*d}var i=void 0,k=void 0,l=c&&c.viewport?c.viewport:angular.element(window),m=c&&c.container?c.container:void 0;return l.css({"overflow-y":"auto",display:"block"}),angular.extend(l,{createPaddingElements:function(a){i=new f(a),k=new f(a),b.before(i),b.after(k)},applyContainerStyle:function(){m&&m!==l&&l.css("height",window.getComputedStyle(m[0]).height)},bottomDataPos:function(){var a=l[0].scrollHeight;return a=null!=a?a:l[0].document.documentElement.scrollHeight,a-k.height()},topDataPos:function(){return i.height()},bottomVisiblePos:function(){return l.scrollTop()+l.outerHeight()},topVisiblePos:function(){return l.scrollTop()},insertElement:function(a,b){return h(a,b||i)},insertElementAnimated:function(a,b){return j(a,b||i)},shouldLoadBottom:function(){return!a.eof&&l.bottomDataPos()=0&&(d=a[f].element.outerHeight(!0),!(c+d>e));f--)k.cache.add(a[f]),c+=d,b++;b>0&&(a.eof=!1,a.remove(a.length-b,a.length),a.next-=b,l.adjustPadding())},shouldLoadTop:function(){return!a.bof&&l.topDataPos()>l.topVisiblePos()-g()},clipTop:function(){for(var b=0,c=0,d=0,e=l.topVisiblePos()-l.topDataPos()-g(),f=0;fe));f++)i.cache.add(a[f]),c+=d,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=i.cache.reduce(function(b,c){return b+(c.index=a.next?c.height:0)},0),d=a.reduce(function(a,b){return a+b.element.outerHeight(!0)},0),e=(d+b+c)/(a.maxIndex-a.minIndex+1),f=null!==a.minIndexUser&&a.minIndex>a.minIndexUser,g=null!==a.maxIndexUser&&a.maxIndexa.minIndexUser){var c=i.height()-b;l.scrollTop(l.scrollTop()+c)}},adjustScrollTopAfterPrepend:function(b){if(b.prepended.length){var c=a.effectiveHeight(b.prepended),d=i.height()-c;d>=0?i.height(d):(i.height(0),l.scrollTop(l.scrollTop()-d))}},resetTopPadding:function(){i.height(0),i.cache.clear()},resetBottomPadding:function(){k.height(0),k.cache.clear()}}),l}function n(a,b,c,e,f){function h(b){var c=a[b],d=j,e=void 0;if(c){var h=c.match(/^(\S+)(?:\s+on\s+(\w(?:\w|\d)*))?/);if(!h)throw new Error("Expected injection expression in form of 'target' or 'target on controller' but got '"+c+"'");var i=h[1],k=h[2],m=function(a){for(var b=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],c=f;c.length;){var e=(c.attr("ng-controller")||"").match(/(\w(?:\w|\d)*)(?:\s+as\s+(\w(?:\w|\d)*))?/);if(e&&e[b?2:1]===a){d=c.scope();break}c=c.parent()}};if(k){if(d=null,m(k),!d)throw new Error("Failed to locate target controller '"+k+"' to inject '"+i+"'")}else{var n=void 0,o=i.indexOf(".");o>0&&(n=i.substr(0,o),m(n,!0))}e=g(i).assign}return function(a){l!==a&&(l[b]=a),e&&e(d,a)}}function i(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 j=b.scope()||d,k=!1,l=this;h("adapter")(l);var m=h("topVisible"),n=h("topVisibleElement"),o=h("topVisibleScope"),p=h("isLoading");Object.defineProperty(this,"disabled",{get:function(){return k},set:function(a){return(k=a)?null:e()}}),this.isLoading=!1,this.isBOF=function(){return c.bof},this.isEOF=function(){return c.eof},this.applyUpdates=function(a,b){if(angular.isFunction(a))c.slice(0).forEach(function(b){i(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&&d0?T[b-1].element:void 0;return j(function(b,f){d=c(b,e),a.element=b,a.scope=f,f[L]=a.item}),V.transform&&V.transform(a.scope,a.element),d}function x(){var a=[],b=[],c=[],d=[];return T.forEach(function(e,f){switch(e.op){case"prepend":b.unshift(e);break;case"append":v(e,f),e.op="none",d.push(e);break;case"insert":a=a.concat(w(e,f,U.insertElementAnimated)),e.op="none",d.push(e);break;case"remove":c.push(e)}}),c.forEach(function(b){return a=a.concat(T.remove(b))}),b.length&&b.forEach(function(a){v(a),a.op="none"}),T.forEach(function(a,b){return a.scope.$index=T.first+b}),{prepended:b,removed:c,inserted:d,animated:a}}function y(a,b){b.animated.length?f.all(b.animated).then(function(){U.adjustPadding(),A(a)}):U.adjustPadding()}function z(a,b){U.shouldLoadBottom()?(!b||T.effectiveHeight(b.inserted)>0)&&1===S.push(!0)&&(C(a),V.loading(!0)):U.shouldLoadTop()&&(!b||T.effectiveHeight(b.prepended)>0||S[0])&&1===S.push(!1)&&(C(a),V.loading(!0))}function A(a){a||(S=[],a=++R);var b=x();e(function(){b.inserted.forEach(function(a){return a.element.removeClass("ng-hide")}),b.prepended.forEach(function(a){return a.element.removeClass("ng-hide")}),p(a)||(y(a,b),z(a),S.length||V.calculateProperties())})}function B(a){var b=x();e(function(){b.inserted.forEach(function(a){return a.element.removeClass("ng-hide")}),b.prepended.forEach(function(a){return a.element.removeClass("ng-hide")}),U.adjustScrollTopAfterPrepend(b),p(a)||(y(a,b),z(a,b),S.shift(),S.length?C(a):(V.loading(!1),q(),V.calculateProperties()))})}function C(a){S[0]?T.length&&!U.shouldLoadBottom()?B(a):Y(function(b){p(a)||(b.length0&&(U.clipTop(),T.append(b)),B(a))}):T.length&&!U.shouldLoadTop()?B(a):Z(function(b){p(a)||(b.length0&&(T.length&&U.clipBottom(),T.prepend(b)),B(a))})}function D(){d.$$phase||V.isLoading||V.disabled||(z(R),S.length?r():(V.calculateProperties(),a.$apply()))}function E(a){if(!V.disabled){var b=U[0].scrollTop,c=U[0].scrollHeight-U[0].clientHeight;(0===b&&!T.bof||b===c&&!T.eof)&&a.preventDefault()}}var F=h.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!F)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+h.uiScroll+"'");var G=3,H=10,I=.3,J=.5,K=null,L=F[1],M=F[2],N=i[0],O=Math.max(G,k(h.bufferSize,H)),P=Math.max(I,k(h.padding,J)),Q=k(h.startIndex,1),R=0,S=[],T=new l(O),U=new m(T,b,N,P),V=new n(h,U,T,A,b);N&&(N.adapter=V);var W=function(){return angular.isObject(K)&&angular.isFunction(K.get)};if(K=g(M)(a),!W()&&(K=c.get(M),!W()))throw new Error(M+" is not a valid datasource");var X={};o(K,"minIndex","minIndexUser"),o(K,"maxIndex","maxIndexUser");var Y=2!==K.get.length?function(a){return K.get(T.next,O,a)}:function(a){K.get({index:T.next,append:T.length?T[T.length-1].item:void 0,count:O},a)},Z=2!==K.get.length?function(a){return K.get(T.first-O,O,a)}:function(a){K.get({index:T.first-O,prepend:T.length?T[0].item:void 0,count:O},a)};V.reload=s,j(function(a,b){U.createPaddingElements(a[0]),b.$destroy(),a.remove()}),a.$on("$destroy",function(){r(),U.unbind("mousewheel",E)}),U.bind("mousewheel",E),e(function(){U.applyContainerStyle(),s()})}var p=c.has&&c.has("$animate")?c.get("$animate"):null,q=1===angular.version.major&&angular.version.minor<3;return{require:["?^^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:o}}])}(); \ No newline at end of file +!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{restrict:"A",controller:["$log","$scope","$element",function(a,b,c){var d=this;d.container=c,d.viewport=c,angular.forEach(c.children(),function(a){"tbody"===a.tagName.toLowerCase()&&(d.viewport=angular.element(a))})}]}}).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){var b=Object.create(Array.prototype);return angular.extend(b,{size:a,reset:function(a){b.remove(0,b.length),b.eof=!1,b.bof=!1,b.first=a,b.next=a,b.minIndex=a,b.maxIndex=a,b.minIndexUser=null,b.maxIndexUser=null},append:function(a){a.forEach(function(a){++b.next,b.insert("append",a)}),b.maxIndex=b.eof?b.next-1:Math.max(b.next-1,b.maxIndex)},prepend:function(a){a.reverse().forEach(function(a){--b.first,b.insert("prepend",a)}),b.minIndex=b.bof?b.minIndex=b.first:Math.min(b.first,b.minIndex)},insert:function(a,c){var d={item:c};if(a%1===0)d.op="insert",b.splice(a,0,d);else switch(d.op=a,a){case"append":b.push(d);break;case"prepend":b.unshift(d)}},remove:function(a,c){if(angular.isNumber(a)){for(var d=a;c>d;d++)i(b[d]);return b.splice(a,c-a)}return b.splice(b.indexOf(a),1),k(a)},effectiveHeight:function(a){if(!a.length)return 0;var b=Number.MAX_VALUE,c=Number.MIN_VALUE;return a.forEach(function(a){a.element[0].offsetParent&&(b=Math.min(b,a.element.offset().top),c=Math.max(c,a.element.offset().top+a.element.outerHeight(!0)))}),Math.max(0,c-b)}}),b}function m(a,b,c,d){function e(){var a=Object.create(Array.prototype);return angular.extend(a,{add:function(b){for(var c=a.length-1;c>=0;c--)if(a[c].index===b.scope.$index)return void(a[c].height=b.element.outerHeight());a.push({index:b.scope.$index,height:b.element.outerHeight()})},clear:function(){a.length=0}}),a}function f(a){var b=void 0;switch(a.tagName){case"dl":throw new Error("ui-scroll directive does not support <"+a.tagName+"> as a repeating tag: "+a.outerHTML);case"tr":var c=angular.element("
    ");b=c.find("tr");break;case"li":b=angular.element("
  • ");break;default:b=angular.element("
    ")}return b.cache=new e,b}function g(){return l.outerHeight()*d}var i=void 0,k=void 0,l=c&&c.viewport?c.viewport:angular.element(window),m=c&&c.container?c.container:void 0;return l.css({"overflow-y":"auto",display:"block"}),angular.extend(l,{createPaddingElements:function(a){i=new f(a),k=new f(a),b.before(i),b.after(k)},applyContainerStyle:function(){m&&m!==l&&l.css("height",window.getComputedStyle(m[0]).height)},bottomDataPos:function(){var a=l[0].scrollHeight;return a=null!=a?a:l[0].document.documentElement.scrollHeight,a-k.height()},topDataPos:function(){return i.height()},bottomVisiblePos:function(){return l.scrollTop()+l.outerHeight()},topVisiblePos:function(){return l.scrollTop()},insertElement:function(a,b){return h(a,b||i)},insertElementAnimated:function(a,b){return j(a,b||i)},shouldLoadBottom:function(){return!a.eof&&l.bottomDataPos()=0&&(d=a[f].element.outerHeight(!0),!(c+d>e));f--)k.cache.add(a[f]),c+=d,b++;b>0&&(a.eof=!1,a.remove(a.length-b,a.length),a.next-=b,l.adjustPadding())},shouldLoadTop:function(){return!a.bof&&l.topDataPos()>l.topVisiblePos()-g()},clipTop:function(){for(var b=0,c=0,d=0,e=l.topVisiblePos()-l.topDataPos()-g(),f=0;fe));f++)i.cache.add(a[f]),c+=d,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=i.cache.reduce(function(b,c){return b+(c.index=a.next?c.height:0)},0),d=a.reduce(function(a,b){return a+b.element.outerHeight(!0)},0),e=(d+b+c)/(a.maxIndex-a.minIndex+1),f=null!==a.minIndexUser&&a.minIndex>a.minIndexUser,g=null!==a.maxIndexUser&&a.maxIndexa.minIndexUser){var c=i.height()-b;l.scrollTop(l.scrollTop()+c)}},adjustScrollTopAfterPrepend:function(b){if(b.prepended.length){var c=a.effectiveHeight(b.prepended),d=i.height()-c;d>=0?i.height(d):(i.height(0),l.scrollTop(l.scrollTop()-d))}},resetTopPadding:function(){i.height(0),i.cache.clear()},resetBottomPadding:function(){k.height(0),k.cache.clear()}}),l}function n(a,b,c,e,f){function h(b){var c=a[b],d=k,e=void 0;if(c){var h=c.match(/^(\S+)(?:\s+on\s+(\w(?:\w|\d)*))?/);if(!h)throw new Error("Expected injection expression in form of 'target' or 'target on controller' but got '"+c+"'");var i=h[1],l=h[2],n=function(a){for(var b=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],c=f;c.length;){var e=c.scope(),g=(c.attr("ng-controller")||"").match(/(\w(?:\w|\d)*)(?:\s+as\s+(\w(?:\w|\d)*))?/);if(g&&g[b?2:1]===a)return d=e,!0;c=c.parent()}},o=function(a){for(var b=f;b.length;){var c=b.scope();if(c&&c.hasOwnProperty(a)&&"controller"===c[a].constructor.name)return d=c,!0;b=b.parent()}};if(l){if(d=null,n(l),!d)throw new Error("Failed to locate target controller '"+l+"' to inject '"+i+"'")}else{var p=void 0,q=i.indexOf(".");q>0&&(p=i.substr(0,q),n(p,!0)||j||o(p))}e=g(i).assign}return function(a){m!==a&&(m[b]=a),e&&e(d,a)}}function i(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 j=!!b.scope(),k=b.scope()||d,l=!1,m=this;h("adapter")(m);var n=h("topVisible"),o=h("topVisibleElement"),p=h("topVisibleScope"),q=h("isLoading");Object.defineProperty(this,"disabled",{get:function(){return l},set:function(a){return(l=a)?null:e()}}),this.isLoading=!1,this.isBOF=function(){return c.bof},this.isEOF=function(){return c.eof},this.applyUpdates=function(a,b){if(angular.isFunction(a))c.slice(0).forEach(function(b){i(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&&d0?T[b-1].element:void 0;return j(function(b,f){d=c(b,e),a.element=b,a.scope=f,f[L]=a.item}),V.transform&&V.transform(a.scope,a.element),d}function x(){var a=[],b=[],c=[],d=[];return T.forEach(function(e,f){switch(e.op){case"prepend":b.unshift(e);break;case"append":v(e,f),e.op="none",d.push(e);break;case"insert":a=a.concat(w(e,f,U.insertElementAnimated)),e.op="none",d.push(e);break;case"remove":c.push(e)}}),c.forEach(function(b){return a=a.concat(T.remove(b))}),b.length&&b.forEach(function(a){v(a),a.op="none"}),T.forEach(function(a,b){return a.scope.$index=T.first+b}),{prepended:b,removed:c,inserted:d,animated:a}}function y(a,b){b.animated.length?f.all(b.animated).then(function(){U.adjustPadding(),A(a)}):U.adjustPadding()}function z(a,b){U.shouldLoadBottom()?(!b||T.effectiveHeight(b.inserted)>0)&&1===S.push(!0)&&(C(a),V.loading(!0)):U.shouldLoadTop()&&(!b||T.effectiveHeight(b.prepended)>0||S[0])&&1===S.push(!1)&&(C(a),V.loading(!0))}function A(a){a||(S=[],a=++R);var b=x();e(function(){b.inserted.forEach(function(a){return a.element.removeClass("ng-hide")}),b.prepended.forEach(function(a){return a.element.removeClass("ng-hide")}),p(a)||(y(a,b),z(a),S.length||V.calculateProperties())})}function B(a){var b=x();e(function(){b.inserted.forEach(function(a){return a.element.removeClass("ng-hide")}),b.prepended.forEach(function(a){return a.element.removeClass("ng-hide")}),U.adjustScrollTopAfterPrepend(b),p(a)||(y(a,b),z(a,b),S.shift(),S.length?C(a):(V.loading(!1),q(),V.calculateProperties()))})}function C(a){S[0]?T.length&&!U.shouldLoadBottom()?B(a):Y(function(b){p(a)||(b.length0&&(U.clipTop(),T.append(b)),B(a))}):T.length&&!U.shouldLoadTop()?B(a):Z(function(b){p(a)||(b.length0&&(T.length&&U.clipBottom(),T.prepend(b)),B(a))})}function D(){d.$$phase||V.isLoading||V.disabled||(z(R),S.length?r():(V.calculateProperties(),a.$apply()))}function E(a){if(!V.disabled){var b=U[0].scrollTop,c=U[0].scrollHeight-U[0].clientHeight;(0===b&&!T.bof||b===c&&!T.eof)&&a.preventDefault()}}var F=h.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!F)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+h.uiScroll+"'");var G=3,H=10,I=.3,J=.5,K=null,L=F[1],M=F[2],N=i[0],O=Math.max(G,k(h.bufferSize,H)),P=Math.max(I,k(h.padding,J)),Q=k(h.startIndex,1),R=0,S=[],T=new l(O),U=new m(T,b,N,P),V=new n(h,U,T,A,b);N&&(N.adapter=V);var W=function(){return angular.isObject(K)&&angular.isFunction(K.get)};if(K=g(M)(a),!W()&&(K=c.get(M),!W()))throw new Error(M+" is not a valid datasource");var X={};o(K,"minIndex","minIndexUser"),o(K,"maxIndex","maxIndexUser");var Y=2!==K.get.length?function(a){return K.get(T.next,O,a)}:function(a){K.get({index:T.next,append:T.length?T[T.length-1].item:void 0,count:O},a)},Z=2!==K.get.length?function(a){return K.get(T.first-O,O,a)}:function(a){K.get({index:T.first-O,prepend:T.length?T[0].item:void 0,count:O},a)};V.reload=s,j(function(a,b){U.createPaddingElements(a[0]),b.$destroy(),a.remove()}),a.$on("$destroy",function(){r(),U.unbind("mousewheel",E)}),U.bind("mousewheel",E),e(function(){U.applyContainerStyle(),s()})}var p=c.has&&c.has("$animate")?c.get("$animate"):null,q=1===angular.version.major&&angular.version.minor<3;return{require:["?^^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:o}}])}(); \ No newline at end of file