Skip to content

fix(jsonforms-renderers): apply rules on layouts - #98

Merged
sthanikan2000 merged 1 commit into
mainfrom
fix/jsonforms-renderers-layout-rules
Oct 9, 2026
Merged

sthanikan2000 merged 1 commit into
mainfrom
fix/jsonforms-renderers-layout-rules

Conversation

@sthanikan2000

@sthanikan2000 sthanikan2000 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

A rule on a layout element (VerticalLayout, HorizontalLayout, Group, Categorization) shows or hides it and everything inside it. The layout renderers are registered through withJsonFormsLayoutProps, which evaluates the element's rule into visible and enabled, as withJsonFormsControlProps does for controls.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Other (please describe):

Changes Made

  • src/renderers/index.ts: radixRenderers registers the four layout renderers through withJsonFormsLayoutProps. The exported components keep their shape.
  • src/renderers/LayoutRenderers.test.tsx: renders forms with SHOW rules on Groups (only the matching Group shows; both show when both match) and HIDE rules on a VerticalLayout and a HorizontalLayout.

Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested edge cases
  • All existing tests pass

The tests fail without the change: three of the four new tests expect a hidden layout and find it rendered. Rendering the CDA certificate issuance form, which shows a Group per requested certificate, shows exactly the requested groups for each certificate type.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked that there are no merge conflicts

Related Issues

N/A

Screenshots/Demo

N/A

Deployment Notes

No change to a running deployment. Portals keep the published package until a new @opennsw/jsonforms-renderers version is released and the dependency is bumped. Forms with rules on layouts then hide those layouts, e.g. SLTB's "Certificate Issuance" group (shown only for its matching final_decision_outcome).

Additional Notes

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Layouts now respect visibility rules, showing or hiding groups and vertical or horizontal layouts according to the configured conditions.
    • Multiple groups can be shown when their visibility conditions match.

The layout renderers (VerticalLayout, HorizontalLayout, Group,
Categorization) are registered through withJsonFormsLayoutProps, which
evaluates a layout element's rule into `visible` and `enabled`, as
withJsonFormsControlProps does for controls. A SHOW or HIDE rule on a
layout element shows or hides it and everything inside it.

Tests render forms with SHOW rules on Groups and HIDE rules on vertical
and horizontal layouts.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1f3c24c-f697-4034-89cd-7075acc1df47
📥 Commits

Reviewing files that changed from the base of the PR and between c39d889 and e2c4855.

📒 Files selected for processing (2)
  • packages/jsonforms-renderers/src/renderers/LayoutRenderers.test.tsx
  • packages/jsonforms-renderers/src/renderers/index.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The renderer registry now wraps four layout renderers with withJsonFormsLayoutProps. New jsdom tests check group SHOW rules and vertical and horizontal layout visibility.

Changes

Layout Renderer Props

Layer / File(s) Summary
Wrap layout renderers
packages/jsonforms-renderers/src/renderers/index.ts
The vertical, horizontal, group, and categorization renderers are registered through withJsonFormsLayoutProps.
Test layout visibility
packages/jsonforms-renderers/src/renderers/LayoutRenderers.test.tsx
Tests check that group elements appear for matching SHOW rules and that vertical and horizontal layouts are hidden for kind: 'P' and visible for kind: 'S'.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to e2c48

The layout-rule change is ready to merge after normal checks; no actionable issue was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: applying rules to layout renderers.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sthanikan2000 sthanikan2000 self-assigned this Oct 9, 2026
@sthanikan2000 sthanikan2000 added invalid This doesn't seem right and removed invalid This doesn't seem right labels Oct 9, 2026

@mushrafmim mushrafmim left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@sthanikan2000
sthanikan2000 merged commit aade9d9 into main Oct 9, 2026
3 checks passed
@sthanikan2000 sthanikan2000 added Package/jsonforms-renderers Changes to packages/jsonforms-renderers Type/Bug Something isn't working as expected labels Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Package/jsonforms-renderers Changes to packages/jsonforms-renderers Type/Bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants