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
4.3 KiB

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