Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio Group Renderer for Vue Vanilla (WIP) #2292

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davewwww
Copy link
Contributor

@davewwww davewwww commented Feb 22, 2024

Hi,

this is a proposal for the radio group renderer, both enum and oneOf, when format=radio.

As I am also working on the Cell Renderer Set I wondered whether this renderer is actually more of a cell instead of renderer

Furthermore, the question of Styles naming, as is currently being discussed here: Support different classes for different controls
Is radioGroup a child of control or a new type at root level?

What do you think?

Preview: https://deploy-preview-2292--jsonforms-examples.netlify.app/vue-vanilla/#radio-group

Copy link

netlify bot commented Feb 22, 2024

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 9ea6b2f
🔍 Latest deploy log https://app.netlify.com/sites/jsonforms-examples/deploys/65d70ddda7bd0000081f8e0c
😎 Deploy Preview https://deploy-preview-2292--jsonforms-examples.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 configuration.

@lucas-koehler lucas-koehler self-requested a review April 10, 2024 09:15
Copy link
Contributor

@lucas-koehler lucas-koehler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davewwww , thanks for the contribution ❤️
Sorry for the late review, we must have overlooked this PR 😅

I think the RadioGroupControl.vue could definitely be a cell. However, I would not do this in this PR but rather contribute this PR first and then potentially refactor it in the cell PR.

Could you add some unit tests for the renderers, please? We aim to have at least basic coverage for all renderers.

Regarding the css classes. Congruent with #2239 (comment), I think the new radio group properties should be added in a new child object of control. E.g.:

export const defaultStyles: Styles = {
  control: {
    root: 'control',
    wrapper: 'wrapper',
    label: 'label',
    description: 'description',
    input: 'input',
    radioGroup: {
       group: 'radio-group',
       item: 'radio-group-item',
       itemLabel: 'radio-group-item-label',
    }
   // [...]
  }
}


export const entry: JsonFormsRendererRegistryEntry = {
renderer: controlRenderer,
tester: rankWith(20, and(isEnumControl, optionIs('format', 'radio'))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: rank 20 seems unnecessarily high considering standard renderers usually use values between 1 and 5. E.g. the plain enum renderer uses 2.

Suggested change
tester: rankWith(20, and(isEnumControl, optionIs('format', 'radio'))),
tester: rankWith(5, and(isEnumControl, optionIs('format', 'radio'))),


export const entry: JsonFormsRendererRegistryEntry = {
renderer: controlRenderer,
tester: rankWith(20, and(isOneOfEnumControl, optionIs('format', 'radio'))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: rank 20 seems unnecessarily high considering standard renderers usually use values between 1 and 5. E.g. the plain enum renderer uses 2.

Suggested change
tester: rankWith(20, and(isOneOfEnumControl, optionIs('format', 'radio'))),
tester: rankWith(5, and(isOneOfEnumControl, optionIs('format', 'radio'))),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants