@triniwiz/nativescript-pager
Version:
A Carousel/Pager plugin for NativeScript
89 lines (88 loc) • 4.32 kB
TypeScript
import { AfterContentInit, DoCheck, ElementRef, EmbeddedViewRef, EventEmitter, InjectionToken, IterableDiffer, IterableDiffers, NgZone, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from "@angular/core";
import { KeyedTemplate, View } from "@nativescript/core";
import { EventData, Template, ItemEventData, ItemsSource } from "@nativescript/core";
import { Pager } from "@triniwiz/nativescript-pager";
import * as i0 from "@angular/core";
export interface PagerTemplatedItemsView {
items: any[] | ItemsSource;
itemTemplate: string | Template;
itemTemplates?: string | Array<KeyedTemplate>;
refresh(): void;
on(event: "itemLoading", callback: (args: ItemEventData) => void, thisArg?: any): any;
on(event: "itemDisposing", callback: (args: ItemEventData) => void, thisArg?: any): any;
off(event: "itemLoading", callback: (args: EventData) => void, thisArg?: any): any;
off(event: "itemDisposing", callback: (args: EventData) => void, thisArg?: any): any;
}
export declare class ItemContext {
$implicit?: any;
item?: any;
index?: number;
even?: boolean;
odd?: boolean;
constructor($implicit?: any, item?: any, index?: number, even?: boolean, odd?: boolean);
}
export interface SetupItemViewArgs {
view: EmbeddedViewRef<any>;
data: any;
index: number;
context: ItemContext;
}
export declare abstract class TemplatedItemsComponent implements DoCheck, OnDestroy, AfterContentInit {
private _iterableDiffers;
private zone;
abstract get nativeElement(): Pager;
protected templatedItemsView: Pager;
protected _items: any;
protected _differ: IterableDiffer<KeyedTemplate>;
protected _templateMap: Map<string, KeyedTemplate>;
private _selectedIndex;
loader: ViewContainerRef;
setupItemView: EventEmitter<SetupItemViewArgs>;
itemTemplateQuery: TemplateRef<ItemContext>;
itemTemplate: TemplateRef<ItemContext>;
get items(): any;
set items(value: any);
get selectedIndex(): number;
set selectedIndex(value: number);
ngAfterViewInit(): void;
constructor(_elementRef: ElementRef, _iterableDiffers: IterableDiffers, zone: NgZone);
ngAfterContentInit(): void;
ngOnDestroy(): void;
private setItemTemplates;
registerTemplate(key: string, template: TemplateRef<ItemContext>): void;
onItemLoading(args: ItemEventData): void;
onItemDisposing(args: ItemEventData): void;
setupViewRef(viewRef: EmbeddedViewRef<ItemContext>, data: any, index: number): void;
protected getItemTemplateViewFactory(template: TemplateRef<ItemContext>): () => View;
private detectChangesOnChild;
ngDoCheck(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<TemplatedItemsComponent, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplatedItemsComponent, never, never, { "items": "items"; "selectedIndex": "selectedIndex"; }, { "setupItemView": "setupItemView"; }, ["itemTemplateQuery"], never, false>;
}
export interface ComponentView {
rootNodes: Array<any>;
destroy(): void;
}
export declare type RootLocator = (nodes: Array<any>, nestLevel: number) => View;
export declare function getItemViewRoot(viewRef: ComponentView, rootLocator?: RootLocator): View;
export declare const TEMPLATED_ITEMS_COMPONENT: InjectionToken<TemplatedItemsComponent>;
export declare class PagerItemDirective implements OnInit {
private templateRef;
private owner;
private viewContainer;
private item;
constructor(templateRef: TemplateRef<any>, owner: TemplatedItemsComponent, viewContainer: ViewContainerRef);
private ensureItem;
private applyConfig;
ngOnInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<PagerItemDirective, [null, { host: true; }, null]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<PagerItemDirective, "[pagerItem]", never, {}, {}, never, never, false>;
}
export declare class TemplateKeyDirective {
private templateRef;
private comp;
constructor(templateRef: TemplateRef<any>, comp: TemplatedItemsComponent);
set pagerTemplateKey(value: any);
static ɵfac: i0.ɵɵFactoryDeclaration<TemplateKeyDirective, [null, { host: true; }]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplateKeyDirective, "[pagerTemplateKey]", never, { "pagerTemplateKey": "pagerTemplateKey"; }, {}, never, never, false>;
}