CngxFilterBuilderPresenter
projects/forms/filter-builder/filter-builder-presenter.directive.ts
Import#
import { CngxFilterBuilderPresenter } from '@cngx/forms/filter-builder'
Description#
Brain of <cngx-filter-builder>. Hosts the state factory bound to a
model<FilterGroup> for [(value)] two-way binding, and provides
CNGX_FILTER_BUILDER_HOST via useExisting so the recursive context
atoms read one source of truth. Implements CngxFormFieldControl
(id / empty / disabled / focused / errorState / focus); the
disabled / focused / errorState scalars derive from the ambient
CngxFormFieldPresenter when the opt-in
CngxFilterBuilderFormFieldControl directive is applied.
Metadata#
Providers#
CNGX_FILTER_BUILDER_HOST- useExisting
CngxFilterBuilderPresenter
Relationships
Depends on1
Index#
Inputs#
Outputs#
FilterGroupInstance Properties#
SignalCngxFormFieldControl empty - true while the tree carries no expressions.
this.core.isEmptySignalCngxFormFieldControl id - stable per-instance, generated once.
signal(nextUid('cngx-filter-builder-')).asReadonly()Methods#
addExpression(path: unknown, expression: FilterExpression)unknownaddGroup(path: unknown, group: FilterGroup)Adds group under the group at path. No-op beyond
maxNestingDepth: a group appended at path sits at depth
path.length + 1 (root is depth 0), and the config cap applies to
programmatic writes exactly like to the add-group UI.
unknownapplyFieldChange(path: unknown, plan: CngxFilterRowFieldChangePlan)unknownfocus(options?: FocusOptions)Focus the first incomplete expression's first focusable descendant;
falls back to the host element when no expression is incomplete. The
row↔presenter correlation runs through the data-cngx-filter-path
attribute each rendered row carries.
FocusOptionsremoveNode(path: unknown)Removes the node at path. When the removal unmounts the DOM that
currently holds focus (the row's remove button, an editor input), focus
is restored after the next render: to the sibling that slid into the
removed index, else the previous sibling, else the parent group
container - instead of dropping to <body>.
unknown