vue-material/dist/components/mdMenu/index.js

8 lines
69 KiB
JavaScript
Raw Normal View History

2016-12-16 06:01:17 +00:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueMaterial=t():e.VueMaterial=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}({0:function(e,t,n){e.exports=n(21)},1:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=r(i);t.default={props:{mdTheme:String},data:function(){return{closestThemedParent:!1}},methods:{getClosestThemedParent:function(e){return!(!e||!e.$el||0===e._uid)&&(e.mdTheme||e.mdName?e:this.getClosestThemedParent(e.$parent))}},computed:{themeClass:function(){if(this.mdTheme)return"md-theme-"+this.mdTheme;var e=this.closestThemedParent.mdTheme;return e||(e=this.closestThemedParent.mdName),"md-theme-"+(e||o.default.material.currentTheme)}},mounted:function(){this.closestThemedParent=this.getClosestThemedParent(this.$parent),o.default.material.currentTheme||o.default.material.setCurrentTheme("default")}},e.exports=t.default},2:function(e,t,n){(function(t){/*!
* Vue.js v2.1.6
* (c) 2014-2016 Evan You
* Released under the MIT License.
*/
"use strict";function n(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function r(e){var t=parseFloat(e,10);return t||0===t?t:e}function i(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i<r.length;i++)n[r[i]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}function o(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}function a(e,t){return gn.call(e,t)}function s(e){return"string"==typeof e||"number"==typeof e}function u(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function l(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function c(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function d(e,t){for(var n in t)e[n]=t[n];return e}function f(e){return null!==e&&"object"==typeof e}function p(e){return $n.call(e)===xn}function h(e){for(var t={},n=0;n<e.length;n++)e[n]&&d(t,e[n]);return t}function v(){}function m(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}function g(e,t){return e==t||!(!f(e)||!f(t))&&JSON.stringify(e)===JSON.stringify(t)}function y(e,t){for(var n=0;n<e.length;n++)if(g(e[n],t))return n;return-1}function _(e){var t=(e+"").charCodeAt(0);return 36===t||95===t}function b(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function C(e){if(!Tn.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}function w(e){return/native code/.test(e.toString())}function $(e){qn.target&&Wn.push(qn.target),qn.target=e}function x(){qn.target=Wn.pop()}function k(e,t){e.__proto__=t}function A(e,t,n){for(var r=0,i=n.length;r<i;r++){var o=n[r];b(e,o,t[o])}}function O(e){if(f(e)){var t;return a(e,"__ob__")&&e.__ob__ instanceof Xn?t=e.__ob__:Jn.shouldConvert&&!In()&&(Array.isArray(e)||p(e))&&Object.isExtensible(e)&&!e._isVue&&(t=new Xn(e)),t}}function T(e,t,n,r){var i=new qn,o=Object.getOwnPropertyDescriptor(e,t);if(!o||o.configurable!==!1){var a=o&&o.get,s=o&&o.set,u=O(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=a?a.call(e):n;return qn.target&&(i.depend(),u&&u.dep.depend(),Array.isArray(t)&&j(t)),t},set:function(t){var o=a?a.call(e):n;t===o||t!==t&&o!==o||(r&&r(),s?s.call(e,t):n=t,u=O(t),i.notify())}})}}function E(e,t,n){if(Array.isArray(e))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(a(e,t))return void(e[t]=n);var r=e.__ob__;return e._isVue||r&&r.vmCount?void Hn("Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option."):r?(T(r.value,t,n),r.dep.notify(),n):void(e[t]=n)}function S(e,t){var n=e.__ob__;return e._isVue||n&&n.vmCount?void Hn("Avoid deleting properties on a Vue instance or its root $data - just set it to null."):void(a(e,t)&&(delete e[t],n&&n.dep.notify()))}function j(e){for(var t=void 0,n=0,r=e.length;n<r;n++)t=e[n],t&&t.__ob__&&t.__ob__.dep.depend(),Array.isArray(t)&&j(t)}function M(e,t){if(!t)return e;for(var n,r,i,o=Object.keys(t),s=0;s<o.length;s++)n=o[s],r=e[n],i=t[n],a(e,n)?p(r)&&p(i)&&M(r,i):E(e,n,i);return e}function L(e,t){return t?e?e.concat(t):Array.isArray(t)?t:[t]:e}function D(e,t){var n=Object.create(e||null);return t?d(n,t):n}function N(e){for(var t in e.components){var n=t.toLowerCase();(mn(n)||On.isReservedTag(n))&&Hn("Do not use built-in or reserved HTML elements as component id: "+t)}}function P(e){var t=e.props;if(t){var n,r,i,o={};if(Array.isArray(t))for(n=t.length;n--;)r=t[n],"string"==typeof r?(i=_n(r),o[i]={type:null}):Hn("props must be strings when using array syntax.");else if(p(t))for(var a in t)r=t[a],i=_n(a),o[i]=p(r)?r:{type:r};e.props=o}}function I(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}function R(e,t,n){function r(r){var i=Zn[r]||er;c[r]=i(e[r],t[r],n,r)}N(t),P(t),I(t);var i=t.extends;if(i&&(e="function"==typeof i?R(e,i.options,n):R(e,i,n)),t.mixins)for(var o=0,s=t.mixins
i.modifiers||(i.modifiers=Yr),n[kt(i)]=i,i.def=U(t.$options,"directives",i.name,!0);return n}function kt(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function At(e,t,n,r){var i=e.def&&e.def[t];i&&i(n.elm,e,n,r)}function Ot(e,t){if(e.data.attrs||t.data.attrs){var n,r,i,o=t.elm,a=e.data.attrs||{},s=t.data.attrs||{};s.__ob__&&(s=t.data.attrs=d({},s));for(n in s)r=s[n],i=a[n],i!==r&&Tt(o,n,r);Ln&&s.value!==a.value&&Tt(o,"value",s.value);for(n in a)null==s[n]&&(Nr(n)?o.removeAttributeNS(Dr,Pr(n)):Mr(n)||o.removeAttribute(n))}}function Tt(e,t,n){Lr(t)?Ir(n)?e.removeAttribute(t):e.setAttribute(t,t):Mr(t)?e.setAttribute(t,Ir(n)||"false"===n?"false":"true"):Nr(t)?Ir(n)?e.removeAttributeNS(Dr,Pr(t)):e.setAttributeNS(Dr,t,n):Ir(n)?e.removeAttribute(t):e.setAttribute(t,n)}function Et(e,t){var n=t.elm,r=t.data,i=e.data;if(r.staticClass||r.class||i&&(i.staticClass||i.class)){var o=Je(t),a=n._transitionClasses;a&&(o=Qe(o,et(a))),o!==n._prevClass&&(n.setAttribute("class",o),n._prevClass=o)}}function St(e,t,n,r){if(n){var i=t;t=function(n){jt(e,t,r),1===arguments.length?i(n):i.apply(null,arguments)}}Tr.addEventListener(e,t,r)}function jt(e,t,n){Tr.removeEventListener(e,t,n)}function Mt(e,t){if(e.data.on||t.data.on){var n=t.data.on||{},r=e.data.on||{};Tr=t.elm,Ae(n,r,St,jt,t.context)}}function Lt(e,t){if(e.data.domProps||t.data.domProps){var n,r,i=t.elm,o=e.data.domProps||{},a=t.data.domProps||{};a.__ob__&&(a=t.data.domProps=d({},a));for(n in o)null==a[n]&&(i[n]="");for(n in a)if(r=a[n],"textContent"!==n&&"innerHTML"!==n||(t.children&&(t.children.length=0),r!==o[n]))if("value"===n){i._value=r;var s=null==r?"":String(r);!i.composing&&(document.activeElement!==i&&i.value!==s||Dt(t,s))&&(i.value=s)}else i[n]=r}}function Dt(e,t){var n=e.elm.value,i=e.elm._vModifiers;return i&&i.number||"number"===e.elm.type?r(n)!==r(t):i&&i.trim?n.trim()!==t.trim():n!==t}function Nt(e){var t=Pt(e.style);return e.staticStyle?d(e.staticStyle,t):t}function Pt(e){return Array.isArray(e)?h(e):"string"==typeof e?ei(e):e}function It(e,t){var n,r={};if(t)for(var i=e;i.child;)i=i.child._vnode,i.data&&(n=Nt(i.data))&&d(r,n);(n=Nt(e.data))&&d(r,n);for(var o=e;o=o.parent;)o.data&&(n=Nt(o.data))&&d(r,n);return r}function Rt(e,t){var n=t.data,r=e.data;if(n.staticStyle||n.style||r.staticStyle||r.style){var i,o,a=t.elm,s=e.data.staticStyle,u=e.data.style||{},l=s||u,c=Pt(t.data.style)||{};t.data.style=c.__ob__?d({},c):c;var f=It(t,!0);for(o in l)null==f[o]&&ri(a,o,"");for(o in f)i=f[o],i!==l[o]&&ri(a,o,null==i?"":i)}}function Ut(e,t){if(t&&t.trim())if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+e.getAttribute("class")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function Ft(e,t){if(t&&t.trim())if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+e.getAttribute("class")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function Ht(e){hi(function(){hi(e)})}function Vt(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),Ut(e,t)}function zt(e,t){e._transitionClasses&&o(e._transitionClasses,t),Ft(e,t)}function Bt(e,t,n){var r=qt(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===ui?di:pi,u=0,l=function(){e.removeEventListener(s,c),n()},c=function(t){t.target===e&&++u>=a&&l()};setTimeout(function(){u<a&&l()},o+1),e.addEventListener(s,c)}function qt(e,t){var n,r=window.getComputedStyle(e),i=r[ci+"Delay"].split(", "),o=r[ci+"Duration"].split(", "),a=Wt(i,o),s=r[fi+"Delay"].split(", "),u=r[fi+"Duration"].split(", "),l=Wt(s,u),c=0,d=0;t===ui?a>0&&(n=ui,c=a,d=o.length):t===li?l>0&&(n=li,c=l,d=u.length):(c=Math.max(a,l),n=c>0?a>l?ui:li:null,d=n?n===ui?o.length:u.length:0);var f=n===ui&&vi.test(r[ci+"Property"]);return{type:n,timeout:c,propCount:d,hasTransform:f}}function Wt(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map(function(t,n){return Kt(t)+Kt(e[n])}))}function Kt(e){return 1e3
this.highlighted=!1,this.$parent.close()},highlightItem:function(e){this.oldHighlight=this.highlighted,"up"===e&&(1===this.highlighted?this.highlighted=this.itemsAmount:this.highlighted--),"down"===e&&(this.highlighted===this.itemsAmount?this.highlighted=1:this.highlighted++)},fireClick:function(){this.highlighted>0&&this.$children[0].$children[this.highlighted-1].$el.click()}},mounted:function(){if(!this.$parent.$el.classList.contains("md-menu"))throw this.$destroy(),new Error("You must wrap the md-menu-content in a md-menu")}},e.exports=t.default},67:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i);n(91),t.default={props:{disabled:Boolean},data:function(){return{parentContent:{},index:0}},computed:{classes:function(){return{"md-highlighted":this.highlighted}},highlighted:function(){return this.index===this.parentContent.highlighted&&(this.disabled&&(this.parentContent.oldHighlight>this.parentContent.highlighted?this.parentContent.highlighted--:this.parentContent.highlighted++),1===this.index?this.parentContent.$el.scrollTop=0:this.index===this.parentContent.itemsAmount?this.parentContent.$el.scrollTop=this.parentContent.$el.scrollHeight:this.$el.scrollIntoViewIfNeeded(!1),!0)}},methods:{close:function(e){this.disabled||(this.parentMenu.mdCloseOnSelect&&this.parentContent.close(),this.$emit("click"),this.$emit("selected",e))}},mounted:function(){if(this.parentContent=(0,o.default)(this.$parent,"md-menu-content"),this.parentMenu=(0,o.default)(this.$parent,"md-menu"),!this.parentContent)throw this.$destroy(),new Error("You must wrap the md-menu-item in a md-menu-content");this.parentContent.itemsAmount++,this.index=this.parentContent.itemsAmount}},e.exports=t.default},91:function(e,t){Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(e){e=0===arguments.length||!!e;var t=this.parentNode,n=window.getComputedStyle(t,null),r=parseInt(n.getPropertyValue("border-top-width")),i=parseInt(n.getPropertyValue("border-left-width")),o=this.offsetTop-t.offsetTop<t.scrollTop,a=this.offsetTop-t.offsetTop+this.clientHeight-r>t.scrollTop+t.clientHeight,s=this.offsetLeft-t.offsetLeft<t.scrollLeft,u=this.offsetLeft-t.offsetLeft+this.clientWidth-i>t.scrollLeft+t.clientWidth,l=o&&!a;(o||a)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-r+this.clientHeight/2),(s||u)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-i+this.clientWidth/2),(o||a||s||u)&&!e&&this.scrollIntoView(l)})},92:function(e,t){},128:function(e,t){e.exports=".THEME_NAME.md-menu-content{background-color:BACKGROUND-COLOR-A100;color:BACKGROUND-CONTRAST}.THEME_NAME.md-menu-content .md-menu-item:hover .md-button:not([disabled]),.THEME_NAME.md-menu-content .md-menu-item:focus .md-button:not([disabled]),.THEME_NAME.md-menu-content .md-menu-item.md-highlighted .md-button:not([disabled]){background-color:BACKGROUND-CONTRAST-0.12}.THEME_NAME.md-menu-content .md-menu-item[disabled]{color:BACKGROUND-CONTRAST-0.38}\n"},173:function(e,t,n){var r,i;n(92),r=n(65);var o=n(198);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,e.exports=r},174:function(e,t,n){var r,i;r=n(66);var o=n(222);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,e.exports=r},175:function(e,t,n){var r,i;r=n(67);var o=n(225);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,e.exports=r},198:function(e,t){e.exports={render:function(){var e=this,t=(e.$createElement,e._c);return t("div",{staticClass:"md-menu"},[e._t("default"),e._v(" "),t("md-backdrop",{ref:"backdrop",staticClass:"md-menu-backdrop md-transparent md-active",on:{close:e.close}})],!0)},staticRenderFns:[]}},222:function(e,t){e.exp