eclipsesource / eclipsesource/jsonforms

React/Material ListWithDetail should support "labelRef" option

Open
#1,824 2 comments 0 reactions 0 assignees View on GitHub
enhancement material react
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

### Describe the bug

The layout ListWithDetail of the React-Material renderer does not honor the options.labelRef.

### Expected behavior

When using the options.labelRef the list of items need to be rendered with that labelRef and not the first field of the schema as shown in the examples here ([list-with-details.ts](https://github.com/eclipsesource/jsonforms/blob/b4f70e30ce1575eab206439ee55b4d2f20092992/packages/examples/src/list-with-detail.ts#L112))

### Steps to reproduce the issue

with a schema.json
```json
"beneficaries": {
"title": "Beneficaries",
"type": "array",
"items": {
"$ref": "#/definitions/Company"
}
}
...
"Company": {
"title": "Company",
"type": "object",
"properties": {
"partner_id": {
"title": "Partner Id",
"type": "string",
"format": "uuid"
},
"name": {
"title": "Name",
"type": "string"
},
"postal_address": {
"$ref": "#/definitions/Address"
}
},
[...]
```

when defining a uischema.json with
```json
{
"type": "ListWithDetail",
"scope": "#/properties/beneficaries",
"options": {
"labelRef": "#/properties/name",
"detail": {
"type": "VerticalLayout",
"elements": [
{ "type": "HorizontalLayout",
"elements":[
{ "type": "Control", "scope": "#/properties/name" },
...
```
When inspecting the MaterialListWithDetailRenderer.tsx and the ListWithDetailMasterItem.tsx, I could not quite find out where the labelRef option comes into play.

### Screenshots

_No response_

### In which browser are you experiencing the issue?

all browsers

### Framework

React

### RendererSet

Material

### Additional context

"dependencies": {
"@jsonforms/core": "^2.5.1",
"@jsonforms/material-renderers": "^2.5.1",
"@jsonforms/react": "^2.5.1",
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
...
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.