UNPKG

scriptable-testlab

Version:

A lightweight, efficient tool designed to manage and update scripts for Scriptable.

106 lines (103 loc) 2.81 kB
import { AbsUITableRow } from 'scriptable-abstract'; import { MockImage } from '../../media/image.js'; import { MockColor } from '../color.js'; import { MockUITableCell } from './ui-table-cell.js'; interface UITableRowState { isHeader: boolean; height: number; backgroundColor: MockColor | null; cellSpacing: number; cells: MockUITableCell[]; dismissOnSelect: boolean; onSelect: (() => void) | null; } /** * Mock implementation of Scriptable's UITableRow * Represents a row in a UITable */ declare class MockUITableRow extends AbsUITableRow<UITableRowState> { constructor(); /** * Whether the row is a header row */ get isHeader(): boolean; /** * Sets whether the row is a header row */ set isHeader(value: boolean); /** * Height of the row */ get height(): number; /** * Sets the height of the row */ set height(value: number); /** * Background color of the row */ get backgroundColor(): MockColor | null; /** * Sets the background color of the row */ set backgroundColor(value: MockColor | null); /** * Spacing between cells */ get cellSpacing(): number; /** * Sets the spacing between cells */ set cellSpacing(value: number); /** * Whether to dismiss the table when the row is selected */ get dismissOnSelect(): boolean; /** * Sets whether to dismiss the table when the row is selected */ set dismissOnSelect(value: boolean); /** * Function to call when the row is selected */ get onSelect(): (() => void) | null; /** * Sets the function to call when the row is selected */ set onSelect(value: (() => void) | null); /** * Cells in the row */ get cells(): MockUITableCell[]; /** * Adds a cell to the row * @param cell Cell to add to the row */ addCell(cell: MockUITableCell): void; /** * Adds a text cell to the row * @param title Optional title to show in the cell * @param subtitle Optional subtitle shown below the title in the cell * @returns The created cell */ addText(title?: string, subtitle?: string): MockUITableCell; /** * Adds an image cell to the row * @param image Image to show in the cell * @returns The created cell */ addImage(image: MockImage): MockUITableCell; /** * Adds an image cell that loads from URL * @param url URL to image * @returns The created cell */ addImageAtURL(url: string): MockUITableCell; /** * Adds a button cell to the row * @param title Title of the button * @returns The created cell */ addButton(title: string): MockUITableCell; } export { MockUITableRow };