|
function MdCheckboxDirective(e,t,n,i,o,c){function a(a,d){function r(a,d,r,l){function s(e,t,n){r[e]&&a.$watch(r[e],function(e){n[e]&&d.attr(t,n[e])})}function u(e){var t=e.which||e.keyCode;t!==n.KEY_CODE.SPACE&&t!==n.KEY_CODE.ENTER||(e.preventDefault(),d.addClass("md-focused"),m(e))}function m(e){d[0].hasAttribute("disabled")||a.skipToggle||a.$apply(function(){var t=r.ngChecked?r.checked:!l.$viewValue;l.$setViewValue(t,e&&e.type),l.$render()})}function p(){d.toggleClass("md-checked",!!l.$viewValue&&!h)}function f(e){h=e!==!1,h&&d.attr("aria-checked","mixed"),d.toggleClass("md-indeterminate",h)}var h;l=l||o.fakeNgModel(),i(d),d.children().on("focus",function(){d.focus()}),o.parseAttributeBoolean(r.mdIndeterminate)&&(f(),a.$watch(r.mdIndeterminate,f)),r.ngChecked&&a.$watch(a.$eval.bind(a,r.ngChecked),function(e){l.$setViewValue(e),l.$render()}),s("ngDisabled","tabindex",{"true":"-1","false":r.tabindex}),t.expectWithText(d,"aria-label"),e.link.pre(a,{on:angular.noop,0:{}},r,[l]),a.mouseActive=!1,d.on("click",m).on("keypress",u).on("mousedown",function(){a.mouseActive=!0,c(function(){a.mouseActive=!1},100)}).on("focus",function(){a.mouseActive===!1&&d.addClass("md-focused")}).on("blur",function(){d.removeClass("md-focused")}),l.$render=p}return d.$set("tabindex",d.tabindex||"0"),d.$set("type","checkbox"),d.$set("role",d.type),{pre:function(e,t){t.on("click",function(e){this.hasAttribute("disabled")&&e.stopImmediatePropagation()})},post:r}}return e=e[0],{restrict:"E",transclude:!0,require:"?ngModel",priority:210,template:'<div class="md-container" md-ink-ripple md-ink-ripple-checkbox><div class="md-icon"></div></div><div ng-transclude class="md-label"></div>',compile:a}}goog.provide("ngmaterial.components.checkbox"),goog.require("ngmaterial.core"),MdCheckboxDirective.$inject=["inputDirective","$mdAria","$mdConstant","$mdTheming","$mdUtil","$timeout"],angular.module("material.components.checkbox",["material.core"]).directive("mdCheckbox",MdCheckboxDirective),ngmaterial.components.checkbox=angular.module("material.components.checkbox");
|