Skip to main content
cngx-src documentation

CngxTreeConfig

Interface

projects/common/interactive/tree-controller/tree-config.ts

Import#

import { CngxTreeConfig } from '@cngx/common/interactive'

Description#

App-wide tree-controller configuration. Populated via provideTreeConfig in the root providers (or provideTreeConfigAt in a component's viewProviders for a sub-tree scope).

Priority for every field is:

Per-controller option (CngxTreeControllerOptions.*)
  ↑ falls through to
Component/scope viewProviders  (provideTreeConfigAt)
  ↑ falls through to
Root providers                 (provideTreeConfig)
  ↑ falls through to
Library default                (createTreeController / flattenTree)

All fields are optional - omit the ones you don't need. Typed with unknown T-parameters because config values flow through the DI system where per-instance generics can't be preserved; per- controller options are still properly typed via the call site's CngxTreeControllerOptions<T>.

Index#

Instance Properties#

cacheLimit#number
ReadonlyOptional

Bound the isExpanded(id) signal cache. Default: unlimited - keeps the stable-identity guarantee (isExpanded(v) === isExpanded(v) always holds for the lifetime of the controller). When set, the cache FIFO-evicts its oldest entry as soon as the size exceeds cacheLimit; a re-queried id then receives a NEW signal instance (values are equivalent, references differ). Set this only at grid/tree scale (100k+ nodes) where memory retention matters more than reference stability.

defaultInitiallyExpanded#"all" | "none" | unknown
ReadonlyOptional

Fallback for initiallyExpanded.

defaultKeyFn#function
ReadonlyOptional

Fallback for keyFn. Library default is identity.

defaultLabelFn#function
ReadonlyOptional

Fallback for labelFn. Library default is String(value).

defaultNodeIdFn#function
ReadonlyOptional

Fallback for nodeIdFn when a caller omits it. With a config default set, CngxTreeControllerOptions.nodeIdFn becomes effectively optional - the factory throws in dev mode only when neither place provides a function.