From 9096f02282ac162dafd4b41a99c1591c7bfb39f8 Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Mon, 27 Jun 2022 19:03:10 +0800 Subject: [PATCH] doc: link to TableState --- .....9]header-row.md => [...10]header-row.md} | 0 ...0]header-cell.md => [...11]header-cell.md} | 0 ...{[...11]body-row.md => [...12]body-row.md} | 0 ......12]body-cell.md => [...13]body-cell.md} | 0 .../docs/[...2]api/[...3]create-columns.md | 20 ++++------------ .../docs/[...2]api/[...5]table-view-model.md | 2 +- .../docs/[...2]api/[...6]table-state.md | 24 +++++++++++++++++++ ...reate-render.md => [...7]create-render.md} | 0 .../{[...7]--render.md => [...8]--render.md} | 0 ...{[...8]subscribe.md => [...9]subscribe.md} | 0 .../[...3]plugins/[...3]add-column-filters.md | 4 +--- .../docs/[...3]plugins/[...9]add-group-by.md | 4 +--- 12 files changed, 32 insertions(+), 22 deletions(-) rename docs/src/routes/docs/[...2]api/{[...9]header-row.md => [...10]header-row.md} (100%) rename docs/src/routes/docs/[...2]api/{[...10]header-cell.md => [...11]header-cell.md} (100%) rename docs/src/routes/docs/[...2]api/{[...11]body-row.md => [...12]body-row.md} (100%) rename docs/src/routes/docs/[...2]api/{[...12]body-cell.md => [...13]body-cell.md} (100%) create mode 100644 docs/src/routes/docs/[...2]api/[...6]table-state.md rename docs/src/routes/docs/[...2]api/{[...6]create-render.md => [...7]create-render.md} (100%) rename docs/src/routes/docs/[...2]api/{[...7]--render.md => [...8]--render.md} (100%) rename docs/src/routes/docs/[...2]api/{[...8]subscribe.md => [...9]subscribe.md} (100%) diff --git a/docs/src/routes/docs/[...2]api/[...9]header-row.md b/docs/src/routes/docs/[...2]api/[...10]header-row.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...9]header-row.md rename to docs/src/routes/docs/[...2]api/[...10]header-row.md diff --git a/docs/src/routes/docs/[...2]api/[...10]header-cell.md b/docs/src/routes/docs/[...2]api/[...11]header-cell.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...10]header-cell.md rename to docs/src/routes/docs/[...2]api/[...11]header-cell.md diff --git a/docs/src/routes/docs/[...2]api/[...11]body-row.md b/docs/src/routes/docs/[...2]api/[...12]body-row.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...11]body-row.md rename to docs/src/routes/docs/[...2]api/[...12]body-row.md diff --git a/docs/src/routes/docs/[...2]api/[...12]body-cell.md b/docs/src/routes/docs/[...2]api/[...13]body-cell.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...12]body-cell.md rename to docs/src/routes/docs/[...2]api/[...13]body-cell.md diff --git a/docs/src/routes/docs/[...2]api/[...3]create-columns.md b/docs/src/routes/docs/[...2]api/[...3]create-columns.md index 6ff9c94..b8b0457 100644 --- a/docs/src/routes/docs/[...2]api/[...3]create-columns.md +++ b/docs/src/routes/docs/[...2]api/[...3]create-columns.md @@ -77,11 +77,9 @@ _Defaults to the value of `accessor` if a string accessor is passed_. Required i #### `columnDef.header: RenderConfig | ((state) => RenderConfig)` - - 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 @@ -119,12 +117,10 @@ const columns = table.createColumns([ Defines the component to use for the body cells of the data column. - - `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). @@ -219,11 +215,9 @@ const columns = table.createColumns([ #### `groupDef.header: RenderConfig | ((state) => RenderConfig)` - - 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 @@ -302,11 +296,9 @@ const columns = table.createColumns([ #### `displayDef.header: RenderConfig | ((state) => RenderConfig)` - - 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 @@ -336,11 +328,9 @@ const columns = table.createColumns([ Defines the component to use for the body cells of the display column. - - `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). diff --git a/docs/src/routes/docs/[...2]api/[...5]table-view-model.md b/docs/src/routes/docs/[...2]api/[...5]table-view-model.md index 1147b88..3e266c9 100644 --- a/docs/src/routes/docs/[...2]api/[...5]table-view-model.md +++ b/docs/src/routes/docs/[...2]api/[...5]table-view-model.md @@ -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 --- diff --git a/docs/src/routes/docs/[...2]api/[...6]table-state.md b/docs/src/routes/docs/[...2]api/[...6]table-state.md new file mode 100644 index 0000000..20d8259 --- /dev/null +++ b/docs/src/routes/docs/[...2]api/[...6]table-state.md @@ -0,0 +1,24 @@ +--- +title: TableState +description: The current state of the table +sidebar_title: TableState +--- + + + +# {$frontmatter.title} + +`TableState` is the [`TableViewModel`](./table-view-model.md) with two additional properties. + +## Usage + +### `data: ReadOrWritable` + +A reference to the original data source. + +### `columns: Column[]` + +A reference to the columns of the table. diff --git a/docs/src/routes/docs/[...2]api/[...6]create-render.md b/docs/src/routes/docs/[...2]api/[...7]create-render.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...6]create-render.md rename to docs/src/routes/docs/[...2]api/[...7]create-render.md diff --git a/docs/src/routes/docs/[...2]api/[...7]--render.md b/docs/src/routes/docs/[...2]api/[...8]--render.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...7]--render.md rename to docs/src/routes/docs/[...2]api/[...8]--render.md diff --git a/docs/src/routes/docs/[...2]api/[...8]subscribe.md b/docs/src/routes/docs/[...2]api/[...9]subscribe.md similarity index 100% rename from docs/src/routes/docs/[...2]api/[...8]subscribe.md rename to docs/src/routes/docs/[...2]api/[...9]subscribe.md diff --git a/docs/src/routes/docs/[...3]plugins/[...3]add-column-filters.md b/docs/src/routes/docs/[...3]plugins/[...3]add-column-filters.md index 65d88be..4f18015 100644 --- a/docs/src/routes/docs/[...3]plugins/[...3]add-column-filters.md +++ b/docs/src/routes/docs/[...3]plugins/[...3]add-column-filters.md @@ -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`. - - -`renderProps` extends `TableState` and includes additional properties. +`renderProps` extends [`TableState`](../api/table-state.md) and includes additional properties. #### `renderProps.id: string` diff --git a/docs/src/routes/docs/[...3]plugins/[...9]add-group-by.md b/docs/src/routes/docs/[...3]plugins/[...9]add-group-by.md index 1c63d1c..df478a7 100644 --- a/docs/src/routes/docs/[...3]plugins/[...9]add-group-by.md +++ b/docs/src/routes/docs/[...3]plugins/[...9]add-group-by.md @@ -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. - - `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`.