Interface

EvaluationContext

@ng-forge/dynamic-forms

Signature

interface EvaluationContext<
  TValue = unknown,
  TFormValue extends Record<string, unknown> = any
>

Type Parameters

NameConstraintDefaultDescription
TValue-unknown-
TFormValueRecord<string, unknown>any-

Properties

NameTypeDescription
fieldValue TValueCurrent field value
formValue TFormValue

Form value for the current evaluation scope.

For regular (non-array) derivations, this contains the complete form value. For array item derivations, this is scoped to the current array item. Use rootFormValue to access the complete form when inside an array context.

fieldPath stringField path for relative references
customFunctions ?Record<string, (context: EvaluationContext<unknown, any>) => unknown>Custom evaluation functions
logger LoggerLogger for diagnostic output
groupValue ?unknown

Value of the field's nearest parent group (or array item, when the field has no inner group above the array boundary).

Complements formValue and fieldValue for derivations on fields nested inside groups built by factory helpers, where the parent group's key isn't known at config-authoring time. Mirrors the runtime semantics of the '$group' token used in dependsOn.

Resolution at evaluation time: - Inside a group at form root: the parent group's value object (e.g., for address.state, groupValue === formValue.address). - Inside nested groups: the innermost parent group's value object. - Directly inside an array item (no inner group): the array item itself (same shape as formValue in array context). - Inside a group inside an array item: the inner group's value object within the current item. - Field at form root with no parent container: undefined.

rootFormValue ?Record<string, unknown>

Root form value when inside an array context.

This provides access to values outside the current array item. When a derivation targets an array item field (e.g., items.$.lineTotal), formValue is scoped to the current array item, while rootFormValue provides access to the entire form value including fields outside the array.

arrayIndex ?numberCurrent array index when inside an array derivation.
arrayPath ?stringPath to the array field when inside an array derivation.
externalData ?Record<string, unknown>

External data signals resolved to their current values.

This allows forms to reference data from outside the form context in conditional logic, derivations, and other expressions.

deprecationTracker ?WarningTracker

DI-scoped tracker for deprecation warnings. Used by the condition evaluator to deduplicate deprecation warnings.

fieldState ?FieldStateInfo

State of the current field being evaluated.

Provides access to field state properties like touched, dirty, valid, etc. Uses a Proxy for lazy evaluation — properties are only read when accessed.

formFieldState ?FormFieldStateMap

State of all fields in the form, keyed by field key.

Provides access to any field's state properties by key. Uses a Proxy for lazy evaluation — field state is only read when accessed.