Daily Log: 2026-03-16
Formula Guards Implementation (Dynaforms)
Achievements & Changes
- Implemented Hard Guards for Field Type Changes:
- Modified
RightPanelStaticComponent.onNumberTypeChangeto block changes to/fromPercentageorCurrencyif the field is referenced in formulas, rules, or validation. - Added
RightPanelStaticComponent.onCurrencyChangeto block currency code changes (e.g., INR to USD) for fields used in formulas. - Used
cdr.detectChanges()to revert UI state visually when a change is blocked.
- Modified
- Enhanced Property Panel UI:
- Updated
right-panel-static.component.htmlto bind the Currency dropdown to the new guard method.
- Updated
Decisions
- Blocking vs Warning: Decided to use a hard block (Error Toast) instead of a warning for currency/percentage changes to prevent silent data interpretation failures.
Dynamic Formula Output Types (Dynaforms)
Achievements & Changes
- Implemented Runtime Output Type Switching:
- Updated
form-element-config.types.tsto storeoutputTypeandoutputCurrencyperFormulaDefinition. - Modified
RightPanelStaticComponentto bridge inferred output types into library entries. - Updated
FormulaFieldComponent(Renderer) to detect active formula types and hot-switch betweenp-datepickerandp-inputNumber.
- Updated
- Edge Case Mitigation:
- Implemented automatic value clearing (
setValue(null)) when the output type switches at runtime.
- Implemented automatic value clearing (
- Bug Fixes (PM Update):
- Race Condition: Swapped emission order in
FormulaBuilderComponentto ensureoutputTypeis persistent before a save. - Chained Inference: Enhanced suggestion mapping so formulas identify as Dates or Currency when referenced in other formulas.
- Race Condition: Swapped emission order in
Decisions
- Immediate Value Reset: Critical for stability when switching between DatePicker and InputNumber.
- Emission Ordering: Discovered that saving a formula must happen after the type assertion to ensure state consistency.