MD.OFFICE
FAL

Daily Log - 2026-03-17

Formula Output Type Refinements & Clean Slate Architecture

Achievements

  • Single Source of Truth (Clean Slate): Implemented logic in RightPanelStaticComponent to explicitly clear top-level legacy properties (formula, outputType, outputCurrency) when "Use Rules" is enabled. This ensures the formulaLibrary is the sole authority for Rule-based fields.
  • State Promotion on Disable: Enhanced the fallback logic so that disabling Rules automatically restores the active Default Formula's logic and formatting to the parent level, ensuring a seamless return to Legacy mode.
  • Isolated Builder Updates: Refined onFormulaOutputTypeChange to prevent property leakage; editing library-stored formulas no longer accidentally overwrites top-level metadata.
  • Deterministic Renderer Lookup: Replaced formula string matching with unique ID-based lookups in FormulaFieldComponent. This ensures the correct output components (e.g., DatePicker vs Currency Input) are used even if multiple formulas in the library have identical text.
  • Robust Renderer Initialization: Updated ngOnInit to prioritize looking up the default formula in the library, allowing the renderer to initialize correctly even when top-level metadata is cleared for Rules mode.

Decisions

  • Minimal Sync Approach: Chose to only synchronize state during the transition from Rule mode to Legacy mode. This keeps the builder JSON clean while rules are active, relying on the renderer's ability to look deeper into the configuration when useRules is true.
  • Deterministic Type Assertion: Decided to move away from string-based matching for formula metadata to avoid "Ambiguity Bugs" where identical formula strings (like standalone numbers) could conflict.

Files Modified

  • src/ifile-teapot-web-dynaforms/components/dynaform-builder/right-panel-static/right-panel-static.component.ts
  • src/ifile-teapot-web-dynaforms/components/form-renderer/components/fields/formula-field/formula-field.component.ts
  • docs/dynaforms-history.md