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, { enumerable: true, get: getter });
|
41 | }
|
42 | };
|
43 |
|
44 |
|
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 |
|
53 |
|
54 |
|
55 |
|
56 |
|
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 |
|
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 |
|
78 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
79 |
|
80 |
|
81 | __webpack_require__.p = "/dist/";
|
82 |
|
83 |
|
84 |
|
85 | return __webpack_require__(__webpack_require__.s = 121);
|
86 | })
|
87 |
|
88 | ({
|
89 |
|
90 | 0:
|
91 | (function(module, __webpack_exports__, __webpack_require__) {
|
92 |
|
93 | "use strict";
|
94 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function normalizeComponent (
|
102 | scriptExports,
|
103 | render,
|
104 | staticRenderFns,
|
105 | functionalTemplate,
|
106 | injectStyles,
|
107 | scopeId,
|
108 | moduleIdentifier, /* server only */
|
109 | shadowMode /* vue-cli only */
|
110 | ) {
|
111 |
|
112 | var options = typeof scriptExports === 'function'
|
113 | ? scriptExports.options
|
114 | : scriptExports
|
115 |
|
116 |
|
117 | if (render) {
|
118 | options.render = render
|
119 | options.staticRenderFns = staticRenderFns
|
120 | options._compiled = true
|
121 | }
|
122 |
|
123 |
|
124 | if (functionalTemplate) {
|
125 | options.functional = true
|
126 | }
|
127 |
|
128 |
|
129 | if (scopeId) {
|
130 | options._scopeId = 'data-v-' + scopeId
|
131 | }
|
132 |
|
133 | var hook
|
134 | if (moduleIdentifier) {
|
135 | hook = function (context) {
|
136 |
|
137 | context =
|
138 | context ||
|
139 | (this.$vnode && this.$vnode.ssrContext) ||
|
140 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
141 |
|
142 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
143 | context = __VUE_SSR_CONTEXT__
|
144 | }
|
145 |
|
146 | if (injectStyles) {
|
147 | injectStyles.call(this, context)
|
148 | }
|
149 |
|
150 | if (context && context._registeredComponents) {
|
151 | context._registeredComponents.add(moduleIdentifier)
|
152 | }
|
153 | }
|
154 |
|
155 |
|
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 |
|
166 |
|
167 | options._injectStyles = hook
|
168 |
|
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 |
|
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 | 11:
|
193 | (function(module, exports) {
|
194 |
|
195 | module.exports = require("element-ui/lib/mixins/migrating");
|
196 |
|
197 | }),
|
198 |
|
199 | 12:
|
200 | (function(module, exports) {
|
201 |
|
202 | module.exports = require("element-ui/lib/utils/clickoutside");
|
203 |
|
204 | }),
|
205 |
|
206 | 121:
|
207 | (function(module, __webpack_exports__, __webpack_require__) {
|
208 |
|
209 | "use strict";
|
210 | __webpack_require__.r(__webpack_exports__);
|
211 |
|
212 |
|
213 | var clickoutside_ = __webpack_require__(12);
|
214 | var clickoutside_default = __webpack_require__.n(clickoutside_);
|
215 |
|
216 |
|
217 | var emitter_ = __webpack_require__(4);
|
218 | var emitter_default = __webpack_require__.n(emitter_);
|
219 |
|
220 |
|
221 | var migrating_ = __webpack_require__(11);
|
222 | var migrating_default = __webpack_require__.n(migrating_);
|
223 |
|
224 |
|
225 | var button_ = __webpack_require__(18);
|
226 | var button_default = __webpack_require__.n(button_);
|
227 |
|
228 |
|
229 | var button_group_ = __webpack_require__(45);
|
230 | var button_group_default = __webpack_require__.n(button_group_);
|
231 |
|
232 |
|
233 | var util_ = __webpack_require__(3);
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | var dropdownvue_type_script_lang_js_ = ({
|
245 | name: 'ElDropdown',
|
246 |
|
247 | componentName: 'ElDropdown',
|
248 |
|
249 | mixins: [emitter_default.a, migrating_default.a],
|
250 |
|
251 | directives: { Clickoutside: clickoutside_default.a },
|
252 |
|
253 | components: {
|
254 | ElButton: button_default.a,
|
255 | ElButtonGroup: button_group_default.a
|
256 | },
|
257 |
|
258 | provide: function provide() {
|
259 | return {
|
260 | dropdown: this
|
261 | };
|
262 | },
|
263 |
|
264 |
|
265 | props: {
|
266 | trigger: {
|
267 | type: String,
|
268 | default: 'hover'
|
269 | },
|
270 | type: String,
|
271 | size: {
|
272 | type: String,
|
273 | default: ''
|
274 | },
|
275 | splitButton: Boolean,
|
276 | hideOnClick: {
|
277 | type: Boolean,
|
278 | default: true
|
279 | },
|
280 | placement: {
|
281 | type: String,
|
282 | default: 'bottom-end'
|
283 | },
|
284 | visibleArrow: {
|
285 | default: true
|
286 | },
|
287 | showTimeout: {
|
288 | type: Number,
|
289 | default: 250
|
290 | },
|
291 | hideTimeout: {
|
292 | type: Number,
|
293 | default: 150
|
294 | },
|
295 | tabindex: {
|
296 | type: Number,
|
297 | default: 0
|
298 | }
|
299 | },
|
300 |
|
301 | data: function data() {
|
302 | return {
|
303 | timeout: null,
|
304 | visible: false,
|
305 | triggerElm: null,
|
306 | menuItems: null,
|
307 | menuItemsArray: null,
|
308 | dropdownElm: null,
|
309 | focusing: false,
|
310 | listId: 'dropdown-menu-' + Object(util_["generateId"])()
|
311 | };
|
312 | },
|
313 |
|
314 |
|
315 | computed: {
|
316 | dropdownSize: function dropdownSize() {
|
317 | return this.size || (this.$ELEMENT || {}).size;
|
318 | }
|
319 | },
|
320 |
|
321 | mounted: function mounted() {
|
322 | this.$on('menu-item-click', this.handleMenuItemClick);
|
323 | },
|
324 |
|
325 |
|
326 | watch: {
|
327 | visible: function visible(val) {
|
328 | this.broadcast('ElDropdownMenu', 'visible', val);
|
329 | this.$emit('visible-change', val);
|
330 | },
|
331 | focusing: function focusing(val) {
|
332 | var selfDefine = this.$el.querySelector('.el-dropdown-selfdefine');
|
333 | if (selfDefine) {
|
334 |
|
335 | if (val) {
|
336 | selfDefine.className += ' focusing';
|
337 | } else {
|
338 | selfDefine.className = selfDefine.className.replace('focusing', '');
|
339 | }
|
340 | }
|
341 | }
|
342 | },
|
343 |
|
344 | methods: {
|
345 | getMigratingConfig: function getMigratingConfig() {
|
346 | return {
|
347 | props: {
|
348 | 'menu-align': 'menu-align is renamed to placement.'
|
349 | }
|
350 | };
|
351 | },
|
352 | show: function show() {
|
353 | var _this = this;
|
354 |
|
355 | if (this.triggerElm.disabled) return;
|
356 | clearTimeout(this.timeout);
|
357 | this.timeout = setTimeout(function () {
|
358 | _this.visible = true;
|
359 | }, this.trigger === 'click' ? 0 : this.showTimeout);
|
360 | },
|
361 | hide: function hide() {
|
362 | var _this2 = this;
|
363 |
|
364 | if (this.triggerElm.disabled) return;
|
365 | this.removeTabindex();
|
366 | if (this.tabindex >= 0) {
|
367 | this.resetTabindex(this.triggerElm);
|
368 | }
|
369 | clearTimeout(this.timeout);
|
370 | this.timeout = setTimeout(function () {
|
371 | _this2.visible = false;
|
372 | }, this.trigger === 'click' ? 0 : this.hideTimeout);
|
373 | },
|
374 | handleClick: function handleClick() {
|
375 | if (this.triggerElm.disabled) return;
|
376 | if (this.visible) {
|
377 | this.hide();
|
378 | } else {
|
379 | this.show();
|
380 | }
|
381 | },
|
382 | handleTriggerKeyDown: function handleTriggerKeyDown(ev) {
|
383 | var keyCode = ev.keyCode;
|
384 | if ([38, 40].indexOf(keyCode) > -1) {
|
385 |
|
386 | this.removeTabindex();
|
387 | this.resetTabindex(this.menuItems[0]);
|
388 | this.menuItems[0].focus();
|
389 | ev.preventDefault();
|
390 | ev.stopPropagation();
|
391 | } else if (keyCode === 13) {
|
392 |
|
393 | this.handleClick();
|
394 | } else if ([9, 27].indexOf(keyCode) > -1) {
|
395 |
|
396 | this.hide();
|
397 | }
|
398 | },
|
399 | handleItemKeyDown: function handleItemKeyDown(ev) {
|
400 | var keyCode = ev.keyCode;
|
401 | var target = ev.target;
|
402 | var currentIndex = this.menuItemsArray.indexOf(target);
|
403 | var max = this.menuItemsArray.length - 1;
|
404 | var nextIndex = void 0;
|
405 | if ([38, 40].indexOf(keyCode) > -1) {
|
406 |
|
407 | if (keyCode === 38) {
|
408 |
|
409 | nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
|
410 | } else {
|
411 |
|
412 | nextIndex = currentIndex < max ? currentIndex + 1 : max;
|
413 | }
|
414 | this.removeTabindex();
|
415 | this.resetTabindex(this.menuItems[nextIndex]);
|
416 | this.menuItems[nextIndex].focus();
|
417 | ev.preventDefault();
|
418 | ev.stopPropagation();
|
419 | } else if (keyCode === 13) {
|
420 |
|
421 | this.triggerElmFocus();
|
422 | target.click();
|
423 | if (this.hideOnClick) {
|
424 |
|
425 | this.visible = false;
|
426 | }
|
427 | } else if ([9, 27].indexOf(keyCode) > -1) {
|
428 |
|
429 | this.hide();
|
430 | this.triggerElmFocus();
|
431 | }
|
432 | },
|
433 | resetTabindex: function resetTabindex(ele) {
|
434 |
|
435 | this.removeTabindex();
|
436 | ele.setAttribute('tabindex', '0');
|
437 | },
|
438 | removeTabindex: function removeTabindex() {
|
439 | this.triggerElm.setAttribute('tabindex', '-1');
|
440 | this.menuItemsArray.forEach(function (item) {
|
441 | item.setAttribute('tabindex', '-1');
|
442 | });
|
443 | },
|
444 | initAria: function initAria() {
|
445 | this.dropdownElm.setAttribute('id', this.listId);
|
446 | this.triggerElm.setAttribute('aria-haspopup', 'list');
|
447 | this.triggerElm.setAttribute('aria-controls', this.listId);
|
448 |
|
449 | if (!this.splitButton) {
|
450 |
|
451 | this.triggerElm.setAttribute('role', 'button');
|
452 | this.triggerElm.setAttribute('tabindex', this.tabindex);
|
453 | this.triggerElm.setAttribute('class', (this.triggerElm.getAttribute('class') || '') + ' el-dropdown-selfdefine');
|
454 | }
|
455 | },
|
456 | initEvent: function initEvent() {
|
457 | var _this3 = this;
|
458 |
|
459 | var trigger = this.trigger,
|
460 | show = this.show,
|
461 | hide = this.hide,
|
462 | handleClick = this.handleClick,
|
463 | splitButton = this.splitButton,
|
464 | handleTriggerKeyDown = this.handleTriggerKeyDown,
|
465 | handleItemKeyDown = this.handleItemKeyDown;
|
466 |
|
467 | this.triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm;
|
468 |
|
469 | var dropdownElm = this.dropdownElm;
|
470 |
|
471 | this.triggerElm.addEventListener('keydown', handleTriggerKeyDown);
|
472 | dropdownElm.addEventListener('keydown', handleItemKeyDown, true);
|
473 |
|
474 | if (!splitButton) {
|
475 | this.triggerElm.addEventListener('focus', function () {
|
476 | _this3.focusing = true;
|
477 | });
|
478 | this.triggerElm.addEventListener('blur', function () {
|
479 | _this3.focusing = false;
|
480 | });
|
481 | this.triggerElm.addEventListener('click', function () {
|
482 | _this3.focusing = false;
|
483 | });
|
484 | }
|
485 | if (trigger === 'hover') {
|
486 | this.triggerElm.addEventListener('mouseenter', show);
|
487 | this.triggerElm.addEventListener('mouseleave', hide);
|
488 | dropdownElm.addEventListener('mouseenter', show);
|
489 | dropdownElm.addEventListener('mouseleave', hide);
|
490 | } else if (trigger === 'click') {
|
491 | this.triggerElm.addEventListener('click', handleClick);
|
492 | }
|
493 | },
|
494 | handleMenuItemClick: function handleMenuItemClick(command, instance) {
|
495 | if (this.hideOnClick) {
|
496 | this.visible = false;
|
497 | }
|
498 | this.$emit('command', command, instance);
|
499 | },
|
500 | triggerElmFocus: function triggerElmFocus() {
|
501 | this.triggerElm.focus && this.triggerElm.focus();
|
502 | },
|
503 | initDomOperation: function initDomOperation() {
|
504 | this.dropdownElm = this.popperElm;
|
505 | this.menuItems = this.dropdownElm.querySelectorAll("[tabindex='-1']");
|
506 | this.menuItemsArray = [].slice.call(this.menuItems);
|
507 |
|
508 | this.initEvent();
|
509 | this.initAria();
|
510 | }
|
511 | },
|
512 |
|
513 | render: function render(h) {
|
514 | var _this4 = this;
|
515 |
|
516 | var hide = this.hide,
|
517 | splitButton = this.splitButton,
|
518 | type = this.type,
|
519 | dropdownSize = this.dropdownSize;
|
520 |
|
521 |
|
522 | var handleMainButtonClick = function handleMainButtonClick(event) {
|
523 | _this4.$emit('click', event);
|
524 | hide();
|
525 | };
|
526 |
|
527 | var triggerElm = !splitButton ? this.$slots.default : h('el-button-group', [h(
|
528 | 'el-button',
|
529 | {
|
530 | attrs: { type: type, size: dropdownSize },
|
531 | nativeOn: {
|
532 | 'click': handleMainButtonClick
|
533 | }
|
534 | },
|
535 | [this.$slots.default]
|
536 | ), h(
|
537 | 'el-button',
|
538 | { ref: 'trigger', attrs: { type: type, size: dropdownSize },
|
539 | 'class': 'el-dropdown__caret-button' },
|
540 | [h('i', { 'class': 'el-dropdown__icon el-icon-arrow-down' })]
|
541 | )]);
|
542 |
|
543 | return h(
|
544 | 'div',
|
545 | { 'class': 'el-dropdown', directives: [{
|
546 | name: 'clickoutside',
|
547 | value: hide
|
548 | }]
|
549 | },
|
550 | [triggerElm, this.$slots.dropdown]
|
551 | );
|
552 | }
|
553 | });
|
554 |
|
555 | var src_dropdownvue_type_script_lang_js_ = (dropdownvue_type_script_lang_js_);
|
556 |
|
557 | var componentNormalizer = __webpack_require__(0);
|
558 |
|
559 |
|
560 | var render, staticRenderFns
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 | var component = Object(componentNormalizer["a" ])(
|
568 | src_dropdownvue_type_script_lang_js_,
|
569 | render,
|
570 | staticRenderFns,
|
571 | false,
|
572 | null,
|
573 | null,
|
574 | null
|
575 |
|
576 | )
|
577 |
|
578 |
|
579 | if (false) { var api; }
|
580 | component.options.__file = "packages/dropdown/src/dropdown.vue"
|
581 | var dropdown = (component.exports);
|
582 |
|
583 |
|
584 |
|
585 |
|
586 | dropdown.install = function (Vue) {
|
587 | Vue.component(dropdown.name, dropdown);
|
588 | };
|
589 |
|
590 | var packages_dropdown = __webpack_exports__["default"] = (dropdown);
|
591 |
|
592 | }),
|
593 |
|
594 | 18:
|
595 | (function(module, exports) {
|
596 |
|
597 | module.exports = require("element-ui/lib/button");
|
598 |
|
599 | }),
|
600 |
|
601 | 3:
|
602 | (function(module, exports) {
|
603 |
|
604 | module.exports = require("element-ui/lib/utils/util");
|
605 |
|
606 | }),
|
607 |
|
608 | 4:
|
609 | (function(module, exports) {
|
610 |
|
611 | module.exports = require("element-ui/lib/mixins/emitter");
|
612 |
|
613 | }),
|
614 |
|
615 | 45:
|
616 | (function(module, exports) {
|
617 |
|
618 | module.exports = require("element-ui/lib/button-group");
|
619 |
|
620 | })
|
621 |
|
622 | }); |
\ | No newline at end of file |