7 lines
9.6 KiB
JavaScript
7 lines
9.6 KiB
JavaScript
/*!
|
|
* AngularJS Material Design
|
|
* https://github.com/angular/material
|
|
* @license MIT
|
|
* v1.1.18-master-97a1616
|
|
*/
|
|
!function(e,y){"use strict";function t(e,t,a){return{restrict:"E",link:function(o,i){i.addClass("_md"),t(i),e(function(){var e,t=i[0].querySelector("md-dialog-content");function n(){i.toggleClass("md-content-overflow",t.scrollHeight>t.clientHeight)}t&&(e=t.getElementsByTagName("img"),n(),y.element(e).on("load",n)),o.$on("$destroy",function(){a.destroy(i)})})}}}function n(e){var b,$;return n.$inject=["$mdDialog","$mdConstant"],o.$inject=["$mdDialog","$mdAria","$mdUtil","$mdConstant","$animate","$document","$window","$rootElement","$log","$injector","$mdTheming","$interpolate","$mdInteraction"],e("$mdDialog").setDefaults({methods:["disableParentScroll","hasBackdrop","clickOutsideToClose","escapeToClose","targetEvent","closeTo","openFrom","parent","fullscreen","multiple"],options:o}).addPreset("alert",{methods:["title","htmlContent","textContent","content","ariaLabel","ok","theme","css"],options:t}).addPreset("confirm",{methods:["title","htmlContent","textContent","content","ariaLabel","ok","cancel","theme","css"],options:t}).addPreset("prompt",{methods:["title","htmlContent","textContent","initialValue","content","placeholder","ariaLabel","ok","cancel","theme","css","required"],options:t});function t(){return{template:['<md-dialog md-theme="{{ dialog.theme || dialog.defaultTheme }}" aria-label="{{ dialog.ariaLabel }}" ng-class="dialog.css">',' <md-dialog-content class="md-dialog-content" role="document" tabIndex="-1">',' <h2 class="md-title">{{ dialog.title }}</h2>',' <div ng-if="::dialog.mdHtmlContent" class="md-dialog-content-body" ',' ng-bind-html="::dialog.mdHtmlContent"></div>',' <div ng-if="::!dialog.mdHtmlContent" class="md-dialog-content-body">'," <p>{{::dialog.mdTextContent}}</p>"," </div>",' <md-input-container md-no-float ng-if="::dialog.$type == \'prompt\'" class="md-prompt-input-container">',' <input ng-keypress="dialog.keypress($event)" md-autofocus ng-model="dialog.result" placeholder="{{::dialog.placeholder}}" ng-required="dialog.required">'," </md-input-container>"," </md-dialog-content>"," <md-dialog-actions>",' <md-button ng-if="dialog.$type === \'confirm\' || dialog.$type === \'prompt\'" ng-click="dialog.abort()" class="md-primary md-cancel-button">'," {{ dialog.cancel }}"," </md-button>",' <md-button ng-click="dialog.hide()" class="md-primary md-confirm-button" md-autofocus="dialog.$type===\'alert\'" ng-disabled="dialog.required && !dialog.result">'," {{ dialog.ok }}"," </md-button>"," </md-dialog-actions>","</md-dialog>"].join("").replace(/\s\s+/g,""),controller:n,controllerAs:"dialog",bindToController:!0}}function n(o,i){this.$onInit=function(){var n="prompt"==this.$type;n&&this.initialValue&&(this.result=this.initialValue),this.hide=function(){o.hide(!n||this.result)},this.abort=function(){o.cancel()},this.keypress=function(e){var t=n&&this.required&&!y.isDefined(this.result);e.keyCode!==i.KEY_CODE.ENTER||t||o.hide(this.result)}}}function o(u,l,g,f,a,d,p,r,s,c,t,m,h){return{hasBackdrop:!0,isolateScope:!0,onCompiling:function(e){e.defaultTheme=t.defaultTheme(),function(t){var e;t.targetEvent&&t.targetEvent.target&&(e=y.element(t.targetEvent.target));var n=e&&e.controller("mdTheme");if(t.hasTheme=!!n,!t.hasTheme)return;t.themeWatch=n.$shouldWatch;var o=t.theme||n.$mdTheme;o&&(t.scope.theme=o);var i=n.registerChanges(function(e){t.scope.theme=e,t.themeWatch||i()})}(e)},onShow:function(e,t,n,o){y.element(d[0].body).addClass("md-dialog-is-showing");var i=t.find("md-dialog");if(i.hasClass("ng-cloak")){s.warn("$mdDialog: using `<md-dialog ng-cloak>` will affect the dialog opening animations.",t[0])}return function(e){e.origin=y.extend({element:null,bounds:null,focus:y.noop},e.origin||{}),e.parent=n(e.parent,r),e.closeTo=t(n(e.closeTo)),e.openFrom=t(n(e.openFrom)),e.targetEvent&&(e.origin=t(e.targetEvent.target,e.origin),e.originInteraction=h.getLastInteractionType());function t(e,t){var n=y.element(e||{});if(n&&n.length){var o=y.isFunction(n[0].getBoundingClientRect);return y.extend(t||{},{element:o?n:void 0,bounds:o?n[0].getBoundingClientRect():y.extend({},{top:0,left:0,height:0,width:0},n[0]),focus:y.bind(n,n.focus)})}}function n(e,t){return y.isString(e)&&(e=d[0].querySelector(e)),y.element(e||t)}}(n),function(e,t){var n="alert"===t.$type?"alertdialog":"dialog",o=e.find("md-dialog-content"),i=e.attr("id"),a="dialogContent_"+(i||g.nextUid());e.attr({role:n,tabIndex:"-1"}),0===o.length&&(o=e,i&&(a=i));o.attr("id",a),e.attr("aria-describedby",a),t.ariaLabel?l.expect(e,"aria-label",t.ariaLabel):l.expectAsync(e,"aria-label",function(){if(t.title)return t.title;var e=o.text().split(/\s+/);return 3<e.length&&(e=e.slice(0,3).concat("...")),e.join(" ")});(b=document.createElement("div")).classList.add("md-dialog-focus-trap"),b.tabIndex=0,$=b.cloneNode(!1);function r(){e.focus()}b.addEventListener("focus",r),$.addEventListener("focus",r),e[0].parentNode.insertBefore(b,e[0]),e.after($)}(i,n),function(e,t,n){n.disableParentScroll&&(n.restoreScroll=g.disableScrollAround(t,n.parent));n.hasBackdrop&&(n.backdrop=g.createBackdrop(e,"md-dialog-backdrop md-opaque"),a.enter(n.backdrop,n.parent));n.hideBackdrop=function(e){n.backdrop&&(e?n.backdrop.remove():a.leave(n.backdrop)),n.disableParentScroll&&(n.restoreScroll&&n.restoreScroll(),delete n.restoreScroll),n.hideBackdrop=null}}(e,t,n),function(e,t){function n(){var e="alert"==t.$type?u.hide:u.cancel;g.nextTick(e,!0)}var o=y.element(p),i=g.debounce(function(){v(e,t)},60),a=[];if(t.escapeToClose){var r=t.parent,l=function(e){e.keyCode===f.KEY_CODE.ESCAPE&&(e.stopImmediatePropagation(),e.preventDefault(),n())};e.on("keydown",l),r.on("keydown",l),a.push(function(){e.off("keydown",l),r.off("keydown",l)})}if(o.on("resize",i),a.push(function(){o.off("resize",i)}),t.clickOutsideToClose){var d,s=e,c=function(e){d=e.target},m=function(e){d===s[0]&&e.target===s[0]&&(e.stopPropagation(),e.preventDefault(),n())};s.on("mousedown",c),s.on("mouseup",m),a.push(function(){s.off("mousedown",c),s.off("mouseup",m)})}t.deactivateListeners=function(){a.forEach(function(e){e()}),t.deactivateListeners=null}}(t,n),function(e,t){t.parent.append(e),t.reverseContainerStretch=v(e,t);var n=e.find("md-dialog"),o=g.dom.animator,i=o.calculateZoomToOrigin,a={transitionInClass:"md-transition-in",transitionOutClass:"md-transition-out"},r=o.toTransformCss(i(n,t.openFrom||t.origin)),l=o.toTransformCss("");return n.toggleClass("md-dialog-fullscreen",!!t.fullscreen),o.translate3d(n,r,l,a).then(function(e){return t.reverseAnimate=function(){return delete t.reverseAnimate,t.closeTo?(a={transitionInClass:"md-transition-out",transitionOutClass:"md-transition-in"},r=l,l=o.toTransformCss(i(n,t.closeTo)),o.translate3d(n,r,l,a)):e(l=o.toTransformCss(i(n,t.origin)))},t.clearAnimate=function(){return delete t.clearAnimate,n.removeClass([a.transitionOutClass,a.transitionInClass].join(" ")),o.translate3d(n,l,o.toTransformCss(""),{})},!0})}(t,n).then(function(){!function(e,t){var o=!0;function n(e){for(var t=function(e){for(var t=[];e.parentNode;){if(e===document.body)return t;for(var n=e.parentNode.children,o=0;o<n.length;o++)e===n[o]||C(n[o],["SCRIPT","STYLE"])||n[o].hasAttribute("aria-live")||t.push(n[o]);e=e.parentNode}return t}(e),n=0;n<t.length;n++)t[n].setAttribute("aria-hidden",o)}n(e[0]),t.unlockScreenReader=function(){o=!1,n(e[0]),t.unlockScreenReader=null}}(t,n),t[0].querySelector(".md-actions")&&s.warn("Using a class of md-actions is deprecated, please use <md-dialog-actions>."),function(){if(n.focusOnOpen){(g.findFocusTarget(t)||t[0].querySelector(".dialog-close, md-dialog-actions button:last-child")||i).focus()}}()})},onShowing:function(e,t,n,o){if(o){var i=o.htmlContent||n.htmlContent||"",a=o.textContent||n.textContent||o.content||n.content||"";if(i&&!c.has("$sanitize"))throw Error("The ngSanitize module must be loaded in order to use htmlContent.");if(i&&a)throw Error("md-dialog cannot have both `htmlContent` and `textContent`");o.mdHtmlContent=i,o.mdTextContent=a}},onRemove:function(e,t,n){n.deactivateListeners(),n.unlockScreenReader(),n.hideBackdrop(n.$destroy),b&&b.parentNode&&b.parentNode.removeChild(b);$&&$.parentNode&&$.parentNode.removeChild($);return n.$destroy?o():function(e,t){return t.reverseAnimate().then(function(){t.contentElement&&t.clearAnimate()})}(0,n).then(o);function o(){y.element(d[0].body).removeClass("md-dialog-is-showing"),n.contentElement&&n.reverseContainerStretch(),n.cleanupElement(),n.$destroy||"keyboard"!==n.originInteraction||n.origin.focus()}},clickOutsideToClose:!1,escapeToClose:!0,targetEvent:null,closeTo:null,openFrom:null,focusOnOpen:!0,disableParentScroll:!0,autoWrap:!0,fullscreen:!1,transformTemplate:function(e,t){var n,o=m.startSymbol(),i=m.endSymbol(),a=o+(t.themeWatch?"":"::")+"theme"+i;return'<div class="md-dialog-container" tabindex="-1" '+(t.hasTheme?'md-theme="'+a+'"':"")+">"+(n=e,t.autoWrap&&!/<\/md-dialog>/g.test(n)?"<md-dialog>"+(n||"")+"</md-dialog>":n||"")+"</div>"}};function v(e,t){var n="fixed"==p.getComputedStyle(d[0].body).position,o=t.backdrop?p.getComputedStyle(t.backdrop[0]):null,i=o?Math.min(d[0].body.clientHeight,Math.ceil(Math.abs(parseInt(o.height,10)))):0,a={top:e.css("top"),height:e.css("height")},r=Math.abs(t.parent[0].getBoundingClientRect().top);return e.css({top:(n?r:0)+"px",height:i?i+"px":"100%"}),function(){e.css(a)}}function C(e,t){if(-1!==t.indexOf(e.nodeName))return!0}}}t.$inject=["$$rAF","$mdTheming","$mdDialog"],n.$inject=["$$interimElementProvider"],y.module("material.components.dialog",["material.core","material.components.backdrop"]).directive("mdDialog",t).provider("$mdDialog",n)}(window,window.angular); |