You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
3.9 KiB

  1. /*!
  2. * Angular Material Design
  3. * https://github.com/angular/material
  4. * @license MIT
  5. * v1.1.0-master-2b98560
  6. */
  7. !function(e,n,t){"use strict";function o(e,o,r,i){function s(e,t){var i=function(){return!1},s=function(){return r.when(o.supplant(d,[t||""]))};return n.extend({isLockedOpen:i,isOpen:i,toggle:s,open:s,close:s,onClose:n.noop,then:function(e){return c(t).then(e||n.noop)}},e)}function l(n,r){var s=e.get(n);return s||r?s:(i.error(o.supplant(d,[n||""])),t)}function c(n){return e.when(n)["catch"](i.error)}var d="SideNav '{0}' is not available! Did you use md-component-id='{0}'?",a={find:l,waitFor:c};return function(e,t){if(n.isUndefined(e))return a;var o=t===!0,r=a.find(e,o);return!r&&o?a.waitFor(e):!r&&n.isUndefined(t)?s(a,e):r}}function r(){return{restrict:"A",require:"^mdSidenav",link:function(e,n,t,o){}}}function i(e,o,r,i,s,l,c,d,a,u){function p(l,p,m,f){function g(e,n){l.isLockedOpen=e,e===n?p.toggleClass("md-locked-open",!!e):s[e?"addClass":"removeClass"](p,"md-locked-open"),k&&k.toggleClass("md-locked-open",!!e)}function $(e){var n=o.findFocusTarget(p)||o.findFocusTarget(p,"[md-sidenav-focus]")||p,t=p.parent();t[e?"on":"off"]("keydown",O),k&&k[e?"on":"off"]("click",w);var r=v(t,e);return e&&(D=u[0].activeElement),h(e),T=a.all([e&&k?s.enter(k,t):k?s.leave(k):a.when(!0),s[e?"removeClass":"addClass"](p,"md-closed")]).then(function(){l.isOpen&&n&&n.focus(),r&&r()})}function v(e,n){var t=p[0],o=e[0].scrollTop;if(n&&o){b={top:t.style.top,bottom:t.style.bottom,height:t.style.height};var r={top:o+"px",bottom:"auto",height:e[0].clientHeight+"px"};p.css(r),k.css(r)}if(!n&&b)return function(){t.style.top=b.top,t.style.bottom=b.bottom,t.style.height=b.height,k[0].style.top=null,k[0].style.bottom=null,k[0].style.height=null,b=null}}function h(e){e&&!y?(y=S.css("overflow"),S.css("overflow","hidden")):n.isDefined(y)&&(S.css("overflow",y),y=t)}function C(e){return l.isOpen==e?a.when(!0):(l.isOpen&&f.onCloseCb&&f.onCloseCb(),a(function(n){l.isOpen=e,o.nextTick(function(){T.then(function(e){l.isOpen||(D&&D.focus(),D=null),n(e)})})}))}function O(e){var n=e.keyCode===r.KEY_CODE.ESCAPE;return n?w(e):a.when(!0)}function w(e){return e.preventDefault(),f.close()}var y,k,b,S=null,D=null,T=a.when(!0),q=c(m.mdIsLockedOpen),E=function(){return q(l.$parent,{$media:function(n){return d.warn("$media is deprecated for is-locked-open. Use $mdMedia instead."),e(n)},$mdMedia:e})};m.mdDisableScrollTarget&&(S=u[0].querySelector(m.mdDisableScrollTarget),S?S=n.element(S):d.warn(o.supplant('mdSidenav: couldn\'t find element matching selector "{selector}". Falling back to parent.',{selector:m.mdDisableScrollTarget}))),S||(S=p.parent()),m.hasOwnProperty("mdDisableBackdrop")||(k=o.createBackdrop(l,"md-sidenav-backdrop md-opaque ng-enter")),p.addClass("_md"),i(p),k&&i.inherit(k,p),p.on("$destroy",function(){k&&k.remove(),f.destroy()}),l.$on("$destroy",function(){k&&k.remove()}),l.$watch(E,g),l.$watch("isOpen",$),f.$toggleOpen=C}return{restrict:"E",scope:{isOpen:"=?mdIsOpen"},controller:"$mdSidenavController",compile:function(e){return e.addClass("md-closed"),e.attr("tabIndex","-1"),p}}}function s(e,n,t,o,r){var i=this;i.isOpen=function(){return!!e.isOpen},i.isLockedOpen=function(){return!!e.isLockedOpen},i.onClose=function(e){return i.onCloseCb=e,i},i.open=function(){return i.$toggleOpen(!0)},i.close=function(){return i.$toggleOpen(!1)},i.toggle=function(){return i.$toggleOpen(!e.isOpen)},i.$toggleOpen=function(n){return r.when(e.isOpen=n)},i.destroy=o.register(i,t.mdComponentId)}o.$inject=["$mdComponentRegistry","$mdUtil","$q","$log"],i.$inject=["$mdMedia","$mdUtil","$mdConstant","$mdTheming","$animate","$compile","$parse","$log","$q","$document"],s.$inject=["$scope","$element","$attrs","$mdComponentRegistry","$q"],n.module("material.components.sidenav",["material.core","material.components.backdrop"]).factory("$mdSidenav",o).directive("mdSidenav",i).directive("mdSidenavFocus",r).controller("$mdSidenavController",s)}(window,window.angular);