Skip to content

React MUI : Allow the translation of enum value used for elementLabelProp #2288

@Maxouwell

Description

@Maxouwell

Describe the bug

At the moment, when an enum field is used in a elementLabelProp option, the raw enum value is used, without allowing to translate it via the translate function.
image

Expected behavior

The value should be sent to the translate function for customizing.

Steps to reproduce the issue

Create a JsonForms with :

Json Schema

{
  type: 'array',
  items: {
    type: 'object',
    properties: {
      message: {
        type: 'string',
        maxLength: 3,
      },
      messageType: {
        type: 'string',
        enum: ['MSG_TYPE_1', 'MSG_TYPE_2'],
      },
    },
  },
}

UI Schema :

{
  type: 'Control',
  scope: '#',
  options: {
    elementLabelProp: 'messageType',
    detail: {
      type: 'HorizontalLayout',
      elements: [
        { type: 'Control', scope: '#/properties/message' },
        { type: 'Control', scope: '#/properties/messageType' },
      ],
    },
  },
}

Data :

[
  {
    message: 'El Barto was here',
    messageType: 'MSG_TYPE_1',
  },
  {
    message: 'Yolo',
  },
]

Screenshots

No response

Which Version of JSON Forms are you using?

v.3.2.1

Framework

React

RendererSet

Material

Additional context

I think an old bug was repurposed to highlight this behavior but I can't find it anymore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions