eclipsesource / jsonforms

Customizable JSON Schema-based forms with React, Angular and Vue support out of the box.
http://jsonforms.io
Other
2.19k stars 370 forks source link

Object inside array with readOnly true is not showing as disabled with material cells #2384

Open neosri opened 3 days ago

neosri commented 3 days ago

Describe the bug

Object inside array with readOnly true is not showing as disabled with material cells.

Expected behavior

Objects defined inside of an array in JsonSchema with a property having a readOnly keyword set to true should render the property/control as disabled.

Steps to reproduce the issue

  1. define a JsonSchema as shown below
    const schema =  {
    type: 'array',
    title: 'test',
    description: 'connection ',
    items: {
        type: 'object',
        title: 'test',
        description: 'test',
        properties: {
            ipAddress: {
                readOnly:true,
                type: 'string'                          
            },
            port: {
                readOnly:true,
                type: 'number'                          
            }                       
        },
        required: ['ipAddress']
    }
    }
  2. Create a Jsonforms component and pass the jsonschema defined above, UI Schema is not relevant here. We are using the material cells and material renderers.
  3. The ipAddress and port properties defined above with readOnly true would be still editable.

Screenshots

No response

Which Version of JSON Forms are you using?

latest

Package

React Material Renderers

Additional context

No response

lucas-koehler commented 2 days ago

Thanks for the report! I edited the issue inline to format your example schema. For reference. This issue is based on this discussion.

There it was discovered that cell renderers currently always get true as their enabled state and that this is most likely caused here.