|
427 | 427 | },
|
428 | 428 | handleClickCheckBox: function handleClickCheckBox(e) {
|
429 | 429 | e.stopPropagation();
|
| 430 | + }, |
| 431 | + renderExpandSlot: function renderExpandSlot() { |
| 432 | + var h = this.$createElement; |
| 433 | + var expandIconSlot = this.tree.expandIcon; |
| 434 | + var node = this.node, |
| 435 | + toggleFold = this.toggleFold, |
| 436 | + visibleExpand = this.visibleExpand; |
| 437 | + var expanded = node.data.expanded; |
| 438 | + return expandIconSlot ? expandIconSlot({ |
| 439 | + expanded: expanded, |
| 440 | + toggleFoldCb: toggleFold |
| 441 | + }) : h("span", { |
| 442 | + "class": ['icon', expanded ? 'rotate180-enter icon-expand' : 'rotate180-leave icon-unexpand'], |
| 443 | + "on": { |
| 444 | + "click": function click() { |
| 445 | + return toggleFold(node); |
| 446 | + } |
| 447 | + }, |
| 448 | + "style": { |
| 449 | + display: visibleExpand |
| 450 | + } |
| 451 | + }, ["\u25BC"]); |
| 452 | + }, |
| 453 | + renderCheckbox: function renderCheckbox() { |
| 454 | + var h = this.$createElement; |
| 455 | + var node = this.node, |
| 456 | + handleClickCheckBox = this.handleClickCheckBox, |
| 457 | + selectToggle = this.selectToggle; |
| 458 | + var _this$tree2 = this.tree, |
| 459 | + checkboxSlot = _this$tree2.checkbox, |
| 460 | + showCheckbox = _this$tree2.showCheckbox; |
| 461 | + var _node$data = node.data, |
| 462 | + checked = _node$data.checked, |
| 463 | + partialSelected = _node$data.partialSelected, |
| 464 | + exceptDisabledChecked = _node$data.exceptDisabledChecked, |
| 465 | + disabled = _node$data.disabled; |
| 466 | + return showCheckbox ? checkboxSlot ? checkboxSlot({ |
| 467 | + handleClickCheckBox: handleClickCheckBox, |
| 468 | + selectToggle: selectToggle, |
| 469 | + node: node.data |
| 470 | + }) : h(Checkbox, { |
| 471 | + "attrs": { |
| 472 | + "value": checked, |
| 473 | + "indeterminate": partialSelected, |
| 474 | + "disabled": disabled |
| 475 | + }, |
| 476 | + "style": "margin-right: 10px;", |
| 477 | + "key": exceptDisabledChecked, |
| 478 | + "nativeOn": { |
| 479 | + "click": handleClickCheckBox |
| 480 | + }, |
| 481 | + "on": { |
| 482 | + "change": function change(val) { |
| 483 | + return selectToggle(val, node); |
| 484 | + } |
| 485 | + } |
| 486 | + }) : null; |
| 487 | + }, |
| 488 | + renderLoading: function renderLoading() { |
| 489 | + var h = this.$createElement; |
| 490 | + var loadingSlot = this.tree.loading; |
| 491 | + var loading = this.loading; |
| 492 | + return loading ? loadingSlot ? loadingSlot({ |
| 493 | + loading: loading |
| 494 | + }) : h("div", ["\u21BB"]) : null; |
| 495 | + }, |
| 496 | + renderNodeName: function renderNodeName() { |
| 497 | + var h = this.$createElement; |
| 498 | + var tree = this.tree, |
| 499 | + node = this.node; |
| 500 | + var name = node.data.name; |
| 501 | + var renderTreeNode = tree.renderTreeNode, |
| 502 | + defaultSlot = tree.$scopedSlots.default; |
| 503 | + return renderTreeNode ? renderTreeNode(node.data) : defaultSlot ? defaultSlot({ |
| 504 | + node: node.data, |
| 505 | + treeNode: node |
| 506 | + }) : h("span", [name]); |
430 | 507 | }
|
431 | 508 | },
|
432 | 509 | render: function render() {
|
433 |
| - var _this3 = this; |
434 |
| - |
435 | 510 | var h = arguments[0];
|
436 |
| - var tree = this.tree, |
437 |
| - node = this.node, |
438 |
| - loading = this.loading, |
439 |
| - clickContent = this.clickContent, |
440 |
| - handleClickCheckBox = this.handleClickCheckBox, |
| 511 | + var clickContent = this.clickContent, |
441 | 512 | activeNode = this.activeNode,
|
442 |
| - visibleExpand = this.visibleExpand; |
443 |
| - |
444 |
| - var _ref = node.data || {}, |
445 |
| - name = _ref.name, |
446 |
| - checked = _ref.checked, |
447 |
| - disabled = _ref.disabled, |
448 |
| - partialSelected = _ref.partialSelected, |
449 |
| - expanded = _ref.expanded, |
450 |
| - exceptDisabledChecked = _ref.exceptDisabledChecked; |
451 |
| - |
452 |
| - var renderTreeNode = tree.renderTreeNode, |
453 |
| - defaultSlot = tree.$scopedSlots.default, |
454 |
| - showCheckbox = tree.showCheckbox; |
| 513 | + renderExpandSlot = this.renderExpandSlot, |
| 514 | + renderCheckbox = this.renderCheckbox, |
| 515 | + renderLoading = this.renderLoading, |
| 516 | + renderNodeName = this.renderNodeName; |
455 | 517 | return h("div", {
|
456 | 518 | "class": ['node-content', {
|
457 | 519 | 'active-li': activeNode
|
458 | 520 | }]
|
459 |
| - }, [h("span", { |
460 |
| - "class": ['icon', expanded ? 'rotate180-enter icon-expand' : 'rotate180-leave icon-unexpand'], |
461 |
| - "on": { |
462 |
| - "click": function click() { |
463 |
| - return _this3.toggleFold(node); |
464 |
| - } |
465 |
| - }, |
466 |
| - "style": { |
467 |
| - display: visibleExpand |
468 |
| - } |
469 |
| - }, ["\u25BC"]), h("div", { |
| 521 | + }, [renderExpandSlot(), h("div", { |
470 | 522 | "class": ['inner-wrap'],
|
471 | 523 | "on": {
|
472 | 524 | "click": clickContent
|
473 | 525 | }
|
474 |
| - }, [showCheckbox && h(Checkbox, { |
475 |
| - "attrs": { |
476 |
| - "value": checked, |
477 |
| - "indeterminate": partialSelected, |
478 |
| - "disabled": disabled |
479 |
| - }, |
480 |
| - "style": "margin-right: 10px;", |
481 |
| - "key": exceptDisabledChecked, |
482 |
| - "nativeOn": { |
483 |
| - "click": handleClickCheckBox |
484 |
| - }, |
485 |
| - "on": { |
486 |
| - "change": function change(val) { |
487 |
| - return _this3.selectToggle(val, node); |
488 |
| - } |
489 |
| - } |
490 |
| - }), loading && h("div", { |
491 |
| - "attrs": { |
492 |
| - "loading": true |
493 |
| - } |
494 |
| - }, ["\u21BB"]), h("div", { |
| 526 | + }, [renderCheckbox(), renderLoading(), h("div", { |
495 | 527 | "class": 'node-name'
|
496 |
| - }, [renderTreeNode ? renderTreeNode(node.data) : defaultSlot ? defaultSlot({ |
497 |
| - node: node.data, |
498 |
| - treeNode: node |
499 |
| - }) : h("span", [name])])])]); |
| 528 | + }, [renderNodeName()])])]); |
500 | 529 | }
|
501 | 530 | };
|
502 | 531 |
|
|
1583 | 1612 | computed: {
|
1584 | 1613 | conStyles: function conStyles() {
|
1585 | 1614 | return this.height ? {
|
1586 |
| - height: "".concat(this.height, "px") |
| 1615 | + height: "".concat(this.height, "px"), |
| 1616 | + overflow: 'scroll' |
1587 | 1617 | } : {
|
1588 | 1618 | height: 'auto'
|
1589 | 1619 | };
|
|
0 commit comments