eclipsesource / jsonforms-vuetify-renderers

https://jsonforms-vuetify-renderers.netlify.app/
Other
25 stars 26 forks source link

Allow falsy values like 0, false, empty string to be allowed values f… #73

Closed kchobantonov closed 1 year ago

kchobantonov commented 1 year ago

…or enums

Example schemas

{
  "type": "object",
  "properties": {
    "areYouTall": {
      "type": "boolean",
      "oneOf": [
        {
          "const": true,
          "title": "Yes"
        },
        {
          "const": false,
          "title": "No"
        }
      ]
    }
  },   
  "required": [
    "areYouTall"
  ]
}
{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/areYouTall"
    }
  ]
}
netlify[bot] commented 1 year ago

Deploy Preview for jsonforms-vuetify-renderers ready!

Name Link
Latest commit 2877e3a88f932c057b662533db37a1791b91de4b
Latest deploy log https://app.netlify.com/sites/jsonforms-vuetify-renderers/deploys/6331b05af5b3ad000883bf64
Deploy Preview https://deploy-preview-73--jsonforms-vuetify-renderers.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

kchobantonov commented 1 year ago

@yaffol can you take a look into the ArrayLayoutRenderer that you have changes because this build fails that on line 458 there is no this.data - perhaps the line should be data: this.control.data, ?

@sdirix can you review this PR - this allows enums with falsy values to be used correctly otherwise it clears the input when such are selected. I was thinking about the same perhaps for the strings to eventually allow empty string for example but since the text control always have an empty value when it is cleared then we will not be able to remove properties for those types but for enums that are renders with dropdowns and etc. it is easy to implement and use those falsy values as well

kchobantonov commented 1 year ago

the above issue with the array renders is fixed in PR https://github.com/eclipsesource/jsonforms-vuetify-renderers/pull/76

sdirix commented 1 year ago

I'll check the code soon! Thanks for the contribution :heart: