[CLAMP-1] Initial ONAP CLAMP seed code commit
[clamp.git] / src / main / resources / META-INF / resources / designer / lib / ui-grid.min.js
1 /*! ui-grid - v2.0.7-g7aeb576 - 2013-12-18
2 * Copyright (c) 2013 ; Licensed MIT */
3 !function(){"use strict";var a=angular.module("ui.grid.body",[]);a.directive("uiGridBody",["$log","GridUtil",function(a){return{replace:!0,priority:1e3,templateUrl:"ui-grid/ui-grid-body",require:"?^uiGrid",scope:{tableClass:"=uiGridTableClass"},link:function(b,c,d,e){a.debug("body postlink scope",b.$id),void 0===e&&a.warn("[ui-grid-body] uiGridCtrl is undefined!"),e&&"undefined"!=typeof e.columns&&e.columns&&(b.columns=e.columns),e&&"undefined"!=typeof e.gridData&&e.gridData&&(b.gridData=e.gridData)}}}])}(),function(){"use strict";var a=angular.module("ui.grid.header",["ui.grid.util"]);a.directive("uiGridHeader",["$log","$templateCache","$compile","GridUtil",function(a,b,c){return{restrict:"EA",priority:1e3,require:"?^uiGrid",scope:{tableClass:"=uiGridTableClass"},compile:function(d){a.debug("header compile");var e;(""===d.html()||/^\s*$/.test(d.html()))&&(e=b.get("ui-grid/ui-grid-header"));var f=function(b,d){a.debug("header prelink scope",b.$id),e&&d.append(e),c(d.contents())(b)},g=function(b,c,d,e){a.debug("header postlink scope",b.$id),void 0===e&&a.warn("[ui-grid-header] uiGridCtrl is undefined!"),e&&"undefined"!=typeof e.columns&&e.columns&&(b.columns=e.columns)};return{pre:f,post:g}}}}])}(),function(){var a=angular.module("ui.grid.style",[]);a.directive("uiGridStyle",["$interpolate","$sce",function(a){return{priority:1e3,link:function(b,c){var d=a(c.text(),!0);d&&b.$watch(d,function(a){c.text(a)})}}}])}(),function(){"use strict";var a=angular.module("ui.grid",["ui.grid.header","ui.grid.body","ui.grid.style","ui.virtual-repeat"]);a.directive("uiGrid",["$compile","$templateCache","$log","GridUtil",function(a,b,c,d){function e(a,b){a.uiGrid;a.gridId=d.newId(),console.log("gridId",a.gridId),b.on("$destroy",function(){})}return{templateUrl:"ui-grid/ui-grid",scope:{uiGrid:"="},compile:function(){return{pre:e}},controller:function(){}}}])}(),function(){"use strict";function a(b,c,d){return angular.isArray(b)?angular.forEach(b,function(b){return a(b,c,d)}):Math.max(c,Math.min(b,d))}var b=angular.module("ui.virtual-repeat",[]),c=["TABLE","TBODY","THEAD","TR","TFOOT"],d=["TABLE","TBODY","THEAD","TR","TFOOT"],e=["TABLE","TBODY","THEAD","TR","TFOOT"];b.directive("uiVirtualRepeat",["$log","$rootElement",function(b,f){function g(a){var b=a.match(/^\s*([\$\w]+)\s+in\s+([\S\s]*)$/);if(!b)throw new Error("Expected uiVirtualRepeat in form of '_item_ in _collection_' but got '"+a+"'.");return{value:b[1],collection:b[2]}}function h(a,b){var c,d=a.tagName.toUpperCase();for(c=0;c<b.length;c++)if(b[c]===d)return!0;return!1}function i(a){var b,e,g=f[0];for(b=a.parent().parent()[0];b!==g&&1==b.nodeType;b=b.parentNode)if(!h(b,c)&&1==b.childElementCount&&!h(b.firstElementChild,d)){for(e=b.firstChild;e&&(3!=e.nodeType||!/\S/g.test(e.textContent));e=e.nextSibling);if(null==e)return{viewport:angular.element(b),content:angular.element(b.firstElementChild)}}throw new Error("No suitable viewport element")}function j(a){var b={overflow:"auto"},c=window.getComputedStyle?window.getComputedStyle(a[0]):a[0].currentStyle,d=c&&c.getPropertyValue("max-height"),e=c&&c.getPropertyValue("height");d&&"0px"!==d?b.maxHeight=d:b.height=e&&"0px"!==e?e:window.innerHeight,a.css(b)}function k(a){var b={margin:0,padding:0,border:0,"box-sizing":"border-box"};a.css(b)}function l(a){var b=window.getComputedStyle?window.getComputedStyle(a):a.currentStyle,c=b&&b.getPropertyValue("max-height"),d=b&&b.getPropertyValue("height");if(d&&"0px"!==d&&"auto"!==d);else if(c&&"0px"!==c&&"none"!==c)d=c;else{if(!a.clientHeight)return;d=a.clientHeight+"px"}return angular.element(a).css("height",d),parseInt(d,10)}function m(b,c,d){function f(b,c,f){function g(a){var b={margin:"0"};h(a[0],e)||(b.display="block"),v&&(b.height=v+"px"),a.css(b)}function n(a,b,c){var d=c.$new();return d[m.value]=b[a],d.$index=a,d.$first=0===a,d.$last=a===b.length-1,d.$middle=!(d.$first||d.$last),d.$watch(function(){d[m.value]=b[a]}),d}function o(a,b,c,e,f){var h,i,j,k=document.createDocumentFragment(),l=[];for(i=a;i!==b;i++)j=n(i,c,e),h=d(j,angular.noop),g(h),l.push(h),k.appendChild(h[0]);return f.after(k),l}function p(){var b=a(y.firstActive,y.firstVisible-y.lowWater,y.firstVisible-y.highWater),c=a(y.firstActive+y.active,y.firstVisible+y.visible+y.lowWater,y.firstVisible+y.visible+y.highWater);y.firstActive=Math.max(0,b),y.active=Math.min(c,y.total)-y.firstActive}function q(a){v&&b.$apply(function(){y.firstVisible=Math.floor(a.target.scrollTop/v),y.visible=Math.ceil(x.viewport[0].clientHeight/v),w=a.target.scrollTop+a.target.clientHeight>=a.target.scrollHeight,p()})}function r(a){var b=a.$eval(m.collection);return b.length!==y.total&&(y.total=b.length,p()),{start:y.firstActive,active:y.active,len:b.length}}function s(a,b){var c,d,e=Array.prototype[a];for(d=0;b>d;d++)c=e.call(u),c.scope().$destroy(),c.remove()}function t(a,b,d){var e,f=b.start+b.active,g=d.$eval(m.collection);if(a===b)e=o(a.start,f,g,d,c),u=e,u.length&&(v=l(e[0][0]));else{var h=a.start+a.active,i=a.start>=b.start,j=i?a.start-b.start:b.start-a.start,k=h>=f?h-f:f-h,n=j<(i?b.active:a.active);if(n){if(i?s("shift",j):j&&(e=o(a.start,b.start,g,d,c),u=e.concat(u)),f>h)s("pop",f-h);else if(k){var p=u[u.length-1];e=o(f,h,g,d,p),u=u.concat(e)}}else s("pop",u.length),u=o(a.start,h,g,d,c);!v&&u.length&&(v=l(u[0][0])),x.content.css({"padding-top":a.start*v+"px"})}x.content.css({height:a.len*v+"px"}),w&&(x.viewport[0].scrollTop=x.viewport[0].clientHeight+x.viewport[0].scrollHeight),d.rendered=u}var u=[];b.rendered=u;var v=0,w=!1,x=i(c),y="ngModel"in f?b.$eval(f.ngModel):{};y.firstActive=0,y.firstVisible=0,y.visible=0,y.active=0,y.total=0,y.lowWater=y.lowWater||10,y.highWater=y.highWater||20,k(x.content),j(x.viewport),x.viewport.bind("scroll",q),b.$watch(r,t,!0)}var m=g(c.uiVirtualRepeat);return{post:f}}var n={require:"?ngModel",transclude:"element",priority:1e3,compile:m,controller:["$scope",function(){this.visibleRows=0,this.visibleRows=this.visibleRows+1}]};return n}])}(),function(){var a=angular.module("ui.grid.util",[]);a.service("GridUtil",function(){var a={readableColumnName:function(a){return"undefined"==typeof a||void 0===a||null===a?a:("string"!=typeof a&&(a=String(a)),a.replace(/_+/g," ").replace(/^[A-Z]+$/,function(a){return angular.lowercase(angular.uppercase(a.charAt(0))+a.slice(1))}).replace(/(\w+)/g,function(a){return angular.uppercase(a.charAt(0))+a.slice(1)}).replace(/(\w+?(?=[A-Z]))/g,"$1 "))},getColumnsFromData:function(b){var c=[],d=b[0];return angular.forEach(d,function(b,d){c.push({field:d,name:a.readableColumnName(d)})}),c},newId:function(){var a=(new Date).getTime();return function(){return a+=1}}()};return a})}();