UNPKG

@nstudio/ui-collectionview

Version:

Customized NativeScript CollectionView for high performance lists. Supports vertical and horizontal modes, templating, and more.

182 lines (181 loc) 8.44 kB
import { ChangedData, CoreTypes, ItemsSource, KeyedTemplate, Label, Property, Template, View } from '@nativescript/core'; import { CollectionView as CollectionViewDefinition, Orientation } from '.'; export declare const CollectionViewTraceCategory = "NativescriptCollectionView"; export declare enum ContentInsetAdjustmentBehavior { Always = 0, Automatic = 1, Never = 2, ScrollableAxes = 3 } export declare enum CLogTypes { log = 0, info = 1, warning = 2, error = 3 } export declare const CLog: (type: CLogTypes, ...args: any[]) => void; export declare enum ListViewViewTypes { ItemView = 0 } export declare namespace knownTemplates { const itemTemplate = "itemTemplate"; } export declare namespace knownMultiTemplates { const itemTemplates = "itemTemplates"; } export interface Plugin { onLayout?: Function; onMeasure?: Function; } export declare abstract class CollectionViewBase extends View implements CollectionViewDefinition { static itemLoadingEvent: string; static itemRecyclingEvent: string; static itemDisposingEvent: string; static bindedEvent: string; static scrollEvent: string; static scrollStartEvent: string; static scrollEndEvent: string; static itemTapEvent: string; static itemHighlightEvent: string; static itemHighlightEndEvent: string; static displayItemEvent: string; static itemReorderedEvent: string; static itemReorderCheckEvent: string; static itemReorderStartingEvent: string; static itemReorderStartedEvent: string; static loadMoreItemsEvent: string; static dataPopulatedEvent: string; static knownFunctions: string[]; isBounceEnabled: boolean; isScrollEnabled: boolean; reverseLayout: boolean; orientation: Orientation; itemTemplate: string | Template; itemTemplates: string | KeyedTemplate[]; isItemsSourceIn: boolean; rowHeight: CoreTypes.PercentLengthType; colWidth: CoreTypes.PercentLengthType; verticalSpacing: CoreTypes.LengthType; horizontalSpacing: CoreTypes.LengthType; spanSize: (item: any, index: number) => number; itemOverlap: (item: any, index: number) => [number, number, number, number]; _innerWidth: number; _innerHeight: number; _effectiveRowHeight: number; _effectiveColWidth: number; loadMoreThreshold: number; scrollOffset: number; reorderEnabled: boolean; /** Used on iOS to auto update cells size if the cell request a layout change (like image itemLoading). * Experimental and true by default */ autoReloadItemOnLayout: boolean; reorderLongPressEnabled: boolean; protected _dataUpdatesSuspended: boolean; scrollBarIndicatorVisible: boolean; layoutStyle: string; plugins: string[]; static plugins: { [k: string]: Plugin; }; static registerPlugin(key: string, plugin: Plugin): void; static layoutStyles: { [k: string]: { createLayout: Function; createDelegate?: Function; }; }; static registerLayoutStyle(style: string, generator: { createLayout: Function; createDelegate?: Function; }): void; protected _itemTemplatesInternal: Map<string, KeyedTemplate>; protected _defaultTemplate: KeyedTemplate; constructor(); notifyForItemAtIndex(eventName: string, view: View, index: number, bindingContext?: any, native?: any): void; abstract refresh(): any; abstract eachChildAsync(callback: any): any; abstract refreshVisibleItems(): any; abstract isItemAtIndexVisible(index: number): any; abstract findFirstVisibleItemIndex(): number; abstract findLastVisibleItemIndex(): number; abstract scrollToIndex(index: number, animated: boolean): any; abstract scrollToOffset(value: number, animated?: boolean): any; protected updateInnerSize(): boolean; onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void; items: any[] | ItemsSource; _prepareItem(view: View, index: number): any; notifyLoading(args: any): void; getItemAtIndex(index: number): any; isHorizontal(): boolean; computeSpanCount(): number; _onRowHeightPropertyChanged(oldValue: CoreTypes.PercentLengthType, newValue: CoreTypes.PercentLengthType): void; _onColWidthPropertyChanged(oldValue: CoreTypes.PercentLengthType, newValue: CoreTypes.PercentLengthType): void; onItemViewLoaderChanged(): void; _itemViewLoader: any; get itemViewLoader(): any; set itemViewLoader(value: any); get padding(): string | CoreTypes.LengthType; set padding(value: string | CoreTypes.LengthType); get paddingTop(): CoreTypes.LengthType; set paddingTop(value: CoreTypes.LengthType); get paddingRight(): CoreTypes.LengthType; set paddingRight(value: CoreTypes.LengthType); get paddingBottom(): CoreTypes.LengthType; set paddingBottom(value: CoreTypes.LengthType); get paddingLeft(): CoreTypes.LengthType; set paddingLeft(value: CoreTypes.LengthType); resolveTemplateView(template: any): View; _getDefaultItemContent(): Label; getTemplateFromSelector(templateKey: any): KeyedTemplate; getViewForViewType(viewType: ListViewViewTypes, templateKey: string): any; private _itemTemplateSelectorBindable; _itemTemplateSelector: Function; onItemTemplateSelectorChanged(oldValue: any, newValue: any): void; private _itemIdGeneratorBindable; _itemIdGenerator: (item: any, index: number, items: any) => number; onItemIdGeneratorChanged(oldValue: any, newValue: any): void; onTemplateAdded(t: any): void; onTemplateRemoved(key: any): void; addTemplate(key: any, t: any): void; removeTemplate(key: any): void; onItemTemplatesChanged(oldValue: any, newValue: any): void; onItemTemplateChanged(oldValue: any, newValue: any): void; getItemSourceAtIndex(index: number): any; getItemArrayAtIndex(index: number): any; onItemsChanged(oldValue: any, newValue: any): void; onSpanSizeChanged: (oldValue: any, newValue: any) => void; onItemOverlapChanged: (oldValue: any, newValue: any) => void; _isDataDirty: boolean; onLoaded(): void; onSourceCollectionChanged(event: ChangedData<any>): void; onSourceCollectionChangedInternal(event: ChangedData<any>): void; suspendUpdates(): void; updatesSuspended(): boolean; resumeUpdates(refresh: boolean): void; abstract getViewForItemAtIndex(index: number): View; abstract startDragging(index: number): any; draggingView: View; _callItemReorderedEvent(oldPosition: any, newPosition: any, item: any): void; _canReorderToPosition(oldPosition: any, newPosition: any, item: any): boolean; _reorderItemInSource(oldPosition: number, newPosition: number, callEvents?: boolean): void; shouldMoveItemAtIndex(index: number): boolean; } export declare const rowHeightProperty: Property<CollectionViewBase, CoreTypes.PercentLengthType>; export declare const colWidthProperty: Property<CollectionViewBase, CoreTypes.PercentLengthType>; export declare const orientationProperty: Property<CollectionViewBase, Orientation>; export declare const itemTemplateProperty: Property<CollectionViewBase, string | Template>; export declare const itemTemplatesProperty: Property<CollectionViewBase, KeyedTemplate[]>; export declare const itemTemplateSelectorProperty: Property<CollectionViewBase, Function>; export declare const itemIdGeneratorProperty: Property<CollectionViewBase, Function>; export declare const itemsProperty: Property<CollectionViewBase, Function>; export declare const spanSizeProperty: Property<CollectionViewBase, Function>; export declare const isScrollEnabledProperty: Property<CollectionViewBase, boolean>; export declare const isBounceEnabledProperty: Property<CollectionViewBase, boolean>; export declare const reverseLayoutProperty: Property<CollectionViewBase, boolean>; export declare const loadMoreThresholdProperty: Property<CollectionViewBase, number>; export declare const reorderingEnabledProperty: Property<CollectionViewBase, boolean>; export declare const reorderLongPressEnabledProperty: Property<CollectionViewBase, boolean>; export declare const scrollBarIndicatorVisibleProperty: Property<CollectionViewBase, boolean>; export declare const autoReloadItemOnLayoutProperty: Property<CollectionViewBase, boolean>; export declare const itemOverlapProperty: Property<CollectionViewBase, Function>;