transfer.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  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 = 57);
  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/mixins/migrating");
  182. /***/ }),
  183. /***/ 15:
  184. /***/ (function(module, exports) {
  185. module.exports = require("element-ui/lib/button");
  186. /***/ }),
  187. /***/ 16:
  188. /***/ (function(module, exports) {
  189. module.exports = require("element-ui/lib/checkbox");
  190. /***/ }),
  191. /***/ 3:
  192. /***/ (function(module, exports) {
  193. module.exports = require("element-ui/lib/mixins/emitter");
  194. /***/ }),
  195. /***/ 37:
  196. /***/ (function(module, exports) {
  197. module.exports = require("element-ui/lib/checkbox-group");
  198. /***/ }),
  199. /***/ 57:
  200. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  201. "use strict";
  202. __webpack_require__.r(__webpack_exports__);
  203. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/transfer/src/main.vue?vue&type=template&id=5c654dd8&
  204. var render = function() {
  205. var _vm = this
  206. var _h = _vm.$createElement
  207. var _c = _vm._self._c || _h
  208. return _c(
  209. "div",
  210. { staticClass: "el-transfer" },
  211. [
  212. _c(
  213. "transfer-panel",
  214. _vm._b(
  215. {
  216. ref: "leftPanel",
  217. attrs: {
  218. data: _vm.sourceData,
  219. title: _vm.titles[0] || _vm.t("el.transfer.titles.0"),
  220. "default-checked": _vm.leftDefaultChecked,
  221. placeholder:
  222. _vm.filterPlaceholder || _vm.t("el.transfer.filterPlaceholder")
  223. },
  224. on: { "checked-change": _vm.onSourceCheckedChange }
  225. },
  226. "transfer-panel",
  227. _vm.$props,
  228. false
  229. ),
  230. [_vm._t("left-footer")],
  231. 2
  232. ),
  233. _c(
  234. "div",
  235. { staticClass: "el-transfer__buttons" },
  236. [
  237. _c(
  238. "el-button",
  239. {
  240. class: [
  241. "el-transfer__button",
  242. _vm.hasButtonTexts ? "is-with-texts" : ""
  243. ],
  244. attrs: {
  245. type: "primary",
  246. disabled: _vm.rightChecked.length === 0
  247. },
  248. nativeOn: {
  249. click: function($event) {
  250. return _vm.addToLeft($event)
  251. }
  252. }
  253. },
  254. [
  255. _c("i", { staticClass: "el-icon-arrow-left" }),
  256. _vm.buttonTexts[0] !== undefined
  257. ? _c("span", [_vm._v(_vm._s(_vm.buttonTexts[0]))])
  258. : _vm._e()
  259. ]
  260. ),
  261. _c(
  262. "el-button",
  263. {
  264. class: [
  265. "el-transfer__button",
  266. _vm.hasButtonTexts ? "is-with-texts" : ""
  267. ],
  268. attrs: {
  269. type: "primary",
  270. disabled: _vm.leftChecked.length === 0
  271. },
  272. nativeOn: {
  273. click: function($event) {
  274. return _vm.addToRight($event)
  275. }
  276. }
  277. },
  278. [
  279. _vm.buttonTexts[1] !== undefined
  280. ? _c("span", [_vm._v(_vm._s(_vm.buttonTexts[1]))])
  281. : _vm._e(),
  282. _c("i", { staticClass: "el-icon-arrow-right" })
  283. ]
  284. )
  285. ],
  286. 1
  287. ),
  288. _c(
  289. "transfer-panel",
  290. _vm._b(
  291. {
  292. ref: "rightPanel",
  293. attrs: {
  294. data: _vm.targetData,
  295. title: _vm.titles[1] || _vm.t("el.transfer.titles.1"),
  296. "default-checked": _vm.rightDefaultChecked,
  297. placeholder:
  298. _vm.filterPlaceholder || _vm.t("el.transfer.filterPlaceholder")
  299. },
  300. on: { "checked-change": _vm.onTargetCheckedChange }
  301. },
  302. "transfer-panel",
  303. _vm.$props,
  304. false
  305. ),
  306. [_vm._t("right-footer")],
  307. 2
  308. )
  309. ],
  310. 1
  311. )
  312. }
  313. var staticRenderFns = []
  314. render._withStripped = true
  315. // CONCATENATED MODULE: ./packages/transfer/src/main.vue?vue&type=template&id=5c654dd8&
  316. // EXTERNAL MODULE: external "element-ui/lib/button"
  317. var button_ = __webpack_require__(15);
  318. var button_default = /*#__PURE__*/__webpack_require__.n(button_);
  319. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  320. var emitter_ = __webpack_require__(3);
  321. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  322. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  323. var locale_ = __webpack_require__(7);
  324. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  325. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/transfer/src/transfer-panel.vue?vue&type=template&id=2ddab8bd&
  326. var transfer_panelvue_type_template_id_2ddab8bd_render = function() {
  327. var _vm = this
  328. var _h = _vm.$createElement
  329. var _c = _vm._self._c || _h
  330. return _c("div", { staticClass: "el-transfer-panel" }, [
  331. _c(
  332. "p",
  333. { staticClass: "el-transfer-panel__header" },
  334. [
  335. _c(
  336. "el-checkbox",
  337. {
  338. attrs: { indeterminate: _vm.isIndeterminate },
  339. on: { change: _vm.handleAllCheckedChange },
  340. model: {
  341. value: _vm.allChecked,
  342. callback: function($$v) {
  343. _vm.allChecked = $$v
  344. },
  345. expression: "allChecked"
  346. }
  347. },
  348. [
  349. _vm._v("\n " + _vm._s(_vm.title) + "\n "),
  350. _c("span", [_vm._v(_vm._s(_vm.checkedSummary))])
  351. ]
  352. )
  353. ],
  354. 1
  355. ),
  356. _c(
  357. "div",
  358. {
  359. class: [
  360. "el-transfer-panel__body",
  361. _vm.hasFooter ? "is-with-footer" : ""
  362. ]
  363. },
  364. [
  365. _vm.filterable
  366. ? _c(
  367. "el-input",
  368. {
  369. staticClass: "el-transfer-panel__filter",
  370. attrs: { size: "small", placeholder: _vm.placeholder },
  371. nativeOn: {
  372. mouseenter: function($event) {
  373. _vm.inputHover = true
  374. },
  375. mouseleave: function($event) {
  376. _vm.inputHover = false
  377. }
  378. },
  379. model: {
  380. value: _vm.query,
  381. callback: function($$v) {
  382. _vm.query = $$v
  383. },
  384. expression: "query"
  385. }
  386. },
  387. [
  388. _c("i", {
  389. class: ["el-input__icon", "el-icon-" + _vm.inputIcon],
  390. attrs: { slot: "prefix" },
  391. on: { click: _vm.clearQuery },
  392. slot: "prefix"
  393. })
  394. ]
  395. )
  396. : _vm._e(),
  397. _c(
  398. "el-checkbox-group",
  399. {
  400. directives: [
  401. {
  402. name: "show",
  403. rawName: "v-show",
  404. value: !_vm.hasNoMatch && _vm.data.length > 0,
  405. expression: "!hasNoMatch && data.length > 0"
  406. }
  407. ],
  408. staticClass: "el-transfer-panel__list",
  409. class: { "is-filterable": _vm.filterable },
  410. model: {
  411. value: _vm.checked,
  412. callback: function($$v) {
  413. _vm.checked = $$v
  414. },
  415. expression: "checked"
  416. }
  417. },
  418. _vm._l(_vm.filteredData, function(item) {
  419. return _c(
  420. "el-checkbox",
  421. {
  422. key: item[_vm.keyProp],
  423. staticClass: "el-transfer-panel__item",
  424. attrs: {
  425. label: item[_vm.keyProp],
  426. disabled: item[_vm.disabledProp]
  427. }
  428. },
  429. [_c("option-content", { attrs: { option: item } })],
  430. 1
  431. )
  432. }),
  433. 1
  434. ),
  435. _c(
  436. "p",
  437. {
  438. directives: [
  439. {
  440. name: "show",
  441. rawName: "v-show",
  442. value: _vm.hasNoMatch,
  443. expression: "hasNoMatch"
  444. }
  445. ],
  446. staticClass: "el-transfer-panel__empty"
  447. },
  448. [_vm._v(_vm._s(_vm.t("el.transfer.noMatch")))]
  449. ),
  450. _c(
  451. "p",
  452. {
  453. directives: [
  454. {
  455. name: "show",
  456. rawName: "v-show",
  457. value: _vm.data.length === 0 && !_vm.hasNoMatch,
  458. expression: "data.length === 0 && !hasNoMatch"
  459. }
  460. ],
  461. staticClass: "el-transfer-panel__empty"
  462. },
  463. [_vm._v(_vm._s(_vm.t("el.transfer.noData")))]
  464. )
  465. ],
  466. 1
  467. ),
  468. _vm.hasFooter
  469. ? _c(
  470. "p",
  471. { staticClass: "el-transfer-panel__footer" },
  472. [_vm._t("default")],
  473. 2
  474. )
  475. : _vm._e()
  476. ])
  477. }
  478. var transfer_panelvue_type_template_id_2ddab8bd_staticRenderFns = []
  479. transfer_panelvue_type_template_id_2ddab8bd_render._withStripped = true
  480. // CONCATENATED MODULE: ./packages/transfer/src/transfer-panel.vue?vue&type=template&id=2ddab8bd&
  481. // EXTERNAL MODULE: external "element-ui/lib/checkbox-group"
  482. var checkbox_group_ = __webpack_require__(37);
  483. var checkbox_group_default = /*#__PURE__*/__webpack_require__.n(checkbox_group_);
  484. // EXTERNAL MODULE: external "element-ui/lib/checkbox"
  485. var checkbox_ = __webpack_require__(16);
  486. var checkbox_default = /*#__PURE__*/__webpack_require__.n(checkbox_);
  487. // EXTERNAL MODULE: external "element-ui/lib/input"
  488. var input_ = __webpack_require__(9);
  489. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  490. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/transfer/src/transfer-panel.vue?vue&type=script&lang=js&
  491. //
  492. //
  493. //
  494. //
  495. //
  496. //
  497. //
  498. //
  499. //
  500. //
  501. //
  502. //
  503. //
  504. //
  505. //
  506. //
  507. //
  508. //
  509. //
  510. //
  511. //
  512. //
  513. //
  514. //
  515. //
  516. //
  517. //
  518. //
  519. //
  520. //
  521. //
  522. //
  523. //
  524. //
  525. //
  526. //
  527. //
  528. //
  529. //
  530. //
  531. //
  532. //
  533. //
  534. //
  535. //
  536. //
  537. //
  538. //
  539. //
  540. //
  541. //
  542. //
  543. //
  544. /* harmony default export */ var transfer_panelvue_type_script_lang_js_ = ({
  545. mixins: [locale_default.a],
  546. name: 'ElTransferPanel',
  547. componentName: 'ElTransferPanel',
  548. components: {
  549. ElCheckboxGroup: checkbox_group_default.a,
  550. ElCheckbox: checkbox_default.a,
  551. ElInput: input_default.a,
  552. OptionContent: {
  553. props: {
  554. option: Object
  555. },
  556. render: function render(h) {
  557. var getParent = function getParent(vm) {
  558. if (vm.$options.componentName === 'ElTransferPanel') {
  559. return vm;
  560. } else if (vm.$parent) {
  561. return getParent(vm.$parent);
  562. } else {
  563. return vm;
  564. }
  565. };
  566. var panel = getParent(this);
  567. var transfer = panel.$parent || panel;
  568. return panel.renderContent ? panel.renderContent(h, this.option) : transfer.$scopedSlots.default ? transfer.$scopedSlots.default({ option: this.option }) : h('span', [this.option[panel.labelProp] || this.option[panel.keyProp]]);
  569. }
  570. }
  571. },
  572. props: {
  573. data: {
  574. type: Array,
  575. default: function _default() {
  576. return [];
  577. }
  578. },
  579. renderContent: Function,
  580. placeholder: String,
  581. title: String,
  582. filterable: Boolean,
  583. format: Object,
  584. filterMethod: Function,
  585. defaultChecked: Array,
  586. props: Object
  587. },
  588. data: function data() {
  589. return {
  590. checked: [],
  591. allChecked: false,
  592. query: '',
  593. inputHover: false,
  594. checkChangeByUser: true
  595. };
  596. },
  597. watch: {
  598. checked: function checked(val, oldVal) {
  599. this.updateAllChecked();
  600. if (this.checkChangeByUser) {
  601. var movedKeys = val.concat(oldVal).filter(function (v) {
  602. return val.indexOf(v) === -1 || oldVal.indexOf(v) === -1;
  603. });
  604. this.$emit('checked-change', val, movedKeys);
  605. } else {
  606. this.$emit('checked-change', val);
  607. this.checkChangeByUser = true;
  608. }
  609. },
  610. data: function data() {
  611. var _this = this;
  612. var checked = [];
  613. var filteredDataKeys = this.filteredData.map(function (item) {
  614. return item[_this.keyProp];
  615. });
  616. this.checked.forEach(function (item) {
  617. if (filteredDataKeys.indexOf(item) > -1) {
  618. checked.push(item);
  619. }
  620. });
  621. this.checkChangeByUser = false;
  622. this.checked = checked;
  623. },
  624. checkableData: function checkableData() {
  625. this.updateAllChecked();
  626. },
  627. defaultChecked: {
  628. immediate: true,
  629. handler: function handler(val, oldVal) {
  630. var _this2 = this;
  631. if (oldVal && val.length === oldVal.length && val.every(function (item) {
  632. return oldVal.indexOf(item) > -1;
  633. })) return;
  634. var checked = [];
  635. var checkableDataKeys = this.checkableData.map(function (item) {
  636. return item[_this2.keyProp];
  637. });
  638. val.forEach(function (item) {
  639. if (checkableDataKeys.indexOf(item) > -1) {
  640. checked.push(item);
  641. }
  642. });
  643. this.checkChangeByUser = false;
  644. this.checked = checked;
  645. }
  646. }
  647. },
  648. computed: {
  649. filteredData: function filteredData() {
  650. var _this3 = this;
  651. return this.data.filter(function (item) {
  652. if (typeof _this3.filterMethod === 'function') {
  653. return _this3.filterMethod(_this3.query, item);
  654. } else {
  655. var label = item[_this3.labelProp] || item[_this3.keyProp].toString();
  656. return label.toLowerCase().indexOf(_this3.query.toLowerCase()) > -1;
  657. }
  658. });
  659. },
  660. checkableData: function checkableData() {
  661. var _this4 = this;
  662. return this.filteredData.filter(function (item) {
  663. return !item[_this4.disabledProp];
  664. });
  665. },
  666. checkedSummary: function checkedSummary() {
  667. var checkedLength = this.checked.length;
  668. var dataLength = this.data.length;
  669. var _format = this.format,
  670. noChecked = _format.noChecked,
  671. hasChecked = _format.hasChecked;
  672. if (noChecked && hasChecked) {
  673. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength).replace(/\${total}/g, dataLength) : noChecked.replace(/\${total}/g, dataLength);
  674. } else {
  675. return checkedLength + '/' + dataLength;
  676. }
  677. },
  678. isIndeterminate: function isIndeterminate() {
  679. var checkedLength = this.checked.length;
  680. return checkedLength > 0 && checkedLength < this.checkableData.length;
  681. },
  682. hasNoMatch: function hasNoMatch() {
  683. return this.query.length > 0 && this.filteredData.length === 0;
  684. },
  685. inputIcon: function inputIcon() {
  686. return this.query.length > 0 && this.inputHover ? 'circle-close' : 'search';
  687. },
  688. labelProp: function labelProp() {
  689. return this.props.label || 'label';
  690. },
  691. keyProp: function keyProp() {
  692. return this.props.key || 'key';
  693. },
  694. disabledProp: function disabledProp() {
  695. return this.props.disabled || 'disabled';
  696. },
  697. hasFooter: function hasFooter() {
  698. return !!this.$slots.default;
  699. }
  700. },
  701. methods: {
  702. updateAllChecked: function updateAllChecked() {
  703. var _this5 = this;
  704. var checkableDataKeys = this.checkableData.map(function (item) {
  705. return item[_this5.keyProp];
  706. });
  707. this.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every(function (item) {
  708. return _this5.checked.indexOf(item) > -1;
  709. });
  710. },
  711. handleAllCheckedChange: function handleAllCheckedChange(value) {
  712. var _this6 = this;
  713. this.checked = value ? this.checkableData.map(function (item) {
  714. return item[_this6.keyProp];
  715. }) : [];
  716. },
  717. clearQuery: function clearQuery() {
  718. if (this.inputIcon === 'circle-close') {
  719. this.query = '';
  720. }
  721. }
  722. }
  723. });
  724. // CONCATENATED MODULE: ./packages/transfer/src/transfer-panel.vue?vue&type=script&lang=js&
  725. /* harmony default export */ var src_transfer_panelvue_type_script_lang_js_ = (transfer_panelvue_type_script_lang_js_);
  726. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  727. var componentNormalizer = __webpack_require__(0);
  728. // CONCATENATED MODULE: ./packages/transfer/src/transfer-panel.vue
  729. /* normalize component */
  730. var component = Object(componentNormalizer["a" /* default */])(
  731. src_transfer_panelvue_type_script_lang_js_,
  732. transfer_panelvue_type_template_id_2ddab8bd_render,
  733. transfer_panelvue_type_template_id_2ddab8bd_staticRenderFns,
  734. false,
  735. null,
  736. null,
  737. null
  738. )
  739. /* hot reload */
  740. if (false) { var api; }
  741. component.options.__file = "packages/transfer/src/transfer-panel.vue"
  742. /* harmony default export */ var transfer_panel = (component.exports);
  743. // EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
  744. var migrating_ = __webpack_require__(10);
  745. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  746. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/transfer/src/main.vue?vue&type=script&lang=js&
  747. //
  748. //
  749. //
  750. //
  751. //
  752. //
  753. //
  754. //
  755. //
  756. //
  757. //
  758. //
  759. //
  760. //
  761. //
  762. //
  763. //
  764. //
  765. //
  766. //
  767. //
  768. //
  769. //
  770. //
  771. //
  772. //
  773. //
  774. //
  775. //
  776. //
  777. //
  778. //
  779. //
  780. //
  781. //
  782. //
  783. //
  784. //
  785. //
  786. //
  787. //
  788. //
  789. //
  790. /* harmony default export */ var mainvue_type_script_lang_js_ = ({
  791. name: 'ElTransfer',
  792. mixins: [emitter_default.a, locale_default.a, migrating_default.a],
  793. components: {
  794. TransferPanel: transfer_panel,
  795. ElButton: button_default.a
  796. },
  797. props: {
  798. data: {
  799. type: Array,
  800. default: function _default() {
  801. return [];
  802. }
  803. },
  804. titles: {
  805. type: Array,
  806. default: function _default() {
  807. return [];
  808. }
  809. },
  810. buttonTexts: {
  811. type: Array,
  812. default: function _default() {
  813. return [];
  814. }
  815. },
  816. filterPlaceholder: {
  817. type: String,
  818. default: ''
  819. },
  820. filterMethod: Function,
  821. leftDefaultChecked: {
  822. type: Array,
  823. default: function _default() {
  824. return [];
  825. }
  826. },
  827. rightDefaultChecked: {
  828. type: Array,
  829. default: function _default() {
  830. return [];
  831. }
  832. },
  833. renderContent: Function,
  834. value: {
  835. type: Array,
  836. default: function _default() {
  837. return [];
  838. }
  839. },
  840. format: {
  841. type: Object,
  842. default: function _default() {
  843. return {};
  844. }
  845. },
  846. filterable: Boolean,
  847. props: {
  848. type: Object,
  849. default: function _default() {
  850. return {
  851. label: 'label',
  852. key: 'key',
  853. disabled: 'disabled'
  854. };
  855. }
  856. },
  857. targetOrder: {
  858. type: String,
  859. default: 'original'
  860. }
  861. },
  862. data: function data() {
  863. return {
  864. leftChecked: [],
  865. rightChecked: []
  866. };
  867. },
  868. computed: {
  869. dataObj: function dataObj() {
  870. var key = this.props.key;
  871. return this.data.reduce(function (o, cur) {
  872. return (o[cur[key]] = cur) && o;
  873. }, {});
  874. },
  875. sourceData: function sourceData() {
  876. var _this = this;
  877. return this.data.filter(function (item) {
  878. return _this.value.indexOf(item[_this.props.key]) === -1;
  879. });
  880. },
  881. targetData: function targetData() {
  882. var _this2 = this;
  883. if (this.targetOrder === 'original') {
  884. return this.data.filter(function (item) {
  885. return _this2.value.indexOf(item[_this2.props.key]) > -1;
  886. });
  887. } else {
  888. return this.value.reduce(function (arr, cur) {
  889. var val = _this2.dataObj[cur];
  890. if (val) {
  891. arr.push(val);
  892. }
  893. return arr;
  894. }, []);
  895. }
  896. },
  897. hasButtonTexts: function hasButtonTexts() {
  898. return this.buttonTexts.length === 2;
  899. }
  900. },
  901. watch: {
  902. value: function value(val) {
  903. this.dispatch('ElFormItem', 'el.form.change', val);
  904. }
  905. },
  906. methods: {
  907. getMigratingConfig: function getMigratingConfig() {
  908. return {
  909. props: {
  910. 'footer-format': 'footer-format is renamed to format.'
  911. }
  912. };
  913. },
  914. onSourceCheckedChange: function onSourceCheckedChange(val, movedKeys) {
  915. this.leftChecked = val;
  916. if (movedKeys === undefined) return;
  917. this.$emit('left-check-change', val, movedKeys);
  918. },
  919. onTargetCheckedChange: function onTargetCheckedChange(val, movedKeys) {
  920. this.rightChecked = val;
  921. if (movedKeys === undefined) return;
  922. this.$emit('right-check-change', val, movedKeys);
  923. },
  924. addToLeft: function addToLeft() {
  925. var currentValue = this.value.slice();
  926. this.rightChecked.forEach(function (item) {
  927. var index = currentValue.indexOf(item);
  928. if (index > -1) {
  929. currentValue.splice(index, 1);
  930. }
  931. });
  932. this.$emit('input', currentValue);
  933. this.$emit('change', currentValue, 'left', this.rightChecked);
  934. },
  935. addToRight: function addToRight() {
  936. var _this3 = this;
  937. var currentValue = this.value.slice();
  938. var itemsToBeMoved = [];
  939. var key = this.props.key;
  940. this.data.forEach(function (item) {
  941. var itemKey = item[key];
  942. if (_this3.leftChecked.indexOf(itemKey) > -1 && _this3.value.indexOf(itemKey) === -1) {
  943. itemsToBeMoved.push(itemKey);
  944. }
  945. });
  946. currentValue = this.targetOrder === 'unshift' ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  947. this.$emit('input', currentValue);
  948. this.$emit('change', currentValue, 'right', this.leftChecked);
  949. },
  950. clearQuery: function clearQuery(which) {
  951. if (which === 'left') {
  952. this.$refs.leftPanel.query = '';
  953. } else if (which === 'right') {
  954. this.$refs.rightPanel.query = '';
  955. }
  956. }
  957. }
  958. });
  959. // CONCATENATED MODULE: ./packages/transfer/src/main.vue?vue&type=script&lang=js&
  960. /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
  961. // CONCATENATED MODULE: ./packages/transfer/src/main.vue
  962. /* normalize component */
  963. var main_component = Object(componentNormalizer["a" /* default */])(
  964. src_mainvue_type_script_lang_js_,
  965. render,
  966. staticRenderFns,
  967. false,
  968. null,
  969. null,
  970. null
  971. )
  972. /* hot reload */
  973. if (false) { var main_api; }
  974. main_component.options.__file = "packages/transfer/src/main.vue"
  975. /* harmony default export */ var main = (main_component.exports);
  976. // CONCATENATED MODULE: ./packages/transfer/index.js
  977. /* istanbul ignore next */
  978. main.install = function (Vue) {
  979. Vue.component(main.name, main);
  980. };
  981. /* harmony default export */ var transfer = __webpack_exports__["default"] = (main);
  982. /***/ }),
  983. /***/ 7:
  984. /***/ (function(module, exports) {
  985. module.exports = require("element-ui/lib/mixins/locale");
  986. /***/ }),
  987. /***/ 9:
  988. /***/ (function(module, exports) {
  989. module.exports = require("element-ui/lib/input");
  990. /***/ })
  991. /******/ });