cascader.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443
  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 = 78);
  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. /***/ 14:
  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. /***/ 32:
  220. /***/ (function(module, exports) {
  221. module.exports = require("element-ui/lib/utils/aria-utils");
  222. /***/ }),
  223. /***/ 38:
  224. /***/ (function(module, exports) {
  225. module.exports = require("element-ui/lib/tag");
  226. /***/ }),
  227. /***/ 4:
  228. /***/ (function(module, exports) {
  229. module.exports = require("element-ui/lib/mixins/emitter");
  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. /***/ 78:
  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. keydown: _vm.handleKeyDown
  279. }
  280. },
  281. [
  282. _c(
  283. "el-input",
  284. {
  285. ref: "input",
  286. class: { "is-focus": _vm.dropDownVisible },
  287. attrs: {
  288. size: _vm.realSize,
  289. placeholder: _vm.placeholder,
  290. readonly: _vm.readonly,
  291. disabled: _vm.isDisabled,
  292. "validate-event": false
  293. },
  294. on: {
  295. focus: _vm.handleFocus,
  296. blur: _vm.handleBlur,
  297. input: _vm.handleInput
  298. },
  299. nativeOn: {
  300. click: function($event) {
  301. return (function() {
  302. return _vm.toggleDropDownVisible(
  303. _vm.readonly ? undefined : true
  304. )
  305. })($event)
  306. }
  307. },
  308. model: {
  309. value: _vm.multiple ? _vm.presentText : _vm.inputValue,
  310. callback: function($$v) {
  311. _vm.multiple ? _vm.presentText : (_vm.inputValue = $$v)
  312. },
  313. expression: "multiple ? presentText : inputValue"
  314. }
  315. },
  316. [
  317. _c("template", { slot: "suffix" }, [
  318. _vm.clearBtnVisible
  319. ? _c("i", {
  320. key: "clear",
  321. staticClass: "el-input__icon el-icon-circle-close",
  322. on: {
  323. click: function($event) {
  324. $event.stopPropagation()
  325. return _vm.handleClear($event)
  326. }
  327. }
  328. })
  329. : _c("i", {
  330. key: "arrow-down",
  331. class: [
  332. "el-input__icon",
  333. "el-icon-arrow-down",
  334. _vm.dropDownVisible && "is-reverse"
  335. ],
  336. on: {
  337. click: function($event) {
  338. $event.stopPropagation()
  339. _vm.toggleDropDownVisible()
  340. }
  341. }
  342. })
  343. ]),
  344. _c("template", { slot: "append" }, [_vm._t("append")], 2)
  345. ],
  346. 2
  347. ),
  348. _vm.multiple
  349. ? _c(
  350. "div",
  351. { staticClass: "el-cascader__tags" },
  352. [
  353. _vm._l(_vm.presentTags, function(tag, index) {
  354. return _c(
  355. "el-tag",
  356. {
  357. key: tag.key,
  358. attrs: {
  359. type: "info",
  360. size: _vm.tagSize,
  361. hit: tag.hitState,
  362. closable: tag.closable,
  363. "disable-transitions": ""
  364. },
  365. on: {
  366. close: function($event) {
  367. _vm.deleteTag(index)
  368. }
  369. }
  370. },
  371. [_c("span", [_vm._v(_vm._s(tag.text))])]
  372. )
  373. }),
  374. _vm.filterable && !_vm.isDisabled
  375. ? _c("input", {
  376. directives: [
  377. {
  378. name: "model",
  379. rawName: "v-model.trim",
  380. value: _vm.inputValue,
  381. expression: "inputValue",
  382. modifiers: { trim: true }
  383. }
  384. ],
  385. staticClass: "el-cascader__search-input",
  386. attrs: {
  387. type: "text",
  388. placeholder: _vm.presentTags.length ? "" : _vm.placeholder
  389. },
  390. domProps: { value: _vm.inputValue },
  391. on: {
  392. input: [
  393. function($event) {
  394. if ($event.target.composing) {
  395. return
  396. }
  397. _vm.inputValue = $event.target.value.trim()
  398. },
  399. function(e) {
  400. return _vm.handleInput(_vm.inputValue, e)
  401. }
  402. ],
  403. click: function($event) {
  404. $event.stopPropagation()
  405. _vm.toggleDropDownVisible(true)
  406. },
  407. keydown: function($event) {
  408. if (
  409. !("button" in $event) &&
  410. _vm._k(
  411. $event.keyCode,
  412. "delete",
  413. [8, 46],
  414. $event.key,
  415. ["Backspace", "Delete", "Del"]
  416. )
  417. ) {
  418. return null
  419. }
  420. return _vm.handleDelete($event)
  421. },
  422. blur: function($event) {
  423. _vm.$forceUpdate()
  424. }
  425. }
  426. })
  427. : _vm._e()
  428. ],
  429. 2
  430. )
  431. : _vm._e(),
  432. _c(
  433. "transition",
  434. {
  435. attrs: { name: "el-zoom-in-top" },
  436. on: { "after-leave": _vm.handleDropdownLeave }
  437. },
  438. [
  439. _c(
  440. "div",
  441. {
  442. directives: [
  443. {
  444. name: "show",
  445. rawName: "v-show",
  446. value: _vm.dropDownVisible,
  447. expression: "dropDownVisible"
  448. }
  449. ],
  450. ref: "popper",
  451. class: ["el-popper", "el-cascader__dropdown", _vm.popperClass]
  452. },
  453. [
  454. _c("el-cascader-panel", {
  455. directives: [
  456. {
  457. name: "show",
  458. rawName: "v-show",
  459. value: !_vm.filtering,
  460. expression: "!filtering"
  461. }
  462. ],
  463. ref: "panel",
  464. attrs: {
  465. options: _vm.options,
  466. props: _vm.config,
  467. border: false,
  468. "render-label": _vm.$scopedSlots.default
  469. },
  470. on: {
  471. "expand-change": _vm.handleExpandChange,
  472. close: function($event) {
  473. _vm.toggleDropDownVisible(false)
  474. }
  475. },
  476. model: {
  477. value: _vm.checkedValue,
  478. callback: function($$v) {
  479. _vm.checkedValue = $$v
  480. },
  481. expression: "checkedValue"
  482. }
  483. }),
  484. _vm.filterable
  485. ? _c(
  486. "el-scrollbar",
  487. {
  488. directives: [
  489. {
  490. name: "show",
  491. rawName: "v-show",
  492. value: _vm.filtering,
  493. expression: "filtering"
  494. }
  495. ],
  496. ref: "suggestionPanel",
  497. staticClass: "el-cascader__suggestion-panel",
  498. attrs: {
  499. tag: "ul",
  500. "view-class": "el-cascader__suggestion-list"
  501. },
  502. nativeOn: {
  503. keydown: function($event) {
  504. return _vm.handleSuggestionKeyDown($event)
  505. }
  506. }
  507. },
  508. [
  509. _vm.suggestions.length
  510. ? _vm._l(_vm.suggestions, function(item, index) {
  511. return _c(
  512. "li",
  513. {
  514. key: item.uid,
  515. class: [
  516. "el-cascader__suggestion-item",
  517. item.checked && "is-checked"
  518. ],
  519. attrs: { tabindex: -1 },
  520. on: {
  521. click: function($event) {
  522. _vm.handleSuggestionClick(index)
  523. }
  524. }
  525. },
  526. [
  527. _c("span", [_vm._v(_vm._s(item.text))]),
  528. item.checked
  529. ? _c("i", { staticClass: "el-icon-check" })
  530. : _vm._e()
  531. ]
  532. )
  533. })
  534. : _vm._t("empty", [
  535. _c(
  536. "li",
  537. { staticClass: "el-cascader__empty-text" },
  538. [_vm._v(_vm._s(_vm.t("el.cascader.noMatch")))]
  539. )
  540. ])
  541. ],
  542. 2
  543. )
  544. : _vm._e()
  545. ],
  546. 1
  547. )
  548. ]
  549. )
  550. ],
  551. 1
  552. )
  553. }
  554. var staticRenderFns = []
  555. render._withStripped = true
  556. // CONCATENATED MODULE: ./packages/cascader/src/cascader.vue?vue&type=template&id=032537a6&
  557. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  558. var vue_popper_ = __webpack_require__(5);
  559. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  560. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  561. var clickoutside_ = __webpack_require__(12);
  562. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  563. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  564. var emitter_ = __webpack_require__(4);
  565. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  566. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  567. var locale_ = __webpack_require__(6);
  568. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  569. // EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
  570. var migrating_ = __webpack_require__(11);
  571. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  572. // EXTERNAL MODULE: external "element-ui/lib/input"
  573. var input_ = __webpack_require__(10);
  574. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  575. // EXTERNAL MODULE: external "element-ui/lib/tag"
  576. var tag_ = __webpack_require__(38);
  577. var tag_default = /*#__PURE__*/__webpack_require__.n(tag_);
  578. // EXTERNAL MODULE: external "element-ui/lib/scrollbar"
  579. var scrollbar_ = __webpack_require__(14);
  580. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  581. // EXTERNAL MODULE: external "element-ui/lib/cascader-panel"
  582. var cascader_panel_ = __webpack_require__(50);
  583. var cascader_panel_default = /*#__PURE__*/__webpack_require__.n(cascader_panel_);
  584. // EXTERNAL MODULE: external "element-ui/lib/utils/aria-utils"
  585. var aria_utils_ = __webpack_require__(32);
  586. var aria_utils_default = /*#__PURE__*/__webpack_require__.n(aria_utils_);
  587. // EXTERNAL MODULE: external "element-ui/lib/locale"
  588. var lib_locale_ = __webpack_require__(19);
  589. // EXTERNAL MODULE: external "element-ui/lib/utils/util"
  590. var util_ = __webpack_require__(3);
  591. // EXTERNAL MODULE: external "element-ui/lib/utils/types"
  592. var types_ = __webpack_require__(20);
  593. // EXTERNAL MODULE: external "element-ui/lib/utils/shared"
  594. var shared_ = __webpack_require__(21);
  595. // EXTERNAL MODULE: external "element-ui/lib/utils/resize-event"
  596. var resize_event_ = __webpack_require__(16);
  597. // EXTERNAL MODULE: external "throttle-debounce/debounce"
  598. var debounce_ = __webpack_require__(17);
  599. var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
  600. // 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&
  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. //
  708. //
  709. //
  710. //
  711. //
  712. //
  713. //
  714. //
  715. //
  716. //
  717. //
  718. //
  719. //
  720. //
  721. //
  722. //
  723. //
  724. //
  725. //
  726. var KeyCode = aria_utils_default.a.keys;
  727. var MigratingProps = {
  728. expandTrigger: {
  729. newProp: "expandTrigger",
  730. type: String
  731. },
  732. changeOnSelect: {
  733. newProp: "checkStrictly",
  734. type: Boolean
  735. },
  736. hoverThreshold: {
  737. newProp: "hoverThreshold",
  738. type: Number
  739. }
  740. };
  741. var PopperMixin = {
  742. props: {
  743. placement: {
  744. type: String,
  745. default: "bottom-start"
  746. },
  747. appendToBody: vue_popper_default.a.props.appendToBody,
  748. visibleArrow: {
  749. type: Boolean,
  750. default: true
  751. },
  752. arrowOffset: vue_popper_default.a.props.arrowOffset,
  753. offset: vue_popper_default.a.props.offset,
  754. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  755. popperOptions: vue_popper_default.a.props.popperOptions
  756. },
  757. methods: vue_popper_default.a.methods,
  758. data: vue_popper_default.a.data,
  759. beforeDestroy: vue_popper_default.a.beforeDestroy
  760. };
  761. var InputSizeMap = {
  762. medium: 36,
  763. small: 32,
  764. mini: 28
  765. };
  766. /* harmony default export */ var cascadervue_type_script_lang_js_ = ({
  767. name: "ElCascader",
  768. directives: { Clickoutside: clickoutside_default.a },
  769. mixins: [PopperMixin, emitter_default.a, locale_default.a, migrating_default.a],
  770. inject: {
  771. elForm: {
  772. default: ""
  773. },
  774. elFormItem: {
  775. default: ""
  776. }
  777. },
  778. components: {
  779. ElInput: input_default.a,
  780. ElTag: tag_default.a,
  781. ElScrollbar: scrollbar_default.a,
  782. ElCascaderPanel: cascader_panel_default.a
  783. },
  784. props: {
  785. value: {},
  786. options: Array,
  787. props: Object,
  788. size: String,
  789. placeholder: {
  790. type: String,
  791. default: function _default() {
  792. return Object(lib_locale_["t"])("el.cascader.placeholder");
  793. }
  794. },
  795. disabled: Boolean,
  796. clearable: Boolean,
  797. filterable: Boolean,
  798. filterMethod: Function,
  799. separator: {
  800. type: String,
  801. default: " / "
  802. },
  803. showAllLevels: {
  804. type: Boolean,
  805. default: true
  806. },
  807. collapseTags: Boolean,
  808. debounce: {
  809. type: Number,
  810. default: 300
  811. },
  812. beforeFilter: {
  813. type: Function,
  814. default: function _default() {
  815. return function () {};
  816. }
  817. },
  818. popperClass: String
  819. },
  820. data: function data() {
  821. return {
  822. dropDownVisible: false,
  823. checkedValue: this.value || null,
  824. inputHover: false,
  825. inputValue: null,
  826. presentText: null,
  827. presentTags: [],
  828. checkedNodes: [],
  829. filtering: false,
  830. suggestions: [],
  831. inputInitialHeight: 0,
  832. pressDeleteCount: 0
  833. };
  834. },
  835. computed: {
  836. realSize: function realSize() {
  837. var _elFormItemSize = (this.elFormItem || {}).elFormItemSize;
  838. return this.size || _elFormItemSize || (this.$ELEMENT || {}).size;
  839. },
  840. tagSize: function tagSize() {
  841. return ["small", "mini"].indexOf(this.realSize) > -1 ? "mini" : "small";
  842. },
  843. isDisabled: function isDisabled() {
  844. return this.disabled || (this.elForm || {}).disabled;
  845. },
  846. config: function config() {
  847. var config = this.props || {};
  848. var $attrs = this.$attrs;
  849. Object.keys(MigratingProps).forEach(function (oldProp) {
  850. var _MigratingProps$oldPr = MigratingProps[oldProp],
  851. newProp = _MigratingProps$oldPr.newProp,
  852. type = _MigratingProps$oldPr.type;
  853. var oldValue = $attrs[oldProp] || $attrs[Object(util_["kebabCase"])(oldProp)];
  854. if (Object(shared_["isDef"])(oldProp) && !Object(shared_["isDef"])(config[newProp])) {
  855. if (type === Boolean && oldValue === "") {
  856. oldValue = true;
  857. }
  858. config[newProp] = oldValue;
  859. }
  860. });
  861. return config;
  862. },
  863. multiple: function multiple() {
  864. return this.config.multiple;
  865. },
  866. leafOnly: function leafOnly() {
  867. return !this.config.checkStrictly;
  868. },
  869. readonly: function readonly() {
  870. return !this.filterable || this.multiple;
  871. },
  872. clearBtnVisible: function clearBtnVisible() {
  873. if (!this.clearable || this.isDisabled || this.filtering || !this.inputHover) {
  874. return false;
  875. }
  876. return this.multiple ? !!this.checkedNodes.filter(function (node) {
  877. return !node.isDisabled;
  878. }).length : !!this.presentText;
  879. },
  880. panel: function panel() {
  881. return this.$refs.panel;
  882. }
  883. },
  884. watch: {
  885. disabled: function disabled() {
  886. this.computePresentContent();
  887. },
  888. value: function value(val) {
  889. if (!Object(util_["isEqual"])(val, this.checkedValue)) {
  890. this.checkedValue = val;
  891. this.computePresentContent();
  892. }
  893. },
  894. checkedValue: function checkedValue(val) {
  895. var value = this.value,
  896. dropDownVisible = this.dropDownVisible;
  897. var _config = this.config,
  898. checkStrictly = _config.checkStrictly,
  899. multiple = _config.multiple;
  900. if (!Object(util_["isEqual"])(val, value) || Object(types_["isUndefined"])(value)) {
  901. this.computePresentContent();
  902. // hide dropdown when single mode
  903. if (!multiple && !checkStrictly && dropDownVisible) {
  904. this.toggleDropDownVisible(false);
  905. }
  906. this.$emit("input", val);
  907. this.$emit("change", val);
  908. this.dispatch("ElFormItem", "el.form.change", [val]);
  909. }
  910. },
  911. options: {
  912. handler: function handler() {
  913. this.$nextTick(this.computePresentContent);
  914. },
  915. deep: true
  916. },
  917. presentText: function presentText(val) {
  918. this.inputValue = val;
  919. },
  920. presentTags: function presentTags(val, oldVal) {
  921. if (this.multiple && (val.length || oldVal.length)) {
  922. this.$nextTick(this.updateStyle);
  923. }
  924. },
  925. filtering: function filtering(val) {
  926. this.$nextTick(this.updatePopper);
  927. }
  928. },
  929. mounted: function mounted() {
  930. var _this = this;
  931. var input = this.$refs.input;
  932. if (input && input.$el) {
  933. this.inputInitialHeight = input.$el.offsetHeight || InputSizeMap[this.realSize] || 40;
  934. }
  935. if (!Object(util_["isEmpty"])(this.value)) {
  936. this.computePresentContent();
  937. }
  938. this.filterHandler = debounce_default()(this.debounce, function () {
  939. var inputValue = _this.inputValue;
  940. if (!inputValue) {
  941. _this.filtering = false;
  942. return;
  943. }
  944. var before = _this.beforeFilter(inputValue);
  945. if (before && before.then) {
  946. before.then(_this.getSuggestions);
  947. } else if (before !== false) {
  948. _this.getSuggestions();
  949. } else {
  950. _this.filtering = false;
  951. }
  952. });
  953. Object(resize_event_["addResizeListener"])(this.$el, this.updateStyle);
  954. },
  955. beforeDestroy: function beforeDestroy() {
  956. Object(resize_event_["removeResizeListener"])(this.$el, this.updateStyle);
  957. },
  958. methods: {
  959. getMigratingConfig: function getMigratingConfig() {
  960. return {
  961. props: {
  962. "expand-trigger": "expand-trigger is removed, use `props.expandTrigger` instead.",
  963. "change-on-select": "change-on-select is removed, use `props.checkStrictly` instead.",
  964. "hover-threshold": "hover-threshold is removed, use `props.hoverThreshold` instead"
  965. },
  966. events: {
  967. "active-item-change": "active-item-change is renamed to expand-change"
  968. }
  969. };
  970. },
  971. toggleDropDownVisible: function toggleDropDownVisible(visible) {
  972. var _this2 = this;
  973. if (this.isDisabled) return;
  974. var dropDownVisible = this.dropDownVisible;
  975. var input = this.$refs.input;
  976. visible = Object(shared_["isDef"])(visible) ? visible : !dropDownVisible;
  977. if (visible !== dropDownVisible) {
  978. this.dropDownVisible = visible;
  979. if (visible) {
  980. this.$nextTick(function () {
  981. _this2.updatePopper();
  982. _this2.panel.scrollIntoView();
  983. });
  984. }
  985. input.$refs.input.setAttribute("aria-expanded", visible);
  986. this.$emit("visible-change", visible);
  987. }
  988. },
  989. handleDropdownLeave: function handleDropdownLeave() {
  990. this.filtering = false;
  991. this.inputValue = this.presentText;
  992. },
  993. handleKeyDown: function handleKeyDown(event) {
  994. switch (event.keyCode) {
  995. case KeyCode.enter:
  996. this.toggleDropDownVisible();
  997. break;
  998. case KeyCode.down:
  999. this.toggleDropDownVisible(true);
  1000. this.focusFirstNode();
  1001. event.preventDefault();
  1002. break;
  1003. case KeyCode.esc:
  1004. case KeyCode.tab:
  1005. this.toggleDropDownVisible(false);
  1006. break;
  1007. }
  1008. },
  1009. handleFocus: function handleFocus(e) {
  1010. this.$emit("focus", e);
  1011. },
  1012. handleBlur: function handleBlur(e) {
  1013. this.$emit("blur", e);
  1014. },
  1015. handleInput: function handleInput(val, event) {
  1016. !this.dropDownVisible && this.toggleDropDownVisible(true);
  1017. if (event && event.isComposing) return;
  1018. if (val) {
  1019. this.filterHandler();
  1020. } else {
  1021. this.filtering = false;
  1022. }
  1023. },
  1024. handleClear: function handleClear() {
  1025. this.presentText = "";
  1026. this.panel.clearCheckedNodes();
  1027. },
  1028. handleExpandChange: function handleExpandChange(value) {
  1029. this.$nextTick(this.updatePopper.bind(this));
  1030. this.$emit("expand-change", value);
  1031. this.$emit("active-item-change", value); // Deprecated
  1032. },
  1033. focusFirstNode: function focusFirstNode() {
  1034. var _this3 = this;
  1035. this.$nextTick(function () {
  1036. var filtering = _this3.filtering;
  1037. var _$refs = _this3.$refs,
  1038. popper = _$refs.popper,
  1039. suggestionPanel = _$refs.suggestionPanel;
  1040. var firstNode = null;
  1041. if (filtering && suggestionPanel) {
  1042. firstNode = suggestionPanel.$el.querySelector(".el-cascader__suggestion-item");
  1043. } else {
  1044. var firstMenu = popper.querySelector(".el-cascader-menu");
  1045. firstNode = firstMenu.querySelector('.el-cascader-node[tabindex="-1"]');
  1046. }
  1047. if (firstNode) {
  1048. firstNode.focus();
  1049. !filtering && firstNode.click();
  1050. }
  1051. });
  1052. },
  1053. computePresentContent: function computePresentContent() {
  1054. var _this4 = this;
  1055. // nextTick is required, because checked nodes may not change right now
  1056. this.$nextTick(function () {
  1057. if (_this4.config.multiple) {
  1058. _this4.computePresentTags();
  1059. _this4.presentText = _this4.presentTags.length ? " " : null;
  1060. } else {
  1061. _this4.computePresentText();
  1062. }
  1063. });
  1064. },
  1065. computePresentText: function computePresentText() {
  1066. var checkedValue = this.checkedValue,
  1067. config = this.config;
  1068. if (!Object(util_["isEmpty"])(checkedValue)) {
  1069. var node = this.panel.getNodeByValue(checkedValue);
  1070. if (node && (config.checkStrictly || node.isLeaf)) {
  1071. this.presentText = node.getText(this.showAllLevels, this.separator);
  1072. return;
  1073. }
  1074. }
  1075. this.presentText = null;
  1076. },
  1077. computePresentTags: function computePresentTags() {
  1078. var isDisabled = this.isDisabled,
  1079. leafOnly = this.leafOnly,
  1080. showAllLevels = this.showAllLevels,
  1081. separator = this.separator,
  1082. collapseTags = this.collapseTags;
  1083. var checkedNodes = this.getCheckedNodes(leafOnly);
  1084. var tags = [];
  1085. var genTag = function genTag(node) {
  1086. return {
  1087. node: node,
  1088. key: node.uid,
  1089. text: node.getText(showAllLevels, separator),
  1090. hitState: false,
  1091. closable: !isDisabled && !node.isDisabled
  1092. };
  1093. };
  1094. if (checkedNodes.length) {
  1095. var first = checkedNodes[0],
  1096. rest = checkedNodes.slice(1);
  1097. var restCount = rest.length;
  1098. tags.push(genTag(first));
  1099. if (restCount) {
  1100. if (collapseTags) {
  1101. tags.push({
  1102. key: -1,
  1103. text: "+ " + restCount,
  1104. closable: false
  1105. });
  1106. } else {
  1107. rest.forEach(function (node) {
  1108. return tags.push(genTag(node));
  1109. });
  1110. }
  1111. }
  1112. }
  1113. this.checkedNodes = checkedNodes;
  1114. this.presentTags = tags;
  1115. },
  1116. getSuggestions: function getSuggestions() {
  1117. var _this5 = this;
  1118. var filterMethod = this.filterMethod;
  1119. if (!Object(types_["isFunction"])(filterMethod)) {
  1120. filterMethod = function filterMethod(node, keyword) {
  1121. return node.text.includes(keyword);
  1122. };
  1123. }
  1124. var suggestions = this.panel.getFlattedNodes(this.leafOnly).filter(function (node) {
  1125. if (node.isDisabled) return false;
  1126. node.text = node.getText(_this5.showAllLevels, _this5.separator) || "";
  1127. return filterMethod(node, _this5.inputValue);
  1128. });
  1129. if (this.multiple) {
  1130. this.presentTags.forEach(function (tag) {
  1131. tag.hitState = false;
  1132. });
  1133. } else {
  1134. suggestions.forEach(function (node) {
  1135. node.checked = Object(util_["isEqual"])(_this5.checkedValue, node.getValueByOption());
  1136. });
  1137. }
  1138. this.filtering = true;
  1139. this.suggestions = suggestions;
  1140. this.$nextTick(this.updatePopper);
  1141. },
  1142. handleSuggestionKeyDown: function handleSuggestionKeyDown(event) {
  1143. var keyCode = event.keyCode,
  1144. target = event.target;
  1145. switch (keyCode) {
  1146. case KeyCode.enter:
  1147. target.click();
  1148. break;
  1149. case KeyCode.up:
  1150. var prev = target.previousElementSibling;
  1151. prev && prev.focus();
  1152. break;
  1153. case KeyCode.down:
  1154. var next = target.nextElementSibling;
  1155. next && next.focus();
  1156. break;
  1157. case KeyCode.esc:
  1158. case KeyCode.tab:
  1159. this.toggleDropDownVisible(false);
  1160. break;
  1161. }
  1162. },
  1163. handleDelete: function handleDelete() {
  1164. var inputValue = this.inputValue,
  1165. pressDeleteCount = this.pressDeleteCount,
  1166. presentTags = this.presentTags;
  1167. var lastIndex = presentTags.length - 1;
  1168. var lastTag = presentTags[lastIndex];
  1169. this.pressDeleteCount = inputValue ? 0 : pressDeleteCount + 1;
  1170. if (!lastTag) return;
  1171. if (this.pressDeleteCount) {
  1172. if (lastTag.hitState) {
  1173. this.deleteTag(lastIndex);
  1174. } else {
  1175. lastTag.hitState = true;
  1176. }
  1177. }
  1178. },
  1179. handleSuggestionClick: function handleSuggestionClick(index) {
  1180. var multiple = this.multiple;
  1181. var targetNode = this.suggestions[index];
  1182. if (multiple) {
  1183. var checked = targetNode.checked;
  1184. targetNode.doCheck(!checked);
  1185. this.panel.calculateMultiCheckedValue();
  1186. } else {
  1187. this.checkedValue = targetNode.getValueByOption();
  1188. this.toggleDropDownVisible(false);
  1189. }
  1190. },
  1191. deleteTag: function deleteTag(index) {
  1192. var checkedValue = this.checkedValue;
  1193. var val = checkedValue[index];
  1194. this.checkedValue = checkedValue.filter(function (n, i) {
  1195. return i !== index;
  1196. });
  1197. this.$emit("remove-tag", val);
  1198. },
  1199. updateStyle: function updateStyle() {
  1200. var $el = this.$el,
  1201. inputInitialHeight = this.inputInitialHeight;
  1202. if (this.$isServer || !$el) return;
  1203. var suggestionPanel = this.$refs.suggestionPanel;
  1204. var inputInner = $el.querySelector(".el-input__inner");
  1205. if (!inputInner) return;
  1206. var tags = $el.querySelector(".el-cascader__tags");
  1207. var suggestionPanelEl = null;
  1208. if (suggestionPanel && (suggestionPanelEl = suggestionPanel.$el)) {
  1209. var suggestionList = suggestionPanelEl.querySelector(".el-cascader__suggestion-list");
  1210. suggestionList.style.minWidth = inputInner.offsetWidth + "px";
  1211. }
  1212. if (tags) {
  1213. var offsetHeight = tags.offsetHeight;
  1214. var height = Math.max(offsetHeight + 6, inputInitialHeight) + "px";
  1215. inputInner.style.height = height;
  1216. this.updatePopper();
  1217. } else {
  1218. inputInner.style.height = inputInitialHeight + "px";
  1219. this.updatePopper();
  1220. }
  1221. },
  1222. /**
  1223. * public methods
  1224. */
  1225. getCheckedNodes: function getCheckedNodes(leafOnly) {
  1226. return this.panel.getCheckedNodes(leafOnly);
  1227. }
  1228. }
  1229. });
  1230. // CONCATENATED MODULE: ./packages/cascader/src/cascader.vue?vue&type=script&lang=js&
  1231. /* harmony default export */ var src_cascadervue_type_script_lang_js_ = (cascadervue_type_script_lang_js_);
  1232. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1233. var componentNormalizer = __webpack_require__(0);
  1234. // CONCATENATED MODULE: ./packages/cascader/src/cascader.vue
  1235. /* normalize component */
  1236. var component = Object(componentNormalizer["a" /* default */])(
  1237. src_cascadervue_type_script_lang_js_,
  1238. render,
  1239. staticRenderFns,
  1240. false,
  1241. null,
  1242. null,
  1243. null
  1244. )
  1245. /* hot reload */
  1246. if (false) { var api; }
  1247. component.options.__file = "packages/cascader/src/cascader.vue"
  1248. /* harmony default export */ var cascader = (component.exports);
  1249. // CONCATENATED MODULE: ./packages/cascader/index.js
  1250. /* istanbul ignore next */
  1251. cascader.install = function (Vue) {
  1252. Vue.component(cascader.name, cascader);
  1253. };
  1254. /* harmony default export */ var packages_cascader = __webpack_exports__["default"] = (cascader);
  1255. /***/ })
  1256. /******/ });