@egjs/flicking
Version:
Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
85 lines (84 loc) • 2.51 kB
TypeScript
import Flicking from "../Flicking";
import VirtualPanel from "./panel/VirtualPanel";
export declare type PanelRenderCallback = ((
/** Virtual panel to render */
panel: VirtualPanel,
/** Index of the panel */
index: number) => string) | (() => string);
export interface VirtualOptions {
renderPanel: PanelRenderCallback;
initialPanelCount: number;
cache?: boolean;
panelClass?: string;
}
/**
* A manager class to add / remove virtual panels
*/
declare class VirtualManager {
private _flicking;
private _renderPanel;
private _initialPanelCount;
private _cache;
private _panelClass;
private _elements;
get elements(): {
nativeElement: HTMLElement;
visible: boolean;
}[];
/**
* A rendering function for the panel element's innerHTML
*/
get renderPanel(): PanelRenderCallback;
/**
* Initial panel count to render
* @readonly
* @defaultValue -1
*/
get initialPanelCount(): number;
/**
* Whether to cache rendered panel's innerHTML
* @defaultValue false
*/
get cache(): boolean;
/**
* The class name that will be applied to rendered panel elements
* @defaultValue "flicking-panel"
*/
get panelClass(): string;
set renderPanel(val: VirtualOptions["renderPanel"]);
set cache(val: NonNullable<VirtualOptions["cache"]>);
set panelClass(val: NonNullable<VirtualOptions["panelClass"]>);
constructor(flicking: Flicking, options: VirtualOptions | null);
init(): void;
show(index: number): void;
hide(index: number): void;
/**
* Add new virtual panels at the end of the list
* @param count - The number of panels to add
* @returns The new panels added
*/
append(count?: number): VirtualPanel[];
/**
* Add new virtual panels at the start of the list
* @param count - The number of panels to add
* @returns The new panels added
*/
prepend(count?: number): VirtualPanel[];
/**
* Add new virtual panels at the given index
* @param count - The number of panels to add
* @returns The new panels added
*/
insert(index: number, count?: number): VirtualPanel[];
/**
* Remove panels at the given index
* @param count - The number of panels to remove
* @returns The panels removed
*/
remove(index: number, count: number): VirtualPanel[];
/**
* @internal
*/
private _initVirtualElements;
}
export default VirtualManager;