Skip to content

Commit 83ee782

Browse files
committed
Release v2.3.3
1 parent 97f7f6e commit 83ee782

File tree

2 files changed

+74
-14
lines changed

2 files changed

+74
-14
lines changed

Diff for: dist/index.js

+73-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-virtual-scroll-list v2.3.2
2+
* vue-virtual-scroll-list v2.3.3
33
* open source under the MIT license
44
* https://github.com/tangbc/vue-virtual-scroll-list#readme
55
*/
@@ -34,6 +34,55 @@
3434
return Constructor;
3535
}
3636

37+
function _defineProperty(obj, key, value) {
38+
if (key in obj) {
39+
Object.defineProperty(obj, key, {
40+
value: value,
41+
enumerable: true,
42+
configurable: true,
43+
writable: true
44+
});
45+
} else {
46+
obj[key] = value;
47+
}
48+
49+
return obj;
50+
}
51+
52+
function ownKeys(object, enumerableOnly) {
53+
var keys = Object.keys(object);
54+
55+
if (Object.getOwnPropertySymbols) {
56+
var symbols = Object.getOwnPropertySymbols(object);
57+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
58+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
59+
});
60+
keys.push.apply(keys, symbols);
61+
}
62+
63+
return keys;
64+
}
65+
66+
function _objectSpread2(target) {
67+
for (var i = 1; i < arguments.length; i++) {
68+
var source = arguments[i] != null ? arguments[i] : {};
69+
70+
if (i % 2) {
71+
ownKeys(Object(source), true).forEach(function (key) {
72+
_defineProperty(target, key, source[key]);
73+
});
74+
} else if (Object.getOwnPropertyDescriptors) {
75+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
76+
} else {
77+
ownKeys(Object(source)).forEach(function (key) {
78+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
79+
});
80+
}
81+
}
82+
83+
return target;
84+
}
85+
3786
function _toConsumableArray(arr) {
3887
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
3988
}
@@ -81,7 +130,7 @@
81130
FIXED: 'FIXED',
82131
DYNAMIC: 'DYNAMIC'
83132
};
84-
var LEADING_BUFFER = 2;
133+
var LEADING_BUFFER = 0;
85134

86135
var Virtual = /*#__PURE__*/function () {
87136
function Virtual(param, callUpdate) {
@@ -536,6 +585,9 @@
536585
component: {
537586
type: [Object, Function]
538587
},
588+
slotComponent: {
589+
type: Function
590+
},
539591
uniqueKey: {
540592
type: [String, Number]
541593
},
@@ -561,10 +613,6 @@
561613
}
562614
};
563615

564-
/**
565-
* item and slot component both use similar wrapper
566-
* we need to know their size change at any time
567-
*/
568616
var Wrapper = {
569617
created: function created() {
570618
this.shapeKey = this.horizontal ? 'offsetWidth' : 'offsetHeight';
@@ -609,18 +657,28 @@
609657
_this$extraProps = this.extraProps,
610658
extraProps = _this$extraProps === void 0 ? {} : _this$extraProps,
611659
index = this.index,
660+
source = this.source,
612661
_this$scopedSlots = this.scopedSlots,
613662
scopedSlots = _this$scopedSlots === void 0 ? {} : _this$scopedSlots,
614-
uniqueKey = this.uniqueKey;
615-
extraProps.source = this.source;
616-
extraProps.index = index;
663+
uniqueKey = this.uniqueKey,
664+
slotComponent = this.slotComponent;
665+
666+
var props = _objectSpread2({}, extraProps, {
667+
source: source,
668+
index: index
669+
});
670+
617671
return h(tag, {
618672
key: uniqueKey,
619673
attrs: {
620674
role: 'listitem'
621675
}
622-
}, [h(component, {
623-
props: extraProps,
676+
}, [slotComponent ? h('div', slotComponent({
677+
item: source,
678+
index: index,
679+
scope: props
680+
})) : h(component, {
681+
props: props,
624682
scopedSlots: scopedSlots
625683
})]);
626684
}
@@ -649,9 +707,9 @@
649707
SLOT: 'slot_resize'
650708
};
651709
var SLOT_TYPE = {
652-
HEADER: 'header',
710+
HEADER: 'thead',
653711
// string value also use for aria role attribute
654-
FOOTER: 'footer'
712+
FOOTER: 'tfoot'
655713
};
656714
var VirtualList = Vue.component('virtual-list', {
657715
props: VirtualProps,
@@ -894,6 +952,7 @@
894952
extraProps = this.extraProps,
895953
dataComponent = this.dataComponent,
896954
itemScopedSlots = this.itemScopedSlots;
955+
var slotComponent = this.$scopedSlots && this.$scopedSlots.item;
897956

898957
for (var index = start; index <= end; index++) {
899958
var dataSource = dataSources[index];
@@ -912,6 +971,7 @@
912971
source: dataSource,
913972
extraProps: extraProps,
914973
component: dataComponent,
974+
slotComponent: slotComponent,
915975
scopedSlots: itemScopedSlots
916976
},
917977
style: itemStyle,

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-virtual-scroll-list",
3-
"version": "2.3.2",
3+
"version": "2.3.3",
44
"description": "A vue component support big amount data list with high scroll performance.",
55
"main": "dist/index.js",
66
"files": [

0 commit comments

Comments
 (0)