Skip to content

Commit 618098a

Browse files
author
Guillaume Chau
committed
chore: v0.11.8
1 parent b00a84a commit 618098a

File tree

5 files changed

+63
-9
lines changed

5 files changed

+63
-9
lines changed

dist/vue-virtual-scroller.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-virtual-scroller.esm.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
var config = {
2+
itemsLimit: 1000
3+
};
4+
15
function getInternetExplorerVersion() {
26
var ua = window.navigator.userAgent;
37

@@ -336,6 +340,15 @@ var Scroller = {
336340
},
337341
scrollToPosition: function scrollToPosition(position) {
338342
this.$el.scrollTop = position;
343+
},
344+
itemsLimitError: function itemsLimitError() {
345+
var _this = this;
346+
347+
setTimeout(function () {
348+
console.log('It seems the scroller element isn\'t scrolling, so it tries to render all the items at once.', 'Scroller:', _this.$el);
349+
console.log('Make sure the scroller has a fixed height and \'overflow-y\' set to \'auto\' so it can scroll correctly and only render the items visible in the scroll viewport.');
350+
});
351+
throw new Error('Rendered items limit reached');
339352
}
340353
}
341354
};
@@ -348,7 +361,7 @@ var VirtualScroller = { render: function render() {
348361
}) : [_vm._l(_vm.visibleItems, function (item, index) {
349362
return _vm._t("default", null, { item: item, itemIndex: _vm.$_startIndex + index, itemKey: _vm.keysEnabled && item[_vm.keyField] || undefined });
350363
})]], 2), _vm._v(" "), _vm._t("after-content")], 2), _vm._v(" "), _vm._t("after-container"), _vm._v(" "), _c('resize-observer', { on: { "notify": _vm.handleResize } })], 2);
351-
}, staticRenderFns: [], _scopeId: 'data-v-2b1f2e05',
364+
}, staticRenderFns: [], _scopeId: 'data-v-727d6836',
352365
name: 'virtual-scroller',
353366

354367
mixins: [Scroller],
@@ -531,6 +544,10 @@ var VirtualScroller = { render: function render() {
531544
containerHeight = l * itemHeight;
532545
}
533546

547+
if (endIndex - startIndex > config.itemsLimit) {
548+
_this2.itemsLimitError();
549+
}
550+
534551
if (force || _this2.$_startIndex !== startIndex || _this2.$_endIndex !== endIndex || _this2.$_offsetTop !== offsetTop || _this2.$_height !== containerHeight || _this2.$_length !== l) {
535552
_this2.keysEnabled = !(startIndex > _this2.$_endIndex || endIndex < _this2.$_startIndex);
536553

@@ -604,7 +621,7 @@ var RecycleList = { render: function render() {
604621
} } }, [_c('div', { ref: "wrapper", staticClass: "item-wrapper", style: { height: _vm.totalHeight + 'px' } }, _vm._l(_vm.pool, function (view) {
605622
return _c('div', { key: view.nr.id, staticClass: "item-view", style: { transform: 'translateY(' + view.top + 'px)' } }, [_vm._t("default", null, { item: view.item, index: view.nr.index, active: view.nr.used })], 2);
606623
})), _vm._v(" "), _vm._t("after-container"), _vm._v(" "), _c('resize-observer', { on: { "notify": _vm.handleResize } })], 2);
607-
}, staticRenderFns: [], _scopeId: 'data-v-2277f571',
624+
}, staticRenderFns: [], _scopeId: 'data-v-68940351',
608625
name: 'RecycleList',
609626

610627
mixins: [Scroller],
@@ -827,6 +844,10 @@ var RecycleList = { render: function render() {
827844
}
828845
}
829846

847+
if (endIndex - startIndex > config.itemsLimit) {
848+
this.itemsLimitError();
849+
}
850+
830851
this.totalHeight = totalHeight;
831852

832853
var view = void 0;
@@ -948,13 +969,19 @@ function registerComponents(Vue, prefix) {
948969

949970
var plugin$4 = {
950971
// eslint-disable-next-line no-undef
951-
version: "0.11.7",
972+
version: "0.11.8",
952973
install: function install(Vue, options) {
953974
var finalOptions = Object.assign({}, {
954975
installComponents: true,
955976
componentsPrefix: ''
956977
}, options);
957978

979+
for (var key in finalOptions) {
980+
if (typeof finalOptions[key] !== 'undefined') {
981+
config[key] = finalOptions[key];
982+
}
983+
}
984+
958985
if (finalOptions.installComponents) {
959986
registerComponents(Vue, finalOptions.componentsPrefix);
960987
}

dist/vue-virtual-scroller.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-virtual-scroller.umd.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
(factory((global['vue-virtual-scroller'] = {})));
55
}(this, (function (exports) { 'use strict';
66

7+
var config = {
8+
itemsLimit: 1000
9+
};
10+
711
function getInternetExplorerVersion() {
812
var ua = window.navigator.userAgent;
913

@@ -342,6 +346,15 @@ var Scroller = {
342346
},
343347
scrollToPosition: function scrollToPosition(position) {
344348
this.$el.scrollTop = position;
349+
},
350+
itemsLimitError: function itemsLimitError() {
351+
var _this = this;
352+
353+
setTimeout(function () {
354+
console.log('It seems the scroller element isn\'t scrolling, so it tries to render all the items at once.', 'Scroller:', _this.$el);
355+
console.log('Make sure the scroller has a fixed height and \'overflow-y\' set to \'auto\' so it can scroll correctly and only render the items visible in the scroll viewport.');
356+
});
357+
throw new Error('Rendered items limit reached');
345358
}
346359
}
347360
};
@@ -354,7 +367,7 @@ var VirtualScroller = { render: function render() {
354367
}) : [_vm._l(_vm.visibleItems, function (item, index) {
355368
return _vm._t("default", null, { item: item, itemIndex: _vm.$_startIndex + index, itemKey: _vm.keysEnabled && item[_vm.keyField] || undefined });
356369
})]], 2), _vm._v(" "), _vm._t("after-content")], 2), _vm._v(" "), _vm._t("after-container"), _vm._v(" "), _c('resize-observer', { on: { "notify": _vm.handleResize } })], 2);
357-
}, staticRenderFns: [], _scopeId: 'data-v-2b1f2e05',
370+
}, staticRenderFns: [], _scopeId: 'data-v-727d6836',
358371
name: 'virtual-scroller',
359372

360373
mixins: [Scroller],
@@ -537,6 +550,10 @@ var VirtualScroller = { render: function render() {
537550
containerHeight = l * itemHeight;
538551
}
539552

553+
if (endIndex - startIndex > config.itemsLimit) {
554+
_this2.itemsLimitError();
555+
}
556+
540557
if (force || _this2.$_startIndex !== startIndex || _this2.$_endIndex !== endIndex || _this2.$_offsetTop !== offsetTop || _this2.$_height !== containerHeight || _this2.$_length !== l) {
541558
_this2.keysEnabled = !(startIndex > _this2.$_endIndex || endIndex < _this2.$_startIndex);
542559

@@ -610,7 +627,7 @@ var RecycleList = { render: function render() {
610627
} } }, [_c('div', { ref: "wrapper", staticClass: "item-wrapper", style: { height: _vm.totalHeight + 'px' } }, _vm._l(_vm.pool, function (view) {
611628
return _c('div', { key: view.nr.id, staticClass: "item-view", style: { transform: 'translateY(' + view.top + 'px)' } }, [_vm._t("default", null, { item: view.item, index: view.nr.index, active: view.nr.used })], 2);
612629
})), _vm._v(" "), _vm._t("after-container"), _vm._v(" "), _c('resize-observer', { on: { "notify": _vm.handleResize } })], 2);
613-
}, staticRenderFns: [], _scopeId: 'data-v-2277f571',
630+
}, staticRenderFns: [], _scopeId: 'data-v-68940351',
614631
name: 'RecycleList',
615632

616633
mixins: [Scroller],
@@ -833,6 +850,10 @@ var RecycleList = { render: function render() {
833850
}
834851
}
835852

853+
if (endIndex - startIndex > config.itemsLimit) {
854+
this.itemsLimitError();
855+
}
856+
836857
this.totalHeight = totalHeight;
837858

838859
var view = void 0;
@@ -954,13 +975,19 @@ function registerComponents(Vue, prefix) {
954975

955976
var plugin$4 = {
956977
// eslint-disable-next-line no-undef
957-
version: "0.11.7",
978+
version: "0.11.8",
958979
install: function install(Vue, options) {
959980
var finalOptions = Object.assign({}, {
960981
installComponents: true,
961982
componentsPrefix: ''
962983
}, options);
963984

985+
for (var key in finalOptions) {
986+
if (typeof finalOptions[key] !== 'undefined') {
987+
config[key] = finalOptions[key];
988+
}
989+
}
990+
964991
if (finalOptions.installComponents) {
965992
registerComponents(Vue, finalOptions.componentsPrefix);
966993
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-virtual-scroller",
33
"description": "Smooth scrolling for any amount of data",
4-
"version": "0.11.7",
4+
"version": "0.11.8",
55
"author": {
66
"name": "Guillaume Chau",
77
"email": "[email protected]"

0 commit comments

Comments
 (0)