mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
feat(listview): add required interface for generalized listview comonent (#5524)
This commit is contained in:
@ -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 { CoercibleProperty, CssProperty, Style, View, Template, KeyedTemplate, Length, Property, Color, Observable, EventData, CSSType } from "../core/view";
|
||||||
import { parse, parseMultipleTemplates } from "../builder";
|
import { parse, parseMultipleTemplates } from "../builder";
|
||||||
import { Label } from "../label";
|
import { Label } from "../label";
|
||||||
@ -19,7 +19,7 @@ export module knownMultiTemplates {
|
|||||||
const autoEffectiveRowHeight = -1;
|
const autoEffectiveRowHeight = -1;
|
||||||
|
|
||||||
@CSSType("ListView")
|
@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 itemLoadingEvent = "itemLoading";
|
||||||
public static itemTapEvent = "itemTap";
|
public static itemTapEvent = "itemTap";
|
||||||
public static loadMoreItemsEvent = "loadMoreItems";
|
public static loadMoreItemsEvent = "loadMoreItems";
|
||||||
|
9
tns-core-modules/ui/list-view/list-view.d.ts
vendored
9
tns-core-modules/ui/list-view/list-view.d.ts
vendored
@ -154,6 +154,15 @@ export interface ItemsSource {
|
|||||||
getItem(index: number): any;
|
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.
|
* Represents the property backing the items property of each ListView instance.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user