uicore-ts
Version:
UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework tha
119 lines (118 loc) • 5.64 kB
TypeScript
import { UINativeScrollView } from "./UINativeScrollView";
import { UIPoint } from "./UIPoint";
import { UIRectangle } from "./UIRectangle";
import { UIView, UIViewBroadcastEvent } from "./UIView";
interface UITableViewRowView extends UIView {
_UITableViewRowIndex?: number;
}
export interface UITableViewReusableViewsContainerObject {
[key: string]: UIView[];
}
export interface UITableViewReusableViewPositionObject {
bottomY: number;
topY: number;
isValid: boolean;
}
export declare class UITableView extends UINativeScrollView {
allRowsHaveEqualHeight: boolean;
_visibleRows: UITableViewRowView[];
/** Shared intrinsic size cache identifier used for all row views when
* allRowsHaveEqualHeight is YES. Stable for the lifetime of the table;
* the shared cache bucket is invalidated on reloadData and
* clearIntrinsicSizeCache so the height is re-measured after data changes. */
_equalRowHeightCacheIdentifier: string;
_rowPositions: UITableViewReusableViewPositionObject[];
_highestValidRowPositionIndex: number;
_unusedReusableViews: UITableViewReusableViewsContainerObject;
_fullHeightView: UIView;
_rowIDIndex: number;
reloadsOnLanguageChange: boolean;
sidePadding: number;
cellWeights?: number[];
_persistedData: any[];
_needsDrawingOfVisibleRowsBeforeLayout: boolean;
_isDrawVisibleRowsScheduled: boolean;
_shouldAnimateNextLayout?: boolean;
usesVirtualLayoutingForIntrinsicSizing: boolean;
animationDuration: number;
_intersectionObserver?: IntersectionObserver;
/** Row index with -1 meaning the header row. undefined means no focus. */
_keyboardFocusedRowIndex: number | undefined;
/** Cell index within the focused row. */
_keyboardFocusedCellIndex: number;
/** Total number of data columns (excludes left/right side cells). Set by CBDataView. */
_columnCount: number;
/** Called by UITableView when the focused row/cell changes. CBDataView overrides this. */
keyboardFocusDidChange?: (rowIndex: number | undefined, cellIndex: number) => void;
/** Fired when Enter is pressed on a focused cell. Passes rowIndex and cellIndex. */
keyboardDidActivateCell?: (rowIndex: number, cellIndex: number) => void;
_keydownHandler?: (event: KeyboardEvent) => void;
_keyboardListenersAttached: boolean;
get _reusableViews(): UITableViewReusableViewsContainerObject;
constructor(elementID?: string);
/**
* The element that receives tabIndex, ARIA grid role, and all keyboard/pointer
* listeners. Defaults to the table's own element. CBDataView overrides this
* to a container that wraps both the header and the table, so the focus ring
* encompasses both.
*/
_keyboardListenerElement: HTMLElement;
_setupGridAccessibility(): void;
/** Called by CBDataView after descriptors change. */
setColumnCount(count: number): void;
/** Called by CBDataView after data loads. */
setRowCount(count: number): void;
_setupKeyboardNavigation(): void;
/**
* Move keyboard focus to a specific row and cell.
* rowIndex = -1 means the header row.
*/
_setKeyboardFocus(rowIndex: number, cellIndex: number): void;
_clearKeyboardFocus(): void;
_clearKeyboardFocusOnRow(rowIndex: number): void;
_applyKeyboardFocusToVisibleRows(clearAll?: boolean): void;
_scrollRowIntoView(rowIndex: number): void;
/** Expose so CBDataView can call it after loading data. */
focusRowAtIndex(rowIndex: number, cellIndex?: number): void;
_windowScrollHandler: () => void;
_resizeHandler: () => void;
_setupViewportScrollAndResizeHandlersIfNeeded(): void;
_cleanupViewportScrollListeners(): void;
wasRemovedFromViewTree(): void;
loadData(): void;
reloadData(): void;
highlightChanges(previousData: any[], newData: any[]): void;
highlightRowAsNew(row: UIView): void;
invalidateSizeOfRowWithIndex(index: number, animateChange?: boolean): void;
_rowPositionWithIndex(index: number, positions?: UITableViewReusableViewPositionObject[]): UITableViewReusableViewPositionObject;
_calculateAllPositions(): void;
_calculatePositionsUntilIndex(maxIndex: number): void;
_heightForAnyRow(calculateVisibleRows?: boolean): number;
indexesForVisibleRows(paddingRatio?: number): number[];
_removeVisibleRows(): void;
_removeAllReusableRows(): void;
_markReusableViewAsUnused(row: UIView): void;
_scheduleDrawVisibleRows(): void;
_drawVisibleRows(): void;
visibleRowWithIndex(rowIndex: number | undefined): UIView | undefined;
isRowWithIndexVisible(rowIndex: number): boolean;
reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView;
newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView;
heightForRowWithIndex(index: number): number;
numberOfRows(): number;
defaultRowPersistenceDataItem(): any;
persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any;
viewForRowWithIndex(rowIndex: number): UITableViewRowView;
didScrollToPosition(offsetPosition: UIPoint): void;
willMoveToSuperview(superview: UIView): void;
wasAddedToViewTree(): void;
setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean): void;
didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
clearIntrinsicSizeCache(): void;
private _layoutAllRows;
private _animateLayoutAllRows;
didLayoutSubviews(): void;
layoutSubviews(): void;
intrinsicContentHeight(constrainingWidth?: number): number;
}
export {};