module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 59);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functioal component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 11:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/utils/clickoutside");
/***/ }),
/***/ 13:
/***/ (function(module, exports) {
module.exports = require("throttle-debounce/debounce");
/***/ }),
/***/ 18:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/locale");
/***/ }),
/***/ 27:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/utils/scroll-into-view");
/***/ }),
/***/ 3:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/mixins/emitter");
/***/ }),
/***/ 32:
/***/ (function(module, exports) {
module.exports = require("babel-helper-vue-jsx-merge-props");
/***/ }),
/***/ 35:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/utils/shared");
/***/ }),
/***/ 4:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/utils/util");
/***/ }),
/***/ 5:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/utils/vue-popper");
/***/ }),
/***/ 59:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader/src/main.vue?vue&type=template&id=2e869fa1&
var mainvue_type_template_id_2e869fa1_render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"span",
{
directives: [
{
name: "clickoutside",
rawName: "v-clickoutside",
value: _vm.handleClickoutside,
expression: "handleClickoutside"
}
],
ref: "reference",
staticClass: "el-cascader",
class: [
{
"is-opened": _vm.menuVisible,
"is-disabled": _vm.cascaderDisabled
},
_vm.cascaderSize ? "el-cascader--" + _vm.cascaderSize : ""
],
on: {
click: _vm.handleClick,
mouseenter: function($event) {
_vm.inputHover = true
},
focus: function($event) {
_vm.inputHover = true
},
mouseleave: function($event) {
_vm.inputHover = false
},
blur: function($event) {
_vm.inputHover = false
},
keydown: _vm.handleKeydown
}
},
[
_c(
"el-input",
{
ref: "input",
class: { "is-focus": _vm.menuVisible },
attrs: {
readonly: _vm.readonly,
placeholder: _vm.currentLabels.length ? undefined : _vm.placeholder,
"validate-event": false,
size: _vm.size,
disabled: _vm.cascaderDisabled
},
on: {
input: _vm.debouncedInputChange,
focus: _vm.handleFocus,
blur: _vm.handleBlur
},
nativeOn: {
compositionstart: function($event) {
return _vm.handleComposition($event)
},
compositionend: function($event) {
return _vm.handleComposition($event)
}
},
model: {
value: _vm.inputValue,
callback: function($$v) {
_vm.inputValue = $$v
},
expression: "inputValue"
}
},
[
_c("template", { slot: "suffix" }, [
_vm.clearable && _vm.inputHover && _vm.currentLabels.length
? _c("i", {
key: "1",
staticClass:
"el-input__icon el-icon-circle-close el-cascader__clearIcon",
on: { click: _vm.clearValue }
})
: _c("i", {
key: "2",
staticClass: "el-input__icon el-icon-arrow-down",
class: { "is-reverse": _vm.menuVisible }
})
])
],
2
),
_c(
"span",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.inputValue === "" && !_vm.isOnComposition,
expression: "inputValue === '' && !isOnComposition"
}
],
staticClass: "el-cascader__label"
},
[
_vm.showAllLevels
? [
_vm._l(_vm.currentLabels, function(label, index) {
return [
_vm._v("\n " + _vm._s(label) + "\n "),
index < _vm.currentLabels.length - 1
? _c("span", { key: index }, [
_vm._v(" " + _vm._s(_vm.separator) + " ")
])
: _vm._e()
]
})
]
: [
_vm._v(
"\n " +
_vm._s(_vm.currentLabels[_vm.currentLabels.length - 1]) +
"\n "
)
]
],
2
)
],
1
)
}
var staticRenderFns = []
mainvue_type_template_id_2e869fa1_render._withStripped = true
// CONCATENATED MODULE: ./packages/cascader/src/main.vue?vue&type=template&id=2e869fa1&
// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(6);
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
// EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(32);
var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
// EXTERNAL MODULE: external "element-ui/lib/utils/shared"
var shared_ = __webpack_require__(35);
// EXTERNAL MODULE: external "element-ui/lib/utils/scroll-into-view"
var scroll_into_view_ = __webpack_require__(27);
var scroll_into_view_default = /*#__PURE__*/__webpack_require__.n(scroll_into_view_);
// EXTERNAL MODULE: external "element-ui/lib/utils/util"
var util_ = __webpack_require__(4);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader/src/menu.vue?vue&type=script&lang=js&
var copyArray = function copyArray(arr, props) {
if (!arr || !Array.isArray(arr) || !props) return arr;
var result = [];
var configurableProps = ['__IS__FLAT__OPTIONS', 'label', 'value', 'disabled'];
var childrenProp = props.children || 'children';
arr.forEach(function (item) {
var itemCopy = {};
configurableProps.forEach(function (prop) {
var name = props[prop];
var value = item[name];
if (value === undefined) {
name = prop;
value = item[name];
}
if (value !== undefined) itemCopy[name] = value;
});
if (Array.isArray(item[childrenProp])) {
itemCopy[childrenProp] = copyArray(item[childrenProp], props);
}
result.push(itemCopy);
});
return result;
};
/* harmony default export */ var menuvue_type_script_lang_js_ = ({
name: 'ElCascaderMenu',
data: function data() {
return {
inputWidth: 0,
options: [],
props: {},
visible: false,
activeValue: [],
value: [],
expandTrigger: 'click',
changeOnSelect: false,
popperClass: '',
hoverTimer: 0,
clicking: false,
id: Object(util_["generateId"])()
};
},
watch: {
visible: function visible(value) {
if (value) {
this.activeValue = this.value;
}
},
value: {
immediate: true,
handler: function handler(value) {
this.activeValue = value;
}
}
},
computed: {
activeOptions: {
get: function get() {
var _this = this;
var activeValue = this.activeValue;
var configurableProps = ['label', 'value', 'children', 'disabled'];
var formatOptions = function formatOptions(options) {
options.forEach(function (option) {
if (option.__IS__FLAT__OPTIONS) return;
configurableProps.forEach(function (prop) {
var value = option[_this.props[prop] || prop];
if (value !== undefined) option[prop] = value;
});
if (Array.isArray(option.children)) {
formatOptions(option.children);
}
});
};
var loadActiveOptions = function loadActiveOptions(options) {
var activeOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var level = activeOptions.length;
activeOptions[level] = options;
var active = activeValue[level];
if (Object(shared_["isDef"])(active)) {
options = options.filter(function (option) {
return option.value === active;
})[0];
if (options && options.children) {
loadActiveOptions(options.children, activeOptions);
}
}
return activeOptions;
};
var optionsCopy = copyArray(this.options, this.props);
formatOptions(optionsCopy);
return loadActiveOptions(optionsCopy);
}
}
},
methods: {
select: function select(item, menuIndex) {
if (item.__IS__FLAT__OPTIONS) {
this.activeValue = item.value;
} else if (menuIndex) {
this.activeValue.splice(menuIndex, this.activeValue.length - 1, item.value);
} else {
this.activeValue = [item.value];
}
this.$emit('pick', this.activeValue.slice());
},
handleMenuLeave: function handleMenuLeave() {
this.$emit('menuLeave');
},
activeItem: function activeItem(item, menuIndex) {
var len = this.activeOptions.length;
this.activeValue.splice(menuIndex, len, item.value);
this.activeOptions.splice(menuIndex + 1, len, item.children);
if (this.changeOnSelect) {
this.$emit('pick', this.activeValue.slice(), false);
} else {
this.$emit('activeItemChange', this.activeValue);
}
},
scrollMenu: function scrollMenu(menu) {
scroll_into_view_default()(menu, menu.getElementsByClassName('is-active')[0]);
},
handleMenuEnter: function handleMenuEnter() {
var _this2 = this;
this.$nextTick(function () {
return _this2.$refs.menus.forEach(function (menu) {
return _this2.scrollMenu(menu);
});
});
}
},
render: function render(h) {
var _this3 = this;
var activeValue = this.activeValue,
activeOptions = this.activeOptions,
visible = this.visible,
expandTrigger = this.expandTrigger,
popperClass = this.popperClass,
hoverThreshold = this.hoverThreshold;
var itemId = null;
var itemIndex = 0;
var hoverMenuRefs = {};
var hoverMenuHandler = function hoverMenuHandler(e) {
var activeMenu = hoverMenuRefs.activeMenu;
if (!activeMenu) return;
var offsetX = e.offsetX;
var width = activeMenu.offsetWidth;
var height = activeMenu.offsetHeight;
if (e.target === hoverMenuRefs.activeItem) {
clearTimeout(_this3.hoverTimer);
var _hoverMenuRefs = hoverMenuRefs,
activeItem = _hoverMenuRefs.activeItem;
var offsetY_top = activeItem.offsetTop;
var offsetY_Bottom = offsetY_top + activeItem.offsetHeight;
hoverMenuRefs.hoverZone.innerHTML = '\n \n \n ';
} else {
if (!_this3.hoverTimer) {
_this3.hoverTimer = setTimeout(function () {
hoverMenuRefs.hoverZone.innerHTML = '';
}, hoverThreshold);
}
}
};
var menus = this._l(activeOptions, function (menu, menuIndex) {
var isFlat = false;
var menuId = 'menu-' + _this3.id + '-' + menuIndex;
var ownsId = 'menu-' + _this3.id + '-' + (menuIndex + 1);
var items = _this3._l(menu, function (item) {
var events = {
on: {}
};
if (item.__IS__FLAT__OPTIONS) isFlat = true;
if (!item.disabled) {
// keydown up/down/left/right/enter
events.on.keydown = function (ev) {
var keyCode = ev.keyCode;
if ([37, 38, 39, 40, 13, 9, 27].indexOf(keyCode) < 0) {
return;
}
var currentEle = ev.target;
var parentEle = _this3.$refs.menus[menuIndex];
var menuItemList = parentEle.querySelectorAll("[tabindex='-1']");
var currentIndex = Array.prototype.indexOf.call(menuItemList, currentEle); // 当前索引
var nextIndex = void 0,
nextMenu = void 0;
if ([38, 40].indexOf(keyCode) > -1) {
if (keyCode === 38) {
// up键
nextIndex = currentIndex !== 0 ? currentIndex - 1 : currentIndex;
} else if (keyCode === 40) {
// down
nextIndex = currentIndex !== menuItemList.length - 1 ? currentIndex + 1 : currentIndex;
}
menuItemList[nextIndex].focus();
} else if (keyCode === 37) {
// left键
if (menuIndex !== 0) {
var previousMenu = _this3.$refs.menus[menuIndex - 1];
previousMenu.querySelector('[aria-expanded=true]').focus();
}
} else if (keyCode === 39) {
// right
if (item.children) {
// 有子menu 选择子menu的第一个menuitem
nextMenu = _this3.$refs.menus[menuIndex + 1];
nextMenu.querySelectorAll("[tabindex='-1']")[0].focus();
}
} else if (keyCode === 13) {
if (!item.children) {
var id = currentEle.getAttribute('id');
parentEle.setAttribute('aria-activedescendant', id);
_this3.select(item, menuIndex);
_this3.$nextTick(function () {
return _this3.scrollMenu(_this3.$refs.menus[menuIndex]);
});
}
} else if (keyCode === 9 || keyCode === 27) {
// esc tab
_this3.$emit('closeInside');
}
};
if (item.children) {
var triggerEvent = {
click: 'click',
hover: 'mouseenter'
}[expandTrigger];
var triggerHandler = function triggerHandler() {
if (_this3.visible) {
_this3.activeItem(item, menuIndex);
_this3.$nextTick(function () {
// adjust self and next level
_this3.scrollMenu(_this3.$refs.menus[menuIndex]);
_this3.scrollMenu(_this3.$refs.menus[menuIndex + 1]);
});
}
};
events.on[triggerEvent] = triggerHandler;
if (triggerEvent === 'mouseenter' && _this3.changeOnSelect) {
events.on.click = function () {
if (_this3.activeValue.indexOf(item.value) !== -1) {
_this3.$emit('closeInside', true);
}
};
}
events.on['mousedown'] = function () {
_this3.clicking = true;
};
events.on['focus'] = function () {
// focus 选中
if (_this3.clicking) {
_this3.clicking = false;
return;
}
triggerHandler();
};
} else {
events.on.click = function () {
_this3.select(item, menuIndex);
_this3.$nextTick(function () {
return _this3.scrollMenu(_this3.$refs.menus[menuIndex]);
});
};
}
}
if (!item.disabled && !item.children) {
// no children set id
itemId = menuId + '-' + itemIndex;
itemIndex++;
}
return h(
'li',
external_babel_helper_vue_jsx_merge_props_default()([{
'class': {
'el-cascader-menu__item': true,
'el-cascader-menu__item--extensible': item.children,
'is-active': item.value === activeValue[menuIndex],
'is-disabled': item.disabled
},
ref: item.value === activeValue[menuIndex] ? 'activeItem' : null
}, events, {
attrs: {
tabindex: item.disabled ? null : -1,
role: 'menuitem',
'aria-haspopup': !!item.children,
'aria-expanded': item.value === activeValue[menuIndex],
id: itemId,
'aria-owns': !item.children ? null : ownsId
}
}]),
[h('span', [item.label])]
);
});
var menuStyle = {};
if (isFlat) {
menuStyle.minWidth = _this3.inputWidth + 'px';
}
var isHoveredMenu = expandTrigger === 'hover' && activeValue.length - 1 === menuIndex;
var hoverMenuEvent = {
on: {}
};
if (isHoveredMenu) {
hoverMenuEvent.on.mousemove = hoverMenuHandler;
menuStyle.position = 'relative';
}
return h(
'ul',
external_babel_helper_vue_jsx_merge_props_default()([{
'class': {
'el-cascader-menu': true,
'el-cascader-menu--flexible': isFlat
}
}, hoverMenuEvent, {
style: menuStyle,
refInFor: true,
ref: 'menus',
attrs: { role: 'menu',
id: menuId
}
}]),
[items, isHoveredMenu ? h('svg', {
ref: 'hoverZone',
style: {
position: 'absolute',
top: 0,
height: '100%',
width: '100%',
left: 0,
pointerEvents: 'none'
}
}) : null]
);
});
if (expandTrigger === 'hover') {
this.$nextTick(function () {
var activeItem = _this3.$refs.activeItem;
if (activeItem) {
var activeMenu = activeItem.parentElement;
var hoverZone = _this3.$refs.hoverZone;
hoverMenuRefs = {
activeMenu: activeMenu,
activeItem: activeItem,
hoverZone: hoverZone
};
} else {
hoverMenuRefs = {};
}
});
}
return h(
'transition',
{
attrs: { name: 'el-zoom-in-top' },
on: {
'before-enter': this.handleMenuEnter,
'after-leave': this.handleMenuLeave
}
},
[h(
'div',
{
directives: [{
name: 'show',
value: visible
}],
'class': ['el-cascader-menus el-popper', popperClass],
ref: 'wrapper'
},
[h('div', {
attrs: { 'x-arrow': true },
'class': 'popper__arrow' }), menus]
)]
);
}
});
// CONCATENATED MODULE: ./packages/cascader/src/menu.vue?vue&type=script&lang=js&
/* harmony default export */ var src_menuvue_type_script_lang_js_ = (menuvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/cascader/src/menu.vue
var menu_render, menu_staticRenderFns
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_menuvue_type_script_lang_js_,
menu_render,
menu_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "packages/cascader/src/menu.vue"
/* harmony default export */ var src_menu = (component.exports);
// EXTERNAL MODULE: external "element-ui/lib/input"
var input_ = __webpack_require__(9);
var input_default = /*#__PURE__*/__webpack_require__.n(input_);
// EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
var vue_popper_ = __webpack_require__(5);
var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
// EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
var clickoutside_ = __webpack_require__(11);
var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
var emitter_ = __webpack_require__(3);
var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
// EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
var locale_ = __webpack_require__(7);
var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
// EXTERNAL MODULE: external "element-ui/lib/locale"
var lib_locale_ = __webpack_require__(18);
// EXTERNAL MODULE: external "throttle-debounce/debounce"
var debounce_ = __webpack_require__(13);
var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader/src/main.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var popperMixin = {
props: {
placement: {
type: String,
default: 'bottom-start'
},
appendToBody: vue_popper_default.a.props.appendToBody,
arrowOffset: vue_popper_default.a.props.arrowOffset,
offset: vue_popper_default.a.props.offset,
boundariesPadding: vue_popper_default.a.props.boundariesPadding,
popperOptions: vue_popper_default.a.props.popperOptions
},
methods: vue_popper_default.a.methods,
data: vue_popper_default.a.data,
beforeDestroy: vue_popper_default.a.beforeDestroy
};
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
name: 'ElCascader',
directives: { Clickoutside: clickoutside_default.a },
mixins: [popperMixin, emitter_default.a, locale_default.a],
inject: {
elForm: {
default: ''
},
elFormItem: {
default: ''
}
},
components: {
ElInput: input_default.a
},
props: {
options: {
type: Array,
required: true
},
props: {
type: Object,
default: function _default() {
return {
children: 'children',
label: 'label',
value: 'value',
disabled: 'disabled'
};
}
},
value: {
type: Array,
default: function _default() {
return [];
}
},
separator: {
type: String,
default: '/'
},
placeholder: {
type: String,
default: function _default() {
return Object(lib_locale_["t"])('el.cascader.placeholder');
}
},
disabled: Boolean,
clearable: {
type: Boolean,
default: false
},
changeOnSelect: Boolean,
popperClass: String,
expandTrigger: {
type: String,
default: 'click'
},
filterable: Boolean,
size: String,
showAllLevels: {
type: Boolean,
default: true
},
debounce: {
type: Number,
default: 300
},
beforeFilter: {
type: Function,
default: function _default() {
return function () {};
}
},
hoverThreshold: {
type: Number,
default: 500
}
},
data: function data() {
return {
currentValue: this.value || [],
menu: null,
debouncedInputChange: function debouncedInputChange() {},
menuVisible: false,
inputHover: false,
inputValue: '',
flatOptions: null,
id: Object(util_["generateId"])(),
needFocus: true,
isOnComposition: false
};
},
computed: {
labelKey: function labelKey() {
return this.props.label || 'label';
},
valueKey: function valueKey() {
return this.props.value || 'value';
},
childrenKey: function childrenKey() {
return this.props.children || 'children';
},
disabledKey: function disabledKey() {
return this.props.disabled || 'disabled';
},
currentLabels: function currentLabels() {
var _this = this;
var options = this.options;
var labels = [];
this.currentValue.forEach(function (value) {
var targetOption = options && options.filter(function (option) {
return option[_this.valueKey] === value;
})[0];
if (targetOption) {
labels.push(targetOption[_this.labelKey]);
options = targetOption[_this.childrenKey];
}
});
return labels;
},
_elFormItemSize: function _elFormItemSize() {
return (this.elFormItem || {}).elFormItemSize;
},
cascaderSize: function cascaderSize() {
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
},
cascaderDisabled: function cascaderDisabled() {
return this.disabled || (this.elForm || {}).disabled;
},
readonly: function readonly() {
return !this.filterable || !Object(util_["isIE"])() && !Object(util_["isEdge"])() && !this.menuVisible;
}
},
watch: {
menuVisible: function menuVisible(value) {
this.$refs.input.$refs.input.setAttribute('aria-expanded', value);
value ? this.showMenu() : this.hideMenu();
this.$emit('visible-change', value);
},
value: function value(_value) {
this.currentValue = _value;
},
currentValue: function currentValue(value) {
this.dispatch('ElFormItem', 'el.form.change', [value]);
},
options: {
deep: true,
handler: function handler(value) {
if (!this.menu) {
this.initMenu();
}
this.flatOptions = this.flattenOptions(this.options);
this.menu.options = value;
}
}
},
methods: {
initMenu: function initMenu() {
this.menu = new external_vue_default.a(src_menu).$mount();
this.menu.options = this.options;
this.menu.props = this.props;
this.menu.expandTrigger = this.expandTrigger;
this.menu.changeOnSelect = this.changeOnSelect;
this.menu.popperClass = this.popperClass;
this.menu.hoverThreshold = this.hoverThreshold;
this.popperElm = this.menu.$el;
this.menu.$refs.menus[0].setAttribute('id', 'cascader-menu-' + this.id);
this.menu.$on('pick', this.handlePick);
this.menu.$on('activeItemChange', this.handleActiveItemChange);
this.menu.$on('menuLeave', this.doDestroy);
this.menu.$on('closeInside', this.handleClickoutside);
},
showMenu: function showMenu() {
var _this2 = this;
if (!this.menu) {
this.initMenu();
}
this.menu.value = this.currentValue.slice(0);
this.menu.visible = true;
this.menu.options = this.options;
this.$nextTick(function (_) {
_this2.updatePopper();
_this2.menu.inputWidth = _this2.$refs.input.$el.offsetWidth - 2;
});
},
hideMenu: function hideMenu() {
this.inputValue = '';
this.menu.visible = false;
if (this.needFocus) {
this.$refs.input.focus();
} else {
this.needFocus = true;
}
},
handleActiveItemChange: function handleActiveItemChange(value) {
var _this3 = this;
this.$nextTick(function (_) {
_this3.updatePopper();
});
this.$emit('active-item-change', value);
},
handleKeydown: function handleKeydown(e) {
var _this4 = this;
var keyCode = e.keyCode;
if (keyCode === 13) {
this.handleClick();
} else if (keyCode === 40) {
// down
this.menuVisible = true; // 打开
setTimeout(function () {
var firstMenu = _this4.popperElm.querySelectorAll('.el-cascader-menu')[0];
firstMenu.querySelectorAll("[tabindex='-1']")[0].focus();
});
e.stopPropagation();
e.preventDefault();
} else if (keyCode === 27 || keyCode === 9) {
// esc tab
this.inputValue = '';
if (this.menu) this.menu.visible = false;
}
},
handlePick: function handlePick(value) {
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.currentValue = value;
this.$emit('input', value);
this.$emit('change', value);
if (close) {
this.menuVisible = false;
} else {
this.$nextTick(this.updatePopper);
}
},
handleInputChange: function handleInputChange(value) {
var _this5 = this;
if (!this.menuVisible) return;
var flatOptions = this.flatOptions;
if (!value) {
this.menu.options = this.options;
this.$nextTick(this.updatePopper);
return;
}
var filteredFlatOptions = flatOptions.filter(function (optionsStack) {
return optionsStack.some(function (option) {
return new RegExp(Object(util_["escapeRegexpString"])(value), 'i').test(option[_this5.labelKey]);
});
});
if (filteredFlatOptions.length > 0) {
filteredFlatOptions = filteredFlatOptions.map(function (optionStack) {
return {
__IS__FLAT__OPTIONS: true,
value: optionStack.map(function (item) {
return item[_this5.valueKey];
}),
label: _this5.renderFilteredOptionLabel(value, optionStack),
disabled: optionStack.some(function (item) {
return item[_this5.disabledKey];
})
};
});
} else {
filteredFlatOptions = [{
__IS__FLAT__OPTIONS: true,
label: this.t('el.cascader.noMatch'),
value: '',
disabled: true
}];
}
this.menu.options = filteredFlatOptions;
this.$nextTick(this.updatePopper);
},
renderFilteredOptionLabel: function renderFilteredOptionLabel(inputValue, optionsStack) {
var _this6 = this;
return optionsStack.map(function (option, index) {
var label = option[_this6.labelKey];
var keywordIndex = label.toLowerCase().indexOf(inputValue.toLowerCase());
var labelPart = label.slice(keywordIndex, inputValue.length + keywordIndex);
var node = keywordIndex > -1 ? _this6.highlightKeyword(label, labelPart) : label;
return index === 0 ? node : [' ' + _this6.separator + ' ', node];
});
},
highlightKeyword: function highlightKeyword(label, keyword) {
var _this7 = this;
var h = this._c;
return label.split(keyword).map(function (node, index) {
return index === 0 ? node : [h('span', { class: { 'el-cascader-menu__item__keyword': true } }, [_this7._v(keyword)]), node];
});
},
flattenOptions: function flattenOptions(options) {
var _this8 = this;
var ancestor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var flatOptions = [];
options.forEach(function (option) {
var optionsStack = ancestor.concat(option);
if (!option[_this8.childrenKey]) {
flatOptions.push(optionsStack);
} else {
if (_this8.changeOnSelect) {
flatOptions.push(optionsStack);
}
flatOptions = flatOptions.concat(_this8.flattenOptions(option[_this8.childrenKey], optionsStack));
}
});
return flatOptions;
},
clearValue: function clearValue(ev) {
ev.stopPropagation();
this.handlePick([], true);
},
handleClickoutside: function handleClickoutside() {
var pickFinished = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (this.menuVisible && !pickFinished) {
this.needFocus = false;
}
this.menuVisible = false;
},
handleClick: function handleClick() {
if (this.cascaderDisabled) return;
this.$refs.input.focus();
if (this.filterable) {
this.menuVisible = true;
return;
}
this.menuVisible = !this.menuVisible;
},
handleFocus: function handleFocus(event) {
this.$emit('focus', event);
},
handleBlur: function handleBlur(event) {
this.$emit('blur', event);
},
handleComposition: function handleComposition(event) {
this.isOnComposition = event.type !== 'compositionend';
}
},
created: function created() {
var _this9 = this;
this.debouncedInputChange = debounce_default()(this.debounce, function (value) {
var before = _this9.beforeFilter(value);
if (before && before.then) {
_this9.menu.options = [{
__IS__FLAT__OPTIONS: true,
label: _this9.t('el.cascader.loading'),
value: '',
disabled: true
}];
before.then(function () {
_this9.$nextTick(function () {
_this9.handleInputChange(value);
});
});
} else if (before !== false) {
_this9.$nextTick(function () {
_this9.handleInputChange(value);
});
}
});
},
mounted: function mounted() {
this.flatOptions = this.flattenOptions(this.options);
}
});
// CONCATENATED MODULE: ./packages/cascader/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/cascader/src/main.vue
/* normalize component */
var main_component = Object(componentNormalizer["a" /* default */])(
src_mainvue_type_script_lang_js_,
mainvue_type_template_id_2e869fa1_render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var main_api; }
main_component.options.__file = "packages/cascader/src/main.vue"
/* harmony default export */ var main = (main_component.exports);
// CONCATENATED MODULE: ./packages/cascader/index.js
/* istanbul ignore next */
main.install = function (Vue) {
Vue.component(main.name, main);
};
/* harmony default export */ var cascader = __webpack_exports__["default"] = (main);
/***/ }),
/***/ 6:
/***/ (function(module, exports) {
module.exports = require("vue");
/***/ }),
/***/ 7:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/mixins/locale");
/***/ }),
/***/ 9:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/input");
/***/ })
/******/ });