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

@infinite-list/data-model

Package Overview
Dependencies
Maintainers
0
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@infinite-list/data-model - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

2

package.json
{
"name": "@infinite-list/data-model",
"version": "2.2.1",
"version": "2.2.2",
"files": [

@@ -5,0 +5,0 @@ "dist",

@@ -17,2 +17,10 @@ import BaseLayout from './BaseLayout';

set intervalTree(intervalTree: PrefixIntervalTree);
/**
*
* @param key
* @returns
*
* it returns different meaning index on different List condition
* 1: MasonryList: index in total data, maybe you should use `getKeyIndexInColumn` as a choice.
*/
getKeyIndex(key: string): number;

@@ -19,0 +27,0 @@ getIndexKey(index: number): string;

@@ -36,2 +36,10 @@ "use strict";

}
/**
*
* @param key
* @returns
*
* it returns different meaning index on different List condition
* 1: MasonryList: index in total data, maybe you should use `getKeyIndexInColumn` as a choice.
*/
getKeyIndex(key) {

@@ -38,0 +46,0 @@ // const index = this._keyToIndexMap.get(key);

@@ -21,2 +21,11 @@ import BaseImpl from './strategies/BaseImpl';

getFinalIndexKeyBottomOffset(index: number, exclusive?: boolean): number;
/**
* TODO: important !!!!!!!
* @param startIndex
* @param endIndex
* @param exclusive
* @returns
*
* fix snap jump issue which may cause blank...
*/
getFinalIndexRangeOffsetMap(startIndex: number, endIndex: number, exclusive?: boolean): IndexToOffsetMap;

@@ -23,0 +32,0 @@ computeIndexRange(minOffset: number, maxOffset: number): {

@@ -69,2 +69,11 @@ "use strict";

}
/**
* TODO: important !!!!!!!
* @param startIndex
* @param endIndex
* @param exclusive
* @returns
*
* fix snap jump issue which may cause blank...
*/
getFinalIndexRangeOffsetMap(startIndex, endIndex, exclusive) {

@@ -78,2 +87,3 @@ const indexToOffsetMap = {};

indexToOffsetMap[index] = startOffset;
// high light ------
if (itemMeta?.isApproximateLayout) {

@@ -84,4 +94,4 @@ indexToOffsetMap[index] = this.itemOffsetBeforeLayoutReady;

indexToOffsetMap[index] = startOffset;
startOffset += itemMeta?.getFinalItemLength();
}
startOffset += itemMeta?.getFinalItemLength();
}

@@ -88,0 +98,0 @@ return indexToOffsetMap;

@@ -184,4 +184,4 @@ "use strict";

indexToOffsetMap[index] = startOffset;
startOffset += itemMeta?.getFinalItemLength();
}
startOffset += itemMeta?.getFinalItemLength();
}

@@ -188,0 +188,0 @@ return indexToOffsetMap;

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

...props,
initialNumToRender: 0,
});

@@ -102,6 +103,7 @@ }

const indexInTotal = this._dataModel.getKeyIndex(key);
const columnIndex = this._dataModel.getKeyColumnIndex(key);
const index = this._dataModel.getKeyIndexInColumn(key);
return {
dimensions: this,
columnIndex: 0,
columnIndex,
indexInTotal,

@@ -108,0 +110,0 @@ index,

@@ -36,2 +36,3 @@ import PrefixIntervalTree from '@x-oasis/prefix-interval-tree';

getColumnIndexKeyOffset(columnIndex: number, indexInColumn: number, exclusive?: boolean): number;
getKeyItemOffset(key: string, exclusive?: boolean): number;
/**

@@ -42,5 +43,5 @@ *

/**
* return index in column
* return index in column; comparing with `getKeyIndex` which will return index in total
*/
getKeyIndexInColumn(key: string): number;
getKeyIndexInColumn(key: string): any;
getColumnTotalLength(columnIndex: number): number;

@@ -47,0 +48,0 @@ /**

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

const common_1 = require("../common");
const default_value_1 = require("@x-oasis/default-value");
/**

@@ -107,2 +108,16 @@ * The key point is how to decorate `columnIntervalTree` and `columnKeyIndexManager`

}
// should be overrided, or will cause error
getKeyItemOffset(key, exclusive) {
const columnIndex = this.getKeyColumnIndex(key);
const index = this.getKeyIndexInColumn(key);
const listOffset = exclusive ? 0 : this.getContainerOffset();
const intervalTree = this.getColumnIntervalTree(columnIndex);
if (typeof index === 'number') {
return (listOffset +
(index >= intervalTree.getMaxUsefulLength()
? intervalTree.getHeap()[1]
: intervalTree.sumUntil(index)));
}
return 0;
}
/**

@@ -121,13 +136,8 @@ *

/**
* return index in column
* return index in column; comparing with `getKeyIndex` which will return index in total
*/
getKeyIndexInColumn(key) {
for (let columnIndex = 0; columnIndex < this.column; columnIndex++) {
const indexManager = this.getColumnKeyIndexManager(columnIndex);
const indexInColumn = indexManager.getKeyIndex(key);
if (typeof indexInColumn === 'number') {
return indexInColumn;
}
}
return 0;
const columnIndex = this.getKeyColumnIndex(key);
const keyIndexManager = this.getColumnKeyIndexManager(columnIndex);
return (0, default_value_1.default)(keyIndexManager.getKeyIndex(key), -1);
}

@@ -134,0 +144,0 @@ getColumnTotalLength(columnIndex) {

@@ -117,4 +117,4 @@ "use strict";

indexToOffsetMap[index] = startOffset;
startOffset += itemMeta?.getFinalItemLength();
}
startOffset += itemMeta?.getFinalItemLength();
}

@@ -121,0 +121,0 @@ return indexToOffsetMap;

@@ -61,4 +61,4 @@ import { ListBaseDimensionsProps, OnEndReached, ScrollMetrics, ItemLayout, StateListener, ListBaseDimensionsStore, GenericItemT, IndexInfo, IndexToOffsetMap, ListStateResult } from '../types';

* if itemMeta.isApproximateLayout is true, then its offset should be
* `itemOffsetBeforeLayoutReady` and its length should not be included in
* consecutive item's offset sum value
* `itemOffsetBeforeLayoutReady`, However its length should be included in
* consecutive item's offset sum value !!!!
*

@@ -84,3 +84,3 @@ */

};
addStateListener(listener: StateListener<ItemT>): void;
addStateListener(listener: StateListener<ItemT>): () => void;
setStoreMetrics(scrollMetrics: ScrollMetrics): void;

@@ -87,0 +87,0 @@ dispatchMetrics(scrollMetrics?: ScrollMetrics | undefined): [ListStateResult<ItemT>, ListStateResult<ItemT>];

@@ -129,7 +129,3 @@ "use strict";

addStateListener(listener) {
this._stateHub.addStateListener(listener);
// if (typeof listener === 'function') this.stateListener = listener;
// return () => {
// if (typeof listener === 'function') this.stateListener = undefined;
// };
return this._stateHub.addStateListener(listener);
}

@@ -136,0 +132,0 @@ setStoreMetrics(scrollMetrics) {

@@ -74,6 +74,7 @@ "use strict";

addStateListener(listener) {
if (typeof listener === 'function')
const isFunction = typeof listener === 'function';
if (isFunction)
this.stateListener = listener;
return () => {
if (typeof listener === 'function')
if (isFunction)
this.stateListener = undefined;

@@ -80,0 +81,0 @@ };

@@ -21,3 +21,3 @@ import { GenericItemT, ListState, StateListener, StateHubProps, ListStateResult } from '../types';

getStateResult(): import("../types").SpaceStateResult<ItemT> | import("../types").RecycleStateResult<ItemT>;
addStateListener(listener: StateListener<ItemT>): void;
addStateListener(listener: StateListener<ItemT>): () => void;
addBuffer(type: string): void;

@@ -24,0 +24,0 @@ get stateResult(): import("../types").SpaceStateResult<ItemT> | import("../types").RecycleStateResult<ItemT>;

@@ -44,3 +44,3 @@ "use strict";

addStateListener(listener) {
this._handler.addStateListener(listener);
return this._handler.addStateListener(listener);
}

@@ -47,0 +47,0 @@ addBuffer(type) {

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