Lundalogik / lime-elements

Provides reusable web components for Lime CRM
https://lundalogik.github.io/lime-elements/versions/latest
Other
38 stars 16 forks source link

limel-form: disabled prop not working for select inputs #1477

Closed johannesss closed 2 years ago

johannesss commented 2 years ago

Current behavior

Unable to disable select inputs when used in limel-form

Steps to reproduce the behavior:

  1. Create limel-form with select inputs and provide the disabled property via lime component props
  2. See that the input is not disabled

Expected behavior

The select input should be disabled

Environment

Codepen demonstrating the issue: https://codepen.io/johanneseriksson/pen/WNZvWoB

adrianschmidt commented 2 years ago

You need to put the disabled property as a direct descendant of the lime property, like this:

document.querySelector('limel-form').schema = {
   title: 'Registration form',
    description: 'Please enter your personal information',
    type: 'object',
    required: [],
    properties: {
        sidekicks: {
            type: 'array',
            title: 'Sidekicks',
            lime: {
              disabled: true
            },
            description: 'Please select your sidekicks',
            uniqueItems: true,
            minItems: 2,
            items: {
                title: 'Friends',
                type: 'string',
                anyOf: [
                    {
                        type: 'string',
                        const: 'super',
                        title: 'Superman',
                    },
                    {
                        type: 'string',
                        const: 'widow',
                        title: 'Black Widow',
                    },
                    {
                        type: 'string',
                        const: 'america',
                        title: 'Captain America',
                    },
                    {
                        type: 'string',
                        const: 'squirrel',
                        title: 'Squirrel Girl',
                    },
                    {
                        type: 'string',
                        const: 'devil',
                        title: 'Daredevil',
                    },
                    {
                        type: 'string',
                        const: 'marvel',
                        title: 'Captain Marvel',
                    },
                    {
                        type: 'string',
                        const: 'fantastic',
                        title: 'Mr. Fantastic',
                    },
                ],
            },
        },
    },  
}

Although, it certainly would be preferable if it was possible to set the value in either place. I'll have a look, if it's easy, we'll fix it, if not, I say we perhaps add something about it to the docs instead.

(I just had to check before I posted: I tried it out in the "Dynamic schema" example for limel-form in the docs, and it seems to work to put the value in either place when using limel-input, so I'm not sure why it wouldn't also work for limel-select…)

johannesss commented 2 years ago

Ah, yes that works. Sounds good! Yeah I really figured they'd be consistent for every component.

lime-ci commented 2 years ago

:tada: This issue has been resolved in version 34.1.0-next.16 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

lime-ci commented 2 years ago

:tada: This issue has been resolved in version 34.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: