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

rc-virtual-list

Package Overview
Dependencies
Maintainers
2
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-virtual-list - npm Package Compare versions

Comparing version 3.10.2 to 3.10.3

es/hooks/useGetSize.d.ts

9

es/interface.d.ts

@@ -9,2 +9,6 @@ /// <reference types="react" />

export type GetKey<T> = (item: T) => React.Key;
export type GetSize = (startKey: React.Key, endKey?: React.Key) => {
top: number;
bottom: number;
};
export interface ExtraRenderInfo {

@@ -21,6 +25,3 @@ /** Virtual list start line */

rtl: boolean;
getSize: (startKey: React.Key, endKey?: React.Key) => {
top: number;
bottom: number;
};
getSize: GetSize;
}

@@ -25,2 +25,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

import { useEvent } from 'rc-util';
import { useGetSize } from './hooks/useGetSize';
var EMPTY_DATA = [];

@@ -355,27 +356,3 @@ var ScrollStyle = {

// ================================ Extra =================================
var getSize = function getSize(startKey) {
var endKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startKey;
var top = 0;
var bottom = 0;
var total = 0;
var dataLen = mergedData.length;
for (var i = 0; i < dataLen; i += 1) {
var _heights$get;
var item = mergedData[i];
var key = getKey(item);
var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight;
bottom = total + cacheHeight;
if (key === startKey) {
top = total;
}
if (key === endKey) {
break;
}
total = bottom;
}
return {
top: top,
bottom: bottom
};
};
var getSize = useGetSize(mergedData, getKey, heights, itemHeight);
var extraContent = extraRender === null || extraRender === void 0 ? void 0 : extraRender({

@@ -382,0 +359,0 @@ start: start,

import type React from 'react';
declare class CacheMap {
maps: Record<string, number>;
id: number;
constructor();
set(key: React.ReactText, value: number): void;
get(key: React.ReactText): number;
set(key: React.Key, value: number): void;
get(key: React.Key): number;
}
export default CacheMap;

@@ -8,2 +8,5 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

this.maps = void 0;
// Used for cache key
// `useMemo` no need to update if `id` not change
this.id = 0;
this.maps = Object.create(null);

@@ -15,2 +18,3 @@ }

this.maps[key] = value;
this.id += 1;
}

@@ -17,0 +21,0 @@ }, {

@@ -9,2 +9,6 @@ /// <reference types="react" />

export type GetKey<T> = (item: T) => React.Key;
export type GetSize = (startKey: React.Key, endKey?: React.Key) => {
top: number;
bottom: number;
};
export interface ExtraRenderInfo {

@@ -21,6 +25,3 @@ /** Virtual list start line */

rtl: boolean;
getSize: (startKey: React.Key, endKey?: React.Key) => {
top: number;
bottom: number;
};
getSize: GetSize;
}

@@ -32,2 +32,3 @@ "use strict";

var _rcUtil = require("rc-util");
var _useGetSize = require("./hooks/useGetSize");
var _excluded = ["prefixCls", "className", "height", "itemHeight", "fullHeight", "style", "data", "children", "itemKey", "virtual", "direction", "scrollWidth", "component", "onScroll", "onVirtualScroll", "onVisibleChange", "innerProps", "extraRender"];

@@ -363,27 +364,3 @@ var EMPTY_DATA = [];

// ================================ Extra =================================
var getSize = function getSize(startKey) {
var endKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startKey;
var top = 0;
var bottom = 0;
var total = 0;
var dataLen = mergedData.length;
for (var i = 0; i < dataLen; i += 1) {
var _heights$get;
var item = mergedData[i];
var key = getKey(item);
var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight;
bottom = total + cacheHeight;
if (key === startKey) {
top = total;
}
if (key === endKey) {
break;
}
total = bottom;
}
return {
top: top,
bottom: bottom
};
};
var getSize = (0, _useGetSize.useGetSize)(mergedData, getKey, heights, itemHeight);
var extraContent = extraRender === null || extraRender === void 0 ? void 0 : extraRender({

@@ -390,0 +367,0 @@ start: start,

import type React from 'react';
declare class CacheMap {
maps: Record<string, number>;
id: number;
constructor();
set(key: React.ReactText, value: number): void;
get(key: React.ReactText): number;
set(key: React.Key, value: number): void;
get(key: React.Key): number;
}
export default CacheMap;

@@ -15,2 +15,5 @@ "use strict";

this.maps = void 0;
// Used for cache key
// `useMemo` no need to update if `id` not change
this.id = 0;
this.maps = Object.create(null);

@@ -22,2 +25,3 @@ }

this.maps[key] = value;
this.id += 1;
}

@@ -24,0 +28,0 @@ }, {

{
"name": "rc-virtual-list",
"version": "3.10.2",
"version": "3.10.3",
"description": "React Virtual List Component",

@@ -5,0 +5,0 @@ "engines": {

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