vscroll
Version:
Virtual scroll engine
62 lines • 1.27 kB
JavaScript
export class Item {
get $index() {
return this.container.$index;
}
set $index(value) {
this.container.$index = value;
}
get data() {
return this.container.data;
}
set data(value) {
this.container.data = value;
}
get element() {
return this.container.element;
}
set element(value) {
this.container.element = value;
}
constructor($index, data, routines) {
this.container = {
$index,
data
};
this.nodeId = String($index);
this.routines = routines;
this.invisible = true;
this.toRemove = false;
this.toInsert = false;
}
dispose() {
delete this.container.element;
}
setSize(preSize = 0) {
this.preSize = preSize;
if (this.element) {
this.size = this.routines.getSize(this.element);
}
}
makeVisible() {
this.routines.makeElementVisible(this.element);
this.invisible = false;
}
hide() {
if (this.element) {
this.routines.hideElement(this.element);
}
}
scrollTo(argument) {
if (this.element) {
this.routines.scrollTo(this.element, argument);
}
}
updateIndex(index) {
this.$index = index;
this.nodeId = String(index);
}
get() {
return this.container;
}
}
//# sourceMappingURL=item.js.map