diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.js index 570a6b5939afd27e5c261c621b1becddd6c1f35e..9d811b9e5fa116675a4156be34142b6ab97a6e93 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.js +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.js @@ -20,19 +20,45 @@ angular.module('ui.layout', []).controller('uiLayoutCtrl', [ var opts = angular.extend({}, $parse(tAttrs.uiLayout)(), $parse(tAttrs.options)()); var isUsingColumnFlow = opts.flow === 'column'; tElement.addClass('stretch').addClass('ui-layout-' + (opts.flow || 'row')); + var child_widths = []; + var total_width = tElement[0].clientWidth; for (_i = 0; _i < _child_len; ++_i) { angular.element(_childens[_i]).addClass('stretch'); + var init_width_attr = _childens[_i].attributes.getNamedItem('ui-layout-init-min-width'); + if(init_width_attr) { + if(init_width_attr.nodeValue.includes('%')) { + var child_width_perc = parseFloat(init_width_attr.nodeValue); + child_widths.push(child_width_perc); + } + else { + var child_width_perc = 100.0*parseFloat(init_width_attr.nodeValue) / total_width; + child_widths.push(child_width_perc); + } + } + else + child_widths.push(undefined); } + if (_child_len > 1) { + var totalDefinedChildWidth = child_widths.filter(function(cw) { return cw != undefined;}).reduce(function(a, b){return a+b;}); + var remainingWithForUndefinedChilds = 100 - totalDefinedChildWidth; + var numUndefinedChilds = child_widths.filter(function(cw) { return cw == undefined;}).length; + var undefinedChildWidth = remainingWithForUndefinedChilds / numUndefinedChilds; + var flowProperty = isUsingColumnFlow ? 'left' : 'top'; var oppositeFlowProperty = isUsingColumnFlow ? 'right' : 'bottom'; - var step = 100 / _child_len; + var prevPerc = 0; for (_i = 0; _i < _child_len; ++_i) { - var area = angular.element(_childens[_i]).css(flowProperty, step * _i + '%').css(oppositeFlowProperty, 100 - step * (_i + 1) + '%'); + var child_width = child_widths[_i]; + if(child_width == undefined) { + child_width = undefinedChildWidth; + } + var area = angular.element(_childens[_i]).css(flowProperty, prevPerc + '%').css(oppositeFlowProperty, 100 - (prevPerc + child_width) + '%'); if (_i < _child_len - 1) { - var bar = angular.element(splitBarElem_htmlTemplate).css(flowProperty, step * (_i + 1) + '%'); + var bar = angular.element(splitBarElem_htmlTemplate).css(flowProperty, prevPerc + child_width + '%'); area.after(bar); } + prevPerc += child_width; } } }, @@ -120,4 +146,4 @@ if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = function (id) { clearTimeout(id); }; -} \ No newline at end of file +} diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.min.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.min.js index c6e5df5ccb63e3a42fc66a88384a535b8008e4b7..88ac76aa8bfd1b8450cac2647c4b58ebcf2ab573 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.min.js +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/js/angular-ui-layout/angular-ui-layout.min.js @@ -1,7 +1 @@ -/** - * angular-ui-layout - This directive allows you to split ! - * @version v0.0.0 - 2014-01-01 - * @link https://github.com/angular-ui/ui-layout - * @license MIT - */ -"use strict";angular.module("ui.layout",[]).controller("uiLayoutCtrl",["$scope","$attrs","$element",function(a,b,c){return{opts:angular.extend({},a.$eval(b.uiLayout),a.$eval(b.options)),element:c}}]).directive("uiLayout",["$parse",function(a){var b='<div class="stretch ui-splitbar"></div>';return{restrict:"AE",compile:function(c,d){var e,f=c.children(),g=f.length,h=angular.extend({},a(d.uiLayout)(),a(d.options)()),i="column"===h.flow;for(c.addClass("stretch").addClass("ui-layout-"+(h.flow||"row")),e=0;g>e;++e)angular.element(f[e]).addClass("stretch");if(g>1){var j=i?"left":"top",k=i?"right":"bottom",l=100/g;for(e=0;g>e;++e){var m=angular.element(f[e]).css(j,l*e+"%").css(k,100-l*(e+1)+"%");if(g-1>e){var n=angular.element(b).css(j,l*(e+1)+"%");m.after(n)}}}},controller:"uiLayoutCtrl"}}]).directive("uiSplitbar",function(){var a=angular.element(document.body.parentElement);return{require:"^uiLayout",restrict:"EAC",link:function(b,c,d,e){function f(){var a=e.element[0].getBoundingClientRect(),b=q.getBoundingClientRect();k.time=+new Date,k.barSize=b[p],k.layoutSize=a[p],k.layoutOrigine=a[n]}function g(){var a=(j-k.layoutOrigine)/k.layoutSize*100;a=Math.min(a,100-k.barSize/k.layoutSize*100),a=Math.max(a,parseInt(q.previousElementSibling.style[n],10)),q.nextElementSibling.nextElementSibling&&(a=Math.min(a,parseInt(q.nextElementSibling.nextElementSibling.style[n],10))),q.style[n]=q.nextElementSibling.style[n]=a+"%",q.previousElementSibling.style[o]=100-a+"%",i=null}function h(a){j=a[m]||a.originalEvent[m],i&&window.cancelAnimationFrame(i),(!k.time||+new Date>k.time+1e3)&&f(),i=window.requestAnimationFrame(g)}var i,j,k={},l="column"===e.opts.flow,m=l?"clientX":"clientY",n=l?"left":"top",o=l?"right":"bottom",p=l?"width":"height",q=c[0];c.on("mousedown touchstart",function(b){return b.preventDefault(),b.stopPropagation(),a.on("mousemove touchmove",h),!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)}); \ No newline at end of file +"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=d[0].clientWidth;for(f=0;f<h;++f){angular.element(g[f]).addClass("stretch");var m=g[f].attributes.getNamedItem("ui-layout-init-min-width");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)}else k.push(void 0)}if(h>1){var o=k.filter(function(a){return void 0!=a}).reduce(function(a,b){return a+b}),p=100-o,q=k.filter(function(a){return void 0==a}).length,r=p/q,s=j?"left":"top",t=j?"right":"bottom",u=0;for(f=0;f<h;++f){var v=k[f];void 0==v&&(v=r);var w=angular.element(g[f]).css(s,u+"%").css(t,100-(u+v)+"%");if(f<h-1){var x=angular.element(b).css(s,u+v+"%");w.after(x)}u+=v}}},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)});