From 8ac392b88fcee75d9797d8d2c84e31e4fdf8be44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:56:24 +0200 Subject: [PATCH 1/3] Update defaultLayouts docs --- packages/dataviews/README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 10da0e364a4995..4473edc6902d0e 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -22,6 +22,7 @@ const Example = () => { fields={ fields } view={ view } onChangeView={ onChangeView } + defaultLayouts={ defaultLayouts } actions={ actions } paginationInfo={ paginationInfo } /> @@ -169,8 +170,8 @@ Properties: - `direction`: the direction to use for sorting, one of `asc` or `desc`. - `fields`: the `id` of the fields that are visible in the UI. - `layout`: config that is specific to a particular layout type. - - `mediaField`: used by the `grid` and `list` layouts. The `id` of the field to be used for rendering each card's media. - - `primaryField`: used by the `table`, `grid` and `list` layouts. The `id` of the field to be highlighted in each row/card/item. + - `mediaField`: used by the `grid` and `list` layouts. The `id` of the field to be used for rendering each card's media. This field is not hiddable. + - `primaryField`: used by the `table`, `grid` and `list` layouts. The `id` of the field to be highlighted in each row/card/item. This field is not hiddable. ### `onChangeView`: `function` @@ -276,7 +277,19 @@ Whether the data is loading. `false` by default. ### `defaultLayouts`: `Record< string, view >` -Default layouts. By default, uses empty layouts: `table`, `grid`, `list`. +This property provides layout information about the view types that are active. If empty, enables all layout types (see "Layout Types") with empty layout data. + +For example, this is how you'd enable only the table view type: + +```js +const defaultLayouts = { + table: { + layout: { + primaryKey: 'my-key', + } + } +}; +``` ### `onChangeSelection`: `function` From 1743e64abd839705e9ce0af2a9def87b3b565c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:57:17 +0200 Subject: [PATCH 2/3] Document badgeFields --- packages/dataviews/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 4473edc6902d0e..b04d271de1cdb5 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -170,8 +170,9 @@ Properties: - `direction`: the direction to use for sorting, one of `asc` or `desc`. - `fields`: the `id` of the fields that are visible in the UI. - `layout`: config that is specific to a particular layout type. - - `mediaField`: used by the `grid` and `list` layouts. The `id` of the field to be used for rendering each card's media. This field is not hiddable. - `primaryField`: used by the `table`, `grid` and `list` layouts. The `id` of the field to be highlighted in each row/card/item. This field is not hiddable. + - `mediaField`: used by the `grid` and `list` layouts. The `id` of the field to be used for rendering each card's media. This field is not hiddable. + - `badgeFields`: used by the `grid` layout. It renders these fields as badges without a label. ### `onChangeView`: `function` From 1fbc971a7bf19b73e5ee6597f91bd0e3eac015c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:59:55 +0200 Subject: [PATCH 3/3] Document columnFields --- packages/dataviews/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index b04d271de1cdb5..c82a748df98858 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -172,7 +172,8 @@ Properties: - `layout`: config that is specific to a particular layout type. - `primaryField`: used by the `table`, `grid` and `list` layouts. The `id` of the field to be highlighted in each row/card/item. This field is not hiddable. - `mediaField`: used by the `grid` and `list` layouts. The `id` of the field to be used for rendering each card's media. This field is not hiddable. - - `badgeFields`: used by the `grid` layout. It renders these fields as badges without a label. + - `badgeFields`: used by the `grid` layout. It renders these fields without a label and styled as badges. + - `columnFields`: used by the `grid` layout. It renders the label and the field data vertically stacked instead of horizontally (the default). ### `onChangeView`: `function`