angular-ui-scroll
Advanced tools
Comparing version 1.9.0 to 1.9.1
{ | ||
"name": "angular-ui-scroll", | ||
"description": "AngularJS infinite scrolling module", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"main": "./dist/ui-scroll.js", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/angular-ui/ui-scroll.git", |
/*! | ||
* angular-ui-scroll | ||
* https://github.com/angular-ui/ui-scroll | ||
* Version: 1.9.0 -- 2023-04-19T12:05:19.939Z | ||
* Version: 1.9.1 -- 2023-05-17T15:38:46.936Z | ||
* License: MIT | ||
*/ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ (function() { // webpackBootstrap | ||
var __webpack_exports__ = {}; | ||
@@ -9,0 +9,0 @@ angular.module('ui.scroll.grid', []).directive('uiScrollTh', ['$log', '$timeout', function (console, $timeout) { |
angular.module("ui.scroll.grid",[]).directive("uiScrollTh",["$log","$timeout",function(t,n){function r(t){this.getLayout=function(){return t.getLayout()},this.applyLayout=function(n){return t.applyLayout(n)},this.columnFromPoint=function(n,r){return t.columnFromPoint(n,r)},Object.defineProperty(this,"columns",{get:function(){return t.getColumns()}})}function o(t,n){this.css=function(){var r=arguments[0],o=arguments[1];if(1==arguments.length)return n.header.css(r);2==arguments.length&&(n.header.css(r,o),t.forEachRow((function(t){return t[n.id].css(r,o)})),n.css[r]=o)},this.moveBefore=function(r){return t.moveBefore(n,r)},this.exchangeWith=function(r){return t.exchangeWith(n,r)},Object.defineProperty(this,"columnId",{get:function(){return n.id}})}function e(t,n,r){function o(t,n,r){var o=t.offset();return!(n<o.left||o.left+t.outerWidth(!0)<n||r<o.top||o.top+t.outerHeight(!0)<r)}function e(t,n){t.detach(),n.before(t)}function i(t){var n=t.parent();t.detach(),n.append(t)}function u(t,n){for(var r in t.removeAttr("style"),n)n.hasOwnProperty(r)&&t.css(r,n[r])}this.header=r,this.css={},this.mapTo=n.length,this.id=n.length,this.applyLayout=function(t){this.css=angular.extend({},t.css),this.mapTo=t.mapTo,u(this.header,this.css)},this.moveBefore=function(n){var o=this;n?(e(r,n.header),t.forEachRow((function(t){return e(t[o.id],t[n.id])}))):(i(r),t.forEachRow((function(t){return i(t[o.id])})))},this.columnFromPoint=function(n,e){var i=this;if(o(r,n,e))return this;var u=null;return t.forEachRow((function(t){return u=o(t[i.id],n,e)?i:u})),u},this.applyCss=function(t){u(t,this.css)}}function i(t){var i=this,u=[],c=new Map;function a(t){var n=t[0].parent(),r=[];t.forEach((function(n,o){u[o].applyCss(n),r[u[o].mapTo]=t[o],t[o].detach()})),r.forEach((function(t){return n.append(t)}))}n((function(){t.adapter.publicContext.gridAdapter=new r(i),t.adapter.transform=function(t,n){return a(c.get(t))}})),this.registerColumn=function(t){u.push(new e(this,u,t))},this.registerCell=function(t,n){var r=c.get(t);return r||(r=[],c.set(t,r)),!(r.length>=u.length||(r.push(n),0))},this.unregisterCell=function(t,n){var r=c.get(t),o=r.indexOf(n);r.splice(o,1),r.length||c.delete(t)},this.forEachRow=function(t){c.forEach(t)},this.getColumns=function(){var t=this,n=[];return u.slice().sort((function(t,n){return t.mapTo-n.mapTo})).forEach((function(r){return n.push(new o(t,r))})),n},this.getLayout=function(){var t=[];return u.forEach((function(n,r){return t.push({index:r,css:angular.extend({},n.css),mapTo:n.mapTo})})),t},this.applyLayout=function(t){if(!t||t.length!=u.length)throw new Error("Failed to apply layout - number of layouts should match number of columns");t.forEach((function(t,n){return u[n].applyLayout(t)})),a(u.map((function(t){return t.header}))),c.forEach((function(t){return a(t)}))},this.moveBefore=function(t,n){var r=n;if(n%1!=0&&(r=n?u[n.columnId].mapTo:u.length),!(r<0||r>u.length)){var o=t.mapTo,e=null;r-=o<r?1:0,u.forEach((function(t){t.mapTo-=t.mapTo>o?1:0,t.mapTo+=t.mapTo>=r?1:0,e=t.mapTo===r+1?t:e})),t.mapTo=r,t.moveBefore(e)}},this.exchangeWith=function(t,n){n<0||n>=u.length||(u.find((function(t){return t.mapTo===n})).mapTo=t.mapTo,t.mapTo=n)},this.columnFromPoint=function(t,n){var r=u.find((function(r){return r.columnFromPoint(t,n)}));return r?new o(this,r):void 0}}return{require:["^^uiScrollViewport"],restrict:"A",link:function(t,n,r,o){o[0].gridController=o[0].gridController||new i(o[0]),o[0].gridController.registerColumn(n)}}}]).directive("uiScrollTd",(function(){return{require:["?^^uiScrollViewport"],restrict:"A",link:function(t,n,r,o){if(o[0]){var e=t,i=t.uiScrollTdInitializer;i||(i=t.uiScrollTdInitializer={linking:!0}),i.linking||(e=i.scope);var u=o[0].gridController;u.registerCell(e,n)&&t.$on("$destroy",(function(){return u.unregisterCell(e,n)})),i.linking||i.onLink()}}}})); | ||
//# sourceMappingURL=ui-scroll-grid.min.js.map |
/*! | ||
* angular-ui-scroll | ||
* https://github.com/angular-ui/ui-scroll | ||
* Version: 1.9.0 -- 2023-04-19T12:05:19.939Z | ||
* Version: 1.9.1 -- 2023-05-17T15:38:46.936Z | ||
* License: MIT | ||
*/ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ (function() { // webpackBootstrap | ||
/******/ "use strict"; | ||
@@ -640,3 +640,3 @@ var __webpack_exports__ = {}; | ||
}(); | ||
/* harmony default export */ const modules_padding = (Padding); | ||
/* harmony default export */ var modules_padding = (Padding); | ||
;// CONCATENATED MODULE: ./src/modules/viewport.js | ||
@@ -1102,3 +1102,3 @@ | ||
}(); | ||
/* harmony default export */ const modules_adapter = (Adapter); | ||
/* harmony default export */ var modules_adapter = (Adapter); | ||
;// CONCATENATED MODULE: ./src/ui-scroll.js | ||
@@ -1105,0 +1105,0 @@ |
@@ -1,2 +0,2 @@ | ||
(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(o=i.key,a=void 0,a=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(o,"string"),"symbol"===e(a)?a:String(a)),i)}var o,a}var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,i,o;return n=e,i=[{key:"registerFor",value:function(e){var n,r,i,o;function a(e,n,r){var i=e[0],a=t({top:["scrollTop","pageYOffset","scrollLeft"],left:["scrollLeft","pageXOffset","scrollTop"]}[n],3),u=a[0],l=a[1],s=a[2],f=void 0!==r;return o(i)?f?i.scrollTo(e[s].call(e),r):l in i?i[l]:i.document.documentElement[u]:(f&&(i[u]=r),i[u])}function u(e,r,a){var u,l=function(e,r){var a,u,l,s,f,c,h,p,d,m;if(o(e))return{base:a=document.documentElement[{height:"clientHeight",width:"clientWidth"}[r]],padding:0,border:0,margin:0};var g=t({width:[e.offsetWidth,"Left","Right"],height:[e.offsetHeight,"Top","Bottom"]}[r],3);return a=g[0],h=g[1],p=g[2],c=i(e),d=n(e,c["padding"+h])||0,m=n(e,c["padding"+p])||0,u=n(e,c["border"+h+"Width"])||0,l=n(e,c["border"+p+"Width"])||0,s=c["margin"+h],f=c["margin"+p],{base:a,padding:d+m,border:u+l,margin:(n(e,s)||0)+(n(e,f)||0)}}(e,r);return l.base>0?{base:l.base-l.padding-l.border,outer:l.base,outerfull:l.base+l.margin}[a]:(((u=i(e)[r])<0||null===u)&&(u=e.style[r]||0),{base:(u=parseFloat(u)||0)-l.padding-l.border,outer:u,outerfull:u+l.padding+l.border+l.margin}[a])}return r=angular.element.prototype.css,e.prototype.css=function(e,t){var n=this[0];if(n&&3!==n.nodeType&&8!==n.nodeType&&n.style)return r.call(this,e,t)},o=function(e){return e&&e.document&&e.location&&e.alert&&e.setInterval},window.getComputedStyle?(i=function(e){return window.getComputedStyle(e,null)},n=function(e,t){return parseFloat(t)}):(i=function(e){return e.currentStyle},n=function(e,t){var n,r,i,o,a;return new RegExp("^("+/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source+")(?!px)[a-z%]+$","i").test(t)?(n=(a=e.style).left,o=(i=e.runtimeStyle)&&i.left,i&&(i.left=a.left),a.left=t,r=a.pixelLeft,a.left=n,o&&(i.left=o),r):parseFloat(t)}),angular.forEach({before:function(e){var t,n,r,i,o,a;if(n=this[0],(t=(o=this.parent()).contents())[0]===n)return o.prepend(e);for(r=i=1,a=t.length-1;1<=a?i<=a:i>=a;r=1<=a?++i:--i)if(t[r]===n)return void angular.element(t[r-1]).after(e);throw new Error("invalid DOM structure "+n.outerHTML)},height:function(e){return void 0!==e?(angular.isNumber(e)&&(e+="px"),r.call(this,"height",e)):u(this[0],"height","base")},outerHeight:function(e){return u(this[0],"height",e?"outerfull":"outer")},outerWidth:function(e){return u(this[0],"width",e?"outerfull":"outer")},offset:function(e){var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(arguments.length){if(void 0===e)return this;throw new Error("offset setter method is not implemented")}if(o)return t=o.documentElement,null!=i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=o.defaultView||o.parentWindow,{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},scrollTop:function(e){return a(this,"top",e)},scrollLeft:function(e){return a(this,"left",e)}},(function(t,n){if(!e.prototype[n])return e.prototype[n]=t}))}}],i&&r(n.prototype,i),o&&r(n,o),Object.defineProperty(n,"prototype",{writable:!1}),e}();function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,a=void 0,a=function(e,t){if("object"!==o(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===o(a)?a:String(a)),r)}var i,a}var u="ng-ui-scroll-hide",l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$animate=t.has&&t.has("$animate")?t.get("$animate"):null,this.isAngularVersionLessThen1_3=1===angular.version.major&&angular.version.minor<3,this.$q=n}var t,n,r;return t=e,r=[{key:"addCSSRules",value:function(){var e,t="."+u,n="display: none",r=document.styleSheets[0];try{e=r.cssRules.length}catch(t){e=0}"insertRule"in r?r.insertRule(t+"{"+n+"}",e):"addRule"in r&&r.addRule(t,n,e)}}],(n=[{key:"hideElement",value:function(e){e.element.addClass(u)}},{key:"showElement",value:function(e){e.element.removeClass(u)}},{key:"insertElement",value:function(e,t){return t.after(e),[]}},{key:"removeElement",value:function(e){return e.element.remove(),e.scope.$destroy(),[]}},{key:"insertElementAnimated",value:function(e,t){if(!this.$animate)return this.insertElement(e,t);if(this.isAngularVersionLessThen1_3){var n=this.$q.defer();return this.$animate.enter(e,null,t,(function(){return n.resolve()})),[n.promise]}return[this.$animate.enter(e,null,t)]}},{key:"removeElementAnimated",value:function(e){if(!this.$animate)return this.removeElement(e);if(this.isAngularVersionLessThen1_3){var t=this.$q.defer();return this.$animate.leave(e.element,(function(){return e.scope.$destroy(),t.resolve()})),[t.promise]}return[this.$animate.leave(e.element).then((function(){return e.scope.$destroy()}))]}}])&&a(t.prototype,n),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),s={PREPEND:"prepend",APPEND:"append",INSERT:"insert",REMOVE:"remove",NONE:"none"};function f(e,t,n){var r=Object.create(Array.prototype);return angular.extend(r,{size:t,reset:function(e){r.remove(0,r.length),r.eof=!1,r.bof=!1,r.first=e,r.next=e,r.minIndex=e,r.maxIndex=e,r.minIndexUser=null,r.maxIndexUser=null},append:function(e){e.forEach((function(e){++r.next,r.insert(s.APPEND,e)})),r.maxIndex=r.eof?r.next-1:Math.max(r.next-1,r.maxIndex)},prepend:function(e,t){e.reverse().forEach((function(e){t?++r.next:--r.first,r.insert(s.PREPEND,e)})),r.minIndex=r.bof?r.minIndex=r.first:Math.min(r.first,r.minIndex)},insert:function(e,t,n){var i={item:t};if(e%1==0)i.op=s.INSERT,r.splice(e,0,i),n?r.first--:r.next++;else switch(i.op=e,e){case s.APPEND:r.push(i);break;case s.PREPEND:r.unshift(i)}},remove:function(t,n){if(angular.isNumber(t)){for(var i=t;i<n;i++)e.removeElement(r[i]);return r.splice(t,n-t)}return r.splice(r.indexOf(t),1),t.shiftTop&&r.first===this.getAbsMinIndex()?this.incrementMinIndex():this.decrementMaxIndex(),t.shiftTop?r.first++:r.next--,r.length||(r.minIndex=Math.min(r.maxIndex,r.minIndex)),e.removeElementAnimated(t)},incrementMinIndex:function(){if(null!==r.minIndexUser){if(r.minIndex>r.minIndexUser)return void r.minIndexUser++;r.minIndex===r.minIndexUser&&r.minIndexUser++}r.minIndex++},decrementMaxIndex:function(){null!==r.maxIndexUser&&r.maxIndex<=r.maxIndexUser&&r.maxIndexUser--,r.maxIndex--},getAbsMinIndex:function(){return null!==r.minIndexUser?Math.min(r.minIndexUser,r.minIndex):r.minIndex},getAbsMaxIndex:function(){return null!==r.maxIndexUser?Math.max(r.maxIndexUser,r.maxIndex):r.maxIndex},effectiveHeight:function(e){if(!e.length)return 0;var t=Number.MAX_VALUE,n=Number.NEGATIVE_INFINITY;return e.forEach((function(e){e.element[0].offsetParent&&(t=Math.min(t,e.element.offset().top),n=Math.max(n,e.element.offset().top+e.element.outerHeight(!0)))})),Math.max(0,n-t)},getItems:function(){return r.filter((function(e){return e.op===s.NONE}))},getFirstItem:function(){var e=r.getItems();return e.length?e[0].item:null},getLastItem:function(){var e=r.getItems();return e.length?e[e.length-1].item:null}}),r.reset(n),r}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,o=void 0,o=function(e,t){if("object"!==c(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===c(o)?o:String(o)),r)}var i,o}function d(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var m=function(){function e(){h(this,e)}return d(e,[{key:"add",value:function(e){for(var t=this.length-1;t>=0;t--)if(this[t].index===e.scope.$index)return void(this[t].height=e.element.outerHeight());this.push({index:e.scope.$index,height:e.element.outerHeight()}),this.sort((function(e,t){return e.index<t.index?-1:e.index>t.index?1:0}))}},{key:"remove",value:function(e,t){for(var n=e%1==0?e:e.scope.$index,r=e%1==0?t:e.shiftTop,i=this.length-1;i>=0;i--)if(this[i].index===n){this.splice(i,1);break}if(!r)for(var o=this.length-1;o>=0;o--)this[o].index>n&&this[o].index--}},{key:"clear",value:function(){this.length=0}}]),e}();function g(){var e=[];return e.push.apply(e,arguments),Object.setPrototypeOf(e,g.prototype),e}g.prototype=Object.create(Array.prototype),Object.getOwnPropertyNames(m.prototype).forEach((function(e){return g.prototype[e]=m.prototype[e]}));const b=function(){function e(t){h(this,e),this.element=function(e){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("ui-scroll directive requires an Element node for templating the view");var t;switch(e.tagName.toLowerCase()){case"dl":throw new Error("ui-scroll directive does not support <".concat(e.tagName,"> as a repeating tag: ").concat(e.outerHTML));case"tr":t=angular.element("<table><tr><td><div></div></td></tr></table>").find("tr");break;case"li":t=angular.element("<li></li>");break;default:t=angular.element("<div></div>")}return t}(t),this.cache=new g}return d(e,[{key:"height",value:function(){return this.element.height.apply(this.element,arguments)}}]),e}();function v(e,t,n,r,i,o){var a=null,u=null,l=r&&r.viewport?r.viewport:angular.element(window),s=r&&r.container?r.container:void 0,f=r&&r.scope?r.scope:i;function c(){return l.outerHeight()*o}return l.css({"overflow-anchor":"none","overflow-y":"auto",display:"block"}),angular.extend(l,{getScope:function(){return f},createPaddingElements:function(e){a=new b(e),u=new b(e),n.before(a.element),n.after(u.element),a.height(0),u.height(0)},applyContainerStyle:function(){return!s||(s!==l&&l.css("height",window.getComputedStyle(s[0]).height),l.height()>0)},bottomDataPos:function(){var e=l[0].scrollHeight;return(e=null!=e?e:l[0].document.documentElement.scrollHeight)-u.height()},topDataPos:function(){return a.height()},bottomVisiblePos:function(){return l.scrollTop()+l.outerHeight()},topVisiblePos:function(){return l.scrollTop()},insertElement:function(t,n){return e.insertElement(t,n||a.element)},insertElementAnimated:function(t,n){return e.insertElementAnimated(t,n||a.element)},shouldLoadBottom:function(){return!t.eof&&l.bottomDataPos()<l.bottomVisiblePos()+c()},clipBottom:function(){for(var e=0,n=0,r=0,i=l.bottomDataPos()-l.bottomVisiblePos()-c(),o=t.length-1;o>=0&&!(n+(r=t[o].element.outerHeight(!0))>i);o--)u.cache.add(t[o]),n+=r,e++;e>0&&(t.eof=!1,t.remove(t.length-e,t.length),t.next-=e,l.adjustPaddings())},shouldLoadTop:function(){return!t.bof&&l.topDataPos()>l.topVisiblePos()-c()},clipTop:function(){for(var e=0,n=0,r=0,i=l.topVisiblePos()-l.topDataPos()-c(),o=0;o<t.length&&!(n+(r=t[o].element.outerHeight(!0))>i);o++)a.cache.add(t[o]),n+=r,e++;e>0&&(a.height(a.height()+n),t.bof=!1,t.remove(0,e),t.first+=e)},adjustPaddings:function(){if(t.length){var e=t.reduce((function(e,t){return e+t.element.outerHeight(!0)}),0),n=0,r=0;a.cache.forEach((function(e){e.index<t.first&&(n+=e.height,r++)}));var i=0,o=0;u.cache.forEach((function(e){e.index>=t.next&&(i+=e.height,o++)}));var l=(e+n+i)/(r+o+t.length),s=null!==t.minIndexUser&&t.minIndex>t.minIndexUser,f=null!==t.maxIndexUser&&t.maxIndex<t.maxIndexUser,c=s?(t.minIndex-t.minIndexUser)*l:0,h=f?(t.maxIndexUser-t.maxIndex)*l:0;a.height(n+c),u.height(i+h)}},onAfterMinIndexSet:function(e){if(null!==t.minIndexUser&&t.minIndex>t.minIndexUser){var n=a.height()-e;for(l.scrollTop(l.scrollTop()+n);(n-=l.scrollTop())>0;)u.height(u.height()+n),l.scrollTop(l.scrollTop()+n)}},onAfterPrepend:function(e){if(e.prepended.length){var n=t.effectiveHeight(e.prepended),r=a.height()-n;if(r>=0)a.height(r);else{var i=l.scrollTop(),o=i-r;l.synthetic={previous:i,next:o},a.height(0),l.scrollTop(o)}}},resetTopPadding:function(){a.height(0),a.cache.clear()},resetBottomPadding:function(){u.height(0),u.cache.clear()},removeCacheItem:function(e,t){a.cache.remove(e,t),u.cache.remove(e,t)},removeItem:function(e){return this.removeCacheItem(e),t.remove(e)}}),l}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,o=void 0,o=function(e,t){if("object"!==y(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===y(o)?o:String(o)),r)}var i,o}const E=function(){function e(t,n,r,i,o,a,u){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$parse=n,this.$attr=r,this.viewport=i,this.buffer=o,this.doAdjust=a,this.reload=u,this.isLoading=!1,this.disabled=!1;var l=i.getScope();this.startScope=l.$parent?l:t,this.publicContext={},this.assignAdapter(r.adapter),this.generatePublicContext()}var t,n,r;return t=e,n=[{key:"assignAdapter",value:function(e){if(e&&(e=e.replace(/^\s+|\s+$/gm,""))){var t;try{this.$parse(e).assign(this.startScope,{}),t=this.$parse(e)(this.startScope)}catch(t){throw t.message="Angular ui-scroll Adapter assignment exception.\n"+"Can't parse \"".concat(e,'" expression.\n')+t.message,t}angular.extend(t,this.publicContext),this.publicContext=t}}},{key:"generatePublicContext",value:function(){for(var e=this,t=["reload","applyUpdates","append","prepend","isBOF","isEOF","isEmpty"],n=t.length-1;n>=0;n--)this.publicContext[t[n]]=this[t[n]].bind(this);for(var r=["isLoading","topVisible","topVisibleElement","topVisibleScope","bottomVisible","bottomVisibleElement","bottomVisibleScope"],i=function(t){var n,i=e.$attr[r[t]];Object.defineProperty(e,r[t],{get:function(){return n},set:function(o){n=o,e.publicContext[r[t]]=o,i&&e.$parse(i).assign(e.startScope,o)}})},o=r.length-1;o>=0;o--)i(o);for(var a=["bufferFirst","bufferLast","bufferLength"],u=function(t){Object.defineProperty(e.publicContext,a[t],{get:function(){return e[a[t]]}})},l=a.length-1;l>=0;l--)u(l);Object.defineProperty(this.publicContext,"disabled",{get:function(){return e.disabled},set:function(t){return(e.disabled=t)?null:e.doAdjust()}})}},{key:"loading",value:function(e){this.isLoading=e}},{key:"isBOF",value:function(){return this.buffer.bof}},{key:"isEOF",value:function(){return this.buffer.eof}},{key:"isEmpty",value:function(){return!this.buffer.length}},{key:"bufferLength",get:function(){return this.buffer.getItems().length}},{key:"bufferFirst",get:function(){return this.buffer.getFirstItem()}},{key:"bufferLast",get:function(){return this.buffer.getLastItem()}},{key:"append",value:function(e){this.buffer.append(e),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"prepend",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.prepend(e,t.immutableTop),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"applyUpdates",value:function(e,t,n){"function"==typeof e?this.applyUpdatesFunc(e,t):this.applyUpdatesIndex(e,t,n),this.doAdjust()}},{key:"applyUpdatesFunc",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.slice(0).forEach((function(r){t.applyUpdate(r,e(r.item,r.scope,r.element),n)}))}},{key:"applyUpdatesIndex",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e%1!=0)throw new Error("applyUpdates - "+e+" is not a valid index (should be an integer)");var r=e-this.buffer.first;r>=0&&r<this.buffer.length?this.applyUpdate(this.buffer[r],t,n):e>=this.buffer.getAbsMinIndex()&&e<=this.buffer.getAbsMaxIndex()&&angular.isArray(t)&&!t.length&&(this.viewport.removeCacheItem(e,!n.immutableTop&&e===this.buffer.minIndex),n.immutableTop||e!==this.buffer.getAbsMinIndex()?this.buffer.decrementMaxIndex():this.buffer.incrementMinIndex())}},{key:"applyUpdate",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(angular.isArray(t)){var i=this.buffer.indexOf(e);t.reverse().some((function(t){return t===e.item}))||(e.op=s.REMOVE,r.immutableTop||t.length||(0===i&&this.buffer.bof||0!==i&&this.buffer[i-1].shiftTop)&&(e.shiftTop=!0)),t.forEach((function(t){t===e.item?i--:n.buffer.insert(i+1,t,!r.immutableTop&&-1===i)}))}}},{key:"calculateProperties",value:function(){for(var e=null,t=0,n=!1,r=!1,i=this.buffer.length,o=0;o<i;o++){var a=this.buffer[o],u=a.element.offset().top;if(e!==u){var l=a.element.outerHeight(!0),s=this.viewport.topDataPos()+t+l;!n&&s>this.viewport.topVisiblePos()&&(n=!0,this.topVisible=a.item,this.topVisibleElement=a.element,this.topVisibleScope=a.scope),!r&&(s>=this.viewport.bottomVisiblePos()||o===i-1&&this.isEOF())&&(r=!0,this.bottomVisible=a.item,this.bottomVisibleElement=a.element,this.bottomVisibleScope=a.scope),t+=l}if(e=u,n&&r)break}}}],n&&x(t.prototype,n),r&&x(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();angular.module("ui.scroll",[]).constant("JQLiteExtras",i).run(["JQLiteExtras",function(e){var t=angular.element;!(window.jQuery&&t.fn&&t.fn.jquery)&&(new e).registerFor(t),l.addCSSRules()}]).directive("uiScrollViewport",(function(){return{restrict:"A",controller:["$scope","$element",function(e,t){var n=this;return this.container=t,this.viewport=t,this.scope=e,angular.forEach(t.children(),(function(e){"tbody"===e.tagName.toLowerCase()&&(n.viewport=angular.element(e))})),this}]}})).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$interval","$q","$parse",function(e,t,n,r,i,o,a){return{require:["?^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:function(e,u,c,h,p){var d=c.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!d)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+c.uiScroll+"'");function m(e,t,n){return n||(e=null===e?t:Math.floor(e)),isNaN(e)?t:e}function g(t,n,r){return m(a(t)(e),n,r)}var b=null,y=d[1],x=d[2],w=h[0],I=Math.max(3,g(c.bufferSize,10)),P=Math.max(.3,g(c.padding,.5,!0)),S=(U=c.handleInertia,L=!0,V=a(U)(e),"boolean"==typeof V?V:L),T=g(c.startIndex,1),$=0,A=[],j=new l(t,o),O=new f(j,I,T),k=new v(j,O,u,w,n,P),N=new E(e,a,c,k,O,J,(function(){W(),k.resetTopPadding(),k.resetBottomPadding(),arguments.length&&(T=m(arguments[0],1,!1));O.reset(T),H(b,"minIndex"),H(b,"maxIndex"),J()}));var U,L,V;w&&(w.adapter=N);var M=function(){return"[object Object]"===Object.prototype.toString.call(b)&&"function"==typeof b.get};if(!(b=a(x)(e),M()||(b=t.get(x),M())))throw new Error(x+" is not a valid datasource");var C=[];function H(e,t){var n;angular.isNumber(e[t])&&(n=e[t],angular.isNumber(n)&&(C=C.filter((function(e){return e.id!==t}))).push({id:t,run:function(){return e[t]=n}}))}function D(e,t,n){var r,i=Object.getOwnPropertyDescriptor(e,t);i&&(i.set||i.get)||(H(e,t),Object.defineProperty(e,t,{set:function(i){if(r=i,!A.length||O.length){O[n]=i;var o=k.topDataPos();k.adjustPaddings(),"minIndex"===t&&k.onAfterMinIndexSet(o)}else H(e,t)},get:function(){return r}}))}D(b,"minIndex","minIndexUser"),D(b,"maxIndex","maxIndexUser");var R=2!==b.get.length?function(e){return b.get(O.next,I,e)}:function(e){b.get({index:O.next,append:O.length?O[O.length-1].item:void 0,count:I},e)},F=2!==b.get.length?function(e){return b.get(O.first-I,I,e)}:function(e){b.get({index:O.first-I,prepend:O.length?O[0].item:void 0,count:I},e)};function B(t){return t&&t!==$||e.$$destroyed}function W(){k.off("resize",Z),k.off("scroll",Z)}function _(e){return e.element.height()&&e.element[0].offsetParent}function q(e,t){z(e,t,k.insertElement),_(e)||(e.unregisterVisibilityWatcher=e.scope.$watch((function(){return function(e){_(e)&&(O.forEach((function(e){"function"==typeof e.unregisterVisibilityWatcher&&(e.unregisterVisibilityWatcher(),delete e.unregisterVisibilityWatcher)})),A.length||r((function(){return J()})))}(e)}))),j.hideElement(e)}function z(e,t,n){var r=null,i=t>0?O[t-1].element:void 0;if(p((function(t,o){r=n(t,i),e.element=t,e.scope=o,o[y]=e.item})),N.transform){var o=e.scope.uiScrollTdInitializer;o&&o.linking?N.transform(e.scope,e.element):e.scope.uiScrollTdInitializer={onLink:function(){return N.transform(e.scope,e.element)},scope:e.scope}}return r}function Q(e,t){t.animated.length?o.all(t.animated).then((function(){k.adjustPaddings(),J(e)})):k.adjustPaddings()}function X(e,t){k.shouldLoadBottom()?(!t||O.effectiveHeight(t.inserted)>0)&&1===A.push(!0)&&(N.loading(!0),K(e)):k.shouldLoadTop()&&(!t||O.effectiveHeight(t.prepended)>0||A[0])&&1===A.push(!1)&&(N.loading(!0),K(e))}function Y(){var t,r,i,o,a=(t=[],r=[],i=[],o=[],O.forEach((function(e,n){switch(e.op){case s.PREPEND:r.unshift(e);break;case s.APPEND:q(e,n),e.op=s.NONE,o.push(e);break;case s.INSERT:t=t.concat(z(e,n,k.insertElementAnimated)),e.op=s.NONE,o.push(e);break;case s.REMOVE:i.push(e)}})),i.forEach((function(e){return t=t.concat(k.removeItem(e))})),r.length&&r.forEach((function(e){q(e),e.op=s.NONE})),O.forEach((function(e,t){return e.scope.$index=O.first+t})),{prepended:r,removed:i,inserted:o,animated:t});return!e.$$phase&&!n.$$phase&&e.$digest(),a.inserted.forEach((function(e){return j.showElement(e)})),a.prepended.forEach((function(e){return j.showElement(e)})),a}function J(e){e||(A=[],e=++$);var t=Y();B(e)||(Q(e,t),X(e),A.length||N.calculateProperties())}function G(e){var t=Y();k.onAfterPrepend(t),B(e)||(Q(e,t),C.forEach((function(e){return e.run()})),C=[],X(e,t),A.shift(),A.length?K(e):(N.loading(!1),k.on("resize",Z),k.on("scroll",Z),N.calculateProperties()))}function K(e){A[0]?O.length&&!k.shouldLoadBottom()?G(e):R((function(t){B(e)||(t.length<I&&(O.eof=!0),t.length>0&&(k.clipTop(),O.append(t)),G(e))})):O.length&&!k.shouldLoadTop()?G(e):F((function(t){B(e)||(t.length<I&&(O.bof=!0),t.length>0&&(O.length&&k.clipBottom(),O.prepend(t)),G(e))}))}function Z(){S&&function(){if(k.synthetic){var e=k.synthetic.previous,t=k.synthetic.next;if(k.scrollTop()!==t)return requestAnimationFrame((function(){var n=k.scrollTop(),r=e-n;r>0?k.scrollTop(t-r):k.scrollTop(t),k.synthetic=null})),!0;k.synthetic=null}}()||n.$$phase||N.isLoading||N.disabled||(X($),A.length?W():(N.calculateProperties(),!e.$$phase&&e.$digest()))}function ee(e){if(!N.disabled){var t=k[0].scrollTop,n=k[0].scrollHeight-k[0].clientHeight;(0===t&&!O.bof||t===n&&!O.eof)&&e.preventDefault()}}p((function(e,t){k.createPaddingElements(e[0]),t.$destroy(),e.remove()})),e.$on("$destroy",(function(){W(),k.off("mousewheel",ee)})),k.on("mousewheel",ee),function(){var e=0;if(k.applyContainerStyle())J();else var t=i((function(){if(e++,k.applyContainerStyle()&&(i.cancel(t),J()),50*e>=500)throw i.cancel(t),Error("ui-scroll directive requires a viewport with non-zero height in ".concat(500,"ms"))}),50)}()}}}])})(); | ||
!function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(o=i.key,a=void 0,a=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(o,"string"),"symbol"===e(a)?a:String(a)),i)}var o,a}var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,i,o;return n=e,i=[{key:"registerFor",value:function(e){var n,r,i,o;function a(e,n,r){var i=e[0],a=t({top:["scrollTop","pageYOffset","scrollLeft"],left:["scrollLeft","pageXOffset","scrollTop"]}[n],3),u=a[0],l=a[1],s=a[2],f=void 0!==r;return o(i)?f?i.scrollTo(e[s].call(e),r):l in i?i[l]:i.document.documentElement[u]:(f&&(i[u]=r),i[u])}function u(e,r,a){var u,l=function(e,r){var a,u,l,s,f,c,h,p,d,m;if(o(e))return{base:a=document.documentElement[{height:"clientHeight",width:"clientWidth"}[r]],padding:0,border:0,margin:0};var g=t({width:[e.offsetWidth,"Left","Right"],height:[e.offsetHeight,"Top","Bottom"]}[r],3);return a=g[0],h=g[1],p=g[2],c=i(e),d=n(e,c["padding"+h])||0,m=n(e,c["padding"+p])||0,u=n(e,c["border"+h+"Width"])||0,l=n(e,c["border"+p+"Width"])||0,s=c["margin"+h],f=c["margin"+p],{base:a,padding:d+m,border:u+l,margin:(n(e,s)||0)+(n(e,f)||0)}}(e,r);return l.base>0?{base:l.base-l.padding-l.border,outer:l.base,outerfull:l.base+l.margin}[a]:(((u=i(e)[r])<0||null===u)&&(u=e.style[r]||0),{base:(u=parseFloat(u)||0)-l.padding-l.border,outer:u,outerfull:u+l.padding+l.border+l.margin}[a])}return r=angular.element.prototype.css,e.prototype.css=function(e,t){var n=this[0];if(n&&3!==n.nodeType&&8!==n.nodeType&&n.style)return r.call(this,e,t)},o=function(e){return e&&e.document&&e.location&&e.alert&&e.setInterval},window.getComputedStyle?(i=function(e){return window.getComputedStyle(e,null)},n=function(e,t){return parseFloat(t)}):(i=function(e){return e.currentStyle},n=function(e,t){var n,r,i,o,a;return new RegExp("^("+/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source+")(?!px)[a-z%]+$","i").test(t)?(n=(a=e.style).left,o=(i=e.runtimeStyle)&&i.left,i&&(i.left=a.left),a.left=t,r=a.pixelLeft,a.left=n,o&&(i.left=o),r):parseFloat(t)}),angular.forEach({before:function(e){var t,n,r,i,o,a;if(n=this[0],(t=(o=this.parent()).contents())[0]===n)return o.prepend(e);for(r=i=1,a=t.length-1;1<=a?i<=a:i>=a;r=1<=a?++i:--i)if(t[r]===n)return void angular.element(t[r-1]).after(e);throw new Error("invalid DOM structure "+n.outerHTML)},height:function(e){return void 0!==e?(angular.isNumber(e)&&(e+="px"),r.call(this,"height",e)):u(this[0],"height","base")},outerHeight:function(e){return u(this[0],"height",e?"outerfull":"outer")},outerWidth:function(e){return u(this[0],"width",e?"outerfull":"outer")},offset:function(e){var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(arguments.length){if(void 0===e)return this;throw new Error("offset setter method is not implemented")}if(o)return t=o.documentElement,null!=i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=o.defaultView||o.parentWindow,{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},scrollTop:function(e){return a(this,"top",e)},scrollLeft:function(e){return a(this,"left",e)}},(function(t,n){if(!e.prototype[n])return e.prototype[n]=t}))}}],i&&r(n.prototype,i),o&&r(n,o),Object.defineProperty(n,"prototype",{writable:!1}),e}();function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,a=void 0,a=function(e,t){if("object"!==o(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===o(a)?a:String(a)),r)}var i,a}var u="ng-ui-scroll-hide",l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$animate=t.has&&t.has("$animate")?t.get("$animate"):null,this.isAngularVersionLessThen1_3=1===angular.version.major&&angular.version.minor<3,this.$q=n}var t,n,r;return t=e,r=[{key:"addCSSRules",value:function(){var e,t="."+u,n="display: none",r=document.styleSheets[0];try{e=r.cssRules.length}catch(t){e=0}"insertRule"in r?r.insertRule(t+"{"+n+"}",e):"addRule"in r&&r.addRule(t,n,e)}}],(n=[{key:"hideElement",value:function(e){e.element.addClass(u)}},{key:"showElement",value:function(e){e.element.removeClass(u)}},{key:"insertElement",value:function(e,t){return t.after(e),[]}},{key:"removeElement",value:function(e){return e.element.remove(),e.scope.$destroy(),[]}},{key:"insertElementAnimated",value:function(e,t){if(!this.$animate)return this.insertElement(e,t);if(this.isAngularVersionLessThen1_3){var n=this.$q.defer();return this.$animate.enter(e,null,t,(function(){return n.resolve()})),[n.promise]}return[this.$animate.enter(e,null,t)]}},{key:"removeElementAnimated",value:function(e){if(!this.$animate)return this.removeElement(e);if(this.isAngularVersionLessThen1_3){var t=this.$q.defer();return this.$animate.leave(e.element,(function(){return e.scope.$destroy(),t.resolve()})),[t.promise]}return[this.$animate.leave(e.element).then((function(){return e.scope.$destroy()}))]}}])&&a(t.prototype,n),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),s={PREPEND:"prepend",APPEND:"append",INSERT:"insert",REMOVE:"remove",NONE:"none"};function f(e,t,n){var r=Object.create(Array.prototype);return angular.extend(r,{size:t,reset:function(e){r.remove(0,r.length),r.eof=!1,r.bof=!1,r.first=e,r.next=e,r.minIndex=e,r.maxIndex=e,r.minIndexUser=null,r.maxIndexUser=null},append:function(e){e.forEach((function(e){++r.next,r.insert(s.APPEND,e)})),r.maxIndex=r.eof?r.next-1:Math.max(r.next-1,r.maxIndex)},prepend:function(e,t){e.reverse().forEach((function(e){t?++r.next:--r.first,r.insert(s.PREPEND,e)})),r.minIndex=r.bof?r.minIndex=r.first:Math.min(r.first,r.minIndex)},insert:function(e,t,n){var i={item:t};if(e%1==0)i.op=s.INSERT,r.splice(e,0,i),n?r.first--:r.next++;else switch(i.op=e,e){case s.APPEND:r.push(i);break;case s.PREPEND:r.unshift(i)}},remove:function(t,n){if(angular.isNumber(t)){for(var i=t;i<n;i++)e.removeElement(r[i]);return r.splice(t,n-t)}return r.splice(r.indexOf(t),1),t.shiftTop&&r.first===this.getAbsMinIndex()?this.incrementMinIndex():this.decrementMaxIndex(),t.shiftTop?r.first++:r.next--,r.length||(r.minIndex=Math.min(r.maxIndex,r.minIndex)),e.removeElementAnimated(t)},incrementMinIndex:function(){if(null!==r.minIndexUser){if(r.minIndex>r.minIndexUser)return void r.minIndexUser++;r.minIndex===r.minIndexUser&&r.minIndexUser++}r.minIndex++},decrementMaxIndex:function(){null!==r.maxIndexUser&&r.maxIndex<=r.maxIndexUser&&r.maxIndexUser--,r.maxIndex--},getAbsMinIndex:function(){return null!==r.minIndexUser?Math.min(r.minIndexUser,r.minIndex):r.minIndex},getAbsMaxIndex:function(){return null!==r.maxIndexUser?Math.max(r.maxIndexUser,r.maxIndex):r.maxIndex},effectiveHeight:function(e){if(!e.length)return 0;var t=Number.MAX_VALUE,n=Number.NEGATIVE_INFINITY;return e.forEach((function(e){e.element[0].offsetParent&&(t=Math.min(t,e.element.offset().top),n=Math.max(n,e.element.offset().top+e.element.outerHeight(!0)))})),Math.max(0,n-t)},getItems:function(){return r.filter((function(e){return e.op===s.NONE}))},getFirstItem:function(){var e=r.getItems();return e.length?e[0].item:null},getLastItem:function(){var e=r.getItems();return e.length?e[e.length-1].item:null}}),r.reset(n),r}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,o=void 0,o=function(e,t){if("object"!==c(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===c(o)?o:String(o)),r)}var i,o}function d(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var m=function(){function e(){h(this,e)}return d(e,[{key:"add",value:function(e){for(var t=this.length-1;t>=0;t--)if(this[t].index===e.scope.$index)return void(this[t].height=e.element.outerHeight());this.push({index:e.scope.$index,height:e.element.outerHeight()}),this.sort((function(e,t){return e.index<t.index?-1:e.index>t.index?1:0}))}},{key:"remove",value:function(e,t){for(var n=e%1==0?e:e.scope.$index,r=e%1==0?t:e.shiftTop,i=this.length-1;i>=0;i--)if(this[i].index===n){this.splice(i,1);break}if(!r)for(var o=this.length-1;o>=0;o--)this[o].index>n&&this[o].index--}},{key:"clear",value:function(){this.length=0}}]),e}();function g(){var e=[];return e.push.apply(e,arguments),Object.setPrototypeOf(e,g.prototype),e}g.prototype=Object.create(Array.prototype),Object.getOwnPropertyNames(m.prototype).forEach((function(e){return g.prototype[e]=m.prototype[e]}));var b=function(){function e(t){h(this,e),this.element=function(e){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("ui-scroll directive requires an Element node for templating the view");var t;switch(e.tagName.toLowerCase()){case"dl":throw new Error("ui-scroll directive does not support <".concat(e.tagName,"> as a repeating tag: ").concat(e.outerHTML));case"tr":t=angular.element("<table><tr><td><div></div></td></tr></table>").find("tr");break;case"li":t=angular.element("<li></li>");break;default:t=angular.element("<div></div>")}return t}(t),this.cache=new g}return d(e,[{key:"height",value:function(){return this.element.height.apply(this.element,arguments)}}]),e}(),v=b;function y(e,t,n,r,i,o){var a=null,u=null,l=r&&r.viewport?r.viewport:angular.element(window),s=r&&r.container?r.container:void 0,f=r&&r.scope?r.scope:i;function c(){return l.outerHeight()*o}return l.css({"overflow-anchor":"none","overflow-y":"auto",display:"block"}),angular.extend(l,{getScope:function(){return f},createPaddingElements:function(e){a=new v(e),u=new v(e),n.before(a.element),n.after(u.element),a.height(0),u.height(0)},applyContainerStyle:function(){return!s||(s!==l&&l.css("height",window.getComputedStyle(s[0]).height),l.height()>0)},bottomDataPos:function(){var e=l[0].scrollHeight;return(e=null!=e?e:l[0].document.documentElement.scrollHeight)-u.height()},topDataPos:function(){return a.height()},bottomVisiblePos:function(){return l.scrollTop()+l.outerHeight()},topVisiblePos:function(){return l.scrollTop()},insertElement:function(t,n){return e.insertElement(t,n||a.element)},insertElementAnimated:function(t,n){return e.insertElementAnimated(t,n||a.element)},shouldLoadBottom:function(){return!t.eof&&l.bottomDataPos()<l.bottomVisiblePos()+c()},clipBottom:function(){for(var e=0,n=0,r=0,i=l.bottomDataPos()-l.bottomVisiblePos()-c(),o=t.length-1;o>=0&&!(n+(r=t[o].element.outerHeight(!0))>i);o--)u.cache.add(t[o]),n+=r,e++;e>0&&(t.eof=!1,t.remove(t.length-e,t.length),t.next-=e,l.adjustPaddings())},shouldLoadTop:function(){return!t.bof&&l.topDataPos()>l.topVisiblePos()-c()},clipTop:function(){for(var e=0,n=0,r=0,i=l.topVisiblePos()-l.topDataPos()-c(),o=0;o<t.length&&!(n+(r=t[o].element.outerHeight(!0))>i);o++)a.cache.add(t[o]),n+=r,e++;e>0&&(a.height(a.height()+n),t.bof=!1,t.remove(0,e),t.first+=e)},adjustPaddings:function(){if(t.length){var e=t.reduce((function(e,t){return e+t.element.outerHeight(!0)}),0),n=0,r=0;a.cache.forEach((function(e){e.index<t.first&&(n+=e.height,r++)}));var i=0,o=0;u.cache.forEach((function(e){e.index>=t.next&&(i+=e.height,o++)}));var l=(e+n+i)/(r+o+t.length),s=null!==t.minIndexUser&&t.minIndex>t.minIndexUser,f=null!==t.maxIndexUser&&t.maxIndex<t.maxIndexUser,c=s?(t.minIndex-t.minIndexUser)*l:0,h=f?(t.maxIndexUser-t.maxIndex)*l:0;a.height(n+c),u.height(i+h)}},onAfterMinIndexSet:function(e){if(null!==t.minIndexUser&&t.minIndex>t.minIndexUser){var n=a.height()-e;for(l.scrollTop(l.scrollTop()+n);(n-=l.scrollTop())>0;)u.height(u.height()+n),l.scrollTop(l.scrollTop()+n)}},onAfterPrepend:function(e){if(e.prepended.length){var n=t.effectiveHeight(e.prepended),r=a.height()-n;if(r>=0)a.height(r);else{var i=l.scrollTop(),o=i-r;l.synthetic={previous:i,next:o},a.height(0),l.scrollTop(o)}}},resetTopPadding:function(){a.height(0),a.cache.clear()},resetBottomPadding:function(){u.height(0),u.cache.clear()},removeCacheItem:function(e,t){a.cache.remove(e,t),u.cache.remove(e,t)},removeItem:function(e){return this.removeCacheItem(e),t.remove(e)}}),l}function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,o=void 0,o=function(e,t){if("object"!==x(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===x(o)?o:String(o)),r)}var i,o}var w=function(){function e(t,n,r,i,o,a,u){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$parse=n,this.$attr=r,this.viewport=i,this.buffer=o,this.doAdjust=a,this.reload=u,this.isLoading=!1,this.disabled=!1;var l=i.getScope();this.startScope=l.$parent?l:t,this.publicContext={},this.assignAdapter(r.adapter),this.generatePublicContext()}var t,n,r;return t=e,n=[{key:"assignAdapter",value:function(e){if(e&&(e=e.replace(/^\s+|\s+$/gm,""))){var t;try{this.$parse(e).assign(this.startScope,{}),t=this.$parse(e)(this.startScope)}catch(t){throw t.message="Angular ui-scroll Adapter assignment exception.\n"+"Can't parse \"".concat(e,'" expression.\n')+t.message,t}angular.extend(t,this.publicContext),this.publicContext=t}}},{key:"generatePublicContext",value:function(){for(var e=this,t=["reload","applyUpdates","append","prepend","isBOF","isEOF","isEmpty"],n=t.length-1;n>=0;n--)this.publicContext[t[n]]=this[t[n]].bind(this);for(var r=["isLoading","topVisible","topVisibleElement","topVisibleScope","bottomVisible","bottomVisibleElement","bottomVisibleScope"],i=function(t){var n,i=e.$attr[r[t]];Object.defineProperty(e,r[t],{get:function(){return n},set:function(o){n=o,e.publicContext[r[t]]=o,i&&e.$parse(i).assign(e.startScope,o)}})},o=r.length-1;o>=0;o--)i(o);for(var a=["bufferFirst","bufferLast","bufferLength"],u=function(t){Object.defineProperty(e.publicContext,a[t],{get:function(){return e[a[t]]}})},l=a.length-1;l>=0;l--)u(l);Object.defineProperty(this.publicContext,"disabled",{get:function(){return e.disabled},set:function(t){return(e.disabled=t)?null:e.doAdjust()}})}},{key:"loading",value:function(e){this.isLoading=e}},{key:"isBOF",value:function(){return this.buffer.bof}},{key:"isEOF",value:function(){return this.buffer.eof}},{key:"isEmpty",value:function(){return!this.buffer.length}},{key:"bufferLength",get:function(){return this.buffer.getItems().length}},{key:"bufferFirst",get:function(){return this.buffer.getFirstItem()}},{key:"bufferLast",get:function(){return this.buffer.getLastItem()}},{key:"append",value:function(e){this.buffer.append(e),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"prepend",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.prepend(e,t.immutableTop),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"applyUpdates",value:function(e,t,n){"function"==typeof e?this.applyUpdatesFunc(e,t):this.applyUpdatesIndex(e,t,n),this.doAdjust()}},{key:"applyUpdatesFunc",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.slice(0).forEach((function(r){t.applyUpdate(r,e(r.item,r.scope,r.element),n)}))}},{key:"applyUpdatesIndex",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e%1!=0)throw new Error("applyUpdates - "+e+" is not a valid index (should be an integer)");var r=e-this.buffer.first;r>=0&&r<this.buffer.length?this.applyUpdate(this.buffer[r],t,n):e>=this.buffer.getAbsMinIndex()&&e<=this.buffer.getAbsMaxIndex()&&angular.isArray(t)&&!t.length&&(this.viewport.removeCacheItem(e,!n.immutableTop&&e===this.buffer.minIndex),n.immutableTop||e!==this.buffer.getAbsMinIndex()?this.buffer.decrementMaxIndex():this.buffer.incrementMinIndex())}},{key:"applyUpdate",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(angular.isArray(t)){var i=this.buffer.indexOf(e);t.reverse().some((function(t){return t===e.item}))||(e.op=s.REMOVE,r.immutableTop||t.length||(0===i&&this.buffer.bof||0!==i&&this.buffer[i-1].shiftTop)&&(e.shiftTop=!0)),t.forEach((function(t){t===e.item?i--:n.buffer.insert(i+1,t,!r.immutableTop&&-1===i)}))}}},{key:"calculateProperties",value:function(){for(var e=null,t=0,n=!1,r=!1,i=this.buffer.length,o=0;o<i;o++){var a=this.buffer[o],u=a.element.offset().top;if(e!==u){var l=a.element.outerHeight(!0),s=this.viewport.topDataPos()+t+l;!n&&s>this.viewport.topVisiblePos()&&(n=!0,this.topVisible=a.item,this.topVisibleElement=a.element,this.topVisibleScope=a.scope),!r&&(s>=this.viewport.bottomVisiblePos()||o===i-1&&this.isEOF())&&(r=!0,this.bottomVisible=a.item,this.bottomVisibleElement=a.element,this.bottomVisibleScope=a.scope),t+=l}if(e=u,n&&r)break}}}],n&&E(t.prototype,n),r&&E(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),I=w;angular.module("ui.scroll",[]).constant("JQLiteExtras",i).run(["JQLiteExtras",function(e){var t=angular.element;!(window.jQuery&&t.fn&&t.fn.jquery)&&(new e).registerFor(t),l.addCSSRules()}]).directive("uiScrollViewport",(function(){return{restrict:"A",controller:["$scope","$element",function(e,t){var n=this;return this.container=t,this.viewport=t,this.scope=e,angular.forEach(t.children(),(function(e){"tbody"===e.tagName.toLowerCase()&&(n.viewport=angular.element(e))})),this}]}})).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$interval","$q","$parse",function(e,t,n,r,i,o,a){return{require:["?^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:function(e,u,c,h,p){var d=c.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!d)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+c.uiScroll+"'");function m(e,t,n){return n||(e=null===e?t:Math.floor(e)),isNaN(e)?t:e}function g(t,n,r){return m(a(t)(e),n,r)}var b=null,v=d[1],x=d[2],E=h[0],w=Math.max(3,g(c.bufferSize,10)),P=Math.max(.3,g(c.padding,.5,!0)),S=(U=c.handleInertia,L=!0,V=a(U)(e),"boolean"==typeof V?V:L),T=g(c.startIndex,1),$=0,A=[],j=new l(t,o),O=new f(j,w,T),k=new y(j,O,u,E,n,P),N=new I(e,a,c,k,O,J,(function(){W(),k.resetTopPadding(),k.resetBottomPadding(),arguments.length&&(T=m(arguments[0],1,!1));O.reset(T),H(b,"minIndex"),H(b,"maxIndex"),J()}));var U,L,V;E&&(E.adapter=N);var M=function(){return"[object Object]"===Object.prototype.toString.call(b)&&"function"==typeof b.get};if(!(b=a(x)(e),M()||(b=t.get(x),M())))throw new Error(x+" is not a valid datasource");var C=[];function H(e,t){var n;angular.isNumber(e[t])&&(n=e[t],angular.isNumber(n)&&(C=C.filter((function(e){return e.id!==t}))).push({id:t,run:function(){return e[t]=n}}))}function D(e,t,n){var r,i=Object.getOwnPropertyDescriptor(e,t);i&&(i.set||i.get)||(H(e,t),Object.defineProperty(e,t,{set:function(i){if(r=i,!A.length||O.length){O[n]=i;var o=k.topDataPos();k.adjustPaddings(),"minIndex"===t&&k.onAfterMinIndexSet(o)}else H(e,t)},get:function(){return r}}))}D(b,"minIndex","minIndexUser"),D(b,"maxIndex","maxIndexUser");var R=2!==b.get.length?function(e){return b.get(O.next,w,e)}:function(e){b.get({index:O.next,append:O.length?O[O.length-1].item:void 0,count:w},e)},F=2!==b.get.length?function(e){return b.get(O.first-w,w,e)}:function(e){b.get({index:O.first-w,prepend:O.length?O[0].item:void 0,count:w},e)};function B(t){return t&&t!==$||e.$$destroyed}function W(){k.off("resize",Z),k.off("scroll",Z)}function _(e){return e.element.height()&&e.element[0].offsetParent}function q(e,t){z(e,t,k.insertElement),_(e)||(e.unregisterVisibilityWatcher=e.scope.$watch((function(){return function(e){_(e)&&(O.forEach((function(e){"function"==typeof e.unregisterVisibilityWatcher&&(e.unregisterVisibilityWatcher(),delete e.unregisterVisibilityWatcher)})),A.length||r((function(){return J()})))}(e)}))),j.hideElement(e)}function z(e,t,n){var r=null,i=t>0?O[t-1].element:void 0;if(p((function(t,o){r=n(t,i),e.element=t,e.scope=o,o[v]=e.item})),N.transform){var o=e.scope.uiScrollTdInitializer;o&&o.linking?N.transform(e.scope,e.element):e.scope.uiScrollTdInitializer={onLink:function(){return N.transform(e.scope,e.element)},scope:e.scope}}return r}function Q(e,t){t.animated.length?o.all(t.animated).then((function(){k.adjustPaddings(),J(e)})):k.adjustPaddings()}function X(e,t){k.shouldLoadBottom()?(!t||O.effectiveHeight(t.inserted)>0)&&1===A.push(!0)&&(N.loading(!0),K(e)):k.shouldLoadTop()&&(!t||O.effectiveHeight(t.prepended)>0||A[0])&&1===A.push(!1)&&(N.loading(!0),K(e))}function Y(){var t,r,i,o,a=(t=[],r=[],i=[],o=[],O.forEach((function(e,n){switch(e.op){case s.PREPEND:r.unshift(e);break;case s.APPEND:q(e,n),e.op=s.NONE,o.push(e);break;case s.INSERT:t=t.concat(z(e,n,k.insertElementAnimated)),e.op=s.NONE,o.push(e);break;case s.REMOVE:i.push(e)}})),i.forEach((function(e){return t=t.concat(k.removeItem(e))})),r.length&&r.forEach((function(e){q(e),e.op=s.NONE})),O.forEach((function(e,t){return e.scope.$index=O.first+t})),{prepended:r,removed:i,inserted:o,animated:t});return!e.$$phase&&!n.$$phase&&e.$digest(),a.inserted.forEach((function(e){return j.showElement(e)})),a.prepended.forEach((function(e){return j.showElement(e)})),a}function J(e){e||(A=[],e=++$);var t=Y();B(e)||(Q(e,t),X(e),A.length||N.calculateProperties())}function G(e){var t=Y();k.onAfterPrepend(t),B(e)||(Q(e,t),C.forEach((function(e){return e.run()})),C=[],X(e,t),A.shift(),A.length?K(e):(N.loading(!1),k.on("resize",Z),k.on("scroll",Z),N.calculateProperties()))}function K(e){A[0]?O.length&&!k.shouldLoadBottom()?G(e):R((function(t){B(e)||(t.length<w&&(O.eof=!0),t.length>0&&(k.clipTop(),O.append(t)),G(e))})):O.length&&!k.shouldLoadTop()?G(e):F((function(t){B(e)||(t.length<w&&(O.bof=!0),t.length>0&&(O.length&&k.clipBottom(),O.prepend(t)),G(e))}))}function Z(){S&&function(){if(k.synthetic){var e=k.synthetic.previous,t=k.synthetic.next;if(k.scrollTop()!==t)return requestAnimationFrame((function(){var n=k.scrollTop(),r=e-n;r>0?k.scrollTop(t-r):k.scrollTop(t),k.synthetic=null})),!0;k.synthetic=null}}()||n.$$phase||N.isLoading||N.disabled||(X($),A.length?W():(N.calculateProperties(),!e.$$phase&&e.$digest()))}function ee(e){if(!N.disabled){var t=k[0].scrollTop,n=k[0].scrollHeight-k[0].clientHeight;(0===t&&!O.bof||t===n&&!O.eof)&&e.preventDefault()}}p((function(e,t){k.createPaddingElements(e[0]),t.$destroy(),e.remove()})),e.$on("$destroy",(function(){W(),k.off("mousewheel",ee)})),k.on("mousewheel",ee),function(){var e=0;if(k.applyContainerStyle())J();else var t=i((function(){if(e++,k.applyContainerStyle()&&(i.cancel(t),J()),50*e>=500)throw i.cancel(t),Error("ui-scroll directive requires a viewport with non-zero height in ".concat(500,"ms"))}),50)}()}}}])}(); | ||
//# sourceMappingURL=ui-scroll.min.js.map |
{ | ||
"name": "angular-ui-scroll", | ||
"description": "AngularJS virtual scrolling module", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"src": "./src/", | ||
@@ -6,0 +6,0 @@ "public": "./dist/", |
@@ -481,2 +481,5 @@ ### UI Scroll - [AngularJS](http://angularjs.org/) directive to provide infinite scroll over a limited element buffer | ||
### v1.9.1 | ||
* Fixed ES5 build. | ||
### v1.9.0 | ||
@@ -483,0 +486,0 @@ * Webpack 5 build. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
599
1330591
1230