module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 72); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* 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, 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 functioal 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 } } /***/ }), /***/ 11: /***/ (function(module, exports) { module.exports = require("element-ui/lib/mixins/migrating"); /***/ }), /***/ 2: /***/ (function(module, exports) { module.exports = require("element-ui/lib/utils/dom"); /***/ }), /***/ 4: /***/ (function(module, exports) { module.exports = require("element-ui/lib/mixins/emitter"); /***/ }), /***/ 72: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter" var emitter_ = __webpack_require__(4); var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_); // EXTERNAL MODULE: external "element-ui/lib/mixins/migrating" var migrating_ = __webpack_require__(11); var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_); // CONCATENATED MODULE: ./src/utils/aria-utils.js var aria = aria || {}; aria.Utils = aria.Utils || {}; /** * @desc Set focus on descendant nodes until the first focusable element is * found. * @param element * DOM node for which to find the first focusable descendant. * @returns * true if a focusable element is found and focus is set. */ aria.Utils.focusFirstDescendant = function (element) { for (var i = 0; i < element.childNodes.length; i++) { var child = element.childNodes[i]; if (aria.Utils.attemptFocus(child) || aria.Utils.focusFirstDescendant(child)) { return true; } } return false; }; /** * @desc Find the last descendant node that is focusable. * @param element * DOM node for which to find the last focusable descendant. * @returns * true if a focusable element is found and focus is set. */ aria.Utils.focusLastDescendant = function (element) { for (var i = element.childNodes.length - 1; i >= 0; i--) { var child = element.childNodes[i]; if (aria.Utils.attemptFocus(child) || aria.Utils.focusLastDescendant(child)) { return true; } } return false; }; /** * @desc Set Attempt to set focus on the current node. * @param element * The node to attempt to focus on. * @returns * true if element is focused. */ aria.Utils.attemptFocus = function (element) { if (!aria.Utils.isFocusable(element)) { return false; } aria.Utils.IgnoreUtilFocusChanges = true; try { element.focus(); } catch (e) {} aria.Utils.IgnoreUtilFocusChanges = false; return document.activeElement === element; }; aria.Utils.isFocusable = function (element) { if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null) { return true; } if (element.disabled) { return false; } switch (element.nodeName) { case 'A': return !!element.href && element.rel !== 'ignore'; case 'INPUT': return element.type !== 'hidden' && element.type !== 'file'; case 'BUTTON': case 'SELECT': case 'TEXTAREA': return true; default: return false; } }; /** * 触发一个事件 * mouseenter, mouseleave, mouseover, keyup, change, click 等 * @param {Element} elm * @param {String} name * @param {*} opts */ aria.Utils.triggerEvent = function (elm, name) { var eventName = void 0; if (/^mouse|click/.test(name)) { eventName = 'MouseEvents'; } else if (/^key/.test(name)) { eventName = 'KeyboardEvent'; } else { eventName = 'HTMLEvents'; } var evt = document.createEvent(eventName); for (var _len = arguments.length, opts = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { opts[_key - 2] = arguments[_key]; } evt.initEvent.apply(evt, [name].concat(opts)); elm.dispatchEvent ? elm.dispatchEvent(evt) : elm.fireEvent('on' + name, evt); return elm; }; aria.Utils.keys = { tab: 9, enter: 13, space: 32, left: 37, up: 38, right: 39, down: 40, esc: 27 }; /* harmony default export */ var aria_utils = (aria.Utils); // CONCATENATED MODULE: ./src/utils/menu/aria-submenu.js var SubMenu = function SubMenu(parent, domNode) { this.domNode = domNode; this.parent = parent; this.subMenuItems = []; this.subIndex = 0; this.init(); }; SubMenu.prototype.init = function () { this.subMenuItems = this.domNode.querySelectorAll('li'); this.addListeners(); }; SubMenu.prototype.gotoSubIndex = function (idx) { if (idx === this.subMenuItems.length) { idx = 0; } else if (idx < 0) { idx = this.subMenuItems.length - 1; } this.subMenuItems[idx].focus(); this.subIndex = idx; }; SubMenu.prototype.addListeners = function () { var _this = this; var keys = aria_utils.keys; var parentNode = this.parent.domNode; Array.prototype.forEach.call(this.subMenuItems, function (el) { el.addEventListener('keydown', function (event) { var prevDef = false; switch (event.keyCode) { case keys.down: _this.gotoSubIndex(_this.subIndex + 1); prevDef = true; break; case keys.up: _this.gotoSubIndex(_this.subIndex - 1); prevDef = true; break; case keys.tab: aria_utils.triggerEvent(parentNode, 'mouseleave'); break; case keys.enter: case keys.space: prevDef = true; event.currentTarget.click(); break; } if (prevDef) { event.preventDefault(); event.stopPropagation(); } return false; }); }); }; /* harmony default export */ var aria_submenu = (SubMenu); // CONCATENATED MODULE: ./src/utils/menu/aria-menuitem.js var MenuItem = function MenuItem(domNode) { this.domNode = domNode; this.submenu = null; this.init(); }; MenuItem.prototype.init = function () { this.domNode.setAttribute('tabindex', '0'); var menuChild = this.domNode.querySelector('.el-menu'); if (menuChild) { this.submenu = new aria_submenu(this, menuChild); } this.addListeners(); }; MenuItem.prototype.addListeners = function () { var _this = this; var keys = aria_utils.keys; this.domNode.addEventListener('keydown', function (event) { var prevDef = false; switch (event.keyCode) { case keys.down: aria_utils.triggerEvent(event.currentTarget, 'mouseenter'); _this.submenu && _this.submenu.gotoSubIndex(0); prevDef = true; break; case keys.up: aria_utils.triggerEvent(event.currentTarget, 'mouseenter'); _this.submenu && _this.submenu.gotoSubIndex(_this.submenu.subMenuItems.length - 1); prevDef = true; break; case keys.tab: aria_utils.triggerEvent(event.currentTarget, 'mouseleave'); break; case keys.enter: case keys.space: prevDef = true; event.currentTarget.click(); break; } if (prevDef) { event.preventDefault(); } }); }; /* harmony default export */ var aria_menuitem = (MenuItem); // CONCATENATED MODULE: ./src/utils/menu/aria-menubar.js var Menu = function Menu(domNode) { this.domNode = domNode; this.init(); }; Menu.prototype.init = function () { var menuChildren = this.domNode.childNodes; [].filter.call(menuChildren, function (child) { return child.nodeType === 1; }).forEach(function (child) { new aria_menuitem(child); // eslint-disable-line }); }; /* harmony default export */ var aria_menubar = (Menu); // EXTERNAL MODULE: external "element-ui/lib/utils/dom" var dom_ = __webpack_require__(2); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu.vue?vue&type=script&lang=js& /* harmony default export */ var menuvue_type_script_lang_js_ = ({ name: 'ElMenu', render: function render(h) { var component = h( 'ul', { attrs: { role: 'menubar' }, key: +this.collapse, style: { backgroundColor: this.backgroundColor || '' }, 'class': { 'el-menu--horizontal': this.mode === 'horizontal', 'el-menu--collapse': this.collapse, "el-menu": true } }, [this.$slots.default] ); if (this.collapseTransition) { return h('el-menu-collapse-transition', [component]); } else { return component; } }, componentName: 'ElMenu', mixins: [emitter_default.a, migrating_default.a], provide: function provide() { return { rootMenu: this }; }, components: { 'el-menu-collapse-transition': { functional: true, render: function render(createElement, context) { var data = { props: { mode: 'out-in' }, on: { beforeEnter: function beforeEnter(el) { el.style.opacity = 0.2; }, enter: function enter(el) { Object(dom_["addClass"])(el, 'el-opacity-transition'); el.style.opacity = 1; }, afterEnter: function afterEnter(el) { Object(dom_["removeClass"])(el, 'el-opacity-transition'); el.style.opacity = ''; }, beforeLeave: function beforeLeave(el) { if (!el.dataset) el.dataset = {}; if (Object(dom_["hasClass"])(el, 'el-menu--collapse')) { Object(dom_["removeClass"])(el, 'el-menu--collapse'); el.dataset.oldOverflow = el.style.overflow; el.dataset.scrollWidth = el.clientWidth; Object(dom_["addClass"])(el, 'el-menu--collapse'); } else { Object(dom_["addClass"])(el, 'el-menu--collapse'); el.dataset.oldOverflow = el.style.overflow; el.dataset.scrollWidth = el.clientWidth; Object(dom_["removeClass"])(el, 'el-menu--collapse'); } el.style.width = el.scrollWidth + 'px'; el.style.overflow = 'hidden'; }, leave: function leave(el) { Object(dom_["addClass"])(el, 'horizontal-collapse-transition'); el.style.width = el.dataset.scrollWidth + 'px'; } } }; return createElement('transition', data, context.children); } } }, props: { mode: { type: String, default: 'vertical' }, defaultActive: { type: String, default: '' }, defaultOpeneds: Array, uniqueOpened: Boolean, router: Boolean, menuTrigger: { type: String, default: 'hover' }, collapse: Boolean, backgroundColor: String, textColor: String, activeTextColor: String, collapseTransition: { type: Boolean, default: true } }, data: function data() { return { activeIndex: this.defaultActive, openedMenus: this.defaultOpeneds && !this.collapse ? this.defaultOpeneds.slice(0) : [], items: {}, submenus: {} }; }, computed: { hoverBackground: function hoverBackground() { return this.backgroundColor ? this.mixColor(this.backgroundColor, 0.2) : ''; }, isMenuPopup: function isMenuPopup() { return this.mode === 'horizontal' || this.mode === 'vertical' && this.collapse; } }, watch: { defaultActive: function defaultActive(value) { if (!this.items[value]) { this.activeIndex = null; } this.updateActiveIndex(value); }, defaultOpeneds: function defaultOpeneds(value) { if (!this.collapse) { this.openedMenus = value; } }, collapse: function collapse(value) { if (value) this.openedMenus = []; this.broadcast('ElSubmenu', 'toggle-collapse', value); } }, methods: { updateActiveIndex: function updateActiveIndex(val) { var item = this.items[val] || this.items[this.activeIndex] || this.items[this.defaultActive]; if (item) { this.activeIndex = item.index; this.initOpenedMenu(); } else { this.activeIndex = null; } }, getMigratingConfig: function getMigratingConfig() { return { props: { 'theme': 'theme is removed.' } }; }, getColorChannels: function getColorChannels(color) { color = color.replace('#', ''); if (/^[0-9a-fA-F]{3}$/.test(color)) { color = color.split(''); for (var i = 2; i >= 0; i--) { color.splice(i, 0, color[i]); } color = color.join(''); } if (/^[0-9a-fA-F]{6}$/.test(color)) { return { red: parseInt(color.slice(0, 2), 16), green: parseInt(color.slice(2, 4), 16), blue: parseInt(color.slice(4, 6), 16) }; } else { return { red: 255, green: 255, blue: 255 }; } }, mixColor: function mixColor(color, percent) { var _getColorChannels = this.getColorChannels(color), red = _getColorChannels.red, green = _getColorChannels.green, blue = _getColorChannels.blue; if (percent > 0) { // shade given color red *= 1 - percent; green *= 1 - percent; blue *= 1 - percent; } else { // tint given color red += (255 - red) * percent; green += (255 - green) * percent; blue += (255 - blue) * percent; } return 'rgb(' + Math.round(red) + ', ' + Math.round(green) + ', ' + Math.round(blue) + ')'; }, addItem: function addItem(item) { this.$set(this.items, item.index, item); }, removeItem: function removeItem(item) { delete this.items[item.index]; }, addSubmenu: function addSubmenu(item) { this.$set(this.submenus, item.index, item); }, removeSubmenu: function removeSubmenu(item) { delete this.submenus[item.index]; }, openMenu: function openMenu(index, indexPath) { var openedMenus = this.openedMenus; if (openedMenus.indexOf(index) !== -1) return; // 将不在该菜单路径下的其余菜单收起 // collapse all menu that are not under current menu item if (this.uniqueOpened) { this.openedMenus = openedMenus.filter(function (index) { return indexPath.indexOf(index) !== -1; }); } this.openedMenus.push(index); }, closeMenu: function closeMenu(index) { var i = this.openedMenus.indexOf(index); if (i !== -1) { this.openedMenus.splice(i, 1); } }, handleSubmenuClick: function handleSubmenuClick(submenu) { var index = submenu.index, indexPath = submenu.indexPath; var isOpened = this.openedMenus.indexOf(index) !== -1; if (isOpened) { this.closeMenu(index); this.$emit('close', index, indexPath); } else { this.openMenu(index, indexPath); this.$emit('open', index, indexPath); } }, handleItemClick: function handleItemClick(item) { var _this = this; var index = item.index, indexPath = item.indexPath; var oldActiveIndex = this.activeIndex; var hasIndex = item.index !== null; if (hasIndex) { this.activeIndex = item.index; } this.$emit('select', index, indexPath, item); if (this.mode === 'horizontal' || this.collapse) { this.openedMenus = []; } if (this.router && hasIndex) { this.routeToItem(item, function (error) { _this.activeIndex = oldActiveIndex; if (error) { // vue-router 3.1.0+ push/replace cause NavigationDuplicated error // https://github.com/ElemeFE/element/issues/17044 if (error.name === 'NavigationDuplicated') return; console.error(error); } }); } }, // 初始化展开菜单 // initialize opened menu initOpenedMenu: function initOpenedMenu() { var _this2 = this; var index = this.activeIndex; var activeItem = this.items[index]; if (!activeItem || this.mode === 'horizontal' || this.collapse) return; var indexPath = activeItem.indexPath; // 展开该菜单项的路径上所有子菜单 // expand all submenus of the menu item indexPath.forEach(function (index) { var submenu = _this2.submenus[index]; submenu && _this2.openMenu(index, submenu.indexPath); }); }, routeToItem: function routeToItem(item, onError) { var route = item.route || item.index; try { this.$router.push(route, function () {}, onError); } catch (e) { console.error(e); } }, open: function open(index) { var _this3 = this; var indexPath = this.submenus[index.toString()].indexPath; indexPath.forEach(function (i) { return _this3.openMenu(i, indexPath); }); }, close: function close(index) { this.closeMenu(index); } }, mounted: function mounted() { this.initOpenedMenu(); this.$on('item-click', this.handleItemClick); this.$on('submenu-click', this.handleSubmenuClick); if (this.mode === 'horizontal') { new aria_menubar(this.$el); // eslint-disable-line } this.$watch('items', this.updateActiveIndex); } }); // CONCATENATED MODULE: ./packages/menu/src/menu.vue?vue&type=script&lang=js& /* harmony default export */ var src_menuvue_type_script_lang_js_ = (menuvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./packages/menu/src/menu.vue var menu_render, staticRenderFns /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( src_menuvue_type_script_lang_js_, menu_render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "packages/menu/src/menu.vue" /* harmony default export */ var menu = (component.exports); // CONCATENATED MODULE: ./packages/menu/index.js /* istanbul ignore next */ menu.install = function (Vue) { Vue.component(menu.name, menu); }; /* harmony default export */ var packages_menu = __webpack_exports__["default"] = (menu); /***/ }) /******/ });