MD.OFFICE
FAL

Daily Log - 2026-04-30

Dynaforms: Dependent Fields (Gap Closure, Type Enforcement & Performance)

Achievements

  • Generic Value Authoring Modes: Rewrote the dependency value input fields to be entirely controller-type-aware. Boolean controls (checkboxes/toggles) now display proper True/False dropdowns natively returning real booleans into the dependsOn payload instead of generic strings.
  • O(1) Engine Wiring Performance: Optimized dependency rendering speeds significantly on larger forms by compiling a single flat controlByJsonKey lookup map, circumventing thousands of heavy recursive findControl scans during the engine's compilation phase.
  • Reactive Propagation Fix: Ensured that any downstream fields cleared by a clearOnHide dependency effect now forcibly emit a valueChange event to notify external formula evaluation fields that their dependency node is empty.
  • Destruction Guarding: Blocked the deletion of any field inside the center panel if its jsonKey is actively utilized as a controller inside any dependency rule in the template.

Decisions

  • Strict Evaluator Equality: Stripped dynamic type coercion from the runtime evaluator entirely. The engine now operates on a typed contract enforced centrally inside the Builder UI, making eq/neq strictly reliable and significantly faster.
  • Effect Type Accumulation: Modified the runtime behavior to aggregate matched rules sequentially by effect type. This enables multiple independent rules (e.g., Age > 65 -> Show Field AND Salary > 5000 -> Make Required) to co-exist without the first match cancelling evaluation for distinct effects.
  • Precomputed UI Labels: Refactored the configurator to use precomputed DOM bindings (__uiOperation, __uiOutcomeText) to bypass Angular change-detection loops generated by raw template method evaluations.

Technical Details

  • Modified: dependency-configurator.component.ts/html -> Bound controller types (isBooleanController, hasStaticValueOptions) to dynamically switch input methodologies.
  • Modified: form-engine.service.ts -> Built buildControlByJsonKeyIndex to inject a flat O(1) AbstractControl lookup map into depEngine.wireUp.
  • Modified: dependency-engine.service.ts -> Enabled emitEvent: true upon targetControl.reset() when executing applyVisibilityEffect to preserve formula event chaining.
  • Modified: dynaform.service.ts -> Enhanced isFieldReferencedInFormulas to include dependency controller usage protections.