You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,27 @@
1
1
# Changelog
2
2
3
+
## 5.11.4
4
+
5
+
* Fix `useGetManyAggregate` merge queries with different `meta` ([#10969](https://github.com/marmelab/react-admin/pull/10969)) ([djhi](https://github.com/djhi))
6
+
* Fix `useDeleteController` should get the record from closest `RecordContext` ([#10967](https://github.com/marmelab/react-admin/pull/10967)) ([djhi](https://github.com/djhi))
7
+
* Fix incompatibility with latest `@tanstack/react-query` ([#10964](https://github.com/marmelab/react-admin/pull/10964)) ([djhi](https://github.com/djhi))
* Fix `<ReferenceInput>` don't return currently selected choice when `enableGetChoices` returns `false` ([#10958](https://github.com/marmelab/react-admin/pull/10958)) ([djhi](https://github.com/djhi))
10
+
* Fix `<FilterLiveForm>` may override latest users inputs when they type at the same pace than the debounce delay ([#10952](https://github.com/marmelab/react-admin/pull/10952)) ([djhi](https://github.com/djhi))
11
+
*[Doc] Update `<ReferenceManyInput>` documentation to mention `rankSource` ([#10970](https://github.com/marmelab/react-admin/pull/10970)) ([djhi](https://github.com/djhi))
12
+
*[Doc] Add logo to `ra-core` documentation ([#10968](https://github.com/marmelab/react-admin/pull/10968)) ([djhi](https://github.com/djhi))
*[Doc] Improve sidebar scrolling on `ra-core` documentation ([#10963](https://github.com/marmelab/react-admin/pull/10963)) ([slax57](https://github.com/slax57))
15
+
*[Doc] Fix some incorrect video types ([#10962](https://github.com/marmelab/react-admin/pull/10962)) ([slax57](https://github.com/slax57))
16
+
*[Doc] Add missing props to `<ReferenceArrayFieldBase>` and `<ReferenceManyFieldBase>` documentation ([#10956](https://github.com/marmelab/react-admin/pull/10956)) ([slax57](https://github.com/slax57))
17
+
*[Doc] Fix `<BulkActionsToolbar selectAllButton>` only accepts an element ([#10954](https://github.com/marmelab/react-admin/pull/10954)) ([slax57](https://github.com/slax57))
* Fix `useLogout` does not redirect to the `checkAuth` call `redirectTo` property ([#10949](https://github.com/marmelab/react-admin/pull/10949)) ([djhi](https://github.com/djhi))
23
+
*[Doc] Update `disableSort` property in `<DataTable>` documentation ([#10947](https://github.com/marmelab/react-admin/pull/10947)) ([johannchopin-buyco](https://github.com/johannchopin-buyco))
24
+
3
25
## 5.11.2
4
26
5
27
* Fix `<BulkDeleteWithConfirmButton>` default color ([#10928](https://github.com/marmelab/react-admin/pull/10928)) ([wmatex](https://github.com/wmatex))
Copy file name to clipboardExpand all lines: docs/Features.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -257,7 +257,7 @@ Let's be realistic: Many developers focus on features first and don't have much
257
257
React-admin provides **components that look pretty good out of the box**, so even if you don't spend time on the UI, it won't look bad (unless you try hard). React-admin uses [Material UI](https://mui.com/material-ui/getting-started/), which is a React implementation of the [Material Design](https://material.io/) guidelines, the most battle-tested design system.
Copy file name to clipboardExpand all lines: docs/ReferenceArrayFieldBase.md
+99Lines changed: 99 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,10 @@ You can change how the list of related records is rendered by passing a custom c
89
89
|`reference`| Required |`string`| - | The name of the resource for the referenced records, e.g. 'tags' |
90
90
|`children`| Optional\*|`Element`|| One or several elements that render a list of records based on a `ListContext`|
91
91
|`render`| Optional\*|`(ListContext) => Element`|| A function that takes a list context and renders a list of records |
92
+
|`empty`| Optional |`ReactNode`| - | The component to render when the related records list is empty |
93
+
|`error`| Optional |`ReactNode`| - | The component to render when an error occurs while fetching the related records |
92
94
|`filter`| Optional |`Object`| - | Filters to use when fetching the related records (the filtering is done client-side) |
95
+
|`loading`| Optional |`ReactNode`| - | The component to render while fetching the related records |
93
96
|`offline`| Optional |`ReactNode`|| The component to render when there is no connectivity and the record isn't in the cache |
94
97
|`perPage`| Optional |`number`| 1000 | Maximum number of results to display |
95
98
|`queryOptions`| Optional |[`UseQuery Options`](https://tanstack.com/query/v5/docs/react/reference/useQuery)|`{}`|`react-query` options for the `getMany` query |
By default, `<ReferenceArrayFieldBase>` renders its children even when the related records list is empty. You can customize what is rendered by providing your own component via the `empty` prop:
You can also have `<ReferenceArrayFieldBase>` render nothing in that case by setting the prop to `null`:
154
+
155
+
```jsx
156
+
<ReferenceArrayFieldBase
157
+
source="tag_ids"
158
+
reference="tags"
159
+
empty={null}
160
+
>
161
+
...
162
+
</ReferenceArrayFieldBase>
163
+
```
164
+
165
+
## `error`
166
+
167
+
By default, `<ReferenceArrayFieldBase>` renders its children even when an error occurs while fetching the related records. You can customize what is rendered by providing your own component via the `error` prop:
You can also have `<ReferenceArrayFieldBase>` render nothing in that case by setting the prop to `null`:
186
+
187
+
```jsx
188
+
<ReferenceArrayFieldBase
189
+
source="tag_ids"
190
+
reference="tags"
191
+
error={null}
192
+
>
193
+
...
194
+
</ReferenceArrayFieldBase>
195
+
```
196
+
130
197
## `render`
131
198
132
199
Alternatively to `children`, you can pass a `render` function prop to `<ReferenceArrayFieldBase>`. The `render` prop will receive the `ListContext` as its argument, allowing to inline the rendering logic.
@@ -174,6 +241,38 @@ For instance, to render only tags that are 'published', you can use the followin
174
241
```
175
242
{% endraw %}
176
243
244
+
## `loading`
245
+
246
+
By default, `<ReferenceArrayFieldBase>` renders its children even while fetching the related records. You can customize what is rendered by providing your own component via the `loading` prop:
You can also have `<ReferenceArrayFieldBase>` render nothing in that case by setting the prop to `null`:
265
+
266
+
```jsx
267
+
<ReferenceArrayFieldBase
268
+
source="tag_ids"
269
+
reference="tags"
270
+
loading={null}
271
+
>
272
+
...
273
+
</ReferenceArrayFieldBase>
274
+
```
275
+
177
276
## `offline`
178
277
179
278
By default, `<ReferenceArrayFieldBase>` renders nothing when there is no connectivity and the records haven't been cached yet. You can provide your own component via the `offline` prop:
| `children` | Optional | `Element` | - | One or several elements that render a list of records based on a `ListContext` |
92
+
| `children` | Optional\* | `Element` | - | One or several elements that render a list of records based on a `ListContext` |
93
93
| `render` | Optional\* | `(ListContext) =>Element` | - | Function that receives a `ListContext` and returns an element |
94
-
| `debounce` | Optional\* | `number` | 500 | debounce time in ms for the `setFilters` callbacks |
94
+
| `debounce` | Optional | `number` | 500 | debounce time in ms for the `setFilters` callbacks |
95
95
| `empty` | Optional | `ReactNode` | - | Element to display when there are no related records. |
96
+
| `error` | Optional | `ReactNode` | - | The component to render when an error occurs while fetching the related records |
96
97
| `filter` | Optional | `Object` | - | Filters to use when fetching the related records, passed to `getManyReference()` |
98
+
| `loading` | Optional | `ReactNode` | - | The component to render while fetching the related records |
97
99
| `offline` | Optional | `ReactNode` | - | Element to display when there are no related records because of lack of network connectivity. |
98
100
| `perPage` | Optional | `number` | 25 | Maximum number of referenced records to fetch |
99
101
| `queryOptions` | Optional | [`UseQuery Options`](https://tanstack.com/query/v3/docs/react/reference/useQuery) | `{}` | `react-query` options for the `getMany` query |
@@ -184,6 +186,38 @@ Use `empty` to customize the text displayed when there are no related records.
184
186
</ReferenceManyFieldBase>
185
187
```
186
188
189
+
## `error`
190
+
191
+
By default, `<ReferenceManyFieldBase>` renders its children when an error occurs while fetching the related records. You can customize what is rendered by providing your own component via the `error` prop:
You can also have `<ReferenceManyFieldBase>` render nothing in that case by setting the prop to `null`:
210
+
211
+
```jsx
212
+
<ReferenceManyFieldBase
213
+
reference="books"
214
+
target="author_id"
215
+
error={null}
216
+
>
217
+
...
218
+
</ReferenceManyFieldBase>
219
+
```
220
+
187
221
## `filter`: Permanent Filter
188
222
189
223
You can filter the query used to populate the possible values. Use the `filter` prop for that.
@@ -202,6 +236,38 @@ You can filter the query used to populate the possible values. Use the `filter`
202
236
203
237
{% endraw %}
204
238
239
+
## `loading`
240
+
241
+
By default, `<ReferenceManyFieldBase>` renders its children while fetching the related records. You can customize what is rendered by providing your own component via the `loading` prop:
Copy file name to clipboardExpand all lines: docs/ReferenceManyInput.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,8 @@ const ProductEdit = () => (
74
74
75
75
**Tip**: `<ReferenceManyInput>` cannot be used with `undoable` mutations. You have to set `mutationMode="optimistic"` or `mutationMode="pessimistic"` in the parent `<Edit>`, as in the example above.
76
76
77
+
**Tip**: `<SimpleFormIterator>` uses the `disableReordering` prop in this example because the `variants` resource doesn't support reordering. If your reference table does have a `rank` column, you can leave sorting controls on (see [the `rankSource` section](#ranksource) for details).
|`source`| Optional |`string`|`id`| Name of the field that carries the identity of the current record, used as origin for the relationship |
87
89
|`filter`| Optional |`Object`| - | Filters to use when fetching the related records, passed to `getManyReference()`|
88
90
|`perPage`| Optional |`number`| 25 | Maximum number of referenced records to fetch |
91
+
|`rankSource`| Optional |`string`| - | Name of the field used to store the rank of each item. When defined, it enables reordering of the items. |
89
92
|`sort`| Optional |`{ field, order }`|`{ field: 'id', order: 'DESC' }`| Sort order to use when fetching the related records, passed to `getManyReference()`|
90
93
|`defaultValue`| Optional |`array`| - | Default value of the input. |
91
94
|`validate`| Optional |`Function`|`array`| - | Validation rules for the array. See the [Validation Documentation](./Validation.md) for details. |
@@ -202,6 +205,31 @@ By default, react-admin restricts the possible values to 25 and displays no pagi
202
205
</ReferenceManyInput>
203
206
```
204
207
208
+
### `rankSource`
209
+
210
+
`<SimpleFormIterator>` provides controls to reorder the items in the list. If the related records have a numeric rank field, you can enable the reordering feature by setting the `rankSource` prop.
211
+
212
+
for example, if the variants have a `rank` field, you can set the `rankSource` prop like this:
213
+
214
+
```jsx
215
+
<ReferenceManyInput
216
+
reference="variants"
217
+
target="product_id"
218
+
rankSource="rank"
219
+
>
220
+
<SimpleFormIterator>
221
+
<TextInput source="sku"/>
222
+
<SelectInput source="size" choices={sizes} />
223
+
<SelectInput source="color" choices={colors} />
224
+
<NumberInput source="stock" defaultValue={0} />
225
+
</SimpleFormIterator>
226
+
</ReferenceManyInput>
227
+
```
228
+
229
+
Now the variants will be ordered by rank, and whenever the user changes the order of the items, `<ReferenceManyInput>` will update the `rank` field of each item accordingly.
230
+
231
+
Note that `<SimpleFormIterator>` doesn't have the `disableReordering` prop in that case, to display the up/down controls.
232
+
205
233
## `reference`
206
234
207
235
The name of the resource to fetch for the related records.
0 commit comments