UNPKG

21.1 kBJavaScriptView Raw
1module.exports =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId]) {
11/******/ return installedModules[moduleId].exports;
12/******/ }
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // define getter function for harmony exports
38/******/ __webpack_require__.d = function(exports, name, getter) {
39/******/ if(!__webpack_require__.o(exports, name)) {
40/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41/******/ }
42/******/ };
43/******/
44/******/ // define __esModule on exports
45/******/ __webpack_require__.r = function(exports) {
46/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48/******/ }
49/******/ Object.defineProperty(exports, '__esModule', { value: true });
50/******/ };
51/******/
52/******/ // create a fake namespace object
53/******/ // mode & 1: value is a module id, require it
54/******/ // mode & 2: merge all properties of value into the ns
55/******/ // mode & 4: return value when already ns object
56/******/ // mode & 8|1: behave like require
57/******/ __webpack_require__.t = function(value, mode) {
58/******/ if(mode & 1) value = __webpack_require__(value);
59/******/ if(mode & 8) return value;
60/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61/******/ var ns = Object.create(null);
62/******/ __webpack_require__.r(ns);
63/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65/******/ return ns;
66/******/ };
67/******/
68/******/ // getDefaultExport function for compatibility with non-harmony modules
69/******/ __webpack_require__.n = function(module) {
70/******/ var getter = module && module.__esModule ?
71/******/ function getDefault() { return module['default']; } :
72/******/ function getModuleExports() { return module; };
73/******/ __webpack_require__.d(getter, 'a', getter);
74/******/ return getter;
75/******/ };
76/******/
77/******/ // Object.prototype.hasOwnProperty.call
78/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79/******/
80/******/ // __webpack_public_path__
81/******/ __webpack_require__.p = "/dist/";
82/******/
83/******/
84/******/ // Load entry module and return exports
85/******/ return __webpack_require__(__webpack_require__.s = 129);
86/******/ })
87/************************************************************************/
88/******/ ({
89
90/***/ 0:
91/***/ (function(module, __webpack_exports__, __webpack_require__) {
92
93"use strict";
94/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
95/* globals __VUE_SSR_CONTEXT__ */
96
97// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
98// This module is a runtime utility for cleaner component module output and will
99// be included in the final webpack user bundle.
100
101function normalizeComponent (
102 scriptExports,
103 render,
104 staticRenderFns,
105 functionalTemplate,
106 injectStyles,
107 scopeId,
108 moduleIdentifier, /* server only */
109 shadowMode /* vue-cli only */
110) {
111 // Vue.extend constructor export interop
112 var options = typeof scriptExports === 'function'
113 ? scriptExports.options
114 : scriptExports
115
116 // render functions
117 if (render) {
118 options.render = render
119 options.staticRenderFns = staticRenderFns
120 options._compiled = true
121 }
122
123 // functional template
124 if (functionalTemplate) {
125 options.functional = true
126 }
127
128 // scopedId
129 if (scopeId) {
130 options._scopeId = 'data-v-' + scopeId
131 }
132
133 var hook
134 if (moduleIdentifier) { // server build
135 hook = function (context) {
136 // 2.3 injection
137 context =
138 context || // cached call
139 (this.$vnode && this.$vnode.ssrContext) || // stateful
140 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
141 // 2.2 with runInNewContext: true
142 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
143 context = __VUE_SSR_CONTEXT__
144 }
145 // inject component styles
146 if (injectStyles) {
147 injectStyles.call(this, context)
148 }
149 // register component module identifier for async chunk inferrence
150 if (context && context._registeredComponents) {
151 context._registeredComponents.add(moduleIdentifier)
152 }
153 }
154 // used by ssr in case component is cached and beforeCreate
155 // never gets called
156 options._ssrRegister = hook
157 } else if (injectStyles) {
158 hook = shadowMode
159 ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
160 : injectStyles
161 }
162
163 if (hook) {
164 if (options.functional) {
165 // for template-only hot-reload because in that case the render fn doesn't
166 // go through the normalizer
167 options._injectStyles = hook
168 // register for functioal component in vue file
169 var originalRender = options.render
170 options.render = function renderWithStyleInjection (h, context) {
171 hook.call(context)
172 return originalRender(h, context)
173 }
174 } else {
175 // inject component registration as beforeCreate hook
176 var existing = options.beforeCreate
177 options.beforeCreate = existing
178 ? [].concat(existing, hook)
179 : [hook]
180 }
181 }
182
183 return {
184 exports: scriptExports,
185 options: options
186 }
187}
188
189
190/***/ }),
191
192/***/ 129:
193/***/ (function(module, __webpack_exports__, __webpack_require__) {
194
195"use strict";
196__webpack_require__.r(__webpack_exports__);
197
198// EXTERNAL MODULE: external "element-ui/lib/transitions/collapse-transition"
199var collapse_transition_ = __webpack_require__(28);
200var collapse_transition_default = /*#__PURE__*/__webpack_require__.n(collapse_transition_);
201
202// EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
203var menu_mixin = __webpack_require__(37);
204
205// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
206var emitter_ = __webpack_require__(4);
207var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
208
209// EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
210var vue_popper_ = __webpack_require__(5);
211var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
212
213// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/submenu.vue?vue&type=script&lang=js&
214
215
216
217
218
219
220var poperMixins = {
221 props: {
222 transformOrigin: {
223 type: [Boolean, String],
224 default: false
225 },
226 offset: vue_popper_default.a.props.offset,
227 boundariesPadding: vue_popper_default.a.props.boundariesPadding,
228 popperOptions: vue_popper_default.a.props.popperOptions
229 },
230 data: vue_popper_default.a.data,
231 methods: vue_popper_default.a.methods,
232 beforeDestroy: vue_popper_default.a.beforeDestroy,
233 deactivated: vue_popper_default.a.deactivated
234};
235
236/* harmony default export */ var submenuvue_type_script_lang_js_ = ({
237 name: 'ElSubmenu',
238
239 componentName: 'ElSubmenu',
240
241 mixins: [menu_mixin["a" /* default */], emitter_default.a, poperMixins],
242
243 components: { ElCollapseTransition: collapse_transition_default.a },
244
245 props: {
246 index: {
247 type: String,
248 required: true
249 },
250 showTimeout: {
251 type: Number,
252 default: 300
253 },
254 hideTimeout: {
255 type: Number,
256 default: 300
257 },
258 popperClass: String,
259 disabled: Boolean,
260 popperAppendToBody: {
261 type: Boolean,
262 default: undefined
263 }
264 },
265
266 data: function data() {
267 return {
268 popperJS: null,
269 timeout: null,
270 items: {},
271 submenus: {},
272 mouseInChild: false
273 };
274 },
275
276 watch: {
277 opened: function opened(val) {
278 var _this = this;
279
280 if (this.isMenuPopup) {
281 this.$nextTick(function (_) {
282 _this.updatePopper();
283 });
284 }
285 }
286 },
287 computed: {
288 // popper option
289 appendToBody: function appendToBody() {
290 return this.popperAppendToBody === undefined ? this.isFirstLevel : this.popperAppendToBody;
291 },
292 menuTransitionName: function menuTransitionName() {
293 return this.rootMenu.collapse ? 'el-zoom-in-left' : 'el-zoom-in-top';
294 },
295 opened: function opened() {
296 return this.rootMenu.openedMenus.indexOf(this.index) > -1;
297 },
298 active: function active() {
299 var isActive = false;
300 var submenus = this.submenus;
301 var items = this.items;
302
303 Object.keys(items).forEach(function (index) {
304 if (items[index].active) {
305 isActive = true;
306 }
307 });
308
309 Object.keys(submenus).forEach(function (index) {
310 if (submenus[index].active) {
311 isActive = true;
312 }
313 });
314
315 return isActive;
316 },
317 hoverBackground: function hoverBackground() {
318 return this.rootMenu.hoverBackground;
319 },
320 backgroundColor: function backgroundColor() {
321 return this.rootMenu.backgroundColor || '';
322 },
323 activeTextColor: function activeTextColor() {
324 return this.rootMenu.activeTextColor || '';
325 },
326 textColor: function textColor() {
327 return this.rootMenu.textColor || '';
328 },
329 mode: function mode() {
330 return this.rootMenu.mode;
331 },
332 isMenuPopup: function isMenuPopup() {
333 return this.rootMenu.isMenuPopup;
334 },
335 titleStyle: function titleStyle() {
336 if (this.mode !== 'horizontal') {
337 return {
338 color: this.textColor
339 };
340 }
341 return {
342 borderBottomColor: this.active ? this.rootMenu.activeTextColor ? this.activeTextColor : '' : 'transparent',
343 color: this.active ? this.activeTextColor : this.textColor
344 };
345 },
346 isFirstLevel: function isFirstLevel() {
347 var isFirstLevel = true;
348 var parent = this.$parent;
349 while (parent && parent !== this.rootMenu) {
350 if (['ElSubmenu', 'ElMenuItemGroup'].indexOf(parent.$options.componentName) > -1) {
351 isFirstLevel = false;
352 break;
353 } else {
354 parent = parent.$parent;
355 }
356 }
357 return isFirstLevel;
358 }
359 },
360 methods: {
361 handleCollapseToggle: function handleCollapseToggle(value) {
362 if (value) {
363 this.initPopper();
364 } else {
365 this.doDestroy();
366 }
367 },
368 addItem: function addItem(item) {
369 this.$set(this.items, item.index, item);
370 },
371 removeItem: function removeItem(item) {
372 delete this.items[item.index];
373 },
374 addSubmenu: function addSubmenu(item) {
375 this.$set(this.submenus, item.index, item);
376 },
377 removeSubmenu: function removeSubmenu(item) {
378 delete this.submenus[item.index];
379 },
380 handleClick: function handleClick() {
381 var rootMenu = this.rootMenu,
382 disabled = this.disabled;
383
384 if (rootMenu.menuTrigger === 'hover' && rootMenu.mode === 'horizontal' || rootMenu.collapse && rootMenu.mode === 'vertical' || disabled) {
385 return;
386 }
387 this.dispatch('ElMenu', 'submenu-click', this);
388 },
389 handleMouseenter: function handleMouseenter(event) {
390 var _this2 = this;
391
392 var showTimeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.showTimeout;
393
394
395 if (!('ActiveXObject' in window) && event.type === 'focus' && !event.relatedTarget) {
396 return;
397 }
398 var rootMenu = this.rootMenu,
399 disabled = this.disabled;
400
401 if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical' || disabled) {
402 return;
403 }
404 this.dispatch('ElSubmenu', 'mouse-enter-child');
405 clearTimeout(this.timeout);
406 this.timeout = setTimeout(function () {
407 _this2.rootMenu.openMenu(_this2.index, _this2.indexPath);
408 }, showTimeout);
409
410 if (this.appendToBody) {
411 this.$parent.$el.dispatchEvent(new MouseEvent('mouseenter'));
412 }
413 },
414 handleMouseleave: function handleMouseleave() {
415 var _this3 = this;
416
417 var deepDispatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
418 var rootMenu = this.rootMenu;
419
420 if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical') {
421 return;
422 }
423 this.dispatch('ElSubmenu', 'mouse-leave-child');
424 clearTimeout(this.timeout);
425 this.timeout = setTimeout(function () {
426 !_this3.mouseInChild && _this3.rootMenu.closeMenu(_this3.index);
427 }, this.hideTimeout);
428
429 if (this.appendToBody && deepDispatch) {
430 if (this.$parent.$options.name === 'ElSubmenu') {
431 this.$parent.handleMouseleave(true);
432 }
433 }
434 },
435 handleTitleMouseenter: function handleTitleMouseenter() {
436 if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
437 var title = this.$refs['submenu-title'];
438 title && (title.style.backgroundColor = this.rootMenu.hoverBackground);
439 },
440 handleTitleMouseleave: function handleTitleMouseleave() {
441 if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
442 var title = this.$refs['submenu-title'];
443 title && (title.style.backgroundColor = this.rootMenu.backgroundColor || '');
444 },
445 updatePlacement: function updatePlacement() {
446 this.currentPlacement = this.mode === 'horizontal' && this.isFirstLevel ? 'bottom-start' : 'right-start';
447 },
448 initPopper: function initPopper() {
449 this.referenceElm = this.$el;
450 this.popperElm = this.$refs.menu;
451 this.updatePlacement();
452 }
453 },
454 created: function created() {
455 var _this4 = this;
456
457 this.$on('toggle-collapse', this.handleCollapseToggle);
458 this.$on('mouse-enter-child', function () {
459 _this4.mouseInChild = true;
460 clearTimeout(_this4.timeout);
461 });
462 this.$on('mouse-leave-child', function () {
463 _this4.mouseInChild = false;
464 clearTimeout(_this4.timeout);
465 });
466 },
467 mounted: function mounted() {
468 this.parentMenu.addSubmenu(this);
469 this.rootMenu.addSubmenu(this);
470 this.initPopper();
471 },
472 beforeDestroy: function beforeDestroy() {
473 this.parentMenu.removeSubmenu(this);
474 this.rootMenu.removeSubmenu(this);
475 },
476 render: function render(h) {
477 var _this5 = this;
478
479 var active = this.active,
480 opened = this.opened,
481 paddingStyle = this.paddingStyle,
482 titleStyle = this.titleStyle,
483 backgroundColor = this.backgroundColor,
484 rootMenu = this.rootMenu,
485 currentPlacement = this.currentPlacement,
486 menuTransitionName = this.menuTransitionName,
487 mode = this.mode,
488 disabled = this.disabled,
489 popperClass = this.popperClass,
490 $slots = this.$slots,
491 isFirstLevel = this.isFirstLevel;
492
493
494 var popupMenu = h(
495 'transition',
496 {
497 attrs: { name: menuTransitionName }
498 },
499 [h(
500 'div',
501 {
502 ref: 'menu',
503 directives: [{
504 name: 'show',
505 value: opened
506 }],
507
508 'class': ['el-menu--' + mode, popperClass],
509 on: {
510 'mouseenter': function mouseenter($event) {
511 return _this5.handleMouseenter($event, 100);
512 },
513 'mouseleave': function mouseleave() {
514 return _this5.handleMouseleave(true);
515 },
516 'focus': function focus($event) {
517 return _this5.handleMouseenter($event, 100);
518 }
519 }
520 },
521 [h(
522 'ul',
523 {
524 attrs: {
525 role: 'menu'
526 },
527 'class': ['el-menu el-menu--popup', 'el-menu--popup-' + currentPlacement],
528 style: { backgroundColor: rootMenu.backgroundColor || '' } },
529 [$slots.default]
530 )]
531 )]
532 );
533
534 var inlineMenu = h('el-collapse-transition', [h(
535 'ul',
536 {
537 attrs: {
538 role: 'menu'
539 },
540 'class': 'el-menu el-menu--inline',
541 directives: [{
542 name: 'show',
543 value: opened
544 }],
545
546 style: { backgroundColor: rootMenu.backgroundColor || '' } },
547 [$slots.default]
548 )]);
549
550 var submenuTitleIcon = rootMenu.mode === 'horizontal' && isFirstLevel || rootMenu.mode === 'vertical' && !rootMenu.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-right';
551
552 return h(
553 'li',
554 {
555 'class': {
556 'el-submenu': true,
557 'is-active': active,
558 'is-opened': opened,
559 'is-disabled': disabled
560 },
561 attrs: { role: 'menuitem',
562 'aria-haspopup': 'true',
563 'aria-expanded': opened
564 },
565 on: {
566 'mouseenter': this.handleMouseenter,
567 'mouseleave': function mouseleave() {
568 return _this5.handleMouseleave(false);
569 },
570 'focus': this.handleMouseenter
571 }
572 },
573 [h(
574 'div',
575 {
576 'class': 'el-submenu__title',
577 ref: 'submenu-title',
578 on: {
579 'click': this.handleClick,
580 'mouseenter': this.handleTitleMouseenter,
581 'mouseleave': this.handleTitleMouseleave
582 },
583
584 style: [paddingStyle, titleStyle, { backgroundColor: backgroundColor }]
585 },
586 [$slots.title, h('i', { 'class': ['el-submenu__icon-arrow', submenuTitleIcon] })]
587 ), this.isMenuPopup ? popupMenu : inlineMenu]
588 );
589 }
590});
591// CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=script&lang=js&
592 /* harmony default export */ var src_submenuvue_type_script_lang_js_ = (submenuvue_type_script_lang_js_);
593// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
594var componentNormalizer = __webpack_require__(0);
595
596// CONCATENATED MODULE: ./packages/menu/src/submenu.vue
597var render, staticRenderFns
598
599
600
601
602/* normalize component */
603
604var component = Object(componentNormalizer["a" /* default */])(
605 src_submenuvue_type_script_lang_js_,
606 render,
607 staticRenderFns,
608 false,
609 null,
610 null,
611 null
612
613)
614
615/* hot reload */
616if (false) { var api; }
617component.options.__file = "packages/menu/src/submenu.vue"
618/* harmony default export */ var submenu = (component.exports);
619// CONCATENATED MODULE: ./packages/submenu/index.js
620
621
622/* istanbul ignore next */
623submenu.install = function (Vue) {
624 Vue.component(submenu.name, submenu);
625};
626
627/* harmony default export */ var packages_submenu = __webpack_exports__["default"] = (submenu);
628
629/***/ }),
630
631/***/ 28:
632/***/ (function(module, exports) {
633
634module.exports = require("element-ui/lib/transitions/collapse-transition");
635
636/***/ }),
637
638/***/ 37:
639/***/ (function(module, __webpack_exports__, __webpack_require__) {
640
641"use strict";
642/* harmony default export */ __webpack_exports__["a"] = ({
643 inject: ['rootMenu'],
644 computed: {
645 indexPath: function indexPath() {
646 var path = [this.index];
647 var parent = this.$parent;
648 while (parent.$options.componentName !== 'ElMenu') {
649 if (parent.index) {
650 path.unshift(parent.index);
651 }
652 parent = parent.$parent;
653 }
654 return path;
655 },
656 parentMenu: function parentMenu() {
657 var parent = this.$parent;
658 while (parent && ['ElMenu', 'ElSubmenu'].indexOf(parent.$options.componentName) === -1) {
659 parent = parent.$parent;
660 }
661 return parent;
662 },
663 paddingStyle: function paddingStyle() {
664 if (this.rootMenu.mode !== 'vertical') return {};
665
666 var padding = 20;
667 var parent = this.$parent;
668
669 if (this.rootMenu.collapse) {
670 padding = 20;
671 } else {
672 while (parent && parent.$options.componentName !== 'ElMenu') {
673 if (parent.$options.componentName === 'ElSubmenu') {
674 padding += 20;
675 }
676 parent = parent.$parent;
677 }
678 }
679 return { paddingLeft: padding + 'px' };
680 }
681 }
682});
683
684/***/ }),
685
686/***/ 4:
687/***/ (function(module, exports) {
688
689module.exports = require("element-ui/lib/mixins/emitter");
690
691/***/ }),
692
693/***/ 5:
694/***/ (function(module, exports) {
695
696module.exports = require("element-ui/lib/utils/vue-popper");
697
698/***/ })
699
700/******/ });
\No newline at end of file