This issue outlines features from the Klamm v2.1.0 form template schema that are not yet fully implemented in Kiln's Renderer.tsx, assuming the v1.0.0 translator will correctly convey the necessary data.
Current Status (as of Renderer.tsx analysis):
Kiln already provides robust support for nested repeaters, dynamic stylesheet/script loading, webStyles/pdfStyles for basic layout/visibility, conditional field visibility, and saveOnSubmit logic.
Remaining Gaps:
-
Form Headers - Ministry Logo Display:
- Description: The
ministry_id is available in formData.ministry_id, but it's not currently used to render a ministry-specific logo in the form header.
- Action Needed: Implement logic to construct and display an image (
<img> tag) using formData.ministry_id as part of the image src.
-
Form Footers - Dynamic Content:
- Description: The
v2.1.0 template includes a footer property for dynamic content. Kiln's Template interface and rendering logic do not currently consume this to populate the form footer (e.g., data-footer-text attribute or visible footer element).
- Translator Action: Map
v2.1.0.footer to a custom property (e.g., _kilnFooterContent) on the top-level v1 output.
- Kiln Action: Update
Template interface and rendering logic to display formData._kilnFooterContent in the footer.
-
Container Legend/Title - Hierarchy-based Heading Levels:
- Description: While container
Items have labels, there's no explicit rendering for these as distinct titles/legends, nor is there logic to dynamically assign HTML heading levels (<h1>, <h2>, etc.) based on container nesting depth.
- Translator Action: If desired, pass a custom
_kilnHierarchyDepth property for each item.
- Kiln Action:
- Implement clear rendering of container labels (e.g., within a
<fieldset><legend> or a styled div).
- If
_kilnHierarchyDepth is available, dynamically render labels using h1-h6 tags based on depth.
-
readOnly Functionality (Global and Field-Level):
- Description: The
Template interface has a readOnly flag, and Item.conditions can define a type: 'readOnly'. However, Renderer.tsx currently lacks logic to apply these readOnly states to disable form inputs, either globally or on individual fields.
- Translator Action: Ensure
v2.1.0 Template.readOnly is mapped (e.g., to _kilnReadOnlyForm) and v2.1.0 Item.conditions[type='readOnly'].value is mapped (e.g., to _kilnReadOnlyExpression).
- Kiln Action:
- Integrate
formData._kilnReadOnlyForm to disable all relevant form inputs.
- For individual fields, evaluate
item._kilnReadOnlyExpression (using eval) and pass the readOnly prop to the respective Carbon components.
-
calculatedValue Condition Handling:
- Description: Kiln does not currently support
calculatedValue conditions for fields. This means it cannot automatically make a field read-only and derive its value from a JavaScript expression based on other form states.
- Translator Action: Map
v2.1.0 Item.conditions[type='calculatedValue'].value to a custom property (e.g., _kilnCalculatedExpression) on the v1 item.
- Kiln Action:
- Update
Item interface to include _kilnCalculatedExpression.
- Implement logic to detect this property. When present, make the field read-only.
- Add
useEffect or similar hooks to re-evaluate _kilnCalculatedExpression (using eval) and update the field's formState whenever relevant dependencies change.
This issue outlines features from the Klamm v2.1.0 form template schema that are not yet fully implemented in Kiln's
Renderer.tsx, assuming the v1.0.0 translator will correctly convey the necessary data.Current Status (as of
Renderer.tsxanalysis):Kiln already provides robust support for nested repeaters, dynamic stylesheet/script loading,
webStyles/pdfStylesfor basic layout/visibility, conditional field visibility, andsaveOnSubmitlogic.Remaining Gaps:
Form Headers - Ministry Logo Display:
ministry_idis available informData.ministry_id, but it's not currently used to render a ministry-specific logo in the form header.<img>tag) usingformData.ministry_idas part of the imagesrc.Form Footers - Dynamic Content:
v2.1.0template includes afooterproperty for dynamic content. Kiln'sTemplateinterface and rendering logic do not currently consume this to populate the form footer (e.g.,data-footer-textattribute or visible footer element).v2.1.0.footerto a custom property (e.g.,_kilnFooterContent) on the top-levelv1output.Templateinterface and rendering logic to displayformData._kilnFooterContentin the footer.Container Legend/Title - Hierarchy-based Heading Levels:
Items havelabels, there's no explicit rendering for these as distinct titles/legends, nor is there logic to dynamically assign HTML heading levels (<h1>,<h2>, etc.) based on container nesting depth._kilnHierarchyDepthproperty for each item.<fieldset><legend>or a styleddiv)._kilnHierarchyDepthis available, dynamically render labels usingh1-h6tags based on depth.readOnlyFunctionality (Global and Field-Level):Templateinterface has areadOnlyflag, andItem.conditionscan define atype: 'readOnly'. However,Renderer.tsxcurrently lacks logic to apply thesereadOnlystates to disable form inputs, either globally or on individual fields.v2.1.0Template.readOnlyis mapped (e.g., to_kilnReadOnlyForm) andv2.1.0Item.conditions[type='readOnly'].valueis mapped (e.g., to_kilnReadOnlyExpression).formData._kilnReadOnlyFormto disable all relevant form inputs.item._kilnReadOnlyExpression(usingeval) and pass thereadOnlyprop to the respective Carbon components.calculatedValueCondition Handling:calculatedValueconditions for fields. This means it cannot automatically make a field read-only and derive its value from a JavaScript expression based on other form states.v2.1.0Item.conditions[type='calculatedValue'].valueto a custom property (e.g.,_kilnCalculatedExpression) on thev1item.Iteminterface to include_kilnCalculatedExpression.useEffector similar hooks to re-evaluate_kilnCalculatedExpression(usingeval) and update the field'sformStatewhenever relevant dependencies change.