fabSpeedDial.min.js 5.0 KB

1234567
  1. /*!
  2. * Angular Material Design
  3. * https://github.com/angular/material
  4. * @license MIT
  5. * v0.11.3-master-3fe7d76
  6. */
  7. !function(n,e,t){"use strict";!function(){function t(t,o,i,r,c){function a(){_.direction=_.direction||"down",_.isOpen=_.isOpen||!1,p()}function s(){var n=["mousedown","mouseup","click","touchstart","touchend","focusin","focusout"];e.forEach(n,function(n){o.on(n,f)}),t.$on("$destroy",function(){e.forEach(n,function(n){o.off(n,f)}),b()})}function l(){R=[]}function u(n){var t,o,i,r=0;do o=n.map(function(n){return n.replace("?","")}),t=e.equals(R,o),t||(n=d(n),i=n.length>=R.length&&n.length!==o.length);while(10>r&&!t&&i);return t}function d(n){var e=!1;return n.filter(function(n){return e||-1===n.indexOf("?")?!0:(e=!0,!1)})}function f(n){return R.push(n.type),u(["mousedown","focusout?","focusin?","mouseup","click"])?(k(n),void l()):u(["touchstart?","touchend?","click"])?(k(n),void l()):u(["focusin"])?(_.open(),void l()):u(["focusout"])?(_.close(),void l()):void m()}function m(){F&&n.clearTimeout(F),F=n.setTimeout(function(){l()},250)}function p(){_.currentActionIndex=-1}function v(){t.$watch("vm.direction",function(n,e){i.removeClass(o,"md-"+e),i.addClass(o,"md-"+n),p()});var n,e;t.$watch("vm.isOpen",function(t){p(),n&&e||(n=$(),e=T()),t?g():b();var r=t?"md-is-open":"",c=t?"":"md-is-open";n.attr("aria-haspopup",!0),n.attr("aria-expanded",t),e.attr("aria-hidden",!t),i.setClass(o,r,c)})}function h(){r.nextTick(function(){i.addClass(o,"md-noop")})}function g(){e.element(document).on("keydown",C)}function b(){e.element(document).off("keydown",C)}function C(n){switch(n.which){case c.KEY_CODE.SPACE:return n.preventDefault(),!1;case c.KEY_CODE.ESCAPE:return _.close(),n.preventDefault(),!1;case c.KEY_CODE.LEFT_ARROW:return E(n),!1;case c.KEY_CODE.UP_ARROW:return w(n),!1;case c.KEY_CODE.RIGHT_ARROW:return x(n),!1;case c.KEY_CODE.DOWN_ARROW:return D(n),!1}}function O(n){y(n,-1)}function A(n){y(n,1)}function y(n,t){var o=T()[0].querySelectorAll(".md-fab-action-item");e.forEach(o,function(n){e.element(e.element(n).children()[0]).attr("tabindex",-1)}),_.currentActionIndex=_.currentActionIndex+t,_.currentActionIndex=Math.min(o.length-1,_.currentActionIndex),_.currentActionIndex=Math.max(0,_.currentActionIndex);var i=e.element(o[_.currentActionIndex]).children()[0];e.element(i).attr("tabindex",0),i.focus(),n.preventDefault(),n.stopImmediatePropagation()}function E(n){"left"===_.direction?A(n):O(n)}function w(n){"down"===_.direction?O(n):A(n)}function x(n){"left"===_.direction?O(n):A(n)}function D(n){"up"===_.direction?O(n):A(n)}function S(n){return r.getClosest(n,"md-fab-trigger")}function I(n){return r.getClosest(n,"md-fab-actions")}function k(n){S(n.target)&&_.toggle(),I(n.target)&&_.close()}function $(){return o.find("md-fab-trigger")}function T(){return o.find("md-fab-actions")}var _=this;_.open=function(){t.$evalAsync("vm.isOpen = true")},_.close=function(){t.$evalAsync("vm.isOpen = false"),o.find("md-fab-trigger")[0].focus()},_.toggle=function(){t.$evalAsync("vm.isOpen = !vm.isOpen")},a(),s(),v(),h();var F,R=[]}e.module("material.components.fabShared",["material.core"]).controller("FabController",t),t.$inject=["$scope","$element","$animate","$mdUtil","$mdConstant"]}(),function(){function t(){function n(n,e){e.prepend('<div class="md-css-variables"></div>')}return{restrict:"E",scope:{direction:"@?mdDirection",isOpen:"=?mdOpen"},bindToController:!0,controller:"FabController",controllerAs:"vm",link:n}}function o(){function t(t){var o=t[0],i=t.controller("mdFabSpeedDial"),r=o.querySelectorAll(".md-fab-action-item"),c=o.querySelector("md-fab-trigger"),a=o.querySelector(".md-css-variables"),s=parseInt(n.getComputedStyle(a).zIndex);e.forEach(r,function(n,e){var t=n.style;t.transform=t.webkitTransform="",t.transitionDelay="",t.opacity=1,t.zIndex=r.length-e+s}),c.style.zIndex=s+r.length+1,i.isOpen||e.forEach(r,function(n,e){var t,o,r=n.style;switch(i.direction){case"up":t=n.scrollHeight*(e+1),o="Y";break;case"down":t=-n.scrollHeight*(e+1),o="Y";break;case"left":t=n.scrollWidth*(e+1),o="X";break;case"right":t=-n.scrollWidth*(e+1),o="X"}var c="translate"+o+"("+t+"px)";r.transform=r.webkitTransform=c})}return{addClass:function(n,e,o){n.hasClass("md-fling")&&(t(n),o())},removeClass:function(n,e,o){t(n),o()}}}function i(){function t(t){var i=t[0],r=t.controller("mdFabSpeedDial"),c=i.querySelectorAll(".md-fab-action-item"),a=i.querySelector(".md-css-variables"),s=parseInt(n.getComputedStyle(a).zIndex);e.forEach(c,function(n,e){var t=n.style,i=e*o;t.opacity=r.isOpen?1:0,t.transform=t.webkitTransform=r.isOpen?"scale(1)":"scale(0)",t.transitionDelay=(r.isOpen?i:c.length-i)+"ms",t.zIndex=c.length-e+s})}var o=65;return{addClass:function(n,e,o){t(n),o()},removeClass:function(n,e,o){t(n),o()}}}e.module("material.components.fabSpeedDial",["material.core","material.components.fabShared","material.components.fabTrigger","material.components.fabActions"]).directive("mdFabSpeedDial",t).animation(".md-fling",o).animation(".md-scale",i).service("mdFabSpeedDialFlingAnimation",o).service("mdFabSpeedDialScaleAnimation",i)}()}(window,window.angular);