app模板、应用模板、组件模板、widget模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2592 lines
71 KiB

4 years ago
  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 = 152);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 103:
  94. /***/ (function(module, exports) {
  95. module.exports = require("tis-ui/lib/utils/aria-utils");
  96. /***/ }),
  97. /***/ 121:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. // ESM COMPAT FLAG
  101. __webpack_require__.r(__webpack_exports__);
  102. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/radio/src/radio.vue?vue&type=template&id=69cd6268&
  103. var render = function() {
  104. var _vm = this
  105. var _h = _vm.$createElement
  106. var _c = _vm._self._c || _h
  107. return _c(
  108. "label",
  109. {
  110. staticClass: "el-radio",
  111. class: [
  112. _vm.border && _vm.radioSize ? "el-radio--" + _vm.radioSize : "",
  113. { "is-disabled": _vm.isDisabled },
  114. { "is-focus": _vm.focus },
  115. { "is-bordered": _vm.border },
  116. { "is-checked": _vm.model === _vm.label }
  117. ],
  118. attrs: {
  119. role: "radio",
  120. "aria-checked": _vm.model === _vm.label,
  121. "aria-disabled": _vm.isDisabled,
  122. tabindex: _vm.tabIndex
  123. },
  124. on: {
  125. keydown: function($event) {
  126. if (
  127. !("button" in $event) &&
  128. _vm._k($event.keyCode, "space", 32, $event.key, [" ", "Spacebar"])
  129. ) {
  130. return null
  131. }
  132. $event.stopPropagation()
  133. $event.preventDefault()
  134. _vm.model = _vm.isDisabled ? _vm.model : _vm.label
  135. }
  136. }
  137. },
  138. [
  139. _c(
  140. "span",
  141. {
  142. staticClass: "el-radio__input",
  143. class: {
  144. "is-disabled": _vm.isDisabled,
  145. "is-checked": _vm.model === _vm.label
  146. }
  147. },
  148. [
  149. _c("span", { staticClass: "el-radio__inner" }),
  150. _c("input", {
  151. directives: [
  152. {
  153. name: "model",
  154. rawName: "v-model",
  155. value: _vm.model,
  156. expression: "model"
  157. }
  158. ],
  159. ref: "radio",
  160. staticClass: "el-radio__original",
  161. attrs: {
  162. type: "radio",
  163. "aria-hidden": "true",
  164. name: _vm.name,
  165. disabled: _vm.isDisabled,
  166. tabindex: "-1"
  167. },
  168. domProps: {
  169. value: _vm.label,
  170. checked: _vm._q(_vm.model, _vm.label)
  171. },
  172. on: {
  173. focus: function($event) {
  174. _vm.focus = true
  175. },
  176. blur: function($event) {
  177. _vm.focus = false
  178. },
  179. change: [
  180. function($event) {
  181. _vm.model = _vm.label
  182. },
  183. _vm.handleChange
  184. ]
  185. }
  186. })
  187. ]
  188. ),
  189. _c(
  190. "span",
  191. {
  192. staticClass: "el-radio__label",
  193. on: {
  194. keydown: function($event) {
  195. $event.stopPropagation()
  196. }
  197. }
  198. },
  199. [
  200. _vm._t("default"),
  201. !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
  202. ],
  203. 2
  204. )
  205. ]
  206. )
  207. }
  208. var staticRenderFns = []
  209. render._withStripped = true
  210. // CONCATENATED MODULE: ./packages/radio/src/radio.vue?vue&type=template&id=69cd6268&
  211. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  212. var emitter_ = __webpack_require__(13);
  213. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  214. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/radio/src/radio.vue?vue&type=script&lang=js&
  215. //
  216. //
  217. //
  218. //
  219. //
  220. //
  221. //
  222. //
  223. //
  224. //
  225. //
  226. //
  227. //
  228. //
  229. //
  230. //
  231. //
  232. //
  233. //
  234. //
  235. //
  236. //
  237. //
  238. //
  239. //
  240. //
  241. //
  242. //
  243. //
  244. //
  245. //
  246. //
  247. //
  248. //
  249. //
  250. //
  251. //
  252. //
  253. //
  254. //
  255. //
  256. //
  257. //
  258. //
  259. /* harmony default export */ var radiovue_type_script_lang_js_ = ({
  260. name: 'TisRadio',
  261. mixins: [emitter_default.a],
  262. inject: {
  263. elForm: {
  264. default: ''
  265. },
  266. elFormItem: {
  267. default: ''
  268. }
  269. },
  270. componentName: 'TisRadio',
  271. props: {
  272. value: {},
  273. label: {},
  274. disabled: Boolean,
  275. name: String,
  276. border: Boolean,
  277. size: String
  278. },
  279. data: function data() {
  280. return {
  281. focus: false
  282. };
  283. },
  284. computed: {
  285. isGroup: function isGroup() {
  286. var parent = this.$parent;
  287. while (parent) {
  288. if (parent.$options.componentName !== 'TisRadioGroup') {
  289. parent = parent.$parent;
  290. } else {
  291. this._radioGroup = parent;
  292. return true;
  293. }
  294. }
  295. return false;
  296. },
  297. model: {
  298. get: function get() {
  299. return this.isGroup ? this._radioGroup.value : this.value;
  300. },
  301. set: function set(val) {
  302. if (this.isGroup) {
  303. this.dispatch('TisRadioGroup', 'input', [val]);
  304. } else {
  305. this.$emit('input', val);
  306. }
  307. this.$refs.radio && (this.$refs.radio.checked = this.model === this.label);
  308. }
  309. },
  310. _elFormItemSize: function _elFormItemSize() {
  311. return (this.elFormItem || {}).elFormItemSize;
  312. },
  313. radioSize: function radioSize() {
  314. var temRadioSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  315. return this.isGroup ? this._radioGroup.radioGroupSize || temRadioSize : temRadioSize;
  316. },
  317. isDisabled: function isDisabled() {
  318. return this.isGroup ? this._radioGroup.disabled || this.disabled || (this.elForm || {}).disabled : this.disabled || (this.elForm || {}).disabled;
  319. },
  320. tabIndex: function tabIndex() {
  321. return this.isDisabled || this.isGroup && this.model !== this.label ? -1 : 0;
  322. }
  323. },
  324. methods: {
  325. handleChange: function handleChange() {
  326. var _this = this;
  327. this.$nextTick(function () {
  328. _this.$emit('change', _this.model);
  329. _this.isGroup && _this.dispatch('TisRadioGroup', 'handleChange', _this.model);
  330. });
  331. }
  332. }
  333. });
  334. // CONCATENATED MODULE: ./packages/radio/src/radio.vue?vue&type=script&lang=js&
  335. /* harmony default export */ var src_radiovue_type_script_lang_js_ = (radiovue_type_script_lang_js_);
  336. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  337. var componentNormalizer = __webpack_require__(2);
  338. // CONCATENATED MODULE: ./packages/radio/src/radio.vue
  339. /* normalize component */
  340. var component = Object(componentNormalizer["a" /* default */])(
  341. src_radiovue_type_script_lang_js_,
  342. render,
  343. staticRenderFns,
  344. false,
  345. null,
  346. null,
  347. null
  348. )
  349. /* hot reload */
  350. if (false) { var api; }
  351. component.options.__file = "packages/radio/src/radio.vue"
  352. /* harmony default export */ var src_radio = (component.exports);
  353. // CONCATENATED MODULE: ./packages/radio/index.js
  354. /* istanbul ignore next */
  355. src_radio.install = function (Vue) {
  356. Vue.component(src_radio.name, src_radio);
  357. };
  358. /* harmony default export */ var packages_radio = __webpack_exports__["default"] = (src_radio);
  359. /***/ }),
  360. /***/ 13:
  361. /***/ (function(module, exports) {
  362. module.exports = require("tis-ui/lib/mixins/emitter");
  363. /***/ }),
  364. /***/ 152:
  365. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  366. "use strict";
  367. // ESM COMPAT FLAG
  368. __webpack_require__.r(__webpack_exports__);
  369. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader-panel/src/cascader-panel.vue?vue&type=template&id=34932346&
  370. var cascader_panelvue_type_template_id_34932346_render = function() {
  371. var _vm = this
  372. var _h = _vm.$createElement
  373. var _c = _vm._self._c || _h
  374. return _c(
  375. "div",
  376. {
  377. class: ["el-cascader-panel", _vm.border && "is-bordered"],
  378. on: { keydown: _vm.handleKeyDown }
  379. },
  380. _vm._l(_vm.menus, function(menu, index) {
  381. return _c("cascader-menu", {
  382. key: index,
  383. ref: "menu",
  384. refInFor: true,
  385. attrs: { index: index, nodes: menu }
  386. })
  387. }),
  388. 1
  389. )
  390. }
  391. var staticRenderFns = []
  392. cascader_panelvue_type_template_id_34932346_render._withStripped = true
  393. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-panel.vue?vue&type=template&id=34932346&
  394. // EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
  395. var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(90);
  396. var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
  397. // EXTERNAL MODULE: ./packages/scrollbar/index.js + 3 modules
  398. var scrollbar = __webpack_require__(66);
  399. // EXTERNAL MODULE: ./packages/checkbox/index.js + 5 modules
  400. var packages_checkbox = __webpack_require__(68);
  401. // EXTERNAL MODULE: ./packages/radio/index.js + 5 modules
  402. var packages_radio = __webpack_require__(121);
  403. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  404. var util_ = __webpack_require__(10);
  405. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader-panel/src/cascader-node.vue?vue&type=script&lang=js&
  406. var stopPropagation = function stopPropagation(e) {
  407. return e.stopPropagation();
  408. };
  409. /* harmony default export */ var cascader_nodevue_type_script_lang_js_ = ({
  410. inject: ['panel'],
  411. components: {
  412. ElCheckbox: packages_checkbox["default"],
  413. ElRadio: packages_radio["default"]
  414. },
  415. props: {
  416. node: {
  417. required: true
  418. },
  419. nodeId: String
  420. },
  421. computed: {
  422. config: function config() {
  423. return this.panel.config;
  424. },
  425. isLeaf: function isLeaf() {
  426. return this.node.isLeaf;
  427. },
  428. isDisabled: function isDisabled() {
  429. return this.node.isDisabled;
  430. },
  431. checkedValue: function checkedValue() {
  432. return this.panel.checkedValue;
  433. },
  434. isChecked: function isChecked() {
  435. return this.node.isSameNode(this.checkedValue);
  436. },
  437. inActivePath: function inActivePath() {
  438. return this.isInPath(this.panel.activePath);
  439. },
  440. inCheckedPath: function inCheckedPath() {
  441. var _this = this;
  442. if (!this.config.checkStrictly) return false;
  443. return this.panel.checkedNodePaths.some(function (checkedPath) {
  444. return _this.isInPath(checkedPath);
  445. });
  446. },
  447. value: function value() {
  448. return this.node.getValueByOption();
  449. }
  450. },
  451. methods: {
  452. handleExpand: function handleExpand() {
  453. var _this2 = this;
  454. var panel = this.panel,
  455. node = this.node,
  456. isDisabled = this.isDisabled,
  457. config = this.config;
  458. var multiple = config.multiple,
  459. checkStrictly = config.checkStrictly;
  460. if (!checkStrictly && isDisabled || node.loading) return;
  461. if (config.lazy && !node.loaded) {
  462. panel.lazyLoad(node, function () {
  463. // do not use cached leaf value here, invoke this.isLeaf to get new value.
  464. var isLeaf = _this2.isLeaf;
  465. if (!isLeaf) _this2.handleExpand();
  466. if (multiple) {
  467. // if leaf sync checked state, else clear checked state
  468. var checked = isLeaf ? node.checked : false;
  469. _this2.handleMultiCheckChange(checked);
  470. }
  471. });
  472. } else {
  473. panel.handleExpand(node);
  474. }
  475. },
  476. handleCheckChange: function handleCheckChange() {
  477. var panel = this.panel,
  478. value = this.value,
  479. node = this.node;
  480. panel.handleCheckChange(value);
  481. panel.handleExpand(node);
  482. },
  483. handleMultiCheckChange: function handleMultiCheckChange(checked) {
  484. this.node.doCheck(checked);
  485. this.panel.calculateMultiCheckedValue();
  486. },
  487. isInPath: function isInPath(pathNodes) {
  488. var node = this.node;
  489. var selectedPathNode = pathNodes[node.level - 1] || {};
  490. return selectedPathNode.uid === node.uid;
  491. },
  492. renderPrefix: function renderPrefix(h) {
  493. var isLeaf = this.isLeaf,
  494. isChecked = this.isChecked,
  495. config = this.config;
  496. var checkStrictly = config.checkStrictly,
  497. multiple = config.multiple;
  498. if (multiple) {
  499. return this.renderCheckbox(h);
  500. } else if (checkStrictly) {
  501. return this.renderRadio(h);
  502. } else if (isLeaf && isChecked) {
  503. return this.renderCheckIcon(h);
  504. }
  505. return null;
  506. },
  507. renderPostfix: function renderPostfix(h) {
  508. var node = this.node,
  509. isLeaf = this.isLeaf;
  510. if (node.loading) {
  511. return this.renderLoadingIcon(h);
  512. } else if (!isLeaf) {
  513. return this.renderExpandIcon(h);
  514. }
  515. return null;
  516. },
  517. renderCheckbox: function renderCheckbox(h) {
  518. var node = this.node,
  519. config = this.config,
  520. isDisabled = this.isDisabled;
  521. var events = {
  522. on: { change: this.handleMultiCheckChange },
  523. nativeOn: {}
  524. };
  525. if (config.checkStrictly) {
  526. // when every node is selectable, click event should not trigger expand event.
  527. events.nativeOn.click = stopPropagation;
  528. }
  529. return h('tis-checkbox', external_babel_helper_vue_jsx_merge_props_default()([{
  530. attrs: {
  531. value: node.checked,
  532. indeterminate: node.indeterminate,
  533. disabled: isDisabled
  534. }
  535. }, events]));
  536. },
  537. renderRadio: function renderRadio(h) {
  538. var checkedValue = this.checkedValue,
  539. value = this.value,
  540. isDisabled = this.isDisabled;
  541. // to keep same reference if value cause radio's checked state is calculated by reference comparision;
  542. if (Object(util_["isEqual"])(value, checkedValue)) {
  543. value = checkedValue;
  544. }
  545. return h(
  546. 'tis-radio',
  547. {
  548. attrs: {
  549. value: checkedValue,
  550. label: value,
  551. disabled: isDisabled
  552. },
  553. on: {
  554. 'change': this.handleCheckChange
  555. },
  556. nativeOn: {
  557. 'click': stopPropagation
  558. }
  559. },
  560. [h('span')]
  561. );
  562. },
  563. renderCheckIcon: function renderCheckIcon(h) {
  564. return h('i', { 'class': 'el-icon-check el-cascader-node__prefix' });
  565. },
  566. renderLoadingIcon: function renderLoadingIcon(h) {
  567. return h('i', { 'class': 'el-icon-loading el-cascader-node__postfix' });
  568. },
  569. renderExpandIcon: function renderExpandIcon(h) {
  570. return h('i', { 'class': 'el-icon-arrow-right el-cascader-node__postfix' });
  571. },
  572. renderContent: function renderContent(h) {
  573. var panel = this.panel,
  574. node = this.node;
  575. var render = panel.renderLabelFn;
  576. var vnode = render ? render({ node: node, data: node.data }) : null;
  577. return h(
  578. 'span',
  579. { 'class': 'el-cascader-node__label' },
  580. [vnode || node.label]
  581. );
  582. }
  583. },
  584. render: function render(h) {
  585. var _this3 = this;
  586. var inActivePath = this.inActivePath,
  587. inCheckedPath = this.inCheckedPath,
  588. isChecked = this.isChecked,
  589. isLeaf = this.isLeaf,
  590. isDisabled = this.isDisabled,
  591. config = this.config,
  592. nodeId = this.nodeId;
  593. var expandTrigger = config.expandTrigger,
  594. checkStrictly = config.checkStrictly,
  595. multiple = config.multiple;
  596. var disabled = !checkStrictly && isDisabled;
  597. var events = { on: {} };
  598. if (expandTrigger === 'click') {
  599. events.on.click = this.handleExpand;
  600. } else {
  601. events.on.mouseenter = function (e) {
  602. _this3.handleExpand();
  603. _this3.$emit('expand', e);
  604. };
  605. events.on.focus = function (e) {
  606. _this3.handleExpand();
  607. _this3.$emit('expand', e);
  608. };
  609. }
  610. if (isLeaf && !isDisabled && !checkStrictly && !multiple) {
  611. events.on.click = this.handleCheckChange;
  612. }
  613. return h(
  614. 'li',
  615. external_babel_helper_vue_jsx_merge_props_default()([{
  616. attrs: {
  617. role: 'menuitem',
  618. id: nodeId,
  619. 'aria-expanded': inActivePath,
  620. tabindex: disabled ? null : -1
  621. },
  622. 'class': {
  623. 'el-cascader-node': true,
  624. 'is-selectable': checkStrictly,
  625. 'in-active-path': inActivePath,
  626. 'in-checked-path': inCheckedPath,
  627. 'is-active': isChecked,
  628. 'is-disabled': disabled
  629. }
  630. }, events]),
  631. [this.renderPrefix(h), this.renderContent(h), this.renderPostfix(h)]
  632. );
  633. }
  634. });
  635. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-node.vue?vue&type=script&lang=js&
  636. /* harmony default export */ var src_cascader_nodevue_type_script_lang_js_ = (cascader_nodevue_type_script_lang_js_);
  637. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  638. var componentNormalizer = __webpack_require__(2);
  639. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-node.vue
  640. var cascader_node_render, cascader_node_staticRenderFns
  641. /* normalize component */
  642. var component = Object(componentNormalizer["a" /* default */])(
  643. src_cascader_nodevue_type_script_lang_js_,
  644. cascader_node_render,
  645. cascader_node_staticRenderFns,
  646. false,
  647. null,
  648. null,
  649. null
  650. )
  651. /* hot reload */
  652. if (false) { var api; }
  653. component.options.__file = "packages/cascader-panel/src/cascader-node.vue"
  654. /* harmony default export */ var cascader_node = (component.exports);
  655. // EXTERNAL MODULE: external "tis-ui/lib/mixins/locale"
  656. var locale_ = __webpack_require__(38);
  657. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  658. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader-panel/src/cascader-menu.vue?vue&type=script&lang=js&
  659. /* harmony default export */ var cascader_menuvue_type_script_lang_js_ = ({
  660. name: 'TisCascaderMenu',
  661. mixins: [locale_default.a],
  662. inject: ['panel'],
  663. components: {
  664. ElScrollbar: scrollbar["default"],
  665. CascaderNode: cascader_node
  666. },
  667. props: {
  668. nodes: {
  669. type: Array,
  670. required: true
  671. },
  672. index: Number
  673. },
  674. data: function data() {
  675. return {
  676. activeNode: null,
  677. hoverTimer: null,
  678. id: Object(util_["generateId"])()
  679. };
  680. },
  681. computed: {
  682. isEmpty: function isEmpty() {
  683. return !this.nodes.length;
  684. },
  685. menuId: function menuId() {
  686. return 'cascader-menu-' + this.id + '-' + this.index;
  687. }
  688. },
  689. methods: {
  690. handleExpand: function handleExpand(e) {
  691. this.activeNode = e.target;
  692. },
  693. handleMouseMove: function handleMouseMove(e) {
  694. var activeNode = this.activeNode,
  695. hoverTimer = this.hoverTimer;
  696. var hoverZone = this.$refs.hoverZone;
  697. if (!activeNode || !hoverZone) return;
  698. if (activeNode.contains(e.target)) {
  699. clearTimeout(hoverTimer);
  700. var _$el$getBoundingClien = this.$el.getBoundingClientRect(),
  701. left = _$el$getBoundingClien.left;
  702. var startX = e.clientX - left;
  703. var _$el = this.$el,
  704. offsetWidth = _$el.offsetWidth,
  705. offsetHeight = _$el.offsetHeight;
  706. var top = activeNode.offsetTop;
  707. var bottom = top + activeNode.offsetHeight;
  708. hoverZone.innerHTML = '\n <path style="pointer-events: auto;" fill="transparent" d="M' + startX + ' ' + top + ' L' + offsetWidth + ' 0 V' + top + ' Z" />\n <path style="pointer-events: auto;" fill="transparent" d="M' + startX + ' ' + bottom + ' L' + offsetWidth + ' ' + offsetHeight + ' V' + bottom + ' Z" />\n ';
  709. } else if (!hoverTimer) {
  710. this.hoverTimer = setTimeout(this.clearHoverZone, this.panel.config.hoverThreshold);
  711. }
  712. },
  713. clearHoverZone: function clearHoverZone() {
  714. var hoverZone = this.$refs.hoverZone;
  715. if (!hoverZone) return;
  716. hoverZone.innerHTML = '';
  717. },
  718. renderEmptyText: function renderEmptyText(h) {
  719. return h(
  720. 'div',
  721. { 'class': 'el-cascader-menu__empty-text' },
  722. [this.t('el.cascader.noData')]
  723. );
  724. },
  725. renderNodeList: function renderNodeList(h) {
  726. var menuId = this.menuId;
  727. var isHoverMenu = this.panel.isHoverMenu;
  728. var events = { on: {} };
  729. if (isHoverMenu) {
  730. events.on.expand = this.handleExpand;
  731. }
  732. var nodes = this.nodes.map(function (node, index) {
  733. var hasChildren = node.hasChildren;
  734. return h('cascader-node', external_babel_helper_vue_jsx_merge_props_default()([{
  735. key: node.uid,
  736. attrs: { node: node,
  737. 'node-id': menuId + '-' + index,
  738. 'aria-haspopup': hasChildren,
  739. 'aria-owns': hasChildren ? menuId : null
  740. }
  741. }, events]));
  742. });
  743. return [].concat(nodes, [isHoverMenu ? h('svg', { ref: 'hoverZone', 'class': 'el-cascader-menu__hover-zone' }) : null]);
  744. }
  745. },
  746. render: function render(h) {
  747. var isEmpty = this.isEmpty,
  748. menuId = this.menuId;
  749. var events = { nativeOn: {} };
  750. // optimize hover to expand experience (#8010)
  751. if (this.panel.isHoverMenu) {
  752. events.nativeOn.mousemove = this.handleMouseMove;
  753. // events.nativeOn.mouseleave = this.clearHoverZone;
  754. }
  755. return h(
  756. 'tis-scrollbar',
  757. external_babel_helper_vue_jsx_merge_props_default()([{
  758. attrs: {
  759. tag: 'ul',
  760. role: 'menu',
  761. id: menuId,
  762. 'wrap-class': 'el-cascader-menu__wrap',
  763. 'view-class': {
  764. 'el-cascader-menu__list': true,
  765. 'is-empty': isEmpty
  766. }
  767. },
  768. 'class': 'el-cascader-menu' }, events]),
  769. [isEmpty ? this.renderEmptyText(h) : this.renderNodeList(h)]
  770. );
  771. }
  772. });
  773. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-menu.vue?vue&type=script&lang=js&
  774. /* harmony default export */ var src_cascader_menuvue_type_script_lang_js_ = (cascader_menuvue_type_script_lang_js_);
  775. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-menu.vue
  776. var cascader_menu_render, cascader_menu_staticRenderFns
  777. /* normalize component */
  778. var cascader_menu_component = Object(componentNormalizer["a" /* default */])(
  779. src_cascader_menuvue_type_script_lang_js_,
  780. cascader_menu_render,
  781. cascader_menu_staticRenderFns,
  782. false,
  783. null,
  784. null,
  785. null
  786. )
  787. /* hot reload */
  788. if (false) { var cascader_menu_api; }
  789. cascader_menu_component.options.__file = "packages/cascader-panel/src/cascader-menu.vue"
  790. /* harmony default export */ var cascader_menu = (cascader_menu_component.exports);
  791. // EXTERNAL MODULE: external "tis-ui/lib/utils/shared"
  792. var shared_ = __webpack_require__(49);
  793. // CONCATENATED MODULE: ./packages/cascader-panel/src/node.js
  794. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  796. var uid = 0;
  797. var node_Node = function () {
  798. function Node(data, config, parentNode) {
  799. _classCallCheck(this, Node);
  800. this.data = data;
  801. this.config = config;
  802. this.parent = parentNode || null;
  803. this.level = !this.parent ? 1 : this.parent.level + 1;
  804. this.uid = uid++;
  805. this.initState();
  806. this.initChildren();
  807. }
  808. Node.prototype.initState = function initState() {
  809. var _config = this.config,
  810. valueKey = _config.value,
  811. labelKey = _config.label;
  812. this.value = this.data[valueKey];
  813. this.label = this.data[labelKey];
  814. this.pathNodes = this.calculatePathNodes();
  815. this.path = this.pathNodes.map(function (node) {
  816. return node.value;
  817. });
  818. this.pathLabels = this.pathNodes.map(function (node) {
  819. return node.label;
  820. });
  821. // lazy load
  822. this.loading = false;
  823. this.loaded = false;
  824. };
  825. Node.prototype.initChildren = function initChildren() {
  826. var _this = this;
  827. var config = this.config;
  828. var childrenKey = config.children;
  829. var childrenData = this.data[childrenKey];
  830. this.hasChildren = Array.isArray(childrenData);
  831. this.children = (childrenData || []).map(function (child) {
  832. return new Node(child, config, _this);
  833. });
  834. };
  835. Node.prototype.calculatePathNodes = function calculatePathNodes() {
  836. var nodes = [this];
  837. var parent = this.parent;
  838. while (parent) {
  839. nodes.unshift(parent);
  840. parent = parent.parent;
  841. }
  842. return nodes;
  843. };
  844. Node.prototype.getPath = function getPath() {
  845. return this.path;
  846. };
  847. Node.prototype.getValue = function getValue() {
  848. return this.value;
  849. };
  850. Node.prototype.getValueByOption = function getValueByOption() {
  851. return this.config.emitPath ? this.getPath() : this.getValue();
  852. };
  853. Node.prototype.getText = function getText(allLevels, separator) {
  854. return allLevels ? this.pathLabels.join(separator) : this.label;
  855. };
  856. Node.prototype.isSameNode = function isSameNode(checkedValue) {
  857. var value = this.getValueByOption();
  858. return this.config.multiple && Array.isArray(checkedValue) ? checkedValue.some(function (val) {
  859. return Object(util_["isEqual"])(val, value);
  860. }) : Object(util_["isEqual"])(checkedValue, value);
  861. };
  862. Node.prototype.broadcast = function broadcast(event) {
  863. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  864. args[_key - 1] = arguments[_key];
  865. }
  866. var handlerName = 'onParent' + Object(util_["capitalize"])(event);
  867. this.children.forEach(function (child) {
  868. if (child) {
  869. // bottom up
  870. child.broadcast.apply(child, [event].concat(args));
  871. child[handlerName] && child[handlerName].apply(child, args);
  872. }
  873. });
  874. };
  875. Node.prototype.emit = function emit(event) {
  876. var parent = this.parent;
  877. var handlerName = 'onChild' + Object(util_["capitalize"])(event);
  878. if (parent) {
  879. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  880. args[_key2 - 1] = arguments[_key2];
  881. }
  882. parent[handlerName] && parent[handlerName].apply(parent, args);
  883. parent.emit.apply(parent, [event].concat(args));
  884. }
  885. };
  886. Node.prototype.onParentCheck = function onParentCheck(checked) {
  887. if (!this.isDisabled) {
  888. this.setCheckState(checked);
  889. }
  890. };
  891. Node.prototype.onChildCheck = function onChildCheck() {
  892. var children = this.children;
  893. var validChildren = children.filter(function (child) {
  894. return !child.isDisabled;
  895. });
  896. var checked = validChildren.length ? validChildren.every(function (child) {
  897. return child.checked;
  898. }) : false;
  899. this.setCheckState(checked);
  900. };
  901. Node.prototype.setCheckState = function setCheckState(checked) {
  902. var totalNum = this.children.length;
  903. var checkedNum = this.children.reduce(function (c, p) {
  904. var num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  905. return c + num;
  906. }, 0);
  907. this.checked = checked;
  908. this.indeterminate = checkedNum !== totalNum && checkedNum > 0;
  909. };
  910. Node.prototype.syncCheckState = function syncCheckState(checkedValue) {
  911. var value = this.getValueByOption();
  912. var checked = this.isSameNode(checkedValue, value);
  913. this.doCheck(checked);
  914. };
  915. Node.prototype.doCheck = function doCheck(checked) {
  916. if (this.checked !== checked) {
  917. if (this.config.checkStrictly) {
  918. this.checked = checked;
  919. } else {
  920. // bottom up to unify the calculation of the indeterminate state
  921. this.broadcast('check', checked);
  922. this.setCheckState(checked);
  923. this.emit('check');
  924. }
  925. }
  926. };
  927. _createClass(Node, [{
  928. key: 'isDisabled',
  929. get: function get() {
  930. var data = this.data,
  931. parent = this.parent,
  932. config = this.config;
  933. var disabledKey = config.disabled;
  934. var checkStrictly = config.checkStrictly;
  935. return data[disabledKey] || !checkStrictly && parent && parent.isDisabled;
  936. }
  937. }, {
  938. key: 'isLeaf',
  939. get: function get() {
  940. var data = this.data,
  941. loaded = this.loaded,
  942. hasChildren = this.hasChildren,
  943. children = this.children;
  944. var _config2 = this.config,
  945. lazy = _config2.lazy,
  946. leafKey = _config2.leaf;
  947. if (lazy) {
  948. var isLeaf = Object(shared_["isDef"])(data[leafKey]) ? data[leafKey] : loaded ? !children.length : false;
  949. this.hasChildren = !isLeaf;
  950. return isLeaf;
  951. }
  952. return !hasChildren;
  953. }
  954. }]);
  955. return Node;
  956. }();
  957. /* harmony default export */ var src_node = (node_Node);
  958. // CONCATENATED MODULE: ./packages/cascader-panel/src/store.js
  959. function store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  960. var flatNodes = function flatNodes(data, leafOnly) {
  961. return data.reduce(function (res, node) {
  962. if (node.isLeaf) {
  963. res.push(node);
  964. } else {
  965. !leafOnly && res.push(node);
  966. res = res.concat(flatNodes(node.children, leafOnly));
  967. }
  968. return res;
  969. }, []);
  970. };
  971. var store_Store = function () {
  972. function Store(data, config) {
  973. store_classCallCheck(this, Store);
  974. this.config = config;
  975. this.initNodes(data);
  976. }
  977. Store.prototype.initNodes = function initNodes(data) {
  978. var _this = this;
  979. data = Object(util_["coerceTruthyValueToArray"])(data);
  980. this.nodes = data.map(function (nodeData) {
  981. return new src_node(nodeData, _this.config);
  982. });
  983. this.flattedNodes = this.getFlattedNodes(false, false);
  984. this.leafNodes = this.getFlattedNodes(true, false);
  985. };
  986. Store.prototype.appendNode = function appendNode(nodeData, parentNode) {
  987. var node = new src_node(nodeData, this.config, parentNode);
  988. var children = parentNode ? parentNode.children : this.nodes;
  989. children.push(node);
  990. };
  991. Store.prototype.appendNodes = function appendNodes(nodeDataList, parentNode) {
  992. var _this2 = this;
  993. nodeDataList = Object(util_["coerceTruthyValueToArray"])(nodeDataList);
  994. nodeDataList.forEach(function (nodeData) {
  995. return _this2.appendNode(nodeData, parentNode);
  996. });
  997. };
  998. Store.prototype.getNodes = function getNodes() {
  999. return this.nodes;
  1000. };
  1001. Store.prototype.getFlattedNodes = function getFlattedNodes(leafOnly) {
  1002. var cached = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1003. var cachedNodes = leafOnly ? this.leafNodes : this.flattedNodes;
  1004. return cached ? cachedNodes : flatNodes(this.nodes, leafOnly);
  1005. };
  1006. Store.prototype.getNodeByValue = function getNodeByValue(value) {
  1007. if (value) {
  1008. var nodes = this.getFlattedNodes(false, !this.config.lazy).filter(function (node) {
  1009. return Object(util_["valueEquals"])(node.path, value) || node.value === value;
  1010. });
  1011. return nodes && nodes.length ? nodes[0] : null;
  1012. }
  1013. return null;
  1014. };
  1015. return Store;
  1016. }();
  1017. /* harmony default export */ var src_store = (store_Store);
  1018. // EXTERNAL MODULE: external "tis-ui/lib/utils/merge"
  1019. var merge_ = __webpack_require__(33);
  1020. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  1021. // EXTERNAL MODULE: external "tis-ui/lib/utils/aria-utils"
  1022. var aria_utils_ = __webpack_require__(103);
  1023. var aria_utils_default = /*#__PURE__*/__webpack_require__.n(aria_utils_);
  1024. // EXTERNAL MODULE: external "tis-ui/lib/utils/scroll-into-view"
  1025. var scroll_into_view_ = __webpack_require__(95);
  1026. var scroll_into_view_default = /*#__PURE__*/__webpack_require__.n(scroll_into_view_);
  1027. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader-panel/src/cascader-panel.vue?vue&type=script&lang=js&
  1028. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  1029. //
  1030. //
  1031. //
  1032. //
  1033. //
  1034. //
  1035. //
  1036. //
  1037. //
  1038. //
  1039. //
  1040. //
  1041. //
  1042. //
  1043. //
  1044. //
  1045. var KeyCode = aria_utils_default.a.keys;
  1046. var DefaultProps = {
  1047. expandTrigger: 'click', // or hover
  1048. multiple: false,
  1049. checkStrictly: false, // whether all nodes can be selected
  1050. emitPath: true, // wether to emit an array of all levels value in which node is located
  1051. lazy: false,
  1052. lazyLoad: util_["noop"],
  1053. value: 'value',
  1054. label: 'label',
  1055. children: 'children',
  1056. leaf: 'leaf',
  1057. disabled: 'disabled',
  1058. hoverThreshold: 500
  1059. };
  1060. var cascader_panelvue_type_script_lang_js_isLeaf = function isLeaf(el) {
  1061. return !el.getAttribute('aria-owns');
  1062. };
  1063. var getSibling = function getSibling(el, distance) {
  1064. var parentNode = el.parentNode;
  1065. if (parentNode) {
  1066. var siblings = parentNode.querySelectorAll('.el-cascader-node[tabindex="-1"]');
  1067. var index = Array.prototype.indexOf.call(siblings, el);
  1068. return siblings[index + distance] || null;
  1069. }
  1070. return null;
  1071. };
  1072. var getMenuIndex = function getMenuIndex(el, distance) {
  1073. if (!el) return;
  1074. var pieces = el.id.split('-');
  1075. return Number(pieces[pieces.length - 2]);
  1076. };
  1077. var focusNode = function focusNode(el) {
  1078. if (!el) return;
  1079. el.focus();
  1080. !cascader_panelvue_type_script_lang_js_isLeaf(el) && el.click();
  1081. };
  1082. var checkNode = function checkNode(el) {
  1083. if (!el) return;
  1084. var input = el.querySelector('input');
  1085. if (input) {
  1086. input.click();
  1087. } else if (cascader_panelvue_type_script_lang_js_isLeaf(el)) {
  1088. el.click();
  1089. }
  1090. };
  1091. /* harmony default export */ var cascader_panelvue_type_script_lang_js_ = ({
  1092. name: 'TisCascaderPanel',
  1093. components: {
  1094. CascaderMenu: cascader_menu
  1095. },
  1096. props: {
  1097. value: {},
  1098. options: Array,
  1099. props: Object,
  1100. border: {
  1101. type: Boolean,
  1102. default: true
  1103. },
  1104. renderLabel: Function
  1105. },
  1106. provide: function provide() {
  1107. return {
  1108. panel: this
  1109. };
  1110. },
  1111. data: function data() {
  1112. return {
  1113. checkedValue: null,
  1114. checkedNodePaths: [],
  1115. store: [],
  1116. menus: [],
  1117. activePath: [],
  1118. loadCount: 0
  1119. };
  1120. },
  1121. computed: {
  1122. config: function config() {
  1123. return merge_default()(_extends({}, DefaultProps), this.props || {});
  1124. },
  1125. multiple: function multiple() {
  1126. return this.config.multiple;
  1127. },
  1128. checkStrictly: function checkStrictly() {
  1129. return this.config.checkStrictly;
  1130. },
  1131. leafOnly: function leafOnly() {
  1132. return !this.checkStrictly;
  1133. },
  1134. isHoverMenu: function isHoverMenu() {
  1135. return this.config.expandTrigger === 'hover';
  1136. },
  1137. renderLabelFn: function renderLabelFn() {
  1138. return this.renderLabel || this.$scopedSlots.default;
  1139. }
  1140. },
  1141. watch: {
  1142. options: {
  1143. handler: function handler() {
  1144. this.initStore();
  1145. },
  1146. immediate: true,
  1147. deep: true
  1148. },
  1149. value: function value() {
  1150. this.syncCheckedValue();
  1151. this.checkStrictly && this.calculateCheckedNodePaths();
  1152. },
  1153. checkedValue: function checkedValue(val) {
  1154. if (!Object(util_["isEqual"])(val, this.value)) {
  1155. this.checkStrictly && this.calculateCheckedNodePaths();
  1156. this.$emit('input', val);
  1157. this.$emit('change', val);
  1158. }
  1159. }
  1160. },
  1161. mounted: function mounted() {
  1162. if (!Object(util_["isEmpty"])(this.value)) {
  1163. this.syncCheckedValue();
  1164. }
  1165. },
  1166. methods: {
  1167. initStore: function initStore() {
  1168. var config = this.config,
  1169. options = this.options;
  1170. if (config.lazy && Object(util_["isEmpty"])(options)) {
  1171. this.lazyLoad();
  1172. } else {
  1173. this.store = new src_store(options, config);
  1174. this.menus = [this.store.getNodes()];
  1175. this.syncMenuState();
  1176. }
  1177. },
  1178. syncCheckedValue: function syncCheckedValue() {
  1179. var value = this.value,
  1180. checkedValue = this.checkedValue;
  1181. if (!Object(util_["isEqual"])(value, checkedValue)) {
  1182. this.checkedValue = value;
  1183. this.syncMenuState();
  1184. }
  1185. },
  1186. syncMenuState: function syncMenuState() {
  1187. var multiple = this.multiple,
  1188. checkStrictly = this.checkStrictly;
  1189. this.syncActivePath();
  1190. multiple && this.syncMultiCheckState();
  1191. checkStrictly && this.calculateCheckedNodePaths();
  1192. this.$nextTick(this.scrollIntoView);
  1193. },
  1194. syncMultiCheckState: function syncMultiCheckState() {
  1195. var _this = this;
  1196. var nodes = this.getFlattedNodes(this.leafOnly);
  1197. nodes.forEach(function (node) {
  1198. node.syncCheckState(_this.checkedValue);
  1199. });
  1200. },
  1201. syncActivePath: function syncActivePath() {
  1202. var _this2 = this;
  1203. var store = this.store,
  1204. multiple = this.multiple,
  1205. activePath = this.activePath,
  1206. checkedValue = this.checkedValue;
  1207. if (!Object(util_["isEmpty"])(activePath)) {
  1208. var nodes = activePath.map(function (node) {
  1209. return _this2.getNodeByValue(node.getValue());
  1210. });
  1211. this.expandNodes(nodes);
  1212. } else if (!Object(util_["isEmpty"])(checkedValue)) {
  1213. var value = multiple ? checkedValue[0] : checkedValue;
  1214. var checkedNode = this.getNodeByValue(value) || {};
  1215. var _nodes = (checkedNode.pathNodes || []).slice(0, -1);
  1216. this.expandNodes(_nodes);
  1217. } else {
  1218. this.activePath = [];
  1219. this.menus = [store.getNodes()];
  1220. }
  1221. },
  1222. expandNodes: function expandNodes(nodes) {
  1223. var _this3 = this;
  1224. nodes.forEach(function (node) {
  1225. return _this3.handleExpand(node, true /* silent */);
  1226. });
  1227. },
  1228. calculateCheckedNodePaths: function calculateCheckedNodePaths() {
  1229. var _this4 = this;
  1230. var checkedValue = this.checkedValue,
  1231. multiple = this.multiple;
  1232. var checkedValues = multiple ? Object(util_["coerceTruthyValueToArray"])(checkedValue) : [checkedValue];
  1233. this.checkedNodePaths = checkedValues.map(function (v) {
  1234. var checkedNode = _this4.getNodeByValue(v);
  1235. return checkedNode ? checkedNode.pathNodes : [];
  1236. });
  1237. },
  1238. handleKeyDown: function handleKeyDown(e) {
  1239. var target = e.target,
  1240. keyCode = e.keyCode;
  1241. switch (keyCode) {
  1242. case KeyCode.up:
  1243. var prev = getSibling(target, -1);
  1244. focusNode(prev);
  1245. break;
  1246. case KeyCode.down:
  1247. var next = getSibling(target, 1);
  1248. focusNode(next);
  1249. break;
  1250. case KeyCode.left:
  1251. var preMenu = this.$refs.menu[getMenuIndex(target) - 1];
  1252. if (preMenu) {
  1253. var expandedNode = preMenu.$el.querySelector('.el-cascader-node[aria-expanded="true"]');
  1254. focusNode(expandedNode);
  1255. }
  1256. break;
  1257. case KeyCode.right:
  1258. var nextMenu = this.$refs.menu[getMenuIndex(target) + 1];
  1259. if (nextMenu) {
  1260. var firstNode = nextMenu.$el.querySelector('.el-cascader-node[tabindex="-1"]');
  1261. focusNode(firstNode);
  1262. }
  1263. break;
  1264. case KeyCode.enter:
  1265. checkNode(target);
  1266. break;
  1267. case KeyCode.esc:
  1268. case KeyCode.tab:
  1269. this.$emit('close');
  1270. break;
  1271. default:
  1272. return;
  1273. }
  1274. },
  1275. handleExpand: function handleExpand(node, silent) {
  1276. var activePath = this.activePath;
  1277. var level = node.level;
  1278. var path = activePath.slice(0, level - 1);
  1279. var menus = this.menus.slice(0, level);
  1280. if (!node.isLeaf) {
  1281. path.push(node);
  1282. menus.push(node.children);
  1283. }
  1284. this.activePath = path;
  1285. this.menus = menus;
  1286. if (!silent) {
  1287. var pathValues = path.map(function (node) {
  1288. return node.getValue();
  1289. });
  1290. var activePathValues = activePath.map(function (node) {
  1291. return node.getValue();
  1292. });
  1293. if (!Object(util_["valueEquals"])(pathValues, activePathValues)) {
  1294. this.$emit('active-item-change', pathValues); // Deprecated
  1295. this.$emit('expand-change', pathValues);
  1296. }
  1297. }
  1298. },
  1299. handleCheckChange: function handleCheckChange(value) {
  1300. this.checkedValue = value;
  1301. },
  1302. lazyLoad: function lazyLoad(node, onFullfiled) {
  1303. var _this5 = this;
  1304. var config = this.config;
  1305. if (!node) {
  1306. node = node || { root: true, level: 0 };
  1307. this.store = new src_store([], config);
  1308. this.menus = [this.store.getNodes()];
  1309. }
  1310. node.loading = true;
  1311. var resolve = function resolve(dataList) {
  1312. var parent = node.root ? null : node;
  1313. dataList && dataList.length && _this5.store.appendNodes(dataList, parent);
  1314. node.loading = false;
  1315. node.loaded = true;
  1316. // dispose default value on lazy load mode
  1317. if (Array.isArray(_this5.checkedValue)) {
  1318. var nodeValue = _this5.checkedValue[_this5.loadCount++];
  1319. var valueKey = _this5.config.value;
  1320. var leafKey = _this5.config.leaf;
  1321. if (Array.isArray(dataList) && dataList.filter(function (item) {
  1322. return item[valueKey] === nodeValue;
  1323. }).length > 0) {
  1324. var checkedNode = _this5.store.getNodeByValue(nodeValue);
  1325. if (!checkedNode.data[leafKey]) {
  1326. _this5.lazyLoad(checkedNode, function () {
  1327. _this5.handleExpand(checkedNode);
  1328. });
  1329. }
  1330. if (_this5.loadCount === _this5.checkedValue.length) {
  1331. _this5.$parent.computePresentText();
  1332. }
  1333. }
  1334. }
  1335. onFullfiled && onFullfiled(dataList);
  1336. };
  1337. config.lazyLoad(node, resolve);
  1338. },
  1339. /**
  1340. * public methods
  1341. */
  1342. calculateMultiCheckedValue: function calculateMultiCheckedValue() {
  1343. this.checkedValue = this.getCheckedNodes(this.leafOnly).map(function (node) {
  1344. return node.getValueByOption();
  1345. });
  1346. },
  1347. scrollIntoView: function scrollIntoView() {
  1348. if (this.$isServer) return;
  1349. var menus = this.$refs.menu || [];
  1350. menus.forEach(function (menu) {
  1351. var menuElement = menu.$el;
  1352. if (menuElement) {
  1353. var container = menuElement.querySelector('.el-scrollbar__wrap');
  1354. var activeNode = menuElement.querySelector('.el-cascader-node.is-active') || menuElement.querySelector('.el-cascader-node.in-active-path');
  1355. scroll_into_view_default()(container, activeNode);
  1356. }
  1357. });
  1358. },
  1359. getNodeByValue: function getNodeByValue(val) {
  1360. return this.store.getNodeByValue(val);
  1361. },
  1362. getFlattedNodes: function getFlattedNodes(leafOnly) {
  1363. var cached = !this.config.lazy;
  1364. return this.store.getFlattedNodes(leafOnly, cached);
  1365. },
  1366. getCheckedNodes: function getCheckedNodes(leafOnly) {
  1367. var checkedValue = this.checkedValue,
  1368. multiple = this.multiple;
  1369. if (multiple) {
  1370. var nodes = this.getFlattedNodes(leafOnly);
  1371. return nodes.filter(function (node) {
  1372. return node.checked;
  1373. });
  1374. } else {
  1375. return Object(util_["isEmpty"])(checkedValue) ? [] : [this.getNodeByValue(checkedValue)];
  1376. }
  1377. },
  1378. clearCheckedNodes: function clearCheckedNodes() {
  1379. var config = this.config,
  1380. leafOnly = this.leafOnly;
  1381. var multiple = config.multiple,
  1382. emitPath = config.emitPath;
  1383. if (multiple) {
  1384. this.getCheckedNodes(leafOnly).filter(function (node) {
  1385. return !node.isDisabled;
  1386. }).forEach(function (node) {
  1387. return node.doCheck(false);
  1388. });
  1389. this.calculateMultiCheckedValue();
  1390. } else {
  1391. this.checkedValue = emitPath ? [] : null;
  1392. }
  1393. }
  1394. }
  1395. });
  1396. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-panel.vue?vue&type=script&lang=js&
  1397. /* harmony default export */ var src_cascader_panelvue_type_script_lang_js_ = (cascader_panelvue_type_script_lang_js_);
  1398. // CONCATENATED MODULE: ./packages/cascader-panel/src/cascader-panel.vue
  1399. /* normalize component */
  1400. var cascader_panel_component = Object(componentNormalizer["a" /* default */])(
  1401. src_cascader_panelvue_type_script_lang_js_,
  1402. cascader_panelvue_type_template_id_34932346_render,
  1403. staticRenderFns,
  1404. false,
  1405. null,
  1406. null,
  1407. null
  1408. )
  1409. /* hot reload */
  1410. if (false) { var cascader_panel_api; }
  1411. cascader_panel_component.options.__file = "packages/cascader-panel/src/cascader-panel.vue"
  1412. /* harmony default export */ var cascader_panel = (cascader_panel_component.exports);
  1413. // CONCATENATED MODULE: ./packages/cascader-panel/index.js
  1414. /* istanbul ignore next */
  1415. cascader_panel.install = function (Vue) {
  1416. Vue.component(cascader_panel.name, cascader_panel);
  1417. };
  1418. /* harmony default export */ var packages_cascader_panel = __webpack_exports__["default"] = (cascader_panel);
  1419. /***/ }),
  1420. /***/ 2:
  1421. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1422. "use strict";
  1423. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  1424. /* globals __VUE_SSR_CONTEXT__ */
  1425. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  1426. // This module is a runtime utility for cleaner component module output and will
  1427. // be included in the final webpack user bundle.
  1428. function normalizeComponent (
  1429. scriptExports,
  1430. render,
  1431. staticRenderFns,
  1432. functionalTemplate,
  1433. injectStyles,
  1434. scopeId,
  1435. moduleIdentifier, /* server only */
  1436. shadowMode /* vue-cli only */
  1437. ) {
  1438. // Vue.extend constructor export interop
  1439. var options = typeof scriptExports === 'function'
  1440. ? scriptExports.options
  1441. : scriptExports
  1442. // render functions
  1443. if (render) {
  1444. options.render = render
  1445. options.staticRenderFns = staticRenderFns
  1446. options._compiled = true
  1447. }
  1448. // functional template
  1449. if (functionalTemplate) {
  1450. options.functional = true
  1451. }
  1452. // scopedId
  1453. if (scopeId) {
  1454. options._scopeId = 'data-v-' + scopeId
  1455. }
  1456. var hook
  1457. if (moduleIdentifier) { // server build
  1458. hook = function (context) {
  1459. // 2.3 injection
  1460. context =
  1461. context || // cached call
  1462. (this.$vnode && this.$vnode.ssrContext) || // stateful
  1463. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  1464. // 2.2 with runInNewContext: true
  1465. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  1466. context = __VUE_SSR_CONTEXT__
  1467. }
  1468. // inject component styles
  1469. if (injectStyles) {
  1470. injectStyles.call(this, context)
  1471. }
  1472. // register component module identifier for async chunk inferrence
  1473. if (context && context._registeredComponents) {
  1474. context._registeredComponents.add(moduleIdentifier)
  1475. }
  1476. }
  1477. // used by ssr in case component is cached and beforeCreate
  1478. // never gets called
  1479. options._ssrRegister = hook
  1480. } else if (injectStyles) {
  1481. hook = shadowMode
  1482. ? function () {
  1483. injectStyles.call(
  1484. this,
  1485. (options.functional ? this.parent : this).$root.$options.shadowRoot
  1486. )
  1487. }
  1488. : injectStyles
  1489. }
  1490. if (hook) {
  1491. if (options.functional) {
  1492. // for template-only hot-reload because in that case the render fn doesn't
  1493. // go through the normalizer
  1494. options._injectStyles = hook
  1495. // register for functional component in vue file
  1496. var originalRender = options.render
  1497. options.render = function renderWithStyleInjection (h, context) {
  1498. hook.call(context)
  1499. return originalRender(h, context)
  1500. }
  1501. } else {
  1502. // inject component registration as beforeCreate hook
  1503. var existing = options.beforeCreate
  1504. options.beforeCreate = existing
  1505. ? [].concat(existing, hook)
  1506. : [hook]
  1507. }
  1508. }
  1509. return {
  1510. exports: scriptExports,
  1511. options: options
  1512. }
  1513. }
  1514. /***/ }),
  1515. /***/ 33:
  1516. /***/ (function(module, exports) {
  1517. module.exports = require("tis-ui/lib/utils/merge");
  1518. /***/ }),
  1519. /***/ 38:
  1520. /***/ (function(module, exports) {
  1521. module.exports = require("tis-ui/lib/mixins/locale");
  1522. /***/ }),
  1523. /***/ 44:
  1524. /***/ (function(module, exports) {
  1525. module.exports = require("tis-ui/lib/utils/resize-event");
  1526. /***/ }),
  1527. /***/ 49:
  1528. /***/ (function(module, exports) {
  1529. module.exports = require("tis-ui/lib/utils/shared");
  1530. /***/ }),
  1531. /***/ 65:
  1532. /***/ (function(module, exports) {
  1533. module.exports = require("tis-ui/lib/utils/scrollbar-width");
  1534. /***/ }),
  1535. /***/ 66:
  1536. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1537. "use strict";
  1538. // ESM COMPAT FLAG
  1539. __webpack_require__.r(__webpack_exports__);
  1540. // EXTERNAL MODULE: external "tis-ui/lib/utils/resize-event"
  1541. var resize_event_ = __webpack_require__(44);
  1542. // EXTERNAL MODULE: external "tis-ui/lib/utils/scrollbar-width"
  1543. var scrollbar_width_ = __webpack_require__(65);
  1544. var scrollbar_width_default = /*#__PURE__*/__webpack_require__.n(scrollbar_width_);
  1545. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  1546. var util_ = __webpack_require__(10);
  1547. // EXTERNAL MODULE: external "tis-ui/lib/utils/dom"
  1548. var dom_ = __webpack_require__(7);
  1549. // CONCATENATED MODULE: ./packages/scrollbar/src/util.js
  1550. var BAR_MAP = {
  1551. vertical: {
  1552. offset: 'offsetHeight',
  1553. scroll: 'scrollTop',
  1554. scrollSize: 'scrollHeight',
  1555. size: 'height',
  1556. key: 'vertical',
  1557. axis: 'Y',
  1558. client: 'clientY',
  1559. direction: 'top'
  1560. },
  1561. horizontal: {
  1562. offset: 'offsetWidth',
  1563. scroll: 'scrollLeft',
  1564. scrollSize: 'scrollWidth',
  1565. size: 'width',
  1566. key: 'horizontal',
  1567. axis: 'X',
  1568. client: 'clientX',
  1569. direction: 'left'
  1570. }
  1571. };
  1572. function renderThumbStyle(_ref) {
  1573. var move = _ref.move,
  1574. size = _ref.size,
  1575. bar = _ref.bar;
  1576. var style = {};
  1577. var translate = 'translate' + bar.axis + '(' + move + '%)';
  1578. style[bar.size] = size;
  1579. style.transform = translate;
  1580. style.msTransform = translate;
  1581. style.webkitTransform = translate;
  1582. return style;
  1583. };
  1584. // CONCATENATED MODULE: ./packages/scrollbar/src/bar.js
  1585. /* istanbul ignore next */
  1586. /* harmony default export */ var src_bar = ({
  1587. name: 'Bar',
  1588. props: {
  1589. vertical: Boolean,
  1590. size: String,
  1591. move: Number
  1592. },
  1593. computed: {
  1594. bar: function bar() {
  1595. return BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
  1596. },
  1597. wrap: function wrap() {
  1598. return this.$parent.wrap;
  1599. }
  1600. },
  1601. render: function render(h) {
  1602. var size = this.size,
  1603. move = this.move,
  1604. bar = this.bar;
  1605. return h(
  1606. 'div',
  1607. {
  1608. 'class': ['el-scrollbar__bar', 'is-' + bar.key],
  1609. on: {
  1610. 'mousedown': this.clickTrackHandler
  1611. }
  1612. },
  1613. [h('div', {
  1614. ref: 'thumb',
  1615. 'class': 'el-scrollbar__thumb',
  1616. on: {
  1617. 'mousedown': this.clickThumbHandler
  1618. },
  1619. style: renderThumbStyle({ size: size, move: move, bar: bar }) })]
  1620. );
  1621. },
  1622. methods: {
  1623. clickThumbHandler: function clickThumbHandler(e) {
  1624. // prevent click event of right button
  1625. if (e.ctrlKey || e.button === 2) {
  1626. return;
  1627. }
  1628. this.startDrag(e);
  1629. this[this.bar.axis] = e.currentTarget[this.bar.offset] - (e[this.bar.client] - e.currentTarget.getBoundingClientRect()[this.bar.direction]);
  1630. },
  1631. clickTrackHandler: function clickTrackHandler(e) {
  1632. var offset = Math.abs(e.target.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]);
  1633. var thumbHalf = this.$refs.thumb[this.bar.offset] / 2;
  1634. var thumbPositionPercentage = (offset - thumbHalf) * 100 / this.$el[this.bar.offset];
  1635. this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
  1636. },
  1637. startDrag: function startDrag(e) {
  1638. e.stopImmediatePropagation();
  1639. this.cursorDown = true;
  1640. Object(dom_["on"])(document, 'mousemove', this.mouseMoveDocumentHandler);
  1641. Object(dom_["on"])(document, 'mouseup', this.mouseUpDocumentHandler);
  1642. document.onselectstart = function () {
  1643. return false;
  1644. };
  1645. },
  1646. mouseMoveDocumentHandler: function mouseMoveDocumentHandler(e) {
  1647. if (this.cursorDown === false) return;
  1648. var prevPage = this[this.bar.axis];
  1649. if (!prevPage) return;
  1650. var offset = (this.$el.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]) * -1;
  1651. var thumbClickPosition = this.$refs.thumb[this.bar.offset] - prevPage;
  1652. var thumbPositionPercentage = (offset - thumbClickPosition) * 100 / this.$el[this.bar.offset];
  1653. this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
  1654. },
  1655. mouseUpDocumentHandler: function mouseUpDocumentHandler(e) {
  1656. this.cursorDown = false;
  1657. this[this.bar.axis] = 0;
  1658. Object(dom_["off"])(document, 'mousemove', this.mouseMoveDocumentHandler);
  1659. document.onselectstart = null;
  1660. }
  1661. },
  1662. destroyed: function destroyed() {
  1663. Object(dom_["off"])(document, 'mouseup', this.mouseUpDocumentHandler);
  1664. }
  1665. });
  1666. // CONCATENATED MODULE: ./packages/scrollbar/src/main.js
  1667. // reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
  1668. /* istanbul ignore next */
  1669. /* harmony default export */ var main = ({
  1670. name: 'TisScrollbar',
  1671. components: { Bar: src_bar },
  1672. props: {
  1673. native: Boolean,
  1674. wrapStyle: {},
  1675. wrapClass: {},
  1676. viewClass: {},
  1677. viewStyle: {},
  1678. noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
  1679. tag: {
  1680. type: String,
  1681. default: 'div'
  1682. }
  1683. },
  1684. data: function data() {
  1685. return {
  1686. sizeWidth: '0',
  1687. sizeHeight: '0',
  1688. moveX: 0,
  1689. moveY: 0
  1690. };
  1691. },
  1692. computed: {
  1693. wrap: function wrap() {
  1694. return this.$refs.wrap;
  1695. }
  1696. },
  1697. render: function render(h) {
  1698. var gutter = scrollbar_width_default()();
  1699. var style = this.wrapStyle;
  1700. if (gutter) {
  1701. var gutterWith = '-' + gutter + 'px';
  1702. var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
  1703. if (Array.isArray(this.wrapStyle)) {
  1704. style = Object(util_["toObject"])(this.wrapStyle);
  1705. style.marginRight = style.marginBottom = gutterWith;
  1706. } else if (typeof this.wrapStyle === 'string') {
  1707. style += gutterStyle;
  1708. } else {
  1709. style = gutterStyle;
  1710. }
  1711. }
  1712. var view = h(this.tag, {
  1713. class: ['el-scrollbar__view', this.viewClass],
  1714. style: this.viewStyle,
  1715. ref: 'resize'
  1716. }, this.$slots.default);
  1717. var wrap = h(
  1718. 'div',
  1719. {
  1720. ref: 'wrap',
  1721. style: style,
  1722. on: {
  1723. 'scroll': this.handleScroll
  1724. },
  1725. 'class': [this.wrapClass, 'el-scrollbar__wrap', gutter ? '' : 'el-scrollbar__wrap--hidden-default'] },
  1726. [[view]]
  1727. );
  1728. var nodes = void 0;
  1729. if (!this.native) {
  1730. nodes = [wrap, h(src_bar, {
  1731. attrs: {
  1732. move: this.moveX,
  1733. size: this.sizeWidth }
  1734. }), h(src_bar, {
  1735. attrs: {
  1736. vertical: true,
  1737. move: this.moveY,
  1738. size: this.sizeHeight }
  1739. })];
  1740. } else {
  1741. nodes = [h(
  1742. 'div',
  1743. {
  1744. ref: 'wrap',
  1745. 'class': [this.wrapClass, 'el-scrollbar__wrap'],
  1746. style: style },
  1747. [[view]]
  1748. )];
  1749. }
  1750. return h('div', { class: 'el-scrollbar' }, nodes);
  1751. },
  1752. methods: {
  1753. handleScroll: function handleScroll() {
  1754. var wrap = this.wrap;
  1755. this.moveY = wrap.scrollTop * 100 / wrap.clientHeight;
  1756. this.moveX = wrap.scrollLeft * 100 / wrap.clientWidth;
  1757. },
  1758. update: function update() {
  1759. var heightPercentage = void 0,
  1760. widthPercentage = void 0;
  1761. var wrap = this.wrap;
  1762. if (!wrap) return;
  1763. heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
  1764. widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
  1765. this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
  1766. this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
  1767. }
  1768. },
  1769. mounted: function mounted() {
  1770. if (this.native) return;
  1771. this.$nextTick(this.update);
  1772. !this.noresize && Object(resize_event_["addResizeListener"])(this.$refs.resize, this.update);
  1773. },
  1774. beforeDestroy: function beforeDestroy() {
  1775. if (this.native) return;
  1776. !this.noresize && Object(resize_event_["removeResizeListener"])(this.$refs.resize, this.update);
  1777. }
  1778. });
  1779. // CONCATENATED MODULE: ./packages/scrollbar/index.js
  1780. /* istanbul ignore next */
  1781. main.install = function (Vue) {
  1782. Vue.component(main.name, main);
  1783. };
  1784. /* harmony default export */ var scrollbar = __webpack_exports__["default"] = (main);
  1785. /***/ }),
  1786. /***/ 68:
  1787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1788. "use strict";
  1789. // ESM COMPAT FLAG
  1790. __webpack_require__.r(__webpack_exports__);
  1791. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
  1792. var render = function() {
  1793. var _vm = this
  1794. var _h = _vm.$createElement
  1795. var _c = _vm._self._c || _h
  1796. return _c(
  1797. "label",
  1798. {
  1799. staticClass: "el-checkbox",
  1800. class: [
  1801. _vm.border && _vm.checkboxSize
  1802. ? "el-checkbox--" + _vm.checkboxSize
  1803. : "",
  1804. { "is-disabled": _vm.isDisabled },
  1805. { "is-bordered": _vm.border },
  1806. { "is-checked": _vm.isChecked }
  1807. ],
  1808. attrs: { id: _vm.id }
  1809. },
  1810. [
  1811. _c(
  1812. "span",
  1813. {
  1814. staticClass: "el-checkbox__input",
  1815. class: {
  1816. "is-disabled": _vm.isDisabled,
  1817. "is-checked": _vm.isChecked,
  1818. "is-indeterminate": _vm.indeterminate,
  1819. "is-focus": _vm.focus
  1820. },
  1821. attrs: {
  1822. tabindex: _vm.indeterminate ? 0 : false,
  1823. role: _vm.indeterminate ? "checkbox" : false,
  1824. "aria-checked": _vm.indeterminate ? "mixed" : false
  1825. }
  1826. },
  1827. [
  1828. _c("span", { staticClass: "el-checkbox__inner" }),
  1829. _vm.trueLabel || _vm.falseLabel
  1830. ? _c("input", {
  1831. directives: [
  1832. {
  1833. name: "model",
  1834. rawName: "v-model",
  1835. value: _vm.model,
  1836. expression: "model"
  1837. }
  1838. ],
  1839. staticClass: "el-checkbox__original",
  1840. attrs: {
  1841. type: "checkbox",
  1842. "aria-hidden": _vm.indeterminate ? "true" : "false",
  1843. name: _vm.name,
  1844. disabled: _vm.isDisabled,
  1845. "true-value": _vm.trueLabel,
  1846. "false-value": _vm.falseLabel
  1847. },
  1848. domProps: {
  1849. checked: Array.isArray(_vm.model)
  1850. ? _vm._i(_vm.model, null) > -1
  1851. : _vm._q(_vm.model, _vm.trueLabel)
  1852. },
  1853. on: {
  1854. change: [
  1855. function($event) {
  1856. var $$a = _vm.model,
  1857. $$el = $event.target,
  1858. $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
  1859. if (Array.isArray($$a)) {
  1860. var $$v = null,
  1861. $$i = _vm._i($$a, $$v)
  1862. if ($$el.checked) {
  1863. $$i < 0 && (_vm.model = $$a.concat([$$v]))
  1864. } else {
  1865. $$i > -1 &&
  1866. (_vm.model = $$a
  1867. .slice(0, $$i)
  1868. .concat($$a.slice($$i + 1)))
  1869. }
  1870. } else {
  1871. _vm.model = $$c
  1872. }
  1873. },
  1874. _vm.handleChange
  1875. ],
  1876. focus: function($event) {
  1877. _vm.focus = true
  1878. },
  1879. blur: function($event) {
  1880. _vm.focus = false
  1881. }
  1882. }
  1883. })
  1884. : _c("input", {
  1885. directives: [
  1886. {
  1887. name: "model",
  1888. rawName: "v-model",
  1889. value: _vm.model,
  1890. expression: "model"
  1891. }
  1892. ],
  1893. staticClass: "el-checkbox__original",
  1894. attrs: {
  1895. type: "checkbox",
  1896. "aria-hidden": _vm.indeterminate ? "true" : "false",
  1897. disabled: _vm.isDisabled,
  1898. name: _vm.name
  1899. },
  1900. domProps: {
  1901. value: _vm.label,
  1902. checked: Array.isArray(_vm.model)
  1903. ? _vm._i(_vm.model, _vm.label) > -1
  1904. : _vm.model
  1905. },
  1906. on: {
  1907. change: [
  1908. function($event) {
  1909. var $$a = _vm.model,
  1910. $$el = $event.target,
  1911. $$c = $$el.checked ? true : false
  1912. if (Array.isArray($$a)) {
  1913. var $$v = _vm.label,
  1914. $$i = _vm._i($$a, $$v)
  1915. if ($$el.checked) {
  1916. $$i < 0 && (_vm.model = $$a.concat([$$v]))
  1917. } else {
  1918. $$i > -1 &&
  1919. (_vm.model = $$a
  1920. .slice(0, $$i)
  1921. .concat($$a.slice($$i + 1)))
  1922. }
  1923. } else {
  1924. _vm.model = $$c
  1925. }
  1926. },
  1927. _vm.handleChange
  1928. ],
  1929. focus: function($event) {
  1930. _vm.focus = true
  1931. },
  1932. blur: function($event) {
  1933. _vm.focus = false
  1934. }
  1935. }
  1936. })
  1937. ]
  1938. ),
  1939. _vm.$slots.default || _vm.label
  1940. ? _c(
  1941. "span",
  1942. { staticClass: "el-checkbox__label" },
  1943. [
  1944. _vm._t("default"),
  1945. !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
  1946. ],
  1947. 2
  1948. )
  1949. : _vm._e()
  1950. ]
  1951. )
  1952. }
  1953. var staticRenderFns = []
  1954. render._withStripped = true
  1955. // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
  1956. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  1957. var emitter_ = __webpack_require__(13);
  1958. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  1959. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
  1960. //
  1961. //
  1962. //
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. //
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. /* harmony default export */ var checkboxvue_type_script_lang_js_ = ({
  2016. name: 'TisCheckbox',
  2017. mixins: [emitter_default.a],
  2018. inject: {
  2019. elForm: {
  2020. default: ''
  2021. },
  2022. elFormItem: {
  2023. default: ''
  2024. }
  2025. },
  2026. componentName: 'TisCheckbox',
  2027. data: function data() {
  2028. return {
  2029. selfModel: false,
  2030. focus: false,
  2031. isLimitExceeded: false
  2032. };
  2033. },
  2034. computed: {
  2035. model: {
  2036. get: function get() {
  2037. return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
  2038. },
  2039. set: function set(val) {
  2040. if (this.isGroup) {
  2041. this.isLimitExceeded = false;
  2042. this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
  2043. this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
  2044. this.isLimitExceeded === false && this.dispatch('TisCheckboxGroup', 'input', [val]);
  2045. } else {
  2046. this.$emit('input', val);
  2047. this.selfModel = val;
  2048. }
  2049. }
  2050. },
  2051. isChecked: function isChecked() {
  2052. if ({}.toString.call(this.model) === '[object Boolean]') {
  2053. return this.model;
  2054. } else if (Array.isArray(this.model)) {
  2055. return this.model.indexOf(this.label) > -1;
  2056. } else if (this.model !== null && this.model !== undefined) {
  2057. return this.model === this.trueLabel;
  2058. }
  2059. },
  2060. isGroup: function isGroup() {
  2061. var parent = this.$parent;
  2062. while (parent) {
  2063. if (parent.$options.componentName !== 'TisCheckboxGroup') {
  2064. parent = parent.$parent;
  2065. } else {
  2066. this._checkboxGroup = parent;
  2067. return true;
  2068. }
  2069. }
  2070. return false;
  2071. },
  2072. store: function store() {
  2073. return this._checkboxGroup ? this._checkboxGroup.value : this.value;
  2074. },
  2075. /* used to make the isDisabled judgment under max/min props */
  2076. isLimitDisabled: function isLimitDisabled() {
  2077. var _checkboxGroup = this._checkboxGroup,
  2078. max = _checkboxGroup.max,
  2079. min = _checkboxGroup.min;
  2080. return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
  2081. },
  2082. isDisabled: function isDisabled() {
  2083. return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
  2084. },
  2085. _elFormItemSize: function _elFormItemSize() {
  2086. return (this.elFormItem || {}).elFormItemSize;
  2087. },
  2088. checkboxSize: function checkboxSize() {
  2089. var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  2090. return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
  2091. }
  2092. },
  2093. props: {
  2094. value: {},
  2095. label: {},
  2096. indeterminate: Boolean,
  2097. disabled: Boolean,
  2098. checked: Boolean,
  2099. name: String,
  2100. trueLabel: [String, Number],
  2101. falseLabel: [String, Number],
  2102. id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
  2103. controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
  2104. border: Boolean,
  2105. size: String
  2106. },
  2107. methods: {
  2108. addToStore: function addToStore() {
  2109. if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
  2110. this.model.push(this.label);
  2111. } else {
  2112. this.model = this.trueLabel || true;
  2113. }
  2114. },
  2115. handleChange: function handleChange(ev) {
  2116. var _this = this;
  2117. if (this.isLimitExceeded) return;
  2118. var value = void 0;
  2119. if (ev.target.checked) {
  2120. value = this.trueLabel === undefined ? true : this.trueLabel;
  2121. } else {
  2122. value = this.falseLabel === undefined ? false : this.falseLabel;
  2123. }
  2124. this.$emit('change', value, ev);
  2125. this.$nextTick(function () {
  2126. if (_this.isGroup) {
  2127. _this.dispatch('TisCheckboxGroup', 'change', [_this._checkboxGroup.value]);
  2128. }
  2129. });
  2130. }
  2131. },
  2132. created: function created() {
  2133. this.checked && this.addToStore();
  2134. },
  2135. mounted: function mounted() {
  2136. // 为indeterminate元素 添加aria-controls 属性
  2137. if (this.indeterminate) {
  2138. this.$el.setAttribute('aria-controls', this.controls);
  2139. }
  2140. },
  2141. watch: {
  2142. value: function value(_value) {
  2143. this.dispatch('ElFormItem', 'el.form.change', _value);
  2144. }
  2145. }
  2146. });
  2147. // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
  2148. /* harmony default export */ var src_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
  2149. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2150. var componentNormalizer = __webpack_require__(2);
  2151. // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
  2152. /* normalize component */
  2153. var component = Object(componentNormalizer["a" /* default */])(
  2154. src_checkboxvue_type_script_lang_js_,
  2155. render,
  2156. staticRenderFns,
  2157. false,
  2158. null,
  2159. null,
  2160. null
  2161. )
  2162. /* hot reload */
  2163. if (false) { var api; }
  2164. component.options.__file = "packages/checkbox/src/checkbox.vue"
  2165. /* harmony default export */ var src_checkbox = (component.exports);
  2166. // CONCATENATED MODULE: ./packages/checkbox/index.js
  2167. /* istanbul ignore next */
  2168. src_checkbox.install = function (Vue) {
  2169. Vue.component(src_checkbox.name, src_checkbox);
  2170. };
  2171. /* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
  2172. /***/ }),
  2173. /***/ 7:
  2174. /***/ (function(module, exports) {
  2175. module.exports = require("tis-ui/lib/utils/dom");
  2176. /***/ }),
  2177. /***/ 90:
  2178. /***/ (function(module, exports) {
  2179. module.exports = require("babel-helper-vue-jsx-merge-props");
  2180. /***/ }),
  2181. /***/ 95:
  2182. /***/ (function(module, exports) {
  2183. module.exports = require("tis-ui/lib/utils/scroll-into-view");
  2184. /***/ })
  2185. /******/ });