UNPKG

18.2 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 = 121);
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/***/ 11:
193/***/ (function(module, exports) {
194
195module.exports = require("element-ui/lib/mixins/migrating");
196
197/***/ }),
198
199/***/ 12:
200/***/ (function(module, exports) {
201
202module.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// EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
213var clickoutside_ = __webpack_require__(12);
214var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
215
216// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
217var emitter_ = __webpack_require__(4);
218var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
219
220// EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
221var migrating_ = __webpack_require__(11);
222var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
223
224// EXTERNAL MODULE: external "element-ui/lib/button"
225var button_ = __webpack_require__(18);
226var button_default = /*#__PURE__*/__webpack_require__.n(button_);
227
228// EXTERNAL MODULE: external "element-ui/lib/button-group"
229var button_group_ = __webpack_require__(45);
230var button_group_default = /*#__PURE__*/__webpack_require__.n(button_group_);
231
232// EXTERNAL MODULE: external "element-ui/lib/utils/util"
233var util_ = __webpack_require__(3);
234
235// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/dropdown/src/dropdown.vue?vue&type=script&lang=js&
236
237
238
239
240
241
242
243
244/* harmony default export */ 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 // up/down
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 // space enter选中
393 this.handleClick();
394 } else if ([9, 27].indexOf(keyCode) > -1) {
395 // tab || esc
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 // up/down
407 if (keyCode === 38) {
408 // up
409 nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
410 } else {
411 // down
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 // enter选中
421 this.triggerElmFocus();
422 target.click();
423 if (this.hideOnClick) {
424 // click关闭
425 this.visible = false;
426 }
427 } else if ([9, 27].indexOf(keyCode) > -1) {
428 // tab // esc
429 this.hide();
430 this.triggerElmFocus();
431 }
432 },
433 resetTabindex: function resetTabindex(ele) {
434 // 下次tab时组件聚焦元素
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); // triggerElm keydown
472 dropdownElm.addEventListener('keydown', handleItemKeyDown, true); // item keydown
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// CONCATENATED MODULE: ./packages/dropdown/src/dropdown.vue?vue&type=script&lang=js&
555 /* harmony default export */ var src_dropdownvue_type_script_lang_js_ = (dropdownvue_type_script_lang_js_);
556// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
557var componentNormalizer = __webpack_require__(0);
558
559// CONCATENATED MODULE: ./packages/dropdown/src/dropdown.vue
560var render, staticRenderFns
561
562
563
564
565/* normalize component */
566
567var component = Object(componentNormalizer["a" /* default */])(
568 src_dropdownvue_type_script_lang_js_,
569 render,
570 staticRenderFns,
571 false,
572 null,
573 null,
574 null
575
576)
577
578/* hot reload */
579if (false) { var api; }
580component.options.__file = "packages/dropdown/src/dropdown.vue"
581/* harmony default export */ var dropdown = (component.exports);
582// CONCATENATED MODULE: ./packages/dropdown/index.js
583
584
585/* istanbul ignore next */
586dropdown.install = function (Vue) {
587 Vue.component(dropdown.name, dropdown);
588};
589
590/* harmony default export */ var packages_dropdown = __webpack_exports__["default"] = (dropdown);
591
592/***/ }),
593
594/***/ 18:
595/***/ (function(module, exports) {
596
597module.exports = require("element-ui/lib/button");
598
599/***/ }),
600
601/***/ 3:
602/***/ (function(module, exports) {
603
604module.exports = require("element-ui/lib/utils/util");
605
606/***/ }),
607
608/***/ 4:
609/***/ (function(module, exports) {
610
611module.exports = require("element-ui/lib/mixins/emitter");
612
613/***/ }),
614
615/***/ 45:
616/***/ (function(module, exports) {
617
618module.exports = require("element-ui/lib/button-group");
619
620/***/ })
621
622/******/ });
\No newline at end of file