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