Skip to content
On this page

Module: features/grids/grid

Interfaces

BaseGrid

BaseGrid: Object

The properties that are added onto a processed BoardOptions to create a Board.

NameTypeDescription
[Component]GenericComponentThe Vue component used to render this feature.
[GatherProps]() => Record<string, unknown>A function to gather the props the vue component requires for this feature.
cellStatePersistent<Record<string | number, State>>The persistent state of this grid, which is a dictionary of cell states.
cellsRecord<string | number, GridCell>A dictionary of cells within this grid.
getID(id: string | number, state: State) => stringGet the auto-generated ID for identifying a specific cell of this grid that appears in the DOM. Will not persist between refreshes or updates.
getState(id: string | number) => StateGet the persistent state of the given cell.
idstringAn auto-generated ID for identifying features that appear in the DOM. Will not persist between refreshes or updates.
setState(id: string | number, state: State) => voidSet the persistent state of the given cell.
typetypeof GridTypeA symbol that helps identify features of the same type.

Defined in

profectus/src/features/grids/grid.ts:254


GridCell

GridCell: Object

Represents a cell within a grid. These properties will typically be accessed via a cell proxy that calls functions on the grid to get the properties for a specific cell.

See

createGridProxy

NameTypeDescription
canClickbooleanWhether this cell can be clicked.
classes?Record<string, boolean>Dictionary of CSS classes to apply to this feature.
displayCoercableComponentThe main text that appears in the display.
idstringA unique identifier for the grid cell.
onClick?(e?: MouseEvent | TouchEvent) => voidA function that is called when the cell is clicked.
onHold?VoidFunctionA function that is called when the cell is held down.
startStateStateThe initial persistent state of this cell.
stateStateThe persistent state of this cell.
style?StyleValueCSS to apply to this feature.
title?CoercableComponentA header to appear at the top of the display.
visibilityboolean | VisibilityWhether this cell should be visible.

Defined in

profectus/src/features/grids/grid.ts:196


GridOptions

GridOptions: Object

An object that configures a Grid.

NameTypeDescription
colsComputable<number>The number of columns in the grid.
getCanClick?CellComputable<boolean>A computable to determine if a cell can be clicked.
getClasses?CellComputable<Record<string, boolean>>A computable to get the CSS classes for a cell.
getDisplayCellComputable<CoercableComponent>A computable to get the display component for a cell.
getStartStateComputable<State> | (id: string | number) => StateA computable to get the initial persistent state of a cell.
getStyle?CellComputable<StyleValue>A computable to get the CSS styles for a cell.
getTitle?CellComputable<CoercableComponent>A computable to get the title component for a cell.
getVisibility?CellComputable<boolean | Visibility>A computable to determine the visibility of a cell.
onClick?(id: string | number, state: State, e?: MouseEvent | TouchEvent) => voidA function that is called when a cell is clicked.
onHold?(id: string | number, state: State) => voidA function that is called when a cell is held down.
rowsComputable<number>The number of rows in the grid.
visibility?Computable<boolean | Visibility>Whether this grid should be visible.

Defined in

profectus/src/features/grids/grid.ts:224

Type Aliases

CellComputable

Ƭ CellComputable<T>: Computable<T> | (id: string | number, state: State) => T

A type representing a computable value for a cell in the grid.

Type parameters

Name
T

Defined in

profectus/src/features/grids/grid.ts:28


GenericGrid

Ƭ GenericGrid: Replace<Grid<GridOptions>, { getCanClick: ProcessedComputable<boolean> ; getVisibility: ProcessedComputable<Visibility | boolean> ; visibility: ProcessedComputable<Visibility | boolean> }>

A type that matches any valid Grid object.

Defined in

profectus/src/features/grids/grid.ts:293


Grid

Ƭ Grid<T>: Replace<T & BaseGrid, { cols: GetComputableType<T["cols"]> ; getCanClick: GetComputableTypeWithDefault<T["getCanClick"], true> ; getClasses: GetComputableType<T["getClasses"]> ; getDisplay: GetComputableType<T["getDisplay"]> ; getStartState: GetComputableType<T["getStartState"]> ; getStyle: GetComputableType<T["getStyle"]> ; getTitle: GetComputableType<T["getTitle"]> ; getVisibility: GetComputableTypeWithDefault<T["getVisibility"], Visible> ; rows: GetComputableType<T["rows"]> ; visibility: GetComputableTypeWithDefault<T["visibility"], Visible> }>

An object that represents a feature that is a grid of cells that all behave according to the same rules.

Type parameters

NameType
Textends GridOptions

Defined in

profectus/src/features/grids/grid.ts:276

Variables

GridType

Const GridType: typeof GridType

A symbol used to identify Grid features.

Defined in

profectus/src/features/grids/grid.ts:25

Functions

createGrid

createGrid<T>(optionsFunc): Grid<T>

Lazily creates a grid with the given options.

Type parameters
NameType
Textends GridOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T, BaseGrid, GenericGrid>Grid options.
Returns

Grid<T>

Defined in

profectus/src/features/grids/grid.ts:306

Components

GridCell Component

Props

NameType
visibility*processedPropType<Visibility | boolean>(Number, Boolean)
onClick(e?: MouseEvent | TouchEvent) => void
onHoldVoidFunction
display*processedPropType<CoercableComponent>(Object, String, Function)
titleprocessedPropType<CoercableComponent>(Object, String, Function)
styleprocessedPropType<StyleValue>(String, Object, Array)
canClick*processedPropType<boolean>(Boolean)
id*string

Grid Component

Props

NameType
visibility*processedPropType<Visibility | boolean>(Number, Boolean)
rows*processedPropType<number>(Number)
cols*processedPropType<number>(Number)
cells*processedPropType<Record<string, GridCell>>(Object)