Mixins / foldkit-mixins-ui

TableView

interface · packages/mixins-ui/src/table.ts:122

interface TableView<Row, Message = never> {
  readonly columns: ReadonlyArray<TableColumn<Row>>
  readonly rows: ReadonlyArray<Row>
  readonly caption?: string | undefined
  readonly rowKey?: ((row: Row) => string) | undefined
  readonly sort?:
    | {
        readonly by: Option.Option<TableSort>
        readonly onSort: (column: string) => Message
      }
    | undefined
  readonly selection?: TableSelection<Row, Message> | undefined
  readonly expansion?: TableExpansion<Row, Message> | undefined
  readonly empty?: Html | undefined
  readonly style?: NamedStyle<typeof TableSlots> | undefined
  readonly mixins?: MixinList<Message> | undefined
  readonly fluid?: boolean | undefined
}

A plain table in one call: columns with per-row values, the rows, an optional caption, a style for its slots, and mixins beside the style. No upstream component stands behind it, except the checkboxes, which are @foldkit/ui's.

Members

TableView.columns

property · packages/mixins-ui/src/table.ts:123

readonly columns: ReadonlyArray<TableColumn<Row>>

TableView.rows

property · packages/mixins-ui/src/table.ts:124

readonly rows: ReadonlyArray<Row>

TableView.caption

property · packages/mixins-ui/src/table.ts:125

readonly caption?: string | undefined

TableView.rowKey

property · packages/mixins-ui/src/table.ts:127

readonly rowKey?: ((row: Row) => string) | undefined

Each row's key, so a sorted row keeps its element; by default its place.

TableView.sort

property · packages/mixins-ui/src/table.ts:129

readonly sort?:
  | {
      readonly by: Option.Option<TableSort>
      readonly onSort: (column: string) => Message
    }
  | undefined

The sort the rows are drawn in, and the Message a press on a sortable heading sends.

TableView.selection

property · packages/mixins-ui/src/table.ts:136

readonly selection?: TableSelection<Row, Message> | undefined

A checkbox on every row, and one in the heading for all of them.

TableView.expansion

property · packages/mixins-ui/src/table.ts:137

readonly expansion?: TableExpansion<Row, Message> | undefined

TableView.empty

property · packages/mixins-ui/src/table.ts:139

readonly empty?: Html | undefined

Drawn across the table while there are no rows: an Empty.view, say.

TableView.style

property · packages/mixins-ui/src/table.ts:141

readonly style?: NamedStyle<typeof TableSlots> | undefined

A style of TableSlots, for the table's look.

TableView.mixins

property · packages/mixins-ui/src/table.ts:143

readonly mixins?: MixinList<Message> | undefined

Mixins beside the style.

TableView.fluid

property · packages/mixins-ui/src/table.ts:149

readonly fluid?: boolean | undefined

One highlight behind the body rows, following the pointer, and the lit row marked data-fluid-lit. Off by default: its Mount sends no Message, which a Scene test would have to resolve.