From f51968274fc92550ffe940deae1628ec7295ff2b Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 21 Oct 2020 23:40:06 +0200 Subject: [PATCH] feat: update types and Component Index --- COMPONENT_INDEX.md | 26 +++++++++++++------------- types/index.d.ts | 7 ++++++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 823a4f78..2c06dca2 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -980,19 +980,19 @@ import { DataTable } from "carbon-components-svelte"; ### Props -| Prop name | Type | Default value | Description | -| :------------- | :-------------------------------------------------- | :------------ | :--------------------------------------------------------------------------------------------------- | -| headers | {key: string; value: string;}[] | `[]` | Specify the data table headers. | -| rows | Object[] | `[]` | Specify the rows the data table should render. keys defined in `headers` are used for the row ids. | -| size | "compact" | "short" | "tall" | -- | Set the size of the data table. | -| title | string | `""` | Specify the title of the data table. | -| description | string | `""` | Specify the description of the data table. | -| zebra | boolean | `false` | Set to `true` to use zebra styles. | -| sortable | boolean | `false` | Set to `true` for the sortable variant. | -| expandable | boolean | `false` | Set to `true` for the expandable variant. Automatically set to `true` if `batchExpansion` is `true`. | -| batchExpansion | boolean | `false` | Set to `true` to enable batch expansion. | -| expandedRowIds | string[] | `[]` | Specify the row ids to be expanded. | -| stickyHeader | boolean | `false` | Set to `true` to enable a sticky header. | +| Prop name | Type | Default value | Description | +| :------------- | :----------------------------------------------------------------------------------------------- | :------------ | :--------------------------------------------------------------------------------------------------- | +| headers | {key: string; value: string; display?: (item) => string; sort?: (a, b) => number}[] | `[]` | Specify the data table headers. | +| rows | Object[] | `[]` | Specify the rows the data table should render. keys defined in `headers` are used for the row ids. | +| size | "compact" | "short" | "tall" | -- | Set the size of the data table. | +| title | string | `""` | Specify the title of the data table. | +| description | string | `""` | Specify the description of the data table. | +| zebra | boolean | `false` | Set to `true` to use zebra styles. | +| sortable | boolean | `false` | Set to `true` for the sortable variant. | +| expandable | boolean | `false` | Set to `true` for the expandable variant. Automatically set to `true` if `batchExpansion` is `true`. | +| batchExpansion | boolean | `false` | Set to `true` to enable batch expansion. | +| expandedRowIds | string[] | `[]` | Specify the row ids to be expanded. | +| stickyHeader | boolean | `false` | Set to `true` to enable a sticky header. | ### Slots diff --git a/types/index.d.ts b/types/index.d.ts index f9b3943c..0f99a102 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -787,7 +787,12 @@ export class DataTable extends CarbonSvelteComponent { * Specify the data table headers * @default [] */ - headers?: { key: string; value: string }[]; + headers?: { + key: string; + value: string; + display?: (item) => string; + sort?: (a, b) => number; + }[]; /** * Specify the rows the data table should render