|
!function(e,t,n){"use strict";function i(e,n,i,a,r,d,o){function s(e,s){var c=l.compile(e,s).post;return e.addClass("md-dragging"),function(e,s,l,m){function u(t){f&&f(e)||(t.stopPropagation(),s.addClass("md-dragging"),w={width:$.prop("offsetWidth")})}function g(e){if(w){e.stopPropagation(),e.srcEvent&&e.srcEvent.preventDefault();var t=e.pointer.distanceX/w.width,n=m.$viewValue?1+t:t;n=Math.max(0,Math.min(1,n)),$.css(i.CSS.TRANSFORM,"translate3d("+100*n+"%,0,0)"),w.translate=n}}function v(t){if(w){t.stopPropagation(),s.removeClass("md-dragging"),$.css(i.CSS.TRANSFORM,"");var n=m.$viewValue?w.translate<.5:w.translate>.5;n&&p(!m.$viewValue),w=null,e.skipToggle=!0,o(function(){e.skipToggle=!1},1)}}function p(t){e.$apply(function(){m.$setViewValue(t),m.$render()})}m=m||n.fakeNgModel();var f=null;null!=l.disabled?f=function(){return!0}:l.ngDisabled&&(f=a(l.ngDisabled));var $=t.element(s[0].querySelector(".md-thumb-container")),h=t.element(s[0].querySelector(".md-container"));r(function(){s.removeClass("md-dragging")}),c(e,s,l,m),f&&e.$watch(f,function(e){s.attr("tabindex",e?-1:0)}),d.register(h,"drag"),h.on("$md.dragstart",u).on("$md.drag",g).on("$md.dragend",v);var w}}var l=e[0];return{restrict:"E",priority:210,transclude:!0,template:'<div class="md-container"><div class="md-bar"></div><div class="md-thumb-container"><div class="md-thumb" md-ink-ripple md-ink-ripple-checkbox></div></div></div><div ng-transclude class="md-label"></div>',require:"?ngModel",compile:s}}i.$inject=["mdCheckboxDirective","$mdUtil","$mdConstant","$parse","$$rAF","$mdGesture","$timeout"],t.module("material.components.switch",["material.core","material.components.checkbox"]).directive("mdSwitch",i)}(window,window.angular);
|