-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcog-dock-panel.min.js
1 lines (1 loc) · 4.4 KB
/
cog-dock-panel.min.js
1
!function(){"use strict";angular.module("cogDockPanel",[])}(),function(){"use strict";function o(){return{restrict:"A",scope:!0,controller:t}}function t(o,t,e){var i=e.evalDockPosition(t.attr("cog-dock"),o);o.__cogDock_id=String(Math.random()).replace(/\./g,"");var n=e.dockPanels[o.$parent.__cogDockPanel_id];n.addChild(t,i)}angular.module("cogDockPanel").directive("cogDock",o),t.$inject=["$scope","$element","cogDockPanelService"]}(),function(){"use strict";function o(){return{require:"dock",restrict:"A",controller:t,controllerAs:"vm"}}function t(o,t,e){function i(){var o="top|bottom".indexOf(u)!==-1?"height":"width",e=["min",o].join("-"),i=["max",o].join("-"),n="0px";t.css(i)===n?angular.forEach(l[o],function(o,e){t.css(e,o)}):(angular.forEach(l[o],function(e,i){l[o][i]=t.css(i)}),t.css(i,n),t.css(e,n))}function n(){if("fill"!==u){var o=t.find("."+s.CUSTOM_COLLAPSE_HANDLE_CLASS).first();o.length&&c(o)}}function c(o){o.addClass([s.JQUI_RESIZE_HANDLE_CLASS,s.JQUI_RESIZE_DIRECTION_PREFIX+a].join(" "))}var a,r=this,s=e.uiResizeClasses,l={height:{height:t.css("height"),"max-height":t.css("max-height"),"min-height":t.css("min-height")},width:{width:t.css("width"),"max-width":t.css("max-width"),"min-width":t.css("min-width")}},u=e.evalDockPosition(t.attr("cog-dock"),o);r.toggleCollapse=i,n(),o.$watch(function(){var i=e.evalDockPosition(t.attr("cog-dock"),o);i!==u&&(u=i,n())})}angular.module("cogDockPanel").directive("cogDockCollapsible",o),t.$inject=["$scope","$element","cogDockPanelService"]}(),function(){"use strict";function o(){return{restrict:"A",scope:!0,controller:t}}function t(o,t,e){o.__cogDockPanel_id=String(Math.random()).replace(/\./g,""),e.dockPanels[o.__cogDockPanel_id]=new e.Panel(t,o)}angular.module("cogDockPanel").directive("cogDockPanel",o),t.$inject=["$scope","$element","cogDockPanelService"]}(),function(){"use strict";function o(){return{dockPanels:{},validPositions:i,dockPositionHandles:n,uiResizeClasses:c,evalDockPosition:e,Panel:t()}}function t(){function o(o,t,e){e.position="absolute","bottom"!==o?e.top=t.top:e.top="auto","left"!==o?e.right=t.right:e.right="auto","right"!==o?e.left=t.left:e.left="auto","top"!==o?e.bottom=t.bottom:e.bottom="auto"}function t(o,t,e){var i;if(o.is(":visible"))switch("top|bottom".indexOf(t)!==-1&&(i=o.outerHeight(!0)),"left|right".indexOf(t)!==-1&&(i=o.outerWidth(!0)),t){case"top":e.top+=i;break;case"right":e.right+=i;break;case"bottom":e.bottom+=i;break;case"left":e.left+=i}}function n(o){i.forEach(function(t){o.removeClass("cog-dock-"+t)})}function c(e,i,c){var a={};n(e),o(i,c,a),e.addClass("cog-dock-"+i),e.css(a),t(e,i,c)}return function(o,t){var i=this,n={top:0,bottom:0,left:0,right:0},a=[];this.addChild=function(o,i){var r=e(i,t);a.push({element:o,dockPosition:r,order:a.length}),c(o,r,n)},this.refresh=function(o){function i(){a.forEach(function(o){o.calcPosition=e(o.element.attr("cog-dock"),t)})}function r(){n.top=0,n.bottom=0,n.left=0,n.right=0,a.forEach(function(o){c(o.element,o.calcPosition,n)})}i(),o?setTimeout(r,0):r()},$(window).resize(function(){i.refresh(!1)}),t.$watch(function(){i.refresh(!0)})}}function e(o,t){var e=o;if(i.indexOf(e)===-1&&(e=t.$eval(o)),i.indexOf(e)===-1)throw{message:'Invalid dock position "'+e+'". Valid positions: '+i.join(", ")};return e}var i=["top","right","bottom","left","fill"],n={top:"s",right:"w",bottom:"n",left:"e"},c={CUSTOM_RESIZE_HANDLE_CLASS:"cog-dock-resize-handle",CUSTOM_COLLAPSE_HANDLE_CLASS:"cog-dock-collapse-handle",JQUI_RESIZE_HANDLE_CLASS:"ui-resizable-handle",JQUI_RESIZE_DIRECTION_PREFIX:"ui-resizable-"};angular.module("cogDockPanel").factory("cogDockPanelService",o)}(),function(){"use strict";function o(){return{require:"dock",restrict:"A",controller:t}}function t(o,t,e){function i(){"fill"!==l&&t.resizable(n())}function n(){r=e.dockPositionHandles[l];var o={handles:r},i={},n=a(),u=t.find("."+s.CUSTOM_RESIZE_HANDLE_CLASS).first();return u.length&&(c(u),(i.handles=i.handles||{})[r]="."+s.CUSTOM_RESIZE_HANDLE_CLASS),angular.merge({},o,i,n)}function c(o){o.addClass([s.JQUI_RESIZE_HANDLE_CLASS,s.JQUI_RESIZE_DIRECTION_PREFIX+r].join(" "))}function a(){var e=o.$eval(t.attr("cog-dock-resizable"));return angular.isObject(e)&&e||{}}var r,s=e.uiResizeClasses,l=e.evalDockPosition(t.attr("cog-dock"),o);i(),o.$watch(function(){var n=e.evalDockPosition(t.attr("cog-dock"),o);n!==l&&(l=n,t.resizable("destroy"),i())})}angular.module("cogDockPanel").directive("cogDockResizable",o),t.$inject=["$scope","$element","cogDockPanelService"]}();