Repository navigation
fix(jsonforms-renderers): apply rules on layouts - #98
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe renderer registry now wraps four layout renderers with ChangesLayout Renderer Props
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to 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)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Summary
A
ruleon a layout element (VerticalLayout,HorizontalLayout,Group,Categorization) shows or hides it and everything inside it. The layout renderers are registered throughwithJsonFormsLayoutProps, which evaluates the element's rule intovisibleandenabled, aswithJsonFormsControlPropsdoes for controls.Type of Change
Changes Made
src/renderers/index.ts:radixRenderersregisters the four layout renderers throughwithJsonFormsLayoutProps. 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 aVerticalLayoutand aHorizontalLayout.Testing
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
Groupper requested certificate, shows exactly the requested groups for each certificate type.Checklist
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-renderersversion 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 matchingfinal_decision_outcome).Additional Notes
N/A
Summary by CodeRabbit