[CLAMP-1] Initial ONAP CLAMP seed code commit
[clamp.git] / src / main / resources / META-INF / resources / designer / lib / angular-vs-repeat.min.js
1 !function(a,b){"use strict";var c=-1!=navigator.appVersion.indexOf("Mac"),d="undefined"!=typeof a.onwheel?"wheel":"undefined"!=typeof a.onmousewheel?"mousewheel":"DOMMouseScroll",e=document.documentElement,f=e.matches?"matches":e.matchesSelector?"matchesSelector":e.webkitMatches?"webkitMatches":e.webkitMatchesSelector?"webkitMatchesSelector":e.msMatches?"msMatches":e.msMatchesSelector?"msMatchesSelector":e.mozMatches?"mozMatches":e.mozMatchesSelector?"mozMatchesSelector":null,g=b.element.prototype.closest||function(a){for(var c=this[0].parentNode;c!==document.documentElement&&null!=c&&!c[f](a);)c=c.parentNode;return c&&c[f](a)?b.element(c):b.element()};b.module("vs-repeat",[]).directive("vsRepeat",["$compile",function(e){return{restrict:"A",scope:!0,require:"?^vsRepeat",controller:["$scope",function(a){this.$scrollParent=a.$scrollParent,this.$fillElement=a.$fillElement}],compile:function(f){var h=f.children().eq(0),i=h.attr("ng-repeat"),j=h[0].outerHTML,k=/^\s*(\S+)\s+in\s+([\S\s]+?)(track\s+by\s+\S+)?$/.exec(i),l=k[1],m=k[2],n=k[3],o="$vs_collection",p={vsRepeat:"elementSize",vsOffsetBefore:"offsetBefore",vsOffsetAfter:"offsetAfter",vsExcess:"excess"};return f.empty(),a.getComputedStyle&&"absolute"===a.getComputedStyle(f[0]).position||f.css("position","relative"),{pre:function(f,h,i,k){function q(){if(!C||C.length<1)return f[o]=[],y=0,v(0),void(f.sizesCumulative=[0]);if(y=C.length,F){f.sizes=C.map(function(a){return a[i.vsSizeProperty]});var a=0;f.sizesCumulative=f.sizes.map(function(b){var c=a;return a+=b,c}),f.sizesCumulative.push(a)}r(),u()}function r(){E&&f.$$postDigest(function(){if(h[0].offsetHeight||h[0].offsetWidth)for(var a=h.children(),b=0;b<a.length;){if(null!=a[b].attributes["ng-repeat"]){a[b][K]&&(f.elementSize=a[b][K],u(),E=!1,f.$root&&!f.$root.$$phase&&f.$apply());break}b++}else var c=f.$watch(function(){(h[0].offsetHeight||h[0].offsetWidth)&&(c(),r())})})}function s(a){var b=a.currentTarget;(b.scrollWidth>b.clientWidth||b.scrollHeight>b.clientHeight)&&z.css("display","block")}function t(){"undefined"!=typeof i.vsAutoresize&&(E=!0,r(),f.$root&&!f.$root.$$phase&&f.$apply()),x()&&f.$apply()}function u(){O=void 0,P=void 0,x(),v(F?f.sizesCumulative[y]:f.elementSize*y),f.$emit("vsRepeatReinitialized")}function v(a){if(D){if(A.css({width:f.offsetBefore+a+f.offsetAfter+"px",height:"100%"}),k&&k.$fillElement){var b=k.$fillElement[0].parentNode.querySelector("[ng-repeat]");b&&k.$fillElement.css({width:b.scrollWidth+"px"})}}else A.css({height:f.offsetBefore+a+f.offsetAfter+"px",width:"100%"}),k&&k.$fillElement&&(b=k.$fillElement[0].parentNode.querySelector("[ng-repeat]"),b&&k.$fillElement.css({height:b.scrollHeight+"px"}))}function w(){var a=G[0][J];a!==Q&&(u(),f.$root&&!f.$root.$$phase&&f.$apply()),Q=a}function x(){if(F){for(f.startIndex=0;f.sizesCumulative[f.startIndex]<G[0][L]-f.offsetBefore;)f.startIndex++;for(f.startIndex>0&&f.startIndex--,f.endIndex=f.startIndex;f.sizesCumulative[f.endIndex]<G[0][L]-f.offsetBefore+G[0][J];)f.endIndex++}else f.startIndex=Math.max(Math.floor((G[0][L]-f.offsetBefore)/f.elementSize+f.excess/2)-f.excess,0),f.endIndex=Math.min(f.startIndex+Math.ceil(G[0][J]/f.elementSize)+f.excess,y);var a=f.startIndex!==O||f.endIndex!==P;return a&&(f[o]=C.slice(f.startIndex,f.endIndex)),O=f.startIndex,P=f.endIndex,a}var y,z,A,B=b.element(j),C=[],D="undefined"!=typeof i.vsHorizontal,E=!i.vsRepeat,F=!!i.vsSizeProperty,G=i.vsScrollParent?g.call(h,i.vsScrollParent):h,H=D?"translateX":"translateY",I=D?"left":"top",J=D?"clientWidth":"clientHeight",K=D?"offsetWidth":"offsetHeight",L=D?"scrollLeft":"scrollTop";if(0===G.length)throw"Specified scroll parent selector did not match any element";f.$scrollParent=G,F&&(f.sizesCumulative=[]),f.elementSize=G[0][J]||50,f.offsetBefore=0,f.offsetAfter=0,f.excess=2,Object.keys(p).forEach(function(a){i[a]&&i.$observe(a,function(b){f[p[a]]=+b,u()})}),f.$watchCollection(m,function(a){C=a||[],q()}),B.attr("ng-repeat",l+" in "+o+(n?" "+n:"")).addClass("vs-repeat-repeated-element");var M=F?"(sizesCumulative[$index + startIndex] + offsetBefore)":"(($index + startIndex) * elementSize + offsetBefore)";"undefined"!=typeof document.documentElement.style.transform?B.attr("ng-style",'{ "transform": "'+H+'(" + '+M+' + "px)"}'):"undefined"!=typeof document.documentElement.style.webkitTransform?B.attr("ng-style",'{ "-webkit-transform": "'+H+'(" + '+M+' + "px)"}'):B.attr("ng-style","{"+I+": "+M+' + "px"}'),e(B)(f),h.append(B),A=b.element('<div class="vs-repeat-fill-element"></div>').css({position:"relative","min-height":"100%","min-width":"100%"}),h.append(A),e(A)(f),f.$fillElement=A;var N={};c&&(z=b.element('<div class="vs-repeat-wheel-helper"></div>').on(d,function(a){a.preventDefault(),a.stopPropagation(),a.originalEvent&&(a=a.originalEvent),G[0].scrollLeft+=a.deltaX||-a.wheelDeltaX,G[0].scrollTop+=a.deltaY||-a.wheelDeltaY}).on("mousemove",function(a){(N.x!==a.clientX||N.y!==a.clientY)&&b.element(this).css("display","none"),N={x:a.clientX,y:a.clientY}}).css("display","none"),A.append(z)),f.startIndex=0,f.endIndex=0,G.on("scroll",function(){x()&&f.$apply()}),c&&G.on(d,s),b.element(a).on("resize",t),f.$on("$destroy",function(){b.element(a).off("resize",t)}),f.$on("vsRepeatTrigger",q),f.$on("vsRepeatResize",function(){E=!0,r()});var O,P,Q;f.$watch(function(){"function"==typeof a.requestAnimationFrame?a.requestAnimationFrame(w):w()})}}}}}]),b.element(document.head).append(["<style>.vs-repeat-wheel-helper{position: absolute;top: 0;bottom: 0;left: 0;right: 0;z-index: 99999;background: rgba(0, 0, 0, 0);}.vs-repeat-repeated-element{position: absolute;z-index: 1;}</style>"].join(""))}(window,window.angular);