cascader.js 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424
  1. module.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 = 85);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 0:
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  152. : injectStyles
  153. }
  154. if (hook) {
  155. if (options.functional) {
  156. // for template-only hot-reload because in that case the render fn doesn't
  157. // go through the normalizer
  158. options._injectStyles = hook
  159. // register for functioal component in vue file
  160. var originalRender = options.render
  161. options.render = function renderWithStyleInjection (h, context) {
  162. hook.call(context)
  163. return originalRender(h, context)
  164. }
  165. } else {
  166. // inject component registration as beforeCreate hook
  167. var existing = options.beforeCreate
  168. options.beforeCreate = existing
  169. ? [].concat(existing, hook)
  170. : [hook]
  171. }
  172. }
  173. return {
  174. exports: scriptExports,
  175. options: options
  176. }
  177. }
  178. /***/ }),
  179. /***/ 10:
  180. /***/ (function(module, exports) {
  181. module.exports = require("element-ui/lib/input");
  182. /***/ }),
  183. /***/ 11:
  184. /***/ (function(module, exports) {
  185. module.exports = require("element-ui/lib/mixins/migrating");
  186. /***/ }),
  187. /***/ 12:
  188. /***/ (function(module, exports) {
  189. module.exports = require("element-ui/lib/utils/clickoutside");
  190. /***/ }),
  191. /***/ 15:
  192. /***/ (function(module, exports) {
  193. module.exports = require("element-ui/lib/scrollbar");
  194. /***/ }),
  195. /***/ 16:
  196. /***/ (function(module, exports) {
  197. module.exports = require("element-ui/lib/utils/resize-event");
  198. /***/ }),
  199. /***/ 17:
  200. /***/ (function(module, exports) {
  201. module.exports = require("throttle-debounce/debounce");
  202. /***/ }),
  203. /***/ 19:
  204. /***/ (function(module, exports) {
  205. module.exports = require("element-ui/lib/locale");
  206. /***/ }),
  207. /***/ 20:
  208. /***/ (function(module, exports) {
  209. module.exports = require("element-ui/lib/utils/types");
  210. /***/ }),
  211. /***/ 21:
  212. /***/ (function(module, exports) {
  213. module.exports = require("element-ui/lib/utils/shared");
  214. /***/ }),
  215. /***/ 3:
  216. /***/ (function(module, exports) {
  217. module.exports = require("element-ui/lib/utils/util");
  218. /***/ }),
  219. /***/ 37:
  220. /***/ (function(module, exports) {
  221. module.exports = require("element-ui/lib/tag");
  222. /***/ }),
  223. /***/ 4:
  224. /***/ (function(module, exports) {
  225. module.exports = require("element-ui/lib/mixins/emitter");
  226. /***/ }),
  227. /***/ 40:
  228. /***/ (function(module, exports) {
  229. module.exports = require("element-ui/lib/utils/aria-utils");
  230. /***/ }),
  231. /***/ 5:
  232. /***/ (function(module, exports) {
  233. module.exports = require("element-ui/lib/utils/vue-popper");
  234. /***/ }),
  235. /***/ 50:
  236. /***/ (function(module, exports) {
  237. module.exports = require("element-ui/lib/cascader-panel");
  238. /***/ }),
  239. /***/ 6:
  240. /***/ (function(module, exports) {
  241. module.exports = require("element-ui/lib/mixins/locale");
  242. /***/ }),
  243. /***/ 85:
  244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  245. "use strict";
  246. __webpack_require__.r(__webpack_exports__);
  247. // 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&
  248. var render = function() {
  249. var _vm = this
  250. var _h = _vm.$createElement
  251. var _c = _vm._self._c || _h
  252. return _c(
  253. "div",
  254. {
  255. directives: [
  256. {
  257. name: "clickoutside",
  258. rawName: "v-clickoutside",
  259. value: function() {
  260. return _vm.toggleDropDownVisible(false)
  261. },
  262. expression: "() => toggleDropDownVisible(false)"
  263. }
  264. ],
  265. ref: "reference",
  266. class: [
  267. "el-cascader",
  268. _vm.realSize && "el-cascader--" + _vm.realSize,
  269. { "is-disabled": _vm.isDisabled }
  270. ],
  271. on: {
  272. mouseenter: function($event) {
  273. _vm.inputHover = true
  274. },
  275. mouseleave: function($event) {
  276. _vm.inputHover = false
  277. },
  278. click: function() {
  279. return _vm.toggleDropDownVisible(_vm.readonly ? undefined : true)
  280. },
  281. keydown: _vm.handleKeyDown
  282. }
  283. },
  284. [
  285. _c(
  286. "el-input",
  287. {
  288. ref: "input",
  289. class: { "is-focus": _vm.dropDownVisible },
  290. attrs: {
  291. size: _vm.realSize,
  292. placeholder: _vm.placeholder,
  293. readonly: _vm.readonly,
  294. disabled: _vm.isDisabled,
  295. "validate-event": false
  296. },
  297. on: {
  298. focus: _vm.handleFocus,
  299. blur: _vm.handleBlur,
  300. input: _vm.handleInput
  301. },
  302. model: {
  303. value: _vm.multiple ? _vm.presentText : _vm.inputValue,
  304. callback: function($$v) {
  305. _vm.multiple ? _vm.presentText : (_vm.inputValue = $$v)
  306. },
  307. expression: "multiple ? presentText : inputValue"
  308. }
  309. },
  310. [
  311. _c("template", { slot: "suffix" }, [
  312. _vm.clearBtnVisible
  313. ? _c("i", {
  314. key: "clear",
  315. staticClass: "el-input__icon el-icon-circle-close",
  316. on: {
  317. click: function($event) {
  318. $event.stopPropagation()
  319. return _vm.handleClear($event)
  320. }
  321. }
  322. })
  323. : _c("i", {
  324. key: "arrow-down",
  325. class: [
  326. "el-input__icon",
  327. "el-icon-arrow-down",
  328. _vm.dropDownVisible && "is-reverse"
  329. ],
  330. on: {
  331. click: function($event) {
  332. $event.stopPropagation()
  333. _vm.toggleDropDownVisible()
  334. }
  335. }
  336. })
  337. ])
  338. ],
  339. 2
  340. ),
  341. _vm.multiple
  342. ? _c(
  343. "div",
  344. { staticClass: "el-cascader__tags" },
  345. [
  346. _vm._l(_vm.presentTags, function(tag) {
  347. return _c(
  348. "el-tag",
  349. {
  350. key: tag.key,
  351. attrs: {
  352. type: "info",
  353. size: _vm.tagSize,
  354. hit: tag.hitState,
  355. closable: tag.closable,
  356. "disable-transitions": ""
  357. },
  358. on: {
  359. close: function($event) {
  360. _vm.deleteTag(tag)
  361. }
  362. }
  363. },
  364. [_c("span", [_vm._v(_vm._s(tag.text))])]
  365. )
  366. }),
  367. _vm.filterable && !_vm.isDisabled
  368. ? _c("input", {
  369. directives: [
  370. {
  371. name: "model",
  372. rawName: "v-model.trim",
  373. value: _vm.inputValue,
  374. expression: "inputValue",
  375. modifiers: { trim: true }
  376. }
  377. ],
  378. staticClass: "el-cascader__search-input",
  379. attrs: {
  380. type: "text",
  381. placeholder: _vm.presentTags.length ? "" : _vm.placeholder
  382. },
  383. domProps: { value: _vm.inputValue },
  384. on: {
  385. input: [
  386. function($event) {
  387. if ($event.target.composing) {
  388. return
  389. }
  390. _vm.inputValue = $event.target.value.trim()
  391. },
  392. function(e) {
  393. return _vm.handleInput(_vm.inputValue, e)
  394. }
  395. ],
  396. click: function($event) {
  397. $event.stopPropagation()
  398. _vm.toggleDropDownVisible(true)
  399. },
  400. keydown: function($event) {
  401. if (
  402. !("button" in $event) &&
  403. _vm._k(
  404. $event.keyCode,
  405. "delete",
  406. [8, 46],
  407. $event.key,
  408. ["Backspace", "Delete", "Del"]
  409. )
  410. ) {
  411. return null
  412. }
  413. return _vm.handleDelete($event)
  414. },
  415. blur: function($event) {
  416. _vm.$forceUpdate()
  417. }
  418. }
  419. })
  420. : _vm._e()
  421. ],
  422. 2
  423. )
  424. : _vm._e(),
  425. _c(
  426. "transition",
  427. {
  428. attrs: { name: "el-zoom-in-top" },
  429. on: { "after-leave": _vm.handleDropdownLeave }
  430. },
  431. [
  432. _c(
  433. "div",
  434. {
  435. directives: [
  436. {
  437. name: "show",
  438. rawName: "v-show",
  439. value: _vm.dropDownVisible,
  440. expression: "dropDownVisible"
  441. }
  442. ],
  443. ref: "popper",
  444. class: ["el-popper", "el-cascader__dropdown", _vm.popperClass]
  445. },
  446. [
  447. _c("el-cascader-panel", {
  448. directives: [
  449. {
  450. name: "show",
  451. rawName: "v-show",
  452. value: !_vm.filtering,
  453. expression: "!filtering"
  454. }
  455. ],
  456. ref: "panel",
  457. attrs: {
  458. options: _vm.options,
  459. props: _vm.config,
  460. border: false,
  461. "render-label": _vm.$scopedSlots.default
  462. },
  463. on: {
  464. "expand-change": _vm.handleExpandChange,
  465. close: function($event) {
  466. _vm.toggleDropDownVisible(false)
  467. }
  468. },
  469. model: {
  470. value: _vm.checkedValue,
  471. callback: function($$v) {
  472. _vm.checkedValue = $$v
  473. },
  474. expression: "checkedValue"
  475. }
  476. }),
  477. _vm.filterable
  478. ? _c(
  479. "el-scrollbar",
  480. {
  481. directives: [
  482. {
  483. name: "show",
  484. rawName: "v-show",
  485. value: _vm.filtering,
  486. expression: "filtering"
  487. }
  488. ],
  489. ref: "suggestionPanel",
  490. staticClass: "el-cascader__suggestion-panel",
  491. attrs: {
  492. tag: "ul",
  493. "view-class": "el-cascader__suggestion-list"
  494. },
  495. nativeOn: {
  496. keydown: function($event) {
  497. return _vm.handleSuggestionKeyDown($event)
  498. }
  499. }
  500. },
  501. [
  502. _vm.suggestions.length
  503. ? _vm._l(_vm.suggestions, function(item, index) {
  504. return _c(
  505. "li",
  506. {
  507. key: item.uid,
  508. class: [
  509. "el-cascader__suggestion-item",
  510. item.checked && "is-checked"
  511. ],
  512. attrs: { tabindex: -1 },
  513. on: {
  514. click: function($event) {
  515. _vm.handleSuggestionClick(index)
  516. }
  517. }
  518. },
  519. [
  520. _c("span", [_vm._v(_vm._s(item.text))]),
  521. item.checked
  522. ? _c("i", { staticClass: "el-icon-check" })
  523. : _vm._e()
  524. ]
  525. )
  526. })
  527. : _vm._t("empty", [
  528. _c(
  529. "li",
  530. { staticClass: "el-cascader__empty-text" },
  531. [_vm._v(_vm._s(_vm.t("el.cascader.noMatch")))]
  532. )
  533. ])
  534. ],
  535. 2
  536. )
  537. : _vm._e()
  538. ],
  539. 1
  540. )
  541. ]
  542. )
  543. ],
  544. 1
  545. )
  546. }
  547. var staticRenderFns = []
  548. render._withStripped = true
  549. // CONCATENATED MODULE: ./packages/cascader/src/cascader.vue?vue&type=template&id=032537a6&
  550. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  551. var vue_popper_ = __webpack_require__(5);
  552. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  553. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  554. var clickoutside_ = __webpack_require__(12);
  555. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  556. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  557. var emitter_ = __webpack_require__(4);
  558. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  559. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  560. var locale_ = __webpack_require__(6);
  561. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  562. // EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
  563. var migrating_ = __webpack_require__(11);
  564. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  565. // EXTERNAL MODULE: external "element-ui/lib/input"
  566. var input_ = __webpack_require__(10);
  567. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  568. // EXTERNAL MODULE: external "element-ui/lib/tag"
  569. var tag_ = __webpack_require__(37);
  570. var tag_default = /*#__PURE__*/__webpack_require__.n(tag_);
  571. // EXTERNAL MODULE: external "element-ui/lib/scrollbar"
  572. var scrollbar_ = __webpack_require__(15);
  573. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  574. // EXTERNAL MODULE: external "element-ui/lib/cascader-panel"
  575. var cascader_panel_ = __webpack_require__(50);
  576. var cascader_panel_default = /*#__PURE__*/__webpack_require__.n(cascader_panel_);
  577. // EXTERNAL MODULE: external "element-ui/lib/utils/aria-utils"
  578. var aria_utils_ = __webpack_require__(40);
  579. var aria_utils_default = /*#__PURE__*/__webpack_require__.n(aria_utils_);
  580. // EXTERNAL MODULE: external "element-ui/lib/locale"
  581. var lib_locale_ = __webpack_require__(19);
  582. // EXTERNAL MODULE: external "element-ui/lib/utils/util"
  583. var util_ = __webpack_require__(3);
  584. // EXTERNAL MODULE: external "element-ui/lib/utils/types"
  585. var types_ = __webpack_require__(20);
  586. // EXTERNAL MODULE: external "element-ui/lib/utils/shared"
  587. var shared_ = __webpack_require__(21);
  588. // EXTERNAL MODULE: external "element-ui/lib/utils/resize-event"
  589. var resize_event_ = __webpack_require__(16);
  590. // EXTERNAL MODULE: external "throttle-debounce/debounce"
  591. var debounce_ = __webpack_require__(17);
  592. var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
  593. // 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&
  594. //
  595. //
  596. //
  597. //
  598. //
  599. //
  600. //
  601. //
  602. //
  603. //
  604. //
  605. //
  606. //
  607. //
  608. //
  609. //
  610. //
  611. //
  612. //
  613. //
  614. //
  615. //
  616. //
  617. //
  618. //
  619. //
  620. //
  621. //
  622. //
  623. //
  624. //
  625. //
  626. //
  627. //
  628. //
  629. //
  630. //
  631. //
  632. //
  633. //
  634. //
  635. //
  636. //
  637. //
  638. //
  639. //
  640. //
  641. //
  642. //
  643. //
  644. //
  645. //
  646. //
  647. //
  648. //
  649. //
  650. //
  651. //
  652. //
  653. //
  654. //
  655. //
  656. //
  657. //
  658. //
  659. //
  660. //
  661. //
  662. //
  663. //
  664. //
  665. //
  666. //
  667. //
  668. //
  669. //
  670. //
  671. //
  672. //
  673. //
  674. //
  675. //
  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. var KeyCode = aria_utils_default.a.keys;
  708. var MigratingProps = {
  709. expandTrigger: {
  710. newProp: 'expandTrigger',
  711. type: String
  712. },
  713. changeOnSelect: {
  714. newProp: 'checkStrictly',
  715. type: Boolean
  716. },
  717. hoverThreshold: {
  718. newProp: 'hoverThreshold',
  719. type: Number
  720. }
  721. };
  722. var PopperMixin = {
  723. props: {
  724. placement: {
  725. type: String,
  726. default: 'bottom-start'
  727. },
  728. appendToBody: vue_popper_default.a.props.appendToBody,
  729. visibleArrow: {
  730. type: Boolean,
  731. default: true
  732. },
  733. arrowOffset: vue_popper_default.a.props.arrowOffset,
  734. offset: vue_popper_default.a.props.offset,
  735. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  736. popperOptions: vue_popper_default.a.props.popperOptions
  737. },
  738. methods: vue_popper_default.a.methods,
  739. data: vue_popper_default.a.data,
  740. beforeDestroy: vue_popper_default.a.beforeDestroy
  741. };
  742. var InputSizeMap = {
  743. medium: 36,
  744. small: 32,
  745. mini: 28
  746. };
  747. /* harmony default export */ var cascadervue_type_script_lang_js_ = ({
  748. name: 'ElCascader',
  749. directives: { Clickoutside: clickoutside_default.a },
  750. mixins: [PopperMixin, emitter_default.a, locale_default.a, migrating_default.a],
  751. inject: {
  752. elForm: {
  753. default: ''
  754. },
  755. elFormItem: {
  756. default: ''
  757. }
  758. },
  759. components: {
  760. ElInput: input_default.a,
  761. ElTag: tag_default.a,
  762. ElScrollbar: scrollbar_default.a,
  763. ElCascaderPanel: cascader_panel_default.a
  764. },
  765. props: {
  766. value: {},
  767. options: Array,
  768. props: Object,
  769. size: String,
  770. placeholder: {
  771. type: String,
  772. default: function _default() {
  773. return Object(lib_locale_["t"])('el.cascader.placeholder');
  774. }
  775. },
  776. disabled: Boolean,
  777. clearable: Boolean,
  778. filterable: Boolean,
  779. filterMethod: Function,
  780. separator: {
  781. type: String,
  782. default: ' / '
  783. },
  784. showAllLevels: {
  785. type: Boolean,
  786. default: true
  787. },
  788. collapseTags: Boolean,
  789. debounce: {
  790. type: Number,
  791. default: 300
  792. },
  793. beforeFilter: {
  794. type: Function,
  795. default: function _default() {
  796. return function () {};
  797. }
  798. },
  799. popperClass: String
  800. },
  801. data: function data() {
  802. return {
  803. dropDownVisible: false,
  804. checkedValue: this.value || null,
  805. inputHover: false,
  806. inputValue: null,
  807. presentText: null,
  808. presentTags: [],
  809. checkedNodes: [],
  810. filtering: false,
  811. suggestions: [],
  812. inputInitialHeight: 0,
  813. pressDeleteCount: 0
  814. };
  815. },
  816. computed: {
  817. realSize: function realSize() {
  818. var _elFormItemSize = (this.elFormItem || {}).elFormItemSize;
  819. return this.size || _elFormItemSize || (this.$ELEMENT || {}).size;
  820. },
  821. tagSize: function tagSize() {
  822. return ['small', 'mini'].indexOf(this.realSize) > -1 ? 'mini' : 'small';
  823. },
  824. isDisabled: function isDisabled() {
  825. return this.disabled || (this.elForm || {}).disabled;
  826. },
  827. config: function config() {
  828. var config = this.props || {};
  829. var $attrs = this.$attrs;
  830. Object.keys(MigratingProps).forEach(function (oldProp) {
  831. var _MigratingProps$oldPr = MigratingProps[oldProp],
  832. newProp = _MigratingProps$oldPr.newProp,
  833. type = _MigratingProps$oldPr.type;
  834. var oldValue = $attrs[oldProp] || $attrs[Object(util_["kebabCase"])(oldProp)];
  835. if (Object(shared_["isDef"])(oldProp) && !Object(shared_["isDef"])(config[newProp])) {
  836. if (type === Boolean && oldValue === '') {
  837. oldValue = true;
  838. }
  839. config[newProp] = oldValue;
  840. }
  841. });
  842. return config;
  843. },
  844. multiple: function multiple() {
  845. return this.config.multiple;
  846. },
  847. leafOnly: function leafOnly() {
  848. return !this.config.checkStrictly;
  849. },
  850. readonly: function readonly() {
  851. return !this.filterable || this.multiple;
  852. },
  853. clearBtnVisible: function clearBtnVisible() {
  854. if (!this.clearable || this.isDisabled || this.filtering || !this.inputHover) {
  855. return false;
  856. }
  857. return this.multiple ? !!this.checkedNodes.filter(function (node) {
  858. return !node.isDisabled;
  859. }).length : !!this.presentText;
  860. },
  861. panel: function panel() {
  862. return this.$refs.panel;
  863. }
  864. },
  865. watch: {
  866. disabled: function disabled() {
  867. this.computePresentContent();
  868. },
  869. value: function value(val) {
  870. if (!Object(util_["isEqual"])(val, this.checkedValue)) {
  871. this.checkedValue = val;
  872. this.computePresentContent();
  873. }
  874. },
  875. checkedValue: function checkedValue(val) {
  876. var value = this.value,
  877. dropDownVisible = this.dropDownVisible;
  878. var _config = this.config,
  879. checkStrictly = _config.checkStrictly,
  880. multiple = _config.multiple;
  881. if (!Object(util_["isEqual"])(val, value) || Object(types_["isUndefined"])(value)) {
  882. this.computePresentContent();
  883. // hide dropdown when single mode
  884. if (!multiple && !checkStrictly && dropDownVisible) {
  885. this.toggleDropDownVisible(false);
  886. }
  887. this.$emit('input', val);
  888. this.$emit('change', val);
  889. this.dispatch('ElFormItem', 'el.form.change', [val]);
  890. }
  891. },
  892. options: {
  893. handler: function handler() {
  894. this.$nextTick(this.computePresentContent);
  895. },
  896. deep: true
  897. },
  898. presentText: function presentText(val) {
  899. this.inputValue = val;
  900. },
  901. presentTags: function presentTags(val, oldVal) {
  902. if (this.multiple && (val.length || oldVal.length)) {
  903. this.$nextTick(this.updateStyle);
  904. }
  905. },
  906. filtering: function filtering(val) {
  907. this.$nextTick(this.updatePopper);
  908. }
  909. },
  910. mounted: function mounted() {
  911. var _this = this;
  912. var input = this.$refs.input;
  913. if (input && input.$el) {
  914. this.inputInitialHeight = input.$el.offsetHeight || InputSizeMap[this.realSize] || 40;
  915. }
  916. if (!Object(util_["isEmpty"])(this.value)) {
  917. this.computePresentContent();
  918. }
  919. this.filterHandler = debounce_default()(this.debounce, function () {
  920. var inputValue = _this.inputValue;
  921. if (!inputValue) {
  922. _this.filtering = false;
  923. return;
  924. }
  925. var before = _this.beforeFilter(inputValue);
  926. if (before && before.then) {
  927. before.then(_this.getSuggestions);
  928. } else if (before !== false) {
  929. _this.getSuggestions();
  930. } else {
  931. _this.filtering = false;
  932. }
  933. });
  934. Object(resize_event_["addResizeListener"])(this.$el, this.updateStyle);
  935. },
  936. beforeDestroy: function beforeDestroy() {
  937. Object(resize_event_["removeResizeListener"])(this.$el, this.updateStyle);
  938. },
  939. methods: {
  940. getMigratingConfig: function getMigratingConfig() {
  941. return {
  942. props: {
  943. 'expand-trigger': 'expand-trigger is removed, use `props.expandTrigger` instead.',
  944. 'change-on-select': 'change-on-select is removed, use `props.checkStrictly` instead.',
  945. 'hover-threshold': 'hover-threshold is removed, use `props.hoverThreshold` instead'
  946. },
  947. events: {
  948. 'active-item-change': 'active-item-change is renamed to expand-change'
  949. }
  950. };
  951. },
  952. toggleDropDownVisible: function toggleDropDownVisible(visible) {
  953. var _this2 = this;
  954. if (this.isDisabled) return;
  955. var dropDownVisible = this.dropDownVisible;
  956. var input = this.$refs.input;
  957. visible = Object(shared_["isDef"])(visible) ? visible : !dropDownVisible;
  958. if (visible !== dropDownVisible) {
  959. this.dropDownVisible = visible;
  960. if (visible) {
  961. this.$nextTick(function () {
  962. _this2.updatePopper();
  963. _this2.panel.scrollIntoView();
  964. });
  965. }
  966. input.$refs.input.setAttribute('aria-expanded', visible);
  967. this.$emit('visible-change', visible);
  968. }
  969. },
  970. handleDropdownLeave: function handleDropdownLeave() {
  971. this.filtering = false;
  972. this.inputValue = this.presentText;
  973. },
  974. handleKeyDown: function handleKeyDown(event) {
  975. switch (event.keyCode) {
  976. case KeyCode.enter:
  977. this.toggleDropDownVisible();
  978. break;
  979. case KeyCode.down:
  980. this.toggleDropDownVisible(true);
  981. this.focusFirstNode();
  982. event.preventDefault();
  983. break;
  984. case KeyCode.esc:
  985. case KeyCode.tab:
  986. this.toggleDropDownVisible(false);
  987. break;
  988. }
  989. },
  990. handleFocus: function handleFocus(e) {
  991. this.$emit('focus', e);
  992. },
  993. handleBlur: function handleBlur(e) {
  994. this.$emit('blur', e);
  995. },
  996. handleInput: function handleInput(val, event) {
  997. !this.dropDownVisible && this.toggleDropDownVisible(true);
  998. if (event && event.isComposing) return;
  999. if (val) {
  1000. this.filterHandler();
  1001. } else {
  1002. this.filtering = false;
  1003. }
  1004. },
  1005. handleClear: function handleClear() {
  1006. this.presentText = '';
  1007. this.panel.clearCheckedNodes();
  1008. },
  1009. handleExpandChange: function handleExpandChange(value) {
  1010. this.$nextTick(this.updatePopper.bind(this));
  1011. this.$emit('expand-change', value);
  1012. this.$emit('active-item-change', value); // Deprecated
  1013. },
  1014. focusFirstNode: function focusFirstNode() {
  1015. var _this3 = this;
  1016. this.$nextTick(function () {
  1017. var filtering = _this3.filtering;
  1018. var _$refs = _this3.$refs,
  1019. popper = _$refs.popper,
  1020. suggestionPanel = _$refs.suggestionPanel;
  1021. var firstNode = null;
  1022. if (filtering && suggestionPanel) {
  1023. firstNode = suggestionPanel.$el.querySelector('.el-cascader__suggestion-item');
  1024. } else {
  1025. var firstMenu = popper.querySelector('.el-cascader-menu');
  1026. firstNode = firstMenu.querySelector('.el-cascader-node[tabindex="-1"]');
  1027. }
  1028. if (firstNode) {
  1029. firstNode.focus();
  1030. !filtering && firstNode.click();
  1031. }
  1032. });
  1033. },
  1034. computePresentContent: function computePresentContent() {
  1035. var _this4 = this;
  1036. // nextTick is required, because checked nodes may not change right now
  1037. this.$nextTick(function () {
  1038. if (_this4.config.multiple) {
  1039. _this4.computePresentTags();
  1040. _this4.presentText = _this4.presentTags.length ? ' ' : null;
  1041. } else {
  1042. _this4.computePresentText();
  1043. }
  1044. });
  1045. },
  1046. computePresentText: function computePresentText() {
  1047. var checkedValue = this.checkedValue,
  1048. config = this.config;
  1049. if (!Object(util_["isEmpty"])(checkedValue)) {
  1050. var node = this.panel.getNodeByValue(checkedValue);
  1051. if (node && (config.checkStrictly || node.isLeaf)) {
  1052. this.presentText = node.getText(this.showAllLevels, this.separator);
  1053. return;
  1054. }
  1055. }
  1056. this.presentText = null;
  1057. },
  1058. computePresentTags: function computePresentTags() {
  1059. var isDisabled = this.isDisabled,
  1060. leafOnly = this.leafOnly,
  1061. showAllLevels = this.showAllLevels,
  1062. separator = this.separator,
  1063. collapseTags = this.collapseTags;
  1064. var checkedNodes = this.getCheckedNodes(leafOnly);
  1065. var tags = [];
  1066. var genTag = function genTag(node) {
  1067. return {
  1068. node: node,
  1069. key: node.uid,
  1070. text: node.getText(showAllLevels, separator),
  1071. hitState: false,
  1072. closable: !isDisabled && !node.isDisabled
  1073. };
  1074. };
  1075. if (checkedNodes.length) {
  1076. var first = checkedNodes[0],
  1077. rest = checkedNodes.slice(1);
  1078. var restCount = rest.length;
  1079. tags.push(genTag(first));
  1080. if (restCount) {
  1081. if (collapseTags) {
  1082. tags.push({
  1083. key: -1,
  1084. text: '+ ' + restCount,
  1085. closable: false
  1086. });
  1087. } else {
  1088. rest.forEach(function (node) {
  1089. return tags.push(genTag(node));
  1090. });
  1091. }
  1092. }
  1093. }
  1094. this.checkedNodes = checkedNodes;
  1095. this.presentTags = tags;
  1096. },
  1097. getSuggestions: function getSuggestions() {
  1098. var _this5 = this;
  1099. var filterMethod = this.filterMethod;
  1100. if (!Object(types_["isFunction"])(filterMethod)) {
  1101. filterMethod = function filterMethod(node, keyword) {
  1102. return node.text.includes(keyword);
  1103. };
  1104. }
  1105. var suggestions = this.panel.getFlattedNodes(this.leafOnly).filter(function (node) {
  1106. if (node.isDisabled) return false;
  1107. node.text = node.getText(_this5.showAllLevels, _this5.separator) || '';
  1108. return filterMethod(node, _this5.inputValue);
  1109. });
  1110. if (this.multiple) {
  1111. this.presentTags.forEach(function (tag) {
  1112. tag.hitState = false;
  1113. });
  1114. } else {
  1115. suggestions.forEach(function (node) {
  1116. node.checked = Object(util_["isEqual"])(_this5.checkedValue, node.getValueByOption());
  1117. });
  1118. }
  1119. this.filtering = true;
  1120. this.suggestions = suggestions;
  1121. this.$nextTick(this.updatePopper);
  1122. },
  1123. handleSuggestionKeyDown: function handleSuggestionKeyDown(event) {
  1124. var keyCode = event.keyCode,
  1125. target = event.target;
  1126. switch (keyCode) {
  1127. case KeyCode.enter:
  1128. target.click();
  1129. break;
  1130. case KeyCode.up:
  1131. var prev = target.previousElementSibling;
  1132. prev && prev.focus();
  1133. break;
  1134. case KeyCode.down:
  1135. var next = target.nextElementSibling;
  1136. next && next.focus();
  1137. break;
  1138. case KeyCode.esc:
  1139. case KeyCode.tab:
  1140. this.toggleDropDownVisible(false);
  1141. break;
  1142. }
  1143. },
  1144. handleDelete: function handleDelete() {
  1145. var inputValue = this.inputValue,
  1146. pressDeleteCount = this.pressDeleteCount,
  1147. presentTags = this.presentTags;
  1148. var lastIndex = presentTags.length - 1;
  1149. var lastTag = presentTags[lastIndex];
  1150. this.pressDeleteCount = inputValue ? 0 : pressDeleteCount + 1;
  1151. if (!lastTag) return;
  1152. if (this.pressDeleteCount) {
  1153. if (lastTag.hitState) {
  1154. this.deleteTag(lastTag);
  1155. } else {
  1156. lastTag.hitState = true;
  1157. }
  1158. }
  1159. },
  1160. handleSuggestionClick: function handleSuggestionClick(index) {
  1161. var multiple = this.multiple;
  1162. var targetNode = this.suggestions[index];
  1163. if (multiple) {
  1164. var checked = targetNode.checked;
  1165. targetNode.doCheck(!checked);
  1166. this.panel.calculateMultiCheckedValue();
  1167. } else {
  1168. this.checkedValue = targetNode.getValueByOption();
  1169. this.toggleDropDownVisible(false);
  1170. }
  1171. },
  1172. deleteTag: function deleteTag(tag) {
  1173. var checkedValue = this.checkedValue;
  1174. var current = tag.node.getValueByOption();
  1175. var val = checkedValue.find(function (n) {
  1176. return Object(util_["isEqual"])(n, current);
  1177. });
  1178. this.checkedValue = checkedValue.filter(function (n) {
  1179. return !Object(util_["isEqual"])(n, current);
  1180. });
  1181. this.$emit('remove-tag', val);
  1182. },
  1183. updateStyle: function updateStyle() {
  1184. var $el = this.$el,
  1185. inputInitialHeight = this.inputInitialHeight;
  1186. if (this.$isServer || !$el) return;
  1187. var suggestionPanel = this.$refs.suggestionPanel;
  1188. var inputInner = $el.querySelector('.el-input__inner');
  1189. if (!inputInner) return;
  1190. var tags = $el.querySelector('.el-cascader__tags');
  1191. var suggestionPanelEl = null;
  1192. if (suggestionPanel && (suggestionPanelEl = suggestionPanel.$el)) {
  1193. var suggestionList = suggestionPanelEl.querySelector('.el-cascader__suggestion-list');
  1194. suggestionList.style.minWidth = inputInner.offsetWidth + 'px';
  1195. }
  1196. if (tags) {
  1197. var offsetHeight = tags.offsetHeight;
  1198. var height = Math.max(offsetHeight + 6, inputInitialHeight) + 'px';
  1199. inputInner.style.height = height;
  1200. this.updatePopper();
  1201. }
  1202. },
  1203. /**
  1204. * public methods
  1205. */
  1206. getCheckedNodes: function getCheckedNodes(leafOnly) {
  1207. return this.panel.getCheckedNodes(leafOnly);
  1208. }
  1209. }
  1210. });
  1211. // CONCATENATED MODULE: ./packages/cascader/src/cascader.vue?vue&type=script&lang=js&
  1212. /* harmony default export */ var src_cascadervue_type_script_lang_js_ = (cascadervue_type_script_lang_js_);
  1213. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1214. var componentNormalizer = __webpack_require__(0);
  1215. // CONCATENATED MODULE: ./packages/cascader/src/cascader.vue
  1216. /* normalize component */
  1217. var component = Object(componentNormalizer["a" /* default */])(
  1218. src_cascadervue_type_script_lang_js_,
  1219. render,
  1220. staticRenderFns,
  1221. false,
  1222. null,
  1223. null,
  1224. null
  1225. )
  1226. /* hot reload */
  1227. if (false) { var api; }
  1228. component.options.__file = "packages/cascader/src/cascader.vue"
  1229. /* harmony default export */ var cascader = (component.exports);
  1230. // CONCATENATED MODULE: ./packages/cascader/index.js
  1231. /* istanbul ignore next */
  1232. cascader.install = function (Vue) {
  1233. Vue.component(cascader.name, cascader);
  1234. };
  1235. /* harmony default export */ var packages_cascader = __webpack_exports__["default"] = (cascader);
  1236. /***/ })
  1237. /******/ });