🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@lqzh/vue-context-menu

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lqzh/vue-context-menu - npm Package Compare versions

Comparing version
2.0.3
to
2.0.4
+1140
dist/vue-context-menu.common.js
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 720:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".Contextmenu_menu_Oc4YL,.Contextmenu_menu_item_qlPAM,.Contextmenu_menu_item__clickable_uOLrt,.Contextmenu_menu_item__unClickable_CUj6v{box-sizing:border-box}", ""]);
// Exports
___CSS_LOADER_EXPORT___.locals = {
"menu": "Contextmenu_menu_Oc4YL",
"menu_item": "Contextmenu_menu_item_qlPAM",
"menu_item__clickable": "Contextmenu_menu_item__clickable_uOLrt",
"menu_item__unClickable": "Contextmenu_menu_item__unClickable_CUj6v"
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 258:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".menu[data-v-eaca9466]{position:fixed;box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);background:#fff;border-radius:4px;padding:8px 0}.menu_body[data-v-eaca9466]{display:block}.menu_item[data-v-eaca9466]{list-style:none;line-height:32px;padding:0 16px;margin:0;font-size:13px;outline:0;display:flex;align-items:center;transition:.2s;border-bottom:1px solid #00000000}.menu_item__divided[data-v-eaca9466]{border-bottom-color:#ebeef5}.menu_item .menu_item_icon[data-v-eaca9466]{margin-right:8px;width:13px}.menu_item .menu_item_label[data-v-eaca9466]{flex:1}.menu_item .menu_item_expand_icon[data-v-eaca9466]{margin-left:16px;font-size:6px;width:10px}.menu_item__available[data-v-eaca9466]{color:#606266;cursor:pointer}.menu_item__available[data-v-eaca9466]:hover{background:#ecf5ff;color:#409eff}.menu_item__disabled[data-v-eaca9466]{color:#c0c4cc;cursor:not-allowed}.menu_item_expand[data-v-eaca9466]{background:#ecf5ff;color:#409eff}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 758:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".contextmenu-submenu-fade-enter-active,.contextmenu-submenu-fade-leave-active{transition:opacity .1s}.contextmenu-submenu-fade-enter,.contextmenu-submenu-fade-leave-to{opacity:0}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 645:
/***/ ((module) => {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = "";
var needLayer = typeof item[5] !== "undefined";
if (item[4]) {
content += "@supports (".concat(item[4], ") {");
}
if (item[2]) {
content += "@media ".concat(item[2], " {");
}
if (needLayer) {
content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
}
content += cssWithMappingToString(item);
if (needLayer) {
content += "}";
}
if (item[2]) {
content += "}";
}
if (item[4]) {
content += "}";
}
return content;
}).join("");
}; // import a list of modules into the list
list.i = function i(modules, media, dedupe, supports, layer) {
if (typeof modules === "string") {
modules = [[null, modules, undefined]];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var k = 0; k < this.length; k++) {
var id = this[k][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _k = 0; _k < modules.length; _k++) {
var item = [].concat(modules[_k]);
if (dedupe && alreadyImportedModules[item[0]]) {
continue;
}
if (typeof layer !== "undefined") {
if (typeof item[5] === "undefined") {
item[5] = layer;
} else {
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
item[5] = layer;
}
}
if (media) {
if (!item[2]) {
item[2] = media;
} else {
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
item[2] = media;
}
}
if (supports) {
if (!item[4]) {
item[4] = "".concat(supports);
} else {
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
item[4] = supports;
}
}
list.push(item);
}
};
return list;
};
/***/ }),
/***/ 81:
/***/ ((module) => {
"use strict";
module.exports = function (i) {
return i[1];
};
/***/ }),
/***/ 996:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(720);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("5f59af02", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 992:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(258);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("7e7d2a34", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 84:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(758);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("fd795d48", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 402:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ addStylesClient)
});
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/listToStyles.js
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/addStylesClient.js
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
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."
) }
}
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
var options = null
var ssrIdKey = 'data-vue-ssr-id'
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
function addStylesClient (parentId, list, _isProduction, _options) {
isProduction = _isProduction
options = _options || {}
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (options.ssrId) {
styleElement.setAttribute(ssrIdKey, obj.id)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ __webpack_require__.p = "";
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ entry_lib)
});
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
/* eslint-disable no-var */
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (false) { var getCurrentScript; }
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ const setPublicPath = (null);
;// CONCATENATED MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
const external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject = require("vue");
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=template&id=5865adb0&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div')
}
var staticRenderFns = []
;// CONCATENATED MODULE: ./src/util.js
function getElementsByClassName(className) {
return Array.from(document.querySelectorAll(`.${className}`));
}
;// CONCATENATED MODULE: ./src/constant.js
const SUBMENU_X_OFFSET = 3;
const SUBMENU_Y_OFFSET = -8;
const SUBMENU_OPEN_TREND_LEFT = "left";
const SUBMENU_OPEN_TREND_RIGHT = "right";
const COMPONENT_NAME = "contextmenu-submenu";
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Contextmenuvue_type_script_lang_js_ = ({
name: 'vue-contextMenu-2',
mounted() {
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.mainMenuInstance = new SubmenuConstructor();
this.mainMenuInstance.items = this.items;
this.mainMenuInstance.commonClass = {
menu: this.$style.menu,
menuItem: this.$style.menu_item,
clickableMenuItem: this.$style.menu_item__clickable,
unClickableMenuItem: this.$style.menu_item__unClickable,
};
this.mainMenuInstance.position = {
x: this.position.x,
y: this.position.y,
width: 0,
height: 0,
};
this.mainMenuInstance.style.minWidth = this.style.minWidth;
this.mainMenuInstance.style.zIndex = this.style.zIndex;
this.mainMenuInstance.customClass = this.customClass;
this.mainMenuInstance.$mount();
document.body.appendChild(this.mainMenuInstance.$el);
this.addListener();
},
data: () => ({
items: [],
position: {
x: 0,
y: 0,
},
style: {
zIndex: 2,
minWidth: 150,
},
mainMenuInstance: null,
customClass: null,
mouseListening: false,
}),
methods: {
mousewheelListener() {
this.close();
},
mouseDownListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (!menus.find(m => m === el)) {
this.close();
}
},
mouseClickListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
const menuItems = getElementsByClassName(this.$style.menu_item);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && !menuItems.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (menuItems.find(m => m === el)) {
const unClickableMenuItems = getElementsByClassName(this.$style.menu_item__unClickable);
if (e.button !== 0 || unClickableMenuItems.find(m => m === el)) {
return;
}
this.close();
return;
}
if (!menus.find(m => m === el)) {
this.close();
}
},
addListener() {
if (!this.mouseListening) {
document.addEventListener('click', this.mouseClickListener);
document.addEventListener('mousedown', this.mouseDownListener);
document.addEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = true;
}
},
removeListener() {
if (this.mouseListening) {
document.removeEventListener('click', this.mouseClickListener);
document.removeEventListener('mousedown', this.mouseDownListener);
document.removeEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = false;
}
},
close() {
this.removeListener();
if (this.mainMenuInstance) {
this.mainMenuInstance.close();
this.mainMenuInstance = null;
}
this.$destroy();
if (this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
},
},
});
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Contextmenuvue_type_script_lang_js_ = (Contextmenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-11.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-11.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-11.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-11.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=style&index=0&id=5865adb0&prod&module=true&lang=css&
var Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_ = __webpack_require__(996);
var Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_default = /*#__PURE__*/__webpack_require__.n(Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_);
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=style&index=0&id=5865adb0&prod&module=true&lang=css&
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent(
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */,
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options =
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection(h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue
;
function injectStyles (context) {
this["$style"] = ((Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_default()).locals || (Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_default()))
}
/* normalize component */
var component = normalizeComponent(
components_Contextmenuvue_type_script_lang_js_,
render,
staticRenderFns,
false,
injectStyles,
null,
null
)
/* harmony default export */ const Contextmenu = (component.exports);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=template&id=eaca9466&scoped=true&
var Submenuvue_type_template_id_eaca9466_scoped_true_render = function render(){var _vm=this,_c=_vm._self._c;return _c('transition',{attrs:{"name":"contextmenu-submenu-fade"}},[(_vm.visible)?_c('div',{ref:"menu",class:['menu', _vm.customClass, _vm.commonClass.menu],style:({left: _vm.style.left + 'px', top: _vm.style.top + 'px', minWidth: _vm.style.minWidth + 'px', zIndex: _vm.style.zIndex}),on:{"contextmenu":function($event){$event.preventDefault();}}},[_c('div',{staticClass:"menu_body"},_vm._l((_vm.itemsShow),function(item,index){return _c('div',{key:item.label,staticClass:"menu_item",class:[
_vm.commonClass.menuItem,
(item.disabled || item.children) ? _vm.commonClass.unClickableMenuItem : _vm.commonClass.clickableMenuItem,
(item.children && _vm.activeSubmenu.index === index) ? 'menu_item_expand' : null,
item.divided ? 'menu_item__divided' : null,
item.disabled ? 'menu_item__disabled' : 'menu_item__available',
],on:{"click":function($event){(!item.disabled && ! item.children) && _vm.itemClick(item)},"mouseenter":function($event){!item.disabled && _vm.enterItem($event,item,index)}}},[(_vm.hasIcon)?_c('div',{staticClass:"menu_item_icon"},[(item.icon)?_c('i',{class:item.icon}):_vm._e()]):_vm._e(),_c('span',{staticClass:"menu_item_label"},[_vm._v(_vm._s(item.label))]),_c('div',{staticClass:"menu_item_expand_icon"},[_vm._v(_vm._s(item.children ? '▶' : ''))])])}),0)]):_vm._e()])
}
var Submenuvue_type_template_id_eaca9466_scoped_true_staticRenderFns = []
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Submenuvue_type_script_lang_js_ = ({
name: COMPONENT_NAME,
mounted() {
const windowWidth = document.documentElement.clientWidth;
const windowHeight = document.documentElement.clientHeight;
const menu = this.$refs.menu;
const menuWidth = menu.offsetWidth;
const menuHeight = menu.offsetHeight;
(this.openTrend === SUBMENU_OPEN_TREND_LEFT ? this.leftOpen : this.rightOpen)(
windowWidth,
windowHeight,
menuWidth,
);
this.style.top = this.position.y;
if (this.position.y + menuHeight > windowHeight) {
if (this.position.height === 0) {
this.style.top = this.position.y - menuHeight;
} else {
this.style.top = windowHeight - menuHeight;
}
if (this.style.top < 0) {
this.style.top = 0;
}
}
},
data: () => ({
commonClass: {
menu: null,
menuItem: null,
clickableMenuItem: null,
unClickableMenuItem: null,
},
activeSubmenu: {
index: null,
instance: null,
},
items: [],
position: {
x: 0,
y: 0,
width: 0,
height: 0,
},
style: {
left: 0,
top: 0,
zIndex: 2,
minWidth: 150,
},
customClass: null,
visible: true, // 默认打开
openTrend: SUBMENU_OPEN_TREND_RIGHT,
}),
computed: {
hasIcon() {
return this.itemsShow.some(v => v.icon);
},
itemsShow() {
return this.items.filter(v => !v.hidden);
},
},
methods: {
leftOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x - menuWidth;
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.style.left < 0) {
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.position.width === 0) {
this.style.left = 0;
} else {
this.style.left = this.position.x + this.position.width;
}
}
},
rightOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x + this.position.width;
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.style.left + menuWidth > windowWidth) {
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.position.width === 0) {
this.style.left = windowWidth - menuWidth;
} else {
this.style.left = this.position.x - menuWidth;
}
}
},
enterItem(e, item, index) {
if (!this.visible) {
return;
}
if (this.activeSubmenu.instance) {
if (this.activeSubmenu.index === index) {
return;
} else {
this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
}
if (!item.children) {
return;
}
const menuItemClientRect = e.target.getBoundingClientRect();
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.activeSubmenu.index = index;
this.activeSubmenu.instance = new SubmenuConstructor();
this.activeSubmenu.instance.items = item.children;
this.activeSubmenu.instance.openTrend = this.openTrend;
this.activeSubmenu.instance.commonClass = this.commonClass;
this.activeSubmenu.instance.position = {
x: menuItemClientRect.x + SUBMENU_X_OFFSET,
y: menuItemClientRect.y + SUBMENU_Y_OFFSET,
width: menuItemClientRect.width - 2 * SUBMENU_X_OFFSET,
height: menuItemClientRect.width,
};
this.activeSubmenu.instance.style.minWidth =
typeof item.minWidth === 'number' ? item.minWidth : this.style.minWidth;
this.activeSubmenu.instance.style.zIndex = this.style.zIndex;
this.activeSubmenu.instance.customClass =
typeof item.customClass === 'string' ? item.customClass : this.customClass;
this.activeSubmenu.instance.$mount();
document.body.appendChild(this.activeSubmenu.instance.$el);
},
itemClick(item) {
if (!this.visible) {
return;
}
if (item && !item.disabled && !item.hidden && typeof item.onClick === 'function') {
item.onClick();
return;
}
},
close() {
if (this.activeSubmenu.instance) {
this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
this.visible = false;
this.$destroy();
if (this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
},
},
});
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Submenuvue_type_script_lang_js_ = (Submenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=0&id=eaca9466&prod&scoped=true&lang=css&
var Submenuvue_type_style_index_0_id_eaca9466_prod_scoped_true_lang_css_ = __webpack_require__(992);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=0&id=eaca9466&prod&scoped=true&lang=css&
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=1&id=eaca9466&prod&lang=css&
var Submenuvue_type_style_index_1_id_eaca9466_prod_lang_css_ = __webpack_require__(84);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=1&id=eaca9466&prod&lang=css&
;// CONCATENATED MODULE: ./src/components/Submenu.vue
;
/* normalize component */
var Submenu_component = normalizeComponent(
components_Submenuvue_type_script_lang_js_,
Submenuvue_type_template_id_eaca9466_scoped_true_render,
Submenuvue_type_template_id_eaca9466_scoped_true_staticRenderFns,
false,
null,
"eaca9466",
null
)
/* harmony default export */ const Submenu = (Submenu_component.exports);
;// CONCATENATED MODULE: ./src/index.js
const ContextmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend(Contextmenu);
external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME, Submenu);
function install(v) {
let lastInstance = null;
const ContextmenuProxy = function (options) {
let instance = new ContextmenuConstructor();
instance.items = options.items;
instance.position.x = options.x || 0;
instance.position.y = options.y || 0;
if (options.event) {
instance.position.x = options.event.clientX;
instance.position.y = options.event.clientY;
}
instance.customClass = options.customClass;
options.minWidth && (instance.style.minWidth = options.minWidth);
options.zIndex && (instance.style.zIndex = options.zIndex);
ContextmenuProxy.destroy();
lastInstance = instance;
instance.$mount();
};
ContextmenuProxy.destroy = function () {
if (lastInstance) {
lastInstance.close();
lastInstance = null;
}
};
v.prototype.$contextmenu = ContextmenuProxy;
}
if (window && window.Vue) {
install(window.Vue);
}
/* harmony default export */ const src_0 = ({
install,
});
;// CONCATENATED MODULE: ./index.js
/* harmony default export */ const index = (src_0);
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
/* harmony default export */ const entry_lib = (index);
})();
module.exports = __webpack_exports__;
/******/ })()
;
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["vue-context-menu"] = factory(require("vue"));
else
root["vue-context-menu"] = factory(root["Vue"]);
})((typeof self !== 'undefined' ? self : this), (__WEBPACK_EXTERNAL_MODULE__203__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 124:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".Contextmenu_menu_Oc4YL,.Contextmenu_menu_item_qlPAM,.Contextmenu_menu_item__clickable_uOLrt,.Contextmenu_menu_item__unClickable_CUj6v{box-sizing:border-box}", ""]);
// Exports
___CSS_LOADER_EXPORT___.locals = {
"menu": "Contextmenu_menu_Oc4YL",
"menu_item": "Contextmenu_menu_item_qlPAM",
"menu_item__clickable": "Contextmenu_menu_item__clickable_uOLrt",
"menu_item__unClickable": "Contextmenu_menu_item__unClickable_CUj6v"
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 331:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".menu[data-v-eaca9466]{position:fixed;box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);background:#fff;border-radius:4px;padding:8px 0}.menu_body[data-v-eaca9466]{display:block}.menu_item[data-v-eaca9466]{list-style:none;line-height:32px;padding:0 16px;margin:0;font-size:13px;outline:0;display:flex;align-items:center;transition:.2s;border-bottom:1px solid #00000000}.menu_item__divided[data-v-eaca9466]{border-bottom-color:#ebeef5}.menu_item .menu_item_icon[data-v-eaca9466]{margin-right:8px;width:13px}.menu_item .menu_item_label[data-v-eaca9466]{flex:1}.menu_item .menu_item_expand_icon[data-v-eaca9466]{margin-left:16px;font-size:6px;width:10px}.menu_item__available[data-v-eaca9466]{color:#606266;cursor:pointer}.menu_item__available[data-v-eaca9466]:hover{background:#ecf5ff;color:#409eff}.menu_item__disabled[data-v-eaca9466]{color:#c0c4cc;cursor:not-allowed}.menu_item_expand[data-v-eaca9466]{background:#ecf5ff;color:#409eff}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 675:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".contextmenu-submenu-fade-enter-active,.contextmenu-submenu-fade-leave-active{transition:opacity .1s}.contextmenu-submenu-fade-enter,.contextmenu-submenu-fade-leave-to{opacity:0}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 645:
/***/ ((module) => {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = "";
var needLayer = typeof item[5] !== "undefined";
if (item[4]) {
content += "@supports (".concat(item[4], ") {");
}
if (item[2]) {
content += "@media ".concat(item[2], " {");
}
if (needLayer) {
content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
}
content += cssWithMappingToString(item);
if (needLayer) {
content += "}";
}
if (item[2]) {
content += "}";
}
if (item[4]) {
content += "}";
}
return content;
}).join("");
}; // import a list of modules into the list
list.i = function i(modules, media, dedupe, supports, layer) {
if (typeof modules === "string") {
modules = [[null, modules, undefined]];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var k = 0; k < this.length; k++) {
var id = this[k][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _k = 0; _k < modules.length; _k++) {
var item = [].concat(modules[_k]);
if (dedupe && alreadyImportedModules[item[0]]) {
continue;
}
if (typeof layer !== "undefined") {
if (typeof item[5] === "undefined") {
item[5] = layer;
} else {
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
item[5] = layer;
}
}
if (media) {
if (!item[2]) {
item[2] = media;
} else {
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
item[2] = media;
}
}
if (supports) {
if (!item[4]) {
item[4] = "".concat(supports);
} else {
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
item[4] = supports;
}
}
list.push(item);
}
};
return list;
};
/***/ }),
/***/ 81:
/***/ ((module) => {
"use strict";
module.exports = function (i) {
return i[1];
};
/***/ }),
/***/ 885:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(124);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("cce2dd0a", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 733:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(331);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("59038fe2", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 180:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(675);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("1fb81058", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 402:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ addStylesClient)
});
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/listToStyles.js
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/addStylesClient.js
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
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."
) }
}
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
var options = null
var ssrIdKey = 'data-vue-ssr-id'
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
function addStylesClient (parentId, list, _isProduction, _options) {
isProduction = _isProduction
options = _options || {}
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (options.ssrId) {
styleElement.setAttribute(ssrIdKey, obj.id)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/***/ 203:
/***/ ((module) => {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__203__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ __webpack_require__.p = "";
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ entry_lib)
});
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
/* eslint-disable no-var */
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (false) { var getCurrentScript; }
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ const setPublicPath = (null);
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(203);
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=template&id=5865adb0&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div')
}
var staticRenderFns = []
;// CONCATENATED MODULE: ./src/util.js
function getElementsByClassName(className) {
return Array.from(document.querySelectorAll(`.${className}`));
}
;// CONCATENATED MODULE: ./src/constant.js
const SUBMENU_X_OFFSET = 3;
const SUBMENU_Y_OFFSET = -8;
const SUBMENU_OPEN_TREND_LEFT = "left";
const SUBMENU_OPEN_TREND_RIGHT = "right";
const COMPONENT_NAME = "contextmenu-submenu";
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Contextmenuvue_type_script_lang_js_ = ({
name: 'vue-contextMenu-2',
mounted() {
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.mainMenuInstance = new SubmenuConstructor();
this.mainMenuInstance.items = this.items;
this.mainMenuInstance.commonClass = {
menu: this.$style.menu,
menuItem: this.$style.menu_item,
clickableMenuItem: this.$style.menu_item__clickable,
unClickableMenuItem: this.$style.menu_item__unClickable,
};
this.mainMenuInstance.position = {
x: this.position.x,
y: this.position.y,
width: 0,
height: 0,
};
this.mainMenuInstance.style.minWidth = this.style.minWidth;
this.mainMenuInstance.style.zIndex = this.style.zIndex;
this.mainMenuInstance.customClass = this.customClass;
this.mainMenuInstance.$mount();
document.body.appendChild(this.mainMenuInstance.$el);
this.addListener();
},
data: () => ({
items: [],
position: {
x: 0,
y: 0,
},
style: {
zIndex: 2,
minWidth: 150,
},
mainMenuInstance: null,
customClass: null,
mouseListening: false,
}),
methods: {
mousewheelListener() {
this.close();
},
mouseDownListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (!menus.find(m => m === el)) {
this.close();
}
},
mouseClickListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
const menuItems = getElementsByClassName(this.$style.menu_item);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && !menuItems.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (menuItems.find(m => m === el)) {
const unClickableMenuItems = getElementsByClassName(this.$style.menu_item__unClickable);
if (e.button !== 0 || unClickableMenuItems.find(m => m === el)) {
return;
}
this.close();
return;
}
if (!menus.find(m => m === el)) {
this.close();
}
},
addListener() {
if (!this.mouseListening) {
document.addEventListener('click', this.mouseClickListener);
document.addEventListener('mousedown', this.mouseDownListener);
document.addEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = true;
}
},
removeListener() {
if (this.mouseListening) {
document.removeEventListener('click', this.mouseClickListener);
document.removeEventListener('mousedown', this.mouseDownListener);
document.removeEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = false;
}
},
close() {
this.removeListener();
if (this.mainMenuInstance) {
this.mainMenuInstance.close();
this.mainMenuInstance = null;
}
this.$destroy();
if (this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
},
},
});
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Contextmenuvue_type_script_lang_js_ = (Contextmenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-51.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-51.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-51.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-51.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=style&index=0&id=5865adb0&prod&module=true&lang=css&
var Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_ = __webpack_require__(885);
var Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_default = /*#__PURE__*/__webpack_require__.n(Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_);
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=style&index=0&id=5865adb0&prod&module=true&lang=css&
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent(
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */,
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options =
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection(h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue
;
function injectStyles (context) {
this["$style"] = ((Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_default()).locals || (Contextmenuvue_type_style_index_0_id_5865adb0_prod_module_true_lang_css_default()))
}
/* normalize component */
var component = normalizeComponent(
components_Contextmenuvue_type_script_lang_js_,
render,
staticRenderFns,
false,
injectStyles,
null,
null
)
/* harmony default export */ const Contextmenu = (component.exports);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=template&id=eaca9466&scoped=true&
var Submenuvue_type_template_id_eaca9466_scoped_true_render = function render(){var _vm=this,_c=_vm._self._c;return _c('transition',{attrs:{"name":"contextmenu-submenu-fade"}},[(_vm.visible)?_c('div',{ref:"menu",class:['menu', _vm.customClass, _vm.commonClass.menu],style:({left: _vm.style.left + 'px', top: _vm.style.top + 'px', minWidth: _vm.style.minWidth + 'px', zIndex: _vm.style.zIndex}),on:{"contextmenu":function($event){$event.preventDefault();}}},[_c('div',{staticClass:"menu_body"},_vm._l((_vm.itemsShow),function(item,index){return _c('div',{key:item.label,staticClass:"menu_item",class:[
_vm.commonClass.menuItem,
(item.disabled || item.children) ? _vm.commonClass.unClickableMenuItem : _vm.commonClass.clickableMenuItem,
(item.children && _vm.activeSubmenu.index === index) ? 'menu_item_expand' : null,
item.divided ? 'menu_item__divided' : null,
item.disabled ? 'menu_item__disabled' : 'menu_item__available',
],on:{"click":function($event){(!item.disabled && ! item.children) && _vm.itemClick(item)},"mouseenter":function($event){!item.disabled && _vm.enterItem($event,item,index)}}},[(_vm.hasIcon)?_c('div',{staticClass:"menu_item_icon"},[(item.icon)?_c('i',{class:item.icon}):_vm._e()]):_vm._e(),_c('span',{staticClass:"menu_item_label"},[_vm._v(_vm._s(item.label))]),_c('div',{staticClass:"menu_item_expand_icon"},[_vm._v(_vm._s(item.children ? '▶' : ''))])])}),0)]):_vm._e()])
}
var Submenuvue_type_template_id_eaca9466_scoped_true_staticRenderFns = []
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Submenuvue_type_script_lang_js_ = ({
name: COMPONENT_NAME,
mounted() {
const windowWidth = document.documentElement.clientWidth;
const windowHeight = document.documentElement.clientHeight;
const menu = this.$refs.menu;
const menuWidth = menu.offsetWidth;
const menuHeight = menu.offsetHeight;
(this.openTrend === SUBMENU_OPEN_TREND_LEFT ? this.leftOpen : this.rightOpen)(
windowWidth,
windowHeight,
menuWidth,
);
this.style.top = this.position.y;
if (this.position.y + menuHeight > windowHeight) {
if (this.position.height === 0) {
this.style.top = this.position.y - menuHeight;
} else {
this.style.top = windowHeight - menuHeight;
}
if (this.style.top < 0) {
this.style.top = 0;
}
}
},
data: () => ({
commonClass: {
menu: null,
menuItem: null,
clickableMenuItem: null,
unClickableMenuItem: null,
},
activeSubmenu: {
index: null,
instance: null,
},
items: [],
position: {
x: 0,
y: 0,
width: 0,
height: 0,
},
style: {
left: 0,
top: 0,
zIndex: 2,
minWidth: 150,
},
customClass: null,
visible: true, // 默认打开
openTrend: SUBMENU_OPEN_TREND_RIGHT,
}),
computed: {
hasIcon() {
return this.itemsShow.some(v => v.icon);
},
itemsShow() {
return this.items.filter(v => !v.hidden);
},
},
methods: {
leftOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x - menuWidth;
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.style.left < 0) {
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.position.width === 0) {
this.style.left = 0;
} else {
this.style.left = this.position.x + this.position.width;
}
}
},
rightOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x + this.position.width;
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.style.left + menuWidth > windowWidth) {
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.position.width === 0) {
this.style.left = windowWidth - menuWidth;
} else {
this.style.left = this.position.x - menuWidth;
}
}
},
enterItem(e, item, index) {
if (!this.visible) {
return;
}
if (this.activeSubmenu.instance) {
if (this.activeSubmenu.index === index) {
return;
} else {
this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
}
if (!item.children) {
return;
}
const menuItemClientRect = e.target.getBoundingClientRect();
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.activeSubmenu.index = index;
this.activeSubmenu.instance = new SubmenuConstructor();
this.activeSubmenu.instance.items = item.children;
this.activeSubmenu.instance.openTrend = this.openTrend;
this.activeSubmenu.instance.commonClass = this.commonClass;
this.activeSubmenu.instance.position = {
x: menuItemClientRect.x + SUBMENU_X_OFFSET,
y: menuItemClientRect.y + SUBMENU_Y_OFFSET,
width: menuItemClientRect.width - 2 * SUBMENU_X_OFFSET,
height: menuItemClientRect.width,
};
this.activeSubmenu.instance.style.minWidth =
typeof item.minWidth === 'number' ? item.minWidth : this.style.minWidth;
this.activeSubmenu.instance.style.zIndex = this.style.zIndex;
this.activeSubmenu.instance.customClass =
typeof item.customClass === 'string' ? item.customClass : this.customClass;
this.activeSubmenu.instance.$mount();
document.body.appendChild(this.activeSubmenu.instance.$el);
},
itemClick(item) {
if (!this.visible) {
return;
}
if (item && !item.disabled && !item.hidden && typeof item.onClick === 'function') {
item.onClick();
return;
}
},
close() {
if (this.activeSubmenu.instance) {
this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
this.visible = false;
this.$destroy();
if (this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
},
},
});
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Submenuvue_type_script_lang_js_ = (Submenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-52.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-52.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=0&id=eaca9466&prod&scoped=true&lang=css&
var Submenuvue_type_style_index_0_id_eaca9466_prod_scoped_true_lang_css_ = __webpack_require__(733);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=0&id=eaca9466&prod&scoped=true&lang=css&
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-52.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-52.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=1&id=eaca9466&prod&lang=css&
var Submenuvue_type_style_index_1_id_eaca9466_prod_lang_css_ = __webpack_require__(180);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=1&id=eaca9466&prod&lang=css&
;// CONCATENATED MODULE: ./src/components/Submenu.vue
;
/* normalize component */
var Submenu_component = normalizeComponent(
components_Submenuvue_type_script_lang_js_,
Submenuvue_type_template_id_eaca9466_scoped_true_render,
Submenuvue_type_template_id_eaca9466_scoped_true_staticRenderFns,
false,
null,
"eaca9466",
null
)
/* harmony default export */ const Submenu = (Submenu_component.exports);
;// CONCATENATED MODULE: ./src/index.js
const ContextmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend(Contextmenu);
external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME, Submenu);
function install(v) {
let lastInstance = null;
const ContextmenuProxy = function (options) {
let instance = new ContextmenuConstructor();
instance.items = options.items;
instance.position.x = options.x || 0;
instance.position.y = options.y || 0;
if (options.event) {
instance.position.x = options.event.clientX;
instance.position.y = options.event.clientY;
}
instance.customClass = options.customClass;
options.minWidth && (instance.style.minWidth = options.minWidth);
options.zIndex && (instance.style.zIndex = options.zIndex);
ContextmenuProxy.destroy();
lastInstance = instance;
instance.$mount();
};
ContextmenuProxy.destroy = function () {
if (lastInstance) {
lastInstance.close();
lastInstance = null;
}
};
v.prototype.$contextmenu = ContextmenuProxy;
}
if (window && window.Vue) {
install(window.Vue);
}
/* harmony default export */ const src_0 = ({
install,
});
;// CONCATENATED MODULE: ./index.js
/* harmony default export */ const index = (src_0);
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
/* harmony default export */ const entry_lib = (index);
})();
/******/ return __webpack_exports__;
/******/ })()
;
});
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-context-menu"]=t(require("vue")):e["vue-context-menu"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(e=>(()=>{var t={726:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l});var i=n(81),s=n.n(i),o=n(645),a=n.n(o),u=a()(s());u.push([e.id,".Contextmenu_menu_Oc4YL,.Contextmenu_menu_item_qlPAM,.Contextmenu_menu_item__clickable_uOLrt,.Contextmenu_menu_item__unClickable_CUj6v{box-sizing:border-box}",""]),u.locals={menu:"Contextmenu_menu_Oc4YL",menu_item:"Contextmenu_menu_item_qlPAM",menu_item__clickable:"Contextmenu_menu_item__clickable_uOLrt",menu_item__unClickable:"Contextmenu_menu_item__unClickable_CUj6v"};const l=u},318:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l});var i=n(81),s=n.n(i),o=n(645),a=n.n(o),u=a()(s());u.push([e.id,".menu[data-v-eaca9466]{position:fixed;box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);background:#fff;border-radius:4px;padding:8px 0}.menu_body[data-v-eaca9466]{display:block}.menu_item[data-v-eaca9466]{list-style:none;line-height:32px;padding:0 16px;margin:0;font-size:13px;outline:0;display:flex;align-items:center;transition:.2s;border-bottom:1px solid #00000000}.menu_item__divided[data-v-eaca9466]{border-bottom-color:#ebeef5}.menu_item .menu_item_icon[data-v-eaca9466]{margin-right:8px;width:13px}.menu_item .menu_item_label[data-v-eaca9466]{flex:1}.menu_item .menu_item_expand_icon[data-v-eaca9466]{margin-left:16px;font-size:6px;width:10px}.menu_item__available[data-v-eaca9466]{color:#606266;cursor:pointer}.menu_item__available[data-v-eaca9466]:hover{background:#ecf5ff;color:#409eff}.menu_item__disabled[data-v-eaca9466]{color:#c0c4cc;cursor:not-allowed}.menu_item_expand[data-v-eaca9466]{background:#ecf5ff;color:#409eff}",""]);const l=u},662:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l});var i=n(81),s=n.n(i),o=n(645),a=n.n(o),u=a()(s());u.push([e.id,".contextmenu-submenu-fade-enter-active,.contextmenu-submenu-fade-leave-active{transition:opacity .1s}.contextmenu-submenu-fade-enter,.contextmenu-submenu-fade-leave-to{opacity:0}",""]);const l=u},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i="undefined"!==typeof t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,s,o){"string"===typeof e&&(e=[[null,e,void 0]]);var a={};if(i)for(var u=0;u<this.length;u++){var l=this[u][0];null!=l&&(a[l]=!0)}for(var r=0;r<e.length;r++){var c=[].concat(e[r]);i&&a[c[0]]||("undefined"!==typeof o&&("undefined"===typeof c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),t.push(c))}},t}},81:e=>{"use strict";e.exports=function(e){return e[1]}},248:(e,t,n)=>{var i=n(726);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var s=n(402).Z;s("62c9fa77",i,!0,{sourceMap:!1,shadowMode:!1})},471:(e,t,n)=>{var i=n(318);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var s=n(402).Z;s("1d749644",i,!0,{sourceMap:!1,shadowMode:!1})},899:(e,t,n)=>{var i=n(662);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var s=n(402).Z;s("83a66158",i,!0,{sourceMap:!1,shadowMode:!1})},402:(e,t,n)=>{"use strict";function i(e,t){for(var n=[],i={},s=0;s<t.length;s++){var o=t[s],a=o[0],u=o[1],l=o[2],r=o[3],c={id:e+":"+s,css:u,media:l,sourceMap:r};i[a]?i[a].parts.push(c):n.push(i[a]={id:a,parts:[c]})}return n}n.d(t,{Z:()=>p});var s="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!s)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 o={},a=s&&(document.head||document.getElementsByTagName("head")[0]),u=null,l=0,r=!1,c=function(){},d=null,m="data-vue-ssr-id",h="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function p(e,t,n,s){r=n,d=s||{};var a=i(e,t);return f(a),function(t){for(var n=[],s=0;s<a.length;s++){var u=a[s],l=o[u.id];l.refs--,n.push(l)}t?(a=i(e,t),f(a)):a=[];for(s=0;s<n.length;s++){l=n[s];if(0===l.refs){for(var r=0;r<l.parts.length;r++)l.parts[r]();delete o[l.id]}}}}function f(e){for(var t=0;t<e.length;t++){var n=e[t],i=o[n.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](n.parts[s]);for(;s<n.parts.length;s++)i.parts.push(_(n.parts[s]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var a=[];for(s=0;s<n.parts.length;s++)a.push(_(n.parts[s]));o[n.id]={id:n.id,refs:1,parts:a}}}}function v(){var e=document.createElement("style");return e.type="text/css",a.appendChild(e),e}function _(e){var t,n,i=document.querySelector("style["+m+'~="'+e.id+'"]');if(i){if(r)return c;i.parentNode.removeChild(i)}if(h){var s=l++;i=u||(u=v()),t=b.bind(null,i,s,!1),n=b.bind(null,i,s,!0)}else i=v(),t=x.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}var y=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function b(e,t,n,i){var s=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=y(t,s);else{var o=document.createTextNode(s),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function x(e,t){var n=t.css,i=t.media,s=t.sourceMap;if(i&&e.setAttribute("media",i),d.ssrId&&e.setAttribute(m,t.id),s&&(n+="\n/*# sourceURL="+s.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{while(e.firstChild)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}},203:t=>{"use strict";t.exports=e}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var o=n[e]={id:e,exports:{}};return t[e](o,o.exports,i),o.exports}(()=>{i.n=e=>{var t=e&&e.__esModule?()=>e["default"]:()=>e;return i.d(t,{a:t}),t}})(),(()=>{i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{i.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),(()=>{i.p=""})();var s={};return(()=>{"use strict";if(i.r(s),i.d(s,{default:()=>O}),"undefined"!==typeof window){var e=window.document.currentScript,t=e&&e.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);t&&(i.p=t[1])}var n=i(203),o=i.n(n),a=function(){var e=this,t=e._self._c;return t("div")},u=[];function l(e){return Array.from(document.querySelectorAll(`.${e}`))}const r=3,c=-8,d="left",m="right",h="contextmenu-submenu",p={name:"vue-contextMenu-2",mounted(){const e=o().component(h);this.mainMenuInstance=new e,this.mainMenuInstance.items=this.items,this.mainMenuInstance.commonClass={menu:this.$style.menu,menuItem:this.$style.menu_item,clickableMenuItem:this.$style.menu_item__clickable,unClickableMenuItem:this.$style.menu_item__unClickable},this.mainMenuInstance.position={x:this.position.x,y:this.position.y,width:0,height:0},this.mainMenuInstance.style.minWidth=this.style.minWidth,this.mainMenuInstance.style.zIndex=this.style.zIndex,this.mainMenuInstance.customClass=this.customClass,this.mainMenuInstance.$mount(),document.body.appendChild(this.mainMenuInstance.$el),this.addListener()},data:()=>({items:[],position:{x:0,y:0},style:{zIndex:2,minWidth:150},mainMenuInstance:null,customClass:null,mouseListening:!1}),methods:{mousewheelListener(){this.close()},mouseDownListener(e){let t=e.target;const n=l(this.$style.menu);while(!n.find((e=>e===t))&&t.parentElement)t=t.parentElement;n.find((e=>e===t))||this.close()},mouseClickListener(e){let t=e.target;const n=l(this.$style.menu),i=l(this.$style.menu_item);while(!n.find((e=>e===t))&&!i.find((e=>e===t))&&t.parentElement)t=t.parentElement;if(i.find((e=>e===t))){const n=l(this.$style.menu_item__unClickable);if(0!==e.button||n.find((e=>e===t)))return;this.close()}else n.find((e=>e===t))||this.close()},addListener(){this.mouseListening||(document.addEventListener("click",this.mouseClickListener),document.addEventListener("mousedown",this.mouseDownListener),document.addEventListener("mousewheel",this.mousewheelListener),this.mouseListening=!0)},removeListener(){this.mouseListening&&(document.removeEventListener("click",this.mouseClickListener),document.removeEventListener("mousedown",this.mouseDownListener),document.removeEventListener("mousewheel",this.mousewheelListener),this.mouseListening=!1)},close(){this.removeListener(),this.mainMenuInstance&&(this.mainMenuInstance.close(),this.mainMenuInstance=null),this.$destroy(),this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}}},f=p;var v=i(248),_=i.n(v);function y(e,t,n,i,s,o,a,u){var l,r="function"===typeof e?e.options:e;if(t&&(r.render=t,r.staticRenderFns=n,r._compiled=!0),i&&(r.functional=!0),o&&(r._scopeId="data-v-"+o),a?(l=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},r._ssrRegister=l):s&&(l=u?function(){s.call(this,(r.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(r.functional){r._injectStyles=l;var c=r.render;r.render=function(e,t){return l.call(t),c(e,t)}}else{var d=r.beforeCreate;r.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:r}}function b(e){this["$style"]=_().locals||_()}var x=y(f,a,u,!1,b,null,null);const g=x.exports;var C=function(){var e=this,t=e._self._c;return t("transition",{attrs:{name:"contextmenu-submenu-fade"}},[e.visible?t("div",{ref:"menu",class:["menu",e.customClass,e.commonClass.menu],style:{left:e.style.left+"px",top:e.style.top+"px",minWidth:e.style.minWidth+"px",zIndex:e.style.zIndex},on:{contextmenu:function(e){e.preventDefault()}}},[t("div",{staticClass:"menu_body"},e._l(e.itemsShow,(function(n,i){return t("div",{key:n.label,staticClass:"menu_item",class:[e.commonClass.menuItem,n.disabled||n.children?e.commonClass.unClickableMenuItem:e.commonClass.clickableMenuItem,n.children&&e.activeSubmenu.index===i?"menu_item_expand":null,n.divided?"menu_item__divided":null,n.disabled?"menu_item__disabled":"menu_item__available"],on:{click:function(t){!n.disabled&&!n.children&&e.itemClick(n)},mouseenter:function(t){!n.disabled&&e.enterItem(t,n,i)}}},[e.hasIcon?t("div",{staticClass:"menu_item_icon"},[n.icon?t("i",{class:n.icon}):e._e()]):e._e(),t("span",{staticClass:"menu_item_label"},[e._v(e._s(n.label))]),t("div",{staticClass:"menu_item_expand_icon"},[e._v(e._s(n.children?"▶":""))])])})),0)]):e._e()])},w=[];const S={name:h,mounted(){const e=document.documentElement.clientWidth,t=document.documentElement.clientHeight,n=this.$refs.menu,i=n.offsetWidth,s=n.offsetHeight;(this.openTrend===d?this.leftOpen:this.rightOpen)(e,t,i),this.style.top=this.position.y,this.position.y+s>t&&(0===this.position.height?this.style.top=this.position.y-s:this.style.top=t-s,this.style.top<0&&(this.style.top=0))},data:()=>({commonClass:{menu:null,menuItem:null,clickableMenuItem:null,unClickableMenuItem:null},activeSubmenu:{index:null,instance:null},items:[],position:{x:0,y:0,width:0,height:0},style:{left:0,top:0,zIndex:2,minWidth:150},customClass:null,visible:!0,openTrend:m}),computed:{hasIcon(){return this.itemsShow.some((e=>e.icon))},itemsShow(){return this.items.filter((e=>!e.hidden))}},methods:{leftOpen(e,t,n){this.style.left=this.position.x-n,this.openTrend=d,this.style.left<0&&(this.openTrend=m,0===this.position.width?this.style.left=0:this.style.left=this.position.x+this.position.width)},rightOpen(e,t,n){this.style.left=this.position.x+this.position.width,this.openTrend=m,this.style.left+n>e&&(this.openTrend=d,0===this.position.width?this.style.left=e-n:this.style.left=this.position.x-n)},enterItem(e,t,n){if(!this.visible)return;if(this.activeSubmenu.instance){if(this.activeSubmenu.index===n)return;this.activeSubmenu.instance.close(),this.activeSubmenu.instance=null,this.activeSubmenu.index=null}if(!t.children)return;const i=e.target.getBoundingClientRect(),s=o().component(h);this.activeSubmenu.index=n,this.activeSubmenu.instance=new s,this.activeSubmenu.instance.items=t.children,this.activeSubmenu.instance.openTrend=this.openTrend,this.activeSubmenu.instance.commonClass=this.commonClass,this.activeSubmenu.instance.position={x:i.x+r,y:i.y+c,width:i.width-2*r,height:i.width},this.activeSubmenu.instance.style.minWidth="number"===typeof t.minWidth?t.minWidth:this.style.minWidth,this.activeSubmenu.instance.style.zIndex=this.style.zIndex,this.activeSubmenu.instance.customClass="string"===typeof t.customClass?t.customClass:this.customClass,this.activeSubmenu.instance.$mount(),document.body.appendChild(this.activeSubmenu.instance.$el)},itemClick(e){this.visible&&(!e||e.disabled||e.hidden||"function"!==typeof e.onClick||e.onClick())},close(){this.activeSubmenu.instance&&(this.activeSubmenu.instance.close(),this.activeSubmenu.instance=null,this.activeSubmenu.index=null),this.visible=!1,this.$destroy(),this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}}},I=S;i(471),i(899);var M=y(I,C,w,!1,null,"eaca9466",null);const $=M.exports,k=o().extend(g);function L(e){let t=null;const n=function(e){let i=new k;i.items=e.items,i.position.x=e.x||0,i.position.y=e.y||0,e.event&&(i.position.x=e.event.clientX,i.position.y=e.event.clientY),i.customClass=e.customClass,e.minWidth&&(i.style.minWidth=e.minWidth),e.zIndex&&(i.style.zIndex=e.zIndex),n.destroy(),t=i,i.$mount()};n.destroy=function(){t&&(t.close(),t=null)},e.prototype.$contextmenu=n}o().component(h,$),window&&window.Vue&&L(window.Vue);const E={install:L},T=E,O=T})(),s})()));
+1
-1

@@ -1,1 +0,1 @@

<!doctype html><meta charset="utf-8"><title>vue-context-menu-popup demo</title><script src="./vue-context-menu-popup.umd.js"></script><script>console.log(vue-context-menu-popup)</script>
<!doctype html><meta charset="utf-8"><title>vue-context-menu demo</title><script src="./vue-context-menu.umd.js"></script><script>console.log(vue-context-menu)</script>
{
"name": "@lqzh/vue-context-menu",
"version": "2.0.3",
"version": "2.0.4",
"description": "Vue context menu",

@@ -12,3 +12,3 @@ "keywords": [

"scripts": {
"test": "vue-cli-service serve ./test/main.js",
"dev": "vue-cli-service serve ./test/main.js",
"build": "vue-cli-service build --target lib -name vue-context-menu index.js",

@@ -15,0 +15,0 @@ "push": "npm version patch && npm publish"

# 致谢
原始代码来源于 `https://github.com/GitHub-Laziji/menujs` <br/>
源库年久失修, 故 fork 后重构,取名 vue-context-menu 以作区分
源库年久失修, 故 fork 后重构

@@ -36,3 +36,3 @@ # Vue ContextMenu

```js
import Contextmenu from 'vue-context-menu';
import Contextmenu from '@lqzh/vue-context-menu';
Vue.use(Contextmenu);

@@ -39,0 +39,0 @@

@@ -49,6 +49,6 @@ <template>

methods: {
async mousewheelListener() {
await this.close();
mousewheelListener() {
this.close();
},
async mouseDownListener(e) {
mouseDownListener(e) {
let el = e.target;

@@ -61,6 +61,6 @@ const menus = getElementsByClassName(this.$style.menu);

if (!menus.find(m => m === el)) {
await this.close();
this.close();
}
},
async mouseClickListener(e) {
mouseClickListener(e) {
let el = e.target;

@@ -79,7 +79,7 @@ const menus = getElementsByClassName(this.$style.menu);

}
await this.close();
this.close();
return;
}
if (!menus.find(m => m === el)) {
await this.close();
this.close();
}

@@ -103,6 +103,7 @@ },

},
async close() {
close() {
this.removeListener();
if (this.mainMenuInstance) {
await this.mainMenuInstance.close();
this.mainMenuInstance.close();
this.mainMenuInstance = null;
}

@@ -109,0 +110,0 @@ this.$destroy();

@@ -48,7 +48,3 @@ <template>

name: COMPONENT_NAME,
async mounted() {
this.visible = true;
await this.$nextTick();
mounted() {
const windowWidth = document.documentElement.clientWidth;

@@ -103,3 +99,3 @@ const windowHeight = document.documentElement.clientHeight;

customClass: null,
visible: false,
visible: true, // 默认打开
openTrend: SUBMENU_OPEN_TREND_RIGHT,

@@ -140,3 +136,3 @@ }),

},
async enterItem(e, item, index) {
enterItem(e, item, index) {
if (!this.visible) {

@@ -149,3 +145,3 @@ return;

} else {
await this.activeSubmenu.instance.close();
this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;

@@ -188,8 +184,9 @@ this.activeSubmenu.index = null;

},
async close() {
this.visible = false;
close() {
if (this.activeSubmenu.instance) {
await this.activeSubmenu.instance.close();
this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
await this.$nextTick();
this.visible = false;
this.$destroy();

@@ -196,0 +193,0 @@ if (this.$el.parentNode) {

@@ -29,3 +29,3 @@ import Vue from 'vue';

if (lastInstance) {
lastInstance.$destroy();
lastInstance.close();
lastInstance = null;

@@ -32,0 +32,0 @@ }

/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 399:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".Contextmenu_menu_Oc4YL,.Contextmenu_menu_item_qlPAM,.Contextmenu_menu_item__clickable_uOLrt,.Contextmenu_menu_item__unClickable_CUj6v{box-sizing:border-box}", ""]);
// Exports
___CSS_LOADER_EXPORT___.locals = {
"menu": "Contextmenu_menu_Oc4YL",
"menu_item": "Contextmenu_menu_item_qlPAM",
"menu_item__clickable": "Contextmenu_menu_item__clickable_uOLrt",
"menu_item__unClickable": "Contextmenu_menu_item__unClickable_CUj6v"
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 463:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".menu[data-v-cdfad7cc]{position:fixed;box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);background:#fff;border-radius:4px;padding:8px 0}.menu_body[data-v-cdfad7cc]{display:block}.menu_item[data-v-cdfad7cc]{list-style:none;line-height:32px;padding:0 16px;margin:0;font-size:13px;outline:0;display:flex;align-items:center;transition:.2s;border-bottom:1px solid #00000000}.menu_item__divided[data-v-cdfad7cc]{border-bottom-color:#ebeef5}.menu_item .menu_item_icon[data-v-cdfad7cc]{margin-right:8px;width:13px}.menu_item .menu_item_label[data-v-cdfad7cc]{flex:1}.menu_item .menu_item_expand_icon[data-v-cdfad7cc]{margin-left:16px;font-size:6px;width:10px}.menu_item__available[data-v-cdfad7cc]{color:#606266;cursor:pointer}.menu_item__available[data-v-cdfad7cc]:hover{background:#ecf5ff;color:#409eff}.menu_item__disabled[data-v-cdfad7cc]{color:#c0c4cc;cursor:not-allowed}.menu_item_expand[data-v-cdfad7cc]{background:#ecf5ff;color:#409eff}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 733:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".contextmenu-submenu-fade-enter-active,.contextmenu-submenu-fade-leave-active{transition:opacity .1s}.contextmenu-submenu-fade-enter,.contextmenu-submenu-fade-leave-to{opacity:0}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 645:
/***/ ((module) => {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = "";
var needLayer = typeof item[5] !== "undefined";
if (item[4]) {
content += "@supports (".concat(item[4], ") {");
}
if (item[2]) {
content += "@media ".concat(item[2], " {");
}
if (needLayer) {
content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
}
content += cssWithMappingToString(item);
if (needLayer) {
content += "}";
}
if (item[2]) {
content += "}";
}
if (item[4]) {
content += "}";
}
return content;
}).join("");
}; // import a list of modules into the list
list.i = function i(modules, media, dedupe, supports, layer) {
if (typeof modules === "string") {
modules = [[null, modules, undefined]];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var k = 0; k < this.length; k++) {
var id = this[k][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _k = 0; _k < modules.length; _k++) {
var item = [].concat(modules[_k]);
if (dedupe && alreadyImportedModules[item[0]]) {
continue;
}
if (typeof layer !== "undefined") {
if (typeof item[5] === "undefined") {
item[5] = layer;
} else {
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
item[5] = layer;
}
}
if (media) {
if (!item[2]) {
item[2] = media;
} else {
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
item[2] = media;
}
}
if (supports) {
if (!item[4]) {
item[4] = "".concat(supports);
} else {
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
item[4] = supports;
}
}
list.push(item);
}
};
return list;
};
/***/ }),
/***/ 81:
/***/ ((module) => {
"use strict";
module.exports = function (i) {
return i[1];
};
/***/ }),
/***/ 874:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(399);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("0eba6a8f", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 0:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(463);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("445986a0", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 861:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(733);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("2d2bb416", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 402:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ addStylesClient)
});
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/listToStyles.js
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/addStylesClient.js
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
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."
) }
}
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
var options = null
var ssrIdKey = 'data-vue-ssr-id'
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
function addStylesClient (parentId, list, _isProduction, _options) {
isProduction = _isProduction
options = _options || {}
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (options.ssrId) {
styleElement.setAttribute(ssrIdKey, obj.id)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ __webpack_require__.p = "";
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ entry_lib)
});
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
/* eslint-disable no-var */
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (false) { var getCurrentScript; }
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ const setPublicPath = (null);
;// CONCATENATED MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
const external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject = require("vue");
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=template&id=650e25e1&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div')
}
var staticRenderFns = []
;// CONCATENATED MODULE: ./src/util.js
function getElementsByClassName(className) {
return Array.from(document.querySelectorAll(`.${className}`));
}
;// CONCATENATED MODULE: ./src/constant.js
const SUBMENU_X_OFFSET = 3;
const SUBMENU_Y_OFFSET = -8;
const SUBMENU_OPEN_TREND_LEFT = "left";
const SUBMENU_OPEN_TREND_RIGHT = "right";
const COMPONENT_NAME = "contextmenu-submenu";
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Contextmenuvue_type_script_lang_js_ = ({
name: 'vue-contextMenu-2',
mounted() {
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.mainMenuInstance = new SubmenuConstructor();
this.mainMenuInstance.items = this.items;
this.mainMenuInstance.commonClass = {
menu: this.$style.menu,
menuItem: this.$style.menu_item,
clickableMenuItem: this.$style.menu_item__clickable,
unClickableMenuItem: this.$style.menu_item__unClickable,
};
this.mainMenuInstance.position = {
x: this.position.x,
y: this.position.y,
width: 0,
height: 0,
};
this.mainMenuInstance.style.minWidth = this.style.minWidth;
this.mainMenuInstance.style.zIndex = this.style.zIndex;
this.mainMenuInstance.customClass = this.customClass;
this.mainMenuInstance.$mount();
document.body.appendChild(this.mainMenuInstance.$el);
this.addListener();
},
data: () => ({
items: [],
position: {
x: 0,
y: 0,
},
style: {
zIndex: 2,
minWidth: 150,
},
mainMenuInstance: null,
customClass: null,
mouseListening: false,
}),
methods: {
async mousewheelListener() {
await this.close();
},
async mouseDownListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (!menus.find(m => m === el)) {
await this.close();
}
},
async mouseClickListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
const menuItems = getElementsByClassName(this.$style.menu_item);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && !menuItems.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (menuItems.find(m => m === el)) {
const unClickableMenuItems = getElementsByClassName(this.$style.menu_item__unClickable);
if (e.button !== 0 || unClickableMenuItems.find(m => m === el)) {
return;
}
await this.close();
return;
}
if (!menus.find(m => m === el)) {
await this.close();
}
},
addListener() {
if (!this.mouseListening) {
document.addEventListener('click', this.mouseClickListener);
document.addEventListener('mousedown', this.mouseDownListener);
document.addEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = true;
}
},
removeListener() {
if (this.mouseListening) {
document.removeEventListener('click', this.mouseClickListener);
document.removeEventListener('mousedown', this.mouseDownListener);
document.removeEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = false;
}
},
async close() {
this.removeListener();
if (this.mainMenuInstance) {
await this.mainMenuInstance.close();
}
this.$destroy();
},
},
});
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Contextmenuvue_type_script_lang_js_ = (Contextmenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-11.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-11.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-11.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-11.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=style&index=0&id=650e25e1&prod&module=true&lang=css&
var Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_ = __webpack_require__(874);
var Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_default = /*#__PURE__*/__webpack_require__.n(Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_);
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=style&index=0&id=650e25e1&prod&module=true&lang=css&
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent(
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */,
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options =
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection(h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue
;
function injectStyles (context) {
this["$style"] = ((Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_default()).locals || (Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_default()))
}
/* normalize component */
var component = normalizeComponent(
components_Contextmenuvue_type_script_lang_js_,
render,
staticRenderFns,
false,
injectStyles,
null,
null
)
/* harmony default export */ const Contextmenu = (component.exports);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=template&id=cdfad7cc&scoped=true&
var Submenuvue_type_template_id_cdfad7cc_scoped_true_render = function render(){var _vm=this,_c=_vm._self._c;return _c('transition',{attrs:{"name":"contextmenu-submenu-fade"}},[(_vm.visible)?_c('div',{ref:"menu",class:['menu', _vm.customClass, _vm.commonClass.menu],style:({left: _vm.style.left + 'px', top: _vm.style.top + 'px', minWidth: _vm.style.minWidth + 'px', zIndex: _vm.style.zIndex}),on:{"contextmenu":function($event){$event.preventDefault();}}},[_c('div',{staticClass:"menu_body"},_vm._l((_vm.itemsShow),function(item,index){return _c('div',{key:item.label,staticClass:"menu_item",class:[
_vm.commonClass.menuItem,
(item.disabled || item.children) ? _vm.commonClass.unClickableMenuItem : _vm.commonClass.clickableMenuItem,
(item.children && _vm.activeSubmenu.index === index) ? 'menu_item_expand' : null,
item.divided ? 'menu_item__divided' : null,
item.disabled ? 'menu_item__disabled' : 'menu_item__available',
],on:{"click":function($event){(!item.disabled && ! item.children) && _vm.itemClick(item)},"mouseenter":function($event){!item.disabled && _vm.enterItem($event,item,index)}}},[(_vm.hasIcon)?_c('div',{staticClass:"menu_item_icon"},[(item.icon)?_c('i',{class:item.icon}):_vm._e()]):_vm._e(),_c('span',{staticClass:"menu_item_label"},[_vm._v(_vm._s(item.label))]),_c('div',{staticClass:"menu_item_expand_icon"},[_vm._v(_vm._s(item.children ? '▶' : ''))])])}),0)]):_vm._e()])
}
var Submenuvue_type_template_id_cdfad7cc_scoped_true_staticRenderFns = []
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Submenuvue_type_script_lang_js_ = ({
name: COMPONENT_NAME,
async mounted() {
this.visible = true;
await this.$nextTick();
const windowWidth = document.documentElement.clientWidth;
const windowHeight = document.documentElement.clientHeight;
const menu = this.$refs.menu;
const menuWidth = menu.offsetWidth;
const menuHeight = menu.offsetHeight;
(this.openTrend === SUBMENU_OPEN_TREND_LEFT ? this.leftOpen : this.rightOpen)(
windowWidth,
windowHeight,
menuWidth,
);
this.style.top = this.position.y;
if (this.position.y + menuHeight > windowHeight) {
if (this.position.height === 0) {
this.style.top = this.position.y - menuHeight;
} else {
this.style.top = windowHeight - menuHeight;
}
if (this.style.top < 0) {
this.style.top = 0;
}
}
},
data: () => ({
commonClass: {
menu: null,
menuItem: null,
clickableMenuItem: null,
unClickableMenuItem: null,
},
activeSubmenu: {
index: null,
instance: null,
},
items: [],
position: {
x: 0,
y: 0,
width: 0,
height: 0,
},
style: {
left: 0,
top: 0,
zIndex: 2,
minWidth: 150,
},
customClass: null,
visible: false,
openTrend: SUBMENU_OPEN_TREND_RIGHT,
}),
computed: {
hasIcon() {
return this.itemsShow.some(v => v.icon);
},
itemsShow() {
return this.items.filter(v => !v.hidden);
},
},
methods: {
leftOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x - menuWidth;
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.style.left < 0) {
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.position.width === 0) {
this.style.left = 0;
} else {
this.style.left = this.position.x + this.position.width;
}
}
},
rightOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x + this.position.width;
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.style.left + menuWidth > windowWidth) {
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.position.width === 0) {
this.style.left = windowWidth - menuWidth;
} else {
this.style.left = this.position.x - menuWidth;
}
}
},
async enterItem(e, item, index) {
if (!this.visible) {
return;
}
if (this.activeSubmenu.instance) {
if (this.activeSubmenu.index === index) {
return;
} else {
await this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
}
if (!item.children) {
return;
}
const menuItemClientRect = e.target.getBoundingClientRect();
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.activeSubmenu.index = index;
this.activeSubmenu.instance = new SubmenuConstructor();
this.activeSubmenu.instance.items = item.children;
this.activeSubmenu.instance.openTrend = this.openTrend;
this.activeSubmenu.instance.commonClass = this.commonClass;
this.activeSubmenu.instance.position = {
x: menuItemClientRect.x + SUBMENU_X_OFFSET,
y: menuItemClientRect.y + SUBMENU_Y_OFFSET,
width: menuItemClientRect.width - 2 * SUBMENU_X_OFFSET,
height: menuItemClientRect.width,
};
this.activeSubmenu.instance.style.minWidth =
typeof item.minWidth === 'number' ? item.minWidth : this.style.minWidth;
this.activeSubmenu.instance.style.zIndex = this.style.zIndex;
this.activeSubmenu.instance.customClass =
typeof item.customClass === 'string' ? item.customClass : this.customClass;
this.activeSubmenu.instance.$mount();
document.body.appendChild(this.activeSubmenu.instance.$el);
},
itemClick(item) {
if (!this.visible) {
return;
}
if (item && !item.disabled && !item.hidden && typeof item.onClick === 'function') {
item.onClick();
return;
}
},
async close() {
this.visible = false;
if (this.activeSubmenu.instance) {
await this.activeSubmenu.instance.close();
}
await this.$nextTick();
this.$destroy();
},
},
});
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Submenuvue_type_script_lang_js_ = (Submenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=0&id=cdfad7cc&prod&scoped=true&lang=css&
var Submenuvue_type_style_index_0_id_cdfad7cc_prod_scoped_true_lang_css_ = __webpack_require__(0);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=0&id=cdfad7cc&prod&scoped=true&lang=css&
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=1&id=cdfad7cc&prod&lang=css&
var Submenuvue_type_style_index_1_id_cdfad7cc_prod_lang_css_ = __webpack_require__(861);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=1&id=cdfad7cc&prod&lang=css&
;// CONCATENATED MODULE: ./src/components/Submenu.vue
;
/* normalize component */
var Submenu_component = normalizeComponent(
components_Submenuvue_type_script_lang_js_,
Submenuvue_type_template_id_cdfad7cc_scoped_true_render,
Submenuvue_type_template_id_cdfad7cc_scoped_true_staticRenderFns,
false,
null,
"cdfad7cc",
null
)
/* harmony default export */ const Submenu = (Submenu_component.exports);
;// CONCATENATED MODULE: ./src/index.js
const ContextmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend(Contextmenu);
external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME, Submenu);
function install(v) {
let lastInstance = null;
const ContextmenuProxy = function (options) {
let instance = new ContextmenuConstructor();
instance.items = options.items;
instance.position.x = options.x || 0;
instance.position.y = options.y || 0;
if (options.event) {
instance.position.x = options.event.clientX;
instance.position.y = options.event.clientY;
}
instance.customClass = options.customClass;
options.minWidth && (instance.style.minWidth = options.minWidth);
options.zIndex && (instance.style.zIndex = options.zIndex);
ContextmenuProxy.destroy();
lastInstance = instance;
instance.$mount();
};
ContextmenuProxy.destroy = function () {
if (lastInstance) {
lastInstance.$destroy();
lastInstance = null;
}
};
v.prototype.$contextmenu = ContextmenuProxy;
}
if (window && window.Vue) {
install(window.Vue);
}
/* harmony default export */ const src_0 = ({
install,
});
;// CONCATENATED MODULE: ./index.js
/* harmony default export */ const index = (src_0);
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
/* harmony default export */ const entry_lib = (index);
})();
module.exports = __webpack_exports__;
/******/ })()
;
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["vue-context-menu-popup"] = factory(require("vue"));
else
root["vue-context-menu-popup"] = factory(root["Vue"]);
})((typeof self !== 'undefined' ? self : this), (__WEBPACK_EXTERNAL_MODULE__203__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 841:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".Contextmenu_menu_Oc4YL,.Contextmenu_menu_item_qlPAM,.Contextmenu_menu_item__clickable_uOLrt,.Contextmenu_menu_item__unClickable_CUj6v{box-sizing:border-box}", ""]);
// Exports
___CSS_LOADER_EXPORT___.locals = {
"menu": "Contextmenu_menu_Oc4YL",
"menu_item": "Contextmenu_menu_item_qlPAM",
"menu_item__clickable": "Contextmenu_menu_item__clickable_uOLrt",
"menu_item__unClickable": "Contextmenu_menu_item__unClickable_CUj6v"
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 902:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".menu[data-v-cdfad7cc]{position:fixed;box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);background:#fff;border-radius:4px;padding:8px 0}.menu_body[data-v-cdfad7cc]{display:block}.menu_item[data-v-cdfad7cc]{list-style:none;line-height:32px;padding:0 16px;margin:0;font-size:13px;outline:0;display:flex;align-items:center;transition:.2s;border-bottom:1px solid #00000000}.menu_item__divided[data-v-cdfad7cc]{border-bottom-color:#ebeef5}.menu_item .menu_item_icon[data-v-cdfad7cc]{margin-right:8px;width:13px}.menu_item .menu_item_label[data-v-cdfad7cc]{flex:1}.menu_item .menu_item_expand_icon[data-v-cdfad7cc]{margin-left:16px;font-size:6px;width:10px}.menu_item__available[data-v-cdfad7cc]{color:#606266;cursor:pointer}.menu_item__available[data-v-cdfad7cc]:hover{background:#ecf5ff;color:#409eff}.menu_item__disabled[data-v-cdfad7cc]{color:#c0c4cc;cursor:not-allowed}.menu_item_expand[data-v-cdfad7cc]{background:#ecf5ff;color:#409eff}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 311:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".contextmenu-submenu-fade-enter-active,.contextmenu-submenu-fade-leave-active{transition:opacity .1s}.contextmenu-submenu-fade-enter,.contextmenu-submenu-fade-leave-to{opacity:0}", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 645:
/***/ ((module) => {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function (cssWithMappingToString) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = "";
var needLayer = typeof item[5] !== "undefined";
if (item[4]) {
content += "@supports (".concat(item[4], ") {");
}
if (item[2]) {
content += "@media ".concat(item[2], " {");
}
if (needLayer) {
content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
}
content += cssWithMappingToString(item);
if (needLayer) {
content += "}";
}
if (item[2]) {
content += "}";
}
if (item[4]) {
content += "}";
}
return content;
}).join("");
}; // import a list of modules into the list
list.i = function i(modules, media, dedupe, supports, layer) {
if (typeof modules === "string") {
modules = [[null, modules, undefined]];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var k = 0; k < this.length; k++) {
var id = this[k][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _k = 0; _k < modules.length; _k++) {
var item = [].concat(modules[_k]);
if (dedupe && alreadyImportedModules[item[0]]) {
continue;
}
if (typeof layer !== "undefined") {
if (typeof item[5] === "undefined") {
item[5] = layer;
} else {
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
item[5] = layer;
}
}
if (media) {
if (!item[2]) {
item[2] = media;
} else {
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
item[2] = media;
}
}
if (supports) {
if (!item[4]) {
item[4] = "".concat(supports);
} else {
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
item[4] = supports;
}
}
list.push(item);
}
};
return list;
};
/***/ }),
/***/ 81:
/***/ ((module) => {
"use strict";
module.exports = function (i) {
return i[1];
};
/***/ }),
/***/ 702:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(841);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("501458ea", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 24:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(902);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("46c8a8c8", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 562:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(311);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.id, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var add = (__webpack_require__(402)/* ["default"] */ .Z)
var update = add("68bf19dc", content, true, {"sourceMap":false,"shadowMode":false});
/***/ }),
/***/ 402:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ addStylesClient)
});
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/listToStyles.js
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/addStylesClient.js
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
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."
) }
}
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
var options = null
var ssrIdKey = 'data-vue-ssr-id'
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
function addStylesClient (parentId, list, _isProduction, _options) {
isProduction = _isProduction
options = _options || {}
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (options.ssrId) {
styleElement.setAttribute(ssrIdKey, obj.id)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/***/ 203:
/***/ ((module) => {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__203__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ __webpack_require__.p = "";
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ entry_lib)
});
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
/* eslint-disable no-var */
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (false) { var getCurrentScript; }
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ const setPublicPath = (null);
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(203);
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=template&id=650e25e1&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div')
}
var staticRenderFns = []
;// CONCATENATED MODULE: ./src/util.js
function getElementsByClassName(className) {
return Array.from(document.querySelectorAll(`.${className}`));
}
;// CONCATENATED MODULE: ./src/constant.js
const SUBMENU_X_OFFSET = 3;
const SUBMENU_Y_OFFSET = -8;
const SUBMENU_OPEN_TREND_LEFT = "left";
const SUBMENU_OPEN_TREND_RIGHT = "right";
const COMPONENT_NAME = "contextmenu-submenu";
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Contextmenuvue_type_script_lang_js_ = ({
name: 'vue-contextMenu-2',
mounted() {
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.mainMenuInstance = new SubmenuConstructor();
this.mainMenuInstance.items = this.items;
this.mainMenuInstance.commonClass = {
menu: this.$style.menu,
menuItem: this.$style.menu_item,
clickableMenuItem: this.$style.menu_item__clickable,
unClickableMenuItem: this.$style.menu_item__unClickable,
};
this.mainMenuInstance.position = {
x: this.position.x,
y: this.position.y,
width: 0,
height: 0,
};
this.mainMenuInstance.style.minWidth = this.style.minWidth;
this.mainMenuInstance.style.zIndex = this.style.zIndex;
this.mainMenuInstance.customClass = this.customClass;
this.mainMenuInstance.$mount();
document.body.appendChild(this.mainMenuInstance.$el);
this.addListener();
},
data: () => ({
items: [],
position: {
x: 0,
y: 0,
},
style: {
zIndex: 2,
minWidth: 150,
},
mainMenuInstance: null,
customClass: null,
mouseListening: false,
}),
methods: {
async mousewheelListener() {
await this.close();
},
async mouseDownListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (!menus.find(m => m === el)) {
await this.close();
}
},
async mouseClickListener(e) {
let el = e.target;
const menus = getElementsByClassName(this.$style.menu);
const menuItems = getElementsByClassName(this.$style.menu_item);
// eslint-disable-next-line no-loop-func
while (!menus.find(m => m === el) && !menuItems.find(m => m === el) && el.parentElement) {
el = el.parentElement;
}
if (menuItems.find(m => m === el)) {
const unClickableMenuItems = getElementsByClassName(this.$style.menu_item__unClickable);
if (e.button !== 0 || unClickableMenuItems.find(m => m === el)) {
return;
}
await this.close();
return;
}
if (!menus.find(m => m === el)) {
await this.close();
}
},
addListener() {
if (!this.mouseListening) {
document.addEventListener('click', this.mouseClickListener);
document.addEventListener('mousedown', this.mouseDownListener);
document.addEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = true;
}
},
removeListener() {
if (this.mouseListening) {
document.removeEventListener('click', this.mouseClickListener);
document.removeEventListener('mousedown', this.mouseDownListener);
document.removeEventListener('mousewheel', this.mousewheelListener);
this.mouseListening = false;
}
},
async close() {
this.removeListener();
if (this.mainMenuInstance) {
await this.mainMenuInstance.close();
}
this.$destroy();
},
},
});
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Contextmenuvue_type_script_lang_js_ = (Contextmenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-51.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-51.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-51.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-51.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Contextmenu.vue?vue&type=style&index=0&id=650e25e1&prod&module=true&lang=css&
var Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_ = __webpack_require__(702);
var Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_default = /*#__PURE__*/__webpack_require__.n(Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_);
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue?vue&type=style&index=0&id=650e25e1&prod&module=true&lang=css&
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent(
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */,
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options =
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection(h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
;// CONCATENATED MODULE: ./src/components/Contextmenu.vue
;
function injectStyles (context) {
this["$style"] = ((Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_default()).locals || (Contextmenuvue_type_style_index_0_id_650e25e1_prod_module_true_lang_css_default()))
}
/* normalize component */
var component = normalizeComponent(
components_Contextmenuvue_type_script_lang_js_,
render,
staticRenderFns,
false,
injectStyles,
null,
null
)
/* harmony default export */ const Contextmenu = (component.exports);
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=template&id=cdfad7cc&scoped=true&
var Submenuvue_type_template_id_cdfad7cc_scoped_true_render = function render(){var _vm=this,_c=_vm._self._c;return _c('transition',{attrs:{"name":"contextmenu-submenu-fade"}},[(_vm.visible)?_c('div',{ref:"menu",class:['menu', _vm.customClass, _vm.commonClass.menu],style:({left: _vm.style.left + 'px', top: _vm.style.top + 'px', minWidth: _vm.style.minWidth + 'px', zIndex: _vm.style.zIndex}),on:{"contextmenu":function($event){$event.preventDefault();}}},[_c('div',{staticClass:"menu_body"},_vm._l((_vm.itemsShow),function(item,index){return _c('div',{key:item.label,staticClass:"menu_item",class:[
_vm.commonClass.menuItem,
(item.disabled || item.children) ? _vm.commonClass.unClickableMenuItem : _vm.commonClass.clickableMenuItem,
(item.children && _vm.activeSubmenu.index === index) ? 'menu_item_expand' : null,
item.divided ? 'menu_item__divided' : null,
item.disabled ? 'menu_item__disabled' : 'menu_item__available',
],on:{"click":function($event){(!item.disabled && ! item.children) && _vm.itemClick(item)},"mouseenter":function($event){!item.disabled && _vm.enterItem($event,item,index)}}},[(_vm.hasIcon)?_c('div',{staticClass:"menu_item_icon"},[(item.icon)?_c('i',{class:item.icon}):_vm._e()]):_vm._e(),_c('span',{staticClass:"menu_item_label"},[_vm._v(_vm._s(item.label))]),_c('div',{staticClass:"menu_item_expand_icon"},[_vm._v(_vm._s(item.children ? '▶' : ''))])])}),0)]):_vm._e()])
}
var Submenuvue_type_template_id_cdfad7cc_scoped_true_staticRenderFns = []
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const Submenuvue_type_script_lang_js_ = ({
name: COMPONENT_NAME,
async mounted() {
this.visible = true;
await this.$nextTick();
const windowWidth = document.documentElement.clientWidth;
const windowHeight = document.documentElement.clientHeight;
const menu = this.$refs.menu;
const menuWidth = menu.offsetWidth;
const menuHeight = menu.offsetHeight;
(this.openTrend === SUBMENU_OPEN_TREND_LEFT ? this.leftOpen : this.rightOpen)(
windowWidth,
windowHeight,
menuWidth,
);
this.style.top = this.position.y;
if (this.position.y + menuHeight > windowHeight) {
if (this.position.height === 0) {
this.style.top = this.position.y - menuHeight;
} else {
this.style.top = windowHeight - menuHeight;
}
if (this.style.top < 0) {
this.style.top = 0;
}
}
},
data: () => ({
commonClass: {
menu: null,
menuItem: null,
clickableMenuItem: null,
unClickableMenuItem: null,
},
activeSubmenu: {
index: null,
instance: null,
},
items: [],
position: {
x: 0,
y: 0,
width: 0,
height: 0,
},
style: {
left: 0,
top: 0,
zIndex: 2,
minWidth: 150,
},
customClass: null,
visible: false,
openTrend: SUBMENU_OPEN_TREND_RIGHT,
}),
computed: {
hasIcon() {
return this.itemsShow.some(v => v.icon);
},
itemsShow() {
return this.items.filter(v => !v.hidden);
},
},
methods: {
leftOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x - menuWidth;
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.style.left < 0) {
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.position.width === 0) {
this.style.left = 0;
} else {
this.style.left = this.position.x + this.position.width;
}
}
},
rightOpen(windowWidth, windowHeight, menuWidth) {
this.style.left = this.position.x + this.position.width;
this.openTrend = SUBMENU_OPEN_TREND_RIGHT;
if (this.style.left + menuWidth > windowWidth) {
this.openTrend = SUBMENU_OPEN_TREND_LEFT;
if (this.position.width === 0) {
this.style.left = windowWidth - menuWidth;
} else {
this.style.left = this.position.x - menuWidth;
}
}
},
async enterItem(e, item, index) {
if (!this.visible) {
return;
}
if (this.activeSubmenu.instance) {
if (this.activeSubmenu.index === index) {
return;
} else {
await this.activeSubmenu.instance.close();
this.activeSubmenu.instance = null;
this.activeSubmenu.index = null;
}
}
if (!item.children) {
return;
}
const menuItemClientRect = e.target.getBoundingClientRect();
const SubmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME);
this.activeSubmenu.index = index;
this.activeSubmenu.instance = new SubmenuConstructor();
this.activeSubmenu.instance.items = item.children;
this.activeSubmenu.instance.openTrend = this.openTrend;
this.activeSubmenu.instance.commonClass = this.commonClass;
this.activeSubmenu.instance.position = {
x: menuItemClientRect.x + SUBMENU_X_OFFSET,
y: menuItemClientRect.y + SUBMENU_Y_OFFSET,
width: menuItemClientRect.width - 2 * SUBMENU_X_OFFSET,
height: menuItemClientRect.width,
};
this.activeSubmenu.instance.style.minWidth =
typeof item.minWidth === 'number' ? item.minWidth : this.style.minWidth;
this.activeSubmenu.instance.style.zIndex = this.style.zIndex;
this.activeSubmenu.instance.customClass =
typeof item.customClass === 'string' ? item.customClass : this.customClass;
this.activeSubmenu.instance.$mount();
document.body.appendChild(this.activeSubmenu.instance.$el);
},
itemClick(item) {
if (!this.visible) {
return;
}
if (item && !item.disabled && !item.hidden && typeof item.onClick === 'function') {
item.onClick();
return;
}
},
async close() {
this.visible = false;
if (this.activeSubmenu.instance) {
await this.activeSubmenu.instance.close();
}
await this.$nextTick();
this.$destroy();
},
},
});
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=script&lang=js&
/* harmony default export */ const components_Submenuvue_type_script_lang_js_ = (Submenuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-52.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-52.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=0&id=cdfad7cc&prod&scoped=true&lang=css&
var Submenuvue_type_style_index_0_id_cdfad7cc_prod_scoped_true_lang_css_ = __webpack_require__(24);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=0&id=cdfad7cc&prod&scoped=true&lang=css&
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-52.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-52.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-52.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Submenu.vue?vue&type=style&index=1&id=cdfad7cc&prod&lang=css&
var Submenuvue_type_style_index_1_id_cdfad7cc_prod_lang_css_ = __webpack_require__(562);
;// CONCATENATED MODULE: ./src/components/Submenu.vue?vue&type=style&index=1&id=cdfad7cc&prod&lang=css&
;// CONCATENATED MODULE: ./src/components/Submenu.vue
;
/* normalize component */
var Submenu_component = normalizeComponent(
components_Submenuvue_type_script_lang_js_,
Submenuvue_type_template_id_cdfad7cc_scoped_true_render,
Submenuvue_type_template_id_cdfad7cc_scoped_true_staticRenderFns,
false,
null,
"cdfad7cc",
null
)
/* harmony default export */ const Submenu = (Submenu_component.exports);
;// CONCATENATED MODULE: ./src/index.js
const ContextmenuConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend(Contextmenu);
external_commonjs_vue_commonjs2_vue_root_Vue_default().component(COMPONENT_NAME, Submenu);
function install(v) {
let lastInstance = null;
const ContextmenuProxy = function (options) {
let instance = new ContextmenuConstructor();
instance.items = options.items;
instance.position.x = options.x || 0;
instance.position.y = options.y || 0;
if (options.event) {
instance.position.x = options.event.clientX;
instance.position.y = options.event.clientY;
}
instance.customClass = options.customClass;
options.minWidth && (instance.style.minWidth = options.minWidth);
options.zIndex && (instance.style.zIndex = options.zIndex);
ContextmenuProxy.destroy();
lastInstance = instance;
instance.$mount();
};
ContextmenuProxy.destroy = function () {
if (lastInstance) {
lastInstance.$destroy();
lastInstance = null;
}
};
v.prototype.$contextmenu = ContextmenuProxy;
}
if (window && window.Vue) {
install(window.Vue);
}
/* harmony default export */ const src_0 = ({
install,
});
;// CONCATENATED MODULE: ./index.js
/* harmony default export */ const index = (src_0);
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
/* harmony default export */ const entry_lib = (index);
})();
/******/ return __webpack_exports__;
/******/ })()
;
});
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-context-menu-popup"]=t(require("vue")):e["vue-context-menu-popup"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(e=>(()=>{var t={875:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var i=n(81),s=n.n(i),o=n(645),a=n.n(o),c=a()(s());c.push([e.id,".Contextmenu_menu_Oc4YL,.Contextmenu_menu_item_qlPAM,.Contextmenu_menu_item__clickable_uOLrt,.Contextmenu_menu_item__unClickable_CUj6v{box-sizing:border-box}",""]),c.locals={menu:"Contextmenu_menu_Oc4YL",menu_item:"Contextmenu_menu_item_qlPAM",menu_item__clickable:"Contextmenu_menu_item__clickable_uOLrt",menu_item__unClickable:"Contextmenu_menu_item__unClickable_CUj6v"};const u=c},570:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var i=n(81),s=n.n(i),o=n(645),a=n.n(o),c=a()(s());c.push([e.id,".menu[data-v-cdfad7cc]{position:fixed;box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);background:#fff;border-radius:4px;padding:8px 0}.menu_body[data-v-cdfad7cc]{display:block}.menu_item[data-v-cdfad7cc]{list-style:none;line-height:32px;padding:0 16px;margin:0;font-size:13px;outline:0;display:flex;align-items:center;transition:.2s;border-bottom:1px solid #00000000}.menu_item__divided[data-v-cdfad7cc]{border-bottom-color:#ebeef5}.menu_item .menu_item_icon[data-v-cdfad7cc]{margin-right:8px;width:13px}.menu_item .menu_item_label[data-v-cdfad7cc]{flex:1}.menu_item .menu_item_expand_icon[data-v-cdfad7cc]{margin-left:16px;font-size:6px;width:10px}.menu_item__available[data-v-cdfad7cc]{color:#606266;cursor:pointer}.menu_item__available[data-v-cdfad7cc]:hover{background:#ecf5ff;color:#409eff}.menu_item__disabled[data-v-cdfad7cc]{color:#c0c4cc;cursor:not-allowed}.menu_item_expand[data-v-cdfad7cc]{background:#ecf5ff;color:#409eff}",""]);const u=c},251:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var i=n(81),s=n.n(i),o=n(645),a=n.n(o),c=a()(s());c.push([e.id,".contextmenu-submenu-fade-enter-active,.contextmenu-submenu-fade-leave-active{transition:opacity .1s}.contextmenu-submenu-fade-enter,.contextmenu-submenu-fade-leave-to{opacity:0}",""]);const u=c},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i="undefined"!==typeof t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,s,o){"string"===typeof e&&(e=[[null,e,void 0]]);var a={};if(i)for(var c=0;c<this.length;c++){var u=this[c][0];null!=u&&(a[u]=!0)}for(var r=0;r<e.length;r++){var l=[].concat(e[r]);i&&a[l[0]]||("undefined"!==typeof o&&("undefined"===typeof l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=o),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),s&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=s):l[4]="".concat(s)),t.push(l))}},t}},81:e=>{"use strict";e.exports=function(e){return e[1]}},434:(e,t,n)=>{var i=n(875);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var s=n(402).Z;s("bd9d86f2",i,!0,{sourceMap:!1,shadowMode:!1})},14:(e,t,n)=>{var i=n(570);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var s=n(402).Z;s("74ddd098",i,!0,{sourceMap:!1,shadowMode:!1})},123:(e,t,n)=>{var i=n(251);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var s=n(402).Z;s("6a15320e",i,!0,{sourceMap:!1,shadowMode:!1})},402:(e,t,n)=>{"use strict";function i(e,t){for(var n=[],i={},s=0;s<t.length;s++){var o=t[s],a=o[0],c=o[1],u=o[2],r=o[3],l={id:e+":"+s,css:c,media:u,sourceMap:r};i[a]?i[a].parts.push(l):n.push(i[a]={id:a,parts:[l]})}return n}n.d(t,{Z:()=>p});var s="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!s)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 o={},a=s&&(document.head||document.getElementsByTagName("head")[0]),c=null,u=0,r=!1,l=function(){},d=null,m="data-vue-ssr-id",h="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function p(e,t,n,s){r=n,d=s||{};var a=i(e,t);return f(a),function(t){for(var n=[],s=0;s<a.length;s++){var c=a[s],u=o[c.id];u.refs--,n.push(u)}t?(a=i(e,t),f(a)):a=[];for(s=0;s<n.length;s++){u=n[s];if(0===u.refs){for(var r=0;r<u.parts.length;r++)u.parts[r]();delete o[u.id]}}}}function f(e){for(var t=0;t<e.length;t++){var n=e[t],i=o[n.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](n.parts[s]);for(;s<n.parts.length;s++)i.parts.push(_(n.parts[s]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var a=[];for(s=0;s<n.parts.length;s++)a.push(_(n.parts[s]));o[n.id]={id:n.id,refs:1,parts:a}}}}function v(){var e=document.createElement("style");return e.type="text/css",a.appendChild(e),e}function _(e){var t,n,i=document.querySelector("style["+m+'~="'+e.id+'"]');if(i){if(r)return l;i.parentNode.removeChild(i)}if(h){var s=u++;i=c||(c=v()),t=b.bind(null,i,s,!1),n=b.bind(null,i,s,!0)}else i=v(),t=x.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}var y=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function b(e,t,n,i){var s=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=y(t,s);else{var o=document.createTextNode(s),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function x(e,t){var n=t.css,i=t.media,s=t.sourceMap;if(i&&e.setAttribute("media",i),d.ssrId&&e.setAttribute(m,t.id),s&&(n+="\n/*# sourceURL="+s.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{while(e.firstChild)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}},203:t=>{"use strict";t.exports=e}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var o=n[e]={id:e,exports:{}};return t[e](o,o.exports,i),o.exports}(()=>{i.n=e=>{var t=e&&e.__esModule?()=>e["default"]:()=>e;return i.d(t,{a:t}),t}})(),(()=>{i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{i.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),(()=>{i.p=""})();var s={};return(()=>{"use strict";if(i.r(s),i.d(s,{default:()=>O}),"undefined"!==typeof window){var e=window.document.currentScript,t=e&&e.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);t&&(i.p=t[1])}var n=i(203),o=i.n(n),a=function(){var e=this,t=e._self._c;return t("div")},c=[];function u(e){return Array.from(document.querySelectorAll(`.${e}`))}const r=3,l=-8,d="left",m="right",h="contextmenu-submenu",p={name:"vue-contextMenu-2",mounted(){const e=o().component(h);this.mainMenuInstance=new e,this.mainMenuInstance.items=this.items,this.mainMenuInstance.commonClass={menu:this.$style.menu,menuItem:this.$style.menu_item,clickableMenuItem:this.$style.menu_item__clickable,unClickableMenuItem:this.$style.menu_item__unClickable},this.mainMenuInstance.position={x:this.position.x,y:this.position.y,width:0,height:0},this.mainMenuInstance.style.minWidth=this.style.minWidth,this.mainMenuInstance.style.zIndex=this.style.zIndex,this.mainMenuInstance.customClass=this.customClass,this.mainMenuInstance.$mount(),document.body.appendChild(this.mainMenuInstance.$el),this.addListener()},data:()=>({items:[],position:{x:0,y:0},style:{zIndex:2,minWidth:150},mainMenuInstance:null,customClass:null,mouseListening:!1}),methods:{async mousewheelListener(){await this.close()},async mouseDownListener(e){let t=e.target;const n=u(this.$style.menu);while(!n.find((e=>e===t))&&t.parentElement)t=t.parentElement;n.find((e=>e===t))||await this.close()},async mouseClickListener(e){let t=e.target;const n=u(this.$style.menu),i=u(this.$style.menu_item);while(!n.find((e=>e===t))&&!i.find((e=>e===t))&&t.parentElement)t=t.parentElement;if(i.find((e=>e===t))){const n=u(this.$style.menu_item__unClickable);if(0!==e.button||n.find((e=>e===t)))return;await this.close()}else n.find((e=>e===t))||await this.close()},addListener(){this.mouseListening||(document.addEventListener("click",this.mouseClickListener),document.addEventListener("mousedown",this.mouseDownListener),document.addEventListener("mousewheel",this.mousewheelListener),this.mouseListening=!0)},removeListener(){this.mouseListening&&(document.removeEventListener("click",this.mouseClickListener),document.removeEventListener("mousedown",this.mouseDownListener),document.removeEventListener("mousewheel",this.mousewheelListener),this.mouseListening=!1)},async close(){this.removeListener(),this.mainMenuInstance&&await this.mainMenuInstance.close(),this.$destroy()}}},f=p;var v=i(434),_=i.n(v);function y(e,t,n,i,s,o,a,c){var u,r="function"===typeof e?e.options:e;if(t&&(r.render=t,r.staticRenderFns=n,r._compiled=!0),i&&(r.functional=!0),o&&(r._scopeId="data-v-"+o),a?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},r._ssrRegister=u):s&&(u=c?function(){s.call(this,(r.functional?this.parent:this).$root.$options.shadowRoot)}:s),u)if(r.functional){r._injectStyles=u;var l=r.render;r.render=function(e,t){return u.call(t),l(e,t)}}else{var d=r.beforeCreate;r.beforeCreate=d?[].concat(d,u):[u]}return{exports:e,options:r}}function b(e){this["$style"]=_().locals||_()}var x=y(f,a,c,!1,b,null,null);const g=x.exports;var C=function(){var e=this,t=e._self._c;return t("transition",{attrs:{name:"contextmenu-submenu-fade"}},[e.visible?t("div",{ref:"menu",class:["menu",e.customClass,e.commonClass.menu],style:{left:e.style.left+"px",top:e.style.top+"px",minWidth:e.style.minWidth+"px",zIndex:e.style.zIndex},on:{contextmenu:function(e){e.preventDefault()}}},[t("div",{staticClass:"menu_body"},e._l(e.itemsShow,(function(n,i){return t("div",{key:n.label,staticClass:"menu_item",class:[e.commonClass.menuItem,n.disabled||n.children?e.commonClass.unClickableMenuItem:e.commonClass.clickableMenuItem,n.children&&e.activeSubmenu.index===i?"menu_item_expand":null,n.divided?"menu_item__divided":null,n.disabled?"menu_item__disabled":"menu_item__available"],on:{click:function(t){!n.disabled&&!n.children&&e.itemClick(n)},mouseenter:function(t){!n.disabled&&e.enterItem(t,n,i)}}},[e.hasIcon?t("div",{staticClass:"menu_item_icon"},[n.icon?t("i",{class:n.icon}):e._e()]):e._e(),t("span",{staticClass:"menu_item_label"},[e._v(e._s(n.label))]),t("div",{staticClass:"menu_item_expand_icon"},[e._v(e._s(n.children?"▶":""))])])})),0)]):e._e()])},w=[];const S={name:h,async mounted(){this.visible=!0,await this.$nextTick();const e=document.documentElement.clientWidth,t=document.documentElement.clientHeight,n=this.$refs.menu,i=n.offsetWidth,s=n.offsetHeight;(this.openTrend===d?this.leftOpen:this.rightOpen)(e,t,i),this.style.top=this.position.y,this.position.y+s>t&&(0===this.position.height?this.style.top=this.position.y-s:this.style.top=t-s,this.style.top<0&&(this.style.top=0))},data:()=>({commonClass:{menu:null,menuItem:null,clickableMenuItem:null,unClickableMenuItem:null},activeSubmenu:{index:null,instance:null},items:[],position:{x:0,y:0,width:0,height:0},style:{left:0,top:0,zIndex:2,minWidth:150},customClass:null,visible:!1,openTrend:m}),computed:{hasIcon(){return this.itemsShow.some((e=>e.icon))},itemsShow(){return this.items.filter((e=>!e.hidden))}},methods:{leftOpen(e,t,n){this.style.left=this.position.x-n,this.openTrend=d,this.style.left<0&&(this.openTrend=m,0===this.position.width?this.style.left=0:this.style.left=this.position.x+this.position.width)},rightOpen(e,t,n){this.style.left=this.position.x+this.position.width,this.openTrend=m,this.style.left+n>e&&(this.openTrend=d,0===this.position.width?this.style.left=e-n:this.style.left=this.position.x-n)},async enterItem(e,t,n){if(!this.visible)return;if(this.activeSubmenu.instance){if(this.activeSubmenu.index===n)return;await this.activeSubmenu.instance.close(),this.activeSubmenu.instance=null,this.activeSubmenu.index=null}if(!t.children)return;const i=e.target.getBoundingClientRect(),s=o().component(h);this.activeSubmenu.index=n,this.activeSubmenu.instance=new s,this.activeSubmenu.instance.items=t.children,this.activeSubmenu.instance.openTrend=this.openTrend,this.activeSubmenu.instance.commonClass=this.commonClass,this.activeSubmenu.instance.position={x:i.x+r,y:i.y+l,width:i.width-2*r,height:i.width},this.activeSubmenu.instance.style.minWidth="number"===typeof t.minWidth?t.minWidth:this.style.minWidth,this.activeSubmenu.instance.style.zIndex=this.style.zIndex,this.activeSubmenu.instance.customClass="string"===typeof t.customClass?t.customClass:this.customClass,this.activeSubmenu.instance.$mount(),document.body.appendChild(this.activeSubmenu.instance.$el)},itemClick(e){this.visible&&(!e||e.disabled||e.hidden||"function"!==typeof e.onClick||e.onClick())},async close(){this.visible=!1,this.activeSubmenu.instance&&await this.activeSubmenu.instance.close(),await this.$nextTick(),this.$destroy()}}},I=S;i(14),i(123);var M=y(I,C,w,!1,null,"cdfad7cc",null);const k=M.exports,L=o().extend(g);function $(e){let t=null;const n=function(e){let i=new L;i.items=e.items,i.position.x=e.x||0,i.position.y=e.y||0,e.event&&(i.position.x=e.event.clientX,i.position.y=e.event.clientY),i.customClass=e.customClass,e.minWidth&&(i.style.minWidth=e.minWidth),e.zIndex&&(i.style.zIndex=e.zIndex),n.destroy(),t=i,i.$mount()};n.destroy=function(){t&&(t.$destroy(),t=null)},e.prototype.$contextmenu=n}o().component(h,k),window&&window.Vue&&$(window.Vue);const E={install:$},T=E,O=T})(),s})()));