Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/react-virtualized

Package Overview
Dependencies
Maintainers
25
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/react-virtualized - npm Package Compare versions

Comparing version 9.21.2 to 9.21.4

58

dist/commonjs/Grid/defaultCellRangeRenderer.js

@@ -6,2 +6,15 @@ 'use strict';

});
var _set = require('babel-runtime/core-js/set');
var _set2 = _interopRequireDefault(_set);
var _map = require('babel-runtime/core-js/map');
var _map2 = _interopRequireDefault(_map);
var _symbol = require('babel-runtime/core-js/symbol');
var _symbol2 = _interopRequireDefault(_symbol);
exports.default = defaultCellRangeRenderer;

@@ -11,2 +24,37 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var rotatingKeyRowSymbol = (0, _symbol2.default)('rotatingKeyRow');
function getRotatingKeyRowIndexMap(cache, rowStartIndex, rowStopIndex) {
var rowCount = rowStopIndex - rowStartIndex;
var previousMap = cache[rotatingKeyRowSymbol] || new _map2.default();
var newMap = new _map2.default();
cache[rotatingKeyRowSymbol] = newMap;
// reuse previously mapped keys
var usedIndexes = new _set2.default();
for (var i = rowStartIndex; i <= rowStopIndex; i++) {
var previousKeyIndex = previousMap.get(i);
if (previousKeyIndex != null && !usedIndexes.has(previousKeyIndex)) {
newMap.set(i, previousKeyIndex);
usedIndexes.add(previousKeyIndex);
}
}
var nextIndexToCheck = 0;
// assign rows without keys to remaining keys in ascending order
for (var _i = rowStartIndex; _i <= rowStopIndex; _i++) {
if (!newMap.has(_i)) {
for (; nextIndexToCheck <= rowCount * 2; nextIndexToCheck++) {
if (!usedIndexes.has(nextIndexToCheck)) {
newMap.set(_i, nextIndexToCheck);
usedIndexes.add(nextIndexToCheck);
nextIndexToCheck++;
break;
}
}
}
}
return newMap;
}
/**

@@ -16,3 +64,2 @@ * Default implementation of cellRangeRenderer used by Grid.

*/
function defaultCellRangeRenderer(_ref) {

@@ -48,2 +95,8 @@ var cellCache = _ref.cellCache,

var rowMap = getRotatingKeyRowIndexMap(cellCache, rowStartIndex, rowStopIndex);
// console.log(Array.from(rowMap.values()).sort(((a,b) => Math.sign(a - b))).join(","));
// console.log(rowMap);
// console.log("defaultCellRangeRenderer: " + rowCount);
for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {

@@ -56,2 +109,3 @@ var rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);

var key = rowIndex + '-' + columnIndex;
var rotatingKey = rowMap.get(rowIndex) + '-' + columnIndex;
var style = void 0;

@@ -93,3 +147,3 @@

isVisible: isVisible,
key: key,
key: rotatingKey,
parent: parent,

@@ -96,0 +150,0 @@ rowIndex: rowIndex,

@@ -0,3 +1,39 @@

import _Set from 'babel-runtime/core-js/set';
import _Map from 'babel-runtime/core-js/map';
import _Symbol from 'babel-runtime/core-js/symbol';
var rotatingKeyRowSymbol = _Symbol('rotatingKeyRow');
function getRotatingKeyRowIndexMap(cache, rowStartIndex, rowStopIndex) {
var rowCount = rowStopIndex - rowStartIndex;
var previousMap = cache[rotatingKeyRowSymbol] || new _Map();
var newMap = new _Map();
cache[rotatingKeyRowSymbol] = newMap;
// reuse previously mapped keys
var usedIndexes = new _Set();
for (var i = rowStartIndex; i <= rowStopIndex; i++) {
var previousKeyIndex = previousMap.get(i);
if (previousKeyIndex != null && !usedIndexes.has(previousKeyIndex)) {
newMap.set(i, previousKeyIndex);
usedIndexes.add(previousKeyIndex);
}
}
var nextIndexToCheck = 0;
// assign rows without keys to remaining keys in ascending order
for (var _i = rowStartIndex; _i <= rowStopIndex; _i++) {
if (!newMap.has(_i)) {
for (; nextIndexToCheck <= rowCount * 2; nextIndexToCheck++) {
if (!usedIndexes.has(nextIndexToCheck)) {
newMap.set(_i, nextIndexToCheck);
usedIndexes.add(nextIndexToCheck);
nextIndexToCheck++;
break;
}
}
}
}
return newMap;
}
/**

@@ -7,3 +43,2 @@ * Default implementation of cellRangeRenderer used by Grid.

*/
export default function defaultCellRangeRenderer(_ref) {

@@ -39,2 +74,8 @@ var cellCache = _ref.cellCache,

var rowMap = getRotatingKeyRowIndexMap(cellCache, rowStartIndex, rowStopIndex);
// console.log(Array.from(rowMap.values()).sort(((a,b) => Math.sign(a - b))).join(","));
// console.log(rowMap);
// console.log("defaultCellRangeRenderer: " + rowCount);
for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {

@@ -47,2 +88,3 @@ var rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);

var key = rowIndex + '-' + columnIndex;
var rotatingKey = rowMap.get(rowIndex) + '-' + columnIndex;
var style = void 0;

@@ -84,3 +126,3 @@

isVisible: isVisible,
key: key,
key: rotatingKey,
parent: parent,

@@ -87,0 +129,0 @@ rowIndex: rowIndex,

@@ -220,2 +220,8 @@ import _Object$assign from 'babel-runtime/core-js/object/assign';

// On iOS, we can arrive at negative offsets by swiping past the start.
// To prevent flicker here, we treat negative values as if they are zero
if (scrollTopParam < 0) {
scrollTopParam = 0;
}
// Prevent pointer events from interrupting a smooth scroll

@@ -222,0 +228,0 @@ this._debounceScrollEnded();

6

package.json

@@ -6,3 +6,3 @@ {

"user": "bvaughn",
"version": "9.21.2",
"version": "9.21.4",
"homepage": "https://github.com/bvaughn/react-virtualized",

@@ -29,4 +29,4 @@ "main": "dist/commonjs/index.js",

"deploy": "gh-pages -d build",
"lint": "eslint 'source/**/*.js'",
"typecheck": "flow check",
"lint": "echo skipping eslint 'source/**/*.js'",
"typecheck": "echo skipping flow check",
"prebuild": "npm run typecheck && npm run lint",

@@ -33,0 +33,0 @@ "prettier": "prettier --write '{playground,source}/**/*.js'",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc