@infinite-list/data-model
Advanced tools
Comparing version 0.2.26 to 0.2.27
@@ -6,2 +6,3 @@ import ItemMetaStateEventHelper from './ItemMetaStateEventHelper'; | ||
private _isListItem; | ||
private _id; | ||
private _layout?; | ||
@@ -26,2 +27,3 @@ private _separatorLength?; | ||
}); | ||
get id(): string; | ||
setLayout(layout: ItemLayout): void; | ||
@@ -28,0 +30,0 @@ getLayout(): ItemLayout; |
{ | ||
"name": "@infinite-list/data-model", | ||
"version": "0.2.26", | ||
"version": "0.2.27", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "dist", |
@@ -15,4 +15,6 @@ import BaseDimensions from './BaseDimensions'; | ||
let count = 0; | ||
class ItemMeta extends ViewabilityItemMeta { | ||
private _isListItem: boolean; | ||
private _id: string; | ||
private _layout?: ItemLayout; | ||
@@ -48,2 +50,3 @@ private _separatorLength?: number; | ||
this._owner = owner; | ||
this._id = `item_meta_${count++}`; | ||
this._layout = layout; | ||
@@ -63,2 +66,6 @@ this._separatorLength = separatorLength || 0; | ||
get id() { | ||
return this._id; | ||
} | ||
setLayout(layout: ItemLayout) { | ||
@@ -65,0 +72,0 @@ this._layout = layout; |
@@ -371,5 +371,18 @@ import noop from '@x-oasis/noop'; | ||
let meta = this.getKeyMeta(key); | ||
if (!meta && this._parentItemsDimensions) { | ||
meta = this._parentItemsDimensions.ensureKeyMeta(key); | ||
} | ||
if (meta) return meta; | ||
// TODO: separatorLength may be included!!!! | ||
meta = new ItemMeta({ | ||
key, | ||
owner: this, | ||
isListItem: true, | ||
isInitialItem: false, | ||
}); | ||
this.setKeyMeta(key, meta); | ||
return meta; | ||
@@ -679,2 +692,3 @@ } | ||
}); | ||
const dataChangedType = this.resolveKeysChangedType( | ||
@@ -705,2 +719,3 @@ keyToIndexArray, | ||
this._data = data; | ||
this._keyToIndexMap = keyToIndexMap; | ||
@@ -808,4 +823,5 @@ this._indexKeys = keyToIndexArray; | ||
const index = this.getKeyIndex(key); | ||
const item = this._data[index]; | ||
const meta = this.getItemMeta(item, index); | ||
// const item = this._data[index]; | ||
const meta = this.getKeyMeta(key); | ||
// const meta = this.getItemMeta(item, index); | ||
@@ -1117,3 +1133,3 @@ if (!meta) return false; | ||
// 如果没有offset,说明item是新增的,那么它渲染就在最开始位置好了 | ||
offset: itemLayout ? indexToOffsetMap[targetIndex] : 0, | ||
offset: itemLength ? indexToOffsetMap[targetIndex] : 0, | ||
position: 'buffered', | ||
@@ -1120,0 +1136,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1662619
19845