Interface

PresetCollaborators

@ng-forge/dynamic-forms

Optional collaborators a preset may need beyond the base context. Passed by the button kind component which has access to its own DI scope.

Adapter input components fill in the collaborators their preset semantics require: - mat-input / bs-input / prime-input / ion-input populate typeOverride + fieldValueSetter + fieldDefaultValueGetter + baselineType from their own DI scope. - Addons rendered outside any input field receive { logger } only and the input-specific presets warn-and-no-op.

Signature

interface PresetCollaborators

Properties

NameTypeDescription
typeOverride ?WritableSignal<string | undefined> | undefinedPer-field input-type override signal — populated only inside an input field.
fieldValueSetter ?((next: unknown) => void) | undefinedWriter that pushes a value into the host field's tree.
fieldDefaultValueGetter ?(() => unknown) | undefined

Read the host field's configured default value (from the form's defaultValues map keyed by field.key). Used by the 'reset' preset; absent when the addon is rendered outside an active field context, in which case 'reset' falls back to clearing.

baselineType ?(() => string | undefined) | undefined

Baseline configured input type (from props().type), read at preset-run time. Used by toggle-password-visibility to refuse to corrupt 'email'/'number'/etc. inputs into 'password' when no override is yet set.

logger Logger

Logger for warnings about presets that can't be fulfilled in this context.

Passed via collaborators (rather than injected) because runPresetAction is a DI-free pure function shared across adapters — each adapter's ADDON_PRESET_HANDLER factory injects DynamicFormLogger itself and forwards it here. The [Dynamic Forms] prefix comes from ConsoleLogger's implementation, so the final console line is identical to one logged directly via inject(DynamicFormLogger).