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 = 72);
|
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 | 10:
|
187 | (function(module, exports) {
|
188 |
|
189 | module.exports = require("element-ui/lib/utils/clickoutside");
|
190 |
|
191 | }),
|
192 |
|
193 | 15:
|
194 | (function(module, exports) {
|
195 |
|
196 | module.exports = require("element-ui/lib/button");
|
197 |
|
198 | }),
|
199 |
|
200 | 2:
|
201 | (function(module, exports) {
|
202 |
|
203 | module.exports = require("element-ui/lib/utils/util");
|
204 |
|
205 | }),
|
206 |
|
207 | 72:
|
208 | (function(module, exports, __webpack_require__) {
|
209 |
|
210 | "use strict";
|
211 |
|
212 |
|
213 | exports.__esModule = true;
|
214 |
|
215 | var _dropdown = __webpack_require__(73);
|
216 |
|
217 | var _dropdown2 = _interopRequireDefault(_dropdown);
|
218 |
|
219 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
220 |
|
221 |
|
222 | _dropdown2.default.install = function (Vue) {
|
223 | Vue.component(_dropdown2.default.name, _dropdown2.default);
|
224 | };
|
225 |
|
226 | exports.default = _dropdown2.default;
|
227 |
|
228 | }),
|
229 |
|
230 | 73:
|
231 | (function(module, __webpack_exports__, __webpack_require__) {
|
232 |
|
233 | "use strict";
|
234 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
235 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_dropdown_vue__ = __webpack_require__(74);
|
236 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_dropdown_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_dropdown_vue__);
|
237 | var normalizeComponent = __webpack_require__(0)
|
238 |
|
239 |
|
240 |
|
241 | var __vue_template__ = null
|
242 |
|
243 | var __vue_template_functional__ = false
|
244 |
|
245 | var __vue_styles__ = null
|
246 |
|
247 | var __vue_scopeId__ = null
|
248 |
|
249 | var __vue_module_identifier__ = null
|
250 | var Component = normalizeComponent(
|
251 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_dropdown_vue___default.a,
|
252 | __vue_template__,
|
253 | __vue_template_functional__,
|
254 | __vue_styles__,
|
255 | __vue_scopeId__,
|
256 | __vue_module_identifier__
|
257 | )
|
258 |
|
259 | __webpack_exports__["default"] = (Component.exports);
|
260 |
|
261 |
|
262 | }),
|
263 |
|
264 | 74:
|
265 | (function(module, exports, __webpack_require__) {
|
266 |
|
267 | "use strict";
|
268 |
|
269 |
|
270 | exports.__esModule = true;
|
271 |
|
272 | var _clickoutside = __webpack_require__(10);
|
273 |
|
274 | var _clickoutside2 = _interopRequireDefault(_clickoutside);
|
275 |
|
276 | var _emitter = __webpack_require__(1);
|
277 |
|
278 | var _emitter2 = _interopRequireDefault(_emitter);
|
279 |
|
280 | var _migrating = __webpack_require__(8);
|
281 |
|
282 | var _migrating2 = _interopRequireDefault(_migrating);
|
283 |
|
284 | var _button = __webpack_require__(15);
|
285 |
|
286 | var _button2 = _interopRequireDefault(_button);
|
287 |
|
288 | var _buttonGroup = __webpack_require__(75);
|
289 |
|
290 | var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
|
291 |
|
292 | var _util = __webpack_require__(2);
|
293 |
|
294 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
295 |
|
296 | exports.default = {
|
297 | name: 'ElDropdown',
|
298 |
|
299 | componentName: 'ElDropdown',
|
300 |
|
301 | mixins: [_emitter2.default, _migrating2.default],
|
302 |
|
303 | directives: { Clickoutside: _clickoutside2.default },
|
304 |
|
305 | components: {
|
306 | ElButton: _button2.default,
|
307 | ElButtonGroup: _buttonGroup2.default
|
308 | },
|
309 |
|
310 | provide: function provide() {
|
311 | return {
|
312 | dropdown: this
|
313 | };
|
314 | },
|
315 |
|
316 |
|
317 | props: {
|
318 | trigger: {
|
319 | type: String,
|
320 | default: 'hover'
|
321 | },
|
322 | type: String,
|
323 | size: {
|
324 | type: String,
|
325 | default: ''
|
326 | },
|
327 | splitButton: Boolean,
|
328 | hideOnClick: {
|
329 | type: Boolean,
|
330 | default: true
|
331 | },
|
332 | placement: {
|
333 | type: String,
|
334 | default: 'bottom-end'
|
335 | },
|
336 | visibleArrow: {
|
337 | default: true
|
338 | },
|
339 | showTimeout: {
|
340 | type: Number,
|
341 | default: 250
|
342 | },
|
343 | hideTimeout: {
|
344 | type: Number,
|
345 | default: 150
|
346 | }
|
347 | },
|
348 |
|
349 | data: function data() {
|
350 | return {
|
351 | timeout: null,
|
352 | visible: false,
|
353 | triggerElm: null,
|
354 | menuItems: null,
|
355 | menuItemsArray: null,
|
356 | dropdownElm: null,
|
357 | focusing: false,
|
358 | listId: 'dropdown-menu-' + (0, _util.generateId)()
|
359 | };
|
360 | },
|
361 |
|
362 |
|
363 | computed: {
|
364 | dropdownSize: function dropdownSize() {
|
365 | return this.size || (this.$ELEMENT || {}).size;
|
366 | }
|
367 | },
|
368 |
|
369 | mounted: function mounted() {
|
370 | this.$on('menu-item-click', this.handleMenuItemClick);
|
371 | this.initEvent();
|
372 | this.initAria();
|
373 | },
|
374 |
|
375 |
|
376 | watch: {
|
377 | visible: function visible(val) {
|
378 | this.broadcast('ElDropdownMenu', 'visible', val);
|
379 | this.$emit('visible-change', val);
|
380 | },
|
381 | focusing: function focusing(val) {
|
382 | var selfDefine = this.$el.querySelector('.el-dropdown-selfdefine');
|
383 | if (selfDefine) {
|
384 |
|
385 | if (val) {
|
386 | selfDefine.className += ' focusing';
|
387 | } else {
|
388 | selfDefine.className = selfDefine.className.replace('focusing', '');
|
389 | }
|
390 | }
|
391 | }
|
392 | },
|
393 |
|
394 | methods: {
|
395 | getMigratingConfig: function getMigratingConfig() {
|
396 | return {
|
397 | props: {
|
398 | 'menu-align': 'menu-align is renamed to placement.'
|
399 | }
|
400 | };
|
401 | },
|
402 | show: function show() {
|
403 | var _this = this;
|
404 |
|
405 | if (this.triggerElm.disabled) return;
|
406 | clearTimeout(this.timeout);
|
407 | this.timeout = setTimeout(function () {
|
408 | _this.visible = true;
|
409 | }, this.trigger === 'click' ? 0 : this.showTimeout);
|
410 | },
|
411 | hide: function hide() {
|
412 | var _this2 = this;
|
413 |
|
414 | if (this.triggerElm.disabled) return;
|
415 | this.removeTabindex();
|
416 | this.resetTabindex(this.triggerElm);
|
417 | clearTimeout(this.timeout);
|
418 | this.timeout = setTimeout(function () {
|
419 | _this2.visible = false;
|
420 | }, this.trigger === 'click' ? 0 : this.hideTimeout);
|
421 | },
|
422 | handleClick: function handleClick() {
|
423 | if (this.triggerElm.disabled) return;
|
424 | if (this.visible) {
|
425 | this.hide();
|
426 | } else {
|
427 | this.show();
|
428 | }
|
429 | },
|
430 | handleTriggerKeyDown: function handleTriggerKeyDown(ev) {
|
431 | var keyCode = ev.keyCode;
|
432 | if ([38, 40].indexOf(keyCode) > -1) {
|
433 |
|
434 | this.removeTabindex();
|
435 | this.resetTabindex(this.menuItems[0]);
|
436 | this.menuItems[0].focus();
|
437 | ev.preventDefault();
|
438 | ev.stopPropagation();
|
439 | } else if (keyCode === 13) {
|
440 |
|
441 | this.handleClick();
|
442 | } else if ([9, 27].indexOf(keyCode) > -1) {
|
443 |
|
444 | this.hide();
|
445 | }
|
446 | return;
|
447 | },
|
448 | handleItemKeyDown: function handleItemKeyDown(ev) {
|
449 | var keyCode = ev.keyCode;
|
450 | var target = ev.target;
|
451 | var currentIndex = this.menuItemsArray.indexOf(target);
|
452 | var max = this.menuItemsArray.length - 1;
|
453 | var nextIndex = void 0;
|
454 | if ([38, 40].indexOf(keyCode) > -1) {
|
455 |
|
456 | if (keyCode === 38) {
|
457 |
|
458 | nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
|
459 | } else {
|
460 |
|
461 | nextIndex = currentIndex < max ? currentIndex + 1 : max;
|
462 | }
|
463 | this.removeTabindex();
|
464 | this.resetTabindex(this.menuItems[nextIndex]);
|
465 | this.menuItems[nextIndex].focus();
|
466 | ev.preventDefault();
|
467 | ev.stopPropagation();
|
468 | } else if (keyCode === 13) {
|
469 |
|
470 | this.triggerElm.focus();
|
471 | target.click();
|
472 | if (this.hideOnClick) {
|
473 |
|
474 | this.visible = false;
|
475 | }
|
476 | } else if ([9, 27].indexOf(keyCode) > -1) {
|
477 |
|
478 | this.hide();
|
479 | this.triggerElm.focus();
|
480 | }
|
481 | return;
|
482 | },
|
483 | resetTabindex: function resetTabindex(ele) {
|
484 |
|
485 | this.removeTabindex();
|
486 | ele.setAttribute('tabindex', '0');
|
487 | },
|
488 | removeTabindex: function removeTabindex() {
|
489 | this.triggerElm.setAttribute('tabindex', '-1');
|
490 | this.menuItemsArray.forEach(function (item) {
|
491 | item.setAttribute('tabindex', '-1');
|
492 | });
|
493 | },
|
494 | initAria: function initAria() {
|
495 | this.dropdownElm.setAttribute('id', this.listId);
|
496 | this.triggerElm.setAttribute('aria-haspopup', 'list');
|
497 | this.triggerElm.setAttribute('aria-controls', this.listId);
|
498 | this.menuItems = this.dropdownElm.querySelectorAll("[tabindex='-1']");
|
499 | this.menuItemsArray = Array.prototype.slice.call(this.menuItems);
|
500 |
|
501 | if (!this.splitButton) {
|
502 |
|
503 | this.triggerElm.setAttribute('role', 'button');
|
504 | this.triggerElm.setAttribute('tabindex', '0');
|
505 | this.triggerElm.setAttribute('class', (this.triggerElm.getAttribute('class') || '') + ' el-dropdown-selfdefine');
|
506 | }
|
507 | },
|
508 | initEvent: function initEvent() {
|
509 | var _this3 = this;
|
510 |
|
511 | var trigger = this.trigger,
|
512 | show = this.show,
|
513 | hide = this.hide,
|
514 | handleClick = this.handleClick,
|
515 | splitButton = this.splitButton,
|
516 | handleTriggerKeyDown = this.handleTriggerKeyDown,
|
517 | handleItemKeyDown = this.handleItemKeyDown;
|
518 |
|
519 | this.triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm;
|
520 |
|
521 | var dropdownElm = this.dropdownElm = this.$slots.dropdown[0].elm;
|
522 |
|
523 | this.triggerElm.addEventListener('keydown', handleTriggerKeyDown);
|
524 | dropdownElm.addEventListener('keydown', handleItemKeyDown, true);
|
525 |
|
526 | if (!splitButton) {
|
527 | this.triggerElm.addEventListener('focus', function () {
|
528 | _this3.focusing = true;
|
529 | });
|
530 | this.triggerElm.addEventListener('blur', function () {
|
531 | _this3.focusing = false;
|
532 | });
|
533 | this.triggerElm.addEventListener('click', function () {
|
534 | _this3.focusing = false;
|
535 | });
|
536 | }
|
537 | if (trigger === 'hover') {
|
538 | this.triggerElm.addEventListener('mouseenter', show);
|
539 | this.triggerElm.addEventListener('mouseleave', hide);
|
540 | dropdownElm.addEventListener('mouseenter', show);
|
541 | dropdownElm.addEventListener('mouseleave', hide);
|
542 | } else if (trigger === 'click') {
|
543 | this.triggerElm.addEventListener('click', handleClick);
|
544 | }
|
545 | },
|
546 | handleMenuItemClick: function handleMenuItemClick(command, instance) {
|
547 | if (this.hideOnClick) {
|
548 | this.visible = false;
|
549 | }
|
550 | this.$emit('command', command, instance);
|
551 | },
|
552 | focus: function focus() {
|
553 | this.triggerElm.focus && this.triggerElm.focus();
|
554 | }
|
555 | },
|
556 |
|
557 | render: function render(h) {
|
558 | var _this4 = this;
|
559 |
|
560 | var hide = this.hide,
|
561 | splitButton = this.splitButton,
|
562 | type = this.type,
|
563 | dropdownSize = this.dropdownSize;
|
564 |
|
565 |
|
566 | var handleMainButtonClick = function handleMainButtonClick(event) {
|
567 | _this4.$emit('click', event);
|
568 | hide();
|
569 | };
|
570 |
|
571 | var triggerElm = !splitButton ? this.$slots.default : h(
|
572 | 'el-button-group',
|
573 | null,
|
574 | [h(
|
575 | 'el-button',
|
576 | {
|
577 | attrs: { type: type, size: dropdownSize },
|
578 | nativeOn: {
|
579 | 'click': handleMainButtonClick
|
580 | }
|
581 | },
|
582 | [this.$slots.default]
|
583 | ), h(
|
584 | 'el-button',
|
585 | { ref: 'trigger', attrs: { type: type, size: dropdownSize },
|
586 | 'class': 'el-dropdown__caret-button' },
|
587 | [h(
|
588 | 'i',
|
589 | { 'class': 'el-dropdown__icon el-icon-arrow-down' },
|
590 | []
|
591 | )]
|
592 | )]
|
593 | );
|
594 |
|
595 | return h(
|
596 | 'div',
|
597 | { 'class': 'el-dropdown', directives: [{
|
598 | name: 'clickoutside',
|
599 | value: hide
|
600 | }]
|
601 | },
|
602 | [triggerElm, this.$slots.dropdown]
|
603 | );
|
604 | }
|
605 | };
|
606 |
|
607 | }),
|
608 |
|
609 | 75:
|
610 | (function(module, exports) {
|
611 |
|
612 | module.exports = require("element-ui/lib/button-group");
|
613 |
|
614 | }),
|
615 |
|
616 | 8:
|
617 | (function(module, exports) {
|
618 |
|
619 | module.exports = require("element-ui/lib/mixins/migrating");
|
620 |
|
621 | })
|
622 |
|
623 | }); |
\ | No newline at end of file |