|
|
/*! * Angular Material Design * https://github.com/angular/material
* @license MIT * v1.1.0-master-2b98560 */ function mdListDirective(e){return{restrict:"E",compile:function(t){return t[0].setAttribute("role","list"),e}}}function mdListItemDirective(e,t,n,r){var a=["md-checkbox","md-switch","md-menu"];return{restrict:"E",controller:"MdListController",compile:function(i,o){function l(){for(var e,t,n=["md-switch","md-checkbox"],r=0;t=n[r];++r)if((e=i.find(t)[0])&&!e.hasAttribute("aria-label")){var a=i.find("p")[0];if(!a)return;e.setAttribute("aria-label","Toggle "+a.textContent)}}function s(){var e=angular.element(b),t=e.parent().hasClass("md-secondary-container")||b.parentNode.firstElementChild!==b,n="left";t&&(n="right"),e.attr("md-position-mode")||e.attr("md-position-mode",n+" target");var r=e.children().eq(0);p(r[0])||r.attr("ng-click","$mdOpenMenu($event)"),r.attr("aria-label")||r.attr("aria-label","Open List Menu")}function d(e){if("div"==e)y=angular.element('<div class="md-no-style md-list-item-inner">'),y.append(i.contents()),i.addClass("md-proxy-focus");else{y=angular.element('<div class="md-button md-no-style"> <div class="md-list-item-inner"></div></div>');var t=angular.element('<md-button class="md-no-style"></md-button>');t[0].setAttribute("aria-label",i[0].textContent),m(i[0],t[0]),i.hasClass("md-no-focus")&&t.addClass("md-no-focus"),y.prepend(t),y.children().eq(1).append(i.contents()),i.addClass("_md-button-wrap")}i[0].setAttribute("tabindex","-1"),i.append(y)}function c(){var e=angular.element('<div class="md-secondary-container">');angular.forEach(C,function(t){u(t,e)}),y.append(e)}function u(t,n){if(t&&!g(t)&&t.hasAttribute("ng-click")){e.expect(t,"aria-label");var r=angular.element('<md-button class="md-secondary md-icon-button">');m(t,r[0],["ng-if","ng-hide","ng-show"]),t.setAttribute("tabindex","-1"),r.append(t),t=r[0]}t&&(!p(t)||!o.ngClick&&f(t))&&angular.element(t).removeClass("md-secondary"),i.addClass("md-with-secondary"),n.append(t)}function m(e,t,r){var a=n.prefixer(["ng-if","ng-click","ng-dblclick","aria-label","ng-disabled","ui-sref","href","ng-href","target","ng-attr-ui-sref","ui-sref-opts"]);r&&(a=a.concat(n.prefixer(r))),angular.forEach(a,function(n){e.hasAttribute(n)&&(t.setAttribute(n,e.getAttribute(n)),e.removeAttribute(n))})}function f(e){return a.indexOf(e.nodeName.toLowerCase())!=-1}function g(e){var t=e.nodeName.toUpperCase();return"MD-BUTTON"==t||"BUTTON"==t}function p(e){for(var t=e.attributes,n=0;n<t.length;n++)if("ngClick"===o.$normalize(t[n].name))return!0;return!1}function v(e,i,o,l){function s(){m&&m.children&&!v&&angular.forEach(a,function(e){angular.forEach(m.querySelectorAll(e+":not(.md-secondary)"),function(e){u.push(e)})})}function d(){(1==u.length||v)&&(i.addClass("md-clickable"),v||l.attachRipple(e,angular.element(i[0].querySelector(".md-no-style"))))}function c(e){var t=["md-slider"];if(!e.path)return t.indexOf(e.target.tagName.toLowerCase())!==-1;for(var n=e.path.indexOf(i.children()[0]),r=0;r<n;r++)if(t.indexOf(e.path[r].tagName.toLowerCase())!==-1)return!0}i.addClass("_md");var u=[],m=i[0].firstElementChild,f=i.hasClass("_md-button-wrap"),g=f?m.firstElementChild:m,v=g&&p(g);s(),d(),i.hasClass("md-proxy-focus")&&u.length&&angular.forEach(u,function(t){t=angular.element(t),e.mouseActive=!1,t.on("mousedown",function(){e.mouseActive=!0,r(function(){e.mouseActive=!1},100)}).on("focus",function(){e.mouseActive===!1&&i.addClass("md-focused"),t.on("blur",function n(){i.removeClass("md-focused"),t.off("blur",n)})})});var h=function(e){if("INPUT"!=e.target.nodeName&&"TEXTAREA"!=e.target.nodeName&&!e.target.isContentEditable){var n=e.which||e.keyCode;n==t.KEY_CODE.SPACE&&g&&(g.click(),e.preventDefault(),e.stopPropagation())}};v||u.length||g&&g.addEventListener("keypress",h),i.off("click"),i.off("keypress"),1==u.length&&g&&i.children().eq(0).on("click",function(e){if(!c(e)){var t=n.getClosest(e.target,"BUTTON");!t&&g.contains(e.target)&&angular.forEach(u,function(t){e.target===t||t.contains(e.target)||("MD-MENU"===t.nodeName&&(t=t.children[0]),angular.element(t).triggerHandler("click"))})}}),e.$on("$destroy",function(){g&&g.removeEventListener("keypress",h)})}var h,b,C=i[0].querySelectorAll(".md-secondary"),y=i;if(i[0].setAttribute("role","listitem"),o.ngClick||o.ngDblclick||o.ngHref||o.href||o.uiSref||o.ngAttrUiSref)d("button");else{for(var A,k=0;A=a[k];++k)if(b=i[0].querySelector(A)){h=!0;break}h?d("div"):i[0].querySelector("md-button:not(.md-secondary):not(.md-exclude)")||i.addClass("md-no-proxy")}return c(),l(),h&&"MD-MENU"===b.nodeName&&s(),v}}}function MdListController(e,t,n){function r(e,t){var r={};n.attach(e,t,r)}var a=this;a.attachRipple=r}goog.provide("ngmaterial.components.list"),goog.require("ngmaterial.core"),MdListController.$inject=["$scope","$element","$mdListInkRipple"],mdListDirective.$inject=["$mdTheming"],mdListItemDirective.$inject=["$mdAria","$mdConstant","$mdUtil","$timeout"],angular.module("material.components.list",["material.core"]).controller("MdListController",MdListController).directive("mdList",mdListDirective).directive("mdListItem",mdListItemDirective),ngmaterial.components.list=angular.module("material.components.list");
|