Skip to content

Commit

Permalink
doc: link to TableState
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lee committed Jun 27, 2022
1 parent eed7fe2 commit 9096f02
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 22 deletions.
20 changes: 5 additions & 15 deletions docs/src/routes/docs/[...2]api/[...3]create-columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ _Defaults to the value of `accessor` if a string accessor is passed_. Required i

#### `columnDef.header: RenderConfig | ((state) => RenderConfig)`

<!-- TODO Document and link `TableState` -->

Defines the component to use for the header cell of the data column.

`header` is either a [`RenderConfig`](./--render.md#renderconfig), or a function that takes `TableState` and returns a [`RenderConfig`](./--render.md#renderconfig).
`header` is either a [`RenderConfig`](./--render.md#renderconfig), or a function that takes [`TableState`](./table-state.md) and returns a [`RenderConfig`](./--render.md#renderconfig).

:::example

Expand Down Expand Up @@ -119,12 +117,10 @@ const columns = table.createColumns([

Defines the component to use for the body cells of the data column.

<!-- TODO Document and link `TableState` -->

`cell` is a function that takes

1. an object with a reference to the [`BodyRow`](./body-row.md), `DataColumn`, and `value` of the cell, and
2. `TableState`,
2. [`TableState`](./table-state.md),

and returns a [`RenderConfig`](./--render.md#renderconfig).

Expand Down Expand Up @@ -219,11 +215,9 @@ const columns = table.createColumns([

#### `groupDef.header: RenderConfig | ((state) => RenderConfig)`

<!-- TODO Document and link `TableState` -->

Defines the component to use for the header cell of the group column.

`header` is either a [`RenderConfig`](./--render.md#renderconfig), or a function that takes `TableState` and returns a [`RenderConfig`](./--render.md#renderconfig).
`header` is either a [`RenderConfig`](./--render.md#renderconfig), or a function that takes [`TableState`](./table-state.md) and returns a [`RenderConfig`](./--render.md#renderconfig).

:::example

Expand Down Expand Up @@ -302,11 +296,9 @@ const columns = table.createColumns([

#### `displayDef.header: RenderConfig | ((state) => RenderConfig)`

<!-- TODO Document and link `TableState` -->

Defines the component to use for the header cell of the display column.

`header` is either a [`RenderConfig`](./--render.md#renderconfig), or a function that takes `TableState` and returns a [`RenderConfig`](./--render.md#renderconfig).
`header` is either a [`RenderConfig`](./--render.md#renderconfig), or a function that takes [`TableState`](./table-state.md) and returns a [`RenderConfig`](./--render.md#renderconfig).

:::example

Expand Down Expand Up @@ -336,11 +328,9 @@ const columns = table.createColumns([

Defines the component to use for the body cells of the display column.

<!-- TODO Document and link `TableState` -->

`cell` is a function that takes

1. an object with a reference to the [`BodyRow`](./body-row.md) and `DataColumn` of the cell, and
2. `TableState`,
2. [`TableState`](./table-state.md),

and returns a [`RenderConfig`](./--render.md#renderconfig).
2 changes: 1 addition & 1 deletion docs/src/routes/docs/[...2]api/[...5]table-view-model.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: TableViewModel
description: Generate the view model for the table
description: The view model of the data table
sidebar_title: TableViewModel
---

Expand Down
24 changes: 24 additions & 0 deletions docs/src/routes/docs/[...2]api/[...6]table-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: TableState
description: The current state of the table
sidebar_title: TableState
---

<script>
import { useHljs } from '$lib/utils/useHljs';
useHljs('ts');
</script>

# {$frontmatter.title}

`TableState` is the [`TableViewModel`](./table-view-model.md) with two additional properties.

## Usage

### `data: ReadOrWritable<Item[]>`

A reference to the original data source.

### `columns: Column[]`

A reference to the columns of the table.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ Receives `filterValue` and the column cell `value`, and returns `true` if the ce

Defines the component to render on `HeaderCell->props.[pluginName].render`.

<!-- TODO Document and link `TableState` -->

`renderProps` extends `TableState` and includes additional properties.
`renderProps` extends [`TableState`](../api/table-state.md) and includes additional properties.

#### `renderProps.id: string`

Expand Down
4 changes: 1 addition & 3 deletions docs/src/routes/docs/[...3]plugins/[...9]add-group-by.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,10 @@ _Required if `value` is not a `string` or `number`, defaults to (value) => value

Defines the component to use for the body cells of aggregated values on grouping rows.

<!-- TODO Document and link `TableState` -->

`cell` is a function that takes

1. an object with a reference to the `BodyRow`, `DataColumn`, and `value` of the cell, and
2. `TableState`,
2. [`TableState`](../api/table-state.md),

and returns a `RenderConfig`.

Expand Down

1 comment on commit 9096f02

@vercel
Copy link

@vercel vercel bot commented on 9096f02 Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.