Socket
Socket
Sign inDemoInstall

react-tiny-virtual-list-oss

Package Overview
Dependencies
6
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 2.3.1

100

build/react-tiny-virtual-list.cjs.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');

@@ -85,31 +83,2 @@ var PropTypes = require('prop-types');

var _a;
var _b;
var _c;
var _d;
var _e;
var ALIGNMENT;
(function (ALIGNMENT) {
ALIGNMENT["AUTO"] = "auto";
ALIGNMENT["START"] = "start";
ALIGNMENT["CENTER"] = "center";
ALIGNMENT["END"] = "end";
})(ALIGNMENT || (ALIGNMENT = {}));
(function (DIRECTION) {
DIRECTION["HORIZONTAL"] = "horizontal";
DIRECTION["VERTICAL"] = "vertical";
})(exports.ScrollDirection || (exports.ScrollDirection = {}));
var SCROLL_CHANGE_REASON;
(function (SCROLL_CHANGE_REASON) {
SCROLL_CHANGE_REASON["OBSERVED"] = "observed";
SCROLL_CHANGE_REASON["REQUESTED"] = "requested";
})(SCROLL_CHANGE_REASON || (SCROLL_CHANGE_REASON = {}));
var scrollProp = (_a = {}, _a[DIRECTION.VERTICAL] = 'scrollTop', _a[DIRECTION.HORIZONTAL] = 'scrollLeft', _a);
var sizeProp = (_b = {}, _b[DIRECTION.VERTICAL] = 'height', _b[DIRECTION.HORIZONTAL] = 'width', _b);
var positionProp = (_c = {}, _c[DIRECTION.VERTICAL] = 'top', _c[DIRECTION.HORIZONTAL] = 'left', _c);
var marginProp = (_d = {}, _d[DIRECTION.VERTICAL] = 'marginTop', _d[DIRECTION.HORIZONTAL] = 'marginLeft', _d);
var oppositeMarginProp = (_e = {}, _e[DIRECTION.VERTICAL] = 'marginBottom', _e[DIRECTION.HORIZONTAL] = 'marginRight', _e);
/* Forked from react-virtualized 💖 */
var SizeAndPositionManager = /** @class */function () {

@@ -192,3 +161,3 @@ function SizeAndPositionManager(_a) {

var _b = _a.align,
align = _b === void 0 ? ALIGNMENT.START : _b,
align = _b === void 0 ? "start" /* START */ : _b,
containerSize = _a.containerSize,

@@ -205,9 +174,9 @@ currentOffset = _a.currentOffset,

switch (align) {
case ALIGNMENT.END:
case "end" /* END */:
idealOffset = minOffset;
break;
case ALIGNMENT.CENTER:
case "center" /* CENTER */:
idealOffset = maxOffset - (containerSize - datum.size) / 2;
break;
case ALIGNMENT.START:
case "start" /* START */:
idealOffset = maxOffset;

@@ -329,2 +298,13 @@ break;

var _a;
var _b;
var _c;
var _d;
var _e;
var scrollProp = (_a = {}, _a["vertical" /* VERTICAL */] = 'scrollTop', _a["horizontal" /* HORIZONTAL */] = 'scrollLeft', _a);
var sizeProp = (_b = {}, _b["vertical" /* VERTICAL */] = 'height', _b["horizontal" /* HORIZONTAL */] = 'width', _b);
var positionProp = (_c = {}, _c["vertical" /* VERTICAL */] = 'top', _c["horizontal" /* HORIZONTAL */] = 'left', _c);
var marginProp = (_d = {}, _d["vertical" /* VERTICAL */] = 'marginTop', _d["horizontal" /* HORIZONTAL */] = 'marginLeft', _d);
var oppositeMarginProp = (_e = {}, _e["vertical" /* VERTICAL */] = 'marginBottom', _e["horizontal" /* HORIZONTAL */] = 'marginRight', _e);
var STYLE_WRAPPER = {

@@ -364,3 +344,3 @@ overflow: 'auto',

offset: _this.props.scrollOffset || _this.props.scrollToIndex != null && _this.getOffsetForIndex(_this.props.scrollToIndex) || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
};

@@ -379,3 +359,3 @@ _this.styleCache = {};

offset: offset,
scrollChangeReason: SCROLL_CHANGE_REASON.OBSERVED
scrollChangeReason: "observed" /* OBSERVED */
});

@@ -428,3 +408,3 @@ if (typeof onScroll === 'function') {

offset: nextProps.scrollOffset || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
});

@@ -434,3 +414,3 @@ } else if (typeof nextProps.scrollToIndex === 'number' && (scrollPropsHaveChanged || itemPropsHaveChanged)) {

offset: this.getOffsetForIndex(nextProps.scrollToIndex, nextProps.scrollToAlignment, nextProps.itemCount),
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
});

@@ -443,5 +423,5 @@ }

scrollChangeReason = _a.scrollChangeReason;
if (prevState.offset !== offset && scrollChangeReason === SCROLL_CHANGE_REASON.REQUESTED) {
this.scrollTo(offset);
}
if (prevState.offset !== offset && scrollChangeReason === "requested" /* REQUESTED */) {
this.scrollTo(offset);
}
};

@@ -453,3 +433,3 @@ VirtualList.prototype.componentWillUnmount = function () {

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? exports.ScrollDirection.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
this.rootNode[scrollProp[scrollDirection]] = value;

@@ -465,3 +445,3 @@ };

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? exports.ScrollDirection.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
if (index < 0 || index >= itemCount) {

@@ -494,3 +474,5 @@ index = 0;

scrollDirection = _a.scrollDirection,
restProps = __rest(_a, ["scrollToAlignment", "scrollOffset", "itemCount", "itemSize", "onScroll", "renderItem", "overscanCount", "scrollDirection"]);
stickyIndices = _a.stickyIndices,
scrollToIndex = _a.scrollToIndex,
restProps = __rest(_a, ["scrollToAlignment", "scrollOffset", "itemCount", "itemSize", "onScroll", "renderItem", "overscanCount", "scrollDirection", "stickyIndices", "scrollToIndex"]);
return restProps;

@@ -508,3 +490,3 @@ };

_d = _b.scrollDirection,
scrollDirection = _d === void 0 ? exports.ScrollDirection.VERTICAL : _d,
scrollDirection = _d === void 0 ? "vertical" /* VERTICAL */ : _d,
stickyIndices = _b.stickyIndices,

@@ -531,5 +513,5 @@ style = _b.style,

});
if (scrollDirection === exports.ScrollDirection.HORIZONTAL) {
innerStyle.display = 'flex';
}
if (scrollDirection === "horizontal" /* HORIZONTAL */) {
innerStyle.display = 'flex';
}
}

@@ -557,3 +539,3 @@ if (typeof start !== 'undefined' && typeof stop !== 'undefined') {

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? exports.ScrollDirection.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
return this.rootNode[scrollProp[scrollDirection]];

@@ -580,3 +562,3 @@ };

var _c = this.props.scrollDirection,
scrollDirection = _c === void 0 ? exports.ScrollDirection.VERTICAL : _c;
scrollDirection = _c === void 0 ? "vertical" /* VERTICAL */ : _c;
var _d = this.sizeAndPositionManager.getSizeAndPositionForIndex(index),

@@ -589,4 +571,4 @@ size = _d.size,

overscanCount: 3,
scrollDirection: exports.ScrollDirection.VERTICAL,
width: '100%'
scrollDirection: "vertical" /* VERTICAL */
, width: '100%'
};

@@ -604,4 +586,10 @@ VirtualList.propTypes = {

scrollToIndex: PropTypes.number,
scrollToAlignment: PropTypes.oneOf([ALIGNMENT.AUTO, ALIGNMENT.START, ALIGNMENT.CENTER, ALIGNMENT.END]),
scrollDirection: PropTypes.oneOf([exports.ScrollDirection.HORIZONTAL, exports.ScrollDirection.VERTICAL]),
scrollToAlignment: PropTypes.oneOf(["auto" /* AUTO */
, "start" /* START */
, "center" /* CENTER */
, "end" /* END */
]),
scrollDirection: PropTypes.oneOf(["horizontal" /* HORIZONTAL */
, "vertical" /* VERTICAL */
]),
stickyIndices: PropTypes.arrayOf(PropTypes.number),

@@ -614,2 +602,2 @@ style: PropTypes.object,

exports['default'] = VirtualList;
module.exports = VirtualList;

@@ -81,31 +81,2 @@ import { PureComponent, createElement } from 'react';

var _a;
var _b;
var _c;
var _d;
var _e;
var ALIGNMENT;
(function (ALIGNMENT) {
ALIGNMENT["AUTO"] = "auto";
ALIGNMENT["START"] = "start";
ALIGNMENT["CENTER"] = "center";
ALIGNMENT["END"] = "end";
})(ALIGNMENT || (ALIGNMENT = {}));
var DIRECTION;
(function (DIRECTION) {
DIRECTION["HORIZONTAL"] = "horizontal";
DIRECTION["VERTICAL"] = "vertical";
})(DIRECTION || (DIRECTION = {}));
var SCROLL_CHANGE_REASON;
(function (SCROLL_CHANGE_REASON) {
SCROLL_CHANGE_REASON["OBSERVED"] = "observed";
SCROLL_CHANGE_REASON["REQUESTED"] = "requested";
})(SCROLL_CHANGE_REASON || (SCROLL_CHANGE_REASON = {}));
var scrollProp = (_a = {}, _a[DIRECTION.VERTICAL] = 'scrollTop', _a[DIRECTION.HORIZONTAL] = 'scrollLeft', _a);
var sizeProp = (_b = {}, _b[DIRECTION.VERTICAL] = 'height', _b[DIRECTION.HORIZONTAL] = 'width', _b);
var positionProp = (_c = {}, _c[DIRECTION.VERTICAL] = 'top', _c[DIRECTION.HORIZONTAL] = 'left', _c);
var marginProp = (_d = {}, _d[DIRECTION.VERTICAL] = 'marginTop', _d[DIRECTION.HORIZONTAL] = 'marginLeft', _d);
var oppositeMarginProp = (_e = {}, _e[DIRECTION.VERTICAL] = 'marginBottom', _e[DIRECTION.HORIZONTAL] = 'marginRight', _e);
/* Forked from react-virtualized 💖 */
var SizeAndPositionManager = /** @class */function () {

@@ -188,3 +159,3 @@ function SizeAndPositionManager(_a) {

var _b = _a.align,
align = _b === void 0 ? ALIGNMENT.START : _b,
align = _b === void 0 ? "start" /* START */ : _b,
containerSize = _a.containerSize,

@@ -201,9 +172,9 @@ currentOffset = _a.currentOffset,

switch (align) {
case ALIGNMENT.END:
case "end" /* END */:
idealOffset = minOffset;
break;
case ALIGNMENT.CENTER:
case "center" /* CENTER */:
idealOffset = maxOffset - (containerSize - datum.size) / 2;
break;
case ALIGNMENT.START:
case "start" /* START */:
idealOffset = maxOffset;

@@ -325,2 +296,13 @@ break;

var _a;
var _b;
var _c;
var _d;
var _e;
var scrollProp = (_a = {}, _a["vertical" /* VERTICAL */] = 'scrollTop', _a["horizontal" /* HORIZONTAL */] = 'scrollLeft', _a);
var sizeProp = (_b = {}, _b["vertical" /* VERTICAL */] = 'height', _b["horizontal" /* HORIZONTAL */] = 'width', _b);
var positionProp = (_c = {}, _c["vertical" /* VERTICAL */] = 'top', _c["horizontal" /* HORIZONTAL */] = 'left', _c);
var marginProp = (_d = {}, _d["vertical" /* VERTICAL */] = 'marginTop', _d["horizontal" /* HORIZONTAL */] = 'marginLeft', _d);
var oppositeMarginProp = (_e = {}, _e["vertical" /* VERTICAL */] = 'marginBottom', _e["horizontal" /* HORIZONTAL */] = 'marginRight', _e);
var STYLE_WRAPPER = {

@@ -360,3 +342,3 @@ overflow: 'auto',

offset: _this.props.scrollOffset || _this.props.scrollToIndex != null && _this.getOffsetForIndex(_this.props.scrollToIndex) || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
};

@@ -375,3 +357,3 @@ _this.styleCache = {};

offset: offset,
scrollChangeReason: SCROLL_CHANGE_REASON.OBSERVED
scrollChangeReason: "observed" /* OBSERVED */
});

@@ -424,3 +406,3 @@ if (typeof onScroll === 'function') {

offset: nextProps.scrollOffset || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
});

@@ -430,3 +412,3 @@ } else if (typeof nextProps.scrollToIndex === 'number' && (scrollPropsHaveChanged || itemPropsHaveChanged)) {

offset: this.getOffsetForIndex(nextProps.scrollToIndex, nextProps.scrollToAlignment, nextProps.itemCount),
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
});

@@ -439,5 +421,5 @@ }

scrollChangeReason = _a.scrollChangeReason;
if (prevState.offset !== offset && scrollChangeReason === SCROLL_CHANGE_REASON.REQUESTED) {
this.scrollTo(offset);
}
if (prevState.offset !== offset && scrollChangeReason === "requested" /* REQUESTED */) {
this.scrollTo(offset);
}
};

@@ -449,3 +431,3 @@ VirtualList.prototype.componentWillUnmount = function () {

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
this.rootNode[scrollProp[scrollDirection]] = value;

@@ -461,3 +443,3 @@ };

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
if (index < 0 || index >= itemCount) {

@@ -490,3 +472,5 @@ index = 0;

scrollDirection = _a.scrollDirection,
restProps = __rest(_a, ["scrollToAlignment", "scrollOffset", "itemCount", "itemSize", "onScroll", "renderItem", "overscanCount", "scrollDirection"]);
stickyIndices = _a.stickyIndices,
scrollToIndex = _a.scrollToIndex,
restProps = __rest(_a, ["scrollToAlignment", "scrollOffset", "itemCount", "itemSize", "onScroll", "renderItem", "overscanCount", "scrollDirection", "stickyIndices", "scrollToIndex"]);
return restProps;

@@ -504,3 +488,3 @@ };

_d = _b.scrollDirection,
scrollDirection = _d === void 0 ? DIRECTION.VERTICAL : _d,
scrollDirection = _d === void 0 ? "vertical" /* VERTICAL */ : _d,
stickyIndices = _b.stickyIndices,

@@ -527,5 +511,5 @@ style = _b.style,

});
if (scrollDirection === DIRECTION.HORIZONTAL) {
innerStyle.display = 'flex';
}
if (scrollDirection === "horizontal" /* HORIZONTAL */) {
innerStyle.display = 'flex';
}
}

@@ -553,3 +537,3 @@ if (typeof start !== 'undefined' && typeof stop !== 'undefined') {

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
return this.rootNode[scrollProp[scrollDirection]];

@@ -576,3 +560,3 @@ };

var _c = this.props.scrollDirection,
scrollDirection = _c === void 0 ? DIRECTION.VERTICAL : _c;
scrollDirection = _c === void 0 ? "vertical" /* VERTICAL */ : _c;
var _d = this.sizeAndPositionManager.getSizeAndPositionForIndex(index),

@@ -585,4 +569,4 @@ size = _d.size,

overscanCount: 3,
scrollDirection: DIRECTION.VERTICAL,
width: '100%'
scrollDirection: "vertical" /* VERTICAL */
, width: '100%'
};

@@ -600,4 +584,10 @@ VirtualList.propTypes = {

scrollToIndex: number,
scrollToAlignment: oneOf([ALIGNMENT.AUTO, ALIGNMENT.START, ALIGNMENT.CENTER, ALIGNMENT.END]),
scrollDirection: oneOf([DIRECTION.HORIZONTAL, DIRECTION.VERTICAL]),
scrollToAlignment: oneOf(["auto" /* AUTO */
, "start" /* START */
, "center" /* CENTER */
, "end" /* END */
]),
scrollDirection: oneOf(["horizontal" /* HORIZONTAL */
, "vertical" /* VERTICAL */
]),
stickyIndices: arrayOf(number),

@@ -610,3 +600,2 @@ style: object,

export { DIRECTION as ScrollDirection };
export default VirtualList;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('prop-types')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'prop-types'], factory) :
(factory((global.VirtualList = {}),global.React,global.PropTypes));
}(this, (function (exports,React,PropTypes) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('prop-types')) :
typeof define === 'function' && define.amd ? define(['react', 'prop-types'], factory) :
(global.VirtualList = factory(global.React,global.PropTypes));
}(this, (function (React,PropTypes) { 'use strict';

@@ -84,31 +84,2 @@ /*! *****************************************************************************

var _a;
var _b;
var _c;
var _d;
var _e;
var ALIGNMENT;
(function (ALIGNMENT) {
ALIGNMENT["AUTO"] = "auto";
ALIGNMENT["START"] = "start";
ALIGNMENT["CENTER"] = "center";
ALIGNMENT["END"] = "end";
})(ALIGNMENT || (ALIGNMENT = {}));
(function (DIRECTION) {
DIRECTION["HORIZONTAL"] = "horizontal";
DIRECTION["VERTICAL"] = "vertical";
})(exports.ScrollDirection || (exports.ScrollDirection = {}));
var SCROLL_CHANGE_REASON;
(function (SCROLL_CHANGE_REASON) {
SCROLL_CHANGE_REASON["OBSERVED"] = "observed";
SCROLL_CHANGE_REASON["REQUESTED"] = "requested";
})(SCROLL_CHANGE_REASON || (SCROLL_CHANGE_REASON = {}));
var scrollProp = (_a = {}, _a[DIRECTION.VERTICAL] = 'scrollTop', _a[DIRECTION.HORIZONTAL] = 'scrollLeft', _a);
var sizeProp = (_b = {}, _b[DIRECTION.VERTICAL] = 'height', _b[DIRECTION.HORIZONTAL] = 'width', _b);
var positionProp = (_c = {}, _c[DIRECTION.VERTICAL] = 'top', _c[DIRECTION.HORIZONTAL] = 'left', _c);
var marginProp = (_d = {}, _d[DIRECTION.VERTICAL] = 'marginTop', _d[DIRECTION.HORIZONTAL] = 'marginLeft', _d);
var oppositeMarginProp = (_e = {}, _e[DIRECTION.VERTICAL] = 'marginBottom', _e[DIRECTION.HORIZONTAL] = 'marginRight', _e);
/* Forked from react-virtualized 💖 */
var SizeAndPositionManager = /** @class */function () {

@@ -191,3 +162,3 @@ function SizeAndPositionManager(_a) {

var _b = _a.align,
align = _b === void 0 ? ALIGNMENT.START : _b,
align = _b === void 0 ? "start" /* START */ : _b,
containerSize = _a.containerSize,

@@ -204,9 +175,9 @@ currentOffset = _a.currentOffset,

switch (align) {
case ALIGNMENT.END:
case "end" /* END */:
idealOffset = minOffset;
break;
case ALIGNMENT.CENTER:
case "center" /* CENTER */:
idealOffset = maxOffset - (containerSize - datum.size) / 2;
break;
case ALIGNMENT.START:
case "start" /* START */:
idealOffset = maxOffset;

@@ -328,2 +299,13 @@ break;

var _a;
var _b;
var _c;
var _d;
var _e;
var scrollProp = (_a = {}, _a["vertical" /* VERTICAL */] = 'scrollTop', _a["horizontal" /* HORIZONTAL */] = 'scrollLeft', _a);
var sizeProp = (_b = {}, _b["vertical" /* VERTICAL */] = 'height', _b["horizontal" /* HORIZONTAL */] = 'width', _b);
var positionProp = (_c = {}, _c["vertical" /* VERTICAL */] = 'top', _c["horizontal" /* HORIZONTAL */] = 'left', _c);
var marginProp = (_d = {}, _d["vertical" /* VERTICAL */] = 'marginTop', _d["horizontal" /* HORIZONTAL */] = 'marginLeft', _d);
var oppositeMarginProp = (_e = {}, _e["vertical" /* VERTICAL */] = 'marginBottom', _e["horizontal" /* HORIZONTAL */] = 'marginRight', _e);
var STYLE_WRAPPER = {

@@ -363,3 +345,3 @@ overflow: 'auto',

offset: _this.props.scrollOffset || _this.props.scrollToIndex != null && _this.getOffsetForIndex(_this.props.scrollToIndex) || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
};

@@ -378,3 +360,3 @@ _this.styleCache = {};

offset: offset,
scrollChangeReason: SCROLL_CHANGE_REASON.OBSERVED
scrollChangeReason: "observed" /* OBSERVED */
});

@@ -427,3 +409,3 @@ if (typeof onScroll === 'function') {

offset: nextProps.scrollOffset || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
});

@@ -433,3 +415,3 @@ } else if (typeof nextProps.scrollToIndex === 'number' && (scrollPropsHaveChanged || itemPropsHaveChanged)) {

offset: this.getOffsetForIndex(nextProps.scrollToIndex, nextProps.scrollToAlignment, nextProps.itemCount),
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
scrollChangeReason: "requested" /* REQUESTED */
});

@@ -442,5 +424,5 @@ }

scrollChangeReason = _a.scrollChangeReason;
if (prevState.offset !== offset && scrollChangeReason === SCROLL_CHANGE_REASON.REQUESTED) {
this.scrollTo(offset);
}
if (prevState.offset !== offset && scrollChangeReason === "requested" /* REQUESTED */) {
this.scrollTo(offset);
}
};

@@ -452,3 +434,3 @@ VirtualList.prototype.componentWillUnmount = function () {

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? exports.ScrollDirection.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
this.rootNode[scrollProp[scrollDirection]] = value;

@@ -464,3 +446,3 @@ };

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? exports.ScrollDirection.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
if (index < 0 || index >= itemCount) {

@@ -493,3 +475,5 @@ index = 0;

scrollDirection = _a.scrollDirection,
restProps = __rest(_a, ["scrollToAlignment", "scrollOffset", "itemCount", "itemSize", "onScroll", "renderItem", "overscanCount", "scrollDirection"]);
stickyIndices = _a.stickyIndices,
scrollToIndex = _a.scrollToIndex,
restProps = __rest(_a, ["scrollToAlignment", "scrollOffset", "itemCount", "itemSize", "onScroll", "renderItem", "overscanCount", "scrollDirection", "stickyIndices", "scrollToIndex"]);
return restProps;

@@ -507,3 +491,3 @@ };

_d = _b.scrollDirection,
scrollDirection = _d === void 0 ? exports.ScrollDirection.VERTICAL : _d,
scrollDirection = _d === void 0 ? "vertical" /* VERTICAL */ : _d,
stickyIndices = _b.stickyIndices,

@@ -530,5 +514,5 @@ style = _b.style,

});
if (scrollDirection === exports.ScrollDirection.HORIZONTAL) {
innerStyle.display = 'flex';
}
if (scrollDirection === "horizontal" /* HORIZONTAL */) {
innerStyle.display = 'flex';
}
}

@@ -556,3 +540,3 @@ if (typeof start !== 'undefined' && typeof stop !== 'undefined') {

var _a = this.props.scrollDirection,
scrollDirection = _a === void 0 ? exports.ScrollDirection.VERTICAL : _a;
scrollDirection = _a === void 0 ? "vertical" /* VERTICAL */ : _a;
return this.rootNode[scrollProp[scrollDirection]];

@@ -579,3 +563,3 @@ };

var _c = this.props.scrollDirection,
scrollDirection = _c === void 0 ? exports.ScrollDirection.VERTICAL : _c;
scrollDirection = _c === void 0 ? "vertical" /* VERTICAL */ : _c;
var _d = this.sizeAndPositionManager.getSizeAndPositionForIndex(index),

@@ -588,4 +572,4 @@ size = _d.size,

overscanCount: 3,
scrollDirection: exports.ScrollDirection.VERTICAL,
width: '100%'
scrollDirection: "vertical" /* VERTICAL */
, width: '100%'
};

@@ -603,4 +587,10 @@ VirtualList.propTypes = {

scrollToIndex: PropTypes.number,
scrollToAlignment: PropTypes.oneOf([ALIGNMENT.AUTO, ALIGNMENT.START, ALIGNMENT.CENTER, ALIGNMENT.END]),
scrollDirection: PropTypes.oneOf([exports.ScrollDirection.HORIZONTAL, exports.ScrollDirection.VERTICAL]),
scrollToAlignment: PropTypes.oneOf(["auto" /* AUTO */
, "start" /* START */
, "center" /* CENTER */
, "end" /* END */
]),
scrollDirection: PropTypes.oneOf(["horizontal" /* HORIZONTAL */
, "vertical" /* VERTICAL */
]),
stickyIndices: PropTypes.arrayOf(PropTypes.number),

@@ -613,6 +603,4 @@ style: PropTypes.object,

exports['default'] = VirtualList;
return VirtualList;
Object.defineProperty(exports, '__esModule', { value: true });
})));

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],e):e(t.VirtualList={},t.React,t.PropTypes)}(this,function(t,e,o){"use strict";function i(t,e){function o(){this.constructor=t}if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");u(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}function n(t,e){var o={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(o[i[n]]=t[i[n]]);return o}var r,s,a,l,f,c,u=function(t,e){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)},d=function(){return(d=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++){e=arguments[o];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)};!function(t){t.AUTO="auto",t.START="start",t.CENTER="center",t.END="end"}(c||(c={})),function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(t.ScrollDirection||(t.ScrollDirection={}));var p;!function(t){t.OBSERVED="observed",t.REQUESTED="requested"}(p||(p={}));var h=(r={},r[DIRECTION.VERTICAL]="scrollTop",r[DIRECTION.HORIZONTAL]="scrollLeft",r),m=(s={},s[DIRECTION.VERTICAL]="height",s[DIRECTION.HORIZONTAL]="width",s),I=(a={},a[DIRECTION.VERTICAL]="top",a[DIRECTION.HORIZONTAL]="left",a),S=(l={},l[DIRECTION.VERTICAL]="marginTop",l[DIRECTION.HORIZONTAL]="marginLeft",l),g=(f={},f[DIRECTION.VERTICAL]="marginBottom",f[DIRECTION.HORIZONTAL]="marginRight",f),y=function(){function t(t){var e=t.itemCount,o=t.itemSizeGetter,i=t.estimatedItemSize;this.itemSizeGetter=o,this.itemCount=e,this.estimatedItemSize=i,this.itemSizeAndPositionData={},this.lastMeasuredIndex=-1}return t.prototype.updateConfig=function(t){var e=t.itemCount,o=t.itemSizeGetter,i=t.estimatedItemSize;null!=e&&(this.itemCount=e),null!=i&&(this.estimatedItemSize=i),null!=o&&(this.itemSizeGetter=o)},t.prototype.getLastMeasuredIndex=function(){return this.lastMeasuredIndex},t.prototype.getSizeAndPositionForIndex=function(t){if(t<0||t>=this.itemCount)throw Error("Requested index "+t+" is outside of range 0.."+this.itemCount);if(t>this.lastMeasuredIndex){for(var e=this.getSizeAndPositionOfLastMeasuredItem(),o=e.offset+e.size,i=this.lastMeasuredIndex+1;i<=t;i++){var n=this.itemSizeGetter(i);if(null==n||isNaN(n))throw Error("Invalid size returned for index "+i+" of value "+n);this.itemSizeAndPositionData[i]={offset:o,size:n},o+=n}this.lastMeasuredIndex=t}return this.itemSizeAndPositionData[t]},t.prototype.getSizeAndPositionOfLastMeasuredItem=function(){return this.lastMeasuredIndex>=0?this.itemSizeAndPositionData[this.lastMeasuredIndex]:{offset:0,size:0}},t.prototype.getTotalSize=function(){var t=this.getSizeAndPositionOfLastMeasuredItem();return t.offset+t.size+(this.itemCount-this.lastMeasuredIndex-1)*this.estimatedItemSize},t.prototype.getUpdatedOffsetForIndex=function(t){var e=t.align,o=void 0===e?c.START:e,i=t.containerSize,n=t.currentOffset,r=t.targetIndex;if(i<=0)return 0;var s,a=this.getSizeAndPositionForIndex(r),l=a.offset,f=l-i+a.size;switch(o){case c.END:s=f;break;case c.CENTER:s=l-(i-a.size)/2;break;case c.START:s=l;break;default:s=Math.max(f,Math.min(l,n))}var u=this.getTotalSize();return Math.max(0,Math.min(u-i,s))},t.prototype.getVisibleRange=function(t){var e=t.containerSize,o=t.offset,i=t.overscanCount;if(0===this.getTotalSize())return{};var n=o+e,r=this.findNearestItem(o);if(void 0===r)throw Error("Invalid offset "+o+" specified");var s=this.getSizeAndPositionForIndex(r);o=s.offset+s.size;for(var a=r;o<n&&a<this.itemCount-1;)a++,o+=this.getSizeAndPositionForIndex(a).size;return i&&(r=Math.max(0,r-i),a=Math.min(a+i,this.itemCount-1)),{start:r,stop:a}},t.prototype.resetItem=function(t){this.lastMeasuredIndex=Math.min(this.lastMeasuredIndex,t-1)},t.prototype.findNearestItem=function(t){if(isNaN(t))throw Error("Invalid offset "+t+" specified");t=Math.max(0,t);var e=this.getSizeAndPositionOfLastMeasuredItem(),o=Math.max(0,this.lastMeasuredIndex);return e.offset>=t?this.binarySearch({high:o,low:0,offset:t}):this.exponentialSearch({index:o,offset:t})},t.prototype.binarySearch=function(t){for(var e=t.low,o=t.high,i=t.offset,n=0,r=0;e<=o;){if(n=e+Math.floor((o-e)/2),(r=this.getSizeAndPositionForIndex(n).offset)===i)return n;r<i?e=n+1:r>i&&(o=n-1)}return e>0?e-1:0},t.prototype.exponentialSearch=function(t){for(var e=t.index,o=t.offset,i=1;e<this.itemCount&&this.getSizeAndPositionForIndex(e).offset<o;)e+=i,i*=2;return this.binarySearch({high:Math.min(e,this.itemCount-1),low:Math.floor(e/2),offset:o})},t}(),z={overflow:"auto",willChange:"transform",WebkitOverflowScrolling:"touch"},T={position:"relative",width:"100%",minHeight:"100%"},O={position:"absolute",top:0,left:0,width:"100%"},v=d(d({},O),{position:"sticky"}),C=function(r){function s(){var t=null!==r&&r.apply(this,arguments)||this;return t.itemSizeGetter=function(e){return function(o){return t.getSize(o,e)}},t.sizeAndPositionManager=new y({itemCount:t.props.itemCount,itemSizeGetter:t.itemSizeGetter(t.props.itemSize),estimatedItemSize:t.getEstimatedItemSize()}),t.state={offset:t.props.scrollOffset||null!=t.props.scrollToIndex&&t.getOffsetForIndex(t.props.scrollToIndex)||0,scrollChangeReason:p.REQUESTED},t.styleCache={},t.getRef=function(e){t.rootNode=e},t.handleScroll=function(e){var o=t.props.onScroll,i=t.getNodeOffset();i<0||t.state.offset===i||e.target!==t.rootNode||(t.setState({offset:i,scrollChangeReason:p.OBSERVED}),"function"==typeof o&&o(i,e))},t}return i(s,r),s.prototype.componentDidMount=function(){var t=this.props,e=t.scrollOffset,o=t.scrollToIndex;this.rootNode.addEventListener("scroll",this.handleScroll,{passive:!0}),null!=e?this.scrollTo(e):null!=o&&this.scrollTo(this.getOffsetForIndex(o))},s.prototype.UNSAFE_componentWillReceiveProps=function(t){var e=this.props,o=e.estimatedItemSize,i=e.itemCount,n=e.itemSize,r=e.scrollOffset,s=e.scrollToAlignment,a=e.scrollToIndex,l=t.scrollToIndex!==a||t.scrollToAlignment!==s,f=t.itemCount!==i||t.itemSize!==n||t.estimatedItemSize!==o;t.itemSize!==n&&this.sizeAndPositionManager.updateConfig({itemSizeGetter:this.itemSizeGetter(t.itemSize)}),t.itemCount===i&&t.estimatedItemSize===o||this.sizeAndPositionManager.updateConfig({itemCount:t.itemCount,estimatedItemSize:this.getEstimatedItemSize(t)}),f&&this.recomputeSizes(),t.scrollOffset!==r?this.setState({offset:t.scrollOffset||0,scrollChangeReason:p.REQUESTED}):"number"==typeof t.scrollToIndex&&(l||f)&&this.setState({offset:this.getOffsetForIndex(t.scrollToIndex,t.scrollToAlignment,t.itemCount),scrollChangeReason:p.REQUESTED})},s.prototype.componentDidUpdate=function(t,e){var o=this.state,i=o.offset,n=o.scrollChangeReason;e.offset!==i&&n===p.REQUESTED&&this.scrollTo(i)},s.prototype.componentWillUnmount=function(){this.rootNode.removeEventListener("scroll",this.handleScroll)},s.prototype.scrollTo=function(e){var o=this.props.scrollDirection,i=void 0===o?t.ScrollDirection.VERTICAL:o;this.rootNode[h[i]]=e},s.prototype.getOffsetForIndex=function(e,o,i){void 0===o&&(o=this.props.scrollToAlignment),void 0===i&&(i=this.props.itemCount);var n=this.props.scrollDirection,r=void 0===n?t.ScrollDirection.VERTICAL:n;return(e<0||e>=i)&&(e=0),this.sizeAndPositionManager.getUpdatedOffsetForIndex({align:o,containerSize:this.props[m[r]],currentOffset:this.state&&this.state.offset||0,targetIndex:e})},s.prototype.recomputeSizes=function(t){void 0===t&&(t=0),this.styleCache={},this.sizeAndPositionManager.resetItem(t)},s.prototype.getDomProps=function(){var t=this.props;t.scrollToAlignment,t.scrollOffset,t.itemCount,t.itemSize,t.onScroll,t.renderItem,t.overscanCount,t.scrollDirection;return n(t,["scrollToAlignment","scrollOffset","itemCount","itemSize","onScroll","renderItem","overscanCount","scrollDirection"])},s.prototype.render=function(){var o,i=this,n=this.props,r=n.height,s=n.overscanCount,a=void 0===s?3:s,l=n.renderItem,f=n.onItemsRendered,c=n.scrollDirection,u=void 0===c?t.ScrollDirection.VERTICAL:c,p=n.stickyIndices,h=n.style,I=n.width,S=this.state.offset,g=this.sizeAndPositionManager.getVisibleRange({containerSize:this.props[m[u]]||0,offset:S,overscanCount:a}),y=g.start,O=g.stop,v=[],C=d(d(d({},z),h),{height:r,width:I}),E=d(d({},T),(o={},o[m[u]]=this.sizeAndPositionManager.getTotalSize(),o));if(null!=p&&0!==p.length&&(p.forEach(function(t){return v.push(l({index:t,style:i.getStyle(t,!0)}))}),u===t.ScrollDirection.HORIZONTAL&&(E.display="flex")),void 0!==y&&void 0!==O){for(var R=y;R<=O;R++)null!=p&&p.includes(R)||v.push(l({index:R,style:this.getStyle(R,!1)}));"function"==typeof f&&f({startIndex:y,stopIndex:O})}return e.createElement("div",d({ref:this.getRef},this.getDomProps(),{style:C}),e.createElement("div",{style:E},v))},s.prototype.getNodeOffset=function(){var e=this.props.scrollDirection,o=void 0===e?t.ScrollDirection.VERTICAL:e;return this.rootNode[h[o]]},s.prototype.getEstimatedItemSize=function(t){return void 0===t&&(t=this.props),t.estimatedItemSize||"number"==typeof t.itemSize&&t.itemSize||50},s.prototype.getSize=function(t,e){return"function"==typeof e?e(t):Array.isArray(e)?e[t]:e},s.prototype.getStyle=function(e,o){var i,n,r=this.styleCache[e];if(r)return r;var s=this.props.scrollDirection,a=void 0===s?t.ScrollDirection.VERTICAL:s,l=this.sizeAndPositionManager.getSizeAndPositionForIndex(e),f=l.size,c=l.offset;return this.styleCache[e]=o?d(d({},v),(i={},i[m[a]]=f,i[S[a]]=c,i[g[a]]=-(c+f),i.zIndex=1,i)):d(d({},O),(n={},n[m[a]]=f,n[I[a]]=c,n))},s.defaultProps={overscanCount:3,scrollDirection:t.ScrollDirection.VERTICAL,width:"100%"},s.propTypes={estimatedItemSize:o.number,height:o.oneOfType([o.number,o.string]).isRequired,itemCount:o.number.isRequired,itemSize:o.oneOfType([o.number,o.array,o.func]).isRequired,onScroll:o.func,onItemsRendered:o.func,overscanCount:o.number,renderItem:o.func.isRequired,scrollOffset:o.number,scrollToIndex:o.number,scrollToAlignment:o.oneOf([c.AUTO,c.START,c.CENTER,c.END]),scrollDirection:o.oneOf([t.ScrollDirection.HORIZONTAL,t.ScrollDirection.VERTICAL]),stickyIndices:o.arrayOf(o.number),style:o.object,width:o.oneOfType([o.number,o.string])},s}(e.PureComponent);t.default=C,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],e):t.VirtualList=e(t.React,t.PropTypes)}(this,function(t,e){"use strict";function o(t,e){function o(){this.constructor=t}if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");f(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}function i(t,e){var o={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(o[i[r]]=t[i[r]]);return o}var r,n,s,a,l,f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)},c=function(){return(c=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++){e=arguments[o];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)},u=function(){function t(t){var e=t.itemCount,o=t.itemSizeGetter,i=t.estimatedItemSize;this.itemSizeGetter=o,this.itemCount=e,this.estimatedItemSize=i,this.itemSizeAndPositionData={},this.lastMeasuredIndex=-1}return t.prototype.updateConfig=function(t){var e=t.itemCount,o=t.itemSizeGetter,i=t.estimatedItemSize;null!=e&&(this.itemCount=e),null!=i&&(this.estimatedItemSize=i),null!=o&&(this.itemSizeGetter=o)},t.prototype.getLastMeasuredIndex=function(){return this.lastMeasuredIndex},t.prototype.getSizeAndPositionForIndex=function(t){if(t<0||t>=this.itemCount)throw Error("Requested index "+t+" is outside of range 0.."+this.itemCount);if(t>this.lastMeasuredIndex){for(var e=this.getSizeAndPositionOfLastMeasuredItem(),o=e.offset+e.size,i=this.lastMeasuredIndex+1;i<=t;i++){var r=this.itemSizeGetter(i);if(null==r||isNaN(r))throw Error("Invalid size returned for index "+i+" of value "+r);this.itemSizeAndPositionData[i]={offset:o,size:r},o+=r}this.lastMeasuredIndex=t}return this.itemSizeAndPositionData[t]},t.prototype.getSizeAndPositionOfLastMeasuredItem=function(){return this.lastMeasuredIndex>=0?this.itemSizeAndPositionData[this.lastMeasuredIndex]:{offset:0,size:0}},t.prototype.getTotalSize=function(){var t=this.getSizeAndPositionOfLastMeasuredItem();return t.offset+t.size+(this.itemCount-this.lastMeasuredIndex-1)*this.estimatedItemSize},t.prototype.getUpdatedOffsetForIndex=function(t){var e=t.align,o=void 0===e?"start":e,i=t.containerSize,r=t.currentOffset,n=t.targetIndex;if(i<=0)return 0;var s,a=this.getSizeAndPositionForIndex(n),l=a.offset,f=l-i+a.size;switch(o){case"end":s=f;break;case"center":s=l-(i-a.size)/2;break;case"start":s=l;break;default:s=Math.max(f,Math.min(l,r))}var c=this.getTotalSize();return Math.max(0,Math.min(c-i,s))},t.prototype.getVisibleRange=function(t){var e=t.containerSize,o=t.offset,i=t.overscanCount;if(0===this.getTotalSize())return{};var r=o+e,n=this.findNearestItem(o);if(void 0===n)throw Error("Invalid offset "+o+" specified");var s=this.getSizeAndPositionForIndex(n);o=s.offset+s.size;for(var a=n;o<r&&a<this.itemCount-1;)a++,o+=this.getSizeAndPositionForIndex(a).size;return i&&(n=Math.max(0,n-i),a=Math.min(a+i,this.itemCount-1)),{start:n,stop:a}},t.prototype.resetItem=function(t){this.lastMeasuredIndex=Math.min(this.lastMeasuredIndex,t-1)},t.prototype.findNearestItem=function(t){if(isNaN(t))throw Error("Invalid offset "+t+" specified");t=Math.max(0,t);var e=this.getSizeAndPositionOfLastMeasuredItem(),o=Math.max(0,this.lastMeasuredIndex);return e.offset>=t?this.binarySearch({high:o,low:0,offset:t}):this.exponentialSearch({index:o,offset:t})},t.prototype.binarySearch=function(t){for(var e=t.low,o=t.high,i=t.offset,r=0,n=0;e<=o;){if(r=e+Math.floor((o-e)/2),(n=this.getSizeAndPositionForIndex(r).offset)===i)return r;n<i?e=r+1:n>i&&(o=r-1)}return e>0?e-1:0},t.prototype.exponentialSearch=function(t){for(var e=t.index,o=t.offset,i=1;e<this.itemCount&&this.getSizeAndPositionForIndex(e).offset<o;)e+=i,i*=2;return this.binarySearch({high:Math.min(e,this.itemCount-1),low:Math.floor(e/2),offset:o})},t}(),d=(r={},r.vertical="scrollTop",r.horizontal="scrollLeft",r),p=(n={},n.vertical="height",n.horizontal="width",n),h=(s={},s.vertical="top",s.horizontal="left",s),m=(a={},a.vertical="marginTop",a.horizontal="marginLeft",a),g=(l={},l.vertical="marginBottom",l.horizontal="marginRight",l),z={overflow:"auto",willChange:"transform",WebkitOverflowScrolling:"touch"},y={position:"relative",width:"100%",minHeight:"100%"},S={position:"absolute",top:0,left:0,width:"100%"},v=c(c({},S),{position:"sticky"});return function(r){function n(){var t=null!==r&&r.apply(this,arguments)||this;return t.itemSizeGetter=function(e){return function(o){return t.getSize(o,e)}},t.sizeAndPositionManager=new u({itemCount:t.props.itemCount,itemSizeGetter:t.itemSizeGetter(t.props.itemSize),estimatedItemSize:t.getEstimatedItemSize()}),t.state={offset:t.props.scrollOffset||null!=t.props.scrollToIndex&&t.getOffsetForIndex(t.props.scrollToIndex)||0,scrollChangeReason:"requested"},t.styleCache={},t.getRef=function(e){t.rootNode=e},t.handleScroll=function(e){var o=t.props.onScroll,i=t.getNodeOffset();i<0||t.state.offset===i||e.target!==t.rootNode||(t.setState({offset:i,scrollChangeReason:"observed"}),"function"==typeof o&&o(i,e))},t}return o(n,r),n.prototype.componentDidMount=function(){var t=this.props,e=t.scrollOffset,o=t.scrollToIndex;this.rootNode.addEventListener("scroll",this.handleScroll,{passive:!0}),null!=e?this.scrollTo(e):null!=o&&this.scrollTo(this.getOffsetForIndex(o))},n.prototype.UNSAFE_componentWillReceiveProps=function(t){var e=this.props,o=e.estimatedItemSize,i=e.itemCount,r=e.itemSize,n=e.scrollOffset,s=e.scrollToAlignment,a=e.scrollToIndex,l=t.scrollToIndex!==a||t.scrollToAlignment!==s,f=t.itemCount!==i||t.itemSize!==r||t.estimatedItemSize!==o;t.itemSize!==r&&this.sizeAndPositionManager.updateConfig({itemSizeGetter:this.itemSizeGetter(t.itemSize)}),t.itemCount===i&&t.estimatedItemSize===o||this.sizeAndPositionManager.updateConfig({itemCount:t.itemCount,estimatedItemSize:this.getEstimatedItemSize(t)}),f&&this.recomputeSizes(),t.scrollOffset!==n?this.setState({offset:t.scrollOffset||0,scrollChangeReason:"requested"}):"number"==typeof t.scrollToIndex&&(l||f)&&this.setState({offset:this.getOffsetForIndex(t.scrollToIndex,t.scrollToAlignment,t.itemCount),scrollChangeReason:"requested"})},n.prototype.componentDidUpdate=function(t,e){var o=this.state,i=o.offset,r=o.scrollChangeReason;e.offset!==i&&"requested"===r&&this.scrollTo(i)},n.prototype.componentWillUnmount=function(){this.rootNode.removeEventListener("scroll",this.handleScroll)},n.prototype.scrollTo=function(t){var e=this.props.scrollDirection,o=void 0===e?"vertical":e;this.rootNode[d[o]]=t},n.prototype.getOffsetForIndex=function(t,e,o){void 0===e&&(e=this.props.scrollToAlignment),void 0===o&&(o=this.props.itemCount);var i=this.props.scrollDirection,r=void 0===i?"vertical":i;return(t<0||t>=o)&&(t=0),this.sizeAndPositionManager.getUpdatedOffsetForIndex({align:e,containerSize:this.props[p[r]],currentOffset:this.state&&this.state.offset||0,targetIndex:t})},n.prototype.recomputeSizes=function(t){void 0===t&&(t=0),this.styleCache={},this.sizeAndPositionManager.resetItem(t)},n.prototype.getDomProps=function(){var t=this.props;t.scrollToAlignment,t.scrollOffset,t.itemCount,t.itemSize,t.onScroll,t.renderItem,t.overscanCount,t.scrollDirection,t.stickyIndices,t.scrollToIndex;return i(t,["scrollToAlignment","scrollOffset","itemCount","itemSize","onScroll","renderItem","overscanCount","scrollDirection","stickyIndices","scrollToIndex"])},n.prototype.render=function(){var e,o=this,i=this.props,r=i.height,n=i.overscanCount,s=void 0===n?3:n,a=i.renderItem,l=i.onItemsRendered,f=i.scrollDirection,u=void 0===f?"vertical":f,d=i.stickyIndices,h=i.style,m=i.width,g=this.state.offset,S=this.sizeAndPositionManager.getVisibleRange({containerSize:this.props[p[u]]||0,offset:g,overscanCount:s}),v=S.start,I=S.stop,x=[],O=c(c(c({},z),h),{height:r,width:m}),C=c(c({},y),(e={},e[p[u]]=this.sizeAndPositionManager.getTotalSize(),e));if(null!=d&&0!==d.length&&(d.forEach(function(t){return x.push(a({index:t,style:o.getStyle(t,!0)}))}),"horizontal"===u&&(C.display="flex")),void 0!==v&&void 0!==I){for(var M=v;M<=I;M++)null!=d&&d.includes(M)||x.push(a({index:M,style:this.getStyle(M,!1)}));"function"==typeof l&&l({startIndex:v,stopIndex:I})}return t.createElement("div",c({ref:this.getRef},this.getDomProps(),{style:O}),t.createElement("div",{style:C},x))},n.prototype.getNodeOffset=function(){var t=this.props.scrollDirection,e=void 0===t?"vertical":t;return this.rootNode[d[e]]},n.prototype.getEstimatedItemSize=function(t){return void 0===t&&(t=this.props),t.estimatedItemSize||"number"==typeof t.itemSize&&t.itemSize||50},n.prototype.getSize=function(t,e){return"function"==typeof e?e(t):Array.isArray(e)?e[t]:e},n.prototype.getStyle=function(t,e){var o,i,r=this.styleCache[t];if(r)return r;var n=this.props.scrollDirection,s=void 0===n?"vertical":n,a=this.sizeAndPositionManager.getSizeAndPositionForIndex(t),l=a.size,f=a.offset;return this.styleCache[t]=e?c(c({},v),(o={},o[p[s]]=l,o[m[s]]=f,o[g[s]]=-(f+l),o.zIndex=1,o)):c(c({},S),(i={},i[p[s]]=l,i[h[s]]=f,i))},n.defaultProps={overscanCount:3,scrollDirection:"vertical",width:"100%"},n.propTypes={estimatedItemSize:e.number,height:e.oneOfType([e.number,e.string]).isRequired,itemCount:e.number.isRequired,itemSize:e.oneOfType([e.number,e.array,e.func]).isRequired,onScroll:e.func,onItemsRendered:e.func,overscanCount:e.number,renderItem:e.func.isRequired,scrollOffset:e.number,scrollToIndex:e.number,scrollToAlignment:e.oneOf(["auto","start","center","end"]),scrollDirection:e.oneOf(["horizontal","vertical"]),stickyIndices:e.arrayOf(e.number),style:e.object,width:e.oneOfType([e.number,e.string])},n}(t.PureComponent)});
## Changelog
### 2.3.1
Fix enums not being properly transpiled when building bundle.
### 2.3.0

@@ -4,0 +8,0 @@

{
"name": "react-tiny-virtual-list-oss",
"version": "2.3.0",
"version": "2.3.1",
"description": "A tiny but mighty list virtualization component, with zero dependencies 💪",

@@ -56,3 +56,3 @@ "main": "build/react-tiny-virtual-list.cjs.js",

"rimraf": "^2.6.1",
"rollup": "0.50",
"rollup": "0.50.1",
"rollup-plugin-babel": "^3.0.2",

@@ -59,0 +59,0 @@ "rollup-plugin-commonjs": "^8.2.0",

@@ -9,4 +9,4 @@ <div align="center" style="margin-bottom: 30px;">

[![npm version](https://img.shields.io/npm/v/react-tiny-virtual-list.svg)](https://www.npmjs.com/package/react-tiny-virtual-list)
[![npm downloads](https://img.shields.io/npm/dm/react-tiny-virtual-list.svg)](https://www.npmjs.com/package/react-tiny-virtual-list)
[![npm version](https://img.shields.io/npm/v/react-tiny-virtual-list-oss.svg)](https://www.npmjs.com/package/react-tiny-virtual-list-oss)
[![npm downloads](https://img.shields.io/npm/dm/react-tiny-virtual-list-oss.svg)](https://www.npmjs.com/package/react-tiny-virtual-list-oss)
[![Build Status](https://travis-ci.org/clauderic/react-tiny-virtual-list.svg?branch=master)](https://travis-ci.org/clauderic/react-tiny-virtual-list)

@@ -13,0 +13,0 @@ [![codecov](https://codecov.io/gh/clauderic/react-tiny-virtual-list/branch/master/graph/badge.svg)](https://codecov.io/gh/clauderic/react-tiny-virtual-list)

@@ -1,2 +0,2 @@

export declare enum ALIGNMENT {
export declare const enum ALIGNMENT {
AUTO = "auto",

@@ -7,7 +7,7 @@ START = "start",

}
export declare enum DIRECTION {
export declare const enum DIRECTION {
HORIZONTAL = "horizontal",
VERTICAL = "vertical"
}
export declare enum SCROLL_CHANGE_REASON {
export declare const enum SCROLL_CHANGE_REASON {
OBSERVED = "observed",

@@ -14,0 +14,0 @@ REQUESTED = "requested"

@@ -88,4 +88,2 @@ import * as React from 'react';

height: string | number;
scrollToIndex?: number | undefined;
stickyIndices?: number[] | undefined;
style?: React.CSSProperties | undefined;

@@ -92,0 +90,0 @@ width?: string | number | undefined;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc