mirror of
https://github.com/tenrok/vue-context.git
synced 2026-05-31 23:14:03 +03:00
1 line
7.3 KiB
JavaScript
1 line
7.3 KiB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=n.n(o);n.d(t,"VueContext",function(){return r.a})},function(e,t,n){var o=n(8)(n(9),n(10),!1,function(e){n(3)},"data-v-18aeaae6",null);e.exports=o.exports},function(e,t,n){var o=n(4);"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals);n(6)("50ad4866",o,!0,{})},function(e,t,n){(e.exports=n(5)(!1)).push([e.i,".v-context[data-v-18aeaae6]{background:#fafafa;border:1px solid #bdbdbd;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);display:block;margin:0;padding:0;position:fixed;width:250px;z-index:99999}.v-context ul[data-v-18aeaae6]{list-style:none;padding:10px 0;margin:0;font-size:12px;font-weight:600}.v-context ul li[data-v-18aeaae6]{margin:0;padding:10px 35px;cursor:pointer}.v-context ul li[data-v-18aeaae6]:hover{background:#1e88e5;color:#fafafa}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(s=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"});return[n].concat(i).concat([r]).join("\n")}var s;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<e.length;r++){var s=e[r];"number"==typeof s[0]&&o[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(e,t,n){var o="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var r=n(7),i={},s=o&&(document.head||document.getElementsByTagName("head")[0]),a=null,l=0,c=!1,u=function(){},f=null,d="data-vue-ssr-id",p="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function h(e){for(var t=0;t<e.length;t++){var n=e[t],o=i[n.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](n.parts[r]);for(;r<n.parts.length;r++)o.parts.push(x(n.parts[r]));o.parts.length>n.parts.length&&(o.parts.length=n.parts.length)}else{var s=[];for(r=0;r<n.parts.length;r++)s.push(x(n.parts[r]));i[n.id]={id:n.id,refs:1,parts:s}}}}function v(){var e=document.createElement("style");return e.type="text/css",s.appendChild(e),e}function x(e){var t,n,o=document.querySelector("style["+d+'~="'+e.id+'"]');if(o){if(c)return u;o.parentNode.removeChild(o)}if(p){var r=l++;o=a||(a=v()),t=y.bind(null,o,r,!1),n=y.bind(null,o,r,!0)}else o=v(),t=function(e,t){var n=t.css,o=t.media,r=t.sourceMap;o&&e.setAttribute("media",o);f.ssrId&&e.setAttribute(d,t.id);r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,o),n=function(){o.parentNode.removeChild(o)};return t(e),function(o){if(o){if(o.css===e.css&&o.media===e.media&&o.sourceMap===e.sourceMap)return;t(e=o)}else n()}}e.exports=function(e,t,n,o){c=n,f=o||{};var s=r(e,t);return h(s),function(t){for(var n=[],o=0;o<s.length;o++){var a=s[o];(l=i[a.id]).refs--,n.push(l)}t?h(s=r(e,t)):s=[];for(o=0;o<n.length;o++){var l;if(0===(l=n[o]).refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete i[l.id]}}}};var m,g=(m=[],function(e,t){return m[e]=t,m.filter(Boolean).join("\n")});function y(e,t,n,o){var r=n?"":o.css;if(e.styleSheet)e.styleSheet.cssText=g(t,r);else{var i=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}},function(e,t){e.exports=function(e,t){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],s=i[0],a={id:e+":"+r,css:i[1],media:i[2],sourceMap:i[3]};o[s]?o[s].parts.push(a):n.push(o[s]={id:s,parts:[a]})}return n}},function(e,t){e.exports=function(e,t,n,o,r,i){var s,a=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(s=e,a=e.default);var c,u="function"==typeof a?a.options:a;if(t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),n&&(u.functional=!0),r&&(u._scopeId=r),i?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},u._ssrRegister=c):o&&(c=o),c){var f=u.functional,d=f?u.render:u.beforeCreate;f?(u._injectStyles=c,u.render=function(e,t){return c.call(t),d(e,t)}):u.beforeCreate=d?[].concat(d,c):[c]}return{esModule:s,exports:a,options:u}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{closeOnClick:{type:Boolean,default:!0},closeOnScroll:{type:Boolean,default:!0}},computed:{style:function(){return this.show?{top:this.top+"px",left:this.left+"px"}:null}},data:function(){return{top:null,left:null,show:!1,data:null}},mounted:function(){this.closeOnScroll&&this.addScrollEventListener()},beforeDestroy:function(){this.closeOnScroll&&this.removeScrollEventListener()},methods:{addScrollEventListener:function(){window.addEventListener("scroll",this.close)},close:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.top=null,this.left=null,this.data=null,this.show=!1,e&&this.$emit("close")},onClick:function(){this.closeOnClick&&this.close(!1)},open:function(e,t){var n=this;this.data=t,this.show=!0,this.$nextTick(function(){n.positionMenu(e.clientY,e.clientX),n.$el.focus(),n.$emit("open",e,n.data,n.top,n.left)})},positionMenu:function(e,t){var n=window.innerHeight-this.$el.offsetHeight-25,o=window.innerWidth-this.$el.offsetWidth-25;e>n&&(e=n),t>o&&(t=o),this.top=e,this.left=t},removeScrollEventListener:function(){window.removeEventListener("scroll",this.close)}},watch:{closeOnScroll:function(e,t){e!==t&&(e?this.addScrollEventListener():this.removeScrollEventListener())}}}},function(e,t){e.exports={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{directives:[{name:"show",rawName:"v-show",value:this.show,expression:"show"}],staticClass:"v-context",style:this.style,attrs:{tabindex:"-1"},on:{blur:this.close,click:this.onClick,"!contextmenu":function(e){e.preventDefault()}}},[this._t("default",null,{data:this.data})],2)},staticRenderFns:[]}}])}); |