import { Dom7Array } from 'dom7'; import Framework7, { CSSSelector, Framework7EventsClass, Framework7Plugin, } from '../app/app-class.js'; export namespace VirtualList { interface VirtualListRenderData { fromIndex: number; toIndex: number; listHeight: number; topPosition: number; items: any[]; } interface VirtualList extends Framework7EventsClass { items: any[]; filteredItems: any[]; domCache: object; /** Virtual list target list block element */ el: HTMLElement; /** Dom7 instance of target list block element */ $el: Dom7Array; /** Parameters passed on list initialization */ params: Parameters; /** Parent "page-content" element */ pageContentEl: HTMLElement; /** Dom7 instance of parent "page-content" element */ $pageContentEl: Dom7Array; /** Index number of currently first rendered item */ currentFromIndex: number; /** Index number of currently last rendered item */ currentToIndex: number; /** Boolean property. Equals true if the currently last rendered item is the last item of all specified items */ reachEnd: boolean; /** Filter virtual list by passing array with indexes of items to show */ filterItems(indexes: number[]): void; /** Disable filter and display all items again */ resetFilter(): void; /** Append item to virtual list */ appendItem(item: any): void; /** Append array with items to virtual list */ appendItems(items: any[]): void; /** Prepend item to virtual list */ prependItem(item: any): void; /** Prepend array with items to virtual list */ prependItems(items: any[]): void; /** Replace item at specified index with the new one */ replaceItem(index: number, item: any): void; /** Replace all items with arrays of new items */ replaceAllItems(items: any[]): void; /** Move virtual item from oldIndex to newIndex */ moveItem(oldIndex: number, newIndex: number): void; /** Insert new item before item with specified index */ insertItemBefore(index: number, item: any): void; /** Delete item at specified index */ deleteItem(index: number): void; /** Delete items at specified array of indexes */ deleteItems(indexes: number[]): void; /** Delete all items */ deleteAllItems(): void; /** Clear virtual list cached DOM elements */ clearCache(): void; /** Destory initialized virtual list and detach all events */ destroy(): void; /** Update virtual list, including recalculation of list sizes and re-rendering of virtual list */ update(): void; /** Scroll Virtual List to specified item by its index number */ scrollToItem(index: number): void; } interface Parameters { /** Target List Block element. In case of string - CSS selector of list block element */ el: HTMLElement | CSSSelector; /** List element