Skip to content

Commit b7a8869

Browse files
authored
Merge branch 'marmelab:master' into disable-radiobuttongroupitem
2 parents 9009339 + 6cb679c commit b7a8869

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1100
-444
lines changed

docs/DataTable.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ title: "The DataTable Component"
77

88
The `<DataTable>` component renders a list of records as a table. It supports sorting, row selection for bulk actions, a collapsible panel, hiding and reordering columns, dynamic row and cell styles, and more.
99

10+
<iframe src="https://www.youtube-nocookie.com/embed/IHjBd9WrVcI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>
11+
1012
## Usage
1113

1214
Use `<DataTable>` inside a `ListContext` (e.g., as a descendent of [`<List>`](./List.md#list) or [`<ReferenceManyField>`](./ReferenceManyField.md)). Define the table columns with its children using `<DataTable.Col>` components:
@@ -141,7 +143,7 @@ const PostList = () => (
141143
```
142144
{% endraw %}
143145

144-
**Tip**: `<DataTable>` also lets you customize the table [header](#header) and [footer](#footer) components.
146+
**Tip**: `<DataTable>` also lets you customize the table [header](#head) and [footer](#foot) components.
145147

146148
## `bulkActionButtons`
147149

@@ -691,6 +693,33 @@ const PostList = () => (
691693

692694
**Tip**: To handle sorting in your custom DataTable head component, check out the [Building a custom sort control](./ListTutorial.md#building-a-custom-sort-control) section.
693695

696+
## `hiddenColumns`
697+
698+
By default, `<DataTable>` renders all `<DataTable.Col>` children. Use the `hiddenColumns` property to set hidden columns by default.
699+
700+
```tsx
701+
import { ColumnsButton, TopToolbar, List, DataTable } from 'react-admin';
702+
703+
const PostListActions = () => (
704+
<TopToolbar>
705+
<ColumnsButton />
706+
</TopToolbar>
707+
)
708+
709+
const PostList = () => (
710+
<List actions={<PostListActions />}>
711+
<DataTable hiddenColumns={['id', 'author']}>
712+
<DataTable.Col source="id" />
713+
<DataTable.Col source="title" />
714+
<DataTable.Col source="author" />
715+
<DataTable.Col source="year" />
716+
</DataTable>
717+
</List>
718+
);
719+
```
720+
721+
Using `hiddenColumns` instead of removing `<DataTable.Col>` elements allows hidden columns to be displayed again using a `<ColumnsButton>`, as explained in the [Hiding or Reordering Columns](#hiding-or-reordering-columns) section.
722+
694723
## `hover`
695724

696725
By default, when a user hovers over a row, the background color changes to indicate the row is active. Set the `hover` prop to `false` to disable this behavior.
@@ -714,7 +743,7 @@ Using the `isRowExpandable` prop, you can customize which rows can have a collap
714743
For instance, this code shows an expand button only for rows that have a detail to show:
715744

716745
```tsx
717-
import { List, DataTable useRecordContext } from 'react-admin';
746+
import { List, DataTable, useRecordContext } from 'react-admin';
718747

719748
const PostPanel = () => {
720749
const record = useRecordContext();
@@ -960,13 +989,13 @@ Additional props are passed to [the MUI `<TableCell>`](https://mui.com/material-
960989

961990
### `align`
962991

963-
Table cells are right-aligned by default. To left-align a column, set the `align` prop to `"left"`. This is useful for numeric columns:
992+
Table cells are left-aligned by default. To right-align a column, set the `align` prop to `"right"`. This is useful for numeric columns:
964993

965994
```tsx
966995
<DataTable.Col
967996
source="nb_views"
968997
field={NumberField}
969-
align="left"
998+
align="right"
970999
/>
9711000
```
9721001

@@ -1616,7 +1645,7 @@ An action column should not be sortable, so you don't need to specify a `source`
16161645

16171646
```tsx
16181647
<DataTable.Col>
1619-
<EditButton>
1648+
<EditButton />
16201649
<DeleteButton />
16211650
</DataTable.Col>
16221651
```
@@ -1652,9 +1681,9 @@ const ProductList = () => (
16521681
</CanAccess>
16531682
<CanAccess action="read" resource="products.reference">
16541683
<DataTable.Col source="reference" />
1655-
</DataTable.Col>
1684+
</CanAccess>
16561685
<CanAccess action="read" resource="products.category_id">
1657-
<DataTable.Col source="category_id" />
1686+
<DataTable.Col source="category_id">
16581687
<ReferenceField source="category_id" reference="categories" />
16591688
</DataTable.Col>
16601689
</CanAccess>
@@ -1686,9 +1715,9 @@ As this is quite verbose, you may prefer using the `<Datagrid>` component from t
16861715
- Users must have the `'read'` permission on a resource column to see it in the export:
16871716

16881717
```jsx
1689-
{ action: "read", resource: `${resource}.${source}` }.
1718+
{ action: "read", resource: `${resource}.${source}` }
16901719
// or
1691-
{ action: "read", resource: `${resource}.*` }.
1720+
{ action: "read", resource: `${resource}.*` }
16921721
```
16931722

16941723
- Users must have the `'delete'` permission on the resource to see the `<BulkExportButton>`.
@@ -1757,7 +1786,7 @@ const ProductList = () => (
17571786
**Tip**: Adding the 'read' permission for the resource itself doesn't grant the 'read' permission on the columns. If you want a user to see all possible columns, add the 'read' permission on columns using a wildcard:
17581787

17591788
```jsx
1760-
{ action: "read", resource: "products.*" }.
1789+
{ action: "read", resource: "products.*" }
17611790
```
17621791

17631792
## Typescript

docs/Demos.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,21 @@ If you want to see what react-admin is capable of, or if you want to learn from
232232
</div>
233233
</div>
234234
</div>
235+
<div class="card">
236+
<a href="#team-wiki" class="no-decoration"><img src="./img/team-wiki.jpg" alt="Kanban Board"></a>
237+
<div class="content-card">
238+
<a href="#team-wiki" class="no-decoration">
239+
<p class="title-card"><b>Team Wiki</b></p>
240+
<p class="description-card">A Team Wiki board built with React-admin Enterprise Edition</p>
241+
</a>
242+
</div>
243+
<div class="card-footer">
244+
<div class="links-container">
245+
<p><b><a href="https://marmelab.com/team-wiki/" class="demo link">Demo</a></b></p>
246+
<p><b><a href="https://github.com/marmelab/team-wiki" class="source-code link">Source code</a></b></p>
247+
</div>
248+
</div>
249+
</div>
235250
</div>
236251

237252
## E-commerce
@@ -414,6 +429,25 @@ The source shows how to implement the following features:
414429
- [InPlace Edition](https://github.com/djhi/atomic-pm/blob/main/src/ra/EditInPlaceInput.tsx)
415430
- [Drag & drop](https://github.com/djhi/atomic-pm/blob/main/src/boards/BoardShow.tsx)
416431

432+
## Team Wiki
433+
434+
A Team Wiki board built with React-admin Enterprise edition.
435+
436+
* Demo: [https://marmelab.com/team-wiki/](https://marmelab.com/team-wiki/)
437+
* Source code: [https://github.com/marmelab/team-wiki](https://github.com/marmelab/team-wiki)
438+
439+
It leverages the following Enterprise Edition features:
440+
- [Navigation](https://react-admin-ee.marmelab.com/documentation/ra-navigation)
441+
- [History](https://react-admin-ee.marmelab.com/documentation/ra-history)
442+
- [Markdown](https://react-admin-ee.marmelab.com/documentation/ra-markdown)
443+
- [Search](https://react-admin-ee.marmelab.com/documentation/ra-search)
444+
- [Tree](https://react-admin-ee.marmelab.com/documentation/ra-tree)
445+
446+
The source shows how to implement the following features:
447+
- [AppBar with Custom Navigation and Search](https://github.com/marmelab/team-wiki/blob/main/src/layout/AppBar.tsx)
448+
- [Customizing the Markdown Input](https://github.com/marmelab/team-wiki/blob/main/src/inputs/PageMarkdownInput.tsx)
449+
- [Custom List](https://github.com/marmelab/team-wiki/blob/main/src/resources/pages/PageList.tsx)
450+
417451
## Broadcom Layer 7 API Hub
418452

419453
A framework built on top of react-admin for building developer portals.

docs/InPlaceEditor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ For example, to render a `<SelectField>` in read mode, you can use the following
158158

159159
The component to render in edit mode. By default, it's a `<TextInput>` using the `source` prop.
160160

161-
You can use any [input component](./Input.md) instead, as it renders in a `<Form>`. You will probably need to tweak the input variant, margin and style so that it matches the style of the read mode component.
161+
You can use any [input component](./Inputs.md) instead, as it renders in a `<Form>`. You will probably need to tweak the input variant, margin and style so that it matches the style of the read mode component.
162162

163163
<video controls autoplay playsinline muted loop>
164164
<source src="./img/InPlaceEditorField.mp4" type="video/mp4"/>
@@ -293,4 +293,4 @@ You can use the `sx` prop to apply styles to the read mode, edit mode and saving
293293

294294
- `& .RaInPlaceEditor-reading`: The read mode.
295295
- `& .RaInPlaceEditor-editing`: The editing mode.
296-
- `& .RaInPlaceEditor-saving`: The saving mode.
296+
- `& .RaInPlaceEditor-saving`: The saving mode.

docs/Reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ title: "Index"
174174

175175
* [`<SaveButton>`](./SaveButton.md)
176176
* [`<SavedQueriesList>`](./SavedQueriesList.md)
177+
* [`<Scheduler>`](./Scheduler.md)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" />
177178
* [`<Search>`](./Search.md)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" />
178179
* [`<SearchInput>`](./SearchInput.md)
179180
* [`<SearchWithResult>`](./SearchWithResult.md)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" />

0 commit comments

Comments
 (0)