|
1 | 1 | /*!
|
2 |
| - * vue-virtual-scroll-list v2.0.9 |
| 2 | + * vue-virtual-scroll-list v2.1.1 |
3 | 3 | * open source under the MIT license
|
4 | 4 | * https://github.com/tangbc/vue-virtual-scroll-list#readme
|
5 | 5 | */
|
|
534 | 534 | mixins: [Wrapper],
|
535 | 535 | props: ItemProps,
|
536 | 536 | render: function render(h) {
|
537 |
| - var itemProps = this.extraProps || {}; |
538 |
| - itemProps.source = this.source; |
539 |
| - return h(this.tag, { |
| 537 | + var tag = this.tag, |
| 538 | + component = this.component, |
| 539 | + _this$extraProps = this.extraProps, |
| 540 | + extraProps = _this$extraProps === void 0 ? {} : _this$extraProps; |
| 541 | + extraProps.source = this.source; |
| 542 | + return h(tag, { |
540 | 543 | role: 'item'
|
541 |
| - }, [h(this.component, { |
542 |
| - props: itemProps |
| 544 | + }, [h(component, { |
| 545 | + props: extraProps |
543 | 546 | })]);
|
544 | 547 | }
|
545 | 548 | }); // wrapping for slot
|
|
548 | 551 | mixins: [Wrapper],
|
549 | 552 | props: SlotProps,
|
550 | 553 | render: function render(h) {
|
551 |
| - return h(this.tag, { |
| 554 | + var tag = this.tag, |
| 555 | + uniqueKey = this.uniqueKey; |
| 556 | + return h(tag, { |
552 | 557 | attrs: {
|
553 |
| - role: this.uniqueKey |
| 558 | + role: uniqueKey |
554 | 559 | }
|
555 | 560 | }, this.$slots["default"]);
|
556 | 561 | }
|
|
744 | 749 | // so those components that are reused will not trigger lifecycle mounted
|
745 | 750 | getRenderSlots: function getRenderSlots(h) {
|
746 | 751 | var slots = [];
|
747 |
| - var start = this.range.start; |
748 |
| - var end = this.range.end; |
| 752 | + var _this$range = this.range, |
| 753 | + start = _this$range.start, |
| 754 | + end = _this$range.end; |
| 755 | + var dataSources = this.dataSources, |
| 756 | + dataKey = this.dataKey, |
| 757 | + itemClass = this.itemClass, |
| 758 | + itemTag = this.itemTag, |
| 759 | + isHorizontal = this.isHorizontal, |
| 760 | + extraProps = this.extraProps, |
| 761 | + dataComponent = this.dataComponent; |
749 | 762 |
|
750 | 763 | for (var index = start; index <= end; index++) {
|
751 |
| - var dataSource = this.dataSources[index]; |
| 764 | + var dataSource = dataSources[index]; |
752 | 765 |
|
753 | 766 | if (dataSource) {
|
754 |
| - if (dataSource[this.dataKey]) { |
| 767 | + if (dataSource[dataKey]) { |
755 | 768 | slots.push(h(Item, {
|
756 |
| - "class": this.itemClass, |
| 769 | + "class": itemClass, |
757 | 770 | props: {
|
758 |
| - tag: this.itemTag, |
| 771 | + tag: itemTag, |
759 | 772 | event: EVENT_TYPE.ITEM,
|
760 |
| - horizontal: this.isHorizontal, |
761 |
| - uniqueKey: dataSource[this.dataKey], |
| 773 | + horizontal: isHorizontal, |
| 774 | + uniqueKey: dataSource[dataKey], |
762 | 775 | source: dataSource,
|
763 |
| - extraProps: this.extraProps, |
764 |
| - component: this.dataComponent |
| 776 | + extraProps: extraProps, |
| 777 | + component: dataComponent |
765 | 778 | }
|
766 | 779 | }));
|
767 | 780 | } else {
|
768 |
| - console.warn("Cannot get the data-key '".concat(this.dataKey, "' from data-sources.")); |
| 781 | + console.warn("Cannot get the data-key '".concat(dataKey, "' from data-sources.")); |
769 | 782 | }
|
770 | 783 | } else {
|
771 | 784 | console.warn("Cannot get the index '".concat(index, "' from data-sources."));
|
|
781 | 794 | var _this$$slots = this.$slots,
|
782 | 795 | header = _this$$slots.header,
|
783 | 796 | footer = _this$$slots.footer;
|
784 |
| - var _this$range = this.range, |
785 |
| - padFront = _this$range.padFront, |
786 |
| - padBehind = _this$range.padBehind; |
| 797 | + var _this$range2 = this.range, |
| 798 | + padFront = _this$range2.padFront, |
| 799 | + padBehind = _this$range2.padBehind; |
| 800 | + var rootTag = this.rootTag, |
| 801 | + headerClass = this.headerClass, |
| 802 | + headerTag = this.headerTag, |
| 803 | + wrapTag = this.wrapTag, |
| 804 | + wrapClass = this.wrapClass, |
| 805 | + footerClass = this.footerClass, |
| 806 | + footerTag = this.footerTag; |
787 | 807 | var padding = this.isHorizontal ? "0px ".concat(padBehind, "px 0px ").concat(padFront, "px") : "".concat(padFront, "px 0px ").concat(padBehind, "px");
|
788 |
| - return h(this.rootTag, { |
| 808 | + return h(rootTag, { |
789 | 809 | ref: 'root',
|
790 | 810 | on: {
|
791 | 811 | '&scroll': this.onScroll
|
792 | 812 | }
|
793 | 813 | }, [// header slot
|
794 | 814 | header ? h(Slot, {
|
795 |
| - "class": this.headerClass, |
| 815 | + "class": headerClass, |
796 | 816 | props: {
|
797 |
| - tag: this.headerTag, |
| 817 | + tag: headerTag, |
798 | 818 | event: EVENT_TYPE.SLOT,
|
799 | 819 | uniqueKey: SLOT_TYPE.HEADER
|
800 | 820 | }
|
801 | 821 | }, header) : null, // main list
|
802 |
| - h(this.wrapTag, { |
803 |
| - "class": this.wrapClass, |
| 822 | + h(wrapTag, { |
| 823 | + "class": wrapClass, |
804 | 824 | attrs: {
|
805 | 825 | role: 'group'
|
806 | 826 | },
|
|
809 | 829 | }
|
810 | 830 | }, this.getRenderSlots(h)), // footer slot
|
811 | 831 | footer ? h(Slot, {
|
812 |
| - "class": this.footerClass, |
| 832 | + "class": footerClass, |
813 | 833 | props: {
|
814 |
| - tag: this.footerTag, |
| 834 | + tag: footerTag, |
815 | 835 | event: EVENT_TYPE.SLOT,
|
816 | 836 | uniqueKey: SLOT_TYPE.FOOTER
|
817 | 837 | }
|
|
0 commit comments