Skip to main content
cngx-src documentation

CngxFilterValueEditorHost

Directivev0.1.0WCAG AA

projects/forms/filter-builder/filter-builder-value-editor-host.directive.ts

Import#

import { CngxFilterValueEditorHost } from '@cngx/forms/filter-builder'

Description#

Mounts a registered custom value editor (CngxFilterEditorComponent) with the documented contract actually honoured: value, fieldDef, expression and disabled are projected onto the mounted instance, and the instance's value model is read back into the row's write sink. Replaces the historical bare *ngComponentOutlet branch, which mounted the component with no inputs and no read-back - a registered editor rendered disconnected from the expression value.

NgComponentOutlet cannot observe a mounted component's ModelSignal, so the fix is a dedicated dynamic mount, not outlet bindings. Sync discipline mirrors the createFieldSync bridge: one effect pushes the host-side inputs (imperative setInput calls inside untracked()), one effect reads instance.value() as its tracked source and calls the sink inside untracked(). Both directions break the cycle through valueEquals - default: arrayEqual when both sides are arrays (fresh [min, max] / list references from between / in editors must not defeat the guard), Object.is otherwise. Override per mount for structured editor values.

Inputs the mounted component does not declare are skipped (reflectComponentType gate), so a minimal editor with only the required value model mounts cleanly.

Metadata#

Relationships

Index#

Inputs#

component#Type>
Required

Editor component class resolved from the CNGX_FILTER_EDITORS registry.

default { alias: 'cngxFilterValueEditorHost', }
disabled#boolean
input()

Disabled state projected onto the editor's optional disabled input.

default false
input()

Full expression node projected onto the editor's optional expression input.

input()

Field metadata projected onto the editor's optional fieldDef input.

value#unknown
input()

Current expression value pushed onto the editor's value model.

Instance Properties#

setValue#unknown
Readonly

Write sink for editor-originated value changes (the row controller's setValue).

input<((value: unknown) => void) | undefined>(undefined)
valueEquals#unknown
Readonly

Cycle-break equality for the value round trip. Default: arrayEqual when both sides are arrays, Object.is otherwise. Provide a custom fn for structured (non-array object) editor values.

input<((a: unknown, b: unknown) => boolean) | undefined>(undefined)