2020-05-19 11:43:42 +03:00

7 lines
4.3 KiB
JavaScript

/*!
* AngularJS Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.18-master-97a1616
*/
!function(a,A){"use strict";function e(y,E,x,$,w,P,g,T){var O="focus touchstart mouseenter",D="blur touchcancel mouseleave",V={top:{x:g.xPosition.CENTER,y:g.yPosition.ABOVE},right:{x:g.xPosition.OFFSET_END,y:g.yPosition.CENTER},bottom:{x:g.xPosition.CENTER,y:g.yPosition.BELOW},left:{x:g.xPosition.OFFSET_START,y:g.yPosition.CENTER}};return{restrict:"E",priority:210,scope:{mdZIndex:"=?mdZIndex",mdDelay:"=?mdDelay",mdVisible:"=?mdVisible",mdAutohide:"=?mdAutohide",mdDirection:"@?mdDirection"},link:function(l,n,d){var o,e,r,a,s,c="md-tooltip-"+P.nextUid(),u=P.getParentWithPointerEvents(n),m=x.throttle(h),f=!1,b=null;function t(){l.mdZIndex=l.mdZIndex||100,l.mdDelay=l.mdDelay||0,V[l.mdDirection]||(l.mdDirection="bottom")}function i(e){var t=e||w(n.text().trim())(l.$parent);(u.attr("aria-label")||u.attr("aria-labelledby"))&&!u.attr("md-labeled-by-tooltip")||(u.attr("aria-label",t),u.attr("md-labeled-by-tooltip")||u.attr("md-labeled-by-tooltip",c))}function h(){t(),a&&a.panelEl&&a.panelEl.removeClass(o),o="md-origin-"+l.mdDirection,e=V[l.mdDirection],r=g.newPanelPosition().relativeTo(u).addPanelPosition(e.x,e.y),a&&a.panelEl&&(a.panelEl.addClass(o),a.updatePosition(r))}function p(e){p.queued&&p.value===!!e||!p.queued&&l.mdVisible===!!e||(p.value=!!e,p.queued||(e?(p.queued=!0,s=y(function(){l.mdVisible=p.value,p.queued=!1,s=null,l.visibleWatcher||v(l.mdVisible)},l.mdDelay)):P.nextTick(function(){l.mdVisible=!1,l.visibleWatcher||v(!1)})))}function v(e){e?function(){if(!n[0].textContent.trim())throw new Error("Text for the tooltip has not been provided. Please include text within the mdTooltip element.");if(!a){var e=A.element(document.body),t=g.newPanelAnimation().openFrom(u).closeTo(u).withAnimation({open:"md-show",close:"md-hide"}),i={id:c,attachTo:e,contentElement:n,propagateContainerEvents:!0,panelClass:"md-tooltip",animation:t,position:r,zIndex:l.mdZIndex,focusOnOpen:!1,onDomAdded:function(){a.panelEl.addClass(o)}};a=g.create(i)}a.open().then(function(){a.panelEl.attr("role","tooltip")})}():a&&a.close()}t(),i(),n.detach(),h(),function(){if(u[0]&&"MutationObserver"in E){var e=new MutationObserver(function(e){!function(e){return e.some(function(e){return"disabled"===e.attributeName&&u[0].disabled}),!1}(e)||P.nextTick(function(){p(!1)})});e.observe(u[0],{attributes:!0})}function t(){p(!1)}function i(){b=document.activeElement===u[0]}function n(e){"focus"===e.type&&b?b=!1:l.mdVisible||(u.on(D,o),p(!0),"touchstart"===e.type&&u.one("touchend",function(){P.nextTick(function(){$.one("touchend",o)},!1)}))}function o(){((l.hasOwnProperty("mdAutohide")?l.mdAutohide:d.hasOwnProperty("mdAutohide"))||f||$[0].activeElement!==u[0])&&(s&&(y.cancel(s),p.queued=!1,s=null),u.off(D,o),u.triggerHandler("blur"),p(!1)),f=!1}function r(){f=!0}b=!1,T.register("scroll",t,!0),T.register("blur",i),T.register("resize",m),l.$on("$destroy",function(){T.deregister("scroll",t,!0),T.deregister("blur",i),T.deregister("resize",m),u.off(O,n).off(D,o).off("mousedown",r),o(),e&&e.disconnect()}),u.on("mousedown",r),u.on(O,n)}(),function(){if(n[0]&&"MutationObserver"in E){var e=new MutationObserver(function(e){e.forEach(function(e){"md-visible"!==e.attributeName||l.visibleWatcher||(l.visibleWatcher=l.$watch("mdVisible",v))})});e.observe(n[0],{attributes:!0}),d.hasOwnProperty("mdVisible")&&(l.visibleWatcher=l.$watch("mdVisible",v))}else l.visibleWatcher=l.$watch("mdVisible",v);function t(){l.$destroy()}l.$watch("mdDirection",h),n.one("$destroy",t),u.one("$destroy",t),l.$on("$destroy",function(){p(!1),a&&a.destroy(),e&&e.disconnect(),n.remove()}),-1<n.text().indexOf(w.startSymbol())&&l.$watch(function(){return n.text().trim()},i)}()}}}e.$inject=["$timeout","$window","$$rAF","$document","$interpolate","$mdUtil","$mdPanel","$$mdTooltipRegistry"],A.module("material.components.tooltip",["material.core","material.components.panel"]).directive("mdTooltip",e).service("$$mdTooltipRegistry",function(){var r={},l=A.element(a);return{register:function(e,t,i){var n=r[e]=r[e]||[];n.length||(i?a.addEventListener(e,d,!0):l.on(e,d));-1===n.indexOf(t)&&n.push(t)},deregister:function(e,t,i){var n=r[e],o=n?n.indexOf(t):-1;-1<o&&(n.splice(o,1),0===n.length&&(i?a.removeEventListener(e,d,!0):l.off(e,d)))}};function d(t){r[t.type]&&r[t.type].forEach(function(e){e.call(this,t)},this)}})}(window,window.angular);