UNPKG

38.7 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 = 78);
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/***/ 10:
193/***/ (function(module, exports) {
194
195module.exports = require("element-ui/lib/input");
196
197/***/ }),
198
199/***/ 11:
200/***/ (function(module, exports) {
201
202module.exports = require("element-ui/lib/mixins/migrating");
203
204/***/ }),
205
206/***/ 12:
207/***/ (function(module, exports) {
208
209module.exports = require("element-ui/lib/utils/clickoutside");
210
211/***/ }),
212
213/***/ 14:
214/***/ (function(module, exports) {
215
216module.exports = require("element-ui/lib/scrollbar");
217
218/***/ }),
219
220/***/ 16:
221/***/ (function(module, exports) {
222
223module.exports = require("element-ui/lib/utils/resize-event");
224
225/***/ }),
226
227/***/ 17:
228/***/ (function(module, exports) {
229
230module.exports = require("throttle-debounce/debounce");
231
232/***/ }),
233
234/***/ 19:
235/***/ (function(module, exports) {
236
237module.exports = require("element-ui/lib/utils/types");
238
239/***/ }),
240
241/***/ 20:
242/***/ (function(module, exports) {
243
244module.exports = require("element-ui/lib/locale");
245
246/***/ }),
247
248/***/ 21:
249/***/ (function(module, exports) {
250
251module.exports = require("element-ui/lib/utils/shared");
252
253/***/ }),
254
255/***/ 3:
256/***/ (function(module, exports) {
257
258module.exports = require("element-ui/lib/utils/util");
259
260/***/ }),
261
262/***/ 37:
263/***/ (function(module, exports) {
264
265module.exports = require("element-ui/lib/tag");
266
267/***/ }),
268
269/***/ 4:
270/***/ (function(module, exports) {
271
272module.exports = require("element-ui/lib/mixins/emitter");
273
274/***/ }),
275
276/***/ 40:
277/***/ (function(module, exports) {
278
279module.exports = require("element-ui/lib/utils/aria-utils");
280
281/***/ }),
282
283/***/ 5:
284/***/ (function(module, exports) {
285
286module.exports = require("element-ui/lib/utils/vue-popper");
287
288/***/ }),
289
290/***/ 50:
291/***/ (function(module, exports) {
292
293module.exports = require("element-ui/lib/cascader-panel");
294
295/***/ }),
296
297/***/ 6:
298/***/ (function(module, exports) {
299
300module.exports = require("element-ui/lib/mixins/locale");
301
302/***/ }),
303
304/***/ 78:
305/***/ (function(module, __webpack_exports__, __webpack_require__) {
306
307"use strict";
308__webpack_require__.r(__webpack_exports__);
309
310// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader/src/cascader.vue?vue&type=template&id=032537a6&
311var render = function() {
312 var _vm = this
313 var _h = _vm.$createElement
314 var _c = _vm._self._c || _h
315 return _c(
316 "div",
317 {
318 directives: [
319 {
320 name: "clickoutside",
321 rawName: "v-clickoutside",
322 value: function() {
323 return _vm.toggleDropDownVisible(false)
324 },
325 expression: "() => toggleDropDownVisible(false)"
326 }
327 ],
328 ref: "reference",
329 class: [
330 "el-cascader",
331 _vm.realSize && "el-cascader--" + _vm.realSize,
332 { "is-disabled": _vm.isDisabled }
333 ],
334 on: {
335 mouseenter: function($event) {
336 _vm.inputHover = true
337 },
338 mouseleave: function($event) {
339 _vm.inputHover = false
340 },
341 click: function() {
342 return _vm.toggleDropDownVisible(_vm.readonly ? undefined : true)
343 },
344 keydown: _vm.handleKeyDown
345 }
346 },
347 [
348 _c(
349 "el-input",
350 {
351 ref: "input",
352 class: { "is-focus": _vm.dropDownVisible },
353 attrs: {
354 size: _vm.realSize,
355 placeholder: _vm.placeholder,
356 readonly: _vm.readonly,
357 disabled: _vm.isDisabled,
358 "validate-event": false
359 },
360 on: {
361 focus: _vm.handleFocus,
362 blur: _vm.handleBlur,
363 input: _vm.handleInput
364 },
365 model: {
366 value: _vm.multiple ? _vm.presentText : _vm.inputValue,
367 callback: function($$v) {
368 _vm.multiple ? _vm.presentText : (_vm.inputValue = $$v)
369 },
370 expression: "multiple ? presentText : inputValue"
371 }
372 },
373 [
374 _c("template", { slot: "suffix" }, [
375 _vm.clearBtnVisible
376 ? _c("i", {
377 key: "clear",
378 staticClass: "el-input__icon el-icon-circle-close",
379 on: {
380 click: function($event) {
381 $event.stopPropagation()
382 return _vm.handleClear($event)
383 }
384 }
385 })
386 : _c("i", {
387 key: "arrow-down",
388 class: [
389 "el-input__icon",
390 "el-icon-arrow-down",
391 _vm.dropDownVisible && "is-reverse"
392 ],
393 on: {
394 click: function($event) {
395 $event.stopPropagation()
396 _vm.toggleDropDownVisible()
397 }
398 }
399 })
400 ])
401 ],
402 2
403 ),
404 _vm.multiple
405 ? _c(
406 "div",
407 { staticClass: "el-cascader__tags" },
408 [
409 _vm._l(_vm.presentTags, function(tag, index) {
410 return _c(
411 "el-tag",
412 {
413 key: tag.key,
414 attrs: {
415 type: "info",
416 size: _vm.tagSize,
417 hit: tag.hitState,
418 closable: tag.closable,
419 "disable-transitions": ""
420 },
421 on: {
422 close: function($event) {
423 _vm.deleteTag(index)
424 }
425 }
426 },
427 [_c("span", [_vm._v(_vm._s(tag.text))])]
428 )
429 }),
430 _vm.filterable && !_vm.isDisabled
431 ? _c("input", {
432 directives: [
433 {
434 name: "model",
435 rawName: "v-model.trim",
436 value: _vm.inputValue,
437 expression: "inputValue",
438 modifiers: { trim: true }
439 }
440 ],
441 staticClass: "el-cascader__search-input",
442 attrs: {
443 type: "text",
444 placeholder: _vm.presentTags.length ? "" : _vm.placeholder
445 },
446 domProps: { value: _vm.inputValue },
447 on: {
448 input: [
449 function($event) {
450 if ($event.target.composing) {
451 return
452 }
453 _vm.inputValue = $event.target.value.trim()
454 },
455 function(e) {
456 return _vm.handleInput(_vm.inputValue, e)
457 }
458 ],
459 click: function($event) {
460 $event.stopPropagation()
461 _vm.toggleDropDownVisible(true)
462 },
463 keydown: function($event) {
464 if (
465 !("button" in $event) &&
466 _vm._k(
467 $event.keyCode,
468 "delete",
469 [8, 46],
470 $event.key,
471 ["Backspace", "Delete", "Del"]
472 )
473 ) {
474 return null
475 }
476 return _vm.handleDelete($event)
477 },
478 blur: function($event) {
479 _vm.$forceUpdate()
480 }
481 }
482 })
483 : _vm._e()
484 ],
485 2
486 )
487 : _vm._e(),
488 _c(
489 "transition",
490 {
491 attrs: { name: "el-zoom-in-top" },
492 on: { "after-leave": _vm.handleDropdownLeave }
493 },
494 [
495 _c(
496 "div",
497 {
498 directives: [
499 {
500 name: "show",
501 rawName: "v-show",
502 value: _vm.dropDownVisible,
503 expression: "dropDownVisible"
504 }
505 ],
506 ref: "popper",
507 class: ["el-popper", "el-cascader__dropdown", _vm.popperClass]
508 },
509 [
510 _c("el-cascader-panel", {
511 directives: [
512 {
513 name: "show",
514 rawName: "v-show",
515 value: !_vm.filtering,
516 expression: "!filtering"
517 }
518 ],
519 ref: "panel",
520 attrs: {
521 options: _vm.options,
522 props: _vm.config,
523 border: false,
524 "render-label": _vm.$scopedSlots.default
525 },
526 on: {
527 "expand-change": _vm.handleExpandChange,
528 close: function($event) {
529 _vm.toggleDropDownVisible(false)
530 }
531 },
532 model: {
533 value: _vm.checkedValue,
534 callback: function($$v) {
535 _vm.checkedValue = $$v
536 },
537 expression: "checkedValue"
538 }
539 }),
540 _vm.filterable
541 ? _c(
542 "el-scrollbar",
543 {
544 directives: [
545 {
546 name: "show",
547 rawName: "v-show",
548 value: _vm.filtering,
549 expression: "filtering"
550 }
551 ],
552 ref: "suggestionPanel",
553 staticClass: "el-cascader__suggestion-panel",
554 attrs: {
555 tag: "ul",
556 "view-class": "el-cascader__suggestion-list"
557 },
558 nativeOn: {
559 keydown: function($event) {
560 return _vm.handleSuggestionKeyDown($event)
561 }
562 }
563 },
564 [
565 _vm.suggestions.length
566 ? _vm._l(_vm.suggestions, function(item, index) {
567 return _c(
568 "li",
569 {
570 key: item.uid,
571 class: [
572 "el-cascader__suggestion-item",
573 item.checked && "is-checked"
574 ],
575 attrs: { tabindex: -1 },
576 on: {
577 click: function($event) {
578 _vm.handleSuggestionClick(index)
579 }
580 }
581 },
582 [
583 _c("span", [_vm._v(_vm._s(item.text))]),
584 item.checked
585 ? _c("i", { staticClass: "el-icon-check" })
586 : _vm._e()
587 ]
588 )
589 })
590 : _vm._t("empty", [
591 _c(
592 "li",
593 { staticClass: "el-cascader__empty-text" },
594 [_vm._v(_vm._s(_vm.t("el.cascader.noMatch")))]
595 )
596 ])
597 ],
598 2
599 )
600 : _vm._e()
601 ],
602 1
603 )
604 ]
605 )
606 ],
607 1
608 )
609}
610var staticRenderFns = []
611render._withStripped = true
612
613
614// CONCATENATED MODULE: ./packages/cascader/src/cascader.vue?vue&type=template&id=032537a6&
615
616// EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
617var vue_popper_ = __webpack_require__(5);
618var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
619
620// EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
621var clickoutside_ = __webpack_require__(12);
622var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
623
624// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
625var emitter_ = __webpack_require__(4);
626var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
627
628// EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
629var locale_ = __webpack_require__(6);
630var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
631
632// EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
633var migrating_ = __webpack_require__(11);
634var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
635
636// EXTERNAL MODULE: external "element-ui/lib/input"
637var input_ = __webpack_require__(10);
638var input_default = /*#__PURE__*/__webpack_require__.n(input_);
639
640// EXTERNAL MODULE: external "element-ui/lib/tag"
641var tag_ = __webpack_require__(37);
642var tag_default = /*#__PURE__*/__webpack_require__.n(tag_);
643
644// EXTERNAL MODULE: external "element-ui/lib/scrollbar"
645var scrollbar_ = __webpack_require__(14);
646var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
647
648// EXTERNAL MODULE: external "element-ui/lib/cascader-panel"
649var cascader_panel_ = __webpack_require__(50);
650var cascader_panel_default = /*#__PURE__*/__webpack_require__.n(cascader_panel_);
651
652// EXTERNAL MODULE: external "element-ui/lib/utils/aria-utils"
653var aria_utils_ = __webpack_require__(40);
654var aria_utils_default = /*#__PURE__*/__webpack_require__.n(aria_utils_);
655
656// EXTERNAL MODULE: external "element-ui/lib/locale"
657var lib_locale_ = __webpack_require__(20);
658
659// EXTERNAL MODULE: external "element-ui/lib/utils/util"
660var util_ = __webpack_require__(3);
661
662// EXTERNAL MODULE: external "element-ui/lib/utils/types"
663var types_ = __webpack_require__(19);
664
665// EXTERNAL MODULE: external "element-ui/lib/utils/shared"
666var shared_ = __webpack_require__(21);
667
668// EXTERNAL MODULE: external "element-ui/lib/utils/resize-event"
669var resize_event_ = __webpack_require__(16);
670
671// EXTERNAL MODULE: external "throttle-debounce/debounce"
672var debounce_ = __webpack_require__(17);
673var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
674
675// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader/src/cascader.vue?vue&type=script&lang=js&
676//
677//
678//
679//
680//
681//
682//
683//
684//
685//
686//
687//
688//
689//
690//
691//
692//
693//
694//
695//
696//
697//
698//
699//
700//
701//
702//
703//
704//
705//
706//
707//
708//
709//
710//
711//
712//
713//
714//
715//
716//
717//
718//
719//
720//
721//
722//
723//
724//
725//
726//
727//
728//
729//
730//
731//
732//
733//
734//
735//
736//
737//
738//
739//
740//
741//
742//
743//
744//
745//
746//
747//
748//
749//
750//
751//
752//
753//
754//
755//
756//
757//
758//
759//
760//
761//
762//
763//
764//
765//
766//
767//
768//
769//
770//
771//
772//
773//
774//
775//
776//
777//
778//
779//
780//
781//
782//
783//
784//
785//
786//
787//
788//
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807var KeyCode = aria_utils_default.a.keys;
808
809var MigratingProps = {
810 expandTrigger: {
811 newProp: 'expandTrigger',
812 type: String
813 },
814 changeOnSelect: {
815 newProp: 'checkStrictly',
816 type: Boolean
817 },
818 hoverThreshold: {
819 newProp: 'hoverThreshold',
820 type: Number
821 }
822};
823
824var PopperMixin = {
825 props: {
826 placement: {
827 type: String,
828 default: 'bottom-start'
829 },
830 appendToBody: vue_popper_default.a.props.appendToBody,
831 visibleArrow: {
832 type: Boolean,
833 default: true
834 },
835 arrowOffset: vue_popper_default.a.props.arrowOffset,
836 offset: vue_popper_default.a.props.offset,
837 boundariesPadding: vue_popper_default.a.props.boundariesPadding,
838 popperOptions: vue_popper_default.a.props.popperOptions
839 },
840 methods: vue_popper_default.a.methods,
841 data: vue_popper_default.a.data,
842 beforeDestroy: vue_popper_default.a.beforeDestroy
843};
844
845var InputSizeMap = {
846 medium: 36,
847 small: 32,
848 mini: 28
849};
850
851/* harmony default export */ var cascadervue_type_script_lang_js_ = ({
852 name: 'ElCascader',
853
854 directives: { Clickoutside: clickoutside_default.a },
855
856 mixins: [PopperMixin, emitter_default.a, locale_default.a, migrating_default.a],
857
858 inject: {
859 elForm: {
860 default: ''
861 },
862 elFormItem: {
863 default: ''
864 }
865 },
866
867 components: {
868 ElInput: input_default.a,
869 ElTag: tag_default.a,
870 ElScrollbar: scrollbar_default.a,
871 ElCascaderPanel: cascader_panel_default.a
872 },
873
874 props: {
875 value: {},
876 options: Array,
877 props: Object,
878 size: String,
879 placeholder: {
880 type: String,
881 default: function _default() {
882 return Object(lib_locale_["t"])('el.cascader.placeholder');
883 }
884 },
885 disabled: Boolean,
886 clearable: Boolean,
887 filterable: Boolean,
888 filterMethod: Function,
889 separator: {
890 type: String,
891 default: ' / '
892 },
893 showAllLevels: {
894 type: Boolean,
895 default: true
896 },
897 collapseTags: Boolean,
898 debounce: {
899 type: Number,
900 default: 300
901 },
902 beforeFilter: {
903 type: Function,
904 default: function _default() {
905 return function () {};
906 }
907 },
908 popperClass: String
909 },
910
911 data: function data() {
912 return {
913 dropDownVisible: false,
914 checkedValue: this.value || null,
915 inputHover: false,
916 inputValue: null,
917 presentText: null,
918 presentTags: [],
919 checkedNodes: [],
920 filtering: false,
921 suggestions: [],
922 inputInitialHeight: 0,
923 pressDeleteCount: 0
924 };
925 },
926
927
928 computed: {
929 realSize: function realSize() {
930 var _elFormItemSize = (this.elFormItem || {}).elFormItemSize;
931 return this.size || _elFormItemSize || (this.$ELEMENT || {}).size;
932 },
933 tagSize: function tagSize() {
934 return ['small', 'mini'].indexOf(this.realSize) > -1 ? 'mini' : 'small';
935 },
936 isDisabled: function isDisabled() {
937 return this.disabled || (this.elForm || {}).disabled;
938 },
939 config: function config() {
940 var config = this.props || {};
941 var $attrs = this.$attrs;
942
943
944 Object.keys(MigratingProps).forEach(function (oldProp) {
945 var _MigratingProps$oldPr = MigratingProps[oldProp],
946 newProp = _MigratingProps$oldPr.newProp,
947 type = _MigratingProps$oldPr.type;
948
949 var oldValue = $attrs[oldProp] || $attrs[Object(util_["kebabCase"])(oldProp)];
950 if (Object(shared_["isDef"])(oldProp) && !Object(shared_["isDef"])(config[newProp])) {
951 if (type === Boolean && oldValue === '') {
952 oldValue = true;
953 }
954 config[newProp] = oldValue;
955 }
956 });
957
958 return config;
959 },
960 multiple: function multiple() {
961 return this.config.multiple;
962 },
963 leafOnly: function leafOnly() {
964 return !this.config.checkStrictly;
965 },
966 readonly: function readonly() {
967 return !this.filterable || this.multiple;
968 },
969 clearBtnVisible: function clearBtnVisible() {
970 if (!this.clearable || this.isDisabled || this.filtering || !this.inputHover) {
971 return false;
972 }
973
974 return this.multiple ? !!this.checkedNodes.filter(function (node) {
975 return !node.isDisabled;
976 }).length : !!this.presentText;
977 },
978 panel: function panel() {
979 return this.$refs.panel;
980 }
981 },
982
983 watch: {
984 disabled: function disabled() {
985 this.computePresentContent();
986 },
987 value: function value(val) {
988 if (!Object(util_["isEqual"])(val, this.checkedValue)) {
989 this.checkedValue = val;
990 this.computePresentContent();
991 }
992 },
993 checkedValue: function checkedValue(val) {
994 var value = this.value,
995 dropDownVisible = this.dropDownVisible;
996 var _config = this.config,
997 checkStrictly = _config.checkStrictly,
998 multiple = _config.multiple;
999
1000
1001 if (!Object(util_["isEqual"])(val, value) || Object(types_["isUndefined"])(value)) {
1002 this.computePresentContent();
1003 // hide dropdown when single mode
1004 if (!multiple && !checkStrictly && dropDownVisible) {
1005 this.toggleDropDownVisible(false);
1006 }
1007
1008 this.$emit('input', val);
1009 this.$emit('change', val);
1010 this.dispatch('ElFormItem', 'el.form.change', [val]);
1011 }
1012 },
1013
1014 options: {
1015 handler: function handler() {
1016 this.$nextTick(this.computePresentContent);
1017 },
1018 deep: true
1019 },
1020 presentText: function presentText(val) {
1021 this.inputValue = val;
1022 },
1023 presentTags: function presentTags(val, oldVal) {
1024 if (this.multiple && (val.length || oldVal.length)) {
1025 this.$nextTick(this.updateStyle);
1026 }
1027 },
1028 filtering: function filtering(val) {
1029 this.$nextTick(this.updatePopper);
1030 }
1031 },
1032
1033 mounted: function mounted() {
1034 var _this = this;
1035
1036 var input = this.$refs.input;
1037
1038 if (input && input.$el) {
1039 this.inputInitialHeight = input.$el.offsetHeight || InputSizeMap[this.realSize] || 40;
1040 }
1041
1042 if (!Object(util_["isEmpty"])(this.value)) {
1043 this.computePresentContent();
1044 }
1045
1046 this.filterHandler = debounce_default()(this.debounce, function () {
1047 var inputValue = _this.inputValue;
1048
1049
1050 if (!inputValue) {
1051 _this.filtering = false;
1052 return;
1053 }
1054
1055 var before = _this.beforeFilter(inputValue);
1056 if (before && before.then) {
1057 before.then(_this.getSuggestions);
1058 } else if (before !== false) {
1059 _this.getSuggestions();
1060 } else {
1061 _this.filtering = false;
1062 }
1063 });
1064
1065 Object(resize_event_["addResizeListener"])(this.$el, this.updateStyle);
1066 },
1067 beforeDestroy: function beforeDestroy() {
1068 Object(resize_event_["removeResizeListener"])(this.$el, this.updateStyle);
1069 },
1070
1071
1072 methods: {
1073 getMigratingConfig: function getMigratingConfig() {
1074 return {
1075 props: {
1076 'expand-trigger': 'expand-trigger is removed, use `props.expandTrigger` instead.',
1077 'change-on-select': 'change-on-select is removed, use `props.checkStrictly` instead.',
1078 'hover-threshold': 'hover-threshold is removed, use `props.hoverThreshold` instead'
1079 },
1080 events: {
1081 'active-item-change': 'active-item-change is renamed to expand-change'
1082 }
1083 };
1084 },
1085 toggleDropDownVisible: function toggleDropDownVisible(visible) {
1086 var _this2 = this;
1087
1088 if (this.isDisabled) return;
1089
1090 var dropDownVisible = this.dropDownVisible;
1091 var input = this.$refs.input;
1092
1093 visible = Object(shared_["isDef"])(visible) ? visible : !dropDownVisible;
1094 if (visible !== dropDownVisible) {
1095 this.dropDownVisible = visible;
1096 if (visible) {
1097 this.$nextTick(function () {
1098 _this2.updatePopper();
1099 _this2.panel.scrollIntoView();
1100 });
1101 }
1102 input.$refs.input.setAttribute('aria-expanded', visible);
1103 this.$emit('visible-change', visible);
1104 }
1105 },
1106 handleDropdownLeave: function handleDropdownLeave() {
1107 this.filtering = false;
1108 this.inputValue = this.presentText;
1109 },
1110 handleKeyDown: function handleKeyDown(event) {
1111 switch (event.keyCode) {
1112 case KeyCode.enter:
1113 this.toggleDropDownVisible();
1114 break;
1115 case KeyCode.down:
1116 this.toggleDropDownVisible(true);
1117 this.focusFirstNode();
1118 event.preventDefault();
1119 break;
1120 case KeyCode.esc:
1121 case KeyCode.tab:
1122 this.toggleDropDownVisible(false);
1123 break;
1124 }
1125 },
1126 handleFocus: function handleFocus(e) {
1127 this.$emit('focus', e);
1128 },
1129 handleBlur: function handleBlur(e) {
1130 this.$emit('blur', e);
1131 },
1132 handleInput: function handleInput(val, event) {
1133 !this.dropDownVisible && this.toggleDropDownVisible(true);
1134
1135 if (event && event.isComposing) return;
1136 if (val) {
1137 this.filterHandler();
1138 } else {
1139 this.filtering = false;
1140 }
1141 },
1142 handleClear: function handleClear() {
1143 this.presentText = '';
1144 this.panel.clearCheckedNodes();
1145 },
1146 handleExpandChange: function handleExpandChange(value) {
1147 this.$nextTick(this.updatePopper.bind(this));
1148 this.$emit('expand-change', value);
1149 this.$emit('active-item-change', value); // Deprecated
1150 },
1151 focusFirstNode: function focusFirstNode() {
1152 var _this3 = this;
1153
1154 this.$nextTick(function () {
1155 var filtering = _this3.filtering;
1156 var _$refs = _this3.$refs,
1157 popper = _$refs.popper,
1158 suggestionPanel = _$refs.suggestionPanel;
1159
1160 var firstNode = null;
1161
1162 if (filtering && suggestionPanel) {
1163 firstNode = suggestionPanel.$el.querySelector('.el-cascader__suggestion-item');
1164 } else {
1165 var firstMenu = popper.querySelector('.el-cascader-menu');
1166 firstNode = firstMenu.querySelector('.el-cascader-node[tabindex="-1"]');
1167 }
1168
1169 if (firstNode) {
1170 firstNode.focus();
1171 !filtering && firstNode.click();
1172 }
1173 });
1174 },
1175 computePresentContent: function computePresentContent() {
1176 var _this4 = this;
1177
1178 // nextTick is required, because checked nodes may not change right now
1179 this.$nextTick(function () {
1180 if (_this4.config.multiple) {
1181 _this4.computePresentTags();
1182 _this4.presentText = _this4.presentTags.length ? ' ' : null;
1183 } else {
1184 _this4.computePresentText();
1185 }
1186 });
1187 },
1188 computePresentText: function computePresentText() {
1189 var checkedValue = this.checkedValue,
1190 config = this.config;
1191
1192 if (!Object(util_["isEmpty"])(checkedValue)) {
1193 var node = this.panel.getNodeByValue(checkedValue);
1194 if (node && (config.checkStrictly || node.isLeaf)) {
1195 this.presentText = node.getText(this.showAllLevels, this.separator);
1196 return;
1197 }
1198 }
1199 this.presentText = null;
1200 },
1201 computePresentTags: function computePresentTags() {
1202 var isDisabled = this.isDisabled,
1203 leafOnly = this.leafOnly,
1204 showAllLevels = this.showAllLevels,
1205 separator = this.separator,
1206 collapseTags = this.collapseTags;
1207
1208 var checkedNodes = this.getCheckedNodes(leafOnly);
1209 var tags = [];
1210
1211 var genTag = function genTag(node) {
1212 return {
1213 node: node,
1214 key: node.uid,
1215 text: node.getText(showAllLevels, separator),
1216 hitState: false,
1217 closable: !isDisabled && !node.isDisabled
1218 };
1219 };
1220
1221 if (checkedNodes.length) {
1222 var first = checkedNodes[0],
1223 rest = checkedNodes.slice(1);
1224
1225 var restCount = rest.length;
1226 tags.push(genTag(first));
1227
1228 if (restCount) {
1229 if (collapseTags) {
1230 tags.push({
1231 key: -1,
1232 text: '+ ' + restCount,
1233 closable: false
1234 });
1235 } else {
1236 rest.forEach(function (node) {
1237 return tags.push(genTag(node));
1238 });
1239 }
1240 }
1241 }
1242
1243 this.checkedNodes = checkedNodes;
1244 this.presentTags = tags;
1245 },
1246 getSuggestions: function getSuggestions() {
1247 var _this5 = this;
1248
1249 var filterMethod = this.filterMethod;
1250
1251
1252 if (!Object(types_["isFunction"])(filterMethod)) {
1253 filterMethod = function filterMethod(node, keyword) {
1254 return node.text.includes(keyword);
1255 };
1256 }
1257
1258 var suggestions = this.panel.getFlattedNodes(this.leafOnly).filter(function (node) {
1259 if (node.isDisabled) return false;
1260 node.text = node.getText(_this5.showAllLevels, _this5.separator) || '';
1261 return filterMethod(node, _this5.inputValue);
1262 });
1263
1264 if (this.multiple) {
1265 this.presentTags.forEach(function (tag) {
1266 tag.hitState = false;
1267 });
1268 } else {
1269 suggestions.forEach(function (node) {
1270 node.checked = Object(util_["isEqual"])(_this5.checkedValue, node.getValueByOption());
1271 });
1272 }
1273
1274 this.filtering = true;
1275 this.suggestions = suggestions;
1276 this.$nextTick(this.updatePopper);
1277 },
1278 handleSuggestionKeyDown: function handleSuggestionKeyDown(event) {
1279 var keyCode = event.keyCode,
1280 target = event.target;
1281
1282 switch (keyCode) {
1283 case KeyCode.enter:
1284 target.click();
1285 break;
1286 case KeyCode.up:
1287 var prev = target.previousElementSibling;
1288 prev && prev.focus();
1289 break;
1290 case KeyCode.down:
1291 var next = target.nextElementSibling;
1292 next && next.focus();
1293 break;
1294 case KeyCode.esc:
1295 case KeyCode.tab:
1296 this.toggleDropDownVisible(false);
1297 break;
1298 }
1299 },
1300 handleDelete: function handleDelete() {
1301 var inputValue = this.inputValue,
1302 pressDeleteCount = this.pressDeleteCount,
1303 presentTags = this.presentTags;
1304
1305 var lastIndex = presentTags.length - 1;
1306 var lastTag = presentTags[lastIndex];
1307 this.pressDeleteCount = inputValue ? 0 : pressDeleteCount + 1;
1308
1309 if (!lastTag) return;
1310
1311 if (this.pressDeleteCount) {
1312 if (lastTag.hitState) {
1313 this.deleteTag(lastIndex);
1314 } else {
1315 lastTag.hitState = true;
1316 }
1317 }
1318 },
1319 handleSuggestionClick: function handleSuggestionClick(index) {
1320 var multiple = this.multiple;
1321
1322 var targetNode = this.suggestions[index];
1323
1324 if (multiple) {
1325 var checked = targetNode.checked;
1326
1327 targetNode.doCheck(!checked);
1328 this.panel.calculateMultiCheckedValue();
1329 } else {
1330 this.checkedValue = targetNode.getValueByOption();
1331 this.toggleDropDownVisible(false);
1332 }
1333 },
1334 deleteTag: function deleteTag(index) {
1335 var checkedValue = this.checkedValue;
1336
1337 var val = checkedValue[index];
1338 this.checkedValue = checkedValue.filter(function (n, i) {
1339 return i !== index;
1340 });
1341 this.$emit('remove-tag', val);
1342 },
1343 updateStyle: function updateStyle() {
1344 var $el = this.$el,
1345 inputInitialHeight = this.inputInitialHeight;
1346
1347 if (this.$isServer || !$el) return;
1348
1349 var suggestionPanel = this.$refs.suggestionPanel;
1350
1351 var inputInner = $el.querySelector('.el-input__inner');
1352
1353 if (!inputInner) return;
1354
1355 var tags = $el.querySelector('.el-cascader__tags');
1356 var suggestionPanelEl = null;
1357
1358 if (suggestionPanel && (suggestionPanelEl = suggestionPanel.$el)) {
1359 var suggestionList = suggestionPanelEl.querySelector('.el-cascader__suggestion-list');
1360 suggestionList.style.minWidth = inputInner.offsetWidth + 'px';
1361 }
1362
1363 if (tags) {
1364 var offsetHeight = tags.offsetHeight;
1365
1366 var height = Math.max(offsetHeight + 6, inputInitialHeight) + 'px';
1367 inputInner.style.height = height;
1368 this.updatePopper();
1369 }
1370 },
1371
1372
1373 /**
1374 * public methods
1375 */
1376 getCheckedNodes: function getCheckedNodes(leafOnly) {
1377 return this.panel.getCheckedNodes(leafOnly);
1378 }
1379 }
1380});
1381// CONCATENATED MODULE: ./packages/cascader/src/cascader.vue?vue&type=script&lang=js&
1382 /* harmony default export */ var src_cascadervue_type_script_lang_js_ = (cascadervue_type_script_lang_js_);
1383// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
1384var componentNormalizer = __webpack_require__(0);
1385
1386// CONCATENATED MODULE: ./packages/cascader/src/cascader.vue
1387
1388
1389
1390
1391
1392/* normalize component */
1393
1394var component = Object(componentNormalizer["a" /* default */])(
1395 src_cascadervue_type_script_lang_js_,
1396 render,
1397 staticRenderFns,
1398 false,
1399 null,
1400 null,
1401 null
1402
1403)
1404
1405/* hot reload */
1406if (false) { var api; }
1407component.options.__file = "packages/cascader/src/cascader.vue"
1408/* harmony default export */ var cascader = (component.exports);
1409// CONCATENATED MODULE: ./packages/cascader/index.js
1410
1411
1412/* istanbul ignore next */
1413cascader.install = function (Vue) {
1414 Vue.component(cascader.name, cascader);
1415};
1416
1417/* harmony default export */ var packages_cascader = __webpack_exports__["default"] = (cascader);
1418
1419/***/ })
1420
1421/******/ });
\No newline at end of file