feat(listview): add required interface for generalized listview comonent (#5524)

This commit is contained in:
Peter Staev
2018-03-22 12:43:39 +02:00
committed by Manol Donev
parent 7cd8e7ef54
commit b29f04ff16
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { ListView as ListViewDefinition, ItemsSource, ItemEventData } from ".";
import { ListView as ListViewDefinition, ItemsSource, ItemEventData, TemplatedItemsView } from ".";
import { CoercibleProperty, CssProperty, Style, View, Template, KeyedTemplate, Length, Property, Color, Observable, EventData, CSSType } from "../core/view";
import { parse, parseMultipleTemplates } from "../builder";
import { Label } from "../label";
@ -19,7 +19,7 @@ export module knownMultiTemplates {
const autoEffectiveRowHeight = -1;
@CSSType("ListView")
export abstract class ListViewBase extends View implements ListViewDefinition {
export abstract class ListViewBase extends View implements ListViewDefinition, TemplatedItemsView {
public static itemLoadingEvent = "itemLoading";
public static itemTapEvent = "itemTap";
public static loadMoreItemsEvent = "loadMoreItems";

View File

@ -154,6 +154,15 @@ export interface ItemsSource {
getItem(index: number): any;
}
export interface TemplatedItemsView {
items: any[] | ItemsSource;
itemTemplate: string | Template;
itemTemplates?: string | Array<KeyedTemplate>;
refresh(): void;
on(event: "itemLoading", callback: (args: ItemEventData) => void, thisArg?: any);
off(event: "itemLoading", callback: (args: EventData) => void, thisArg?: any);
}
/**
* Represents the property backing the items property of each ListView instance.
*/