Task/Feature:

What feature or task are you working on? Implement a scope-based dependency lookup model where a rule expression dependencies (the fields referenced in the expression) should follow a scoped lookup model, similar to variable scopes in programming languages, it starts by looking for a form element’s dependencies in the local section, moves up to the parent, and finally checks global scope (siblings and root level).

Status:

In progress

What’s working:

The current dependency look up look for parent after reaching the element root parent it doesn't go down to look into siblings (not in the same path of the element), what i want to do regarding the look-up is implement something like Scope-based Dependency Lookup: Dependencies should follow a scoped lookup model, similar to variable scopes in programming languages, it starts by looking for the dependency in the local section, moves up to the parent, and finally checks global scope (siblings and root level).

Currently, I construct the elements from the which I construct the widgets in a map Map<String, FormElementInstance<dynamic>> formElement. FormInstance is the whole form model, containing different helper methods

class FormInstance {
	Map<String, FormElementInstance<dynamic>> formElements; // we iterate over and construct the widgets
	FormGroup form; // root form's formGroup, which all elements reference
}

The current implementation of FormInstance doesn’t consolidate elements into a single root, need creating a unified tree structure with all elements starting from a single root node and traversing the tree both upwards and downwards from any node.

Tasks

  1. organize the hierarchy in a way that supports navigating through different levels of scope while maintaining efficient access to sibling elements. A common root parent for all elements, A SectionInstance, with parent = null, name =empty
  2. implement a tree-walking algorithm to go beyond immediate siblings:

Issues Encountered:

Improvements/Next Steps:

Key Design Decisions: