Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
angular-ui-layout.min.js 3.22 KiB
"use strict";angular.module("ui.layout",[]).controller("uiLayoutCtrl",["$scope","$attrs","$element",function(b,c,d){return{opts:angular.extend({},b.$eval(c.uiLayout),b.$eval(c.options)),element:d}}]).directive("uiLayout",["$parse",function(a){var b='<div class="stretch ui-splitbar"></div>';return{restrict:"AE",compile:function(d,e){var f,g=d.children(),h=g.length,i=angular.extend({},a(e.uiLayout)(),a(e.options)()),j="column"===i.flow;d.addClass("stretch").addClass("ui-layout-"+(i.flow||"row"));var k=[],l=j?d[0].clientWidth:d[0].clientHeight;for(f=0;f<h;++f){angular.element(g[f]).addClass("stretch");var m=j?g[f].attributes.getNamedItem("ui-layout-init-width")||g[f].attributes.getNamedItem("ui-layout-init-min-width"):g[f].attributes.getNamedItem("ui-layout-init-height")||g[f].attributes.getNamedItem("ui-layout-init-min-height");if(m){if(m.nodeValue.includes("%")){var n=parseFloat(m.nodeValue);k.push(n)}else{var n=100*parseFloat(m.nodeValue)/l;k.push(n)}var o=j?null===g[f].attributes.getNamedItem("ui-layout-init-width"):null===g[f].attributes.getNamedItem("ui-layout-init-height");o&&(k[k.length-1]=Math.max(k[k.length-1],100/h))}else k.push(void 0)}if(h>1){var p=k.filter(function(a){return void 0!=a}).reduce(function(a,b){return a+b}),q=100-p,r=k.filter(function(a){return void 0==a}).length,s=q/r,t=j?"left":"top",u=j?"right":"bottom",v=0;for(f=0;f<h;++f){var w=k[f];void 0==w&&(w=s);var x=angular.element(g[f]).css(t,v+"%").css(u,100-(v+w)+"%");if(f<h-1){var y=angular.element(b).css(t,v+w+"%");x.after(y)}v+=w}}},controller:"uiLayoutCtrl"}}]).directive("uiSplitbar",function(){var a=angular.element(document.body.parentElement);return{require:"^uiLayout",restrict:"EAC",link:function(b,c,d,e){function o(){var a=e.element[0].getBoundingClientRect(),b=n.getBoundingClientRect();h.time=+new Date,h.barSize=b[m],h.layoutSize=a[m],h.layoutOrigine=a[k]}function p(){var a=(g-h.layoutOrigine)/h.layoutSize*100;a=Math.min(a,100-h.barSize/h.layoutSize*100),a=Math.max(a,parseInt(n.previousElementSibling.style[k],10)),n.nextElementSibling.nextElementSibling&&(a=Math.min(a,parseInt(n.nextElementSibling.nextElementSibling.style[k],10))),n.style[k]=n.nextElementSibling.style[k]=a+"%",n.previousElementSibling.style[l]=100-a+"%",f=null}function q(a){g=a[j]||a.originalEvent[j],f&&window.cancelAnimationFrame(f),(!h.time||+new Date>h.time+1e3)&&o(),f=window.requestAnimationFrame(p)}var f,g,h={},i="column"===e.opts.flow,j=i?"clientX":"clientY",k=i?"left":"top",l=i?"right":"bottom",m=i?"width":"height",n=c[0];c.on("mousedown touchstart",function(b){return b.preventDefault(),b.stopPropagation(),a.on("mousemove touchmove",q),!1}),a.on("mouseup touchend",function(){a.off("mousemove touchmove")})}}});for(var lastTime=0,vendors=["ms","moz","webkit","o"],x=0;x<vendors.length&&!window.requestAnimationFrame;++x)window.requestAnimationFrame=window[vendors[x]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[vendors[x]+"CancelAnimationFrame"]||window[vendors[x]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=(new Date).getTime(),c=Math.max(0,16-(b-lastTime)),d=window.setTimeout(function(){a(b+c)},c);return lastTime=b+c,d}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});