@playcanvas/pcui
Version:
User interface component library for the web
83 lines (82 loc) • 2.23 kB
TypeScript
import { Observer } from '@playcanvas/observer';
import { Container, ContainerArgs } from '../Container';
import { IFocusable } from '../Element';
import { Label } from '../Label';
import { RadioButton } from '../RadioButton';
/**
* The arguments for the {@link GridViewItem} constructor.
*/
interface GridViewItemArgs extends ContainerArgs {
/**
* The type of the {@link GridViewItem}. Can be `null` or 'radio'.
*/
type?: string;
/**
* If `true`, allow selecting the item. Defaults to `true`.
*/
allowSelect?: boolean;
/**
* Whether the item is selected.
*/
selected?: boolean;
/**
* The text of the item. Defaults to ''.
*/
text?: string;
/**
* Sets the tabIndex of the {@link GridViewItem}. Defaults to 0.
*/
tabIndex?: number;
}
/**
* Represents a grid view item used in {@link GridView}.
*/
declare class GridViewItem extends Container implements IFocusable {
/**
* Determines whether the item can be selected. Defaults to `true`.
*/
allowSelect: boolean;
protected _selected: boolean;
protected _radioButton: RadioButton;
protected _labelText: Label;
protected _type: string;
/**
* Creates a new GridViewItem.
*
* @param args - The arguments.
*/
constructor(args?: Readonly<GridViewItemArgs>);
destroy(): void;
protected _onRadioButtonClick: () => void;
protected _onFocus: () => void;
protected _onBlur: () => void;
focus(): void;
blur(): void;
link(observers: Observer | Observer[], paths: string | string[]): void;
unlink(): void;
/**
* Sets whether the item is selected.
*/
set selected(value: boolean);
/**
* Gets whether the item is selected.
*/
get selected(): boolean;
/**
* Sets the text of the item.
*/
set text(value: string);
/**
* Gets the text of the item.
*/
get text(): string;
/**
* Gets the next visible sibling grid view item.
*/
get nextSibling(): GridViewItem;
/**
* Gets the previous visible sibling grid view item.
*/
get previousSibling(): GridViewItem;
}
export { GridViewItem, GridViewItemArgs };