|
1 | 1 | /*!
|
2 |
| - * vue-virtual-scroll-list v2.3.1 |
| 2 | + * vue-virtual-scroll-list v2.3.2 |
3 | 3 | * open source under the MIT license
|
4 | 4 | * https://github.com/tangbc/vue-virtual-scroll-list#readme
|
5 | 5 | */
|
|
34 | 34 | return Constructor;
|
35 | 35 | }
|
36 | 36 |
|
| 37 | + function _toConsumableArray(arr) { |
| 38 | + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); |
| 39 | + } |
| 40 | + |
| 41 | + function _arrayWithoutHoles(arr) { |
| 42 | + if (Array.isArray(arr)) return _arrayLikeToArray(arr); |
| 43 | + } |
| 44 | + |
| 45 | + function _iterableToArray(iter) { |
| 46 | + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
| 47 | + } |
| 48 | + |
| 49 | + function _unsupportedIterableToArray(o, minLen) { |
| 50 | + if (!o) return; |
| 51 | + if (typeof o === "string") return _arrayLikeToArray(o, minLen); |
| 52 | + var n = Object.prototype.toString.call(o).slice(8, -1); |
| 53 | + if (n === "Object" && o.constructor) n = o.constructor.name; |
| 54 | + if (n === "Map" || n === "Set") return Array.from(n); |
| 55 | + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); |
| 56 | + } |
| 57 | + |
| 58 | + function _arrayLikeToArray(arr, len) { |
| 59 | + if (len == null || len > arr.length) len = arr.length; |
| 60 | + |
| 61 | + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; |
| 62 | + |
| 63 | + return arr2; |
| 64 | + } |
| 65 | + |
| 66 | + function _nonIterableSpread() { |
| 67 | + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 68 | + } |
| 69 | + |
37 | 70 | /**
|
38 | 71 | * virtual list core calculating center
|
39 | 72 | */
|
|
153 | 186 |
|
154 | 187 | if (this.calcType !== CALC_TYPE.FIXED && typeof this.firstRangeTotalSize !== 'undefined') {
|
155 | 188 | if (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length)) {
|
156 |
| - this.firstRangeTotalSize = this.firstRangeTotalSize + size; |
| 189 | + this.firstRangeTotalSize = _toConsumableArray(this.sizes.values()).reduce(function (acc, val) { |
| 190 | + return acc + val; |
| 191 | + }, 0); |
157 | 192 | this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size);
|
158 | 193 | } else {
|
159 | 194 | // it's done using
|
|
190 | 225 | this.direction = offset < this.offset ? DIRECTION_TYPE.FRONT : DIRECTION_TYPE.BEHIND;
|
191 | 226 | this.offset = offset;
|
192 | 227 |
|
| 228 | + if (!this.param) { |
| 229 | + return; |
| 230 | + } |
| 231 | + |
193 | 232 | if (this.direction === DIRECTION_TYPE.FRONT) {
|
194 | 233 | this.handleFront();
|
195 | 234 | } else if (this.direction === DIRECTION_TYPE.BEHIND) {
|
|
202 | 241 | value: function handleFront() {
|
203 | 242 | var overs = this.getScrollOvers(); // should not change range if start doesn't exceed overs
|
204 | 243 |
|
205 |
| - if (overs > this.range.start || !this.param) { |
| 244 | + if (overs > this.range.start) { |
206 | 245 | return;
|
207 | 246 | } // move up start by a buffer length, and make sure its safety
|
208 | 247 |
|
|
0 commit comments