@ng-forge/dynamic-forms 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ng-forge-dynamic-forms-ng-forge-dynamic-forms--Qgd-rJE.mjs","sources":["../../../../packages/dynamic-forms/src/lib/utils/derived-from-deferred/derived-from-deferred.ts","../../../../packages/dynamic-forms/src/lib/utils/grid-classes/grid-classes.ts","../../../../packages/dynamic-forms/src/lib/mappers/base/base-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/utils/field-mapper/field-mapper.ts","../../../../packages/dynamic-forms/src/lib/utils/resolve-field/resolve-field.ts","../../../../packages/dynamic-forms/src/lib/utils/submission-handler/submission-handler.ts","../../../../packages/dynamic-forms/src/lib/utils/object-utils.ts","../../../../packages/dynamic-forms/src/lib/models/field-signal-context.token.ts","../../../../packages/dynamic-forms/src/lib/models/field-type.ts","../../../../packages/dynamic-forms/src/lib/utils/inject-field-registry/inject-field-registry.ts","../../../../packages/dynamic-forms/src/lib/core/registry/root-form-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/registry/field-context-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/registry/function-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/value-utils.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/types.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/tokenizer.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/parser.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/evaluator.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/expression-parser.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/condition-evaluator.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/logic-function-factory.ts","../../../../packages/dynamic-forms/src/lib/core/values/dynamic-value-factory.ts","../../../../packages/dynamic-forms/src/lib/models/logic/logic-config.ts","../../../../packages/dynamic-forms/src/lib/core/cross-field/cross-field-detector.ts","../../../../packages/dynamic-forms/src/lib/core/validation/validator-factory.ts","../../../../packages/dynamic-forms/src/lib/core/logic/logic-applicator.ts","../../../../packages/dynamic-forms/src/lib/core/registry/schema-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/values/type-predicate-factory.ts","../../../../packages/dynamic-forms/src/lib/core/schema-application.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/group-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/array-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/row-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/page-field.ts","../../../../packages/dynamic-forms/src/lib/core/form-mapping.ts","../../../../packages/dynamic-forms/src/lib/utils/default-value/default-value.ts","../../../../packages/dynamic-forms/src/lib/models/types/type-guards.ts","../../../../packages/dynamic-forms/src/lib/core/schema-builder.ts","../../../../packages/dynamic-forms/src/lib/events/event.bus.ts","../../../../packages/dynamic-forms/src/lib/events/constants/submit.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/component-initialized.event.ts","../../../../packages/dynamic-forms/src/lib/utils/initialization-tracker/initialization-tracker.ts","../../../../packages/dynamic-forms/src/lib/models/types/form-mode.ts","../../../../packages/dynamic-forms/src/lib/utils/flattener/field-flattener.ts","../../../../packages/dynamic-forms/src/lib/core/cross-field/cross-field-collector.ts","../../../../packages/dynamic-forms/src/lib/utils/form-validation/form-mode-validator.ts","../../../../packages/dynamic-forms/src/lib/events/constants/next-page.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/page-change.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/previous-page.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/add-array-item.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/remove-array-item.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/form-reset.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/form-clear.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/page-navigation-state-change.event.ts","../../../../packages/dynamic-forms/src/lib/core/page-orchestrator/page-orchestrator.component.ts","../../../../packages/dynamic-forms/src/lib/dynamic-form.component.ts","../../../../packages/dynamic-forms/src/lib/mappers/array/array-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/group/group-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/row/row-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/page/page-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/text/text-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/providers/built-in-fields.ts","../../../../packages/dynamic-forms/src/lib/providers/dynamic-form-providers.ts","../../../../packages/dynamic-forms/src/lib/core/logic/button-logic-resolver.ts","../../../../packages/dynamic-forms/src/lib/definitions/base/base-value-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/base/base-checked-field.ts","../../../../packages/dynamic-forms/src/lib/events/utils/token-resolver.ts","../../../../packages/dynamic-forms/src/lib/utils/form-internals/form-internals.ts","../../../../packages/dynamic-forms/src/lib/mappers/value/value-field.mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/checkbox/checkbox-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/select/options-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/datepicker/datepicker-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/utils/dynamic-text-to-observable.ts","../../../../packages/dynamic-forms/src/lib/utils/should-show-errors.ts","../../../../packages/dynamic-forms/src/lib/utils/interpolate-params.ts","../../../../packages/dynamic-forms/src/lib/utils/create-resolved-errors-signal.ts","../../../../packages/dynamic-forms/src/lib/pipes/dynamic-text/dynamic-text.pipe.ts","../../../../packages/dynamic-forms/src/lib/utils/emit-initialization/emit-initialization.ts","../../../../packages/dynamic-forms/src/lib/fields/row/row-field.component.ts","../../../../packages/dynamic-forms/src/lib/fields/group/group-field.component.ts","../../../../packages/dynamic-forms/src/lib/utils/array-field/array-field.types.ts","../../../../packages/dynamic-forms/src/lib/utils/array-field/create-array-item-injector.ts","../../../../packages/dynamic-forms/src/lib/utils/array-field/resolve-array-item.ts","../../../../packages/dynamic-forms/src/lib/fields/array/array-field.component.ts","../../../../packages/dynamic-forms/src/lib/index.ts","../../../../packages/dynamic-forms/src/ng-forge-dynamic-forms.ts"],"sourcesContent":["import { Injector, isSignal, Signal } from '@angular/core';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { combineLatest, defer, Observable, OperatorFunction } from 'rxjs';\n\n/**\n * Options for derivedFromDeferred.\n */\nexport interface DerivedFromDeferredOptions<R> {\n initialValue: R;\n injector: Injector;\n}\n\n/**\n * Type helper to extract the value type from a Signal.\n */\ntype SignalValue<T> = T extends Signal<infer V> ? V : never;\n\n/**\n * Type helper to map an array of Signals to an array of their value types.\n */\ntype SignalValues<T extends readonly Signal<unknown>[]> = {\n [K in keyof T]: SignalValue<T[K]>;\n};\n\n/**\n * Type helper to map an object of Signals to an object of their value types.\n */\ntype SignalObjectValues<T extends Record<string, Signal<unknown>>> = {\n [K in keyof T]: SignalValue<T[K]>;\n};\n\n/**\n * Type guard to check if a value is an array of Signals.\n */\nfunction isSignalArray(value: unknown): value is readonly Signal<unknown>[] {\n return Array.isArray(value) && value.every((item) => isSignal(item));\n}\n\n/**\n * Type guard to check if a value is an object of Signals (record).\n */\nfunction isSignalRecord(value: unknown): value is Record<string, Signal<unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.values(value).every((item) => isSignal(item));\n}\n\n/**\n * Like derivedFrom from ngxtension, but uses defer() to avoid input availability issues.\n * This ensures toObservable is called at subscription time, not at field initialization.\n *\n * Supports three source types:\n * - Single signal: `derivedFromDeferred(signal, operator, options)`\n * - Array of signals: `derivedFromDeferred([signal1, signal2], operator, options)`\n * - Object of signals: `derivedFromDeferred({a: signal1, b: signal2}, operator, options)`\n *\n * @example\n * ```typescript\n * // Single signal\n * const result = derivedFromDeferred(\n * mySignal,\n * pipe(map(v => v * 2)),\n * { initialValue: 0, injector }\n * );\n *\n * // Array of signals\n * const result = derivedFromDeferred(\n * [signalA, signalB],\n * pipe(map(([a, b]) => a + b)),\n * { initialValue: 0, injector }\n * );\n *\n * // Object of signals\n * const result = derivedFromDeferred(\n * { x: signalX, y: signalY },\n * pipe(map(({ x, y }) => x + y)),\n * { initialValue: 0, injector }\n * );\n * ```\n */\n\n// Overload: Single signal\nexport function derivedFromDeferred<T, R>(\n source: Signal<T>,\n operator: OperatorFunction<T, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R>;\n\n// Overload: Array of signals\nexport function derivedFromDeferred<T extends readonly Signal<unknown>[], R>(\n sources: [...T],\n operator: OperatorFunction<SignalValues<T>, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R>;\n\n// Overload: Object of signals\nexport function derivedFromDeferred<T extends Record<string, Signal<unknown>>, R>(\n sources: T,\n operator: OperatorFunction<SignalObjectValues<T>, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R>;\n\n// Implementation\nexport function derivedFromDeferred<T, R>(\n source: Signal<T> | Signal<unknown>[] | Record<string, Signal<unknown>>,\n operator: OperatorFunction<T | unknown[] | Record<string, unknown>, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R> {\n const deferred$: Observable<R> = defer(() => {\n // Handle single signal\n if (isSignal(source)) {\n return toObservable(source, { injector: options.injector });\n }\n\n // Handle array of signals\n if (isSignalArray(source)) {\n const observables = source.map((s) => toObservable(s, { injector: options.injector }));\n return combineLatest(observables);\n }\n\n // Handle object of signals\n if (isSignalRecord(source)) {\n const keys = Object.keys(source);\n const observables = keys.map((key) => toObservable(source[key], { injector: options.injector }));\n\n return combineLatest(observables, (...values) => {\n const result: Record<string, unknown> = {};\n keys.forEach((key, index) => {\n result[key] = values[index];\n });\n return result;\n });\n }\n\n // Fallback - should not happen with proper typing\n throw new Error('Invalid source type. Expected a Signal, array of Signals, or object of Signals.');\n }).pipe(operator);\n\n return toSignal(deferred$, { initialValue: options.initialValue, injector: options.injector });\n}\n","import { FieldDef } from '../../definitions/base/field-def';\n\n/**\n * Generates CSS class string for responsive grid layout based on field column configuration.\n *\n * Creates Bootstrap-style column classes for implementing responsive form layouts.\n * Validates column values to ensure they fall within the standard 12-column grid system.\n *\n * @param fieldDef - Field definition containing column configuration\n * @returns CSS class string for grid layout, empty if no valid column configuration\n *\n * @example\n * ```typescript\n * // Full width field\n * const fullWidth = getGridClassString({ type: 'input', key: 'name', col: 12 });\n * // Returns: 'df-col-12'\n *\n * // Half width field\n * const halfWidth = getGridClassString({ type: 'input', key: 'email', col: 6 });\n * // Returns: 'df-col-6'\n *\n * // Invalid column value\n * const invalid = getGridClassString({ type: 'input', key: 'phone', col: 15 });\n * // Returns: ''\n * ```\n *\n * @example\n * ```typescript\n * // Usage in component template\n * @Component({\n * template: `\n * <div [class]=\"getGridClassString(field)\" class=\"form-field\">\n * <!-- Field content -->\n * </div>\n * `\n * })\n * export class FieldComponent {\n * field: FieldDef<any>;\n * getGridClassString = getGridClassString;\n * }\n * ```\n *\n * @public\n */\nexport function getGridClassString(fieldDef: FieldDef<any>): string {\n const classes: string[] = [];\n\n if (typeof fieldDef.col === 'number' && fieldDef.col > 0 && fieldDef.col <= 12) {\n classes.push(`df-col-${fieldDef.col}`);\n }\n\n return classes.join(' ');\n}\n","import { computed, Signal } from '@angular/core';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { getGridClassString } from '../../utils/grid-classes/grid-classes';\n\n/**\n * Builds base input properties from a field definition.\n *\n * This is a helper function that extracts common field properties.\n * Used by mappers to build the inputs record.\n *\n * @param fieldDef The field definition to extract properties from\n * @returns Record of input names to values\n */\nexport function buildBaseInputs(fieldDef: FieldDef<unknown>): Record<string, unknown> {\n const { key, label, className, tabIndex, props } = fieldDef;\n const inputs: Record<string, unknown> = {};\n\n // Always include key - required by components for accessibility and identification\n inputs['key'] = key;\n\n if (label !== undefined) {\n inputs['label'] = label;\n }\n\n // Combine user className with generated grid classes\n const gridClassString = getGridClassString(fieldDef);\n const allClasses: string[] = [];\n\n if (gridClassString) {\n allClasses.push(gridClassString);\n }\n\n if (className) {\n allClasses.push(className);\n }\n\n if (allClasses.length > 0) {\n inputs['className'] = allClasses.join(' ');\n }\n\n if (tabIndex !== undefined) {\n inputs['tabIndex'] = tabIndex;\n }\n\n if (props !== undefined) {\n inputs['props'] = props;\n }\n\n return inputs;\n}\n\n/**\n * Base field mapper that extracts common field properties into component inputs.\n *\n * Returns a Signal containing the Record of input names to values that will be\n * passed to ngComponentOutlet. The signal enables reactive updates.\n *\n * @param fieldDef The field definition to map\n * @returns Signal containing Record of input names to values\n */\nexport function baseFieldMapper(fieldDef: FieldDef<unknown>): Signal<Record<string, unknown>> {\n // For base mapper, inputs are static (no reactive dependencies)\n // Wrap in computed for consistency with the MapperFn type\n return computed(() => buildBaseInputs(fieldDef));\n}\n","import { Signal } from '@angular/core';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { baseFieldMapper } from '../../mappers/base/base-field-mapper';\n\n/**\n * Main field mapper function that uses the field registry to get the appropriate mapper\n * based on the field's type property.\n *\n * This function must be called within an injection context where FIELD_SIGNAL_CONTEXT\n * is provided, as mappers inject the context to access form state.\n *\n * @param fieldDef The field definition to map\n * @param fieldRegistry The registry of field type definitions\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function mapFieldToInputs(\n fieldDef: FieldDef<unknown>,\n fieldRegistry: Map<string, FieldTypeDefinition>,\n): Signal<Record<string, unknown>> {\n // Get the field type definition from registry\n const fieldType = fieldRegistry.get(fieldDef.type);\n\n if (fieldType?.mapper) {\n // Use the registered mapper for this field type\n // Mapper will inject FIELD_SIGNAL_CONTEXT internally\n return fieldType.mapper(fieldDef);\n }\n\n // Fallback to base mapper\n // Mapper will inject FIELD_SIGNAL_CONTEXT internally\n return baseFieldMapper(fieldDef);\n}\n","import { DestroyRef, Injector, runInInjectionContext, Signal, Type } from '@angular/core';\nimport { catchError, from, map, Observable, of } from 'rxjs';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { mapFieldToInputs } from '../field-mapper/field-mapper';\n\n/**\n * Resolved field ready for rendering with ngComponentOutlet.\n */\nexport interface ResolvedField {\n key: string;\n component: Type<unknown>;\n injector: Injector;\n inputs: Signal<Record<string, unknown>>;\n}\n\n/**\n * Context required to resolve a field.\n */\nexport interface ResolveFieldContext {\n /** The field registry to load components from */\n loadTypeComponent: (type: string) => Promise<Type<unknown>>;\n /** The raw field registry map for mappers */\n registry: Map<string, FieldTypeDefinition>;\n /** The injector to use for the resolved field */\n injector: Injector;\n /** DestroyRef to check if component is destroyed */\n destroyRef: DestroyRef;\n /** Optional error handler for logging */\n onError?: (fieldDef: FieldDef<unknown>, error: unknown) => void;\n}\n\n/**\n * Resolves a single field definition to a ResolvedField using RxJS.\n * Loads the component asynchronously and maps inputs in the injection context.\n *\n * @param fieldDef - The field definition to resolve\n * @param context - The context containing dependencies for resolution\n * @returns Observable that emits ResolvedField or undefined on error\n */\nexport function resolveField(fieldDef: FieldDef<unknown>, context: ResolveFieldContext): Observable<ResolvedField | undefined> {\n return from(context.loadTypeComponent(fieldDef.type)).pipe(\n map((component) => {\n // Check if component is destroyed before proceeding\n if (context.destroyRef.destroyed) {\n return undefined;\n }\n\n // Run mapper in injection context\n const inputs = runInInjectionContext(context.injector, () => mapFieldToInputs(fieldDef, context.registry));\n\n return {\n key: fieldDef.key,\n component,\n injector: context.injector,\n inputs,\n };\n }),\n catchError((error) => {\n // Only handle errors if component hasn't been destroyed\n if (!context.destroyRef.destroyed) {\n context.onError?.(fieldDef, error);\n }\n return of(undefined);\n }),\n );\n}\n\n/**\n * Reconciles previous and current resolved fields to preserve injector instances\n * for fields that haven't changed type, preventing unnecessary component recreation.\n *\n * @param prev - Previous resolved fields array\n * @param curr - Current resolved fields array\n * @returns Reconciled fields with preserved injectors where applicable\n */\nexport function reconcileFields(prev: ResolvedField[], curr: ResolvedField[]): ResolvedField[] {\n const prevMap = new Map(prev.map((f) => [f.key, f]));\n\n return curr.map((field) => {\n const existing = prevMap.get(field.key);\n\n if (existing && existing.component === field.component) {\n // Same key & type - reuse existing injector, update inputs\n return {\n ...field,\n injector: existing.injector,\n };\n }\n\n // New field or type changed - use new injector\n return field;\n });\n}\n","import { Signal } from '@angular/core';\nimport { submit } from '@angular/forms/signals';\nimport { EMPTY, firstValueFrom, from, isObservable, Observable, switchMap } from 'rxjs';\nimport { EventBus } from '../../events/event.bus';\nimport { SubmitEvent } from '../../events/constants/submit.event';\nimport { FormConfig } from '../../models/form-config';\nimport { RegisteredFieldTypes } from '../../models/registry/field-registry';\n\n/**\n * Options for creating a submission handler.\n */\nexport interface SubmissionHandlerOptions<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[]> {\n /** Event bus instance for listening to submit events */\n eventBus: EventBus;\n /** Signal containing the form configuration */\n configSignal: Signal<FormConfig<TFields>>;\n /** Signal containing the form instance */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formSignal: Signal<any>;\n}\n\n/**\n * Wraps a submission action to handle both Promise and Observable returns.\n * Converts Observables to Promises for compatibility with Angular Signal Forms' submit().\n *\n * @param action - The submission action function\n * @returns A wrapped function that always returns a Promise\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrapSubmissionAction(action: (formTree: any) => any): (formTree: any) => Promise<any> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (formTree: any): Promise<any> => {\n const result = action(formTree);\n // If the action returns an Observable, convert it to a Promise\n if (isObservable(result)) {\n return firstValueFrom(result);\n }\n return result;\n };\n}\n\n/**\n * Creates an Observable that handles form submission with optional submission action.\n *\n * This utility encapsulates the submission handling logic:\n * - Listens for submit events from the event bus\n * - If a submission.action is configured, wraps it and uses Angular Signal Forms' submit()\n * - Handles both Promise and Observable returns from the action\n * - Uses switchMap to cancel any in-flight submission when a new one starts\n *\n * The returned Observable should be subscribed to with takeUntilDestroyed() in the component.\n *\n * @param options - Configuration options for the submission handler\n * @returns Observable that processes submissions (emits when submission completes)\n *\n * @example\n * ```typescript\n * // In component constructor\n * createSubmissionHandler({\n * eventBus: this.eventBus,\n * configSignal: this.config,\n * formSignal: this.form,\n * })\n * .pipe(takeUntilDestroyed())\n * .subscribe();\n * ```\n */\nexport function createSubmissionHandler<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[]>(\n options: SubmissionHandlerOptions<TFields>,\n): Observable<unknown> {\n const { eventBus, configSignal, formSignal } = options;\n\n return eventBus.on<SubmitEvent>('submit').pipe(\n switchMap(() => {\n const submissionConfig = configSignal().submission;\n\n // If no submission action is configured, let the submitted output handle it\n // This maintains backward compatibility for users handling submission manually\n if (!submissionConfig?.action) {\n return EMPTY;\n }\n\n const wrappedAction = wrapSubmissionAction(submissionConfig.action);\n\n // Use Angular Signal Forms' native submit() function\n // This automatically:\n // - Sets form.submitting() to true during execution\n // - Applies server errors to form fields on completion\n // - Sets form.submitting() to false when done\n return from(submit(formSignal(), wrappedAction));\n }),\n );\n}\n","/**\n * Native JavaScript utility functions to replace lodash-es\n * These are simple implementations for common object manipulation patterns\n */\n\n/**\n * Creates a new object without the specified keys\n * Native replacement for lodash omit()\n *\n * @param obj - Source object\n * @param keys - Keys to omit\n * @returns New object without specified keys\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * omit(obj, ['b']); // { a: 1, c: 3 }\n * ```\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n keys.forEach((key) => delete result[key]);\n return result as Omit<T, K>;\n}\n\n/**\n * Creates an object from an array, keyed by a specified property\n * Native replacement for lodash keyBy()\n *\n * @param array - Source array\n * @param key - Property to use as key\n * @returns Object keyed by the specified property\n *\n * @example\n * ```typescript\n * const users = [{ id: 'a', name: 'Alice' }, { id: 'b', name: 'Bob' }];\n * keyBy(users, 'id'); // { a: { id: 'a', name: 'Alice' }, b: { id: 'b', name: 'Bob' } }\n * ```\n */\nexport function keyBy<T extends Record<string, any>>(array: T[], key: keyof T): Record<string, T> {\n return array.reduce(\n (acc, item) => {\n acc[item[key]] = item;\n return acc;\n },\n {} as Record<string, T>,\n );\n}\n\n/**\n * Maps object values through a transformation function\n * Native replacement for lodash mapValues()\n *\n * @param obj - Source object\n * @param fn - Transformation function\n * @returns New object with transformed values\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2 };\n * mapValues(obj, (v) => v * 2); // { a: 2, b: 4 }\n * ```\n */\nexport function mapValues<T, U>(obj: Record<string, T>, fn: (value: T, key: string) => U): Record<string, U> {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n acc[key] = fn(value, key);\n return acc;\n },\n {} as Record<string, U>,\n );\n}\n\n/**\n * Memoizes a function with optional custom cache key resolver\n * Native replacement for lodash memoize()\n *\n * @param fn - Function to memoize\n * @param resolver - Optional function to generate cache key from arguments\n * @returns Memoized function\n *\n * @example\n * ```typescript\n * const expensive = (a: number, b: number) => a + b;\n * const memoized = memoize(expensive, (a, b) => `${a}-${b}`);\n * memoized(1, 2); // Computed\n * memoized(1, 2); // Cached\n * ```\n */\nexport function memoize<TFunc extends (...args: any[]) => any>(fn: TFunc, resolver?: (...args: Parameters<TFunc>) => string): TFunc {\n const cache = new Map<string, ReturnType<TFunc>>();\n\n return ((...args: Parameters<TFunc>): ReturnType<TFunc> => {\n const key = resolver ? resolver(...args) : JSON.stringify(args);\n\n if (cache.has(key)) {\n return cache.get(key)!;\n }\n\n const result = fn(...args);\n cache.set(key, result);\n return result;\n }) as TFunc;\n}\n\n/**\n * Performs a deep equality comparison between two values\n * Native replacement for lodash isEqual()\n *\n * @param a - First value\n * @param b - Second value\n * @returns true if values are deeply equal\n *\n * @example\n * ```typescript\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual([1, 2], [1, 2]); // true\n * isEqual({ a: 1 }, { a: 2 }); // false\n * ```\n */\nexport function isEqual(a: any, b: any): boolean {\n // Same reference or both null/undefined\n if (a === b) return true;\n\n // One is null/undefined but not both\n if (a == null || b == null) return false;\n\n // Different types\n if (typeof a !== typeof b) return false;\n\n // Handle dates\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n // Handle arrays\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((item, index) => isEqual(item, b[index]));\n }\n\n // Handle objects\n if (typeof a === 'object' && typeof b === 'object') {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) return false;\n\n return keysA.every((key) => keysB.includes(key) && isEqual(a[key], b[key]));\n }\n\n // Primitives - use Object.is to handle NaN correctly (NaN === NaN is false, but Object.is(NaN, NaN) is true)\n return Object.is(a, b);\n}\n","import { InjectionToken } from '@angular/core';\nimport type { FieldSignalContext, ArrayContext } from '../mappers/types';\n\n/**\n * Injection token for providing field signal context to mappers and components.\n *\n * The field signal context is the \"nervous system\" of the dynamic form library,\n * providing access to:\n * - The form instance and structure\n * - Current form values (as signals)\n * - Default values\n * - Validation messages\n * - The injector for creating components\n *\n * This token is provided by the DynamicForm component and can be scoped\n * for nested forms (Groups, Arrays) via child injectors.\n *\n * @example\n * ```typescript\n * // In a mapper function\n * export function mapValueField(fieldDef: BaseValueField<any, any>): Binding[] {\n * const context = inject(FIELD_SIGNAL_CONTEXT);\n * const form = context.form();\n * // ... use context\n * }\n *\n * // In a component\n * export class MyFieldComponent {\n * private context = inject(FIELD_SIGNAL_CONTEXT);\n * }\n * ```\n */\nexport const FIELD_SIGNAL_CONTEXT = new InjectionToken<FieldSignalContext>('FIELD_SIGNAL_CONTEXT', {\n providedIn: null, // Not provided at root - must be provided by DynamicForm\n factory: () => {\n throw new Error(\n 'FIELD_SIGNAL_CONTEXT was not provided. ' +\n 'This token must be provided by DynamicFormComponent or a container field component. ' +\n 'If you are calling a mapper function directly, ensure it runs within runInInjectionContext() ' +\n 'with an injector that provides FIELD_SIGNAL_CONTEXT.',\n );\n },\n});\n\n/**\n * Injection token for providing array context metadata to mappers and components.\n *\n * This token is optionally provided by ArrayFieldComponent when creating injectors\n * for array items. It contains metadata about the array item's position and parent.\n *\n * Mappers can inject this token with {optional: true} to access array context:\n *\n * @example\n * ```typescript\n * // In a mapper function\n * export function buttonMapper(fieldDef: FieldDef<any>): Binding[] {\n * const arrayContext = inject(ARRAY_CONTEXT, { optional: true });\n * if (arrayContext) {\n * // Use arrayContext.index, arrayContext.arrayKey, etc.\n * }\n * }\n * ```\n */\nexport const ARRAY_CONTEXT = new InjectionToken<ArrayContext>('ARRAY_CONTEXT');\n","import { InjectionToken } from '@angular/core';\nimport { FieldDef } from '../definitions/base/field-def';\nimport { MapperFn } from '../mappers/types';\n\n/**\n * Defines how a field type handles form values and data collection.\n *\n * - 'include': Field contributes to form values (default for input fields)\n * - 'exclude': Field is excluded from form values (for display/layout fields)\n * - 'flatten': Field's children are flattened to parent level (for container fields)\n */\nexport type ValueHandlingMode = 'include' | 'exclude' | 'flatten';\n\n/**\n * Configuration interface for registering custom field types.\n *\n * Defines how a field type should be handled by the dynamic form system,\n * including its component loading strategy and field-to-component mapping logic.\n * Supports both eager-loaded and lazy-loaded components.\n *\n * @typeParam T - The field definition type this field type handles\n *\n * @example\n * ```typescript\n * const CustomInputType: FieldTypeDefinition<InputFieldDef> = {\n * name: 'custom-input',\n * loadComponent: () => import('./custom-input.component').then(m => m.CustomInputComponent),\n * mapper: customInputMapper\n * };\n *\n * // Register with providers\n * provideDynamicForm(CustomInputType)\n * ```\n */\nexport interface FieldTypeDefinition<T extends FieldDef<any> = any> {\n /** Unique identifier for the field type */\n name: string;\n /** Field definition type marker (internal use) */\n _fieldDef?: T;\n /** Function to load the component (supports lazy loading) */\n loadComponent?: () => Promise<any>;\n /** Mapper function that converts field definition to component bindings */\n mapper: MapperFn<T>;\n /** How this field type handles form values and data collection (defaults to 'include') */\n valueHandling?: ValueHandlingMode;\n}\n\n/**\n * Injection token for the global field type registry.\n *\n * Provides access to the map of registered field types throughout the application.\n * The registry is populated by the provideDynamicForm function and used by\n * field rendering components to resolve field types to their implementations.\n *\n * @example\n * ```typescript\n * constructor(@Inject(FIELD_REGISTRY) private registry: Map<string, FieldTypeDefinition>) {\n * const inputType = registry.get('input');\n * }\n * ```\n */\nexport const FIELD_REGISTRY = new InjectionToken<Map<string, FieldTypeDefinition>>('FIELD_REGISTRY', {\n providedIn: 'root',\n factory: () => new Map(),\n});\n\n/**\n * Gets the value handling mode for a specific field type from the registry.\n *\n * @param fieldType - The field type identifier\n * @param registry - The field type registry\n * @returns The value handling mode ('include' is the default if not specified)\n */\nexport function getFieldValueHandling(fieldType: string, registry: Map<string, FieldTypeDefinition>): ValueHandlingMode {\n const definition = registry.get(fieldType);\n return definition?.valueHandling ?? 'include';\n}\n","import { inject, Type } from '@angular/core';\nimport { FIELD_REGISTRY, FieldTypeDefinition } from '../../models/field-type';\n\n/**\n * Injection function for accessing the dynamic form field registry.\n *\n * Provides a convenient API for interacting with registered field types,\n * including type checking, component loading, and registration management.\n * Must be called within an injection context.\n *\n * @returns Object with methods for field registry interaction\n *\n * @example\n * ```typescript\n * @Component({...})\n * export class MyComponent {\n * private fieldRegistry = injectFieldRegistry();\n *\n * async loadCustomField() {\n * if (this.fieldRegistry.hasType('custom-input')) {\n * const component = await this.fieldRegistry.loadTypeComponent('custom-input');\n * // Use component...\n * }\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // In a service\n * @Injectable()\n * export class FormBuilderService {\n * private fieldRegistry = injectFieldRegistry();\n *\n * getAvailableFieldTypes(): string[] {\n * return this.fieldRegistry.getTypes().map(type => type.name);\n * }\n * }\n * ```\n *\n * @public\n */\nexport function injectFieldRegistry() {\n const registry = inject(FIELD_REGISTRY);\n\n return {\n /**\n * Retrieves a field type definition by its registered name.\n *\n * @param name - The registered name of the field type\n * @returns The field type definition if found, undefined otherwise\n *\n * @example\n * ```typescript\n * const inputType = fieldRegistry.getType('input');\n * if (inputType) {\n * console.log('Input field type found:', inputType.name);\n * }\n * ```\n */\n getType(name: string): FieldTypeDefinition | undefined {\n return registry.get(name);\n },\n\n /**\n * Checks if a field type is registered in the registry.\n *\n * @param name - The name of the field type to check\n * @returns True if the field type exists, false otherwise\n *\n * @example\n * ```typescript\n * if (fieldRegistry.hasType('custom-input')) {\n * // Safe to use custom-input field type\n * const component = await fieldRegistry.loadTypeComponent('custom-input');\n * }\n * ```\n */\n hasType(name: string): boolean {\n return registry.has(name);\n },\n\n /**\n * Loads a field type component with support for lazy loading.\n *\n * Handles both synchronous component references and asynchronous\n * dynamic imports. Automatically extracts default exports from ES modules.\n *\n * @param name - The name of the field type to load\n * @returns Promise resolving to the component constructor\n * @throws {Error} When field type is not registered or loading fails\n *\n * @example\n * ```typescript\n * try {\n * const InputComponent = await fieldRegistry.loadTypeComponent('input');\n * const componentRef = vcr.createComponent(InputComponent);\n * } catch (error) {\n * console.error('Failed to load component:', error);\n * }\n * ```\n */\n async loadTypeComponent(name: string): Promise<Type<unknown>> {\n const fieldType = registry.get(name);\n\n if (!fieldType) {\n throw new Error(`[Dynamic Forms] Field type \"${name}\" is not registered`);\n }\n\n // Handle async loading\n if (fieldType.loadComponent) {\n try {\n const result = await fieldType.loadComponent();\n // Handle ES module imports - extract default export if needed\n return (result as any)?.default || result;\n } catch (error) {\n throw new Error(`[Dynamic Forms] Failed to load component for field type \"${name}\": ${error}`);\n }\n }\n\n throw new Error(`[Dynamic Forms] Field type \"${name}\" has no component or loadComponent function`);\n },\n\n /**\n * Gets all registered field type definitions.\n *\n * @returns Array of all field type definitions in the registry\n *\n * @example\n * ```typescript\n * const allTypes = fieldRegistry.getTypes();\n * const typeNames = allTypes.map(type => type.name);\n * console.log('Available field types:', typeNames);\n * ```\n */\n getTypes(): FieldTypeDefinition[] {\n return Array.from(registry.values());\n },\n\n /**\n * Registers multiple field types at once.\n *\n * Useful for bulk registration of custom field types. Overwrites\n * existing registrations with the same name.\n *\n * @param types - Array of field type definitions to register\n *\n * @example\n * ```typescript\n * fieldRegistry.registerTypes([\n * CustomInputType,\n * CustomSelectType,\n * CustomDatePickerType\n * ]);\n * ```\n */\n registerTypes(types: FieldTypeDefinition[]): void {\n types.forEach((type) => {\n registry.set(type.name, type);\n });\n },\n\n /**\n * Provides direct access to the underlying registry Map.\n *\n * Use with caution - direct modification can affect form behavior.\n * Primarily intended for advanced use cases and debugging.\n *\n * @returns The raw Map containing field type registrations\n *\n * @example\n * ```typescript\n * const rawRegistry = fieldRegistry.raw;\n * console.log('Registry size:', rawRegistry.size);\n * ```\n */\n get raw() {\n return registry;\n },\n };\n}\n","import { Injectable, signal, Signal, isSignal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\n\n/**\n * Type for form value signals - either a Signal returning an object or a FieldTree\n */\ntype FormValueSource = Signal<Record<string, unknown>> | FieldTree<unknown>;\n\n/**\n * Registry service that maintains references to root form fields.\n * This provides a type-safe way to access root form values from child fields\n * without relying on internal Angular Forms API navigation.\n *\n * This service should be provided at the component level to ensure proper\n * isolation between different form instances.\n *\n * IMPORTANT: This registry supports two registration patterns:\n * 1. registerFormValueSignal() - Register the SOURCE signal BEFORE form creation\n * This allows logic functions to read form values during schema evaluation.\n * 2. registerRootForm() - Register the FieldTree AFTER form creation\n * This provides access to the full form structure.\n *\n * For cross-field logic to work correctly, registerFormValueSignal() should be\n * called BEFORE the form() call.\n */\n@Injectable()\nexport class RootFormRegistryService {\n // Use a signal containing a Map to make registration reactive\n private readonly _rootForms = signal(new Map<string, FieldTree<unknown>>());\n // Store form value signals separately - these can be registered before form creation\n private readonly _formValueSignals = signal(new Map<string, Signal<Record<string, unknown>>>());\n private readonly formContexts = new Map<string, Record<string, unknown>>();\n\n /**\n * Registers the form value signal BEFORE form creation.\n *\n * This is the recommended pattern for cross-field logic:\n * 1. Create the formValue signal\n * 2. Register it with registerFormValueSignal()\n * 3. Create the form with form(formValue, schema(...))\n *\n * This allows logic functions to access form values during schema evaluation.\n */\n registerFormValueSignal(valueSignal: Signal<Record<string, unknown>>, formId = 'default'): void {\n this._formValueSignals.update((signals) => {\n const newSignals = new Map(signals);\n newSignals.set(formId, valueSignal);\n return newSignals;\n });\n }\n\n /**\n * Gets the registered form value signal by id.\n *\n * This allows direct access to the source signal, which can be read\n * reactively to get form values.\n */\n getFormValueSignal(formId = 'default'): Signal<Record<string, unknown>> | undefined {\n return this._formValueSignals().get(formId);\n }\n\n /**\n * Registers a root form field with an optional identifier.\n * If no id is provided, uses 'default' as the key.\n *\n * This triggers reactive updates for any computed signals that\n * depend on getRootForm().\n */\n registerRootForm(rootField: FieldTree<unknown>, formId = 'default'): void {\n this._rootForms.update((forms) => {\n const newForms = new Map(forms);\n newForms.set(formId, rootField);\n return newForms;\n });\n }\n\n /**\n * Gets a registered root form field by id.\n *\n * IMPORTANT: This method reads from a signal, which means any computed\n * signal that calls this method will automatically re-evaluate when\n * the form is registered or updated.\n */\n getRootForm(formId = 'default'): FieldTree<unknown> | undefined {\n return this._rootForms().get(formId);\n }\n\n /**\n * Gets the form value, preferring the direct signal if available.\n *\n * This method tries in order:\n * 1. Form value signal (if registered) - reads directly from source signal\n * 2. Root form's .value() (if registered) - reads from FieldTree\n * 3. Returns empty object if nothing is registered\n *\n * Reading from signals creates reactive dependencies, so computeds will\n * re-evaluate when form values change.\n */\n getFormValue(formId = 'default'): Record<string, unknown> {\n // First try the direct value signal (preferred, can be registered before form creation)\n const valueSignal = this._formValueSignals().get(formId);\n if (valueSignal) {\n const value = valueSignal();\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n return value;\n }\n }\n\n // Fall back to root form's value\n const rootForm = this._rootForms().get(formId);\n if (rootForm) {\n try {\n let rootValue: unknown;\n\n // Check if rootForm is a Signal (callable function that returns FieldTree)\n if (isSignal(rootForm)) {\n const fieldTree = rootForm();\n if (fieldTree && typeof fieldTree === 'object' && 'value' in fieldTree) {\n rootValue = (fieldTree as { value: () => unknown }).value();\n }\n } else if ('value' in rootForm && typeof (rootForm as { value: unknown }).value === 'function') {\n rootValue = (rootForm as { value: () => unknown }).value();\n }\n\n if (rootValue && typeof rootValue === 'object' && !Array.isArray(rootValue)) {\n return rootValue as Record<string, unknown>;\n }\n } catch {\n // Ignore errors when reading form value\n }\n }\n\n return {};\n }\n\n /**\n * Registers form context (field paths and metadata) for a specific form.\n * This can be used to store additional context information.\n */\n registerFormContext(context: Record<string, unknown>, formId = 'default'): void {\n this.formContexts.set(formId, context);\n }\n\n /**\n * Gets form context by id.\n */\n getFormContext(formId = 'default'): Record<string, unknown> {\n return this.formContexts.get(formId) || {};\n }\n\n /**\n * Unregisters a form and its context.\n * This should be called when a form component is destroyed to prevent memory leaks.\n */\n unregisterForm(formId = 'default'): void {\n this._rootForms.update((forms) => {\n const newForms = new Map(forms);\n newForms.delete(formId);\n return newForms;\n });\n this.formContexts.delete(formId);\n }\n\n /**\n * Gets all registered form IDs.\n */\n getRegisteredFormIds(): string[] {\n return Array.from(this._rootForms().keys());\n }\n\n /**\n * Clears all registered forms. Useful for testing.\n */\n clear(): void {\n this._rootForms.set(new Map());\n this._formValueSignals.set(new Map());\n this.formContexts.clear();\n }\n}\n","import { inject, Injectable, isSignal, untracked } from '@angular/core';\nimport { ChildFieldContext, FieldContext } from '@angular/forms/signals';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { RootFormRegistryService } from './root-form-registry.service';\n\nfunction isChildFieldContext<TValue>(context: FieldContext<TValue>): context is ChildFieldContext<TValue> {\n return 'key' in context && isSignal(context.key);\n}\n\n/**\n * Service that provides field evaluation context by combining\n * field context with root form registry information.\n *\n * This service should be provided at the component level to ensure proper\n * isolation between different form instances.\n */\n@Injectable()\nexport class FieldContextRegistryService {\n private rootFormRegistry = inject(RootFormRegistryService);\n\n /**\n * Creates an evaluation context for a field by combining:\n * - The field's current value\n * - The root form value from the registry\n * - The field path (if available from form context)\n * - Custom functions (if provided)\n */\n createEvaluationContext<TValue>(\n fieldContext: FieldContext<TValue>,\n customFunctions?: Record<string, (context: EvaluationContext) => unknown>,\n formId = 'default',\n ): EvaluationContext {\n // Use untracked() to read the field value WITHOUT creating a reactive dependency.\n // This prevents infinite loops when logic functions are evaluated inside computed signals.\n const fieldValue = untracked(() => fieldContext.value());\n\n // Get form value using the unified method, wrapped in untracked() to prevent\n // reactive dependencies. This allows validators and dynamic values to access\n // form values without causing infinite loops.\n //\n // Without untracked():\n // 1. Validator runs and reads formValue via this context\n // 2. This creates a signal dependency on the form's value\n // 3. Any field change updates the form value signal\n // 4. All validators that read formValue re-run\n // 5. They read formValue again, creating new dependencies\n // 6. Infinite loop until browser freezes\n //\n // With untracked():\n // - Form value is read as a snapshot, no dependency is created\n // - Validators still run when their own field value changes (via fieldValue)\n // - Cross-field validation still works, just without cascading re-evaluation\n const formValue = untracked(() => this.rootFormRegistry.getFormValue(formId));\n\n // Get field path from form context\n const formContext = this.rootFormRegistry.getFormContext(formId);\n const fieldPath = this.extractFieldPath(fieldContext, formContext);\n\n return {\n fieldValue,\n formValue,\n fieldPath,\n customFunctions: customFunctions || {},\n };\n }\n\n /**\n * Registers a field path mapping for a specific form.\n * This can be called when fields are created to maintain path information.\n */\n registerFieldPath(fieldKey: string | number, parentPath: string, formId = 'default'): void {\n const context = this.rootFormRegistry.getFormContext(formId);\n const fullPath = parentPath ? `${parentPath}.${fieldKey}` : String(fieldKey);\n\n context.fieldPaths = context.fieldPaths || {};\n (context.fieldPaths as Record<string, string>)[String(fieldKey)] = fullPath;\n\n this.rootFormRegistry.registerFormContext(context, formId);\n }\n\n /**\n * Extracts the field path for a given field context.\n * This is a simplified implementation that could be enhanced\n * based on the specific needs of the form library.\n */\n private extractFieldPath(fieldContext: FieldContext<unknown>, formContext: Record<string, unknown>): string {\n // Check if the field context has a key property (for child fields)\n const extendedContext = fieldContext;\n\n if (isChildFieldContext(extendedContext)) {\n try {\n const key = extendedContext.key();\n const fieldPaths = (formContext.fieldPaths as Record<string, string>) || {};\n return fieldPaths[String(key)] || String(key);\n } catch (error) {\n console.warn('[Dynamic Forms] Unable to extract field key:', error);\n }\n }\n\n // For root fields or when key is not available\n return '';\n }\n\n /**\n * Creates a REACTIVE evaluation context for logic functions.\n *\n * Unlike createEvaluationContext, this method does NOT use untracked(),\n * which allows logic functions (hidden, readonly, disabled, required) to\n * create reactive dependencies on form values.\n *\n * When a dependent field value changes, the logic function will be re-evaluated.\n *\n * IMPORTANT: For this to work correctly, the form value signal should be\n * registered with rootFormRegistry.registerFormValueSignal() BEFORE the\n * form is created. This ensures the logic function can read form values\n * during schema evaluation.\n *\n * NOTE: This should ONLY be used for logic functions, not validators.\n * Validators should use createEvaluationContext with untracked() to prevent\n * infinite reactive loops. Validators with cross-field dependencies should be\n * hoisted to form-level using validateTree.\n */\n createReactiveEvaluationContext<TValue>(\n fieldContext: FieldContext<TValue>,\n customFunctions?: Record<string, (context: EvaluationContext) => unknown>,\n formId = 'default',\n ): EvaluationContext {\n // Read field value reactively (creates a dependency)\n const fieldValue = fieldContext.value();\n\n // Get form value using the new unified method that prefers the direct signal\n // This creates reactive dependencies on the form value signal\n const formValue = this.rootFormRegistry.getFormValue(formId);\n\n // Get field path from form context\n const formContext = this.rootFormRegistry.getFormContext(formId);\n const fieldPath = this.extractFieldPath(fieldContext, formContext);\n\n return {\n fieldValue,\n formValue,\n fieldPath,\n customFunctions: customFunctions || {},\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { CustomFunction, CustomFunctionOptions, CustomFunctionScope } from '../expressions/custom-function-types';\nimport { AsyncCustomValidator, CustomValidator, HttpCustomValidator } from '../validation/validator-types';\n\n/**\n * Registry service for custom functions and validators\n *\n * This service maintains four separate registries:\n *\n * 1. **Custom Functions** - For conditional expressions (when/readonly/disabled)\n * - Used in: when conditions, readonly logic, disabled logic\n * - Return type: any value (typically boolean)\n * - Example: `isAdult: (ctx) => ctx.age >= 18`\n *\n * 2. **Custom Validators** - For synchronous validation using Angular's public FieldContext API\n * - Used in: validators array on fields\n * - Return type: ValidationError | ValidationError[] | null\n * - Example: `noSpaces: (ctx) => ctx.value().includes(' ') ? { kind: 'noSpaces' } : null`\n *\n * 3. **Async Validators** - For asynchronous validation (debouncing, database lookups, etc.)\n * - Used in: validators array on fields with type 'customAsync'\n * - Return type: Observable<ValidationError | ValidationError[] | null>\n * - Example: `checkUsername: (ctx) => userService.checkAvailability(ctx.value())`\n *\n * 4. **HTTP Validators** - For HTTP-based validation with automatic request cancellation\n * - Used in: validators array on fields with type 'customHttp'\n * - Configuration object with url, method, mapResponse, etc.\n * - Example: `{ url: '/api/check', method: 'GET', mapResponse: ... }`\n *\n * @example\n * ```typescript\n * // Register a custom function for expressions\n * registry.registerCustomFunction('isAdult', (ctx) => ctx.age >= 18);\n *\n * // Use in field configuration\n * {\n * key: 'alcoholPreference',\n * when: { function: 'isAdult' }\n * }\n *\n * // Register a custom validator\n * registry.registerValidator('noSpaces', (ctx) => {\n * const value = ctx.value();\n * return typeof value === 'string' && value.includes(' ')\n * ? { kind: 'noSpaces' }\n * : null;\n * });\n *\n * // Use in field configuration\n * {\n * key: 'username',\n * validators: [{ type: 'custom', functionName: 'noSpaces' }],\n * validationMessages: {\n * noSpaces: 'Spaces are not allowed'\n * }\n * }\n * ```\n */\n@Injectable()\nexport class FunctionRegistryService {\n private readonly customFunctions = new Map<string, CustomFunction>();\n private readonly customFunctionScopes = new Map<string, CustomFunctionScope>();\n private readonly validators = new Map<string, CustomValidator>();\n private readonly asyncValidators = new Map<string, AsyncCustomValidator>();\n private readonly httpValidators = new Map<string, HttpCustomValidator>();\n\n /**\n * Register a custom function for conditional expressions\n *\n * Custom functions are used for control flow logic (when/readonly/disabled),\n * NOT for validation. They return any value, typically boolean.\n *\n * @param name - Unique identifier for the function\n * @param fn - Function that receives EvaluationContext and returns any value\n * @param options - Optional configuration for the function\n *\n * @example\n * ```typescript\n * // Form-level function (default) - may access other fields\n * registry.registerCustomFunction('isAdult', (ctx) => ctx.formValue.age >= 18);\n *\n * // Field-level function - only uses current field value (performance optimization)\n * registry.registerCustomFunction('isEmpty', (ctx) => !ctx.fieldValue, { scope: 'field' });\n * ```\n */\n registerCustomFunction(name: string, fn: CustomFunction, options?: CustomFunctionOptions): void {\n this.customFunctions.set(name, fn);\n // Store scope (default to 'form' for conservative cross-field detection)\n this.customFunctionScopes.set(name, options?.scope ?? 'form');\n }\n\n /**\n * Get the scope of a registered custom function.\n *\n * @param name - The function name\n * @returns The function scope, or undefined if not registered\n */\n getCustomFunctionScope(name: string): CustomFunctionScope | undefined {\n return this.customFunctionScopes.get(name);\n }\n\n /**\n * Check if a custom function is field-scoped (no cross-field dependencies).\n *\n * @param name - The function name\n * @returns true if the function is field-scoped, false if form-scoped or not registered\n */\n isFieldScopedFunction(name: string): boolean {\n return this.customFunctionScopes.get(name) === 'field';\n }\n\n /**\n * Get all custom functions as an object\n */\n getCustomFunctions(): Record<string, CustomFunction> {\n return Object.fromEntries(this.customFunctions);\n }\n\n /**\n * Clear all custom functions and their scopes\n */\n clearCustomFunctions(): void {\n this.customFunctions.clear();\n this.customFunctionScopes.clear();\n }\n\n /**\n * Register a custom validator using Angular's public FieldContext API\n *\n * Validators receive the full FieldContext, allowing access to:\n * - Current field value: `ctx.value()`\n * - Field state: `ctx.state` (errors, touched, dirty, etc.)\n * - Other field values: `ctx.valueOf(path)` (public API!)\n * - Other field states: `ctx.stateOf(path)`\n * - Parameters from JSON configuration via second argument\n *\n * @param name - Unique identifier for the validator\n * @param fn - Validator function (ctx, params?) => ValidationError | ValidationError[] | null\n *\n * @example Single Field Validation\n * ```typescript\n * registry.registerValidator('noSpaces', (ctx) => {\n * const value = ctx.value();\n * if (typeof value === 'string' && value.includes(' ')) {\n * return { kind: 'noSpaces' };\n * }\n * return null;\n * });\n * ```\n *\n * @example Cross-Field Validation (Public API)\n * ```typescript\n * registry.registerValidator('lessThan', (ctx, params) => {\n * const value = ctx.value();\n * const compareToPath = params?.field as string;\n *\n * // Use valueOf() to access other fields - public API!\n * const otherValue = ctx.valueOf(compareToPath as any);\n *\n * if (otherValue !== undefined && value >= otherValue) {\n * return { kind: 'notLessThan' };\n * }\n * return null;\n * });\n * ```\n *\n * @example Multiple Errors (Cross-Field Validation)\n * ```typescript\n * registry.registerValidator('validateDateRange', (ctx) => {\n * const errors: ValidationError[] = [];\n * const startDate = ctx.valueOf('startDate' as any);\n * const endDate = ctx.valueOf('endDate' as any);\n *\n * if (!startDate) errors.push({ kind: 'startDateRequired' });\n * if (!endDate) errors.push({ kind: 'endDateRequired' });\n * if (startDate && endDate && startDate > endDate) {\n * errors.push({ kind: 'invalidDateRange' });\n * }\n *\n * return errors.length > 0 ? errors : null;\n * });\n * ```\n */\n registerValidator(name: string, fn: CustomValidator): void {\n this.validators.set(name, fn);\n }\n\n /**\n * Get a validator by name\n */\n getValidator(name: string): CustomValidator | undefined {\n return this.validators.get(name);\n }\n\n /**\n * Clear all validators\n */\n clearValidators(): void {\n this.validators.clear();\n }\n\n /**\n * Register an async validator using Angular's public validateAsync() API\n *\n * Async validators return Observables for asynchronous validation logic.\n * Use for debouncing, database lookups, or complex async business logic.\n *\n * @param name - Unique identifier for the async validator\n * @param fn - Async validator function (ctx, params?) => Observable<ValidationError | ValidationError[] | null>\n *\n * @example Debounced Username Check\n * ```typescript\n * registry.registerAsyncValidator('checkUsernameAvailable', (ctx) => {\n * const username = ctx.value();\n * return of(username).pipe(\n * debounceTime(300),\n * switchMap(name => userService.checkAvailability(name)),\n * map(available => available ? null : { kind: 'usernameTaken' })\n * );\n * });\n * ```\n *\n * @example Async Cross-Field Validation\n * ```typescript\n * registry.registerAsyncValidator('validatePasswordStrength', (ctx) => {\n * const password = ctx.value();\n * const email = ctx.valueOf('email' as any);\n * return passwordService.checkStrength(password, email).pipe(\n * map(result => result.strong ? null : { kind: 'weakPassword' })\n * );\n * });\n * ```\n */\n registerAsyncValidator(name: string, fn: AsyncCustomValidator): void {\n this.asyncValidators.set(name, fn);\n }\n\n /**\n * Get an async validator by name\n */\n getAsyncValidator(name: string): AsyncCustomValidator | undefined {\n return this.asyncValidators.get(name);\n }\n\n /**\n * Clear all async validators\n */\n clearAsyncValidators(): void {\n this.asyncValidators.clear();\n }\n\n /**\n * Register an HTTP validator configuration using Angular's public validateHttp() API\n *\n * HTTP validators provide optimized HTTP validation with automatic request cancellation,\n * caching, and debouncing. Preferred over AsyncCustomValidator for HTTP requests.\n *\n * @param name - Unique identifier for the HTTP validator\n * @param config - HTTP validator configuration object\n *\n * @example Username Availability Check\n * ```typescript\n * registry.registerHttpValidator('checkUsername', {\n * url: (ctx) => `/api/users/check-username?username=${encodeURIComponent(ctx.value())}`,\n * method: 'GET',\n * mapResponse: (response, ctx) => {\n * return response.available ? null : { kind: 'usernameTaken' };\n * }\n * });\n * ```\n *\n * @example POST Request with Body\n * ```typescript\n * registry.registerHttpValidator('validateAddress', {\n * url: '/api/validate-address',\n * method: 'POST',\n * body: (ctx) => ({\n * street: ctx.valueOf('street' as any),\n * city: ctx.valueOf('city' as any),\n * zipCode: ctx.value()\n * }),\n * mapResponse: (response) => {\n * return response.valid ? null : { kind: 'invalidAddress' };\n * },\n * debounceTime: 500\n * });\n * ```\n */\n registerHttpValidator(name: string, config: HttpCustomValidator): void {\n this.httpValidators.set(name, config);\n }\n\n /**\n * Get an HTTP validator by name\n */\n getHttpValidator(name: string): HttpCustomValidator | undefined {\n return this.httpValidators.get(name);\n }\n\n /**\n * Clear all HTTP validators\n */\n clearHttpValidators(): void {\n this.httpValidators.clear();\n }\n\n /**\n * Generic helper to set registry values only if they have changed\n * @param registry - The Map to update\n * @param values - Object mapping keys to values\n */\n private setRegistryIfChanged<T>(registry: Map<string, T>, values: Record<string, T> | undefined): void {\n if (!values) return;\n\n const entries = Object.entries(values);\n const hasChanges = entries.some(([name, value]) => registry.get(name) !== value);\n\n if (hasChanges) {\n entries.forEach(([name, value]) => registry.set(name, value));\n }\n }\n\n /**\n * Set validators from a config object\n * Only updates validators if their references have changed\n *\n * @param validators - Object mapping validator names to validator functions\n */\n setValidators(validators: Record<string, CustomValidator> | undefined): void {\n this.setRegistryIfChanged(this.validators, validators);\n }\n\n /**\n * Set async validators from a config object\n * Only updates validators if their references have changed\n *\n * @param asyncValidators - Object mapping validator names to async validator configs\n */\n setAsyncValidators(asyncValidators: Record<string, AsyncCustomValidator> | undefined): void {\n this.setRegistryIfChanged(this.asyncValidators, asyncValidators);\n }\n\n /**\n * Set HTTP validators from a config object\n * Only updates validators if their references have changed\n *\n * @param httpValidators - Object mapping validator names to HTTP validator configs\n */\n setHttpValidators(httpValidators: Record<string, HttpCustomValidator> | undefined): void {\n this.setRegistryIfChanged(this.httpValidators, httpValidators);\n }\n\n /**\n * Clear everything (functions and all validators)\n */\n clearAll(): void {\n this.clearCustomFunctions();\n this.clearValidators();\n this.clearAsyncValidators();\n this.clearHttpValidators();\n }\n}\n","/**\n * Compares two values using the specified comparison operator.\n *\n * Supports various comparison types including equality, numerical comparisons,\n * string operations, and regular expression matching. Type coercion is applied\n * for numerical and string operations as needed.\n *\n * @param actual - The value to compare\n * @param expected - The value to compare against\n * @param operator - Comparison operator to use\n * @returns True if the comparison succeeds, false otherwise\n *\n * @example\n * ```typescript\n * // Equality checks\n * compareValues(10, 10, 'equals') // true\n * compareValues('test', 'other', 'notEquals') // true\n *\n * // Numerical comparisons\n * compareValues(15, 10, 'greater') // true\n * compareValues('5', 3, 'greaterOrEqual') // true (coerced to numbers)\n *\n * // String operations\n * compareValues('hello world', 'world', 'contains') // true\n * compareValues('prefix-test', 'prefix', 'startsWith') // true\n * compareValues('test.jpg', '.jpg', 'endsWith') // true\n *\n * // Regular expression matching\n * compareValues('test123', '^test\\\\d+$', 'matches') // true\n * compareValues('invalid', '[invalid', 'matches') // false (invalid regex)\n * ```\n */\nexport function compareValues(actual: unknown, expected: unknown, operator: string): boolean {\n switch (operator) {\n case 'equals':\n return actual === expected;\n case 'notEquals':\n return actual !== expected;\n case 'greater':\n return Number(actual) > Number(expected);\n case 'less':\n return Number(actual) < Number(expected);\n case 'greaterOrEqual':\n return Number(actual) >= Number(expected);\n case 'lessOrEqual':\n return Number(actual) <= Number(expected);\n case 'contains':\n return String(actual).includes(String(expected));\n case 'startsWith':\n return String(actual).startsWith(String(expected));\n case 'endsWith':\n return String(actual).endsWith(String(expected));\n case 'matches':\n try {\n return new RegExp(String(expected)).test(String(actual));\n } catch {\n return false;\n }\n default:\n return false;\n }\n}\n\n/**\n * Retrieves a nested value from an object using dot notation path.\n *\n * Safely traverses object properties using a dot-separated path string.\n * Returns undefined if any part of the path is missing or if the traversal\n * encounters a non-object value.\n *\n * @param obj - The object to traverse\n * @param path - Dot-separated path to the desired property\n * @returns The value at the specified path, or undefined if not found\n *\n * @example\n * ```typescript\n * const data = {\n * user: {\n * profile: {\n * name: 'John',\n * age: 30\n * },\n * settings: { theme: 'dark' }\n * }\n * };\n *\n * getNestedValue(data, 'user.profile.name') // 'John'\n * getNestedValue(data, 'user.settings.theme') // 'dark'\n * getNestedValue(data, 'user.profile.email') // undefined\n * getNestedValue(data, 'nonexistent.path') // undefined\n * getNestedValue(null, 'any.path') // undefined\n * ```\n */\nexport function getNestedValue(obj: unknown, path: string): unknown {\n return path.split('.').reduce((current: unknown, key: string) => {\n return current && typeof current === 'object' ? (current as Record<string, unknown>)[key] : undefined;\n }, obj);\n}\n","/**\n * Token types for expression parsing\n */\nexport enum TokenType {\n // Literals\n NUMBER = 'NUMBER',\n STRING = 'STRING',\n TRUE = 'TRUE',\n FALSE = 'FALSE',\n NULL = 'NULL',\n UNDEFINED = 'UNDEFINED',\n\n // Identifiers\n IDENTIFIER = 'IDENTIFIER',\n\n // Operators\n PLUS = 'PLUS',\n MINUS = 'MINUS',\n MULTIPLY = 'MULTIPLY',\n DIVIDE = 'DIVIDE',\n MODULO = 'MODULO',\n\n // Comparison\n EQUAL = 'EQUAL',\n NOT_EQUAL = 'NOT_EQUAL',\n GREATER = 'GREATER',\n LESS = 'LESS',\n GREATER_EQUAL = 'GREATER_EQUAL',\n LESS_EQUAL = 'LESS_EQUAL',\n\n // Logical\n AND = 'AND',\n OR = 'OR',\n NOT = 'NOT',\n\n // Punctuation\n DOT = 'DOT',\n COMMA = 'COMMA',\n LPAREN = 'LPAREN',\n RPAREN = 'RPAREN',\n LBRACKET = 'LBRACKET',\n RBRACKET = 'RBRACKET',\n\n // Special\n EOF = 'EOF',\n TYPEOF = 'TYPEOF',\n}\n\n/**\n * Token with type, value, and position\n */\nexport interface Token {\n type: TokenType;\n value: string;\n position: number;\n}\n\n/**\n * AST Node types\n */\nexport type ASTNode = LiteralNode | IdentifierNode | MemberAccessNode | BinaryOpNode | UnaryOpNode | CallExpressionNode | ArrayLiteralNode;\n\nexport interface LiteralNode {\n type: 'Literal';\n value: string | number | boolean | null | undefined;\n}\n\nexport interface IdentifierNode {\n type: 'Identifier';\n name: string;\n}\n\nexport interface MemberAccessNode {\n type: 'MemberAccess';\n object: ASTNode;\n property: string;\n}\n\nexport interface BinaryOpNode {\n type: 'BinaryOp';\n operator: string;\n left: ASTNode;\n right: ASTNode;\n}\n\nexport interface UnaryOpNode {\n type: 'UnaryOp';\n operator: string;\n operand: ASTNode;\n}\n\nexport interface CallExpressionNode {\n type: 'CallExpression';\n callee: ASTNode;\n arguments: ASTNode[];\n}\n\nexport interface ArrayLiteralNode {\n type: 'ArrayLiteral';\n elements: ASTNode[];\n}\n\n/**\n * Parser error with position information\n */\nexport class ExpressionParserError extends Error {\n constructor(\n message: string,\n public position: number,\n public expression: string,\n ) {\n super(`${message} at position ${position} in expression: ${expression}`);\n this.name = 'ExpressionParserError';\n }\n}\n","import { Token, TokenType, ExpressionParserError } from './types';\n\n/**\n * Tokenizes an expression string into tokens\n */\nexport class Tokenizer {\n private position = 0;\n private readonly expression: string;\n\n constructor(expression: string) {\n this.expression = expression;\n }\n\n /**\n * Tokenize the entire expression\n */\n tokenize(): Token[] {\n const tokens: Token[] = [];\n\n while (this.position < this.expression.length) {\n this.skipWhitespace();\n\n if (this.position >= this.expression.length) {\n break;\n }\n\n const token = this.nextToken();\n tokens.push(token);\n }\n\n tokens.push({ type: TokenType.EOF, value: '', position: this.position });\n return tokens;\n }\n\n private skipWhitespace(): void {\n while (this.position < this.expression.length && /\\s/.test(this.expression[this.position])) {\n this.position++;\n }\n }\n\n private nextToken(): Token {\n const char = this.expression[this.position];\n\n // String literals\n if (char === '\"' || char === \"'\") {\n return this.readString(char);\n }\n\n // Numbers\n if (/[0-9]/.test(char)) {\n return this.readNumber();\n }\n\n // Identifiers and keywords\n if (/[a-zA-Z_$]/.test(char)) {\n return this.readIdentifierOrKeyword();\n }\n\n // Operators and punctuation\n return this.readOperatorOrPunctuation();\n }\n\n private readString(quote: string): Token {\n const start = this.position;\n this.position++; // Skip opening quote\n\n let value = '';\n while (this.position < this.expression.length) {\n const char = this.expression[this.position];\n\n if (char === quote) {\n this.position++; // Skip closing quote\n return { type: TokenType.STRING, value, position: start };\n }\n\n if (char === '\\\\' && this.position + 1 < this.expression.length) {\n // Handle escape sequences\n this.position++;\n const nextChar = this.expression[this.position];\n switch (nextChar) {\n case 'n':\n value += '\\n';\n break;\n case 't':\n value += '\\t';\n break;\n case 'r':\n value += '\\r';\n break;\n case '\\\\':\n value += '\\\\';\n break;\n case quote:\n value += quote;\n break;\n default:\n value += nextChar;\n }\n this.position++;\n } else {\n value += char;\n this.position++;\n }\n }\n\n throw new ExpressionParserError('[Dynamic Forms] Unterminated string literal', start, this.expression);\n }\n\n private readNumber(): Token {\n const start = this.position;\n let value = '';\n\n while (this.position < this.expression.length && /[0-9.]/.test(this.expression[this.position])) {\n value += this.expression[this.position];\n this.position++;\n }\n\n return { type: TokenType.NUMBER, value, position: start };\n }\n\n private readIdentifierOrKeyword(): Token {\n const start = this.position;\n let value = '';\n\n while (this.position < this.expression.length && /[a-zA-Z0-9_$]/.test(this.expression[this.position])) {\n value += this.expression[this.position];\n this.position++;\n }\n\n // Check for keywords\n const type = this.getKeywordType(value);\n return { type, value, position: start };\n }\n\n private getKeywordType(value: string): TokenType {\n switch (value) {\n case 'true':\n return TokenType.TRUE;\n case 'false':\n return TokenType.FALSE;\n case 'null':\n return TokenType.NULL;\n case 'undefined':\n return TokenType.UNDEFINED;\n case 'typeof':\n return TokenType.TYPEOF;\n default:\n return TokenType.IDENTIFIER;\n }\n }\n\n private readOperatorOrPunctuation(): Token {\n const start = this.position;\n const char = this.expression[this.position];\n const nextChar = this.position + 1 < this.expression.length ? this.expression[this.position + 1] : '';\n const thirdChar = this.position + 2 < this.expression.length ? this.expression[this.position + 2] : '';\n\n // Three-character operators - check these first!\n const threeChar = char + nextChar + thirdChar;\n if (threeChar === '===') {\n this.position += 3;\n return { type: TokenType.EQUAL, value: '===', position: start };\n }\n if (threeChar === '!==') {\n this.position += 3;\n return { type: TokenType.NOT_EQUAL, value: '!==', position: start };\n }\n\n // Two-character operators\n const twoChar = char + nextChar;\n switch (twoChar) {\n case '==':\n this.position += 2;\n return { type: TokenType.EQUAL, value: '==', position: start };\n case '!=':\n this.position += 2;\n return { type: TokenType.NOT_EQUAL, value: '!=', position: start };\n case '>=':\n this.position += 2;\n return { type: TokenType.GREATER_EQUAL, value: '>=', position: start };\n case '<=':\n this.position += 2;\n return { type: TokenType.LESS_EQUAL, value: '<=', position: start };\n case '&&':\n this.position += 2;\n return { type: TokenType.AND, value: '&&', position: start };\n case '||':\n this.position += 2;\n return { type: TokenType.OR, value: '||', position: start };\n }\n\n // Single-character operators and punctuation\n this.position++;\n switch (char) {\n case '+':\n return { type: TokenType.PLUS, value: '+', position: start };\n case '-':\n return { type: TokenType.MINUS, value: '-', position: start };\n case '*':\n return { type: TokenType.MULTIPLY, value: '*', position: start };\n case '/':\n return { type: TokenType.DIVIDE, value: '/', position: start };\n case '%':\n return { type: TokenType.MODULO, value: '%', position: start };\n case '>':\n return { type: TokenType.GREATER, value: '>', position: start };\n case '<':\n return { type: TokenType.LESS, value: '<', position: start };\n case '!':\n return { type: TokenType.NOT, value: '!', position: start };\n case '.':\n return { type: TokenType.DOT, value: '.', position: start };\n case ',':\n return { type: TokenType.COMMA, value: ',', position: start };\n case '(':\n return { type: TokenType.LPAREN, value: '(', position: start };\n case ')':\n return { type: TokenType.RPAREN, value: ')', position: start };\n case '[':\n return { type: TokenType.LBRACKET, value: '[', position: start };\n case ']':\n return { type: TokenType.RBRACKET, value: ']', position: start };\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unexpected character: ${char}`, start, this.expression);\n }\n }\n}\n","import { Token, TokenType, ASTNode, ExpressionParserError } from './types';\nimport { Tokenizer } from './tokenizer';\n\n/**\n * Parses tokens into an Abstract Syntax Tree (AST)\n * Uses recursive descent parsing with operator precedence\n */\nexport class Parser {\n private tokens: Token[] = [];\n private current = 0;\n private readonly expression: string;\n\n constructor(expression: string) {\n this.expression = expression;\n }\n\n /**\n * Parse the expression into an AST\n */\n parse(): ASTNode {\n const tokenizer = new Tokenizer(this.expression);\n this.tokens = tokenizer.tokenize();\n this.current = 0;\n\n if (this.isAtEnd()) {\n throw new ExpressionParserError('[Dynamic Forms] Empty expression', 0, this.expression);\n }\n\n return this.parseExpression();\n }\n\n private parseExpression(): ASTNode {\n return this.parseLogicalOr();\n }\n\n private parseLogicalOr(): ASTNode {\n let node = this.parseLogicalAnd();\n\n while (this.match(TokenType.OR)) {\n const operator = this.previous().value;\n const right = this.parseLogicalAnd();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseLogicalAnd(): ASTNode {\n let node = this.parseEquality();\n\n while (this.match(TokenType.AND)) {\n const operator = this.previous().value;\n const right = this.parseEquality();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseEquality(): ASTNode {\n let node = this.parseComparison();\n\n while (this.match(TokenType.EQUAL, TokenType.NOT_EQUAL)) {\n const operator = this.previous().value;\n const right = this.parseComparison();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseComparison(): ASTNode {\n let node = this.parseAddition();\n\n while (this.match(TokenType.GREATER, TokenType.GREATER_EQUAL, TokenType.LESS, TokenType.LESS_EQUAL)) {\n const operator = this.previous().value;\n const right = this.parseAddition();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseAddition(): ASTNode {\n let node = this.parseMultiplication();\n\n while (this.match(TokenType.PLUS, TokenType.MINUS)) {\n const operator = this.previous().value;\n const right = this.parseMultiplication();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseMultiplication(): ASTNode {\n let node = this.parseUnary();\n\n while (this.match(TokenType.MULTIPLY, TokenType.DIVIDE, TokenType.MODULO)) {\n const operator = this.previous().value;\n const right = this.parseUnary();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseUnary(): ASTNode {\n if (this.match(TokenType.NOT, TokenType.MINUS, TokenType.PLUS, TokenType.TYPEOF)) {\n const operator = this.previous().value;\n const operand = this.parseUnary();\n return { type: 'UnaryOp', operator, operand };\n }\n\n return this.parsePostfix();\n }\n\n private parsePostfix(): ASTNode {\n let node = this.parsePrimary();\n\n while (true) {\n if (this.match(TokenType.DOT)) {\n // Member access: obj.property\n if (!this.check(TokenType.IDENTIFIER)) {\n throw new ExpressionParserError('[Dynamic Forms] Expected property name after \".\"', this.peek().position, this.expression);\n }\n const property = this.advance().value;\n node = { type: 'MemberAccess', object: node, property };\n } else if (this.match(TokenType.LPAREN)) {\n // Function call: func()\n const args = this.parseArgumentList();\n this.consume(TokenType.RPAREN, 'Expected \")\" after arguments');\n node = { type: 'CallExpression', callee: node, arguments: args };\n } else {\n break;\n }\n }\n\n return node;\n }\n\n private parsePrimary(): ASTNode {\n // Literals\n if (this.match(TokenType.TRUE)) {\n return { type: 'Literal', value: true };\n }\n\n if (this.match(TokenType.FALSE)) {\n return { type: 'Literal', value: false };\n }\n\n if (this.match(TokenType.NULL)) {\n return { type: 'Literal', value: null };\n }\n\n if (this.match(TokenType.UNDEFINED)) {\n return { type: 'Literal', value: undefined };\n }\n\n if (this.match(TokenType.NUMBER)) {\n return { type: 'Literal', value: parseFloat(this.previous().value) };\n }\n\n if (this.match(TokenType.STRING)) {\n return { type: 'Literal', value: this.previous().value };\n }\n\n // Array literal\n if (this.match(TokenType.LBRACKET)) {\n const elements = this.parseArrayElements();\n this.consume(TokenType.RBRACKET, 'Expected \"]\" after array elements');\n return { type: 'ArrayLiteral', elements };\n }\n\n // Identifier\n if (this.match(TokenType.IDENTIFIER)) {\n return { type: 'Identifier', name: this.previous().value };\n }\n\n // Grouped expression\n if (this.match(TokenType.LPAREN)) {\n const expr = this.parseExpression();\n this.consume(TokenType.RPAREN, 'Expected \")\" after expression');\n return expr;\n }\n\n throw new ExpressionParserError(`[Dynamic Forms] Unexpected token: ${this.peek().value}`, this.peek().position, this.expression);\n }\n\n private parseArgumentList(): ASTNode[] {\n const args: ASTNode[] = [];\n\n if (!this.check(TokenType.RPAREN)) {\n do {\n args.push(this.parseExpression());\n } while (this.match(TokenType.COMMA));\n }\n\n return args;\n }\n\n private parseArrayElements(): ASTNode[] {\n const elements: ASTNode[] = [];\n\n if (!this.check(TokenType.RBRACKET)) {\n do {\n elements.push(this.parseExpression());\n } while (this.match(TokenType.COMMA));\n }\n\n return elements;\n }\n\n private match(...types: TokenType[]): boolean {\n for (const type of types) {\n if (this.check(type)) {\n this.advance();\n return true;\n }\n }\n return false;\n }\n\n private check(type: TokenType): boolean {\n if (this.isAtEnd()) return false;\n return this.peek().type === type;\n }\n\n private advance(): Token {\n if (!this.isAtEnd()) this.current++;\n return this.previous();\n }\n\n private isAtEnd(): boolean {\n return this.peek().type === TokenType.EOF;\n }\n\n private peek(): Token {\n return this.tokens[this.current];\n }\n\n private previous(): Token {\n return this.tokens[this.current - 1];\n }\n\n private consume(type: TokenType, message: string): Token {\n if (this.check(type)) return this.advance();\n\n throw new ExpressionParserError(`[Dynamic Forms] ${message}`, this.peek().position, this.expression);\n }\n}\n","import { ASTNode, ExpressionParserError } from './types';\n\n/**\n * Evaluation context for safe expression evaluation\n */\nexport interface EvaluationScope {\n [key: string]: unknown;\n}\n\n/**\n * Security Model: Whitelist-only approach for method calls\n *\n * A method is considered SAFE if it meets ALL criteria:\n * 1. Pure data access/transformation (no side effects)\n * 2. No code execution capabilities\n * 3. No global state modification\n * 4. No prototype chain modification\n * 5. No information disclosure about system internals\n *\n * Methods NOT included (unsafe):\n * - constructor: Could enable code execution via Function constructor\n * - valueOf: Could enable type confusion attacks\n * - __proto__, __defineGetter__, etc: Direct prototype manipulation\n * - hasOwnProperty, isPrototypeOf, propertyIsEnumerable: Leak object structure\n * - toLocaleString: Could expose locale/system information\n */\n\n/**\n * Type-safe method whitelists derived from TypeScript primitive types\n * Only methods explicitly listed here are allowed - this is a whitelist-only approach\n */\nconst STRING_SAFE_METHODS: ReadonlyArray<keyof string> = [\n 'charAt',\n 'charCodeAt',\n 'concat',\n 'endsWith',\n 'includes',\n 'indexOf',\n 'lastIndexOf',\n 'match',\n 'padEnd',\n 'padStart',\n 'repeat',\n 'replace',\n 'search',\n 'slice',\n 'split',\n 'startsWith',\n 'substring',\n 'toLowerCase',\n 'toUpperCase',\n 'trim',\n 'trimEnd',\n 'trimStart',\n 'toString',\n] as const;\n\nconst NUMBER_SAFE_METHODS: ReadonlyArray<keyof number> = ['toExponential', 'toFixed', 'toPrecision', 'toString'] as const;\n\nconst ARRAY_SAFE_METHODS: ReadonlyArray<keyof Array<unknown>> = [\n 'concat',\n 'every',\n 'filter',\n 'find',\n 'findIndex',\n 'flat',\n 'flatMap',\n 'includes',\n 'indexOf',\n 'join',\n 'lastIndexOf',\n 'map',\n 'reduce',\n 'reduceRight',\n 'slice',\n 'some',\n 'toString',\n 'entries',\n 'keys',\n 'values',\n] as const;\n\nconst DATE_SAFE_METHODS: ReadonlyArray<keyof Date> = [\n 'getDate',\n 'getDay',\n 'getFullYear',\n 'getHours',\n 'getMilliseconds',\n 'getMinutes',\n 'getMonth',\n 'getSeconds',\n 'getTime',\n 'getTimezoneOffset',\n 'getUTCDate',\n 'getUTCDay',\n 'getUTCFullYear',\n 'getUTCHours',\n 'getUTCMilliseconds',\n 'getUTCMinutes',\n 'getUTCMonth',\n 'getUTCSeconds',\n 'toDateString',\n 'toISOString',\n 'toJSON',\n 'toString',\n 'toTimeString',\n 'toUTCString',\n] as const;\n\n/**\n * Whitelist of safe methods that can be called on values\n * Using Set for O(1) lookup performance\n */\nconst SAFE_METHODS: Record<string, ReadonlySet<string>> = {\n string: new Set(STRING_SAFE_METHODS as readonly string[]),\n number: new Set(NUMBER_SAFE_METHODS as readonly string[]),\n array: new Set(ARRAY_SAFE_METHODS as readonly string[]),\n date: new Set(DATE_SAFE_METHODS as readonly string[]),\n};\n\n/**\n * Blacklist of property names that should not be accessible\n * These properties can leak information about object structure or enable attacks\n */\nconst BLOCKED_PROPERTIES = new Set<string>([\n 'constructor',\n '__proto__',\n 'prototype',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__',\n]);\n\n/**\n * Safely evaluates an AST node with a given context\n */\nexport class Evaluator {\n private readonly scope: EvaluationScope;\n private readonly expression: string;\n\n constructor(scope: EvaluationScope, expression: string) {\n this.scope = scope;\n this.expression = expression;\n }\n\n /**\n * Evaluate an AST node\n */\n evaluate(node: ASTNode): unknown {\n switch (node.type) {\n case 'Literal':\n return node.value;\n\n case 'Identifier':\n return this.evaluateIdentifier(node.name);\n\n case 'MemberAccess':\n return this.evaluateMemberAccess(node);\n\n case 'BinaryOp':\n return this.evaluateBinaryOp(node);\n\n case 'UnaryOp':\n return this.evaluateUnaryOp(node);\n\n case 'CallExpression':\n return this.evaluateCallExpression(node);\n\n case 'ArrayLiteral':\n return this.evaluateArrayLiteral(node);\n\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unknown node type: ${(node as { type: string }).type}`, 0, this.expression);\n }\n }\n\n private evaluateIdentifier(name: string): unknown {\n if (!(name in this.scope)) {\n return undefined;\n }\n return this.scope[name];\n }\n\n private evaluateMemberAccess(node: { object: ASTNode; property: string }): unknown {\n const obj = this.evaluate(node.object);\n\n if (obj === null || obj === undefined) {\n return undefined;\n }\n\n // Block access to dangerous properties that could leak information or enable attacks\n if (BLOCKED_PROPERTIES.has(node.property)) {\n throw new ExpressionParserError(\n `[Dynamic Forms] Property \"${node.property}\" is not accessible for security reasons`,\n 0,\n this.expression,\n );\n }\n\n // Allow property access on plain objects and primitives\n if (typeof obj === 'object' || typeof obj === 'string' || typeof obj === 'number') {\n return (obj as Record<string, unknown>)[node.property];\n }\n\n return undefined;\n }\n\n private evaluateBinaryOp(node: { operator: string; left: ASTNode; right: ASTNode }): unknown {\n const left = this.evaluate(node.left);\n const right = this.evaluate(node.right);\n\n switch (node.operator) {\n // Arithmetic\n case '+':\n return (left as number) + (right as number);\n case '-':\n return (left as number) - (right as number);\n case '*':\n return (left as number) * (right as number);\n case '/':\n return (left as number) / (right as number);\n case '%':\n return (left as number) % (right as number);\n\n // Comparison - using == and != intentionally for loose equality\n case '==':\n return left == right;\n case '===':\n return left === right;\n case '!=':\n return left != right;\n case '!==':\n return left !== right;\n case '>':\n return (left as number) > (right as number);\n case '<':\n return (left as number) < (right as number);\n case '>=':\n return (left as number) >= (right as number);\n case '<=':\n return (left as number) <= (right as number);\n\n // Logical\n case '&&':\n return left && right;\n case '||':\n return left || right;\n\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unknown binary operator: ${node.operator}`, 0, this.expression);\n }\n }\n\n private evaluateUnaryOp(node: { operator: string; operand: ASTNode }): unknown {\n const operand = this.evaluate(node.operand);\n\n switch (node.operator) {\n case '!':\n return !operand;\n case '-':\n return -(operand as number);\n case '+':\n return +(operand as number);\n case 'typeof':\n return typeof operand;\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unknown unary operator: ${node.operator}`, 0, this.expression);\n }\n }\n\n private evaluateCallExpression(node: { callee: ASTNode; arguments: ASTNode[] }): unknown {\n // Only allow method calls (member access), not arbitrary function calls\n if (node.callee.type !== 'MemberAccess') {\n throw new ExpressionParserError('[Dynamic Forms] Only method calls are allowed, not arbitrary function calls', 0, this.expression);\n }\n\n const obj = this.evaluate(node.callee.object);\n const methodName = node.callee.property;\n\n // Block access to dangerous properties (must check before method call)\n if (BLOCKED_PROPERTIES.has(methodName)) {\n throw new ExpressionParserError(\n `[Dynamic Forms] Property \"${methodName}\" is not accessible for security reasons`,\n 0,\n this.expression,\n );\n }\n\n // Check if the method is in the whitelist\n if (!this.isMethodSafe(obj, methodName)) {\n throw new ExpressionParserError(`[Dynamic Forms] Method \"${methodName}\" is not allowed for security reasons`, 0, this.expression);\n }\n\n // Evaluate arguments\n const args = node.arguments.map((arg) => this.evaluate(arg));\n\n // Call the method with proper `this` binding\n const method = (obj as Record<string, unknown>)[methodName];\n if (typeof method === 'function') {\n // Use .call() to properly bind `this` context\n return (method as (...args: unknown[]) => unknown).call(obj, ...args);\n }\n\n return undefined;\n }\n\n private evaluateArrayLiteral(node: { elements: ASTNode[] }): unknown {\n return node.elements.map((element) => this.evaluate(element));\n }\n\n private isMethodSafe(obj: unknown, methodName: string): boolean {\n if (obj === null || obj === undefined) {\n return false;\n }\n\n const type = Array.isArray(obj) ? 'array' : obj instanceof Date ? 'date' : typeof obj;\n\n const safeMethods = SAFE_METHODS[type];\n if (!safeMethods) {\n return false;\n }\n\n return safeMethods.has(methodName);\n }\n}\n","import { Parser } from './parser';\nimport { Evaluator, EvaluationScope } from './evaluator';\nimport { ASTNode, ExpressionParserError } from './types';\n\n/**\n * Maximum cache size to prevent memory issues\n */\nconst MAX_AST_CACHE_SIZE = 1000;\n\n/**\n * LRU Cache implementation for AST nodes\n * Tracks access order to evict least-recently-used entries\n */\nclass LRUCache<K, V> {\n private cache = new Map<K, V>();\n private maxSize: number;\n\n constructor(maxSize: number) {\n this.maxSize = maxSize;\n }\n\n get(key: K): V | undefined {\n const value = this.cache.get(key);\n if (value !== undefined) {\n // Move to end (most recently used)\n this.cache.delete(key);\n this.cache.set(key, value);\n }\n return value;\n }\n\n set(key: K, value: V): void {\n // Delete if exists to update position\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n\n // Add to end (most recently used)\n this.cache.set(key, value);\n\n // Evict least recently used if over limit\n if (this.cache.size > this.maxSize) {\n const firstKey = this.cache.keys().next().value;\n if (firstKey !== undefined) {\n this.cache.delete(firstKey);\n }\n }\n }\n\n clear(): void {\n this.cache.clear();\n }\n\n get size(): number {\n return this.cache.size;\n }\n}\n\n/**\n * Cache for parsed AST nodes to improve performance\n */\nconst astCache = new LRUCache<string, ASTNode>(MAX_AST_CACHE_SIZE);\n\n/**\n * Secure expression parser that uses AST-based evaluation instead of eval() or new Function()\n *\n * This parser provides:\n * - Security: No arbitrary code execution, only whitelisted operations\n * - Performance: AST caching for repeated expressions\n * - Better errors: Clear error messages with position information\n * - Type safety: Strongly typed AST and evaluation\n */\nexport class ExpressionParser {\n /**\n * Parse an expression string into an AST\n * Results are cached for performance using LRU eviction\n */\n static parse(expression: string): ASTNode {\n // Check cache first\n const cached = astCache.get(expression);\n if (cached) {\n return cached;\n }\n\n // Parse the expression\n const parser = new Parser(expression);\n const ast = parser.parse();\n\n // Cache the result (LRU cache handles eviction automatically)\n astCache.set(expression, ast);\n\n return ast;\n }\n\n /**\n * Evaluate an expression with a given scope\n */\n static evaluate(expression: string, scope: EvaluationScope): unknown {\n try {\n const ast = this.parse(expression);\n const evaluator = new Evaluator(scope, expression);\n return evaluator.evaluate(ast);\n } catch (error) {\n if (error instanceof ExpressionParserError) {\n throw error;\n }\n // Wrap other errors for consistency\n throw new ExpressionParserError(\n `[Dynamic Forms] Error evaluating expression: ${error instanceof Error ? error.message : String(error)}`,\n 0,\n expression,\n );\n }\n }\n\n /**\n * Clear the AST cache\n */\n static clearCache(): void {\n astCache.clear();\n }\n\n /**\n * Get cache statistics\n */\n static getCacheStats(): { size: number; maxSize: number } {\n return {\n size: astCache.size,\n maxSize: MAX_AST_CACHE_SIZE,\n };\n }\n}\n","import { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { compareValues, getNestedValue } from './value-utils';\nimport { ExpressionParser } from './parser/expression-parser';\n\n/**\n * Evaluate conditional expression\n * Uses secure AST-based parsing for JavaScript expressions\n */\nexport function evaluateCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n switch (expression.type) {\n case 'fieldValue':\n return evaluateFieldValueCondition(expression, context);\n\n case 'formValue':\n return evaluateFormValueCondition(expression, context);\n\n case 'javascript':\n return evaluateJavaScriptExpression(expression, context);\n\n case 'custom':\n return evaluateCustomFunction(expression, context);\n\n case 'and':\n return evaluateAndCondition(expression, context);\n\n case 'or':\n return evaluateOrCondition(expression, context);\n\n default:\n return false;\n }\n}\n\nfunction evaluateFieldValueCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.fieldPath || !expression.operator) return false;\n\n const fieldValue = getNestedValue(context.formValue, expression.fieldPath);\n return compareValues(fieldValue, expression.value, expression.operator);\n}\n\nfunction evaluateFormValueCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.operator) return false;\n return compareValues(context.formValue, expression.value, expression.operator);\n}\n\nfunction evaluateJavaScriptExpression(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.expression) return false;\n\n try {\n // Use secure AST-based expression parser instead of new Function()\n const result = ExpressionParser.evaluate(expression.expression, context);\n return !!result;\n } catch (error) {\n console.error('[Dynamic Forms] Error evaluating JavaScript expression:', expression.expression, error);\n return false;\n }\n}\n\nfunction evaluateCustomFunction(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.expression) return false;\n\n const customFn = context.customFunctions?.[expression.expression];\n if (!customFn) {\n console.error('[Dynamic Forms] Custom function not found:', expression.expression);\n return false;\n }\n\n try {\n return !!customFn(context);\n } catch (error) {\n console.error('[Dynamic Forms] Error executing custom function:', expression.expression, error);\n return false;\n }\n}\n\nfunction evaluateAndCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.conditions || expression.conditions.length === 0) return false;\n\n // All conditions must be true for AND logic\n return expression.conditions.every((condition) => evaluateCondition(condition, context));\n}\n\nfunction evaluateOrCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.conditions || expression.conditions.length === 0) return false;\n\n // At least one condition must be true for OR logic\n return expression.conditions.some((condition) => evaluateCondition(condition, context));\n}\n","import { inject } from '@angular/core';\nimport { FieldContext, LogicFn } from '@angular/forms/signals';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { FieldContextRegistryService } from '../registry/field-context-registry.service';\nimport { FunctionRegistryService } from '../registry/function-registry.service';\nimport { evaluateCondition } from './condition-evaluator';\n\n/**\n * Create a logic function from a conditional expression.\n *\n * This function is used for creating logic functions for hidden, readonly, disabled, and required.\n * It uses the REACTIVE evaluation context, which allows the logic function to create\n * reactive dependencies on form values. When dependent fields change, the logic function\n * will be automatically re-evaluated.\n *\n * NOTE: For validators, use createEvaluationContext directly (with untracked) to prevent\n * infinite reactive loops. Validators with cross-field dependencies should be hoisted\n * to form-level using validateTree.\n */\nexport function createLogicFunction<TValue>(expression: ConditionalExpression): LogicFn<TValue, boolean> {\n // Inject services during factory creation, not during execution\n const functionRegistry = inject(FunctionRegistryService);\n const fieldContextRegistry = inject(FieldContextRegistryService);\n\n return (ctx: FieldContext<TValue>) => {\n // Create REACTIVE evaluation context for logic functions\n // This allows logic to re-evaluate when dependent fields change\n const evaluationContext = fieldContextRegistry.createReactiveEvaluationContext(ctx, functionRegistry.getCustomFunctions());\n\n return evaluateCondition(expression, evaluationContext);\n };\n}\n","import { inject } from '@angular/core';\nimport { FieldContext, LogicFn } from '@angular/forms/signals';\nimport { FieldContextRegistryService } from '../registry/field-context-registry.service';\nimport { ExpressionParser } from '../expressions/parser/expression-parser';\n\n/**\n * Create a dynamic value function from an expression string\n * Uses secure AST-based parsing instead of eval() or new Function()\n */\nexport function createDynamicValueFunction<TValue, TReturn>(expression: string): LogicFn<TValue, TReturn> {\n return (ctx: FieldContext<TValue>) => {\n // Create evaluation context using the registry-based approach\n const fieldContextRegistry = inject(FieldContextRegistryService);\n const evaluationContext = fieldContextRegistry.createEvaluationContext(ctx);\n\n try {\n // Use secure AST-based expression parser\n return ExpressionParser.evaluate(expression, evaluationContext) as TReturn;\n } catch (error) {\n console.error('[Dynamic Forms] Error evaluating dynamic expression:', expression, error);\n return undefined as TReturn;\n }\n };\n}\n","import { ConditionalExpression } from '../expressions/conditional-expression';\n\n/**\n * Special form-state conditions for button disabled logic.\n *\n * These conditions evaluate form or page-level state rather than field values,\n * and are primarily used for controlling button disabled states.\n *\n * @example\n * ```typescript\n * // Disable submit button when form is invalid or submitting\n * {\n * key: 'submit',\n * type: 'submit',\n * label: 'Submit',\n * logic: [\n * { type: 'disabled', condition: 'formInvalid' },\n * { type: 'disabled', condition: 'formSubmitting' },\n * ]\n * }\n *\n * // Disable next button when current page is invalid\n * nextButton({\n * key: 'next',\n * label: 'Next',\n * logic: [\n * { type: 'disabled', condition: 'pageInvalid' },\n * ]\n * })\n * ```\n *\n * @public\n */\nexport type FormStateCondition =\n /** True when form.valid() === false */\n | 'formInvalid'\n /** True when form.submitting() === true */\n | 'formSubmitting'\n /** True when fields on the current page are invalid (for paged forms) */\n | 'pageInvalid';\n\n/**\n * Configuration for conditional field logic.\n *\n * Defines how field behavior changes based on conditions.\n * Supports hiding, disabling, making readonly, or requiring fields\n * based on form state or field values.\n *\n * @example\n * ```typescript\n * // Hide email field when contact method is not email\n * {\n * type: 'hidden',\n * condition: {\n * type: 'fieldValue',\n * fieldPath: 'contactMethod',\n * operator: 'notEquals',\n * value: 'email'\n * }\n * }\n *\n * // Disable button when form is submitting\n * {\n * type: 'disabled',\n * condition: 'formSubmitting'\n * }\n * ```\n *\n * @public\n */\nexport interface LogicConfig {\n /**\n * Logic type identifier.\n *\n * - `hidden`: Hide the field from view (still participates in form state)\n * - `readonly`: Make the field read-only\n * - `disabled`: Disable user interaction\n * - `required`: Make the field required\n */\n type: 'hidden' | 'readonly' | 'disabled' | 'required';\n\n /**\n * Condition that determines when this logic applies.\n *\n * Can be:\n * - `boolean`: Static value (always applies or never applies)\n * - `ConditionalExpression`: Expression evaluated against field/form values\n * - `FormStateCondition`: Special form/page state check (for buttons)\n *\n * @example\n * ```typescript\n * // Static condition\n * condition: true\n *\n * // Field value condition\n * condition: {\n * type: 'fieldValue',\n * fieldPath: 'status',\n * operator: 'equals',\n * value: 'locked'\n * }\n *\n * // Form state condition (for buttons)\n * condition: 'formSubmitting'\n * ```\n */\n condition: ConditionalExpression | boolean | FormStateCondition;\n}\n\n/**\n * Type guard to check if a condition is a FormStateCondition.\n *\n * @param condition - The condition to check\n * @returns true if the condition is a FormStateCondition\n *\n * @public\n */\nexport function isFormStateCondition(condition: LogicConfig['condition']): condition is FormStateCondition {\n return typeof condition === 'string' && ['formInvalid', 'formSubmitting', 'pageInvalid'].includes(condition);\n}\n","import { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { FormStateCondition, isFormStateCondition, LogicConfig } from '../../models/logic/logic-config';\nimport { CustomValidatorConfig, ValidatorConfig } from '../../models/validation/validator-config';\nimport { SchemaApplicationConfig } from '../../models/schemas/schema-definition';\nimport { CustomFunctionScope } from '../expressions/custom-function-types';\n\n/**\n * Regular expression to detect formValue property access in expressions.\n * Matches patterns like: formValue.fieldName, formValue['fieldName'], formValue[\"fieldName\"]\n */\nconst FORM_VALUE_ACCESS_PATTERN = /\\bformValue\\s*(?:\\.|\\[)/;\n\n/**\n * Regular expressions to extract field paths from formValue expressions.\n */\nconst FORM_VALUE_DOT_PATTERN = /\\bformValue\\.(\\w+)/g;\nconst FORM_VALUE_BRACKET_SINGLE_PATTERN = /\\bformValue\\s*\\[\\s*'(\\w+)'\\s*\\]/g;\nconst FORM_VALUE_BRACKET_DOUBLE_PATTERN = /\\bformValue\\s*\\[\\s*\"(\\w+)\"\\s*\\]/g;\n\n/**\n * Context for cross-field detection, providing access to function scope information.\n */\nexport interface CrossFieldDetectionContext {\n /**\n * Lookup function to get the scope of a registered custom function.\n *\n * @param functionName The name of the custom function\n * @returns The function's scope, or undefined if not registered\n */\n getFunctionScope?: (functionName: string) => CustomFunctionScope | undefined;\n}\n\n/**\n * Detects if a ConditionalExpression references other fields (cross-field).\n *\n * This is the core detection function that handles ALL expression types:\n * - `fieldValue` with `fieldPath` → Always cross-field\n * - `formValue` → Always cross-field\n * - `javascript` with `formValue.*` in expression → Cross-field\n * - `custom` → Checks registered function scope, defaults to cross-field if unknown\n * - `and`/`or` → Recursively check nested conditions\n *\n * @param expr The conditional expression to analyze\n * @param context Optional context providing function scope lookup\n * @returns true if the expression references other fields\n */\nexport function isCrossFieldExpression(\n expr: ConditionalExpression | boolean | FormStateCondition | undefined,\n context?: CrossFieldDetectionContext,\n): boolean {\n // Boolean, undefined, or FormStateCondition (form-level state checks) are not cross-field\n if (expr === undefined || typeof expr === 'boolean' || isFormStateCondition(expr)) {\n return false;\n }\n\n switch (expr.type) {\n case 'fieldValue':\n // fieldPath means it references another field's value\n return !!expr.fieldPath;\n\n case 'formValue':\n // formValue type always accesses the form state\n return true;\n\n case 'javascript':\n // Check for formValue.* patterns in the expression string\n return FORM_VALUE_ACCESS_PATTERN.test(expr.expression || '');\n\n case 'custom': {\n // For custom functions, determine scope from registry or default to cross-field.\n // The expression.expression property holds the function name.\n //\n // Look up function scope from registry if context is provided\n const functionName = expr.expression;\n if (context?.getFunctionScope && functionName) {\n const scope = context.getFunctionScope(functionName);\n if (scope === 'field') {\n // Function is explicitly marked as field-scoped (no cross-field deps)\n return false;\n }\n // 'form' scope or undefined → treat as cross-field\n }\n\n // Default: conservative approach - assume cross-field\n return true;\n }\n\n case 'and':\n case 'or':\n // Recursively check nested conditions, passing context through\n return (expr.conditions || []).some((c) => isCrossFieldExpression(c, context));\n\n default:\n return false;\n }\n}\n\n/**\n * Extracts field dependencies from a ConditionalExpression.\n *\n * Returns an array of field keys that the expression depends on.\n * For `formValue` type without specific field, returns ['*'] to indicate\n * dependency on the entire form.\n *\n * @param expr The conditional expression to analyze\n * @returns Array of field keys that this expression depends on\n */\nexport function extractExpressionDependencies(expr: ConditionalExpression | boolean | undefined): string[] {\n if (expr === undefined || typeof expr === 'boolean') {\n return [];\n }\n\n const deps = new Set<string>();\n\n switch (expr.type) {\n case 'fieldValue':\n if (expr.fieldPath) {\n // Extract root field name (before any dots for nested paths)\n deps.add(expr.fieldPath.split('.')[0]);\n }\n break;\n\n case 'formValue':\n // Full form access - depends on everything\n deps.add('*');\n break;\n\n case 'javascript':\n // Extract from formValue.* patterns in expression\n extractFromExpressionString(expr.expression || '', deps);\n break;\n\n case 'custom':\n // Custom functions have full form access - conservative approach\n deps.add('*');\n break;\n\n case 'and':\n case 'or':\n // Recursively extract from nested conditions\n for (const condition of expr.conditions || []) {\n extractExpressionDependencies(condition).forEach((d) => deps.add(d));\n }\n break;\n }\n\n return Array.from(deps);\n}\n\n/**\n * Extracts field names from a JavaScript expression string.\n * Handles both dot notation (formValue.field) and bracket notation (formValue['field']).\n */\nexport function extractStringDependencies(expression: string): string[] {\n const deps = new Set<string>();\n extractFromExpressionString(expression, deps);\n return Array.from(deps);\n}\n\n/** Internal helper that populates a Set with dependencies from an expression string. */\nfunction extractFromExpressionString(expression: string, deps: Set<string>): void {\n // Extract from dot notation: formValue.fieldName\n const dotMatches = expression.matchAll(FORM_VALUE_DOT_PATTERN);\n for (const match of dotMatches) {\n deps.add(match[1]);\n }\n\n // Extract from bracket notation with single quotes: formValue['fieldName']\n const bracketSingleMatches = expression.matchAll(FORM_VALUE_BRACKET_SINGLE_PATTERN);\n for (const match of bracketSingleMatches) {\n deps.add(match[1]);\n }\n\n // Extract from bracket notation with double quotes: formValue[\"fieldName\"]\n const bracketDoubleMatches = expression.matchAll(FORM_VALUE_BRACKET_DOUBLE_PATTERN);\n for (const match of bracketDoubleMatches) {\n deps.add(match[1]);\n }\n}\n\n// ============================================================================\n// Validator Detection\n// ============================================================================\n\n/**\n * Detects if a custom validator configuration references formValue (cross-field validation).\n *\n * @param config The custom validator configuration to check\n * @returns true if the validator references formValue\n */\nexport function isCrossFieldValidator(config: CustomValidatorConfig): boolean {\n if (!config.expression) {\n return false;\n }\n return FORM_VALUE_ACCESS_PATTERN.test(config.expression);\n}\n\n/**\n * Detects if a built-in validator has a dynamic expression that references formValue.\n *\n * Built-in validators (min, max, pattern, etc.) can have dynamic expressions\n * like `{ type: 'min', expression: 'formValue.minAge' }`.\n *\n * @param config The validator configuration to check\n * @returns true if the validator has a cross-field dynamic expression\n */\nexport function isCrossFieldBuiltInValidator(config: ValidatorConfig): boolean {\n if (config.type === 'custom') {\n return false; // Custom validators handled separately\n }\n\n // Check if expression property references formValue\n if ('expression' in config && typeof config.expression === 'string') {\n return FORM_VALUE_ACCESS_PATTERN.test(config.expression);\n }\n\n return false;\n}\n\n/**\n * Detects if a validator's `when` condition is cross-field.\n *\n * @param config The validator configuration to check\n * @param context Optional context providing function scope lookup\n * @returns true if the when condition references other fields\n */\nexport function hasCrossFieldWhenCondition(config: ValidatorConfig, context?: CrossFieldDetectionContext): boolean {\n if (!('when' in config) || !config.when) {\n return false;\n }\n return isCrossFieldExpression(config.when as ConditionalExpression, context);\n}\n\n// ============================================================================\n// Logic Detection\n// ============================================================================\n\n/**\n * Detects if a LogicConfig has a cross-field condition.\n *\n * @param config The logic configuration to check\n * @param context Optional context providing function scope lookup\n * @returns true if the logic condition references other fields\n */\nexport function isCrossFieldLogic(config: LogicConfig, context?: CrossFieldDetectionContext): boolean {\n return isCrossFieldExpression(config.condition, context);\n}\n\n// ============================================================================\n// Schema Detection\n// ============================================================================\n\n/**\n * Detects if a SchemaApplicationConfig has a cross-field condition.\n *\n * @param config The schema application configuration to check\n * @param context Optional context providing function scope lookup\n * @returns true if the schema condition references other fields\n */\nexport function isCrossFieldSchema(config: SchemaApplicationConfig, context?: CrossFieldDetectionContext): boolean {\n if (config.type !== 'applyWhen' || !config.condition) {\n return false;\n }\n return isCrossFieldExpression(config.condition, context);\n}\n","import type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport {\n email,\n FieldContext,\n LogicFn,\n max,\n maxLength,\n min,\n minLength,\n PathKind,\n pattern,\n required,\n SchemaPathRules,\n validate,\n validateAsync,\n validateHttp,\n ValidationError,\n} from '@angular/forms/signals';\nimport { inject } from '@angular/core';\nimport {\n AsyncValidatorConfig,\n BuiltInValidatorConfig,\n CustomValidatorConfig,\n HttpValidatorConfig,\n ValidatorConfig,\n} from '../../models/validation/validator-config';\nimport { createLogicFunction } from '../expressions/logic-function-factory';\nimport { createDynamicValueFunction } from '../values/dynamic-value-factory';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { FunctionRegistryService } from '../registry/function-registry.service';\nimport { FieldContextRegistryService } from '../registry/field-context-registry.service';\nimport { ExpressionParser } from '../expressions/parser/expression-parser';\nimport { isCrossFieldValidator, isCrossFieldBuiltInValidator, hasCrossFieldWhenCondition } from '../cross-field/cross-field-detector';\n\n/**\n * Helper to create conditional logic function from when expression.\n * Returns undefined if no when condition is specified.\n * Reduces duplication across validator types.\n */\nfunction createConditionalLogic<TValue>(when: ConditionalExpression | undefined): LogicFn<TValue, boolean> | undefined {\n return when ? (createLogicFunction(when) as LogicFn<TValue, boolean>) : undefined;\n}\n\n/**\n * Safely cast a SchemaPathTree to SchemaPath with Supported rules.\n *\n * This is safe when TValue is not an AbstractControl, because:\n * - SchemaPathTree<T> for non-AbstractControl is: SchemaPath<T, Supported> & {...nested}\n * - The intersection type is structurally compatible with SchemaPath<T, Supported>\n * - We only work with signal forms, never reactive forms (AbstractControl)\n *\n * TypeScript can't automatically narrow this because SchemaPathTree is defined as a\n * conditional type, but at runtime the value is always the correct type for our use case.\n */\nfunction toSupportedPath<TValue, TPathKind extends PathKind = PathKind.Root>(\n path: SchemaPath<TValue, any, TPathKind> | SchemaPathTree<TValue, TPathKind>,\n): SchemaPath<TValue, SchemaPathRules.Supported, TPathKind> {\n // The cast is safe because SchemaPathTree extends SchemaPath, and we constrain TValue\n // to exclude AbstractControl in our public APIs (we never pass reactive form controls)\n return path as SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>;\n}\n\n/**\n * Apply validator configuration to field path, following the logic pattern.\n *\n * Accepts both SchemaPath and SchemaPathTree to support being called from both\n * individual field mappings and schema functions.\n *\n * Note: ValidatorConfig is runtime configuration that doesn't encode the field's\n * TypeScript type. The type assertions to specific types (string, number) are safe\n * because Angular's validators perform runtime value checks regardless of the static\n * type parameter.\n *\n * Cross-field validators (those referencing formValue.*) are skipped at field level.\n * They are collected by the parent form component using collectCrossFieldEntries\n * and executed at form level using validateTree.\n *\n * @param config The validator configuration\n * @param fieldPath The field path to apply the validator to\n * @param fieldKey Optional field key (used for logging)\n */\nexport function applyValidator(config: ValidatorConfig, fieldPath: SchemaPath<any> | SchemaPathTree<any>, fieldKey?: string): void {\n const path = toSupportedPath(fieldPath);\n\n // Check if this is a built-in validator with a cross-field expression\n // These are collected at form level - skip here\n if (isCrossFieldBuiltInValidator(config)) {\n // Cross-field validators are handled at form level via validateTree\n return;\n }\n\n // Check if the validator has a cross-field `when` condition\n // These are collected at form level - skip here\n if (hasCrossFieldWhenCondition(config)) {\n // Cross-field validators are handled at form level via validateTree\n return;\n }\n\n switch (config.type) {\n case 'required':\n if (config.when) {\n const whenLogic = createLogicFunction(config.when);\n required(path, { when: whenLogic });\n } else {\n required(path);\n }\n break;\n\n case 'email':\n email(fieldPath as SchemaPath<string>);\n break;\n\n case 'min':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMin = createDynamicValueFunction<string | number | null, number | undefined>(config.expression);\n min(fieldPath as SchemaPath<number>, dynamicMin);\n } else {\n min(fieldPath as SchemaPath<number>, config.value);\n }\n }\n break;\n\n case 'max':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMax = createDynamicValueFunction<string | number | null, number | undefined>(config.expression);\n max(fieldPath as SchemaPath<number>, dynamicMax);\n } else {\n max(fieldPath as SchemaPath<number>, config.value);\n }\n }\n break;\n\n case 'minLength':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMinLength = createDynamicValueFunction<string, number>(config.expression);\n minLength(fieldPath as SchemaPath<string>, dynamicMinLength);\n } else {\n minLength(fieldPath as SchemaPath<string>, config.value);\n }\n }\n break;\n\n case 'maxLength':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMaxLength = createDynamicValueFunction<string, number>(config.expression);\n // MaxLength validator expects SchemaPath<string>\n maxLength(fieldPath as SchemaPath<string, SchemaPathRules.Supported>, dynamicMaxLength);\n } else {\n maxLength(fieldPath as SchemaPath<string, SchemaPathRules.Supported>, config.value);\n }\n }\n break;\n\n case 'pattern':\n if (config.value instanceof RegExp || typeof config.value === 'string') {\n const regexPattern = typeof config.value === 'string' ? new RegExp(config.value) : config.value;\n if (config.expression) {\n const dynamicPattern = createDynamicValueFunction<string | undefined, RegExp | undefined>(config.expression);\n // Pattern validator expects SchemaPath<string>\n pattern(\n fieldPath as SchemaPath<string, SchemaPathRules.Supported>,\n dynamicPattern as LogicFn<string | undefined, RegExp | undefined>,\n );\n } else {\n pattern(fieldPath as SchemaPath<string, SchemaPathRules.Supported>, regexPattern);\n }\n }\n break;\n\n case 'custom':\n applyCustomValidator(config, path, fieldKey);\n break;\n\n case 'customAsync':\n applyAsyncValidator(config, path);\n break;\n\n case 'customHttp':\n applyHttpValidator(config, path);\n break;\n }\n}\n\n/**\n * Apply custom validator to field path using Angular's public validate() API\n * Supports both function-based and expression-based validators.\n *\n * Cross-field validators (those referencing formValue.*) are skipped at field level.\n * They are collected at form level and executed via validateTree.\n *\n * @param config The custom validator configuration\n * @param fieldPath The field path to apply validation to\n * @param fieldKey Optional field key (used for logging)\n */\nfunction applyCustomValidator(config: CustomValidatorConfig, fieldPath: SchemaPath<any>, fieldKey?: string): void {\n // Check if this is a cross-field validator - skip at field level\n if (isCrossFieldValidator(config)) {\n // Cross-field validators are handled at form level via validateTree\n return;\n }\n\n // Non-cross-field validators: apply at field level as before\n let validatorFn: (ctx: FieldContext<any>) => ValidationError | ValidationError[] | null;\n\n if (config.expression) {\n // Expression-based validator\n validatorFn = createExpressionValidator<any>(config);\n } else if (config.functionName) {\n // Function-based validator\n validatorFn = createFunctionValidator<any>(config);\n } else {\n console.warn('[Dynamic Forms] Custom validator must have either \"expression\" or \"functionName\"');\n return;\n }\n\n // Apply with conditional logic if specified\n const whenLogic = createConditionalLogic<any>(config.when);\n if (whenLogic) {\n const conditionalValidator = (ctx: FieldContext<any>) => {\n if (!whenLogic(ctx)) {\n return null; // Condition not met, skip validation\n }\n return validatorFn(ctx);\n };\n validate(fieldPath, conditionalValidator);\n } else {\n validate(fieldPath, validatorFn);\n }\n}\n\n/**\n * Create a function-based validator using registered validator functions\n */\nfunction createFunctionValidator<TValue>(\n config: CustomValidatorConfig,\n): (ctx: FieldContext<TValue>) => ValidationError | ValidationError[] | null {\n const registry = inject(FunctionRegistryService);\n const validatorFn = registry.getValidator(config.functionName!);\n\n if (!validatorFn) {\n console.warn(\n `[Dynamic Forms] Custom validator \"${config.functionName}\" not found in registry. ` +\n `Ensure it's registered using customFnConfig.validators or check the function name for typos.`,\n );\n return () => null;\n }\n\n return (ctx: FieldContext<TValue>): ValidationError | ValidationError[] | null => {\n return validatorFn(ctx, config.params);\n };\n}\n\n/**\n * Create an expression-based validator using secure AST evaluation\n */\nfunction createExpressionValidator<TValue>(\n config: CustomValidatorConfig,\n): (ctx: FieldContext<TValue>) => ValidationError | ValidationError[] | null {\n const fieldContextRegistry = inject(FieldContextRegistryService);\n const functionRegistry = inject(FunctionRegistryService);\n\n return (ctx: FieldContext<TValue>): ValidationError | ValidationError[] | null => {\n try {\n // Create evaluation context from FieldContext\n const evaluationContext = fieldContextRegistry.createEvaluationContext(ctx, functionRegistry.getCustomFunctions());\n\n // Evaluate expression securely using AST parser\n const result = ExpressionParser.evaluate(config.expression!, evaluationContext);\n\n // If expression returns truthy, validation passes (no error)\n // If expression returns falsy, validation fails\n if (result) {\n return null; // Validation passes\n }\n\n // Validation failed - return error with kind\n const kind = config.kind || 'custom';\n const validationError: ValidationError = { kind };\n\n // Evaluate and include errorParams for message interpolation\n if (config.errorParams) {\n Object.entries(config.errorParams).forEach(([key, expression]) => {\n try {\n (validationError as unknown as Record<string, unknown>)[key] = ExpressionParser.evaluate(expression, evaluationContext);\n } catch (err) {\n console.warn(`[Dynamic Forms] Error evaluating errorParam \"${key}\":`, expression, err);\n }\n });\n }\n\n return validationError;\n } catch (error) {\n // Gracefully degrade on errors (e.g., typos in field names, undefined functions)\n // Log to console for debugging while keeping form functional\n console.error('[Dynamic Forms] Error evaluating custom validator expression:', config.expression, error);\n return { kind: config.kind || 'custom' };\n }\n };\n}\n\n/**\n * Apply async validator to field path using Angular's public validateAsync() API\n *\n * Angular's validateAsync uses the resource API, which requires:\n * - params: Function that computes params from field context\n * - factory: Function that creates ResourceRef from params signal\n * - onSuccess: Maps resource result to validation errors\n * - onError: Optional handler for resource errors\n */\nfunction applyAsyncValidator(config: AsyncValidatorConfig, fieldPath: SchemaPath<any, SchemaPathRules.Supported>): void {\n const registry = inject(FunctionRegistryService);\n\n // Get async validator config from registry\n const validatorConfig = registry.getAsyncValidator(config.functionName);\n\n if (!validatorConfig) {\n console.warn(\n `[Dynamic Forms] Async validator \"${config.functionName}\" not found in registry. ` +\n `Ensure it's registered using customFnConfig.asyncValidators or check the function name for typos.`,\n );\n return;\n }\n\n // Build Angular's AsyncValidatorOptions\n const asyncOptions = {\n params: (ctx: FieldContext<any>) => {\n return validatorConfig.params(ctx, config.params);\n },\n factory: validatorConfig.factory,\n onSuccess: validatorConfig.onSuccess,\n onError: validatorConfig.onError,\n };\n\n // Apply with conditional logic if specified\n const whenLogic = createConditionalLogic<any>(config.when);\n if (whenLogic) {\n // For conditional async validators, we wrap the params function\n const conditionalOptions = {\n ...asyncOptions,\n params: (ctx: FieldContext<any>) => {\n if (!whenLogic(ctx)) {\n return undefined; // Skip validation when condition not met\n }\n return asyncOptions.params(ctx);\n },\n };\n // TypeScript needs help with the ResourceRef generic - the types are correct at runtime\n validateAsync(fieldPath, conditionalOptions as Parameters<typeof validateAsync>[1]);\n } else {\n validateAsync(fieldPath, asyncOptions as Parameters<typeof validateAsync>[1]);\n }\n}\n\n/**\n * Apply HTTP validator to field path using Angular's public validateHttp() API\n *\n * Angular's validateHttp requires:\n * - request: Function that returns URL string or HttpResourceRequest\n * - onSuccess: Maps HTTP response to validation errors (inverted logic!)\n * - onError: Optional handler for HTTP errors\n */\nfunction applyHttpValidator(config: HttpValidatorConfig, fieldPath: SchemaPath<any>): void {\n const registry = inject(FunctionRegistryService);\n\n // Get HTTP validator config from registry\n const httpValidatorConfig = registry.getHttpValidator(config.functionName);\n\n if (!httpValidatorConfig) {\n console.warn(\n `[Dynamic Forms] HTTP validator \"${config.functionName}\" not found in registry. ` +\n `Ensure it's registered using customFnConfig.httpValidators or check the function name for typos.`,\n );\n return;\n }\n\n // Build Angular's HttpValidatorOptions\n const httpOptions = {\n request: (ctx: FieldContext<any>) => {\n return httpValidatorConfig.request(ctx, config.params);\n },\n onSuccess: httpValidatorConfig.onSuccess,\n onError: httpValidatorConfig.onError,\n };\n\n // Apply with conditional logic if specified\n const whenLogic = createConditionalLogic<any>(config.when);\n if (whenLogic) {\n // For conditional HTTP validators, we wrap the request function\n const conditionalOptions = {\n ...httpOptions,\n request: (ctx: FieldContext<any>) => {\n if (!whenLogic(ctx)) {\n return undefined; // Skip validation when condition not met\n }\n return httpOptions.request(ctx);\n },\n };\n // TypeScript needs help with the HttpResourceRequest generic - the types are correct at runtime\n validateHttp(fieldPath, conditionalOptions as Parameters<typeof validateHttp>[1]);\n } else {\n validateHttp(fieldPath, httpOptions as Parameters<typeof validateHttp>[1]);\n }\n}\n\n/**\n * Apply multiple validators to a field path\n *\n * @param configs Array of validator configurations\n * @param fieldPath The field path to apply validators to\n * @param fieldKey Optional field key (used for logging)\n */\nexport function applyValidators(configs: ValidatorConfig[], fieldPath: SchemaPath<any> | SchemaPathTree<any>, fieldKey?: string): void {\n configs.forEach((config) => applyValidator(config, fieldPath, fieldKey));\n}\n","import { disabled, hidden, readonly, required, SchemaPathRules, PathKind, LogicFn } from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { LogicConfig } from '../../models/logic/logic-config';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { createLogicFunction } from '../expressions/logic-function-factory';\n\n/**\n * A logic function that can be used with Angular Signal Forms.\n * Accepts either a simple () => boolean or a LogicFn that takes FieldContext.\n */\ntype AnyLogicFn<TValue> = LogicFn<TValue, boolean> | (() => boolean);\n\n/**\n * Safely cast a SchemaPathTree to SchemaPath with Supported rules.\n * See validator-factory.ts for detailed explanation of why this is safe.\n */\nfunction toSupportedPath<TValue, TPathKind extends PathKind = PathKind.Root>(\n path: SchemaPath<TValue, any, TPathKind> | SchemaPathTree<TValue, TPathKind>,\n): SchemaPath<TValue, SchemaPathRules.Supported, TPathKind> {\n return path as SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>;\n}\n\n/**\n * Apply logic configuration to field path.\n * Accepts both SchemaPath and SchemaPathTree for flexibility.\n *\n * Cross-field logic (referencing formValue.*) is handled automatically by\n * createLogicFunction which uses RootFormRegistryService to access the\n * root form value. No special context or pre-computed signals needed.\n *\n * @param config The logic configuration\n * @param fieldPath The Angular Signal Forms path\n */\nexport function applyLogic<TValue>(config: LogicConfig, fieldPath: SchemaPath<TValue> | SchemaPathTree<TValue>): void {\n const path = toSupportedPath(fieldPath);\n\n // Handle static boolean conditions\n if (typeof config.condition === 'boolean') {\n const staticLogicFn = () => config.condition as boolean;\n applyLogicFn(config.type, path, staticLogicFn);\n return;\n }\n\n // Create logic function from condition expression\n // Cross-field references (formValue.*) are handled automatically via RootFormRegistryService\n const condition = config.condition as ConditionalExpression;\n const logicFn = createLogicFunction(condition);\n applyLogicFn(config.type, path, logicFn);\n}\n\n/**\n * Applies a logic function to a path for a specific logic type.\n */\nfunction applyLogicFn<TValue>(type: LogicConfig['type'], path: SchemaPath<TValue>, logicFn: AnyLogicFn<TValue>): void {\n switch (type) {\n case 'hidden':\n hidden(path, logicFn);\n break;\n\n case 'readonly':\n readonly(path, logicFn);\n break;\n\n case 'disabled':\n disabled(path, logicFn);\n break;\n\n case 'required':\n required(path, { when: logicFn });\n break;\n }\n}\n\n/**\n * Apply multiple logic configurations to a field path\n *\n * @param configs Array of logic configurations\n * @param fieldPath The Angular Signal Forms path\n */\nexport function applyMultipleLogic<TValue>(configs: LogicConfig[], fieldPath: SchemaPath<TValue> | SchemaPathTree<TValue>): void {\n configs.forEach((config) => applyLogic(config, fieldPath));\n}\n","import { Injectable } from '@angular/core';\nimport { SchemaDefinition } from '../../models/schemas/schema-definition';\n\n@Injectable()\nexport class SchemaRegistryService {\n private readonly registeredSchemas = new Map<string, SchemaDefinition>();\n\n /**\n * Register a reusable schema\n */\n registerSchema(schema: SchemaDefinition): void {\n this.registeredSchemas.set(schema.name, schema);\n }\n\n /**\n * Get registered schema by name\n */\n getSchema(name: string): SchemaDefinition | undefined {\n return this.registeredSchemas.get(name);\n }\n\n /**\n * Get all registered schemas\n */\n getAllSchemas(): Map<string, SchemaDefinition> {\n return new Map(this.registeredSchemas);\n }\n\n /**\n * Clear all registered schemas\n */\n clearSchemas(): void {\n this.registeredSchemas.clear();\n }\n\n /**\n * Resolve schema from string reference or direct definition\n */\n resolveSchema(schema: string | SchemaDefinition): SchemaDefinition | null {\n if (typeof schema === 'string') {\n return this.getSchema(schema) || null;\n }\n return schema;\n }\n}\n","/**\n * Create a type predicate function from a predicate string\n */\nexport function createTypePredicateFunction<T = unknown>(predicate: string): (value: unknown) => value is T {\n return (value: unknown): value is T => {\n try {\n const func = new Function('value', `return ${predicate};`);\n return func(value);\n } catch (error) {\n console.error('[Dynamic Forms] Error evaluating type predicate:', predicate, error);\n return false;\n }\n };\n}\n","import { inject } from '@angular/core';\nimport { apply, applyEach, applyWhen, applyWhenValue, SchemaOrSchemaFn } from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { SchemaApplicationConfig, SchemaDefinition } from '../models/schemas/schema-definition';\nimport { SchemaRegistryService } from './registry/schema-registry.service';\nimport { createLogicFunction } from './expressions/logic-function-factory';\nimport { createTypePredicateFunction } from './values/type-predicate-factory';\nimport { applyValidator } from './validation/validator-factory';\nimport { applyLogic } from './logic/logic-applicator';\n\n/**\n * Apply schema configuration.\n * Accepts both SchemaPath and SchemaPathTree for flexibility.\n *\n * Note: We cast fieldPath to suppress TypeScript's union type errors. This is safe because:\n * 1. We only use signal forms (not AbstractControl), so SchemaPathTree is always the supported branch\n * 2. The Angular apply functions accept SchemaPath with any value type\n * 3. The actual schema application happens at runtime via the schema function\n */\nexport function applySchema(config: SchemaApplicationConfig, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n const schemaRegistry = inject(SchemaRegistryService);\n const schema = schemaRegistry.resolveSchema(config.schema);\n\n if (!schema) {\n const availableSchemas = Array.from(schemaRegistry.getAllSchemas().keys()).join(', ') || '<none>';\n console.error(\n `[Dynamic Forms] Schema not found: '${config.schema}'. ` +\n `Available schemas: ${availableSchemas}. ` +\n `Ensure the schema is registered in your schema registry.`,\n );\n return;\n }\n\n const schemaFn = createSchemaFunction(schema);\n\n // Cast to suppress union type errors - safe because we only use signal forms (see function docs)\n const path = fieldPath as SchemaPath<any>;\n\n switch (config.type) {\n case 'apply':\n apply(path, schemaFn);\n break;\n\n case 'applyWhen':\n if (config.condition) {\n const conditionFn = createLogicFunction(config.condition);\n applyWhen(path, conditionFn, schemaFn);\n }\n break;\n\n case 'applyWhenValue':\n if (config.typePredicate) {\n const predicate = createTypePredicateFunction(config.typePredicate);\n applyWhenValue(path, predicate, schemaFn);\n }\n break;\n\n case 'applyEach':\n applyEach(path as SchemaPath<any[]>, schemaFn);\n break;\n }\n}\n\n/**\n * Create a schema function from schema definition.\n *\n * Schema functions receive SchemaPathTree which includes both the base SchemaPath\n * and nested child access properties. The validator/logic/schema application functions\n * accept SchemaPath | SchemaPathTree, so we can pass the path directly.\n */\nexport function createSchemaFunction<T = unknown>(schema: SchemaDefinition): SchemaOrSchemaFn<T> {\n return (path: SchemaPathTree<T>) => {\n // Apply validators - path is SchemaPathTree which is accepted by applyValidator\n schema.validators?.forEach((validatorConfig) => {\n applyValidator(validatorConfig, path);\n });\n\n // Apply logic - path is SchemaPathTree which is accepted by applyLogic\n schema.logic?.forEach((logicConfig) => {\n applyLogic(logicConfig, path);\n });\n\n // Apply sub-schemas - path is SchemaPathTree which is accepted by applySchema\n schema.subSchemas?.forEach((subSchemaConfig) => {\n applySchema(subSchemaConfig, path);\n });\n };\n}\n","import { FieldComponent, FieldDef } from '../base/field-def';\nimport { GroupAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Group field interface for creating logical field groupings that map to object values\n * Groups create nested form structures where child field values are collected into an object\n * This is a programmatic grouping only - users cannot customize this field type\n *\n * TypeScript cannot enforce field nesting rules due to circular dependency limitations.\n * For documentation: Groups should contain rows and leaf fields, but NOT pages or other groups.\n * Runtime validation enforces these rules.\n */\nexport interface GroupField<TFields extends readonly GroupAllowedChildren[] = readonly GroupAllowedChildren[]> extends FieldDef<never> {\n type: 'group';\n\n readonly fields: TFields;\n\n /** Groups do not have a label property - they are logical containers only **/\n readonly label?: never;\n}\n\n/**\n * Type guard for GroupField with proper type narrowing\n */\nexport function isGroupField(field: FieldDef<any>): field is GroupField {\n return field.type === 'group' && 'fields' in field;\n}\n\nexport type GroupComponent<T extends GroupAllowedChildren[]> = FieldComponent<GroupField<T>>;\n","import { FieldComponent, FieldDef } from '../base/field-def';\nimport { ArrayAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Array field interface for creating dynamic field collections that map to array values.\n *\n * Key concepts:\n * - The `fields` array defines the TEMPLATE (single field definition), not instances\n * - Array items are created/removed dynamically at runtime via event bus\n * - For primitive arrays: Use a leaf field as template → `['value1', 'value2']`\n * - For object arrays: Use a group field as template → `[{key1: val1}, {key2: val2}]`\n *\n * @example\n * // Primitive array (flat values)\n * {\n * key: 'tags',\n * type: 'array',\n * fields: [{ key: 'tag', type: 'input' }]\n * }\n * // Creates: { tags: ['tag1', 'tag2', 'tag3'] }\n *\n * @example\n * // Object array (nested groups)\n * {\n * key: 'contacts',\n * type: 'array',\n * fields: [{\n * type: 'group',\n * fields: [\n * { key: 'name', type: 'input' },\n * { key: 'email', type: 'input' }\n * ]\n * }]\n * }\n * // Creates: { contacts: [{name: '', email: ''}, {name: '', email: ''}] }\n *\n * Nesting constraints: Arrays can contain rows, leaf fields, or groups (for object arrays),\n * but NOT pages or other arrays. Runtime validation enforces these rules.\n */\nexport interface ArrayField<TFields extends readonly ArrayAllowedChildren[] = readonly ArrayAllowedChildren[]> extends FieldDef<never> {\n type: 'array';\n\n /**\n * Template field definition(s) that will be cloned for each array item.\n * Typically contains a single field definition:\n * - For flat arrays: A leaf field (input, select, checkbox, etc.)\n * - For object arrays: A group field containing multiple child fields\n */\n readonly fields: TFields;\n\n /** Array fields do not have a label property **/\n readonly label?: never;\n}\n\n/**\n * Type guard for ArrayField with proper type narrowing\n */\nexport function isArrayField(field: FieldDef<any>): field is ArrayField {\n return field.type === 'array' && 'fields' in field;\n}\n\nexport type ArrayComponent<T extends ArrayAllowedChildren[]> = FieldComponent<ArrayField<T>>;\n","import { FieldComponent, FieldDef } from '../base/field-def';\nimport { RowAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Row field interface for creating horizontal layouts\n * This is a special field type that contains other definitions arranged horizontally\n * The row itself doesn't have a value - it's a layout container\n * This is a programmatic field type only - users cannot customize this field type\n *\n * TypeScript cannot enforce field nesting rules due to circular dependency limitations.\n * For documentation: Rows should contain groups and leaf fields, but NOT pages or other rows.\n * Runtime validation enforces these rules.\n */\nexport interface RowField<TFields extends readonly RowAllowedChildren[] = readonly RowAllowedChildren[]> extends FieldDef<never> {\n type: 'row';\n\n /** Child definitions to render within this row */\n readonly fields: TFields;\n\n /** Row fields do not have a label property **/\n readonly label?: never;\n}\n\n/**\n * Type guard for RowField with proper type narrowing\n */\nexport function isRowField(field: FieldDef<any>): field is RowField {\n return field.type === 'row' && 'fields' in field && Array.isArray((field as RowField).fields);\n}\n\nexport type RowComponent = FieldComponent<RowField<RowAllowedChildren[]>>;\n","import { FieldDef } from '../base/field-def';\nimport { PageAllowedChildren } from '../../models/types/nesting-constraints';\nimport { isRowField } from './row-field';\nimport { isGroupField } from './group-field';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\n\n/**\n * Logic configuration for page fields.\n * Pages only support the 'hidden' logic type since they are layout containers,\n * not form controls (they can't be readonly, disabled, or required).\n */\nexport interface PageLogicConfig {\n /** Only 'hidden' is supported for pages */\n type: 'hidden';\n\n /**\n * Condition that determines when this page is hidden.\n * Can be a boolean or a conditional expression evaluated against form values.\n */\n condition: ConditionalExpression | boolean;\n}\n\n/**\n * Page field interface for creating top-level page layouts\n * This is a special field type that contains other field definitions\n * The page itself doesn't have a value - it's a layout container like row\n * Pages can only be used at the top level and cannot be nested\n * This is a programmatic field type only - users cannot customize this field type\n *\n * TypeScript cannot enforce field nesting rules due to circular dependency limitations.\n * For documentation: Pages should contain rows, groups, and leaf fields, but NOT other pages.\n * Runtime validation enforces these rules.\n */\nexport interface PageField<TFields extends readonly PageAllowedChildren[] = PageAllowedChildren[]> extends FieldDef<never> {\n type: 'page';\n\n /** Child field definitions to render within this page */\n readonly fields: TFields;\n\n /** Page fields do not have a label property **/\n readonly label?: never;\n\n /**\n * Logic configurations for conditional page visibility.\n * Only 'hidden' type logic is supported for pages.\n *\n * @example\n * ```typescript\n * {\n * key: 'businessPage',\n * type: 'page',\n * logic: [{\n * type: 'hidden',\n * condition: {\n * type: 'fieldValue',\n * fieldPath: 'accountType',\n * operator: 'notEquals',\n * value: 'business',\n * },\n * }],\n * fields: [...]\n * }\n * ```\n */\n readonly logic?: PageLogicConfig[];\n}\n\n/**\n * Type guard for PageField with proper type narrowing\n */\nexport function isPageField(field: FieldDef<unknown>): field is PageField {\n return field.type === 'page' && 'fields' in field && Array.isArray((field as PageField).fields);\n}\n\n/**\n * Validates that a page field doesn't contain nested page fields\n * @param pageField The page field to validate\n * @returns true if valid (no nested pages), false otherwise\n */\nexport function validatePageNesting(pageField: PageField): boolean {\n return !hasNestedPages(pageField.fields);\n}\n\n/**\n * Type guard to check if a field is a container with fields property\n */\nfunction isContainerWithFields(field: FieldDef<unknown>): field is FieldDef<unknown> & { readonly fields: readonly FieldDef<unknown>[] } {\n return (isRowField(field) || isGroupField(field)) && 'fields' in field && Array.isArray((field as { fields: unknown }).fields);\n}\n\n/**\n * Recursively checks if fields contain any nested page fields\n * @param fields Array of field definitions to check\n * @returns true if nested pages found, false otherwise\n */\nfunction hasNestedPages(fields: readonly FieldDef<unknown>[]): boolean {\n for (const field of fields) {\n if (isPageField(field)) {\n return true;\n }\n\n // Check row and group fields for nested pages\n if (isContainerWithFields(field)) {\n if (hasNestedPages(field.fields)) {\n return true;\n }\n }\n }\n return false;\n}\n","import {\n disabled,\n email,\n hidden,\n max,\n maxLength,\n min,\n minLength,\n pattern,\n readonly,\n required,\n SchemaPathRules,\n PathKind,\n applyEach,\n schema,\n} from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { FieldDef } from '../definitions/base/field-def';\nimport { FieldWithValidation } from '../definitions/base/field-with-validation';\nimport { applyValidator } from './validation/validator-factory';\nimport { applyLogic } from './logic/logic-applicator';\nimport { applySchema } from './schema-application';\nimport { isGroupField } from '../definitions/default/group-field';\nimport { isArrayField } from '../definitions/default/array-field';\nimport { isPageField } from '../definitions/default/page-field';\nimport { isRowField } from '../definitions/default/row-field';\n\n/**\n * Safely cast a SchemaPathTree to SchemaPath with Supported rules.\n * See validator-factory.ts for detailed explanation of why this is safe.\n */\nfunction toSupportedPath<TValue, TPathKind extends PathKind = PathKind.Root>(\n path: SchemaPath<TValue, any, TPathKind> | SchemaPathTree<TValue, TPathKind>,\n): SchemaPath<TValue, SchemaPathRules.Supported, TPathKind> {\n return path as SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>;\n}\n\n/**\n * Single entry point to map field data into form\n * This is the main function that should be called from the dynamic form component\n *\n * Cross-field logic (formValue.*) is handled automatically by createLogicFunction\n * which uses RootFormRegistryService. No special context needed.\n *\n * Cross-field validators are skipped at field level - they are collected and\n * applied at form level using validateTree.\n *\n * @param fieldDef The field definition to map\n * @param fieldPath The Angular Signal Forms schema path\n */\nexport function mapFieldToForm(fieldDef: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n // Cast to FieldWithValidation to access validation properties\n const validationField = fieldDef as FieldDef<any> & FieldWithValidation;\n\n // Special handling for page fields - flatten child fields to root level\n if (isPageField(fieldDef)) {\n mapPageFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Special handling for row fields - flatten child fields to root level (like pages)\n if (isRowField(fieldDef)) {\n mapRowFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Special handling for group fields - apply child field validations to the parent form schema\n if (isGroupField(fieldDef)) {\n mapGroupFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Special handling for array fields - apply child field validations to the parent form schema\n if (isArrayField(fieldDef)) {\n mapArrayFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Apply simple validation rules from field properties (backward compatibility)\n applySimpleValidationRules(validationField, fieldPath);\n\n // Apply advanced validators if they exist\n // Cross-field validators are skipped here (detected by validator-factory)\n // and applied at form level via validateTree\n if (validationField.validators) {\n validationField.validators.forEach((validatorConfig) => {\n applyValidator(validatorConfig, fieldPath, fieldDef.key);\n });\n }\n\n // Apply logic if it exists\n // Cross-field logic (formValue.*) is handled automatically by createLogicFunction\n if (validationField.logic) {\n validationField.logic.forEach((logicConfig) => {\n applyLogic(logicConfig, fieldPath);\n });\n }\n\n // Apply schemas if they exist\n if (validationField.schemas) {\n validationField.schemas.forEach((schemaConfig) => {\n applySchema(schemaConfig, fieldPath);\n });\n }\n\n // Handle any additional field-specific configuration\n mapFieldSpecificConfiguration(fieldDef, fieldPath);\n}\n\n/**\n * Apply simple validation rules from field properties for backward compatibility\n *\n * Note: This function accepts SchemaPath<any> because FieldDef doesn't encode\n * the field's TypeScript type at compile time. The validators are applied based\n * on runtime FieldDef properties (email, min, max, etc.). The type assertions\n * to specific types (string, number) are safe because:\n * 1. Angular's validators perform runtime value checks, not compile-time type checks\n * 2. The FieldDef properties indicate which validator to apply\n * 3. The SchemaPath type parameter is primarily for IDE autocomplete/type inference\n */\nfunction applySimpleValidationRules(fieldDef: FieldDef<any> & FieldWithValidation, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n const path = toSupportedPath(fieldPath);\n\n // Required validator\n if (fieldDef.required) {\n required(path);\n }\n\n // Email validator\n if (fieldDef.email) {\n // Email validator expects SchemaPath<string>\n email(path as SchemaPath<string, SchemaPathRules.Supported>);\n }\n\n // Numeric validators (min/max)\n // Support both 'min'/'max' (from FieldWithValidation) and 'minValue'/'maxValue' (from SliderField)\n const minVal = fieldDef.min ?? (fieldDef as any).minValue ?? (fieldDef.props as any)?.min;\n const maxVal = fieldDef.max ?? (fieldDef as any).maxValue ?? (fieldDef.props as any)?.max;\n\n if (minVal !== undefined) {\n // Min validator expects SchemaPath<number>\n min(path as SchemaPath<number, SchemaPathRules.Supported>, minVal);\n }\n\n if (maxVal !== undefined) {\n // Max validator expects SchemaPath<number>\n max(path as SchemaPath<number, SchemaPathRules.Supported>, maxVal);\n }\n\n // String length validators\n if (fieldDef.minLength !== undefined) {\n // MinLength validator expects SchemaPath<string>\n minLength(path as SchemaPath<string, SchemaPathRules.Supported>, fieldDef.minLength);\n }\n\n if (fieldDef.maxLength !== undefined) {\n // MaxLength validator expects SchemaPath<string>\n maxLength(path as SchemaPath<string, SchemaPathRules.Supported>, fieldDef.maxLength);\n }\n\n // Pattern validator\n if (fieldDef.pattern) {\n const regexPattern = typeof fieldDef.pattern === 'string' ? new RegExp(fieldDef.pattern) : fieldDef.pattern;\n // Pattern validator expects SchemaPath<string>\n pattern(path as SchemaPath<string, SchemaPathRules.Supported>, regexPattern);\n }\n}\n\n/**\n * Handle field-specific configuration that doesn't fit into validators/logic/schemas\n */\nfunction mapFieldSpecificConfiguration(fieldDef: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n // Handle disabled state\n if (fieldDef.disabled) {\n disabled(toSupportedPath(fieldPath));\n }\n\n // Handle readonly state\n if (fieldDef.readonly) {\n readonly(toSupportedPath(fieldPath));\n }\n\n // Handle hidden state (hidden() requires a logic function, so we provide a static true)\n if (fieldDef.hidden) {\n hidden(toSupportedPath(fieldPath), () => true);\n }\n\n // Handle any additional configuration specific to the field type\n // This can be extended as needed for specific field requirements\n\n // Example: if field has custom form integration requirements\n if ('customFormConfig' in fieldDef && fieldDef.customFormConfig) {\n console.log('Custom form configuration detected for field:', fieldDef.key);\n // Handle custom configuration here\n }\n}\n\n/**\n * Common helper to map child fields to their parent form paths\n * @param fields - Array of child field definitions\n * @param parentPath - The parent field path\n */\nfunction mapChildFieldsToForm<TValue>(fields: FieldDef<any>[], parentPath: SchemaPath<TValue> | SchemaPathTree<TValue>): void {\n for (const childField of fields) {\n if (!childField.key) {\n continue;\n }\n\n // Type assertion needed due to dynamic field keys\n const childPath = (parentPath as any)[childField.key] as SchemaPath<any> | SchemaPathTree<any> | undefined;\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n}\n\n/**\n * Maps page field children to the root form schema\n * Page fields are layout containers that don't create their own form controls\n * Their children are flattened to the root level of the form\n */\nfunction mapPageFieldToForm(pageField: FieldDef<any>, rootPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isPageField(pageField) || !pageField.fields) {\n return;\n }\n\n const fields = pageField.fields as FieldDef<any>[];\n mapChildFieldsToForm(fields, rootPath);\n}\n\n/**\n * Maps row field children to the root form schema\n * Row fields are layout containers (horizontal) that don't create their own form controls\n * Their children are flattened to the root level of the form, similar to page fields\n */\nfunction mapRowFieldToForm(rowField: FieldDef<any>, rootPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isRowField(rowField) || !rowField.fields) {\n return;\n }\n\n const fields = rowField.fields as FieldDef<any>[];\n mapChildFieldsToForm(fields, rootPath);\n}\n\n/**\n * Maps group field children to the parent form schema\n * This ensures that validation from child fields is applied to the parent form\n */\nfunction mapGroupFieldToForm(groupField: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isGroupField(groupField) || !groupField.fields) {\n return;\n }\n\n const fields = groupField.fields as FieldDef<any>[];\n mapChildFieldsToForm(fields, fieldPath);\n}\n\n/**\n * Maps array field to the parent form schema using applyEach.\n *\n * Array fields are fundamentally different from groups:\n * - The fields array is a TEMPLATE (single field definition), not instances\n * - Array items are created/removed dynamically at runtime\n * - applyEach creates proper FieldTree structure for each array item\n *\n * By using applyEach, Angular Signal Forms will:\n * 1. Create FieldTree instances for each array item\n * 2. Apply the item schema (validation, logic) to each item\n * 3. Allow array items to be accessed via arrayFieldTree[index]\n */\nfunction mapArrayFieldToForm(arrayField: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isArrayField(arrayField) || !arrayField.fields || arrayField.fields.length === 0) {\n return;\n }\n\n // Get the template field (first field in array.fields)\n const templateField = arrayField.fields[0];\n\n // Create an item schema from the template field\n const itemSchema = schema<any>((itemPath: SchemaPathTree<any>) => {\n // Handle container fields (row, group) that have nested fields\n if (isRowField(templateField) || isPageField(templateField)) {\n // Row/page templates flatten their children - apply child validations directly to item\n if (templateField.fields && Array.isArray(templateField.fields)) {\n for (const childField of templateField.fields as FieldDef<any>[]) {\n if (!childField.key) continue;\n const childPath = (itemPath as unknown as Record<string, SchemaPathTree<any>>)[childField.key];\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n }\n } else if (isGroupField(templateField)) {\n // Group template - apply child validations to the item\n if (templateField.fields && Array.isArray(templateField.fields)) {\n for (const childField of templateField.fields as FieldDef<any>[]) {\n if (!childField.key) continue;\n const childPath = (itemPath as unknown as Record<string, SchemaPathTree<any>>)[childField.key];\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n }\n } else {\n // Simple field template - apply validation directly\n mapFieldToForm(templateField, itemPath);\n }\n });\n\n // Apply the item schema to each array element\n applyEach(fieldPath as SchemaPath<any[]>, itemSchema);\n\n // TODO: Support array-level validation (min/max length, unique items, etc.)\n // This would be applied to the array field itself, not individual items:\n // if (arrayField.minLength) minLength(fieldPath, arrayField.minLength);\n // if (arrayField.maxLength) maxLength(fieldPath, arrayField.maxLength);\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { FieldTypeDefinition, getFieldValueHandling } from '../../models/field-type';\n\n/**\n * Generates appropriate default values for different field types in dynamic forms.\n *\n * Uses registry configuration to determine how each field type should handle values.\n * Supports exclude/flatten/include modes based on field type registration.\n *\n * @param field - Field definition to generate default value for\n * @param registry - Field type registry for value handling configuration\n * @returns Appropriate default value based on field type and configuration\n *\n * @example\n * ```typescript\n * // Basic input field defaults to empty string\n * getFieldDefaultValue({ type: 'input', key: 'email' }, registry); // ''\n *\n * // Excluded fields (like text/row) return undefined\n * getFieldDefaultValue({ type: 'text', key: 'label' }, registry); // undefined\n *\n * // Group field returns object with child defaults\n * getFieldDefaultValue({\n * type: 'group',\n * key: 'address',\n * fields: [\n * { type: 'input', key: 'street' },\n * { type: 'input', key: 'city', value: 'New York' }\n * ]\n * }, registry); // { street: '', city: 'New York' }\n * ```\n */\nexport function getFieldDefaultValue(field: FieldDef<unknown>, registry: Map<string, FieldTypeDefinition>): unknown {\n const valueHandling = getFieldValueHandling(field.type, registry);\n\n // Fields with 'exclude' handling don't contribute values\n if (valueHandling === 'exclude') {\n return undefined;\n }\n\n // Flatten fields (row/page) return flattened object of children's values\n // This is used by array fields to get the template structure\n // Note: fieldsToDefaultValues will skip these at top-level since they have keys and return objects\n if (valueHandling === 'flatten' && 'fields' in field && field.fields) {\n const childFields = field.fields as readonly FieldDef<unknown>[];\n\n // Collect only fields that contribute values (exclude buttons, text, etc.)\n const flattenedValues: Record<string, unknown> = {};\n for (const childField of childFields) {\n if ('key' in childField && childField.key) {\n const childValue = getFieldDefaultValue(childField, registry);\n if (childValue !== undefined) {\n flattenedValues[childField.key] = childValue;\n }\n }\n }\n\n // Return flattened object if there are any values, otherwise undefined\n return Object.keys(flattenedValues).length > 0 ? flattenedValues : undefined;\n }\n\n // Group fields with 'include' handling create nested objects\n if (field.type === 'group' && 'fields' in field) {\n const fields = field.fields as readonly FieldDef<unknown>[];\n if (!fields || fields.length === 0) {\n return undefined;\n }\n\n const groupDefaults: Record<string, unknown> = {};\n for (const childField of fields) {\n const childValueHandling = getFieldValueHandling(childField.type, registry);\n\n // Flatten row/page fields into the group (they are presentational containers)\n if (childValueHandling === 'flatten' && 'fields' in childField && childField.fields) {\n const nestedFields = childField.fields as readonly FieldDef<unknown>[];\n for (const nestedField of nestedFields) {\n if ('key' in nestedField && nestedField.key) {\n const nestedValue = getFieldDefaultValue(nestedField, registry);\n if (nestedValue !== undefined) {\n groupDefaults[nestedField.key] = nestedValue;\n }\n }\n }\n } else if ('key' in childField && childField.key) {\n const childValue = getFieldDefaultValue(childField, registry);\n if (childValue !== undefined) {\n groupDefaults[childField.key] = childValue;\n }\n }\n }\n return groupDefaults;\n }\n\n // Check for defaultValue first (used for reset/clear operations)\n if ('defaultValue' in field && (field as any).defaultValue !== undefined && (field as any).defaultValue !== null) {\n return (field as any).defaultValue;\n }\n\n // Use explicit value if provided, with type-specific handling for null\n if ('value' in field) {\n // If value is explicitly set (even to null/undefined), respect it\n if (field.value !== null && field.value !== undefined) {\n return field.value;\n }\n\n // Handle explicit null: use type-specific default\n if (field.value === null) {\n return field.type === 'checkbox' ? false : '';\n }\n\n // Handle explicit undefined: fall through to type-specific defaults\n }\n\n // Type-specific defaults when no value is specified\n if (field.type === 'checkbox') {\n return false;\n }\n\n if (field.type === 'array') {\n return [];\n }\n\n // Number inputs need a number type default for Angular signal forms\n // to use valueAsNumber for coercion. NaN is ideal because:\n // - typeof NaN === 'number' (triggers Angular's valueAsNumber path)\n // - NaN displays as empty in number inputs\n // - valueAsNumber returns NaN when input is cleared\n if (field.type === 'input' && 'props' in field) {\n const props = field.props as { type?: string } | undefined;\n if (props?.type === 'number') {\n return NaN;\n }\n }\n\n return '';\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { isPageField } from '../../definitions/default/page-field';\nimport { isRowField } from '../../definitions/default/row-field';\nimport { isGroupField } from '../../definitions/default/group-field';\nimport { isArrayField } from '../../definitions/default/array-field';\nimport { ContainerFieldTypes, LeafFieldTypes, RegisteredFieldTypes } from '../registry/field-registry';\n\n/**\n * Type guard to check if a field definition has child fields.\n * This is a looser check that works with FieldDef<unknown> without requiring RegisteredFieldTypes.\n */\nexport function hasChildFields<T>(\n field: FieldDef<T>,\n): field is FieldDef<T> & { fields: FieldDef<unknown>[] | Record<string, FieldDef<unknown>> } {\n return 'fields' in field && field.fields != null;\n}\n\n/** Container field type names */\nconst CONTAINER_TYPES = new Set(['page', 'row', 'group', 'array']);\n\n/**\n * Type guard to check if a field is a container field (page, row, group, or array)\n * Container fields have a 'fields' property and don't contribute values directly.\n * This overload works with RegisteredFieldTypes for full type narrowing.\n */\nexport function isContainerField(field: RegisteredFieldTypes): field is ContainerFieldTypes;\n/**\n * Type guard to check if a field is a container field (page, row, group, or array).\n * This overload works with any FieldDef for looser type checking.\n */\nexport function isContainerField(field: FieldDef<unknown>): boolean;\nexport function isContainerField(field: FieldDef<unknown> | RegisteredFieldTypes): boolean {\n return CONTAINER_TYPES.has(field.type);\n}\n\n/**\n * Type guard to check if a field is a leaf field (value or display field)\n * Leaf fields don't have children and either contribute values or display content\n */\nexport function isLeafField(field: RegisteredFieldTypes): field is LeafFieldTypes {\n return !isContainerField(field);\n}\n\n/**\n * Type guard to check if a field has a value property (value-bearing field)\n * These fields contribute to the form value output\n * Note: Using `unknown` in the Extract condition to match any value type\n */\nexport function isValueBearingField(field: RegisteredFieldTypes): field is Extract<RegisteredFieldTypes, { value: unknown }> {\n return 'value' in field;\n}\n\n/**\n * Type guard to check if a field is excluded from form values (display-only field)\n * Currently this includes text fields and any other fields without a value property\n */\nexport function isDisplayOnlyField(field: RegisteredFieldTypes): boolean {\n return field.type === 'text' || isContainerField(field);\n}\n\n// Re-export the specific type guards for convenience\nexport { isPageField, isRowField, isGroupField, isArrayField };\n","import { inject, untracked } from '@angular/core';\nimport { Schema, schema, validateTree, FieldContext, ValidationError, FieldTree } from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { FieldDef } from '../definitions/base/field-def';\nimport { mapFieldToForm } from './form-mapping';\nimport { FieldTypeDefinition, getFieldValueHandling } from '../models/field-type';\nimport { getFieldDefaultValue } from '../utils/default-value/default-value';\nimport { CrossFieldValidatorEntry } from './cross-field/cross-field-types';\nimport { FunctionRegistryService } from './registry/function-registry.service';\nimport { ExpressionParser } from './expressions/parser/expression-parser';\nimport { evaluateCondition } from './expressions/condition-evaluator';\nimport { CustomValidatorConfig, ValidatorConfig } from '../models/validation/validator-config';\nimport { hasChildFields } from '../models/types/type-guards';\n\nconst emailPattern = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\n/**\n * Creates an Angular signal forms schema from field definitions\n * This is the single entry point at dynamic form level that replaces createSchemaFromFields\n * Uses the new modular signal forms adapter structure\n *\n * Cross-field logic (formValue.*) is handled automatically by createLogicFunction\n * which uses RootFormRegistryService. No special context needed.\n *\n * Cross-field validators are passed directly and applied at form level using validateTree.\n *\n * @param fields Field definitions to create schema from\n * @param registry Field type registry\n * @param crossFieldValidators Optional array of collected cross-field validators\n */\nexport function createSchemaFromFields<TModel = unknown>(\n fields: FieldDef<any>[],\n registry: Map<string, FieldTypeDefinition>,\n crossFieldValidators?: CrossFieldValidatorEntry[],\n): Schema<TModel> {\n // Inject services for cross-field validation\n // These will be available because createSchemaFromFields is called within runInInjectionContext\n const functionRegistry = inject(FunctionRegistryService);\n\n return schema<TModel>((path) => {\n for (const fieldDef of fields) {\n const valueHandling = getFieldValueHandling(fieldDef.type, registry);\n\n // Handle different value handling modes\n if (valueHandling === 'exclude') {\n // Skip fields that don't contribute to form values\n continue;\n }\n\n if (valueHandling === 'flatten' && hasChildFields(fieldDef)) {\n // Handle both array (page/row fields) and object (group fields)\n const fieldsArray = Array.isArray(fieldDef.fields) ? fieldDef.fields : Object.values(fieldDef.fields);\n for (const childField of fieldsArray) {\n if (!childField.key) continue;\n\n const childPath = path[childField.key as keyof typeof path] as SchemaPath<unknown>;\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n continue;\n }\n\n // Regular field processing for 'include' fields\n const fieldPath = path[fieldDef.key as keyof typeof path] as SchemaPath<unknown>;\n\n if (!fieldPath) {\n continue;\n }\n\n // Use the new modular form mapping function\n // This will progressively apply validators, logic, and schemas\n // Cross-field logic is handled automatically via RootFormRegistryService\n mapFieldToForm(fieldDef, fieldPath);\n }\n\n // Apply cross-field validators using validateTree\n if (crossFieldValidators && crossFieldValidators.length > 0) {\n applyCrossFieldTreeValidator(path as SchemaPathTree<TModel>, crossFieldValidators, functionRegistry);\n }\n });\n}\n\n/**\n * Applies cross-field validators using Angular's validateTree API.\n *\n * This is the key integration point that routes cross-field validation errors\n * to the appropriate target fields via Angular's form state system.\n *\n * The validateTree function allows returning errors with a `field` property\n * that targets specific fields, which Angular automatically routes to those\n * fields' errors() signal.\n *\n * Supports two types of hoisted validators:\n * 1. Custom validators with cross-field expressions (e.g., `formValue.password === formValue.confirmPassword`)\n * 2. Built-in validators with cross-field `when` conditions (e.g., `required` when `country === 'USA'`)\n *\n * @param rootPath The root schema path tree\n * @param validators Array of collected cross-field validators\n * @param functionRegistry Registry containing custom functions for expression evaluation\n */\nfunction applyCrossFieldTreeValidator<TModel>(\n rootPath: SchemaPathTree<TModel>,\n validators: CrossFieldValidatorEntry[],\n functionRegistry: FunctionRegistryService,\n): void {\n // Get custom functions for expression evaluation\n const customFunctions = functionRegistry.getCustomFunctions();\n\n validateTree(rootPath as SchemaPath<TModel>, (ctx: FieldContext<TModel>) => {\n if (validators.length === 0) {\n return null; // ValidationSuccess - no errors\n }\n\n // Read form value reactively - don't wrap in untracked() so Angular can track dependencies\n const formValue = ctx.value() as Record<string, unknown>;\n const errors: ValidationError.WithOptionalField[] = [];\n\n for (const entry of validators) {\n const { sourceFieldKey, config } = entry;\n\n try {\n const error = evaluateCrossFieldValidator(entry, formValue, sourceFieldKey, ctx, customFunctions);\n\n if (error) {\n errors.push(error);\n }\n } catch (err) {\n console.error(`[Dynamic Forms] Error evaluating cross-field validator for ${sourceFieldKey}:`, err);\n\n // On error, add a validation error to indicate the failure\n // Use ctx.field[key] to access the field tree for dynamic field names\n const targetField = (ctx.field as Record<string, FieldTree<unknown>>)[sourceFieldKey];\n\n if (targetField) {\n const customConfig = config as CustomValidatorConfig;\n errors.push({\n kind: customConfig.kind || config.type || 'custom',\n field: targetField,\n });\n }\n }\n }\n\n return errors.length > 0 ? errors : null;\n });\n}\n\n/**\n * Evaluates a single cross-field validator entry and returns an error if validation fails.\n */\nfunction evaluateCrossFieldValidator<TModel>(\n entry: CrossFieldValidatorEntry,\n formValue: Record<string, unknown>,\n sourceFieldKey: string,\n ctx: FieldContext<TModel>,\n customFunctions: Record<string, unknown>,\n): ValidationError.WithOptionalField | null {\n const { config } = entry;\n const fieldValue = formValue[sourceFieldKey];\n\n // Create evaluation context for condition/expression evaluation\n const evaluationContext = {\n fieldValue,\n formValue,\n fieldPath: sourceFieldKey,\n customFunctions,\n };\n\n // Check if this is a custom validator (with expression) or a built-in validator (with when condition)\n if (config.type === 'custom') {\n return evaluateCustomCrossFieldValidator(config as CustomValidatorConfig, evaluationContext, sourceFieldKey, ctx);\n } else {\n // Built-in validator with cross-field when condition\n return evaluateBuiltInCrossFieldValidator(config, evaluationContext, sourceFieldKey, ctx);\n }\n}\n\n/**\n * Evaluates a custom cross-field validator with an expression.\n */\nfunction evaluateCustomCrossFieldValidator<TModel>(\n config: CustomValidatorConfig,\n evaluationContext: Record<string, unknown>,\n sourceFieldKey: string,\n ctx: FieldContext<TModel>,\n): ValidationError.WithOptionalField | null {\n if (!config.expression) {\n return null;\n }\n\n const { fieldValue, formValue } = evaluationContext as { fieldValue: unknown; formValue: Record<string, unknown> };\n\n // First, evaluate the when condition if present\n // If the condition is false, the validator doesn't apply (validation passes)\n if (config.when) {\n const conditionMet = evaluateCondition(config.when, {\n fieldValue,\n formValue,\n fieldPath: sourceFieldKey,\n customFunctions: (evaluationContext.customFunctions as Record<string, (ctx: unknown) => unknown>) || {},\n });\n\n if (!conditionMet) {\n return null; // Condition not met, skip validation\n }\n }\n\n // Evaluate expression using the secure AST parser\n const result = ExpressionParser.evaluate(config.expression, evaluationContext);\n\n // If expression returns truthy, validation passes (no error)\n if (result) {\n return null;\n }\n\n // Validation failed - create error targeting the source field\n // Use ctx.field[key] to access the field tree for dynamic field names\n const targetField = (ctx.field as Record<string, FieldTree<unknown>>)[sourceFieldKey];\n\n if (!targetField) {\n return null;\n }\n\n const errorObj: Record<string, unknown> = {\n kind: config.kind || 'custom',\n field: targetField,\n };\n\n // Evaluate and include errorParams for message interpolation\n if (config.errorParams) {\n for (const [key, expression] of Object.entries(config.errorParams)) {\n try {\n errorObj[key] = ExpressionParser.evaluate(expression, evaluationContext);\n } catch {\n // Ignore evaluation errors for params\n }\n }\n }\n\n return errorObj as unknown as ValidationError.WithOptionalField;\n}\n\n/**\n * Evaluates a built-in validator with a cross-field when condition.\n * First checks the when condition, then applies the built-in validation logic.\n */\nfunction evaluateBuiltInCrossFieldValidator<TModel>(\n config: ValidatorConfig,\n evaluationContext: Record<string, unknown>,\n sourceFieldKey: string,\n ctx: FieldContext<TModel>,\n): ValidationError.WithOptionalField | null {\n const { fieldValue, formValue } = evaluationContext as { fieldValue: unknown; formValue: Record<string, unknown> };\n\n // First, evaluate the when condition\n // If the condition is false, the validator doesn't apply (validation passes)\n if (config.when) {\n const conditionMet = evaluateCondition(config.when, {\n fieldValue,\n formValue,\n fieldPath: sourceFieldKey,\n customFunctions: (evaluationContext.customFunctions as Record<string, (ctx: unknown) => unknown>) || {},\n });\n\n if (!conditionMet) {\n return null; // Condition not met, skip validation\n }\n }\n\n // Now apply the built-in validation logic based on the validator type\n const isValid = applyBuiltInValidationLogic(config, fieldValue);\n\n if (isValid) {\n return null; // Validation passed\n }\n\n // Validation failed - create error targeting the source field\n // Use ctx.field[key] to access the field tree for dynamic field names\n const targetField = (ctx.field as Record<string, FieldTree<unknown>>)[sourceFieldKey];\n if (!targetField) {\n return null;\n }\n\n return {\n kind: config.type,\n field: targetField,\n } as ValidationError.WithOptionalField;\n}\n\n/**\n * Applies built-in validation logic based on the validator type.\n * Returns true if validation passes, false if it fails.\n */\nfunction applyBuiltInValidationLogic(config: ValidatorConfig, fieldValue: unknown): boolean {\n switch (config.type) {\n case 'required':\n // Required: value must be non-null, non-undefined, and non-empty string\n if (fieldValue === null || fieldValue === undefined) {\n return false;\n }\n if (typeof fieldValue === 'string' && fieldValue.trim() === '') {\n return false;\n }\n return true;\n\n case 'min':\n // Min: numeric value must be >= min\n if (fieldValue === null || fieldValue === undefined) {\n return true; // Empty values pass min validation (use required for emptiness)\n }\n if ('value' in config && typeof config.value === 'number') {\n return (fieldValue as number) >= config.value;\n }\n return true;\n\n case 'max':\n // Max: numeric value must be <= max\n if (fieldValue === null || fieldValue === undefined) {\n return true;\n }\n if ('value' in config && typeof config.value === 'number') {\n return (fieldValue as number) <= config.value;\n }\n return true;\n\n case 'minLength':\n // MinLength: string length must be >= minLength\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n if ('value' in config && typeof config.value === 'number') {\n return String(fieldValue).length >= config.value;\n }\n return true;\n\n case 'maxLength':\n // MaxLength: string length must be <= maxLength\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n if ('value' in config && typeof config.value === 'number') {\n return String(fieldValue).length <= config.value;\n }\n return true;\n\n case 'email':\n // Email: must match email pattern\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n\n return emailPattern.test(String(fieldValue));\n\n case 'pattern':\n // Pattern: must match regex pattern\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n if ('value' in config && config.value) {\n const regex = config.value instanceof RegExp ? config.value : new RegExp(String(config.value));\n return regex.test(String(fieldValue));\n }\n return true;\n\n default:\n // Unknown validator type, consider valid\n return true;\n }\n}\n\n/**\n * Utility to convert field definitions to default values object\n */\nexport function fieldsToDefaultValues<TModel = unknown>(fields: FieldDef<any>[], registry: Map<string, FieldTypeDefinition>): TModel {\n const defaultValues: Record<string, unknown> = {};\n\n for (const field of fields) {\n if (!field.key) continue;\n\n // Skip flatten fields (row/page) at top level - they are presentational containers\n const valueHandling = getFieldValueHandling(field.type, registry);\n if (valueHandling === 'flatten') {\n continue;\n }\n\n const value = getFieldDefaultValue(field, registry);\n if (value !== undefined) {\n defaultValues[field.key] = value;\n }\n }\n\n return defaultValues as TModel;\n}\n","import { Injectable } from '@angular/core';\nimport { filter, Observable, Subject } from 'rxjs';\nimport { FormEvent, FormEventConstructor } from './interfaces/form-event';\n\n/**\n * Event bus service for form-wide event communication.\n *\n * Provides type-safe event dispatching and subscription for form components\n * to communicate without direct coupling. Uses RxJS observables for reactive\n * event handling and supports both single event type and multiple event type subscriptions.\n *\n * @example\n * ```typescript\n * @Component({\n * providers: [EventBus]\n * })\n * export class MyFormComponent {\n * constructor(private eventBus: EventBus) {\n * // Subscribe to form submission events\n * this.eventBus.on<SubmitEvent>('submit').subscribe(() => {\n * console.log('Form was submitted');\n * });\n *\n * // Subscribe to multiple event types\n * this.eventBus.on<SubmitEvent | FormResetEvent>(['submit', 'form-reset']).subscribe(event => {\n * console.log('Form event:', event.type);\n * });\n * }\n *\n * onSubmit() {\n * // Dispatch a submit event\n * this.eventBus.dispatch(SubmitEvent);\n * }\n * }\n * ```\n */\n@Injectable()\nexport class EventBus {\n private pipeline$ = new Subject<FormEvent>();\n\n events$ = this.pipeline$.asObservable();\n\n /**\n * Dispatches an event to all subscribers.\n *\n * Creates an instance of the provided event constructor and broadcasts it\n * through the event pipeline to all active subscribers.\n *\n * @param eventConstructor - Constructor function for the event to dispatch\n *\n * @example\n * ```typescript\n * // Dispatch a submit event\n * eventBus.dispatch(SubmitEvent);\n *\n * // Dispatch a custom event\n * eventBus.dispatch(CustomFormEvent);\n * ```\n */\n dispatch<T extends FormEventConstructor>(eventConstructor: T, ...args: any[]): void {\n this.pipeline$.next(new eventConstructor(...args));\n }\n\n /**\n * Subscribes to events of a specific type.\n *\n * @param eventType - The type of event to subscribe to\n * @returns Observable that emits events of the specified type\n */\n on<T extends FormEvent>(eventType: T['type']): Observable<T>;\n /**\n * Subscribes to events of multiple types.\n *\n * @param eventType - Array of event types to subscribe to\n * @returns Observable that emits events matching any of the specified types\n */\n on<T extends FormEvent>(eventType: Array<T['type']>): Observable<T>;\n /**\n * Subscribes to form events with type-safe filtering.\n *\n * Provides a reactive stream of events filtered by type. Supports both single\n * event type subscriptions and multi-type subscriptions for flexible event handling.\n *\n * @param eventType - Event type string or array of event type strings to filter by\n * @returns Observable stream of filtered events\n *\n * @example\n * ```typescript\n * // Subscribe to a single event type\n * eventBus.on<SubmitEvent>('submit').subscribe(event => {\n * console.log('Submit event received');\n * });\n *\n * // Subscribe to multiple event types\n * eventBus.on<SubmitEvent | FormResetEvent | ValidationErrorEvent>(['submit', 'form-reset', 'validation-error']).subscribe(event => {\n * switch (event.type) {\n * case 'submit':\n * handleSubmit();\n * break;\n * case 'form-reset':\n * handleReset();\n * break;\n * case 'validation-error':\n * handleValidationError();\n * break;\n * }\n * });\n * ```\n */\n on<T extends FormEvent>(eventType: T['type'] | Array<T['type']>): Observable<T> {\n if (Array.isArray(eventType)) {\n return this.pipeline$.pipe(filter((event): event is T => eventType.includes(event.type)));\n }\n\n return this.pipeline$.pipe(filter((event): event is T => event.type === eventType));\n }\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class SubmitEvent implements FormEvent {\n readonly type = 'submit' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class ComponentInitializedEvent implements FormEvent {\n readonly type = 'component-initialized' as const;\n\n constructor(\n public componentType: 'dynamic-form' | 'page' | 'row' | 'group',\n public componentId: string,\n ) {}\n}\n","import { Injector, Signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { Observable } from 'rxjs';\nimport { filter, map, scan, shareReplay, switchMap, take } from 'rxjs/operators';\nimport { EventBus } from '../../events/event.bus';\nimport { ComponentInitializedEvent } from '../../events/constants/component-initialized.event';\n\n/**\n * Creates an observable that tracks component initialization progress.\n *\n * This function returns an observable that emits when all expected components\n * have been initialized. It uses the scan operator to accumulate initialization\n * events and emits true when the count reaches the expected total.\n *\n * @param eventBus - The event bus instance to subscribe to\n * @param expectedCount - Total number of components expected to initialize\n * @returns Observable<boolean> that emits true when all components are initialized\n *\n * @example\n * ```typescript\n * const eventBus = inject(EventBus);\n * const totalComponents = 5; // 1 dynamic-form + 2 pages + 1 row + 1 group\n *\n * const allInitialized$ = createInitializationTracker(eventBus, totalComponents);\n *\n * allInitialized$.subscribe(isComplete => {\n * if (isComplete) {\n * console.log('All components are initialized!');\n * }\n * });\n * ```\n */\nexport function createInitializationTracker(eventBus: EventBus, expectedCount: number): Observable<boolean> {\n return eventBus.on<ComponentInitializedEvent>('component-initialized').pipe(\n scan((count, _event) => count + 1, 0),\n map((currentCount) => currentCount >= expectedCount),\n filter((isComplete) => isComplete),\n );\n}\n\n/**\n * Creates an observable that tracks component initialization progress with detailed status.\n *\n * This function returns an observable that emits the current count and completion status\n * for each initialization event, providing more granular tracking capabilities.\n *\n * @param eventBus - The event bus instance to subscribe to\n * @param expectedCount - Total number of components expected to initialize\n * @returns Observable with current count, expected count, and completion status\n *\n * @example\n * ```typescript\n * const eventBus = inject(EventBus);\n * const totalComponents = 5;\n *\n * const progress$ = createDetailedInitializationTracker(eventBus, totalComponents);\n *\n * progress$.subscribe(({ currentCount, expectedCount, isComplete }) => {\n * console.log(`Progress: ${currentCount}/${expectedCount} (${isComplete ? 'Complete' : 'In Progress'})`);\n * });\n * ```\n */\nexport function createDetailedInitializationTracker(\n eventBus: EventBus,\n expectedCount: number,\n): Observable<{ currentCount: number; expectedCount: number; isComplete: boolean }> {\n return eventBus.on<ComponentInitializedEvent>('component-initialized').pipe(\n scan((count, _event) => count + 1, 0),\n map((currentCount) => ({\n currentCount,\n expectedCount,\n isComplete: currentCount >= expectedCount,\n })),\n );\n}\n\n/**\n * Options for setting up initialization tracking.\n */\nexport interface InitializationTrackingOptions {\n eventBus: EventBus;\n totalComponentsCount: Signal<number>;\n injector: Injector;\n componentId: string;\n}\n\n/**\n * Creates an observable that tracks when all form components are initialized.\n * Uses shareReplay({ bufferSize: 1, refCount: false }) to ensure exactly one emission\n * that can be received by late subscribers and keeps the subscription alive.\n *\n * This utility function replaces the manual ReplaySubject pattern for tracking initialization.\n * The count includes container components (dynamic-form, pages, rows, groups).\n *\n * @param options - Configuration options for initialization tracking\n * @returns Observable<boolean> that emits true when all components are initialized\n *\n * @example\n * ```typescript\n * const eventBus = inject(EventBus);\n * const totalComponents = computed(() => countContainerComponents(fields));\n *\n * readonly initialized$ = setupInitializationTracking({\n * eventBus,\n * totalComponentsCount: totalComponents,\n * injector: this.injector,\n * componentId: 'dynamic-form'\n * });\n * ```\n */\nexport function setupInitializationTracking(options: InitializationTrackingOptions): Observable<boolean> {\n const { eventBus, totalComponentsCount, injector, componentId } = options;\n\n return toObservable(totalComponentsCount, { injector }).pipe(\n take(1),\n switchMap((count) => {\n if (count === 1) {\n // Only dynamic-form component, emit immediately when it initializes\n return eventBus.on<ComponentInitializedEvent>('component-initialized').pipe(\n filter((event) => event.componentType === 'dynamic-form' && event.componentId === componentId),\n map(() => true),\n take(1),\n );\n }\n\n return createInitializationTracker(eventBus, count);\n }),\n shareReplay({ bufferSize: 1, refCount: false }),\n );\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { isPageField } from '../../definitions/default/page-field';\nimport { RegisteredFieldTypes } from '../registry/field-registry';\n\n// Re-export isPageField for external usage\nexport { isPageField };\n\n/**\n * Type guard to check if a field is a container with fields\n */\nfunction isContainerWithFields(field: FieldDef<any>): field is FieldDef<any> & { fields: FieldDef<any>[] } {\n return (\n (field.type === 'row' || field.type === 'group' || field.type === 'page') &&\n 'fields' in field &&\n Array.isArray((field as FieldDef<any> & { fields: FieldDef<any>[] }).fields)\n );\n}\n\n/**\n * Form mode enumeration distinguishing between paged and non-paged forms\n */\nexport type FormMode = 'paged' | 'non-paged';\n\n/**\n * Result of form mode detection with validation details\n */\nexport interface FormModeDetectionResult {\n /** The detected form mode */\n mode: FormMode;\n /** Whether the form configuration is valid for the detected mode */\n isValid: boolean;\n /** Array of validation errors if form is invalid */\n errors: string[];\n}\n\n/**\n * Type guard for paged form configurations\n * A paged form has ALL root-level fields of type 'page'\n */\nexport function isPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n if (!fields || fields.length === 0) {\n return false;\n }\n\n return fields.every((field) => isPageField(field));\n}\n\n/**\n * Type guard for non-paged form configurations\n * A non-paged form has NO page fields at any level\n */\nexport function isNonPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n if (!fields || fields.length === 0) {\n return true; // Empty form is considered non-paged\n }\n\n return !hasAnyPageFields(fields);\n}\n\n/**\n * Detects the form mode and validates the configuration\n * @param fields The form field definitions\n * @returns Detection result with mode and validation status\n */\nexport function detectFormMode<TFields extends RegisteredFieldTypes[]>(fields: TFields): FormModeDetectionResult {\n if (!fields || fields.length === 0) {\n return {\n mode: 'non-paged',\n isValid: true,\n errors: [],\n };\n }\n\n const hasPageFields = fields.some((field) => isPageField(field));\n const allPagesAtRoot = fields.every((field) => isPageField(field));\n const hasNestedPages = hasNestedPageFields(fields);\n\n // Determine mode and validate\n if (hasPageFields) {\n const errors: string[] = [];\n\n // For paged forms, ALL root fields must be pages\n if (!allPagesAtRoot) {\n errors.push('Mixed page and non-page fields at root level. In paged forms, ALL root-level fields must be of type \"page\".');\n }\n\n // Check for nested pages in any page field\n if (hasNestedPages) {\n errors.push('Page fields cannot contain nested page fields at any level.');\n }\n\n return {\n mode: 'paged',\n isValid: errors.length === 0,\n errors,\n };\n } else {\n // Non-paged form\n const errors: string[] = [];\n\n // Non-paged forms cannot have page fields anywhere\n if (hasAnyPageFields(fields)) {\n errors.push('Page fields are not allowed in non-paged forms.');\n }\n\n return {\n mode: 'non-paged',\n isValid: errors.length === 0,\n errors,\n };\n }\n}\n\n/**\n * Recursively checks if any field definition is a page field\n * @param fields Array of field definitions to check\n * @returns true if any page field is found at any level\n */\nfunction hasAnyPageFields(fields: FieldDef<any>[]): boolean {\n for (const field of fields) {\n if (isPageField(field)) {\n return true;\n }\n\n // Check nested fields in container types\n if (isContainerWithFields(field) && (field.type === 'row' || field.type === 'group')) {\n if (hasAnyPageFields(field.fields)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Checks if fields contain nested page fields within their children\n * (This is different from hasAnyPageFields as it checks NESTED pages, not root pages)\n * @param fields Array of field definitions to check\n * @returns true if nested page fields found\n */\nfunction hasNestedPageFields(fields: FieldDef<any>[]): boolean {\n for (const field of fields) {\n // If this is a page field, check if its children contain pages\n if (isPageField(field) && isContainerWithFields(field)) {\n if (hasAnyPageFields(field.fields)) {\n return true;\n }\n }\n\n // Check other container types for nested pages\n if (isContainerWithFields(field) && (field.type === 'row' || field.type === 'group')) {\n if (hasNestedPageFields(field.fields)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Type predicate for valid paged form configurations\n */\nexport function isValidPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n const result = detectFormMode(fields);\n return result.mode === 'paged' && result.isValid;\n}\n\n/**\n * Type predicate for valid non-paged form configurations\n */\nexport function isValidNonPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n const result = detectFormMode(fields);\n return result.mode === 'non-paged' && result.isValid;\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { isRowField } from '../../definitions/default/row-field';\nimport { isGroupField } from '../../definitions/default/group-field';\nimport { isArrayField } from '../../definitions/default/array-field';\nimport { FieldTypeDefinition, getFieldValueHandling } from '../../models/field-type';\n\n/**\n * Represents a field definition that has been processed through the flattening algorithm.\n *\n * Guarantees that the field has a valid key property, either from the original\n * field definition or auto-generated during the flattening process.\n *\n * @public\n */\nexport interface FlattenedField extends FieldDef<unknown> {\n /** Guaranteed non-empty key for form binding and field identification */\n readonly key: string;\n}\n\n/**\n * Flattens a hierarchical field structure into a linear array for form processing.\n *\n * Handles different field types with specific flattening strategies:\n * - **Page fields**: Children are flattened and merged into the result (no wrapper)\n * - **Row fields**: Children are flattened and merged into the result (no wrapper), unless preserveRows=true\n * - **Group fields**: Maintains group structure with flattened children nested under the group key\n * - **Array fields**: Maintains array structure with flattened children nested under the array key\n * - **Other fields**: Pass through unchanged with guaranteed key generation\n *\n * Auto-generates keys for fields missing the key property to ensure form binding works correctly.\n *\n * @param fields - Array of field definitions that may contain nested structures\n * @param registry - Field type registry for determining value handling behavior\n * @param options - Configuration options for flattening behavior\n * @param options.preserveRows - When true, keep row fields in structure for DOM rendering (grid layout)\n * @returns Flattened array of field definitions with guaranteed keys\n *\n * @example\n * ```typescript\n * const hierarchicalFields = [\n * {\n * type: 'row',\n * fields: [\n * { type: 'input', key: 'firstName' },\n * { type: 'input', key: 'lastName' }\n * ]\n * },\n * {\n * type: 'group',\n * key: 'address',\n * fields: [\n * { type: 'input', key: 'street' },\n * { type: 'input', key: 'city' }\n * ]\n * }\n * ];\n *\n * const flattened = flattenFields(hierarchicalFields, registry);\n * // Result: [\n * // { type: 'input', key: 'firstName' },\n * // { type: 'input', key: 'lastName' },\n * // { type: 'group', key: 'address', fields: [...] }\n * // ]\n * ```\n *\n * @example\n * ```typescript\n * // Auto-key generation for fields without keys\n * const fieldsWithoutKeys = [\n * { type: 'input', label: 'Name' },\n * { type: 'button', label: 'Submit' }\n * ];\n *\n * const flattened = flattenFields(fieldsWithoutKeys, registry);\n * // Result: [\n * // { type: 'input', label: 'Name', key: 'auto_field_0' },\n * // { type: 'button', label: 'Submit', key: 'auto_field_1' }\n * // ]\n * ```\n *\n * @public\n */\nexport function flattenFields(\n fields: FieldDef<unknown>[],\n registry: Map<string, FieldTypeDefinition>,\n options: { preserveRows?: boolean } = {},\n): FlattenedField[] {\n const result: FlattenedField[] = [];\n let autoKeyCounter = 0;\n\n // Process each field using appropriate strategy based on field type and configuration\n for (const field of fields) {\n // Step 1: Determine how this field type should handle its value in the form\n // valueHandling can be: 'include', 'exclude', or 'flatten'\n const valueHandling = getFieldValueHandling(field.type, registry);\n\n // Step 2: Check if this is a row field that should be preserved for DOM rendering\n // Row fields need to render their container element for grid layouts to work\n if (options.preserveRows && isRowField(field)) {\n if (field.fields) {\n // Normalize field children to array format (handles both array and object syntax)\n const fieldsArray = Array.isArray(field.fields) ? field.fields : Object.values(field.fields);\n\n // Recursively flatten children while preserving row structure\n const flattenedChildren = flattenFields(fieldsArray as FieldDef<unknown>[], registry, options);\n\n // Keep the row field in the result with its flattened children\n // This allows the row component to render its container while children are flattened\n result.push({\n ...field,\n fields: flattenedChildren,\n key: field.key || `auto_row_${autoKeyCounter++}`,\n } as FlattenedField);\n }\n } else if (valueHandling === 'flatten' && 'fields' in field) {\n // Step 3: Handle fields with 'flatten' value handling (typically page/row fields)\n // These fields are pure containers - merge their children directly into the parent level\n if (field.fields) {\n const fieldsArray = Array.isArray(field.fields) ? field.fields : Object.values(field.fields);\n const flattenedChildren = flattenFields(fieldsArray as FieldDef<unknown>[], registry, options);\n\n // Spread children directly into result - the container field itself is discarded\n // This is used for page fields (form structure) and row fields (form values)\n result.push(...flattenedChildren);\n }\n } else if (isGroupField(field)) {\n // Step 4: Handle group fields - preserve structure for nested form values\n // Group fields create a nested object in the form value: { groupKey: { field1: value1, ... } }\n const childFieldsArray = Object.values(field.fields) as FieldDef<unknown>[];\n const flattenedChildren = flattenFields(childFieldsArray, registry, options);\n\n // Keep the group field with its recursively flattened children nested under its key\n result.push({\n ...field,\n fields: flattenedChildren,\n key: field.key || `auto_group_${autoKeyCounter++}`,\n } as FlattenedField);\n } else if (isArrayField(field)) {\n // Step 5: Handle array fields - preserve structure for array form values\n // Array fields create an array in the form value: { arrayKey: [item1, item2, ...] }\n const childFieldsArray = Object.values(field.fields) as FieldDef<unknown>[];\n const flattenedChildren = flattenFields(childFieldsArray, registry, options);\n\n // Keep the array field with its template definition nested under its key\n result.push({\n ...field,\n fields: flattenedChildren,\n key: field.key || `auto_array_${autoKeyCounter++}`,\n } as FlattenedField);\n } else {\n // Step 6: Handle all other fields (inputs, buttons, etc.) - pass through unchanged\n // These fields are leaf nodes that don't contain children and map directly to form controls\n const key = field.key || `auto_field_${autoKeyCounter++}`;\n result.push({\n ...field,\n key,\n } as FlattenedField);\n }\n }\n\n return result;\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { FieldWithValidation } from '../../definitions/base/field-with-validation';\nimport { LogicConfig } from '../../models/logic/logic-config';\nimport { ValidatorConfig, CustomValidatorConfig, BuiltInValidatorConfig } from '../../models/validation/validator-config';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { SchemaApplicationConfig } from '../../models/schemas/schema-definition';\nimport { hasChildFields } from '../../models/types/type-guards';\nimport {\n isCrossFieldExpression,\n isCrossFieldValidator,\n isCrossFieldBuiltInValidator,\n hasCrossFieldWhenCondition,\n isCrossFieldLogic,\n isCrossFieldSchema,\n extractExpressionDependencies,\n extractStringDependencies,\n} from './cross-field-detector';\nimport { CrossFieldValidatorEntry, CrossFieldLogicEntry, CrossFieldSchemaEntry, LogicType } from './cross-field-types';\n\n/** Collected cross-field entries from traversing field definitions. */\nexport interface CrossFieldCollection {\n validators: CrossFieldValidatorEntry[];\n logic: CrossFieldLogicEntry[];\n schemas: CrossFieldSchemaEntry[];\n}\n\n/** Creates an empty cross-field collection. */\nexport function createEmptyCollection(): CrossFieldCollection {\n return {\n validators: [],\n logic: [],\n schemas: [],\n };\n}\n\n/** Traverses field definitions and collects cross-field entries (validators, logic, schemas). */\nexport function collectCrossFieldEntries(fields: FieldDef<unknown>[]): CrossFieldCollection {\n const collection = createEmptyCollection();\n traverseFields(fields, collection);\n return collection;\n}\n\nfunction traverseFields(fields: FieldDef<unknown>[], collection: CrossFieldCollection): void {\n for (const field of fields) {\n collectFromField(field, collection);\n\n // Recursively process container fields (page, row, group, array)\n if (hasChildFields(field)) {\n const childFields = Array.isArray(field.fields) ? field.fields : Object.values(field.fields);\n traverseFields(childFields as FieldDef<unknown>[], collection);\n }\n }\n}\n\nfunction collectFromField(field: FieldDef<unknown>, collection: CrossFieldCollection): void {\n const fieldKey = field.key;\n if (!fieldKey) return;\n\n const validationField = field as FieldDef<unknown> & FieldWithValidation;\n\n // Collect cross-field validators\n if (validationField.validators) {\n for (const config of validationField.validators) {\n const entry = tryCreateValidatorEntry(fieldKey, config);\n if (entry) {\n collection.validators.push(entry);\n }\n }\n }\n\n // Collect cross-field logic\n if (validationField.logic) {\n for (const config of validationField.logic) {\n const entry = tryCreateLogicEntry(fieldKey, config);\n if (entry) {\n collection.logic.push(entry);\n }\n }\n }\n\n // Collect cross-field schemas\n if (validationField.schemas) {\n for (const config of validationField.schemas) {\n const entry = tryCreateSchemaEntry(fieldKey, config);\n if (entry) {\n collection.schemas.push(entry);\n }\n }\n }\n}\n\n/** Returns a validator entry if cross-field, null otherwise. */\nfunction tryCreateValidatorEntry(fieldKey: string, config: ValidatorConfig): CrossFieldValidatorEntry | null {\n // Check for custom validators with cross-field expressions\n if (config.type === 'custom') {\n const customConfig = config as CustomValidatorConfig;\n if (isCrossFieldValidator(customConfig)) {\n return {\n sourceFieldKey: fieldKey,\n config,\n dependsOn: extractStringDependencies(customConfig.expression || ''),\n category: 'validator',\n };\n }\n }\n\n // Check for built-in validators with cross-field dynamic expressions\n if (isCrossFieldBuiltInValidator(config)) {\n const builtInConfig = config as BuiltInValidatorConfig;\n return {\n sourceFieldKey: fieldKey,\n config: convertBuiltInToCustomValidator(builtInConfig),\n validatorType: config.type,\n dependsOn: extractStringDependencies(builtInConfig.expression || ''),\n category: 'validator',\n };\n }\n\n // Check for validators with cross-field when conditions\n if (hasCrossFieldWhenCondition(config)) {\n const whenCondition = config.when as ConditionalExpression;\n return {\n sourceFieldKey: fieldKey,\n config,\n validatorType: config.type,\n dependsOn: extractExpressionDependencies(whenCondition),\n category: 'validator',\n };\n }\n\n return null;\n}\n\n/** Returns a logic entry if cross-field, null otherwise. */\nfunction tryCreateLogicEntry(fieldKey: string, config: LogicConfig): CrossFieldLogicEntry | null {\n if (!isCrossFieldLogic(config)) {\n return null;\n }\n\n const condition = config.condition as ConditionalExpression;\n return {\n sourceFieldKey: fieldKey,\n logicType: config.type as LogicType,\n condition,\n config,\n dependsOn: extractExpressionDependencies(condition),\n category: 'logic',\n };\n}\n\n/** Returns a schema entry if cross-field, null otherwise. */\nfunction tryCreateSchemaEntry(fieldKey: string, config: SchemaApplicationConfig): CrossFieldSchemaEntry | null {\n if (!isCrossFieldSchema(config)) {\n return null;\n }\n\n const condition = config.condition as ConditionalExpression;\n return {\n sourceFieldKey: fieldKey,\n config,\n condition,\n dependsOn: extractExpressionDependencies(condition),\n category: 'schema',\n };\n}\n\n/** Converts a built-in validator with cross-field expression to a custom validator. */\nfunction convertBuiltInToCustomValidator(config: BuiltInValidatorConfig): CustomValidatorConfig {\n const expression = config.expression!;\n let validationExpression: string;\n\n switch (config.type) {\n case 'min':\n validationExpression = `fieldValue == null || fieldValue >= (${expression})`;\n break;\n case 'max':\n validationExpression = `fieldValue == null || fieldValue <= (${expression})`;\n break;\n case 'minLength':\n validationExpression = `fieldValue == null || (typeof fieldValue !== 'string' && !Array.isArray(fieldValue)) || fieldValue.length >= (${expression})`;\n break;\n case 'maxLength':\n validationExpression = `fieldValue == null || (typeof fieldValue !== 'string' && !Array.isArray(fieldValue)) || fieldValue.length <= (${expression})`;\n break;\n case 'pattern':\n validationExpression = `fieldValue == null || new RegExp(${expression}).test(fieldValue)`;\n break;\n default:\n throw new Error(`Cannot convert ${config.type} validator to custom validator`);\n }\n\n return {\n type: 'custom',\n expression: validationExpression,\n kind: config.type,\n when: config.when,\n errorParams: {\n [config.type]: expression,\n },\n };\n}\n","import { detectFormMode, FormModeDetectionResult, isPageField } from '../../models/types/form-mode';\nimport { RegisteredFieldTypes } from '../../models/registry';\nimport { validatePageNesting } from '../../definitions/default/page-field';\n\n/**\n * Comprehensive form configuration validator that checks:\n * 1. Form mode consistency (paged vs non-paged)\n * 2. Page nesting rules\n * 3. Field placement constraints\n */\nexport class FormModeValidator {\n /**\n * Validates a form configuration and returns detailed validation results\n * @param fields The form field definitions to validate\n * @returns Validation result with mode detection and error details\n */\n static validateFormConfiguration<TFields extends RegisteredFieldTypes[]>(fields: TFields): FormConfigurationValidationResult {\n const modeDetection = detectFormMode(fields);\n const additionalErrors: string[] = [];\n\n // Additional validation for paged forms\n if (modeDetection.mode === 'paged' && modeDetection.isValid) {\n // Validate each page field individually\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i];\n if (isPageField(field)) {\n if (!validatePageNesting(field)) {\n additionalErrors.push(\n `Page field at index ${i} (key: \"${field.key || 'unknown'}\") contains nested page fields, which is not allowed.`,\n );\n }\n }\n }\n }\n\n const allErrors = [...modeDetection.errors, ...additionalErrors];\n const isFullyValid = modeDetection.isValid && additionalErrors.length === 0;\n\n return {\n mode: modeDetection.mode,\n isValid: isFullyValid,\n errors: allErrors,\n warnings: this.generateWarnings(fields, modeDetection),\n };\n }\n\n /**\n * Validates form configuration and throws an error if invalid\n * @param fields The form field definitions to validate\n * @throws Error with detailed validation messages if form is invalid\n */\n static validateFormConfigurationOrThrow<TFields extends RegisteredFieldTypes[]>(fields: TFields): void {\n const result = this.validateFormConfiguration(fields);\n\n if (!result.isValid) {\n const errorMessage = [\n `[Dynamic Forms] Invalid form configuration (${result.mode} mode):`,\n ...result.errors.map((error) => ` - ${error}`),\n ].join('\\n');\n\n throw new Error(errorMessage);\n }\n }\n\n /**\n * Generates helpful warnings for form configurations\n * @param fields The form field definitions\n * @param modeDetection The mode detection result\n * @returns Array of warning messages\n */\n private static generateWarnings<TFields extends RegisteredFieldTypes[]>(\n fields: TFields,\n modeDetection: FormModeDetectionResult,\n ): string[] {\n const warnings: string[] = [];\n\n // Warn about single page forms\n if (modeDetection.mode === 'paged' && fields.length === 1) {\n warnings.push('Single page form detected. Consider using non-paged mode for better performance if page navigation is not needed.');\n }\n\n // Warn about empty pages\n if (modeDetection.mode === 'paged') {\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i];\n if (isPageField(field)) {\n if (!field.fields || field.fields.length === 0) {\n warnings.push(`Page field at index ${i} (key: \"${field.key || 'unknown'}\") contains no fields and will render as empty.`);\n }\n }\n }\n }\n\n return warnings;\n }\n}\n\n/**\n * Extended validation result including warnings\n */\nexport interface FormConfigurationValidationResult extends FormModeDetectionResult {\n /** Array of warning messages that don't prevent form operation */\n warnings: string[];\n}\n\n/**\n * Convenience function for quick form mode validation\n * @param fields The form field definitions to validate\n * @returns True if form configuration is valid, false otherwise\n */\nexport function isValidFormConfiguration<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n return FormModeValidator.validateFormConfiguration(fields).isValid;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class NextPageEvent implements FormEvent {\n readonly type = 'next-page' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class PageChangeEvent implements FormEvent {\n readonly type = 'page-change' as const;\n\n constructor(\n /** The current page index (0-based) */\n public readonly currentPageIndex: number,\n /** Total number of pages */\n public readonly totalPages: number,\n /** Previous page index (0-based), undefined if first navigation */\n public readonly previousPageIndex?: number,\n ) {}\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class PreviousPageEvent implements FormEvent {\n readonly type = 'previous-page' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\nimport { ArrayAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Event dispatched to add a new item to an array field.\n *\n * This event is used to dynamically add items to array fields at runtime.\n * The array field component listens for this event and adds a new item\n * based on the provided field template, or uses the array's own template if not provided.\n *\n * @example\n * ```typescript\n * // Add item using array's own template\n * eventBus.dispatch(AddArrayItemEvent, 'contacts');\n *\n * // Add item with explicit field template\n * const fieldTemplate = { key: 'email', type: 'input' };\n * eventBus.dispatch(AddArrayItemEvent, 'contacts', fieldTemplate);\n *\n * // Add item at specific index\n * eventBus.dispatch(AddArrayItemEvent, 'contacts', fieldTemplate, 2);\n * ```\n */\nexport class AddArrayItemEvent implements FormEvent {\n readonly type = 'add-array-item' as const;\n\n constructor(\n /** The key of the array field to add an item to */\n public readonly arrayKey: string,\n /**\n * Optional field template definition to render for the new array item.\n * If not provided, the array field component will use its own template.\n */\n public readonly field?: ArrayAllowedChildren,\n /** Optional index where to insert the item (defaults to end of array) */\n public readonly index?: number,\n ) {}\n}\n","import { FormEvent } from '../interfaces/form-event';\n\n/**\n * Event dispatched to remove an item from an array field.\n *\n * This event is used to dynamically remove items from array fields at runtime.\n * The array field component listens for this event and removes the item\n * at the specified index.\n *\n * @example\n * ```typescript\n * // Remove item at index 1 from 'contacts' array\n * eventBus.dispatch(RemoveArrayItemEvent, 'contacts', 1);\n *\n * // Remove last item\n * eventBus.dispatch(RemoveArrayItemEvent, 'contacts');\n * ```\n */\nexport class RemoveArrayItemEvent implements FormEvent {\n readonly type = 'remove-array-item' as const;\n\n constructor(\n /** The key of the array field to remove an item from */\n public readonly arrayKey: string,\n /** Index of the item to remove (defaults to last item) */\n public readonly index?: number,\n ) {}\n}\n","import { FormEvent } from '../interfaces/form-event';\n\n/**\n * Event dispatched when the form should be reset to its default values.\n *\n * This event instructs the dynamic form component to restore all field values\n * to their initial default values as defined in the form configuration.\n *\n * @example\n * ```typescript\n * // Dispatch from a button component\n * eventBus.dispatch(FormResetEvent);\n * ```\n *\n * @example\n * ```typescript\n * // Listen for reset events\n * eventBus.on<FormResetEvent>('form-reset').subscribe(() => {\n * console.log('Form was reset to defaults');\n * });\n * ```\n */\nexport class FormResetEvent implements FormEvent {\n readonly type = 'form-reset' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\n/**\n * Event dispatched when the form should be cleared.\n *\n * This event instructs the dynamic form component to clear all field values,\n * resetting them to empty/undefined state regardless of their default values.\n *\n * @example\n * ```typescript\n * // Dispatch from a button component\n * eventBus.dispatch(FormClearEvent);\n * ```\n *\n * @example\n * ```typescript\n * // Listen for clear events\n * eventBus.on<FormClearEvent>('form-clear').subscribe(() => {\n * console.log('Form was cleared');\n * });\n * ```\n */\nexport class FormClearEvent implements FormEvent {\n readonly type = 'form-clear' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\nimport { PageOrchestratorState } from '../../core/page-orchestrator/page-orchestrator.interfaces';\n\nexport class PageNavigationStateChangeEvent implements FormEvent {\n type = 'page-navigation-state-change' as const;\n\n constructor(public state: PageOrchestratorState) {}\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { EventBus } from '../../events/event.bus';\nimport { NextPageEvent, PageChangeEvent, PreviousPageEvent } from '../../events/constants';\nimport { NavigationResult, PageOrchestratorState } from './page-orchestrator.interfaces';\nimport { PageField, PageLogicConfig } from '../../definitions/default/page-field';\nimport { FieldSignalContext } from '../../mappers/types';\nimport PageFieldComponent from '../../fields/page/page-field.component';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { PageNavigationStateChangeEvent } from '../../events/constants/page-navigation-state-change.event';\nimport { FieldTree } from '@angular/forms/signals';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { RootFormRegistryService } from '../registry/root-form-registry.service';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { evaluateCondition } from '../expressions/condition-evaluator';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { FunctionRegistryService } from '../registry/function-registry.service';\n\n/**\n * PageOrchestrator manages page navigation and visibility for paged forms.\n * It acts as an intermediary between the DynamicForm component and PageField components,\n * handling page state management and navigation events without interfering with form data.\n *\n * This component uses declarative rendering with @defer blocks for optimal performance,\n * ensuring that non-visible pages are lazily loaded only when needed.\n *\n * Key responsibilities:\n * - Manage current page index state\n * - Handle navigation events (next/previous)\n * - Declaratively render pages with deferred loading\n * - Emit page change events\n * - Validate navigation boundaries\n *\n * @example\n * ```html\n * <div page-orchestrator\n * [pageFields]=\"pageFields\"\n * [form]=\"form\"\n * [fieldSignalContext]=\"fieldSignalContext\"\n * [config]=\"orchestratorConfig\"\n * (pageChanged)=\"onPageChanged($event)\"\n * (navigationStateChanged)=\"onNavigationStateChanged($event)\">\n * </div>\n * ```\n */\n@Component({\n selector: 'div[page-orchestrator]',\n imports: [PageFieldComponent],\n template: `\n @for (pageField of pageFields(); track pageField.key; let i = $index) {\n @if (i === state().currentPageIndex || i === state().currentPageIndex + 1 || i === state().currentPageIndex - 1) {\n <!-- Current and adjacent pages (±1): render immediately for flicker-free navigation -->\n @defer (on immediate) {\n <section\n page-field\n [field]=\"pageField\"\n [key]=\"pageField.key\"\n [pageIndex]=\"i\"\n [isVisible]=\"i === state().currentPageIndex\"\n ></section>\n } @placeholder {\n <div class=\"df-page-placeholder\" [attr.data-page-index]=\"i\" [attr.data-page-key]=\"pageField.key\"></div>\n }\n } @else {\n <!-- Distant pages: defer until browser is idle for memory savings -->\n @defer (on idle) {\n <section page-field [field]=\"pageField\" [key]=\"pageField.key\" [pageIndex]=\"i\" [isVisible]=\"false\"></section>\n } @placeholder {\n <div class=\"df-page-placeholder\" [attr.data-page-index]=\"i\" [attr.data-page-key]=\"pageField.key\"></div>\n }\n }\n }\n `,\n styleUrl: './page-orchestrator.component.scss',\n host: {\n class: 'df-page-orchestrator',\n '[attr.data-current-page]': 'state().currentPageIndex',\n '[attr.data-total-pages]': 'state().totalPages',\n },\n providers: [\n {\n provide: FIELD_SIGNAL_CONTEXT,\n useFactory: (orchestrator: PageOrchestratorComponent) => orchestrator.extendedFieldSignalContext(),\n deps: [PageOrchestratorComponent],\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PageOrchestratorComponent {\n private readonly eventBus = inject(EventBus);\n private readonly rootFormRegistry = inject(RootFormRegistryService);\n private readonly functionRegistry = inject(FunctionRegistryService);\n\n /**\n * Array of page field definitions to render\n */\n pageFields = input.required<PageField[]>();\n\n /**\n * Root form instance from parent DynamicForm\n */\n form = input.required<FieldTree<any>>();\n\n /**\n * Field signal context for child fields\n */\n fieldSignalContext = input.required<FieldSignalContext>();\n\n /**\n * Computed signal that tracks which pages are hidden.\n * Returns an array of booleans where true means the page is hidden.\n * This signal is reactive and will re-evaluate when form values change.\n */\n readonly pageHiddenStates = computed(() => {\n const pages = this.pageFields();\n const formValue = this.rootFormRegistry.getFormValue();\n\n return pages.map((page) => this.evaluatePageHidden(page, formValue));\n });\n\n /**\n * Computed signal that returns indices of visible (non-hidden) pages.\n * This is used for navigation to skip hidden pages.\n */\n readonly visiblePageIndices = computed(() => {\n const hiddenStates = this.pageHiddenStates();\n return hiddenStates\n .map((hidden, index) => ({ index, hidden }))\n .filter((item) => !item.hidden)\n .map((item) => item.index);\n });\n\n /**\n * Internal signal for current page index that tracks with page fields.\n * This tracks the actual page index, not the visible page index.\n *\n * Note: We only track pageFields().length to handle page additions/removals.\n * The hidden state changes should NOT reset the current page index -\n * that would cause unwanted navigation when form values change.\n */\n private readonly currentPageIndex = linkedSignal(() => {\n const totalPages = this.pageFields().length;\n\n if (totalPages === 0) return 0;\n\n // Start on page 0 (will be adjusted if page 0 is hidden by initial navigation)\n return 0;\n });\n\n /**\n * Computed state for the orchestrator\n */\n readonly state = computed<PageOrchestratorState>(() => {\n const currentIndex = this.currentPageIndex();\n const totalPages = this.pageFields().length;\n const visibleIndices = this.visiblePageIndices();\n\n // Find where the current index is in the visible pages list\n const currentVisiblePosition = visibleIndices.indexOf(currentIndex);\n const isFirstVisiblePage = currentVisiblePosition === 0 || currentVisiblePosition === -1;\n const isLastVisiblePage = currentVisiblePosition >= visibleIndices.length - 1;\n\n return {\n currentPageIndex: currentIndex,\n totalPages,\n isFirstPage: isFirstVisiblePage,\n isLastPage: isLastVisiblePage,\n navigationDisabled: false,\n };\n });\n\n /**\n * Signal indicating whether all fields on the current page are valid.\n *\n * This is used by next page buttons to determine their disabled state.\n * Returns `true` if all fields on the current page pass validation,\n * `false` otherwise.\n *\n * @returns `true` if current page is valid, `false` otherwise\n */\n readonly currentPageValid = computed(() => {\n const currentIndex = this.currentPageIndex();\n const pages = this.pageFields();\n const form = this.form();\n\n // No pages or invalid index\n if (pages.length === 0 || currentIndex >= pages.length) {\n return true;\n }\n\n const currentPage = pages[currentIndex];\n const pageFields = currentPage.fields || [];\n\n // Check validity of each field on the current page\n // Fields are stored at root level in the form (pages don't add nesting)\n for (const fieldDef of pageFields) {\n const fieldKey = fieldDef.key;\n if (!fieldKey) continue;\n\n // Access the field from the form using dynamic key access\n const field = (form as Record<string, unknown>)[fieldKey];\n if (field && typeof field === 'function') {\n const fieldState = (field as () => { valid: () => boolean })();\n if (fieldState && typeof fieldState.valid === 'function' && !fieldState.valid()) {\n return false;\n }\n }\n }\n\n return true;\n });\n\n /**\n * Extended field signal context that includes currentPageValid.\n *\n * This extends the parent context from DynamicForm with page-specific\n * information needed by button mappers (e.g., next button needs to know\n * if the current page is valid).\n */\n readonly extendedFieldSignalContext = computed(() => ({\n ...this.fieldSignalContext(),\n currentPageValid: this.currentPageValid,\n }));\n\n constructor() {\n // Setup event listeners for navigation\n this.setupEventListeners();\n }\n\n /**\n * Navigate to the next visible page, skipping hidden pages.\n * @returns Navigation result\n */\n navigateToNextPage(): NavigationResult {\n const currentState = this.state();\n const visibleIndices = this.visiblePageIndices();\n\n if (currentState.isLastPage) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Already on the last visible page',\n };\n }\n\n if (currentState.navigationDisabled) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Navigation is currently disabled',\n };\n }\n\n // Find the next visible page after the current index\n const currentVisiblePosition = visibleIndices.indexOf(currentState.currentPageIndex);\n if (currentVisiblePosition === -1 || currentVisiblePosition >= visibleIndices.length - 1) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'No next visible page available',\n };\n }\n\n const nextVisiblePageIndex = visibleIndices[currentVisiblePosition + 1];\n return this.navigateToPage(nextVisiblePageIndex);\n }\n\n /**\n * Navigate to the previous visible page, skipping hidden pages.\n * @returns Navigation result\n */\n navigateToPreviousPage(): NavigationResult {\n const currentState = this.state();\n const visibleIndices = this.visiblePageIndices();\n\n if (currentState.isFirstPage) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Already on the first visible page',\n };\n }\n\n if (currentState.navigationDisabled) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Navigation is currently disabled',\n };\n }\n\n // Find the previous visible page before the current index\n const currentVisiblePosition = visibleIndices.indexOf(currentState.currentPageIndex);\n if (currentVisiblePosition <= 0) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'No previous visible page available',\n };\n }\n\n const prevVisiblePageIndex = visibleIndices[currentVisiblePosition - 1];\n return this.navigateToPage(prevVisiblePageIndex);\n }\n\n /**\n * Navigate to a specific page index\n * @param pageIndex The target page index (0-based)\n * @returns Navigation result\n */\n navigateToPage(pageIndex: number): NavigationResult {\n const currentState = this.state();\n const totalPages = currentState.totalPages;\n\n // Validate page index\n if (pageIndex < 0 || pageIndex >= totalPages) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: `Invalid page index: ${pageIndex}. Valid range is 0 to ${totalPages - 1}`,\n };\n }\n\n // Check if already on target page\n if (pageIndex === currentState.currentPageIndex) {\n return {\n success: true,\n newPageIndex: pageIndex,\n };\n }\n\n // Perform navigation\n const previousIndex = currentState.currentPageIndex;\n this.currentPageIndex.set(pageIndex);\n\n // Emit page change event\n this.eventBus.dispatch(PageChangeEvent, pageIndex, totalPages, previousIndex);\n\n return {\n success: true,\n newPageIndex: pageIndex,\n };\n }\n\n /**\n * Set up event listeners for navigation events\n */\n private setupEventListeners(): void {\n // Listen for next page events\n this.eventBus\n .on<NextPageEvent>('next-page')\n .pipe(takeUntilDestroyed())\n .subscribe(() => {\n this.navigateToNextPage();\n });\n\n // Listen for previous page events\n this.eventBus\n .on<PreviousPageEvent>('previous-page')\n .pipe(takeUntilDestroyed())\n .subscribe(() => {\n this.navigateToPreviousPage();\n });\n\n explicitEffect([this.state], ([state]) => this.eventBus.dispatch(PageNavigationStateChangeEvent, state));\n }\n\n /**\n * Evaluates whether a page should be hidden based on its logic configuration.\n * A page is hidden if ANY of its hidden logic conditions evaluate to true.\n *\n * @param page The page field to evaluate\n * @param formValue The current form value to evaluate against\n * @returns true if the page should be hidden, false otherwise\n */\n private evaluatePageHidden(page: PageField, formValue: unknown): boolean {\n // If no logic defined, page is visible\n if (!page.logic || page.logic.length === 0) {\n return false;\n }\n\n // Filter to only hidden logic (pages only support hidden type)\n const hiddenLogic = page.logic.filter((l): l is PageLogicConfig => l.type === 'hidden');\n\n // If no hidden logic, page is visible\n if (hiddenLogic.length === 0) {\n return false;\n }\n\n // Check each hidden logic - if ANY condition is true, the page is hidden\n for (const logic of hiddenLogic) {\n // Handle static boolean conditions\n if (typeof logic.condition === 'boolean') {\n if (logic.condition) {\n return true;\n }\n continue;\n }\n\n // Evaluate conditional expression\n const condition = logic.condition as ConditionalExpression;\n const context: EvaluationContext = {\n fieldValue: null, // Pages don't have field values\n formValue: (formValue ?? {}) as Record<string, unknown>,\n fieldPath: page.key || '',\n customFunctions: this.functionRegistry.getCustomFunctions(),\n };\n\n if (evaluateCondition(condition, context)) {\n return true;\n }\n }\n\n return false;\n }\n}\n","import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n inject,\n Injector,\n input,\n InputSignal,\n linkedSignal,\n model,\n OnDestroy,\n runInInjectionContext,\n signal,\n Signal,\n untracked,\n} from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { form } from '@angular/forms/signals';\nimport { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { EMPTY, forkJoin, map, of, pipe, scan, switchMap } from 'rxjs';\nimport { derivedFromDeferred } from './utils/derived-from-deferred/derived-from-deferred';\nimport { reconcileFields, ResolvedField, resolveField } from './utils/resolve-field/resolve-field';\nimport { createSubmissionHandler } from './utils/submission-handler/submission-handler';\nimport { keyBy, memoize, isEqual } from './utils/object-utils';\nimport { FIELD_SIGNAL_CONTEXT } from './models/field-signal-context.token';\nimport { FieldTypeDefinition } from './models/field-type';\nimport { FormConfig, FormOptions } from './models/form-config';\nimport { RegisteredFieldTypes } from './models/registry/field-registry';\nimport { injectFieldRegistry } from './utils/inject-field-registry/inject-field-registry';\nimport { createSchemaFromFields } from './core/schema-builder';\nimport { EventBus } from './events/event.bus';\nimport { SubmitEvent } from './events/constants/submit.event';\nimport { ComponentInitializedEvent } from './events/constants/component-initialized.event';\nimport { setupInitializationTracking } from './utils/initialization-tracker/initialization-tracker';\nimport { FormMode, InferFormValue, isContainerField } from './models/types';\nimport { flattenFields } from './utils/flattener/field-flattener';\nimport { FieldDef } from './definitions/base/field-def';\nimport { isPageField, PageField } from './definitions/default/page-field';\nimport { getFieldDefaultValue } from './utils/default-value/default-value';\nimport { FieldSignalContext } from './mappers/types';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { FieldContextRegistryService, FunctionRegistryService, RootFormRegistryService, SchemaRegistryService } from './core/registry';\nimport { detectFormMode, FormModeDetectionResult } from './models/types/form-mode';\nimport { collectCrossFieldEntries } from './core/cross-field/cross-field-collector';\nimport { FormModeValidator } from './utils/form-validation/form-mode-validator';\nimport { PageOrchestratorComponent } from './core/page-orchestrator';\nimport { FormClearEvent } from './events/constants/form-clear.event';\nimport { FormResetEvent } from './events/constants/form-reset.event';\nimport { PageChangeEvent } from './events/constants/page-change.event';\nimport { PageNavigationStateChangeEvent } from './events/constants/page-navigation-state-change.event';\n\n/**\n * Dynamic form component that renders a complete form based on configuration.\n *\n * This is the main entry point for the dynamic form system. It handles form state management,\n * validation, field rendering, and event coordination using Angular's signal-based reactive forms.\n *\n * @typeParam TFields - Array of registered field types available for this form\n * @typeParam TModel - The strongly-typed interface for form values\n *\n * @example\n *```html\n * <form\n * [dynamic-form]=\"formConfig\"\n * [(value)]=\"formData\"\n * (submitted)=\"handleSubmit($event)\"\n * (validityChange)=\"handleValidityChange($event)\">\n * </form>\n * ```\n */\n@Component({\n selector: 'form[dynamic-form]',\n imports: [NgComponentOutlet, PageOrchestratorComponent],\n template: `\n @if (formModeDetection().mode === 'paged') {\n <div page-orchestrator [pageFields]=\"pageFieldDefinitions()\" [form]=\"$any(form())\" [fieldSignalContext]=\"fieldSignalContext()\"></div>\n } @else {\n @for (field of resolvedFields(); track field.key) {\n <ng-container *ngComponentOutlet=\"field.component; injector: field.injector; inputs: field.inputs()\" />\n }\n }\n <!-- Live region for screen reader announcements -->\n <div class=\"df-live-region\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ errorAnnouncement() }}</div>\n `,\n styleUrl: './dynamic-form.component.scss',\n providers: [EventBus, SchemaRegistryService, FunctionRegistryService, RootFormRegistryService, FieldContextRegistryService],\n host: {\n class: 'df-dynamic-form df-form',\n '[class.disabled]': 'disabled()',\n '[class.df-form-paged]': 'formModeDetection().mode === \"paged\"',\n '[class.df-form-non-paged]': 'formModeDetection().mode === \"non-paged\"',\n '[attr.data-form-mode]': 'formModeDetection().mode',\n '(submit)': 'onNativeSubmit($event)',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[], TModel = InferFormValue<TFields>>\n implements OnDestroy\n{\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly injector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n private readonly rootFormRegistry = inject(RootFormRegistryService);\n private readonly functionRegistry = inject(FunctionRegistryService);\n private readonly schemaRegistry = inject(SchemaRegistryService);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Form configuration defining the structure, validation, and behavior. */\n config: InputSignal<FormConfig<TFields>> = input.required<FormConfig<TFields>>({ alias: 'dynamic-form' });\n\n /** Runtime form options that override config options when provided. */\n formOptions = input<FormOptions | undefined>(undefined);\n\n /** Form values for two-way data binding. */\n value = model<Partial<TModel> | undefined>(undefined);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Memoized Functions\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly memoizedFlattenFields = memoize(\n (fields: FieldDef<unknown>[], registry: Map<string, FieldTypeDefinition>) => flattenFields(fields, registry),\n (fields, registry) => {\n const fieldKeys = fields.map((f) => `${f.key || ''}:${f.type}`).join('|');\n const registryKeys = Array.from(registry.keys()).sort().join('|');\n return `${fieldKeys}__${registryKeys}`;\n },\n );\n\n private readonly memoizedFlattenFieldsForRendering = memoize(\n (fields: FieldDef<unknown>[], registry: Map<string, FieldTypeDefinition>) => flattenFields(fields, registry, { preserveRows: true }),\n (fields, registry) => {\n const fieldKeys = fields.map((f) => `${f.key || ''}:${f.type}`).join('|');\n const registryKeys = Array.from(registry.keys()).sort().join('|');\n return `render_${fieldKeys}__${registryKeys}`;\n },\n );\n\n private readonly memoizedKeyBy = memoize(\n <T extends { key: string }>(fields: T[]) => keyBy(fields, 'key'),\n (fields) => fields.map((f) => f.key).join('|'),\n );\n\n private readonly memoizedDefaultValues = memoize(\n <T extends FieldDef<unknown>>(fieldsById: Record<string, T>, registry: Map<string, FieldTypeDefinition>) => {\n const result: Record<string, unknown> = {};\n for (const [key, field] of Object.entries(fieldsById)) {\n const value = getFieldDefaultValue(field, registry);\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result as TModel;\n },\n (fieldsById, registry) => {\n const fieldKeys = Object.keys(fieldsById).sort().join('|');\n const registryKeys = Array.from(registry.keys()).sort().join('|');\n return `defaults_${fieldKeys}__${registryKeys}`;\n },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n readonly formModeDetection = computed<FormModeDetectionResult>(() => {\n const config = this.config();\n const fields = config.fields || [];\n const detection = detectFormMode(fields);\n const validation = FormModeValidator.validateFormConfiguration(fields);\n\n if (!validation.isValid) {\n console.error('[Dynamic Forms] Invalid form configuration:', validation.errors);\n }\n\n if (validation.warnings.length > 0) {\n console.warn('[Dynamic Forms] Form configuration warnings:', validation.warnings);\n }\n\n return detection;\n });\n\n private readonly formSetup = computed(() => {\n const config = this.config();\n const modeDetection = this.formModeDetection();\n const registry = this.rawFieldRegistry();\n\n this.registerValidatorsFromConfig(config);\n\n if (config.fields && config.fields.length > 0) {\n return this.createFormSetupFromConfig(config.fields, modeDetection.mode, registry);\n }\n\n return this.createEmptyFormSetup(registry);\n });\n\n readonly pageFieldDefinitions = computed(() => {\n const config = this.config();\n const mode = this.formModeDetection().mode;\n\n if (mode === 'paged' && config.fields) {\n return config.fields.filter(isPageField);\n }\n\n return [] as PageField[];\n });\n\n readonly effectiveFormOptions = computed(() => {\n const config = this.config();\n const configOptions = config.options || {};\n const inputOptions = this.formOptions();\n return { ...configOptions, ...inputOptions };\n });\n\n readonly fieldSignalContext = computed<FieldSignalContext<TModel>>(() => ({\n injector: this.injector,\n value: this.value,\n defaultValues: this.defaultValues,\n form: this.form(),\n defaultValidationMessages: this.config().defaultValidationMessages,\n formOptions: this.effectiveFormOptions(),\n }));\n\n private readonly fieldInjector = computed(() =>\n Injector.create({\n parent: this.injector,\n providers: [\n {\n provide: FIELD_SIGNAL_CONTEXT,\n useValue: this.fieldSignalContext(),\n },\n ],\n }),\n );\n\n readonly defaultValues = linkedSignal(() => this.formSetup().defaultValues);\n\n private readonly entity = linkedSignal(() => {\n const inputValue = this.value();\n const defaults = this.defaultValues();\n const setup = this.formSetup();\n\n const combined = { ...defaults, ...inputValue };\n\n if (setup.schemaFields && setup.schemaFields.length > 0) {\n const validKeys = new Set(setup.schemaFields.map((field) => field.key).filter((key: string | undefined) => key !== undefined));\n const filtered: Record<string, unknown> = {};\n for (const key of Object.keys(combined)) {\n if (validKeys.has(key)) {\n filtered[key] = (combined as Record<string, unknown>)[key];\n }\n }\n return filtered as TModel;\n }\n\n return combined as TModel;\n });\n\n readonly form = computed<ReturnType<typeof form<TModel>>>(() => {\n return runInInjectionContext(this.injector, () => {\n const setup = this.formSetup();\n let formInstance: ReturnType<typeof form<TModel>>;\n\n untracked(() => this.rootFormRegistry.registerFormValueSignal(this.entity as Signal<Record<string, unknown>>));\n\n if (setup.schemaFields && setup.schemaFields.length > 0) {\n const crossFieldCollection = collectCrossFieldEntries(setup.schemaFields as FieldDef<unknown>[]);\n const schema = createSchemaFromFields(setup.schemaFields, setup.registry, crossFieldCollection.validators);\n formInstance = untracked(() => form(this.entity, schema));\n } else {\n formInstance = untracked(() => form(this.entity));\n }\n\n untracked(() => this.rootFormRegistry.registerRootForm(formInstance));\n\n return formInstance;\n });\n });\n\n private readonly componentId = 'dynamic-form';\n\n private readonly totalComponentsCount = computed(() => {\n const fields = this.formSetup().fields;\n if (!fields) {\n return 1;\n }\n\n const registry = this.rawFieldRegistry();\n const flatFields = flattenFields(fields, registry);\n const componentCount = flatFields.filter(isContainerField).length;\n\n return componentCount + 1;\n });\n\n private readonly fieldsSource = computed(() => this.formSetup().fields);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public State Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Collects errors from async field component loading for error boundary patterns. */\n readonly fieldLoadingErrors = signal<Array<{ fieldType: string; fieldKey: string; error: Error }>>([]);\n\n /** Current form values (reactive). */\n readonly formValue = computed(() => this.form()().value());\n\n /** Whether the form is currently valid. */\n readonly valid = computed(() => this.form()().valid());\n\n /** Whether the form is currently invalid. */\n readonly invalid = computed(() => this.form()().invalid());\n\n /** Whether any form field has been modified. */\n readonly dirty = computed(() => this.form()().dirty());\n\n /** Whether any form field has been touched (blurred). */\n readonly touched = computed(() => this.form()().touched());\n\n /** Current validation errors from all fields. */\n readonly errors = computed(() => this.form()().errors());\n\n /** Whether the form is disabled (from options or form state). */\n readonly disabled = computed(() => {\n const optionsDisabled = this.effectiveFormOptions().disabled;\n const formDisabled = this.form()().disabled();\n return optionsDisabled ?? formDisabled;\n });\n\n /** Whether the form is currently submitting. */\n readonly submitting = computed(() => this.form()().submitting());\n\n /**\n * Announcement message for screen readers.\n * Updates when form submission fails due to validation errors.\n */\n readonly errorAnnouncement = signal<string>('');\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Initialization\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly initialized$ = setupInitializationTracking({\n eventBus: this.eventBus,\n totalComponentsCount: this.totalComponentsCount,\n injector: this.injector,\n componentId: this.componentId,\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Outputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Emits when form validity changes. */\n readonly validityChange = outputFromObservable(toObservable(this.valid));\n\n /** Emits when form dirty state changes. */\n readonly dirtyChange = outputFromObservable(toObservable(this.dirty));\n\n /**\n * Emits form values when submitted (via SubmitEvent).\n * Note: Does not emit when `submission.action` is configured - use one or the other.\n */\n readonly submitted = outputFromObservable(\n this.eventBus.on<SubmitEvent>('submit').pipe(\n switchMap(() => {\n const submissionConfig = this.config().submission;\n\n if (submissionConfig?.action) {\n console.warn(\n '[Dynamic Forms] Both `submission.action` and `(submitted)` output are configured. ' +\n 'When using `submission.action`, the `(submitted)` output will not emit. ' +\n 'Use either `submission.action` OR `(submitted)`, not both.',\n );\n return EMPTY;\n }\n\n return of(this.value());\n }),\n ),\n );\n\n /** Emits when form is reset to default values. */\n readonly reset = outputFromObservable(this.eventBus.on<FormResetEvent>('form-reset'));\n\n /** Emits when form is cleared to empty state. */\n readonly cleared = outputFromObservable(this.eventBus.on<FormClearEvent>('form-clear'));\n\n /** Emits all form events for custom event handling. */\n readonly events = outputFromObservable(this.eventBus.events$);\n\n /**\n * Emits when all form components are initialized and ready for interaction.\n * Useful for E2E testing to ensure the form is fully rendered before interaction.\n */\n readonly initialized = outputFromObservable(this.initialized$);\n\n /** Emits when the current page changes in paged forms. */\n readonly onPageChange = outputFromObservable(this.eventBus.on<PageChangeEvent>('page-change'));\n\n /** Emits when page navigation state changes (canGoNext, canGoPrevious, etc.). */\n readonly onPageNavigationStateChange = outputFromObservable(\n this.eventBus.on<PageNavigationStateChangeEvent>('page-navigation-state-change'),\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Field Resolution\n // ─────────────────────────────────────────────────────────────────────────────\n\n protected readonly resolvedFields = derivedFromDeferred(\n this.fieldsSource,\n pipe(\n switchMap((fields) => {\n if (!fields || fields.length === 0) {\n return of([] as (ResolvedField | undefined)[]);\n }\n const context = {\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n registry: this.rawFieldRegistry(),\n injector: this.fieldInjector(),\n destroyRef: this.destroyRef,\n onError: (fieldDef: FieldDef<unknown>, error: unknown) => {\n const fieldKey = fieldDef.key || '<no key>';\n this.fieldLoadingErrors.update((errors) => [\n ...errors,\n {\n fieldType: fieldDef.type,\n fieldKey,\n error: error instanceof Error ? error : new Error(String(error)),\n },\n ]);\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${fieldDef.type}' (key: ${fieldKey}). ` +\n `Ensure the field type is registered in your field registry.`,\n error,\n );\n },\n };\n return forkJoin(fields.map((f) => resolveField(f, context)));\n }),\n map((fields) => fields.filter((f): f is ResolvedField => f !== undefined)),\n scan(reconcileFields, [] as ResolvedField[]),\n ),\n { initialValue: [] as ResolvedField[], injector: this.injector },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Effects\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly syncEntityToValue = explicitEffect([this.entity], ([currentEntity]) => {\n const currentValue = this.value();\n if (!isEqual(currentEntity, currentValue)) {\n this.value.set(currentEntity);\n }\n });\n\n private readonly clearErrorsOnConfigChange = explicitEffect([this.config], () => {\n this.fieldLoadingErrors.set([]);\n });\n\n private readonly emitPagedFormInitialized = explicitEffect([this.formModeDetection, this.pageFieldDefinitions], ([{ mode }, pages]) => {\n if (mode === 'paged' && pages.length > 0) {\n this.eventBus.dispatch(ComponentInitializedEvent, 'dynamic-form', this.componentId);\n }\n });\n\n private readonly emitNonPagedFormInitialized = explicitEffect([this.resolvedFields, this.formModeDetection], ([fields, { mode }]) => {\n if (mode === 'non-paged' && fields.length > 0) {\n afterNextRender(\n () => {\n this.eventBus.dispatch(ComponentInitializedEvent, 'dynamic-form', this.componentId);\n },\n { injector: this.injector },\n );\n }\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Event Handlers\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly handleFormReset = this.eventBus\n .on<FormResetEvent>('form-reset')\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.onFormReset());\n\n private readonly handleFormClear = this.eventBus\n .on<FormClearEvent>('form-clear')\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.onFormClear());\n\n /**\n * Announces form validation errors to screen readers when submission is attempted\n * on an invalid form.\n */\n private readonly handleErrorAnnouncement = this.eventBus\n .on<SubmitEvent>('submit')\n .pipe(takeUntilDestroyed())\n .subscribe(() => {\n const formState = this.form()();\n if (formState.invalid()) {\n const errorCount = this.countErrors(formState.errors());\n const message =\n errorCount === 1\n ? 'Form submission failed. Please fix 1 validation error before submitting.'\n : `Form submission failed. Please fix ${errorCount} validation errors before submitting.`;\n // Clear first to ensure screen readers announce even if message is the same\n this.errorAnnouncement.set('');\n // Use setTimeout to ensure the clear is processed before the new message\n setTimeout(() => this.errorAnnouncement.set(message), 50);\n }\n });\n\n private readonly handleSubmission = createSubmissionHandler({\n eventBus: this.eventBus,\n configSignal: this.config,\n formSignal: this.form,\n })\n .pipe(takeUntilDestroyed())\n .subscribe();\n\n /**\n * Handles native form submission triggered by:\n * - Pressing Enter in an input field\n * - Clicking a button with type=\"submit\"\n * - Programmatic form.submit() calls\n *\n * This method prevents the default form submission behavior (page reload)\n * and dispatches a SubmitEvent through the EventBus for processing.\n *\n * @param event - The native submit event from the form element\n */\n protected onNativeSubmit(event: Event): void {\n event.preventDefault();\n this.eventBus.dispatch(SubmitEvent);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Private Methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n private registerValidatorsFromConfig({ customFnConfig, schemas }: FormConfig<TFields>): void {\n if (schemas) {\n schemas.forEach((schema) => {\n this.schemaRegistry.registerSchema(schema);\n });\n }\n\n if (!customFnConfig) {\n return;\n }\n\n if (customFnConfig.customFunctions) {\n Object.entries(customFnConfig.customFunctions).forEach(([name, fn]) => {\n this.functionRegistry.registerCustomFunction(name, fn);\n });\n }\n\n this.functionRegistry.setValidators(customFnConfig.validators);\n this.functionRegistry.setAsyncValidators(customFnConfig.asyncValidators);\n this.functionRegistry.setHttpValidators(customFnConfig.httpValidators);\n }\n\n private createFormSetupFromConfig(fields: FieldDef<unknown>[], mode: FormMode, registry: Map<string, FieldTypeDefinition>) {\n const flattenedFields = this.memoizedFlattenFields(fields, registry);\n const flattenedFieldsForRendering = this.memoizedFlattenFieldsForRendering(fields, registry);\n const fieldsById = this.memoizedKeyBy(flattenedFields);\n const defaultValues = this.memoizedDefaultValues(fieldsById, registry);\n const fieldsToRender = mode === 'paged' ? [] : flattenedFieldsForRendering;\n\n return {\n fields: fieldsToRender,\n schemaFields: flattenedFields,\n originalFields: fields,\n defaultValues,\n schema: undefined,\n mode,\n registry,\n };\n }\n\n private createEmptyFormSetup(registry: Map<string, FieldTypeDefinition>) {\n return {\n fields: [],\n schemaFields: [],\n defaultValues: {} as TModel,\n schema: undefined,\n mode: 'non-paged' as const,\n registry,\n };\n }\n\n private onFormReset(): void {\n const defaults = this.defaultValues();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.form()().value.set(defaults as any);\n this.value.set(defaults as Partial<TModel>);\n }\n\n private onFormClear(): void {\n const emptyValue = {} as Partial<TModel>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.form()().value.set(emptyValue as any);\n this.value.set(emptyValue);\n }\n\n /**\n * Counts the total number of validation errors across all fields.\n * Used for screen reader announcements.\n */\n private countErrors(errors: unknown[] | null): number {\n if (!errors) return 0;\n return errors.length;\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────────────────────────\n\n ngOnDestroy(): void {\n this.rootFormRegistry.unregisterForm();\n }\n}\n","import { computed, Signal } from '@angular/core';\nimport { ArrayField } from '../../definitions/default/array-field';\n\n/**\n * Maps an array field definition to component inputs.\n *\n * Array components create nested form structures under the array's key.\n * The array component will inject the parent FIELD_SIGNAL_CONTEXT and create\n * a scoped child injector for its array item fields.\n *\n * @param fieldDef The array field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function arrayFieldMapper(fieldDef: ArrayField): Signal<Record<string, unknown>> {\n // Array inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, Signal } from '@angular/core';\nimport { GroupField } from '../../definitions/default/group-field';\n\n/**\n * Maps a group field definition to component inputs.\n *\n * Group components create nested form structures under the group's key.\n * The group component will inject the parent FIELD_SIGNAL_CONTEXT and create\n * a scoped child injector for its nested fields.\n *\n * @param fieldDef The group field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function groupFieldMapper(fieldDef: GroupField): Signal<Record<string, unknown>> {\n // Group inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, Signal } from '@angular/core';\nimport { RowField } from '../../definitions/default/row-field';\n\n/**\n * Maps a row field definition to component inputs.\n *\n * Row components are layout containers that don't change the form shape.\n * The row component will inject FIELD_SIGNAL_CONTEXT directly.\n *\n * @param fieldDef The row field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function rowFieldMapper(fieldDef: RowField): Signal<Record<string, unknown>> {\n // Row inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, Signal } from '@angular/core';\nimport { PageField } from '../../definitions/default/page-field';\n\n/**\n * Maps a page field definition to component inputs.\n *\n * Page fields are layout containers that don't modify the form context.\n * The page component will inject FIELD_SIGNAL_CONTEXT directly.\n *\n * @param fieldDef The page field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function pageFieldMapper(fieldDef: PageField): Signal<Record<string, unknown>> {\n // Page inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, inject, Signal } from '@angular/core';\nimport { TextField } from '../../definitions/default/text-field';\nimport { buildBaseInputs } from '../base/base-field-mapper';\nimport { RootFormRegistryService } from '../../core/registry/root-form-registry.service';\nimport { FunctionRegistryService } from '../../core/registry/function-registry.service';\nimport { evaluateCondition } from '../../core/expressions/condition-evaluator';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\n\n/**\n * Maps a text field definition to component inputs.\n *\n * Text fields are display-only fields that don't participate in the form schema.\n * This mapper handles the `logic` configuration by creating reactive signals\n * that evaluate conditions using the form value from RootFormRegistryService.\n *\n * @param fieldDef The text field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function textFieldMapper(fieldDef: TextField): Signal<Record<string, unknown>> {\n const rootFormRegistry = inject(RootFormRegistryService);\n const functionRegistry = inject(FunctionRegistryService);\n\n // Build base inputs (static, from field definition)\n const baseInputs = buildBaseInputs(fieldDef);\n\n // Create computed signal for hidden state based on logic configuration\n const hiddenLogic = fieldDef.logic?.filter((l) => l.type === 'hidden') ?? [];\n\n // Return computed signal for reactive updates\n return computed(() => {\n const inputs: Record<string, unknown> = { ...baseInputs };\n\n // Evaluate hidden logic if present\n if (hiddenLogic.length > 0) {\n const formValue = rootFormRegistry.getFormValue();\n const customFunctions = functionRegistry.getCustomFunctions();\n\n // Create evaluation context without a specific field value\n // (text fields don't have their own value in the form)\n const evaluationContext: EvaluationContext = {\n fieldValue: undefined,\n formValue,\n fieldPath: fieldDef.key,\n customFunctions,\n };\n\n // Evaluate all hidden logic conditions - if ANY is true, the field is hidden\n inputs['hidden'] = hiddenLogic.some((logic) => {\n if (typeof logic.condition === 'boolean') {\n return logic.condition;\n }\n return evaluateCondition(logic.condition as ConditionalExpression, evaluationContext);\n });\n }\n\n return inputs;\n });\n}\n","import { FieldTypeDefinition } from '../models/field-type';\nimport { arrayFieldMapper } from '../mappers/array/array-field-mapper';\nimport { groupFieldMapper } from '../mappers/group/group-field-mapper';\nimport { rowFieldMapper } from '../mappers/row/row-field-mapper';\nimport { pageFieldMapper } from '../mappers/page/page-field-mapper';\nimport { textFieldMapper } from '../mappers/text/text-field-mapper';\n\n/**\n * Built-in field types provided by the dynamic form library.\n *\n * These core field types handle form structure and layout. They are automatically\n * registered when using provideDynamicForm() and form the foundation for building\n * complex form layouts with nested fields and multi-step flows.\n *\n * @example\n * ```typescript\n * // Row field for horizontal layout\n * { type: 'row', fields: [\n * { type: 'input', key: 'firstName' },\n * { type: 'input', key: 'lastName' }\n * ]}\n *\n * // Group field for nested form sections\n * { type: 'group', key: 'address', fields: [\n * { type: 'input', key: 'street' },\n * { type: 'input', key: 'city' }\n * ]}\n *\n * // Array field for array-based form sections\n * { type: 'array', key: 'items', fields: [\n * { type: 'input', key: 'name' },\n * { type: 'input', key: 'quantity' }\n * ]}\n *\n * // Page field for multi-step forms\n * { type: 'page', key: 'step1', fields: [...] }\n * ```\n */\nexport const BUILT_IN_FIELDS: FieldTypeDefinition[] = [\n {\n name: 'row',\n loadComponent: () => import('../fields/row/row-field.component'),\n mapper: rowFieldMapper,\n valueHandling: 'flatten',\n },\n {\n name: 'group',\n loadComponent: () => import('../fields/group/group-field.component'),\n mapper: groupFieldMapper,\n valueHandling: 'include',\n },\n {\n name: 'array',\n loadComponent: () => import('../fields/array/array-field.component'),\n mapper: arrayFieldMapper,\n valueHandling: 'include',\n },\n {\n name: 'page',\n loadComponent: () => import('../fields/page/page-field.component'),\n mapper: pageFieldMapper,\n valueHandling: 'flatten',\n },\n {\n name: 'text',\n loadComponent: () => import('../fields/text/text-field.component'),\n mapper: textFieldMapper,\n valueHandling: 'exclude',\n },\n];\n","import { EnvironmentProviders, makeEnvironmentProviders, Provider } from '@angular/core';\nimport { FIELD_REGISTRY, FieldTypeDefinition } from '../models/field-type';\nimport { BUILT_IN_FIELDS } from './built-in-fields';\nimport { FieldDef } from '../definitions/base/field-def';\n\n// Re-export global types for module augmentation\nexport type { DynamicFormFieldRegistry, AvailableFieldTypes } from '../models/registry';\nexport type { RegisteredFieldTypes } from '../models/types';\n\n/**\n * Field type definitions with optional config providers\n */\ntype FieldTypeDefinitionsWithConfig = FieldTypeDefinition[] & {\n __configProviders?: Provider[];\n};\n\n/**\n * Extract FieldDef type from FieldTypeDefinition\n */\ntype ExtractFieldDef<T> = T extends FieldTypeDefinition<infer F> ? F : never;\n\n/**\n * Union of all FieldDef types from provided field types\n */\ntype FieldDefUnion<T extends FieldTypeDefinition[]> = ExtractFieldDef<T[number]>;\n\n/**\n * Infer form value type from field definitions\n */\ntype InferFormValue<TFieldDefs extends FieldDef<any>[]> = {\n [K in TFieldDefs[number]['key']]: any; // TODO: extract actual value type from field\n};\n\n/**\n * Provider result with type inference\n */\ntype ProvideDynamicFormResult<T extends FieldTypeDefinition[]> = EnvironmentProviders & {\n __fieldDefs?: FieldDefUnion<T>;\n __formValue?: InferFormValue<FieldDefUnion<T>[]>;\n};\n\n/**\n * Provider function to configure the dynamic form system with field types and options.\n *\n * This function creates environment providers that can be used at application or route level\n * to register field types. It provides type-safe field registration with automatic type inference.\n *\n * @param fieldTypes - Custom field type definitions to register alongside built-in types\n * @returns Environment providers for dependency injection with type inference\n *\n * @example\n * ```typescript\n * // Application-level setup\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideDynamicForm(...withMaterialFields())\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Route-level setup\n * const routes: Routes = [\n * {\n * path: 'form',\n * component: FormComponent,\n * providers: [provideDynamicForm(...withMaterialFields())]\n * }\n * ];\n * ```\n *\n * @example\n * ```typescript\n * // Custom field types with type inference\n * import { CustomFieldType, AnotherFieldType } from './custom-fields';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDynamicForm(CustomFieldType, AnotherFieldType)\n * ]\n * };\n * ```\n *\n * @typeParam T - Array of field type definitions for type inference\n *\n * @public\n */\nexport function provideDynamicForm<const T extends FieldTypeDefinition[]>(...fieldTypes: T): ProvideDynamicFormResult<T> {\n const fields = [...BUILT_IN_FIELDS, ...fieldTypes];\n\n // Extract config providers from field type arrays\n const configProviders: Provider[] = [];\n fieldTypes.forEach((fieldTypeArray) => {\n const fieldTypeWithConfig = fieldTypeArray as unknown as FieldTypeDefinitionsWithConfig;\n if (fieldTypeWithConfig.__configProviders) {\n configProviders.push(...fieldTypeWithConfig.__configProviders);\n }\n });\n\n return makeEnvironmentProviders([\n {\n provide: FIELD_REGISTRY,\n useFactory: () => {\n const registry = new Map();\n // Add custom field types\n fields.forEach((fieldType) => {\n if (registry.has(fieldType.name)) {\n console.warn(`[Dynamic Forms] Field type \"${fieldType.name}\" is already registered. Overwriting.`);\n }\n registry.set(fieldType.name, fieldType);\n });\n return registry;\n },\n },\n ...configProviders,\n ]) as ProvideDynamicFormResult<T>;\n}\n\n/**\n * Extract FieldDef types from provider result\n */\nexport type ExtractFieldDefs<T> = T extends { __fieldDefs?: infer F } ? F : never;\n\n/**\n * Extract form value type from provider result\n */\nexport type ExtractFormValue<T> = T extends { __formValue?: infer V } ? V : never;\n","import { computed, Signal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\nimport { FormOptions, NextButtonOptions, SubmitButtonOptions } from '../../models/form-config';\nimport { LogicConfig, FormStateCondition, isFormStateCondition } from '../../models/logic';\nimport { ConditionalExpression } from '../../models/expressions';\nimport { evaluateCondition } from '../expressions';\n\n/**\n * Context for resolving button disabled state.\n *\n * @public\n */\nexport interface ButtonLogicContext {\n /** The form's FieldTree instance */\n form: FieldTree<unknown>;\n\n /** Form-level options */\n formOptions?: FormOptions;\n\n /** Field-level logic array (if provided) */\n fieldLogic?: LogicConfig[];\n\n /** Explicit disabled state from field definition */\n explicitlyDisabled?: boolean;\n\n /** Current page validity signal (for paged forms) */\n currentPageValid?: Signal<boolean>;\n\n /** Current form value for evaluating conditional expressions */\n formValue?: unknown;\n}\n\n/**\n * Default options for submit button disabled behavior.\n */\nconst DEFAULT_SUBMIT_BUTTON_OPTIONS: Required<SubmitButtonOptions> = {\n disableWhenInvalid: true,\n disableWhileSubmitting: true,\n};\n\n/**\n * Default options for next button disabled behavior.\n */\nconst DEFAULT_NEXT_BUTTON_OPTIONS: Required<NextButtonOptions> = {\n disableWhenPageInvalid: true,\n disableWhileSubmitting: true,\n};\n\n/**\n * Evaluates a FormStateCondition against the current form/page state.\n *\n * @param condition - The form state condition to evaluate\n * @param ctx - The button logic context\n * @returns true if the condition is met (button should be disabled)\n */\nfunction evaluateFormStateCondition(condition: FormStateCondition, ctx: ButtonLogicContext): boolean {\n const form = ctx.form();\n\n switch (condition) {\n case 'formInvalid':\n return !form.valid();\n\n case 'formSubmitting':\n return form.submitting();\n\n case 'pageInvalid':\n return ctx.currentPageValid ? !ctx.currentPageValid() : false;\n\n default:\n return false;\n }\n}\n\n/**\n * Evaluates a single logic condition (boolean, FormStateCondition, or ConditionalExpression).\n *\n * @param condition - The condition to evaluate\n * @param ctx - The button logic context\n * @returns true if the condition is met\n */\nfunction evaluateLogicCondition(condition: LogicConfig['condition'], ctx: ButtonLogicContext): boolean {\n // Boolean condition\n if (typeof condition === 'boolean') {\n return condition;\n }\n\n // FormStateCondition (string)\n if (isFormStateCondition(condition)) {\n return evaluateFormStateCondition(condition, ctx);\n }\n\n // ConditionalExpression\n const formValue = (ctx.formValue ?? ctx.form().value()) as Record<string, unknown>;\n const evaluationContext = {\n fieldValue: undefined,\n formValue,\n fieldPath: '',\n };\n\n return evaluateCondition(condition as ConditionalExpression, evaluationContext);\n}\n\n/**\n * Checks if any disabled logic condition is met in the field's logic array.\n *\n * @param fieldLogic - Array of logic configurations\n * @param ctx - The button logic context\n * @returns true if any disabled condition is met\n */\nfunction hasFieldLevelDisabledCondition(fieldLogic: LogicConfig[] | undefined, ctx: ButtonLogicContext): boolean {\n if (!fieldLogic || fieldLogic.length === 0) {\n return false;\n }\n\n return fieldLogic.filter((logic) => logic.type === 'disabled').some((logic) => evaluateLogicCondition(logic.condition, ctx));\n}\n\n/**\n * Checks if the field has explicit logic that should override form-level defaults.\n *\n * When a field has its own disabled logic defined, it indicates the user wants\n * custom control over the disabled state, so form-level defaults should be ignored.\n *\n * @param fieldLogic - Array of logic configurations\n * @returns true if field has its own disabled logic\n */\nfunction hasCustomDisabledLogic(fieldLogic: LogicConfig[] | undefined): boolean {\n if (!fieldLogic || fieldLogic.length === 0) {\n return false;\n }\n\n return fieldLogic.some((logic) => logic.type === 'disabled');\n}\n\n/**\n * Resolves the disabled state for a submit button.\n *\n * The disabled state is determined by (in order of precedence):\n * 1. Explicit `disabled: true` on the field definition\n * 2. Field-level `logic` array (if present, overrides form-level defaults)\n * 3. Form-level `options.submitButton` defaults\n *\n * @param ctx - The button logic context\n * @returns A computed signal that returns true when the button should be disabled\n *\n * @example\n * ```typescript\n * const disabled = resolveSubmitButtonDisabled({\n * form: formInstance,\n * formOptions: config.options,\n * fieldLogic: buttonField.logic,\n * explicitlyDisabled: buttonField.disabled,\n * });\n *\n * // Use in template\n * <button [disabled]=\"disabled()\">Submit</button>\n * ```\n *\n * @public\n */\nexport function resolveSubmitButtonDisabled(ctx: ButtonLogicContext): Signal<boolean> {\n return computed(() => {\n // 1. Explicit disabled always wins\n if (ctx.explicitlyDisabled) {\n return true;\n }\n\n // 2. If field has custom disabled logic, use it exclusively\n if (hasCustomDisabledLogic(ctx.fieldLogic)) {\n return hasFieldLevelDisabledCondition(ctx.fieldLogic, ctx);\n }\n\n // 3. Apply form-level defaults\n const options = {\n ...DEFAULT_SUBMIT_BUTTON_OPTIONS,\n ...ctx.formOptions?.submitButton,\n };\n\n const form = ctx.form();\n\n if (options.disableWhenInvalid && !form.valid()) {\n return true;\n }\n\n if (options.disableWhileSubmitting && form.submitting()) {\n return true;\n }\n\n return false;\n });\n}\n\n/**\n * Resolves the disabled state for a next page button.\n *\n * The disabled state is determined by (in order of precedence):\n * 1. Explicit `disabled: true` on the field definition\n * 2. Field-level `logic` array (if present, overrides form-level defaults)\n * 3. Form-level `options.nextButton` defaults\n *\n * @param ctx - The button logic context\n * @returns A computed signal that returns true when the button should be disabled\n *\n * @example\n * ```typescript\n * const disabled = resolveNextButtonDisabled({\n * form: formInstance,\n * formOptions: config.options,\n * fieldLogic: buttonField.logic,\n * explicitlyDisabled: buttonField.disabled,\n * currentPageValid: pageOrchestrator.currentPageValid,\n * });\n * ```\n *\n * @public\n */\nexport function resolveNextButtonDisabled(ctx: ButtonLogicContext): Signal<boolean> {\n return computed(() => {\n // 1. Explicit disabled always wins\n if (ctx.explicitlyDisabled) {\n return true;\n }\n\n // 2. If field has custom disabled logic, use it exclusively\n if (hasCustomDisabledLogic(ctx.fieldLogic)) {\n return hasFieldLevelDisabledCondition(ctx.fieldLogic, ctx);\n }\n\n // 3. Apply form-level defaults\n const options = {\n ...DEFAULT_NEXT_BUTTON_OPTIONS,\n ...ctx.formOptions?.nextButton,\n };\n\n const form = ctx.form();\n\n if (options.disableWhenPageInvalid && ctx.currentPageValid && !ctx.currentPageValid()) {\n return true;\n }\n\n if (options.disableWhileSubmitting && form.submitting()) {\n return true;\n }\n\n return false;\n });\n}\n","import { FieldDef } from './field-def';\nimport { FieldWithValidation } from './field-with-validation';\nimport { WithInputSignals } from '../../models/component-type';\nimport { Prettify } from '../../models/prettify';\nimport { DynamicText } from '../../models/types/dynamic-text';\n\n/**\n * Supported primitive value types for form fields.\n * This type represents all possible value types that can be used in form fields.\n */\nexport type ValueType = string | number | boolean | Date | object | unknown[];\n\nexport interface BaseValueField<TProps, TValue> extends FieldDef<TProps>, FieldWithValidation {\n value?: TValue;\n\n /**\n * Placeholder text displayed when the field is empty.\n * Supports static strings, Observables, and Signals for dynamic content.\n */\n placeholder?: DynamicText;\n\n required?: boolean;\n}\n\nexport function isValueField<TProps>(field: FieldDef<TProps>): field is BaseValueField<TProps, ValueType> {\n return 'value' in field;\n}\n\ntype ExcludedKeys =\n | 'type'\n | 'conditionals'\n | 'value'\n | 'valueType'\n | 'disabled'\n | 'readonly'\n | 'hidden'\n | 'col'\n | 'minValue'\n | 'maxValue'\n | 'step'\n // Exclude validation config, but keep validationMessages for component use\n | 'required'\n | 'email'\n | 'min'\n | 'max'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'validators'\n | 'logic'\n | 'schemas';\n\nexport type ValueFieldComponent<T extends BaseValueField<any, unknown>> = Prettify<WithInputSignals<Omit<T, ExcludedKeys>>>;\n","import { FieldDef } from './field-def';\nimport { FieldWithValidation } from './field-with-validation';\nimport { WithInputSignals } from '../../models/component-type';\nimport { Prettify } from '../../models/prettify';\nimport { DynamicText } from '../../models/types/dynamic-text';\n\nexport interface BaseCheckedField<TProps> extends FieldDef<TProps>, FieldWithValidation {\n value?: boolean;\n\n /**\n * Placeholder text displayed when the field is empty.\n * Supports static strings, Observables, and Signals for dynamic content.\n */\n placeholder?: DynamicText;\n\n required?: boolean;\n}\n\nexport function isCheckedField<TProps>(field: FieldDef<TProps>): field is BaseCheckedField<TProps> {\n return field.type === 'checkbox';\n}\n\ntype ExcludedKeys = 'type' | 'conditionals' | 'value' | 'disabled' | 'readonly' | 'hidden' | 'col' | keyof FieldWithValidation;\n\nexport type CheckedFieldComponent<T extends BaseCheckedField<any>> = Prettify<WithInputSignals<Omit<T, ExcludedKeys>>>;\n","/**\n * Context for token resolution in event args\n */\nexport interface TokenContext {\n /** Current field key */\n key?: string;\n /** Array index if field is inside an array */\n index?: number;\n /** Parent array field key if field is inside an array */\n arrayKey?: string;\n /** Current form value for complex indexing */\n formValue?: unknown;\n}\n\n/**\n * Resolves special tokens in event arguments to their actual values\n *\n * Supported tokens:\n * - $key: The current field key\n * - $index: The array index (if inside an array field)\n * - $arrayKey: The parent array field key (if inside an array field)\n * - formValue: Reference to the current form value for indexing\n *\n * @param args - Array of arguments that may contain tokens\n * @param context - Context object containing token values\n * @returns Array with resolved values\n *\n * @example\n * resolveTokens(['$arrayKey', '$index'], { arrayKey: 'contacts', index: 2 })\n * // Returns: ['contacts', 2]\n *\n * @example\n * resolveTokens(['$key', 'static'], { key: 'myField' })\n * // Returns: ['myField', 'static']\n */\nexport function resolveTokens(\n args: readonly (string | number | boolean | null | undefined)[],\n context: TokenContext,\n): (string | number | boolean | null | undefined | unknown)[] {\n return args.map((arg) => {\n // Only process string tokens\n if (typeof arg !== 'string') {\n return arg;\n }\n\n // Check for token patterns\n switch (arg) {\n case '$key':\n return context.key;\n case '$index':\n return context.index;\n case '$arrayKey':\n return context.arrayKey;\n case 'formValue':\n return context.formValue;\n default:\n // Return as-is if not a recognized token\n return arg;\n }\n });\n}\n","import { FieldTree } from '@angular/forms/signals';\n\n/**\n * Internal Angular Signal Forms structure interface.\n *\n * WARNING: These properties are internal Angular APIs and may change between versions.\n * This interface documents our dependency on Angular internals for form structure access.\n *\n * Used to access:\n * - `structure.childrenMap()` - Map of child field keys to their FieldTree instances\n * - `fieldProxy` - The FieldTree proxy for a FieldNode\n */\nexport interface FormInternals<T = unknown> {\n /**\n * Internal structure containing form graph information.\n * Present on forms created via `form()` function.\n */\n structure?: {\n /**\n * Returns a Map of child field keys to their FieldTree instances.\n * Keys are strings for object properties or stringified indices for arrays.\n */\n childrenMap?: () => Map<string, FieldTree<unknown>>;\n };\n\n /**\n * The FieldTree proxy for navigating the form graph.\n * Present on FieldNode instances.\n */\n fieldProxy?: FieldTree<T>;\n}\n\n/**\n * Type guard for checking if a form-like object has the internal structure property.\n *\n * @param form - The form object to check\n * @returns True if the form has a structure property with childrenMap\n */\nexport function hasFormStructure(form: unknown): form is FormInternals {\n return (\n typeof form === 'object' && form !== null && 'structure' in form && typeof (form as FormInternals).structure?.childrenMap === 'function'\n );\n}\n\n/**\n * Safely retrieves the childrenMap from a form's internal structure.\n *\n * @param form - The form object (from `form()` function or FieldTree)\n * @returns The childrenMap or null if not available\n */\nexport function getChildrenMap(form: unknown): Map<string, FieldTree<unknown>> | null {\n if (!hasFormStructure(form)) {\n return null;\n }\n return form.structure?.childrenMap?.() ?? null;\n}\n\n/**\n * Safely retrieves the fieldProxy from a form node.\n *\n * @param node - The form node (FieldNode or similar)\n * @returns The fieldProxy FieldTree or null if not available\n */\nexport function getFieldProxy<T = unknown>(node: unknown): FieldTree<T> | null {\n if (typeof node !== 'object' || node === null) {\n return null;\n }\n const proxy = (node as FormInternals<T>).fieldProxy;\n return proxy ?? null;\n}\n\n/**\n * Retrieves a child FieldTree from a form by key.\n *\n * @param form - The parent form\n * @param key - The child field key\n * @returns The child FieldTree or null if not found\n */\nexport function getChildFieldTree(form: unknown, key: string): FieldTree<unknown> | null {\n const childrenMap = getChildrenMap(form);\n return childrenMap?.get(key) ?? null;\n}\n","import { BaseValueField } from '../../definitions/base/base-value-field';\nimport { computed, inject, isSignal, Signal } from '@angular/core';\nimport { buildBaseInputs } from '../base/base-field-mapper';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { omit } from '../../utils/object-utils';\nimport { getChildrenMap, getFieldProxy } from '../../utils/form-internals/form-internals';\nimport { ValidationMessages } from '../../models/validation-types';\n\n/**\n * Context for value field mapping, containing resolved field proxy and default validation messages.\n * Used by specialized mappers to avoid duplicate context resolution.\n */\nexport interface ValueFieldContext {\n fieldProxy: unknown;\n defaultValidationMessages: ValidationMessages | undefined;\n}\n\n/**\n * Resolves the field proxy and default validation messages from the form context.\n * Must be called within an injection context.\n *\n * @param fieldKey The key of the field to resolve\n * @returns The resolved context with field proxy and validation messages\n */\nexport function resolveValueFieldContext(fieldKey: string): ValueFieldContext {\n const context = inject(FIELD_SIGNAL_CONTEXT);\n\n // Get form-level validation messages\n const defaultValidationMessages = context.defaultValidationMessages;\n\n // Get the form root to access field proxy\n const formRoot = context.form();\n const childrenMap = getChildrenMap(formRoot);\n\n // Resolve field proxy\n let fieldProxy: unknown = undefined;\n\n if (!childrenMap) {\n // No childrenMap - the form might be a FormRecord where fields are direct properties\n // First check if formRoot itself has fieldProxy (for FieldTree items)\n const rootFieldProxy = getFieldProxy(formRoot);\n if (rootFieldProxy) {\n fieldProxy = rootFieldProxy;\n } else {\n // Try accessing the field as a direct property on formRoot (FormRecord case)\n // This handles forms created with form(entity, schema) where fields are accessible as formRoot[key]\n const formField = (formRoot as unknown as Record<string, unknown>)[fieldKey];\n const resolvedProxy = getFieldProxy(formField);\n if (resolvedProxy) {\n fieldProxy = resolvedProxy;\n } else if (isSignal(formField) || formField) {\n // The field itself might be the proxy (signal), or might have a different structure\n // Try using the field directly as the proxy\n fieldProxy = formField;\n }\n }\n } else {\n // Standard field access for non-array keys via childrenMap lookup\n const formField = childrenMap.get(fieldKey);\n const resolvedProxy = getFieldProxy(formField);\n if (resolvedProxy) {\n fieldProxy = resolvedProxy;\n }\n }\n\n return { fieldProxy, defaultValidationMessages };\n}\n\n/**\n * Builds the base inputs for a value field.\n * This is a helper function used by valueFieldMapper and specialized mappers.\n *\n * @param fieldDef The value field definition\n * @param ctx The resolved value field context\n * @returns Record of input names to values\n */\nexport function buildValueFieldInputs<TProps, TValue = unknown>(\n fieldDef: BaseValueField<TProps, TValue>,\n ctx: ValueFieldContext,\n): Record<string, unknown> {\n const omittedFields = omit(fieldDef, ['value']);\n const baseInputs = buildBaseInputs(omittedFields);\n\n const inputs: Record<string, unknown> = {\n ...baseInputs,\n // Always pass validationMessages (or empty object) - required for error display signals\n validationMessages: fieldDef.validationMessages ?? {},\n };\n\n // Value field specific properties\n if (fieldDef.placeholder !== undefined) {\n inputs['placeholder'] = fieldDef.placeholder;\n }\n\n if (ctx.defaultValidationMessages !== undefined) {\n inputs['defaultValidationMessages'] = ctx.defaultValidationMessages;\n }\n\n if (ctx.fieldProxy !== undefined) {\n inputs['field'] = ctx.fieldProxy;\n }\n\n return inputs;\n}\n\n/**\n * Maps a value field definition to component inputs.\n *\n * Value fields are input fields that contribute to the form's value (text, number, etc.).\n * This mapper injects FIELD_SIGNAL_CONTEXT to access the form structure and retrieve the field proxy.\n *\n * For fields with specific properties (select, datepicker, textarea, slider), use the specialized mappers:\n * - selectFieldMapper: for fields with options (select, radio, multi-checkbox)\n * - datepickerFieldMapper: for fields with minDate, maxDate, startAt\n * - textareaFieldMapper: for fields with rows, cols\n * - sliderFieldMapper: for fields with minValue, maxValue, step\n *\n * @param fieldDef The value field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function valueFieldMapper<TProps = unknown, TValue = unknown>(\n fieldDef: BaseValueField<TProps, TValue>,\n): Signal<Record<string, unknown>> {\n const ctx = resolveValueFieldContext(fieldDef.key);\n\n return computed(() => buildValueFieldInputs(fieldDef, ctx));\n}\n","import { BaseCheckedField } from '../../definitions/base/base-checked-field';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { computed, inject, Signal } from '@angular/core';\nimport { buildBaseInputs } from '../base/base-field-mapper';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { omit } from '../../utils/object-utils';\nimport { getChildrenMap, getFieldProxy } from '../../utils/form-internals/form-internals';\n\n/**\n * Maps a checkbox/toggle field definition to component inputs.\n *\n * Checkbox fields are checked fields that contribute to the form's value as boolean.\n * This mapper injects FIELD_SIGNAL_CONTEXT to access the form structure and retrieve the field proxy.\n *\n * @param fieldDef The checkbox field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function checkboxFieldMapper(fieldDef: BaseCheckedField<unknown>): Signal<Record<string, unknown>> {\n const context = inject(FIELD_SIGNAL_CONTEXT);\n const omittedFields = omit(fieldDef, ['value']) as FieldDef<unknown>;\n\n // Build base inputs (static, from field definition)\n const baseInputs = buildBaseInputs(omittedFields);\n\n // Get form-level validation messages (static)\n const defaultValidationMessages = context.defaultValidationMessages;\n\n // Get the form root to access field proxy\n const formRoot = context.form();\n const childrenMap = getChildrenMap(formRoot);\n\n // Resolve field proxy (static - determined once during mapping)\n let fieldProxy: unknown = undefined;\n\n if (childrenMap) {\n const formField = childrenMap.get(fieldDef.key);\n const resolvedProxy = getFieldProxy(formField);\n if (resolvedProxy) {\n fieldProxy = resolvedProxy;\n }\n }\n\n // Return computed signal for reactive updates\n return computed(() => {\n const inputs: Record<string, unknown> = {\n ...baseInputs,\n // Always pass validationMessages (or empty object) - required for error display signals\n validationMessages: fieldDef.validationMessages ?? {},\n };\n\n // Checked field specific property: placeholder\n if (fieldDef.placeholder !== undefined) {\n inputs['placeholder'] = fieldDef.placeholder;\n }\n\n if (defaultValidationMessages !== undefined) {\n inputs['defaultValidationMessages'] = defaultValidationMessages;\n }\n\n if (fieldProxy !== undefined) {\n inputs['field'] = fieldProxy;\n }\n\n return inputs;\n });\n}\n","import { computed, Signal } from '@angular/core';\nimport { SelectField } from '../../definitions/default/select-field';\nimport { RadioField } from '../../definitions/default/radio-field';\nimport { MultiCheckboxField } from '../../definitions/default/multi-checkbox-field';\nimport { BaseValueField } from '../../definitions/base/base-value-field';\nimport { resolveValueFieldContext, buildValueFieldInputs } from '../value/value-field.mapper';\n\n/**\n * Field types that have an options property.\n */\nexport type FieldWithOptions<T = unknown, TProps = unknown> =\n | SelectField<T, TProps>\n | RadioField<T, TProps>\n | MultiCheckboxField<T, TProps>;\n\n/**\n * Maps a field with options (select, radio, multi-checkbox) to component inputs.\n *\n * Extends the base value field mapper by adding the options property.\n *\n * @param fieldDef The field definition with options\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function optionsFieldMapper<T, TProps>(fieldDef: FieldWithOptions<T, TProps>): Signal<Record<string, unknown>> {\n const ctx = resolveValueFieldContext(fieldDef.key);\n\n return computed(() => {\n // Cast to BaseValueField - safe because all FieldWithOptions types extend BaseValueField\n const inputs = buildValueFieldInputs(fieldDef as BaseValueField<TProps, unknown>, ctx);\n\n // Add options property\n inputs['options'] = fieldDef.options;\n\n return inputs;\n });\n}\n","import { computed, Signal } from '@angular/core';\nimport { DatepickerField } from '../../definitions/default/datepicker-field';\nimport { resolveValueFieldContext, buildValueFieldInputs } from '../value/value-field.mapper';\n\n/**\n * Maps a datepicker field to component inputs.\n *\n * Extends the base value field mapper by adding datepicker-specific properties:\n * - minDate: Minimum selectable date\n * - maxDate: Maximum selectable date\n * - startAt: Initial date to display when opening the picker\n *\n * @param fieldDef The datepicker field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function datepickerFieldMapper<TProps>(fieldDef: DatepickerField<TProps>): Signal<Record<string, unknown>> {\n const ctx = resolveValueFieldContext(fieldDef.key);\n\n return computed(() => {\n const inputs = buildValueFieldInputs(fieldDef, ctx);\n\n // Add datepicker-specific properties\n if (fieldDef.minDate !== undefined) {\n inputs['minDate'] = fieldDef.minDate;\n }\n if (fieldDef.maxDate !== undefined) {\n inputs['maxDate'] = fieldDef.maxDate;\n }\n if (fieldDef.startAt !== undefined) {\n inputs['startAt'] = fieldDef.startAt;\n }\n\n return inputs;\n });\n}\n","import { isSignal, Injector } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { isObservable, Observable, of } from 'rxjs';\nimport { DynamicText } from '../models/types/dynamic-text';\n\n/**\n * Converts DynamicText (string | Observable | Signal) to Observable<string>\n * Unifies all three types into a consistent Observable stream\n *\n * @param value - The dynamic text value to convert\n * @param injector - Optional injector for signal conversion\n * @returns Observable<string> - The value as an observable stream\n */\nexport function dynamicTextToObservable(value: DynamicText | undefined, injector?: Injector): Observable<string> {\n if (value === undefined) {\n return of('');\n }\n\n if (isObservable(value)) {\n return value;\n }\n\n if (isSignal(value)) {\n return toObservable(value, { injector });\n }\n\n return of(String(value));\n}\n","import { Signal, computed } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\n\n/**\n * Computed signal that determines if errors should be displayed\n * Based on field's invalid, touched, and error count\n *\n * @param field - Signal containing FieldTree\n * @returns Signal<boolean> - True if errors should be displayed\n */\nexport function shouldShowErrors<T>(field: Signal<FieldTree<T>>): Signal<boolean> {\n return computed(() => {\n const fieldTree = field();\n const control = fieldTree();\n return control.invalid() && control.touched() && control.errors().length > 0;\n });\n}\n","import { ValidationError } from '../models/validation-types';\n\n/**\n * Interpolates {{param}} placeholders in message with error values\n *\n * @param message - Message template with {{param}} placeholders\n * @param error - Validation error containing parameter values\n * @returns Message with interpolated parameters\n *\n * @example\n * interpolateParams(\"Min value is {{min}}\", { kind: 'min', min: 5 })\n * // Returns: \"Min value is 5\"\n */\nexport function interpolateParams(message: string, error: ValidationError): string {\n let result = message;\n const params = extractErrorParams(error);\n\n Object.entries(params).forEach(([key, value]) => {\n const placeholder = new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g');\n result = result.replace(placeholder, safeToString(value));\n });\n\n return result;\n}\n\n/**\n * Safely converts a value to a string, handling complex objects\n * @internal\n */\nfunction safeToString(value: unknown): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n // Handle primitives directly\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n\n // Handle RegExp (has its own toString)\n if (value instanceof RegExp) {\n return value.toString();\n }\n\n // Handle Date\n if (value instanceof Date) {\n return value.toISOString();\n }\n\n // Handle arrays\n if (Array.isArray(value)) {\n return value.join(', ');\n }\n\n // For objects, try JSON.stringify first, fall back to empty string\n try {\n // Check if object has a custom toString that's not Object.prototype.toString\n if (typeof value === 'object' && value.toString !== Object.prototype.toString) {\n return value.toString();\n }\n // Otherwise use JSON representation\n return JSON.stringify(value);\n } catch {\n // If JSON.stringify fails (circular reference, etc.), return empty string\n return '[object]';\n }\n}\n\n/**\n * Extracts parameter values from validation error\n * @internal\n */\nfunction extractErrorParams(error: ValidationError): Record<string, unknown> {\n const params: Record<string, unknown> = {};\n\n // Common validation error parameters\n if ('min' in error) params.min = error.min;\n if ('max' in error) params.max = error.max;\n if ('requiredLength' in error) params.requiredLength = error.requiredLength;\n if ('actualLength' in error) params.actualLength = error.actualLength;\n if ('pattern' in error) params.pattern = error.pattern;\n if ('actual' in error) params.actual = error.actual;\n if ('expected' in error) params.expected = error.expected;\n\n // Include all custom properties from error object (for custom validators)\n // Skip 'kind' as it's the error type identifier, not a parameter\n Object.keys(error).forEach((key) => {\n if (key !== 'kind' && !(key in params)) {\n params[key] = error[key as keyof ValidationError];\n }\n });\n\n return params;\n}\n","import { computed, inject, Injector, signal, Signal } from '@angular/core';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { FieldTree, ValidationError } from '@angular/forms/signals';\nimport { combineLatest, Observable, of } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { ValidationMessages } from '../models/validation-types';\nimport { dynamicTextToObservable } from './dynamic-text-to-observable';\nimport { interpolateParams } from './interpolate-params';\n\n/**\n * Resolved validation error with interpolated message\n */\nexport interface ResolvedError {\n kind: string;\n message: string;\n}\n\n/**\n * Factory function that creates a signal of resolved validation errors\n * Handles async resolution of DynamicText validation messages\n *\n * @param field - Signal containing FieldTree\n * @param validationMessages - Signal containing custom field-level validation messages\n * @param defaultValidationMessages - Signal containing default validation messages (fallback)\n * @param injector - Optional injector for DynamicText resolution\n * @returns Signal<ResolvedError[]> - Reactively resolved error messages\n *\n * @example\n * ```typescript\n * readonly resolvedErrors = createResolvedErrorsSignal(\n * this.field,\n * this.validationMessages,\n * this.defaultValidationMessages\n * );\n * ```\n */\nexport function createResolvedErrorsSignal<T>(\n field: Signal<FieldTree<T>>,\n validationMessages: Signal<ValidationMessages | undefined>,\n defaultValidationMessages: Signal<ValidationMessages | undefined> = signal(undefined),\n injector = inject(Injector),\n): Signal<ResolvedError[]> {\n // Ensure validationMessages is never undefined (mappers pass {} if not defined)\n const messages = computed(() => validationMessages() ?? {});\n const defaultMessages = computed(() => defaultValidationMessages() ?? {});\n\n // Create a computed signal that reads the actual errors from the field\n // This ensures the signal tracks changes to field().errors(), not just the field reference\n const errors = computed(() => {\n const control = field()();\n return control.errors();\n });\n\n // Convert signals to observables using toObservable with injector\n const errors$ = toObservable(errors, { injector });\n const messages$ = toObservable(messages, { injector });\n const defaultMessages$ = toObservable(defaultMessages, { injector });\n\n // Combine observables and process errors\n const resolvedErrors$ = combineLatest([errors$, messages$, defaultMessages$]).pipe(\n switchMap(([currentErrors, msgs, defaultMsgs]) => {\n // No errors - return empty array\n if (!currentErrors || currentErrors.length === 0) {\n return of([]);\n }\n\n // Create observable for each error's resolved message\n const errorResolvers = currentErrors.map((error: ValidationError) => resolveErrorMessage(error, msgs, defaultMsgs, injector));\n\n // Combine all error message observables into single array emission, filtering out nulls\n return errorResolvers.length > 0\n ? combineLatest(errorResolvers).pipe(map((errors) => errors.filter((e): e is ResolvedError => e !== null)))\n : of([]);\n }),\n );\n\n // Convert observable back to signal using toSignal with injector\n // toSignal properly handles the injection context and manages subscriptions\n return toSignal(resolvedErrors$, { initialValue: [] as ResolvedError[], injector });\n}\n\n/**\n * Resolves a single error message from DynamicText sources with fallback logic\n * Priority: field-level message → default message → no message (logs warning)\n * @internal\n */\nfunction resolveErrorMessage(\n error: ValidationError,\n fieldMessages: ValidationMessages,\n defaultMessages: ValidationMessages,\n injector: Injector,\n): Observable<ResolvedError | null> {\n // Check for field-level custom message first\n const fieldMessage = fieldMessages[error.kind];\n\n // Fall back to default message if no field-level message exists\n const defaultMessage = defaultMessages[error.kind];\n\n // Determine which message to use: field-level → default\n const messageToUse = fieldMessage ?? defaultMessage;\n\n // If no message found, log warning and return null (will be filtered out)\n if (!messageToUse) {\n console.warn(\n `[Dynamic Forms] No validation message found for error kind \"${error.kind}\". ` +\n `Please provide a message via field-level validationMessages or form-level defaultValidationMessages.`,\n );\n return of(null);\n }\n\n // Convert DynamicText to Observable\n const messageObservable = dynamicTextToObservable(messageToUse, injector);\n\n // Apply parameter interpolation to support {{param}} syntax\n return messageObservable.pipe(\n map((msg) => ({\n kind: error.kind,\n message: interpolateParams(msg, error),\n })),\n );\n}\n","import { inject, Injector, isSignal, Pipe, PipeTransform } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { isObservable, Observable, of } from 'rxjs';\nimport { DynamicText } from '../../models/types/dynamic-text';\n\n/**\n * Pipe that handles dynamic text resolution with support for static strings,\n * Observables, and Signals.\n *\n * Supports:\n * - Static strings (pass-through)\n * - Observables (subscribed internally)\n * - Signals (converted to Observable using toObservable for reactivity)\n *\n * @example\n * ```html\n * <!-- Static string -->\n * {{ 'Hello World' | dynamicText | async }}\n *\n * <!-- Observable -->\n * {{ transloco.selectTranslate('key') | dynamicText | async }}\n *\n * <!-- Signal -->\n * {{ myTextSignal | dynamicText | async }}\n * ```\n *\n * @public\n */\n@Pipe({\n name: 'dynamicText',\n standalone: true,\n})\nexport class DynamicTextPipe implements PipeTransform {\n private readonly injector = inject(Injector);\n\n /**\n * Transforms dynamic text input into a resolved string value\n *\n * @param value - The dynamic text value to resolve\n * @returns The resolved string value as an Observable\n */\n transform(value: DynamicText | undefined): Observable<string> {\n if (isObservable(value)) {\n return value;\n }\n\n if (isSignal(value)) {\n return toObservable(value, { injector: this.injector });\n }\n\n return of(value || '');\n }\n}\n","import { afterNextRender, Injector } from '@angular/core';\nimport { EventBus } from '../../events/event.bus';\nimport { ComponentInitializedEvent } from '../../events/constants/component-initialized.event';\n\n/**\n * Component type for initialization events.\n */\nexport type InitializationComponentType = 'dynamic-form' | 'group' | 'row' | 'page' | 'array';\n\n/**\n * Emits a component initialization event after the next render cycle.\n *\n * This utility is used by container components (group, row, page, array) to signal\n * that their child fields have been resolved and rendered. The event is dispatched\n * through the EventBus and is used by the initialization tracking system.\n *\n * @param eventBus - The EventBus instance to dispatch the event on\n * @param componentType - The type of component being initialized\n * @param componentKey - The unique key/id of the component\n * @param injector - The injector to use for afterNextRender scheduling\n */\nexport function emitComponentInitialized(\n eventBus: EventBus,\n componentType: InitializationComponentType,\n componentKey: string,\n injector: Injector,\n): void {\n afterNextRender(\n () => {\n try {\n eventBus.dispatch(ComponentInitializedEvent, componentType, componentKey);\n } catch {\n // Input not available - component may have been destroyed\n }\n },\n { injector },\n );\n}\n","import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, Injector, input } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { forkJoin, map, of, pipe, scan, switchMap } from 'rxjs';\nimport { derivedFromDeferred } from '../../utils/derived-from-deferred/derived-from-deferred';\nimport { reconcileFields, ResolvedField, resolveField } from '../../utils/resolve-field/resolve-field';\nimport { emitComponentInitialized } from '../../utils/emit-initialization/emit-initialization';\nimport { RowField } from '../../definitions/default/row-field';\nimport { injectFieldRegistry } from '../../utils/inject-field-registry/inject-field-registry';\nimport { EventBus } from '../../events/event.bus';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\n\n/**\n * Layout container for horizontal field arrangement.\n *\n * Does not create a new form context - fields share the parent's context.\n * Field values are flattened into the parent form (no nesting under row key).\n * Purely a visual/layout container with no impact on form structure.\n */\n@Component({\n selector: 'div[row-field]',\n imports: [NgComponentOutlet],\n template: `\n @for (field of resolvedFields(); track field.key) {\n <ng-container *ngComponentOutlet=\"field.component; injector: field.injector; inputs: field.inputs()\" />\n }\n `,\n styleUrl: './row-field.component.scss',\n host: {\n class: 'df-field df-row',\n '[class.disabled]': 'disabled()',\n '[id]': '`${key()}`',\n '[attr.data-testid]': 'key()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class RowFieldComponent {\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly injector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n field = input.required<RowField>();\n key = input.required<string>();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly disabled = computed(() => {\n try {\n return this.field().disabled || false;\n } catch {\n return false;\n }\n });\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Field Resolution\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly fieldsSource = computed(() => this.field().fields || []);\n\n protected readonly resolvedFields = derivedFromDeferred(\n this.fieldsSource,\n pipe(\n switchMap((fields) => {\n if (!fields || fields.length === 0) {\n return of([] as (ResolvedField | undefined)[]);\n }\n const rowKey = this.field().key || '<no key>';\n const context = {\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n registry: this.rawFieldRegistry(),\n injector: this.injector,\n destroyRef: this.destroyRef,\n onError: (fieldDef: FieldDef<unknown>, error: unknown) => {\n const fieldKey = fieldDef.key || '<no key>';\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${fieldDef.type}' (key: ${fieldKey}) ` +\n `within row '${rowKey}'. Ensure the field type is registered in your field registry.`,\n error,\n );\n },\n };\n return forkJoin(fields.map((f) => resolveField(f as FieldDef<unknown>, context)));\n }),\n map((fields) => fields.filter((f): f is ResolvedField => f !== undefined)),\n scan(reconcileFields, [] as ResolvedField[]),\n ),\n { initialValue: [] as ResolvedField[], injector: this.injector },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Effects\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly emitInitializedOnFieldsResolved = explicitEffect([this.resolvedFields], ([fields]) => {\n if (fields.length > 0) {\n emitComponentInitialized(this.eventBus, 'row', this.field().key, this.injector);\n }\n });\n}\n\nexport { RowFieldComponent };\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n inject,\n Injector,\n input,\n linkedSignal,\n runInInjectionContext,\n untracked,\n} from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { outputFromObservable, toObservable } from '@angular/core/rxjs-interop';\nimport { forkJoin, map, of, pipe, scan, switchMap } from 'rxjs';\nimport { derivedFromDeferred } from '../../utils/derived-from-deferred/derived-from-deferred';\nimport { reconcileFields, ResolvedField, resolveField } from '../../utils/resolve-field/resolve-field';\nimport { emitComponentInitialized } from '../../utils/emit-initialization/emit-initialization';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { keyBy, mapValues, memoize } from '../../utils/object-utils';\nimport { GroupField } from '../../definitions/default/group-field';\nimport { injectFieldRegistry } from '../../utils/inject-field-registry/inject-field-registry';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { form } from '@angular/forms/signals';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldSignalContext } from '../../mappers/types';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { getFieldDefaultValue } from '../../utils/default-value/default-value';\nimport { createSchemaFromFields } from '../../core/schema-builder';\nimport { EventBus } from '../../events/event.bus';\nimport { SubmitEvent } from '../../events/constants/submit.event';\nimport { flattenFields } from '../../utils/flattener/field-flattener';\nimport { getChildFieldTree } from '../../utils/form-internals/form-internals';\n\n/**\n * Container component for rendering nested form groups.\n *\n * Creates a scoped form context with its own validation state.\n * Child fields receive a FIELD_SIGNAL_CONTEXT scoped to this group's form instance.\n * Group values are nested under the group's key in the parent form.\n */\n@Component({\n selector: 'fieldset[group-field]',\n imports: [NgComponentOutlet],\n template: `\n @for (field of resolvedFields(); track field.key) {\n <ng-container *ngComponentOutlet=\"field.component; injector: field.injector; inputs: field.inputs()\" />\n }\n `,\n styleUrl: './group-field.component.scss',\n host: {\n class: 'df-field df-group',\n role: 'group',\n '[class.disabled]': 'disabled()',\n '[id]': '`${key()}`',\n '[attr.data-testid]': 'key()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class GroupFieldComponent<TModel = Record<string, unknown>> {\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly parentFieldSignalContext = inject(FIELD_SIGNAL_CONTEXT) as FieldSignalContext<TModel>;\n private readonly injector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Memoized Functions\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly memoizedFlattenFields = memoize(\n (fields: readonly FieldDef<unknown>[], registry: Map<string, FieldTypeDefinition>) => flattenFields([...fields], registry),\n (fields, registry) =>\n JSON.stringify(fields.map((f) => ({ key: f.key, type: f.type }))) + '_' + Array.from(registry.keys()).sort().join(','),\n );\n\n private readonly memoizedKeyBy = memoize(\n <T extends { key: string }>(fields: T[]) => keyBy(fields, 'key'),\n (fields) => fields.map((f) => f.key).join(','),\n );\n\n private readonly memoizedDefaultValues = memoize(\n <T extends FieldDef<unknown>>(fieldsById: Record<string, T>, registry: Map<string, FieldTypeDefinition>) =>\n mapValues(fieldsById, (field) => getFieldDefaultValue(field, registry)),\n (fieldsById, registry) => Object.keys(fieldsById).sort().join(',') + '_' + Array.from(registry.keys()).sort().join(','),\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n field = input.required<GroupField>();\n key = input.required<string>();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n private readonly formSetup = computed(() => {\n try {\n const groupField = this.field();\n const registry = this.rawFieldRegistry();\n\n if (groupField.fields && groupField.fields.length > 0) {\n const flattenedFields = this.memoizedFlattenFields(groupField.fields, registry);\n const fieldsById = this.memoizedKeyBy(flattenedFields);\n const defaultValues = this.memoizedDefaultValues(fieldsById, registry);\n\n return {\n fields: flattenedFields,\n originalFields: groupField.fields,\n defaultValues,\n registry,\n };\n }\n\n return {\n fields: [],\n originalFields: [],\n defaultValues: {},\n registry,\n };\n } catch {\n return {\n fields: [],\n originalFields: [],\n defaultValues: {},\n registry: this.rawFieldRegistry(),\n };\n }\n });\n\n readonly defaultValues = linkedSignal(() => this.formSetup().defaultValues);\n\n private readonly entity = linkedSignal(() => {\n const parentValue = this.parentFieldSignalContext.value();\n const groupKey = this.field().key;\n const defaults = this.defaultValues();\n const groupValue = (parentValue as Record<string, unknown>)?.[groupKey] || {};\n return { ...defaults, ...groupValue };\n });\n\n private readonly form = computed(() => {\n return runInInjectionContext(this.injector, () => {\n const setup = this.formSetup();\n\n if (setup.fields.length > 0) {\n const schema = createSchemaFromFields(setup.fields, setup.registry);\n return untracked(() => form(this.entity, schema));\n }\n\n return untracked(() => form(this.entity));\n });\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public State Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly formValue = computed(() => this.entity());\n readonly valid = computed(() => this.form()().valid());\n readonly invalid = computed(() => this.form()().invalid());\n readonly dirty = computed(() => this.form()().dirty());\n readonly touched = computed(() => this.form()().touched());\n readonly errors = computed(() => this.form()().errors());\n readonly disabled = computed(() => this.form()().disabled());\n\n /**\n * Get the nested FieldTree from the parent form for this group.\n * This allows child fields to update the parent form directly,\n * avoiding the need for separate form synchronization.\n */\n private readonly nestedFieldTree = computed(() => {\n const parentForm = this.parentFieldSignalContext.form();\n const groupKey = this.field().key;\n return getChildFieldTree(parentForm, groupKey);\n });\n\n private readonly groupInjector = computed(() => {\n const nestedTree = this.nestedFieldTree();\n\n // Use the nested FieldTree from parent if available, otherwise fall back to our own form\n // The nested FieldTree ensures changes propagate directly to the parent form\n const formToProvide = nestedTree ?? this.form();\n\n const groupFieldSignalContext: FieldSignalContext<Record<string, unknown>> = {\n injector: this.injector,\n value: this.parentFieldSignalContext.value,\n defaultValues: this.defaultValues,\n form: (() => formToProvide) as unknown as ReturnType<typeof form<Record<string, unknown>>>,\n defaultValidationMessages: this.parentFieldSignalContext.defaultValidationMessages,\n };\n\n return Injector.create({\n parent: this.injector,\n providers: [\n {\n provide: FIELD_SIGNAL_CONTEXT,\n useValue: groupFieldSignalContext,\n },\n ],\n });\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Outputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly validityChange = outputFromObservable(toObservable(this.valid));\n readonly dirtyChange = outputFromObservable(toObservable(this.dirty));\n readonly submitted = outputFromObservable(this.eventBus.on<SubmitEvent>('submit'));\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Field Resolution\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly fieldsSource = computed(() => this.formSetup().fields);\n\n protected readonly resolvedFields = derivedFromDeferred(\n this.fieldsSource,\n pipe(\n switchMap((fields) => {\n if (!fields || fields.length === 0) {\n return of([] as (ResolvedField | undefined)[]);\n }\n const groupKey = this.field().key;\n const context = {\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n registry: this.rawFieldRegistry(),\n injector: this.groupInjector(),\n destroyRef: this.destroyRef,\n onError: (fieldDef: FieldDef<unknown>, error: unknown) => {\n const fieldKey = fieldDef.key || '<no key>';\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${fieldDef.type}' (key: ${fieldKey}) ` +\n `within group '${groupKey}'. Ensure the field type is registered in your field registry.`,\n error,\n );\n },\n };\n return forkJoin(fields.map((f) => resolveField(f, context)));\n }),\n map((fields) => fields.filter((f): f is ResolvedField => f !== undefined)),\n scan(reconcileFields, [] as ResolvedField[]),\n ),\n { initialValue: [] as ResolvedField[], injector: this.injector },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Effects\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly emitInitializedOnFieldsResolved = explicitEffect([this.resolvedFields], ([fields]) => {\n if (fields.length > 0) {\n emitComponentInitialized(this.eventBus, 'group', this.field().key, this.injector);\n }\n });\n}\n\nexport { GroupFieldComponent };\n","import { Injector, Signal, type Type } from '@angular/core';\n\n/**\n * Generates a unique identifier for array items.\n * Uses crypto.randomUUID() for collision-free IDs that remain stable across position changes.\n */\nexport function generateArrayItemId(): string {\n return crypto.randomUUID();\n}\n\n/**\n * Resolved array item ready for declarative rendering with ngComponentOutlet.\n * Each item has a stable unique ID and a linkedSignal-based index that\n * automatically updates when items are added/removed.\n */\nexport interface ResolvedArrayItem {\n /** Unique identifier for this item (stable across position changes). */\n id: string;\n /** The loaded component type. */\n component: Type<unknown>;\n /** Injector providing ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT. */\n injector: Injector;\n /** Inputs signal for ngComponentOutlet - evaluated in template for reactivity. */\n inputs: Signal<Record<string, unknown>>;\n}\n\n/**\n * Safely extracts an array value from a model object.\n * Returns empty array if the key doesn't exist or value isn't an array.\n */\nexport function getArrayValue<TModel>(value: Partial<TModel> | undefined, key: string): unknown[] {\n const arrayValue = (value as Record<string, unknown>)?.[key];\n return Array.isArray(arrayValue) ? arrayValue : [];\n}\n\n/**\n * Discriminated union of possible differential update operations.\n * Enables optimized array updates without full recreation when possible.\n */\nexport type DifferentialUpdateOperation =\n | { type: 'clear' }\n | { type: 'initial'; fieldTreesLength: number }\n | { type: 'append'; startIndex: number; endIndex: number }\n | { type: 'pop'; newLength: number }\n | { type: 'recreate' }\n | { type: 'none' };\n\n/**\n * Determines the optimal differential update operation based on current and new state.\n *\n * Operations:\n * - Clear all (empty array)\n * - Initial render (no existing items)\n * - Append only (items added at end)\n * - Pop only (items removed from end)\n * - None (same length - items update via linkedSignal)\n */\nexport function determineDifferentialOperation(currentItems: ResolvedArrayItem[], newLength: number): DifferentialUpdateOperation {\n const currentLength = currentItems.length;\n\n if (newLength === 0) {\n return { type: 'clear' };\n }\n\n if (currentLength === 0) {\n return { type: 'initial', fieldTreesLength: newLength };\n }\n\n // For all length changes, we optimize by assuming existing items stay in place.\n // Items handle their own value updates via linkedSignal - no need to compare snapshots.\n // Snapshot comparison was causing false \"recreate\" when existing items had been edited.\n\n if (newLength > currentLength) {\n // Items added - append new ones, existing items stay\n return { type: 'append', startIndex: currentLength, endIndex: newLength };\n }\n\n if (newLength < currentLength) {\n // Items removed - pop from end, remaining items stay\n return { type: 'pop', newLength };\n }\n\n // Same length - no structural change, items update via linkedSignal\n return { type: 'none' };\n}\n","import { Injector, runInInjectionContext, Signal, untracked, linkedSignal } from '@angular/core';\nimport { FieldTree, form } from '@angular/forms/signals';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { ArrayField } from '../../definitions/default/array-field';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { ArrayContext, FieldSignalContext } from '../../mappers/types';\nimport { ARRAY_CONTEXT, FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { mapFieldToInputs } from '../field-mapper/field-mapper';\nimport { flattenFields } from '../flattener/field-flattener';\nimport { createSchemaFromFields } from '../../core/schema-builder';\nimport { getArrayValue } from './array-field.types';\n\n/**\n * Options for creating an array item injector.\n */\nexport interface CreateArrayItemInjectorOptions<TModel> {\n /** The field tree for this item (null for object items without existing FieldTree). */\n fieldTree: FieldTree<unknown> | null;\n /** The field template defining the array item structure. */\n template: FieldDef<unknown>;\n /** Signal containing the current index (uses linkedSignal for auto-updates). */\n indexSignal: Signal<number>;\n /** Parent context for accessing form state and values. */\n parentFieldSignalContext: FieldSignalContext<TModel>;\n /** Parent injector for creating scoped child injector. */\n parentInjector: Injector;\n /** Field registry for looking up field type definitions. */\n registry: Map<string, FieldTypeDefinition>;\n /** The array field definition containing this item. */\n arrayField: ArrayField;\n}\n\n/**\n * Result of creating an array item injector.\n */\nexport interface ArrayItemInjectorResult {\n /** Scoped injector providing ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT. */\n injector: Injector;\n /** Inputs signal for ngComponentOutlet, mapped from the field template. */\n inputs: Signal<Record<string, unknown>>;\n}\n\n/**\n * Syncs item form value changes back to the parent form's array.\n * This effect watches the item form value and updates the parent array when changes occur.\n */\nfunction syncItemToParent<TModel>(\n itemFormInstance: ReturnType<typeof form<unknown>>,\n parentFieldSignalContext: FieldSignalContext<TModel>,\n arrayKey: string,\n indexSignal: Signal<number>,\n injector: Injector,\n): void {\n // Track if we're currently syncing to prevent loops\n let isSyncing = false;\n\n runInInjectionContext(injector, () => {\n // The form instance is callable - call it to get the form state with .value()\n explicitEffect([() => itemFormInstance().value()], ([itemValue]) => {\n if (isSyncing) return;\n\n const parentForm = parentFieldSignalContext.form();\n const parentValue = untracked(() => parentForm.value()) as Record<string, unknown>;\n const currentArray = getArrayValue(parentValue as Partial<TModel>, arrayKey);\n const idx = untracked(() => indexSignal());\n\n // Only sync if value actually changed\n if (idx >= 0 && idx < currentArray.length && currentArray[idx] !== itemValue) {\n isSyncing = true;\n const newArray = [...currentArray];\n newArray[idx] = itemValue;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentForm.value.set({ ...parentValue, [arrayKey]: newArray } as any);\n isSyncing = false;\n }\n });\n });\n}\n\n/**\n * Creates an injector and inputs for an array item.\n *\n * Handles different item types (flatten, group, regular) by creating appropriate\n * form references and scoped injectors with ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT.\n * Sets up two-way sync to propagate item form changes back to the parent form.\n */\nexport function createArrayItemInjectorAndInputs<TModel>(options: CreateArrayItemInjectorOptions<TModel>): ArrayItemInjectorResult {\n const { fieldTree, template, indexSignal, parentFieldSignalContext, parentInjector, registry, arrayField } = options;\n\n // Create item form - uses linkedSignal that derives from parent\n const formRef =\n fieldTree ??\n createObjectItemForm({\n template,\n indexSignal,\n parentFieldSignalContext,\n parentInjector,\n registry,\n arrayKey: arrayField.key,\n });\n\n const injector = createItemInjector({\n formRef,\n indexSignal,\n parentFieldSignalContext,\n parentInjector,\n arrayField,\n });\n\n // Set up two-way sync: item form changes -> parent form array\n // Only sync for locally created forms (not external FieldTrees)\n if (!fieldTree) {\n syncItemToParent(formRef as ReturnType<typeof form<unknown>>, parentFieldSignalContext, arrayField.key, indexSignal, injector);\n }\n\n const inputs = runInInjectionContext(injector, () => {\n return mapFieldToInputs(template, registry);\n });\n\n return { injector, inputs };\n}\n\ninterface CreateObjectItemFormOptions<TModel> {\n template: FieldDef<unknown>;\n indexSignal: Signal<number>;\n parentFieldSignalContext: FieldSignalContext<TModel>;\n parentInjector: Injector;\n registry: Map<string, FieldTypeDefinition>;\n arrayKey: string;\n}\n\n/**\n * Creates a local form for an object array item using linkedSignal.\n * The linkedSignal derives from the parent array at the current index.\n *\n * For array items, we always create a form with a schema to ensure proper field structure.\n * This is needed for valueFieldMapper to find fields via childrenMap.\n */\nfunction createObjectItemForm<TModel>(options: CreateObjectItemFormOptions<TModel>): ReturnType<typeof form<unknown>> {\n const { template, indexSignal, parentFieldSignalContext, parentInjector, registry, arrayKey } = options;\n\n const itemEntity = linkedSignal(() => {\n const parentValue = parentFieldSignalContext.value();\n const arrayValue = getArrayValue(parentValue as Partial<TModel>, arrayKey);\n return arrayValue[indexSignal()] ?? {};\n });\n\n const nestedFields = 'fields' in template && Array.isArray(template.fields) ? template.fields : [];\n\n return runInInjectionContext(parentInjector, () => {\n // Determine which fields to include in the schema\n // - If template has nested fields (e.g., row with children), use those\n // - Otherwise use the template itself as a single-field schema\n const schemaFields = nestedFields.length > 0 ? nestedFields : [template];\n const flattenedFields = flattenFields(schemaFields, registry);\n const schema = createSchemaFromFields(flattenedFields, registry);\n return untracked(() => form(itemEntity, schema));\n });\n}\n\ninterface CreateItemInjectorOptions<TModel> {\n formRef: FieldTree<unknown> | ReturnType<typeof form<unknown>>;\n indexSignal: Signal<number>;\n parentFieldSignalContext: FieldSignalContext<TModel>;\n parentInjector: Injector;\n arrayField: ArrayField;\n}\n\n/**\n * Creates a scoped injector for an array item.\n * Provides both FIELD_SIGNAL_CONTEXT (for form access) and ARRAY_CONTEXT (for position awareness).\n */\nfunction createItemInjector<TModel>(options: CreateItemInjectorOptions<TModel>): Injector {\n const { formRef, indexSignal, parentFieldSignalContext, parentInjector, arrayField } = options;\n\n const arrayContext: ArrayContext = {\n arrayKey: arrayField.key,\n index: indexSignal,\n formValue: parentFieldSignalContext.value(),\n field: arrayField,\n };\n\n const itemFieldSignalContext: FieldSignalContext<unknown> = {\n injector: undefined as unknown as Injector,\n value: parentFieldSignalContext.value,\n defaultValues: () => ({}),\n // formRef is already the form instance (result of form()), no need to wrap in another function\n form: formRef as unknown as ReturnType<typeof form<unknown>>,\n defaultValidationMessages: parentFieldSignalContext.defaultValidationMessages,\n };\n\n const injector = Injector.create({\n parent: parentInjector,\n providers: [\n { provide: FIELD_SIGNAL_CONTEXT, useValue: itemFieldSignalContext },\n { provide: ARRAY_CONTEXT, useValue: arrayContext },\n ],\n });\n\n itemFieldSignalContext.injector = injector;\n\n return injector;\n}\n","import { DestroyRef, Injector, linkedSignal, Signal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\nimport { catchError, from, map, Observable, of } from 'rxjs';\nimport { ArrayField } from '../../definitions/default/array-field';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldSignalContext } from '../../mappers/types';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { generateArrayItemId, ResolvedArrayItem } from './array-field.types';\nimport { createArrayItemInjectorAndInputs } from './create-array-item-injector';\n\n/**\n * Options for resolving an array item.\n */\nexport interface ResolveArrayItemOptions<TModel> {\n /** The field tree for this item (null for object items). */\n fieldTree: FieldTree<unknown> | null;\n /** The initial index of this item in the array. */\n index: number;\n /** The field template defining the array item structure. */\n template: FieldDef<unknown>;\n /** The array field definition containing this item. */\n arrayField: ArrayField;\n /** Signal containing ordered item IDs for reactive index derivation. */\n itemOrderSignal: Signal<string[]>;\n /** Parent context for accessing form state and values. */\n parentFieldSignalContext: FieldSignalContext<TModel>;\n /** Parent injector for creating scoped child injector. */\n parentInjector: Injector;\n /** Field registry for looking up field type definitions. */\n registry: Map<string, FieldTypeDefinition>;\n /** DestroyRef to abort resolution if component is destroyed. */\n destroyRef: DestroyRef;\n /** Function to async load the component for the field type. */\n loadTypeComponent: (type: string) => Promise<unknown>;\n}\n\n/**\n * Resolves a single array item for declarative rendering.\n *\n * Uses linkedSignal for the index, which automatically updates when itemOrderSignal changes.\n * This enables position-aware updates without recreating components when items are reordered.\n */\nexport function resolveArrayItem<TModel>(options: ResolveArrayItemOptions<TModel>): Observable<ResolvedArrayItem | undefined> {\n const {\n fieldTree,\n index,\n template,\n arrayField,\n itemOrderSignal,\n parentFieldSignalContext,\n parentInjector,\n registry,\n destroyRef,\n loadTypeComponent,\n } = options;\n\n return from(loadTypeComponent(template.type)).pipe(\n map((component) => {\n if (destroyRef.destroyed) {\n return undefined;\n }\n\n const itemId = generateArrayItemId();\n\n const indexSignal = linkedSignal(() => {\n const order = itemOrderSignal();\n const idx = order.indexOf(itemId);\n return idx >= 0 ? idx : index;\n });\n\n const { injector, inputs } = createArrayItemInjectorAndInputs({\n fieldTree,\n template,\n indexSignal,\n parentFieldSignalContext,\n parentInjector,\n registry,\n arrayField,\n });\n\n return {\n id: itemId,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: component as any,\n injector,\n inputs,\n };\n }),\n catchError((error) => {\n if (!destroyRef.destroyed) {\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${template.type}' at index ${index} ` +\n `within array '${arrayField.key}'. Ensure the field type is registered in your field registry.`,\n error,\n );\n }\n return of(undefined);\n }),\n );\n}\n","import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, Injector, input, linkedSignal, signal } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter, forkJoin, map, Observable, of } from 'rxjs';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { ArrayField } from '../../definitions/default/array-field';\nimport { injectFieldRegistry } from '../../utils/inject-field-registry/inject-field-registry';\nimport { FieldTree } from '@angular/forms/signals';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { getFieldDefaultValue } from '../../utils/default-value/default-value';\nimport { getFieldValueHandling } from '../../models/field-type';\nimport { emitComponentInitialized } from '../../utils/emit-initialization/emit-initialization';\nimport { AddArrayItemEvent } from '../../events/constants/add-array-item.event';\nimport { RemoveArrayItemEvent } from '../../events/constants/remove-array-item.event';\nimport { EventBus } from '../../events/event.bus';\nimport { FieldSignalContext } from '../../mappers/types';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { getChildFieldTree } from '../../utils/form-internals/form-internals';\nimport { determineDifferentialOperation, getArrayValue, ResolvedArrayItem } from '../../utils/array-field/array-field.types';\nimport { resolveArrayItem } from '../../utils/array-field/resolve-array-item';\n\n/**\n * Container component for rendering dynamic arrays of fields.\n *\n * Supports add/remove operations via AddArrayItemEvent and RemoveArrayItemEvent.\n * Uses differential updates to optimize rendering - only recreates items when necessary.\n * Each item gets a scoped injector with ARRAY_CONTEXT for position-aware operations.\n */\n@Component({\n selector: 'array-field',\n imports: [NgComponentOutlet],\n template: `\n @for (item of resolvedItems(); track item.id) {\n <ng-container *ngComponentOutlet=\"item.component; injector: item.injector; inputs: item.inputs()\" />\n }\n `,\n styleUrl: './array-field.component.scss',\n host: {\n class: 'df-field df-array',\n '[id]': '`${key()}`',\n '[attr.data-testid]': 'key()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class ArrayFieldComponent<TModel = Record<string, unknown>> {\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly parentFieldSignalContext = inject(FIELD_SIGNAL_CONTEXT) as FieldSignalContext<TModel>;\n private readonly parentInjector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n field = input.required<ArrayField>();\n key = input.required<string>();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n private readonly fieldTemplate = computed<FieldDef<unknown> | null>(() => {\n const arrayField = this.field();\n return arrayField.fields && arrayField.fields.length > 0 ? arrayField.fields[0] : null;\n });\n\n private readonly arrayFieldTrees = computed<readonly (FieldTree<unknown> | null)[]>(() => {\n const arrayKey = this.field().key;\n const parentForm = this.parentFieldSignalContext.form();\n const arrayValue = getArrayValue(this.parentFieldSignalContext.value(), arrayKey);\n\n if (arrayValue.length === 0) return [];\n\n // Get the array FieldTree from the parent form\n const arrayFieldTree = getChildFieldTree(parentForm, arrayKey);\n if (!arrayFieldTree) return arrayValue.map(() => null);\n\n // Access array items via bracket notation - Angular Signal Forms arrays support this\n // The type is ReadonlyArrayLike<MaybeFieldTree<U, number>>\n const arrayWithIndex = arrayFieldTree as unknown as readonly (FieldTree<unknown> | undefined)[];\n\n const items: (FieldTree<unknown> | null)[] = [];\n for (let i = 0; i < arrayValue.length; i++) {\n // Access item FieldTree directly via bracket notation\n const itemFieldTree = arrayWithIndex[i];\n items.push(itemFieldTree ?? null);\n }\n\n return items;\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // State Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly resolvedItemsSignal = signal<ResolvedArrayItem[]>([]);\n private readonly updateVersion = signal(0);\n private readonly itemOrderSignal = linkedSignal(() => this.resolvedItemsSignal().map((item) => item.id));\n\n readonly resolvedItems = linkedSignal(() => this.resolvedItemsSignal());\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Effects\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly syncFieldsOnArrayChange = explicitEffect([this.arrayFieldTrees], ([fieldTrees]) => {\n this.updateVersion.update((v) => v + 1);\n const currentVersion = this.updateVersion();\n this.performDifferentialUpdate(fieldTrees, currentVersion);\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Event Handlers\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly handleAddItem = this.eventBus\n .on<AddArrayItemEvent>('add-array-item')\n .pipe(\n takeUntilDestroyed(),\n filter((event) => event.arrayKey === this.key()),\n )\n .subscribe((event) => this.addItem(event.field ?? this.fieldTemplate(), event.index));\n\n private readonly handleRemoveItem = this.eventBus\n .on<RemoveArrayItemEvent>('remove-array-item')\n .pipe(\n takeUntilDestroyed(),\n filter((event) => event.arrayKey === this.key()),\n )\n .subscribe((event) => this.removeItem(event.index));\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Private Methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n private performDifferentialUpdate(fieldTrees: readonly (FieldTree<unknown> | null)[], updateId: number): void {\n const resolvedItems = this.resolvedItemsSignal();\n const operation = determineDifferentialOperation(resolvedItems, fieldTrees.length);\n\n switch (operation.type) {\n case 'clear':\n this.resolvedItemsSignal.set([]);\n break;\n case 'initial':\n this.resolveAllItems(fieldTrees, updateId);\n break;\n case 'append':\n this.appendItems(fieldTrees, operation.startIndex, operation.endIndex, updateId);\n break;\n case 'pop':\n this.resolvedItemsSignal.set(resolvedItems.slice(0, operation.newLength));\n break;\n case 'recreate':\n this.resolvedItemsSignal.set([]);\n this.resolveAllItems(fieldTrees, updateId);\n break;\n case 'none':\n break;\n }\n }\n\n private resolveAllItems(fieldTrees: readonly (FieldTree<unknown> | null)[], updateId: number): void {\n if (fieldTrees.length === 0) {\n this.resolvedItemsSignal.set([]);\n return;\n }\n\n const itemObservables = fieldTrees.map((fieldTree, i) => this.createResolveItemObservable(fieldTree, i));\n\n forkJoin(itemObservables)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((items) => items.filter((item): item is ResolvedArrayItem => item !== undefined)),\n )\n .subscribe((newItems) => {\n if (updateId === this.updateVersion()) {\n this.resolvedItemsSignal.set(newItems);\n emitComponentInitialized(this.eventBus, 'array', this.field().key, this.parentInjector);\n }\n });\n }\n\n private appendItems(fieldTrees: readonly (FieldTree<unknown> | null)[], startIndex: number, endIndex: number, updateId: number): void {\n const itemsToResolve = fieldTrees.slice(startIndex, endIndex);\n if (itemsToResolve.length === 0) return;\n\n const itemObservables = itemsToResolve.map((fieldTree, i) => this.createResolveItemObservable(fieldTree, startIndex + i));\n\n forkJoin(itemObservables)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((items) => items.filter((item): item is ResolvedArrayItem => item !== undefined)),\n )\n .subscribe((newItems) => {\n if (updateId === this.updateVersion()) {\n this.resolvedItemsSignal.update((current) => [...current, ...newItems]);\n }\n });\n }\n\n private createResolveItemObservable(fieldTree: FieldTree<unknown> | null, index: number): Observable<ResolvedArrayItem | undefined> {\n const template = this.fieldTemplate();\n if (!template) return of(undefined);\n\n return resolveArrayItem({\n fieldTree,\n index,\n template,\n arrayField: this.field(),\n itemOrderSignal: this.itemOrderSignal,\n parentFieldSignalContext: this.parentFieldSignalContext,\n parentInjector: this.parentInjector,\n registry: this.rawFieldRegistry(),\n destroyRef: this.destroyRef,\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n });\n }\n\n private addItem(fieldTemplate: FieldDef<unknown> | null, index?: number): void {\n if (!fieldTemplate) {\n console.error(\n `[Dynamic Forms] Cannot add item to array '${this.field().key}': no field template provided. ` +\n 'Ensure the array field has a fields property with at least one field definition.',\n );\n return;\n }\n\n const arrayKey = this.field().key;\n const formObject = this.parentFieldSignalContext.form();\n const currentValue = formObject.value() as TModel;\n const currentArray = getArrayValue(currentValue as Partial<TModel>, arrayKey);\n const insertIndex = index !== undefined ? Math.min(index, currentArray.length) : currentArray.length;\n\n const rawValue = getFieldDefaultValue(fieldTemplate, this.rawFieldRegistry());\n const valueHandling = getFieldValueHandling(fieldTemplate.type, this.rawFieldRegistry());\n\n // For fields with 'include' value handling (bare fields like input, checkbox, etc.),\n // wrap the value in an object using the field's key since arrays contain objects\n const value = valueHandling === 'include' && fieldTemplate.key ? { [fieldTemplate.key]: rawValue } : rawValue;\n\n const newArray = [...currentArray];\n newArray.splice(insertIndex, 0, value);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formObject.value.set({ ...currentValue, [arrayKey]: newArray } as any);\n }\n\n private removeItem(index?: number): void {\n const arrayKey = this.field().key;\n const formObject = this.parentFieldSignalContext.form();\n const currentValue = formObject.value() as TModel;\n const currentArray = getArrayValue(currentValue as Partial<TModel>, arrayKey);\n\n if (currentArray.length === 0) return;\n\n const removeIndex = index !== undefined ? Math.min(index, currentArray.length - 1) : currentArray.length - 1;\n const newArray = [...currentArray];\n newArray.splice(removeIndex, 1);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formObject.value.set({ ...currentValue, [arrayKey]: newArray } as any);\n }\n}\n\nexport { ArrayFieldComponent };\n","/**\n * @ng-forge/dynamic-forms\n *\n * Dynamic forms library for Angular applications.\n *\n * ## Public API (for end users)\n * - DynamicForm component\n * - provideDynamicForm() for configuration\n * - FormConfig and field definition types\n * - Event classes (SubmitEvent, PageChangeEvent, etc.)\n *\n * ## Integration API (for UI library authors building Material, Bootstrap, etc.)\n * - Mappers (baseFieldMapper, valueFieldMapper, etc.)\n * - FieldTypeDefinition for registering field types\n * - DynamicTextPipe, shouldShowErrors, createResolvedErrorsSignal\n * - EventBus for custom event handling\n */\n\n// ============================================================\n// PUBLIC API - For end users\n// ============================================================\n\n// Core Component\nexport { DynamicForm } from './dynamic-form.component';\n\n// Provider System\nexport { provideDynamicForm } from './providers';\nexport type { ExtractFieldDefs, ExtractFormValue } from './providers';\n\n// Configuration Types\nexport type { CustomFnConfig, FormConfig, FormOptions } from './models';\n\nexport type { DynamicText, FieldOption, ValidationError, ValidationMessages } from './models';\n\n// Submission Config\nexport type { SubmissionConfig, SubmissionActionResult, SubmitButtonOptions, NextButtonOptions } from './models';\n\n// Form State Condition\nexport type { FormStateCondition } from './models';\nexport { isFormStateCondition } from './models';\n\n// Button Logic Resolver (for UI library authors)\nexport { resolveSubmitButtonDisabled, resolveNextButtonDisabled } from './core/logic';\nexport type { ButtonLogicContext } from './core/logic';\n\n// Field Definition Types\nexport type {\n ArrayField,\n BaseCheckedField,\n BaseValueField,\n ButtonField,\n CheckboxField,\n CheckedFieldComponent,\n DatepickerField,\n DatepickerProps,\n FieldComponent,\n FieldDef,\n FieldWithValidation,\n GroupField,\n InputField,\n InputProps,\n MultiCheckboxField,\n PageField,\n RadioField,\n RowField,\n SelectField,\n SelectProps,\n SliderField,\n TextareaField,\n TextareaProps,\n TextElementType,\n TextField,\n TextProps,\n ToggleField,\n ValueFieldComponent,\n ValueType,\n} from './definitions';\n\nexport { isCheckedField, isValueField } from './definitions';\n\n// Validation Config Types\nexport type {\n AsyncValidatorConfig,\n BaseValidatorConfig,\n BuiltInValidatorConfig,\n CustomValidatorConfig,\n HttpValidatorConfig,\n ValidatorConfig,\n} from './models';\n\n// Validator Function Types (for customFnConfig)\nexport type { AsyncCustomValidator, CustomValidator, HttpCustomValidator } from './core/validation';\n\n// Logic & Expression Types\nexport type { ConditionalExpression, EvaluationContext, LogicConfig } from './models';\n\n// Schema Types\nexport type { SchemaApplicationConfig, SchemaDefinition } from './models';\n\n// Registry Types (for module augmentation)\nexport type {\n AvailableFieldTypes,\n ContainerFieldTypes,\n DynamicFormFieldRegistry,\n FieldRegistryContainers,\n FieldRegistryLeaves,\n LeafFieldTypes,\n RegisteredFieldTypes,\n} from './models';\n\n// Utility Types\nexport type {\n ArrayAllowedChildren,\n FieldPathAccess,\n FormMode,\n FormModeDetectionResult,\n GroupAllowedChildren,\n InferFormValue,\n PageAllowedChildren,\n Prettify,\n RowAllowedChildren,\n WithInputSignals,\n} from './models';\n\n// Type Guards\nexport {\n isArrayField,\n isContainerField,\n isDisplayOnlyField,\n isGroupField,\n isLeafField,\n isPageField,\n isRowField,\n isValueBearingField,\n} from './models';\n\n// Events\nexport {\n AddArrayItemEvent,\n FormClearEvent,\n FormResetEvent,\n NextPageEvent,\n PageChangeEvent,\n PreviousPageEvent,\n RemoveArrayItemEvent,\n SubmitEvent,\n} from './events';\n\nexport type { FormEvent } from './events';\n\n// ============================================================\n// INTEGRATION API - For UI library authors\n// (Material, Bootstrap, PrimeNG, Ionic, etc.)\n// ============================================================\n\n// Mappers - for creating FieldTypeDefinition\nexport {\n arrayFieldMapper,\n baseFieldMapper,\n buildBaseInputs,\n checkboxFieldMapper,\n datepickerFieldMapper,\n groupFieldMapper,\n pageFieldMapper,\n optionsFieldMapper,\n rowFieldMapper,\n valueFieldMapper,\n} from './mappers';\n\nexport type { ArrayContext, FieldSignalContext, MapperFn } from './mappers';\n\n// Field Type Definition - for registering custom field types\nexport type { FieldTypeDefinition, ValueHandlingMode } from './models';\nexport { FIELD_REGISTRY, getFieldValueHandling } from './models';\n\n// Signal Context - injection tokens for field components\nexport { ARRAY_CONTEXT, FIELD_SIGNAL_CONTEXT } from './models';\n\n// Error Display Utilities - for field components\nexport { createResolvedErrorsSignal, shouldShowErrors } from './utils';\nexport type { ResolvedError } from './utils';\n\n// Dynamic Text - for translatable labels\nexport { dynamicTextToObservable } from './utils';\nexport { DynamicTextPipe } from './pipes';\n\n// Container Components - for building custom containers\nexport { ArrayFieldComponent, GroupFieldComponent, RowFieldComponent } from './fields';\n\n// Validation - for applying validators in custom fields\nexport { applyValidator, applyValidators } from './core/validation';\nexport type { HttpResourceRequest } from './core/validation';\n\n// Event Utilities - for custom event handling\nexport { EventBus } from './events';\nexport { resolveTokens } from './events';\nexport type { ArrayItemContext, FormEventConstructor, TokenContext } from './events';\n\n// Registry Utilities\nexport { injectFieldRegistry } from './utils/inject-field-registry/inject-field-registry';\nexport { BUILT_IN_FIELDS } from './providers';\n\n// Event Args Type\nexport type { EventArgs } from './definitions';\n\n// Form Internals - for advanced container field implementations\nexport { getChildFieldTree, getChildrenMap, getFieldProxy, hasFormStructure } from './utils/form-internals';\nexport type { FormInternals } from './utils/form-internals';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["toSupportedPath","isContainerWithFields","map","filter","switchMap","scan"],"mappings":";;;;;;;;;AA+BA;;AAEG;AACH,SAAS,aAAa,CAAC,KAAc,EAAA;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtE;AAEA;;AAEG;AACH,SAAS,cAAc,CAAC,KAAc,EAAA;AACpC,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrI;AAyDA;SACgB,mBAAmB,CACjC,MAAuE,EACvE,QAAsE,EACtE,OAAsC,EAAA;AAEtC,IAAA,MAAM,SAAS,GAAkB,KAAK,CAAC,MAAK;;AAE1C,QAAA,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;AACpB,YAAA,OAAO,YAAY,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC7D;;AAGA,QAAA,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AACtF,YAAA,OAAO,aAAa,CAAC,WAAW,CAAC;QACnC;;AAGA,QAAA,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE;YAC1B,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,EAAA,cAAA,EAAA,mBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAb5B;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,qpKAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EALS,iBAAiB,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,mBAAA,EAAA,yBAAA,EAAA,2BAAA,EAAA,sCAAA,EAAA,0BAAA,EAAA,2BAAA,CAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAcR,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAhBvC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EAAA,OAAA,EACd,CAAC,iBAAiB,CAAC,EAAA,QAAA,EAClB;;;;GAIT,EAAA,IAAA,EAEK;AACJ,wBAAA,KAAK,EAAE,mBAAmB;AAC1B,wBAAA,MAAM,EAAE,YAAY;AACpB,wBAAA,oBAAoB,EAAE,OAAO;qBAC9B,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,qpKAAA,CAAA,EAAA;;;;;;;;;AC1CjD;;;;;;;;;;;;;;;;AAgBG;AAEH;AACA;AACA;AAEA;;ACtBA;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-forge-dynamic-forms-ng-forge-dynamic-forms-BWj75LVN.mjs","sources":["../../../../packages/dynamic-forms/src/lib/utils/derived-from-deferred/derived-from-deferred.ts","../../../../packages/dynamic-forms/src/lib/utils/grid-classes/grid-classes.ts","../../../../packages/dynamic-forms/src/lib/mappers/base/base-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/utils/field-mapper/field-mapper.ts","../../../../packages/dynamic-forms/src/lib/utils/resolve-field/resolve-field.ts","../../../../packages/dynamic-forms/src/lib/utils/submission-handler/submission-handler.ts","../../../../packages/dynamic-forms/src/lib/utils/object-utils.ts","../../../../packages/dynamic-forms/src/lib/models/field-signal-context.token.ts","../../../../packages/dynamic-forms/src/lib/models/field-type.ts","../../../../packages/dynamic-forms/src/lib/utils/inject-field-registry/inject-field-registry.ts","../../../../packages/dynamic-forms/src/lib/core/registry/root-form-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/registry/field-context-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/registry/function-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/value-utils.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/types.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/tokenizer.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/parser.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/evaluator.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/parser/expression-parser.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/condition-evaluator.ts","../../../../packages/dynamic-forms/src/lib/core/expressions/logic-function-factory.ts","../../../../packages/dynamic-forms/src/lib/core/values/dynamic-value-factory.ts","../../../../packages/dynamic-forms/src/lib/models/logic/logic-config.ts","../../../../packages/dynamic-forms/src/lib/core/cross-field/cross-field-detector.ts","../../../../packages/dynamic-forms/src/lib/core/validation/validator-factory.ts","../../../../packages/dynamic-forms/src/lib/core/logic/logic-applicator.ts","../../../../packages/dynamic-forms/src/lib/core/registry/schema-registry.service.ts","../../../../packages/dynamic-forms/src/lib/core/values/type-predicate-factory.ts","../../../../packages/dynamic-forms/src/lib/core/schema-application.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/group-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/array-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/row-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/default/page-field.ts","../../../../packages/dynamic-forms/src/lib/core/form-mapping.ts","../../../../packages/dynamic-forms/src/lib/utils/default-value/default-value.ts","../../../../packages/dynamic-forms/src/lib/models/types/type-guards.ts","../../../../packages/dynamic-forms/src/lib/core/schema-builder.ts","../../../../packages/dynamic-forms/src/lib/events/event.bus.ts","../../../../packages/dynamic-forms/src/lib/events/constants/submit.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/component-initialized.event.ts","../../../../packages/dynamic-forms/src/lib/utils/initialization-tracker/initialization-tracker.ts","../../../../packages/dynamic-forms/src/lib/models/types/form-mode.ts","../../../../packages/dynamic-forms/src/lib/utils/flattener/field-flattener.ts","../../../../packages/dynamic-forms/src/lib/core/cross-field/cross-field-collector.ts","../../../../packages/dynamic-forms/src/lib/utils/form-validation/form-mode-validator.ts","../../../../packages/dynamic-forms/src/lib/events/constants/next-page.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/page-change.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/previous-page.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/add-array-item.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/remove-array-item.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/form-reset.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/form-clear.event.ts","../../../../packages/dynamic-forms/src/lib/events/constants/page-navigation-state-change.event.ts","../../../../packages/dynamic-forms/src/lib/core/page-orchestrator/page-orchestrator.component.ts","../../../../packages/dynamic-forms/src/lib/dynamic-form.component.ts","../../../../packages/dynamic-forms/src/lib/mappers/array/array-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/group/group-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/row/row-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/page/page-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/text/text-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/providers/built-in-fields.ts","../../../../packages/dynamic-forms/src/lib/providers/dynamic-form-providers.ts","../../../../packages/dynamic-forms/src/lib/core/logic/button-logic-resolver.ts","../../../../packages/dynamic-forms/src/lib/definitions/base/base-value-field.ts","../../../../packages/dynamic-forms/src/lib/definitions/base/base-checked-field.ts","../../../../packages/dynamic-forms/src/lib/events/utils/token-resolver.ts","../../../../packages/dynamic-forms/src/lib/utils/form-internals/form-internals.ts","../../../../packages/dynamic-forms/src/lib/mappers/value/value-field.mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/checkbox/checkbox-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/select/options-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/mappers/datepicker/datepicker-field-mapper.ts","../../../../packages/dynamic-forms/src/lib/utils/dynamic-text-to-observable.ts","../../../../packages/dynamic-forms/src/lib/utils/should-show-errors.ts","../../../../packages/dynamic-forms/src/lib/utils/interpolate-params.ts","../../../../packages/dynamic-forms/src/lib/utils/create-resolved-errors-signal.ts","../../../../packages/dynamic-forms/src/lib/pipes/dynamic-text/dynamic-text.pipe.ts","../../../../packages/dynamic-forms/src/lib/utils/emit-initialization/emit-initialization.ts","../../../../packages/dynamic-forms/src/lib/fields/row/row-field.component.ts","../../../../packages/dynamic-forms/src/lib/fields/group/group-field.component.ts","../../../../packages/dynamic-forms/src/lib/utils/array-field/array-field.types.ts","../../../../packages/dynamic-forms/src/lib/utils/array-field/create-array-item-injector.ts","../../../../packages/dynamic-forms/src/lib/utils/array-field/resolve-array-item.ts","../../../../packages/dynamic-forms/src/lib/fields/array/array-field.component.ts","../../../../packages/dynamic-forms/src/lib/index.ts","../../../../packages/dynamic-forms/src/ng-forge-dynamic-forms.ts"],"sourcesContent":["import { Injector, isSignal, Signal } from '@angular/core';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { combineLatest, defer, Observable, OperatorFunction } from 'rxjs';\n\n/**\n * Options for derivedFromDeferred.\n */\nexport interface DerivedFromDeferredOptions<R> {\n initialValue: R;\n injector: Injector;\n}\n\n/**\n * Type helper to extract the value type from a Signal.\n */\ntype SignalValue<T> = T extends Signal<infer V> ? V : never;\n\n/**\n * Type helper to map an array of Signals to an array of their value types.\n */\ntype SignalValues<T extends readonly Signal<unknown>[]> = {\n [K in keyof T]: SignalValue<T[K]>;\n};\n\n/**\n * Type helper to map an object of Signals to an object of their value types.\n */\ntype SignalObjectValues<T extends Record<string, Signal<unknown>>> = {\n [K in keyof T]: SignalValue<T[K]>;\n};\n\n/**\n * Type guard to check if a value is an array of Signals.\n */\nfunction isSignalArray(value: unknown): value is readonly Signal<unknown>[] {\n return Array.isArray(value) && value.every((item) => isSignal(item));\n}\n\n/**\n * Type guard to check if a value is an object of Signals (record).\n */\nfunction isSignalRecord(value: unknown): value is Record<string, Signal<unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.values(value).every((item) => isSignal(item));\n}\n\n/**\n * Like derivedFrom from ngxtension, but uses defer() to avoid input availability issues.\n * This ensures toObservable is called at subscription time, not at field initialization.\n *\n * Supports three source types:\n * - Single signal: `derivedFromDeferred(signal, operator, options)`\n * - Array of signals: `derivedFromDeferred([signal1, signal2], operator, options)`\n * - Object of signals: `derivedFromDeferred({a: signal1, b: signal2}, operator, options)`\n *\n * @example\n * ```typescript\n * // Single signal\n * const result = derivedFromDeferred(\n * mySignal,\n * pipe(map(v => v * 2)),\n * { initialValue: 0, injector }\n * );\n *\n * // Array of signals\n * const result = derivedFromDeferred(\n * [signalA, signalB],\n * pipe(map(([a, b]) => a + b)),\n * { initialValue: 0, injector }\n * );\n *\n * // Object of signals\n * const result = derivedFromDeferred(\n * { x: signalX, y: signalY },\n * pipe(map(({ x, y }) => x + y)),\n * { initialValue: 0, injector }\n * );\n * ```\n */\n\n// Overload: Single signal\nexport function derivedFromDeferred<T, R>(\n source: Signal<T>,\n operator: OperatorFunction<T, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R>;\n\n// Overload: Array of signals\nexport function derivedFromDeferred<T extends readonly Signal<unknown>[], R>(\n sources: [...T],\n operator: OperatorFunction<SignalValues<T>, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R>;\n\n// Overload: Object of signals\nexport function derivedFromDeferred<T extends Record<string, Signal<unknown>>, R>(\n sources: T,\n operator: OperatorFunction<SignalObjectValues<T>, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R>;\n\n// Implementation\nexport function derivedFromDeferred<T, R>(\n source: Signal<T> | Signal<unknown>[] | Record<string, Signal<unknown>>,\n operator: OperatorFunction<T | unknown[] | Record<string, unknown>, R>,\n options: DerivedFromDeferredOptions<R>,\n): Signal<R> {\n const deferred$: Observable<R> = defer(() => {\n // Handle single signal\n if (isSignal(source)) {\n return toObservable(source, { injector: options.injector });\n }\n\n // Handle array of signals\n if (isSignalArray(source)) {\n const observables = source.map((s) => toObservable(s, { injector: options.injector }));\n return combineLatest(observables);\n }\n\n // Handle object of signals\n if (isSignalRecord(source)) {\n const keys = Object.keys(source);\n const observables = keys.map((key) => toObservable(source[key], { injector: options.injector }));\n\n return combineLatest(observables, (...values) => {\n const result: Record<string, unknown> = {};\n keys.forEach((key, index) => {\n result[key] = values[index];\n });\n return result;\n });\n }\n\n // Fallback - should not happen with proper typing\n throw new Error('Invalid source type. Expected a Signal, array of Signals, or object of Signals.');\n }).pipe(operator);\n\n return toSignal(deferred$, { initialValue: options.initialValue, injector: options.injector });\n}\n","import { FieldDef } from '../../definitions/base/field-def';\n\n/**\n * Generates CSS class string for responsive grid layout based on field column configuration.\n *\n * Creates Bootstrap-style column classes for implementing responsive form layouts.\n * Validates column values to ensure they fall within the standard 12-column grid system.\n *\n * @param fieldDef - Field definition containing column configuration\n * @returns CSS class string for grid layout, empty if no valid column configuration\n *\n * @example\n * ```typescript\n * // Full width field\n * const fullWidth = getGridClassString({ type: 'input', key: 'name', col: 12 });\n * // Returns: 'df-col-12'\n *\n * // Half width field\n * const halfWidth = getGridClassString({ type: 'input', key: 'email', col: 6 });\n * // Returns: 'df-col-6'\n *\n * // Invalid column value\n * const invalid = getGridClassString({ type: 'input', key: 'phone', col: 15 });\n * // Returns: ''\n * ```\n *\n * @example\n * ```typescript\n * // Usage in component template\n * @Component({\n * template: `\n * <div [class]=\"getGridClassString(field)\" class=\"form-field\">\n * <!-- Field content -->\n * </div>\n * `\n * })\n * export class FieldComponent {\n * field: FieldDef<any>;\n * getGridClassString = getGridClassString;\n * }\n * ```\n *\n * @public\n */\nexport function getGridClassString(fieldDef: FieldDef<any>): string {\n const classes: string[] = [];\n\n if (typeof fieldDef.col === 'number' && fieldDef.col > 0 && fieldDef.col <= 12) {\n classes.push(`df-col-${fieldDef.col}`);\n }\n\n return classes.join(' ');\n}\n","import { computed, Signal } from '@angular/core';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { getGridClassString } from '../../utils/grid-classes/grid-classes';\n\n/**\n * Builds base input properties from a field definition.\n *\n * This is a helper function that extracts common field properties.\n * Used by mappers to build the inputs record.\n *\n * @param fieldDef The field definition to extract properties from\n * @returns Record of input names to values\n */\nexport function buildBaseInputs(fieldDef: FieldDef<unknown>): Record<string, unknown> {\n const { key, label, className, tabIndex, props } = fieldDef;\n const inputs: Record<string, unknown> = {};\n\n // Always include key - required by components for accessibility and identification\n inputs['key'] = key;\n\n if (label !== undefined) {\n inputs['label'] = label;\n }\n\n // Combine user className with generated grid classes\n const gridClassString = getGridClassString(fieldDef);\n const allClasses: string[] = [];\n\n if (gridClassString) {\n allClasses.push(gridClassString);\n }\n\n if (className) {\n allClasses.push(className);\n }\n\n if (allClasses.length > 0) {\n inputs['className'] = allClasses.join(' ');\n }\n\n if (tabIndex !== undefined) {\n inputs['tabIndex'] = tabIndex;\n }\n\n if (props !== undefined) {\n inputs['props'] = props;\n }\n\n return inputs;\n}\n\n/**\n * Base field mapper that extracts common field properties into component inputs.\n *\n * Returns a Signal containing the Record of input names to values that will be\n * passed to ngComponentOutlet. The signal enables reactive updates.\n *\n * @param fieldDef The field definition to map\n * @returns Signal containing Record of input names to values\n */\nexport function baseFieldMapper(fieldDef: FieldDef<unknown>): Signal<Record<string, unknown>> {\n // For base mapper, inputs are static (no reactive dependencies)\n // Wrap in computed for consistency with the MapperFn type\n return computed(() => buildBaseInputs(fieldDef));\n}\n","import { Signal } from '@angular/core';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { baseFieldMapper } from '../../mappers/base/base-field-mapper';\n\n/**\n * Main field mapper function that uses the field registry to get the appropriate mapper\n * based on the field's type property.\n *\n * This function must be called within an injection context where FIELD_SIGNAL_CONTEXT\n * is provided, as mappers inject the context to access form state.\n *\n * @param fieldDef The field definition to map\n * @param fieldRegistry The registry of field type definitions\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function mapFieldToInputs(\n fieldDef: FieldDef<unknown>,\n fieldRegistry: Map<string, FieldTypeDefinition>,\n): Signal<Record<string, unknown>> {\n // Get the field type definition from registry\n const fieldType = fieldRegistry.get(fieldDef.type);\n\n if (fieldType?.mapper) {\n // Use the registered mapper for this field type\n // Mapper will inject FIELD_SIGNAL_CONTEXT internally\n return fieldType.mapper(fieldDef);\n }\n\n // Fallback to base mapper\n // Mapper will inject FIELD_SIGNAL_CONTEXT internally\n return baseFieldMapper(fieldDef);\n}\n","import { DestroyRef, Injector, runInInjectionContext, Signal, Type } from '@angular/core';\nimport { catchError, from, map, Observable, of } from 'rxjs';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { mapFieldToInputs } from '../field-mapper/field-mapper';\n\n/**\n * Resolved field ready for rendering with ngComponentOutlet.\n */\nexport interface ResolvedField {\n key: string;\n component: Type<unknown>;\n injector: Injector;\n inputs: Signal<Record<string, unknown>>;\n}\n\n/**\n * Context required to resolve a field.\n */\nexport interface ResolveFieldContext {\n /** The field registry to load components from */\n loadTypeComponent: (type: string) => Promise<Type<unknown>>;\n /** The raw field registry map for mappers */\n registry: Map<string, FieldTypeDefinition>;\n /** The injector to use for the resolved field */\n injector: Injector;\n /** DestroyRef to check if component is destroyed */\n destroyRef: DestroyRef;\n /** Optional error handler for logging */\n onError?: (fieldDef: FieldDef<unknown>, error: unknown) => void;\n}\n\n/**\n * Resolves a single field definition to a ResolvedField using RxJS.\n * Loads the component asynchronously and maps inputs in the injection context.\n *\n * @param fieldDef - The field definition to resolve\n * @param context - The context containing dependencies for resolution\n * @returns Observable that emits ResolvedField or undefined on error\n */\nexport function resolveField(fieldDef: FieldDef<unknown>, context: ResolveFieldContext): Observable<ResolvedField | undefined> {\n return from(context.loadTypeComponent(fieldDef.type)).pipe(\n map((component) => {\n // Check if component is destroyed before proceeding\n if (context.destroyRef.destroyed) {\n return undefined;\n }\n\n // Run mapper in injection context\n const inputs = runInInjectionContext(context.injector, () => mapFieldToInputs(fieldDef, context.registry));\n\n return {\n key: fieldDef.key,\n component,\n injector: context.injector,\n inputs,\n };\n }),\n catchError((error) => {\n // Only handle errors if component hasn't been destroyed\n if (!context.destroyRef.destroyed) {\n context.onError?.(fieldDef, error);\n }\n return of(undefined);\n }),\n );\n}\n\n/**\n * Reconciles previous and current resolved fields to preserve injector instances\n * for fields that haven't changed type, preventing unnecessary component recreation.\n *\n * @param prev - Previous resolved fields array\n * @param curr - Current resolved fields array\n * @returns Reconciled fields with preserved injectors where applicable\n */\nexport function reconcileFields(prev: ResolvedField[], curr: ResolvedField[]): ResolvedField[] {\n const prevMap = new Map(prev.map((f) => [f.key, f]));\n\n return curr.map((field) => {\n const existing = prevMap.get(field.key);\n\n if (existing && existing.component === field.component) {\n // Same key & type - reuse existing injector, update inputs\n return {\n ...field,\n injector: existing.injector,\n };\n }\n\n // New field or type changed - use new injector\n return field;\n });\n}\n","import { Signal } from '@angular/core';\nimport { submit } from '@angular/forms/signals';\nimport { EMPTY, firstValueFrom, from, isObservable, Observable, switchMap } from 'rxjs';\nimport { EventBus } from '../../events/event.bus';\nimport { SubmitEvent } from '../../events/constants/submit.event';\nimport { FormConfig } from '../../models/form-config';\nimport { RegisteredFieldTypes } from '../../models/registry/field-registry';\n\n/**\n * Options for creating a submission handler.\n */\nexport interface SubmissionHandlerOptions<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[]> {\n /** Event bus instance for listening to submit events */\n eventBus: EventBus;\n /** Signal containing the form configuration */\n configSignal: Signal<FormConfig<TFields>>;\n /** Signal containing the form instance */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formSignal: Signal<any>;\n}\n\n/**\n * Wraps a submission action to handle both Promise and Observable returns.\n * Converts Observables to Promises for compatibility with Angular Signal Forms' submit().\n *\n * @param action - The submission action function\n * @returns A wrapped function that always returns a Promise\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrapSubmissionAction(action: (formTree: any) => any): (formTree: any) => Promise<any> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (formTree: any): Promise<any> => {\n const result = action(formTree);\n // If the action returns an Observable, convert it to a Promise\n if (isObservable(result)) {\n return firstValueFrom(result);\n }\n return result;\n };\n}\n\n/**\n * Creates an Observable that handles form submission with optional submission action.\n *\n * This utility encapsulates the submission handling logic:\n * - Listens for submit events from the event bus\n * - If a submission.action is configured, wraps it and uses Angular Signal Forms' submit()\n * - Handles both Promise and Observable returns from the action\n * - Uses switchMap to cancel any in-flight submission when a new one starts\n *\n * The returned Observable should be subscribed to with takeUntilDestroyed() in the component.\n *\n * @param options - Configuration options for the submission handler\n * @returns Observable that processes submissions (emits when submission completes)\n *\n * @example\n * ```typescript\n * // In component constructor\n * createSubmissionHandler({\n * eventBus: this.eventBus,\n * configSignal: this.config,\n * formSignal: this.form,\n * })\n * .pipe(takeUntilDestroyed())\n * .subscribe();\n * ```\n */\nexport function createSubmissionHandler<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[]>(\n options: SubmissionHandlerOptions<TFields>,\n): Observable<unknown> {\n const { eventBus, configSignal, formSignal } = options;\n\n return eventBus.on<SubmitEvent>('submit').pipe(\n switchMap(() => {\n const submissionConfig = configSignal().submission;\n\n // If no submission action is configured, let the submitted output handle it\n // This maintains backward compatibility for users handling submission manually\n if (!submissionConfig?.action) {\n return EMPTY;\n }\n\n const wrappedAction = wrapSubmissionAction(submissionConfig.action);\n\n // Use Angular Signal Forms' native submit() function\n // This automatically:\n // - Sets form.submitting() to true during execution\n // - Applies server errors to form fields on completion\n // - Sets form.submitting() to false when done\n return from(submit(formSignal(), wrappedAction));\n }),\n );\n}\n","/**\n * Native JavaScript utility functions to replace lodash-es\n * These are simple implementations for common object manipulation patterns\n */\n\n/**\n * Creates a new object without the specified keys\n * Native replacement for lodash omit()\n *\n * @param obj - Source object\n * @param keys - Keys to omit\n * @returns New object without specified keys\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * omit(obj, ['b']); // { a: 1, c: 3 }\n * ```\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n keys.forEach((key) => delete result[key]);\n return result as Omit<T, K>;\n}\n\n/**\n * Creates an object from an array, keyed by a specified property\n * Native replacement for lodash keyBy()\n *\n * @param array - Source array\n * @param key - Property to use as key\n * @returns Object keyed by the specified property\n *\n * @example\n * ```typescript\n * const users = [{ id: 'a', name: 'Alice' }, { id: 'b', name: 'Bob' }];\n * keyBy(users, 'id'); // { a: { id: 'a', name: 'Alice' }, b: { id: 'b', name: 'Bob' } }\n * ```\n */\nexport function keyBy<T extends Record<string, any>>(array: T[], key: keyof T): Record<string, T> {\n return array.reduce(\n (acc, item) => {\n acc[item[key]] = item;\n return acc;\n },\n {} as Record<string, T>,\n );\n}\n\n/**\n * Maps object values through a transformation function\n * Native replacement for lodash mapValues()\n *\n * @param obj - Source object\n * @param fn - Transformation function\n * @returns New object with transformed values\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2 };\n * mapValues(obj, (v) => v * 2); // { a: 2, b: 4 }\n * ```\n */\nexport function mapValues<T, U>(obj: Record<string, T>, fn: (value: T, key: string) => U): Record<string, U> {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n acc[key] = fn(value, key);\n return acc;\n },\n {} as Record<string, U>,\n );\n}\n\n/**\n * Memoizes a function with optional custom cache key resolver\n * Native replacement for lodash memoize()\n *\n * @param fn - Function to memoize\n * @param resolver - Optional function to generate cache key from arguments\n * @returns Memoized function\n *\n * @example\n * ```typescript\n * const expensive = (a: number, b: number) => a + b;\n * const memoized = memoize(expensive, (a, b) => `${a}-${b}`);\n * memoized(1, 2); // Computed\n * memoized(1, 2); // Cached\n * ```\n */\nexport function memoize<TFunc extends (...args: any[]) => any>(fn: TFunc, resolver?: (...args: Parameters<TFunc>) => string): TFunc {\n const cache = new Map<string, ReturnType<TFunc>>();\n\n return ((...args: Parameters<TFunc>): ReturnType<TFunc> => {\n const key = resolver ? resolver(...args) : JSON.stringify(args);\n\n if (cache.has(key)) {\n return cache.get(key)!;\n }\n\n const result = fn(...args);\n cache.set(key, result);\n return result;\n }) as TFunc;\n}\n\n/**\n * Performs a deep equality comparison between two values\n * Native replacement for lodash isEqual()\n *\n * @param a - First value\n * @param b - Second value\n * @returns true if values are deeply equal\n *\n * @example\n * ```typescript\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual([1, 2], [1, 2]); // true\n * isEqual({ a: 1 }, { a: 2 }); // false\n * ```\n */\nexport function isEqual(a: any, b: any): boolean {\n // Same reference or both null/undefined\n if (a === b) return true;\n\n // One is null/undefined but not both\n if (a == null || b == null) return false;\n\n // Different types\n if (typeof a !== typeof b) return false;\n\n // Handle dates\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n // Handle arrays\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((item, index) => isEqual(item, b[index]));\n }\n\n // Handle objects\n if (typeof a === 'object' && typeof b === 'object') {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) return false;\n\n return keysA.every((key) => keysB.includes(key) && isEqual(a[key], b[key]));\n }\n\n // Primitives - use Object.is to handle NaN correctly (NaN === NaN is false, but Object.is(NaN, NaN) is true)\n return Object.is(a, b);\n}\n","import { InjectionToken } from '@angular/core';\nimport type { FieldSignalContext, ArrayContext } from '../mappers/types';\n\n/**\n * Injection token for providing field signal context to mappers and components.\n *\n * The field signal context is the \"nervous system\" of the dynamic form library,\n * providing access to:\n * - The form instance and structure\n * - Current form values (as signals)\n * - Default values\n * - Validation messages\n * - The injector for creating components\n *\n * This token is provided by the DynamicForm component and can be scoped\n * for nested forms (Groups, Arrays) via child injectors.\n *\n * @example\n * ```typescript\n * // In a mapper function\n * export function mapValueField(fieldDef: BaseValueField<any, any>): Binding[] {\n * const context = inject(FIELD_SIGNAL_CONTEXT);\n * const form = context.form();\n * // ... use context\n * }\n *\n * // In a component\n * export class MyFieldComponent {\n * private context = inject(FIELD_SIGNAL_CONTEXT);\n * }\n * ```\n */\nexport const FIELD_SIGNAL_CONTEXT = new InjectionToken<FieldSignalContext>('FIELD_SIGNAL_CONTEXT', {\n providedIn: null, // Not provided at root - must be provided by DynamicForm\n factory: () => {\n throw new Error(\n 'FIELD_SIGNAL_CONTEXT was not provided. ' +\n 'This token must be provided by DynamicFormComponent or a container field component. ' +\n 'If you are calling a mapper function directly, ensure it runs within runInInjectionContext() ' +\n 'with an injector that provides FIELD_SIGNAL_CONTEXT.',\n );\n },\n});\n\n/**\n * Injection token for providing array context metadata to mappers and components.\n *\n * This token is optionally provided by ArrayFieldComponent when creating injectors\n * for array items. It contains metadata about the array item's position and parent.\n *\n * Mappers can inject this token with {optional: true} to access array context:\n *\n * @example\n * ```typescript\n * // In a mapper function\n * export function buttonMapper(fieldDef: FieldDef<any>): Binding[] {\n * const arrayContext = inject(ARRAY_CONTEXT, { optional: true });\n * if (arrayContext) {\n * // Use arrayContext.index, arrayContext.arrayKey, etc.\n * }\n * }\n * ```\n */\nexport const ARRAY_CONTEXT = new InjectionToken<ArrayContext>('ARRAY_CONTEXT');\n","import { InjectionToken } from '@angular/core';\nimport { FieldDef } from '../definitions/base/field-def';\nimport { MapperFn } from '../mappers/types';\n\n/**\n * Defines how a field type handles form values and data collection.\n *\n * - 'include': Field contributes to form values (default for input fields)\n * - 'exclude': Field is excluded from form values (for display/layout fields)\n * - 'flatten': Field's children are flattened to parent level (for container fields)\n */\nexport type ValueHandlingMode = 'include' | 'exclude' | 'flatten';\n\n/**\n * Configuration interface for registering custom field types.\n *\n * Defines how a field type should be handled by the dynamic form system,\n * including its component loading strategy and field-to-component mapping logic.\n * Supports both eager-loaded and lazy-loaded components.\n *\n * @typeParam T - The field definition type this field type handles\n *\n * @example\n * ```typescript\n * const CustomInputType: FieldTypeDefinition<InputFieldDef> = {\n * name: 'custom-input',\n * loadComponent: () => import('./custom-input.component').then(m => m.CustomInputComponent),\n * mapper: customInputMapper\n * };\n *\n * // Register with providers\n * provideDynamicForm(CustomInputType)\n * ```\n */\nexport interface FieldTypeDefinition<T extends FieldDef<any> = any> {\n /** Unique identifier for the field type */\n name: string;\n /** Field definition type marker (internal use) */\n _fieldDef?: T;\n /** Function to load the component (supports lazy loading) */\n loadComponent?: () => Promise<any>;\n /** Mapper function that converts field definition to component bindings */\n mapper: MapperFn<T>;\n /** How this field type handles form values and data collection (defaults to 'include') */\n valueHandling?: ValueHandlingMode;\n}\n\n/**\n * Injection token for the global field type registry.\n *\n * Provides access to the map of registered field types throughout the application.\n * The registry is populated by the provideDynamicForm function and used by\n * field rendering components to resolve field types to their implementations.\n *\n * @example\n * ```typescript\n * constructor(@Inject(FIELD_REGISTRY) private registry: Map<string, FieldTypeDefinition>) {\n * const inputType = registry.get('input');\n * }\n * ```\n */\nexport const FIELD_REGISTRY = new InjectionToken<Map<string, FieldTypeDefinition>>('FIELD_REGISTRY', {\n providedIn: 'root',\n factory: () => new Map(),\n});\n\n/**\n * Gets the value handling mode for a specific field type from the registry.\n *\n * @param fieldType - The field type identifier\n * @param registry - The field type registry\n * @returns The value handling mode ('include' is the default if not specified)\n */\nexport function getFieldValueHandling(fieldType: string, registry: Map<string, FieldTypeDefinition>): ValueHandlingMode {\n const definition = registry.get(fieldType);\n return definition?.valueHandling ?? 'include';\n}\n","import { inject, Type } from '@angular/core';\nimport { FIELD_REGISTRY, FieldTypeDefinition } from '../../models/field-type';\n\n/**\n * Injection function for accessing the dynamic form field registry.\n *\n * Provides a convenient API for interacting with registered field types,\n * including type checking, component loading, and registration management.\n * Must be called within an injection context.\n *\n * @returns Object with methods for field registry interaction\n *\n * @example\n * ```typescript\n * @Component({...})\n * export class MyComponent {\n * private fieldRegistry = injectFieldRegistry();\n *\n * async loadCustomField() {\n * if (this.fieldRegistry.hasType('custom-input')) {\n * const component = await this.fieldRegistry.loadTypeComponent('custom-input');\n * // Use component...\n * }\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // In a service\n * @Injectable()\n * export class FormBuilderService {\n * private fieldRegistry = injectFieldRegistry();\n *\n * getAvailableFieldTypes(): string[] {\n * return this.fieldRegistry.getTypes().map(type => type.name);\n * }\n * }\n * ```\n *\n * @public\n */\nexport function injectFieldRegistry() {\n const registry = inject(FIELD_REGISTRY);\n\n return {\n /**\n * Retrieves a field type definition by its registered name.\n *\n * @param name - The registered name of the field type\n * @returns The field type definition if found, undefined otherwise\n *\n * @example\n * ```typescript\n * const inputType = fieldRegistry.getType('input');\n * if (inputType) {\n * console.log('Input field type found:', inputType.name);\n * }\n * ```\n */\n getType(name: string): FieldTypeDefinition | undefined {\n return registry.get(name);\n },\n\n /**\n * Checks if a field type is registered in the registry.\n *\n * @param name - The name of the field type to check\n * @returns True if the field type exists, false otherwise\n *\n * @example\n * ```typescript\n * if (fieldRegistry.hasType('custom-input')) {\n * // Safe to use custom-input field type\n * const component = await fieldRegistry.loadTypeComponent('custom-input');\n * }\n * ```\n */\n hasType(name: string): boolean {\n return registry.has(name);\n },\n\n /**\n * Loads a field type component with support for lazy loading.\n *\n * Handles both synchronous component references and asynchronous\n * dynamic imports. Automatically extracts default exports from ES modules.\n *\n * @param name - The name of the field type to load\n * @returns Promise resolving to the component constructor\n * @throws {Error} When field type is not registered or loading fails\n *\n * @example\n * ```typescript\n * try {\n * const InputComponent = await fieldRegistry.loadTypeComponent('input');\n * const componentRef = vcr.createComponent(InputComponent);\n * } catch (error) {\n * console.error('Failed to load component:', error);\n * }\n * ```\n */\n async loadTypeComponent(name: string): Promise<Type<unknown>> {\n const fieldType = registry.get(name);\n\n if (!fieldType) {\n throw new Error(`[Dynamic Forms] Field type \"${name}\" is not registered`);\n }\n\n // Handle async loading\n if (fieldType.loadComponent) {\n try {\n const result = await fieldType.loadComponent();\n // Handle ES module imports - extract default export if needed\n return (result as any)?.default || result;\n } catch (error) {\n throw new Error(`[Dynamic Forms] Failed to load component for field type \"${name}\": ${error}`);\n }\n }\n\n throw new Error(`[Dynamic Forms] Field type \"${name}\" has no component or loadComponent function`);\n },\n\n /**\n * Gets all registered field type definitions.\n *\n * @returns Array of all field type definitions in the registry\n *\n * @example\n * ```typescript\n * const allTypes = fieldRegistry.getTypes();\n * const typeNames = allTypes.map(type => type.name);\n * console.log('Available field types:', typeNames);\n * ```\n */\n getTypes(): FieldTypeDefinition[] {\n return Array.from(registry.values());\n },\n\n /**\n * Registers multiple field types at once.\n *\n * Useful for bulk registration of custom field types. Overwrites\n * existing registrations with the same name.\n *\n * @param types - Array of field type definitions to register\n *\n * @example\n * ```typescript\n * fieldRegistry.registerTypes([\n * CustomInputType,\n * CustomSelectType,\n * CustomDatePickerType\n * ]);\n * ```\n */\n registerTypes(types: FieldTypeDefinition[]): void {\n types.forEach((type) => {\n registry.set(type.name, type);\n });\n },\n\n /**\n * Provides direct access to the underlying registry Map.\n *\n * Use with caution - direct modification can affect form behavior.\n * Primarily intended for advanced use cases and debugging.\n *\n * @returns The raw Map containing field type registrations\n *\n * @example\n * ```typescript\n * const rawRegistry = fieldRegistry.raw;\n * console.log('Registry size:', rawRegistry.size);\n * ```\n */\n get raw() {\n return registry;\n },\n };\n}\n","import { Injectable, signal, Signal, isSignal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\n\n/**\n * Type for form value signals - either a Signal returning an object or a FieldTree\n */\ntype FormValueSource = Signal<Record<string, unknown>> | FieldTree<unknown>;\n\n/**\n * Registry service that maintains references to root form fields.\n * This provides a type-safe way to access root form values from child fields\n * without relying on internal Angular Forms API navigation.\n *\n * This service should be provided at the component level to ensure proper\n * isolation between different form instances.\n *\n * IMPORTANT: This registry supports two registration patterns:\n * 1. registerFormValueSignal() - Register the SOURCE signal BEFORE form creation\n * This allows logic functions to read form values during schema evaluation.\n * 2. registerRootForm() - Register the FieldTree AFTER form creation\n * This provides access to the full form structure.\n *\n * For cross-field logic to work correctly, registerFormValueSignal() should be\n * called BEFORE the form() call.\n */\n@Injectable()\nexport class RootFormRegistryService {\n // Use a signal containing a Map to make registration reactive\n private readonly _rootForms = signal(new Map<string, FieldTree<unknown>>());\n // Store form value signals separately - these can be registered before form creation\n private readonly _formValueSignals = signal(new Map<string, Signal<Record<string, unknown>>>());\n private readonly formContexts = new Map<string, Record<string, unknown>>();\n\n /**\n * Registers the form value signal BEFORE form creation.\n *\n * This is the recommended pattern for cross-field logic:\n * 1. Create the formValue signal\n * 2. Register it with registerFormValueSignal()\n * 3. Create the form with form(formValue, schema(...))\n *\n * This allows logic functions to access form values during schema evaluation.\n */\n registerFormValueSignal(valueSignal: Signal<Record<string, unknown>>, formId = 'default'): void {\n this._formValueSignals.update((signals) => {\n const newSignals = new Map(signals);\n newSignals.set(formId, valueSignal);\n return newSignals;\n });\n }\n\n /**\n * Gets the registered form value signal by id.\n *\n * This allows direct access to the source signal, which can be read\n * reactively to get form values.\n */\n getFormValueSignal(formId = 'default'): Signal<Record<string, unknown>> | undefined {\n return this._formValueSignals().get(formId);\n }\n\n /**\n * Registers a root form field with an optional identifier.\n * If no id is provided, uses 'default' as the key.\n *\n * This triggers reactive updates for any computed signals that\n * depend on getRootForm().\n */\n registerRootForm(rootField: FieldTree<unknown>, formId = 'default'): void {\n this._rootForms.update((forms) => {\n const newForms = new Map(forms);\n newForms.set(formId, rootField);\n return newForms;\n });\n }\n\n /**\n * Gets a registered root form field by id.\n *\n * IMPORTANT: This method reads from a signal, which means any computed\n * signal that calls this method will automatically re-evaluate when\n * the form is registered or updated.\n */\n getRootForm(formId = 'default'): FieldTree<unknown> | undefined {\n return this._rootForms().get(formId);\n }\n\n /**\n * Gets the form value, preferring the direct signal if available.\n *\n * This method tries in order:\n * 1. Form value signal (if registered) - reads directly from source signal\n * 2. Root form's .value() (if registered) - reads from FieldTree\n * 3. Returns empty object if nothing is registered\n *\n * Reading from signals creates reactive dependencies, so computeds will\n * re-evaluate when form values change.\n */\n getFormValue(formId = 'default'): Record<string, unknown> {\n // First try the direct value signal (preferred, can be registered before form creation)\n const valueSignal = this._formValueSignals().get(formId);\n if (valueSignal) {\n const value = valueSignal();\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n return value;\n }\n }\n\n // Fall back to root form's value\n const rootForm = this._rootForms().get(formId);\n if (rootForm) {\n try {\n let rootValue: unknown;\n\n // Check if rootForm is a Signal (callable function that returns FieldTree)\n if (isSignal(rootForm)) {\n const fieldTree = rootForm();\n if (fieldTree && typeof fieldTree === 'object' && 'value' in fieldTree) {\n rootValue = (fieldTree as { value: () => unknown }).value();\n }\n } else if ('value' in rootForm && typeof (rootForm as { value: unknown }).value === 'function') {\n rootValue = (rootForm as { value: () => unknown }).value();\n }\n\n if (rootValue && typeof rootValue === 'object' && !Array.isArray(rootValue)) {\n return rootValue as Record<string, unknown>;\n }\n } catch {\n // Ignore errors when reading form value\n }\n }\n\n return {};\n }\n\n /**\n * Registers form context (field paths and metadata) for a specific form.\n * This can be used to store additional context information.\n */\n registerFormContext(context: Record<string, unknown>, formId = 'default'): void {\n this.formContexts.set(formId, context);\n }\n\n /**\n * Gets form context by id.\n */\n getFormContext(formId = 'default'): Record<string, unknown> {\n return this.formContexts.get(formId) || {};\n }\n\n /**\n * Unregisters a form and its context.\n * This should be called when a form component is destroyed to prevent memory leaks.\n */\n unregisterForm(formId = 'default'): void {\n this._rootForms.update((forms) => {\n const newForms = new Map(forms);\n newForms.delete(formId);\n return newForms;\n });\n this.formContexts.delete(formId);\n }\n\n /**\n * Gets all registered form IDs.\n */\n getRegisteredFormIds(): string[] {\n return Array.from(this._rootForms().keys());\n }\n\n /**\n * Clears all registered forms. Useful for testing.\n */\n clear(): void {\n this._rootForms.set(new Map());\n this._formValueSignals.set(new Map());\n this.formContexts.clear();\n }\n}\n","import { inject, Injectable, isSignal, untracked } from '@angular/core';\nimport { ChildFieldContext, FieldContext } from '@angular/forms/signals';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { RootFormRegistryService } from './root-form-registry.service';\n\nfunction isChildFieldContext<TValue>(context: FieldContext<TValue>): context is ChildFieldContext<TValue> {\n return 'key' in context && isSignal(context.key);\n}\n\n/**\n * Service that provides field evaluation context by combining\n * field context with root form registry information.\n *\n * This service should be provided at the component level to ensure proper\n * isolation between different form instances.\n */\n@Injectable()\nexport class FieldContextRegistryService {\n private rootFormRegistry = inject(RootFormRegistryService);\n\n /**\n * Creates an evaluation context for a field by combining:\n * - The field's current value\n * - The root form value from the registry\n * - The field path (if available from form context)\n * - Custom functions (if provided)\n */\n createEvaluationContext<TValue>(\n fieldContext: FieldContext<TValue>,\n customFunctions?: Record<string, (context: EvaluationContext) => unknown>,\n formId = 'default',\n ): EvaluationContext {\n // Use untracked() to read the field value WITHOUT creating a reactive dependency.\n // This prevents infinite loops when logic functions are evaluated inside computed signals.\n const fieldValue = untracked(() => fieldContext.value());\n\n // Get form value using the unified method, wrapped in untracked() to prevent\n // reactive dependencies. This allows validators and dynamic values to access\n // form values without causing infinite loops.\n //\n // Without untracked():\n // 1. Validator runs and reads formValue via this context\n // 2. This creates a signal dependency on the form's value\n // 3. Any field change updates the form value signal\n // 4. All validators that read formValue re-run\n // 5. They read formValue again, creating new dependencies\n // 6. Infinite loop until browser freezes\n //\n // With untracked():\n // - Form value is read as a snapshot, no dependency is created\n // - Validators still run when their own field value changes (via fieldValue)\n // - Cross-field validation still works, just without cascading re-evaluation\n const formValue = untracked(() => this.rootFormRegistry.getFormValue(formId));\n\n // Get field path from form context\n const formContext = this.rootFormRegistry.getFormContext(formId);\n const fieldPath = this.extractFieldPath(fieldContext, formContext);\n\n return {\n fieldValue,\n formValue,\n fieldPath,\n customFunctions: customFunctions || {},\n };\n }\n\n /**\n * Registers a field path mapping for a specific form.\n * This can be called when fields are created to maintain path information.\n */\n registerFieldPath(fieldKey: string | number, parentPath: string, formId = 'default'): void {\n const context = this.rootFormRegistry.getFormContext(formId);\n const fullPath = parentPath ? `${parentPath}.${fieldKey}` : String(fieldKey);\n\n context.fieldPaths = context.fieldPaths || {};\n (context.fieldPaths as Record<string, string>)[String(fieldKey)] = fullPath;\n\n this.rootFormRegistry.registerFormContext(context, formId);\n }\n\n /**\n * Extracts the field path for a given field context.\n * This is a simplified implementation that could be enhanced\n * based on the specific needs of the form library.\n */\n private extractFieldPath(fieldContext: FieldContext<unknown>, formContext: Record<string, unknown>): string {\n // Check if the field context has a key property (for child fields)\n const extendedContext = fieldContext;\n\n if (isChildFieldContext(extendedContext)) {\n try {\n const key = extendedContext.key();\n const fieldPaths = (formContext.fieldPaths as Record<string, string>) || {};\n return fieldPaths[String(key)] || String(key);\n } catch (error) {\n console.warn('[Dynamic Forms] Unable to extract field key:', error);\n }\n }\n\n // For root fields or when key is not available\n return '';\n }\n\n /**\n * Creates a REACTIVE evaluation context for logic functions.\n *\n * Unlike createEvaluationContext, this method does NOT use untracked(),\n * which allows logic functions (hidden, readonly, disabled, required) to\n * create reactive dependencies on form values.\n *\n * When a dependent field value changes, the logic function will be re-evaluated.\n *\n * IMPORTANT: For this to work correctly, the form value signal should be\n * registered with rootFormRegistry.registerFormValueSignal() BEFORE the\n * form is created. This ensures the logic function can read form values\n * during schema evaluation.\n *\n * NOTE: This should ONLY be used for logic functions, not validators.\n * Validators should use createEvaluationContext with untracked() to prevent\n * infinite reactive loops. Validators with cross-field dependencies should be\n * hoisted to form-level using validateTree.\n */\n createReactiveEvaluationContext<TValue>(\n fieldContext: FieldContext<TValue>,\n customFunctions?: Record<string, (context: EvaluationContext) => unknown>,\n formId = 'default',\n ): EvaluationContext {\n // Read field value reactively (creates a dependency)\n const fieldValue = fieldContext.value();\n\n // Get form value using the new unified method that prefers the direct signal\n // This creates reactive dependencies on the form value signal\n const formValue = this.rootFormRegistry.getFormValue(formId);\n\n // Get field path from form context\n const formContext = this.rootFormRegistry.getFormContext(formId);\n const fieldPath = this.extractFieldPath(fieldContext, formContext);\n\n return {\n fieldValue,\n formValue,\n fieldPath,\n customFunctions: customFunctions || {},\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { CustomFunction, CustomFunctionOptions, CustomFunctionScope } from '../expressions/custom-function-types';\nimport { AsyncCustomValidator, CustomValidator, HttpCustomValidator } from '../validation/validator-types';\n\n/**\n * Registry service for custom functions and validators\n *\n * This service maintains four separate registries:\n *\n * 1. **Custom Functions** - For conditional expressions (when/readonly/disabled)\n * - Used in: when conditions, readonly logic, disabled logic\n * - Return type: any value (typically boolean)\n * - Example: `isAdult: (ctx) => ctx.age >= 18`\n *\n * 2. **Custom Validators** - For synchronous validation using Angular's public FieldContext API\n * - Used in: validators array on fields\n * - Return type: ValidationError | ValidationError[] | null\n * - Example: `noSpaces: (ctx) => ctx.value().includes(' ') ? { kind: 'noSpaces' } : null`\n *\n * 3. **Async Validators** - For asynchronous validation (debouncing, database lookups, etc.)\n * - Used in: validators array on fields with type 'customAsync'\n * - Return type: Observable<ValidationError | ValidationError[] | null>\n * - Example: `checkUsername: (ctx) => userService.checkAvailability(ctx.value())`\n *\n * 4. **HTTP Validators** - For HTTP-based validation with automatic request cancellation\n * - Used in: validators array on fields with type 'customHttp'\n * - Configuration object with url, method, mapResponse, etc.\n * - Example: `{ url: '/api/check', method: 'GET', mapResponse: ... }`\n *\n * @example\n * ```typescript\n * // Register a custom function for expressions\n * registry.registerCustomFunction('isAdult', (ctx) => ctx.age >= 18);\n *\n * // Use in field configuration\n * {\n * key: 'alcoholPreference',\n * when: { function: 'isAdult' }\n * }\n *\n * // Register a custom validator\n * registry.registerValidator('noSpaces', (ctx) => {\n * const value = ctx.value();\n * return typeof value === 'string' && value.includes(' ')\n * ? { kind: 'noSpaces' }\n * : null;\n * });\n *\n * // Use in field configuration\n * {\n * key: 'username',\n * validators: [{ type: 'custom', functionName: 'noSpaces' }],\n * validationMessages: {\n * noSpaces: 'Spaces are not allowed'\n * }\n * }\n * ```\n */\n@Injectable()\nexport class FunctionRegistryService {\n private readonly customFunctions = new Map<string, CustomFunction>();\n private readonly customFunctionScopes = new Map<string, CustomFunctionScope>();\n private readonly validators = new Map<string, CustomValidator>();\n private readonly asyncValidators = new Map<string, AsyncCustomValidator>();\n private readonly httpValidators = new Map<string, HttpCustomValidator>();\n\n /**\n * Register a custom function for conditional expressions\n *\n * Custom functions are used for control flow logic (when/readonly/disabled),\n * NOT for validation. They return any value, typically boolean.\n *\n * @param name - Unique identifier for the function\n * @param fn - Function that receives EvaluationContext and returns any value\n * @param options - Optional configuration for the function\n *\n * @example\n * ```typescript\n * // Form-level function (default) - may access other fields\n * registry.registerCustomFunction('isAdult', (ctx) => ctx.formValue.age >= 18);\n *\n * // Field-level function - only uses current field value (performance optimization)\n * registry.registerCustomFunction('isEmpty', (ctx) => !ctx.fieldValue, { scope: 'field' });\n * ```\n */\n registerCustomFunction(name: string, fn: CustomFunction, options?: CustomFunctionOptions): void {\n this.customFunctions.set(name, fn);\n // Store scope (default to 'form' for conservative cross-field detection)\n this.customFunctionScopes.set(name, options?.scope ?? 'form');\n }\n\n /**\n * Get the scope of a registered custom function.\n *\n * @param name - The function name\n * @returns The function scope, or undefined if not registered\n */\n getCustomFunctionScope(name: string): CustomFunctionScope | undefined {\n return this.customFunctionScopes.get(name);\n }\n\n /**\n * Check if a custom function is field-scoped (no cross-field dependencies).\n *\n * @param name - The function name\n * @returns true if the function is field-scoped, false if form-scoped or not registered\n */\n isFieldScopedFunction(name: string): boolean {\n return this.customFunctionScopes.get(name) === 'field';\n }\n\n /**\n * Get all custom functions as an object\n */\n getCustomFunctions(): Record<string, CustomFunction> {\n return Object.fromEntries(this.customFunctions);\n }\n\n /**\n * Clear all custom functions and their scopes\n */\n clearCustomFunctions(): void {\n this.customFunctions.clear();\n this.customFunctionScopes.clear();\n }\n\n /**\n * Register a custom validator using Angular's public FieldContext API\n *\n * Validators receive the full FieldContext, allowing access to:\n * - Current field value: `ctx.value()`\n * - Field state: `ctx.state` (errors, touched, dirty, etc.)\n * - Other field values: `ctx.valueOf(path)` (public API!)\n * - Other field states: `ctx.stateOf(path)`\n * - Parameters from JSON configuration via second argument\n *\n * @param name - Unique identifier for the validator\n * @param fn - Validator function (ctx, params?) => ValidationError | ValidationError[] | null\n *\n * @example Single Field Validation\n * ```typescript\n * registry.registerValidator('noSpaces', (ctx) => {\n * const value = ctx.value();\n * if (typeof value === 'string' && value.includes(' ')) {\n * return { kind: 'noSpaces' };\n * }\n * return null;\n * });\n * ```\n *\n * @example Cross-Field Validation (Public API)\n * ```typescript\n * registry.registerValidator('lessThan', (ctx, params) => {\n * const value = ctx.value();\n * const compareToPath = params?.field as string;\n *\n * // Use valueOf() to access other fields - public API!\n * const otherValue = ctx.valueOf(compareToPath as any);\n *\n * if (otherValue !== undefined && value >= otherValue) {\n * return { kind: 'notLessThan' };\n * }\n * return null;\n * });\n * ```\n *\n * @example Multiple Errors (Cross-Field Validation)\n * ```typescript\n * registry.registerValidator('validateDateRange', (ctx) => {\n * const errors: ValidationError[] = [];\n * const startDate = ctx.valueOf('startDate' as any);\n * const endDate = ctx.valueOf('endDate' as any);\n *\n * if (!startDate) errors.push({ kind: 'startDateRequired' });\n * if (!endDate) errors.push({ kind: 'endDateRequired' });\n * if (startDate && endDate && startDate > endDate) {\n * errors.push({ kind: 'invalidDateRange' });\n * }\n *\n * return errors.length > 0 ? errors : null;\n * });\n * ```\n */\n registerValidator(name: string, fn: CustomValidator): void {\n this.validators.set(name, fn);\n }\n\n /**\n * Get a validator by name\n */\n getValidator(name: string): CustomValidator | undefined {\n return this.validators.get(name);\n }\n\n /**\n * Clear all validators\n */\n clearValidators(): void {\n this.validators.clear();\n }\n\n /**\n * Register an async validator using Angular's public validateAsync() API\n *\n * Async validators return Observables for asynchronous validation logic.\n * Use for debouncing, database lookups, or complex async business logic.\n *\n * @param name - Unique identifier for the async validator\n * @param fn - Async validator function (ctx, params?) => Observable<ValidationError | ValidationError[] | null>\n *\n * @example Debounced Username Check\n * ```typescript\n * registry.registerAsyncValidator('checkUsernameAvailable', (ctx) => {\n * const username = ctx.value();\n * return of(username).pipe(\n * debounceTime(300),\n * switchMap(name => userService.checkAvailability(name)),\n * map(available => available ? null : { kind: 'usernameTaken' })\n * );\n * });\n * ```\n *\n * @example Async Cross-Field Validation\n * ```typescript\n * registry.registerAsyncValidator('validatePasswordStrength', (ctx) => {\n * const password = ctx.value();\n * const email = ctx.valueOf('email' as any);\n * return passwordService.checkStrength(password, email).pipe(\n * map(result => result.strong ? null : { kind: 'weakPassword' })\n * );\n * });\n * ```\n */\n registerAsyncValidator(name: string, fn: AsyncCustomValidator): void {\n this.asyncValidators.set(name, fn);\n }\n\n /**\n * Get an async validator by name\n */\n getAsyncValidator(name: string): AsyncCustomValidator | undefined {\n return this.asyncValidators.get(name);\n }\n\n /**\n * Clear all async validators\n */\n clearAsyncValidators(): void {\n this.asyncValidators.clear();\n }\n\n /**\n * Register an HTTP validator configuration using Angular's public validateHttp() API\n *\n * HTTP validators provide optimized HTTP validation with automatic request cancellation,\n * caching, and debouncing. Preferred over AsyncCustomValidator for HTTP requests.\n *\n * @param name - Unique identifier for the HTTP validator\n * @param config - HTTP validator configuration object\n *\n * @example Username Availability Check\n * ```typescript\n * registry.registerHttpValidator('checkUsername', {\n * url: (ctx) => `/api/users/check-username?username=${encodeURIComponent(ctx.value())}`,\n * method: 'GET',\n * mapResponse: (response, ctx) => {\n * return response.available ? null : { kind: 'usernameTaken' };\n * }\n * });\n * ```\n *\n * @example POST Request with Body\n * ```typescript\n * registry.registerHttpValidator('validateAddress', {\n * url: '/api/validate-address',\n * method: 'POST',\n * body: (ctx) => ({\n * street: ctx.valueOf('street' as any),\n * city: ctx.valueOf('city' as any),\n * zipCode: ctx.value()\n * }),\n * mapResponse: (response) => {\n * return response.valid ? null : { kind: 'invalidAddress' };\n * },\n * debounceTime: 500\n * });\n * ```\n */\n registerHttpValidator(name: string, config: HttpCustomValidator): void {\n this.httpValidators.set(name, config);\n }\n\n /**\n * Get an HTTP validator by name\n */\n getHttpValidator(name: string): HttpCustomValidator | undefined {\n return this.httpValidators.get(name);\n }\n\n /**\n * Clear all HTTP validators\n */\n clearHttpValidators(): void {\n this.httpValidators.clear();\n }\n\n /**\n * Generic helper to set registry values only if they have changed\n * @param registry - The Map to update\n * @param values - Object mapping keys to values\n */\n private setRegistryIfChanged<T>(registry: Map<string, T>, values: Record<string, T> | undefined): void {\n if (!values) return;\n\n const entries = Object.entries(values);\n const hasChanges = entries.some(([name, value]) => registry.get(name) !== value);\n\n if (hasChanges) {\n entries.forEach(([name, value]) => registry.set(name, value));\n }\n }\n\n /**\n * Set validators from a config object\n * Only updates validators if their references have changed\n *\n * @param validators - Object mapping validator names to validator functions\n */\n setValidators(validators: Record<string, CustomValidator> | undefined): void {\n this.setRegistryIfChanged(this.validators, validators);\n }\n\n /**\n * Set async validators from a config object\n * Only updates validators if their references have changed\n *\n * @param asyncValidators - Object mapping validator names to async validator configs\n */\n setAsyncValidators(asyncValidators: Record<string, AsyncCustomValidator> | undefined): void {\n this.setRegistryIfChanged(this.asyncValidators, asyncValidators);\n }\n\n /**\n * Set HTTP validators from a config object\n * Only updates validators if their references have changed\n *\n * @param httpValidators - Object mapping validator names to HTTP validator configs\n */\n setHttpValidators(httpValidators: Record<string, HttpCustomValidator> | undefined): void {\n this.setRegistryIfChanged(this.httpValidators, httpValidators);\n }\n\n /**\n * Clear everything (functions and all validators)\n */\n clearAll(): void {\n this.clearCustomFunctions();\n this.clearValidators();\n this.clearAsyncValidators();\n this.clearHttpValidators();\n }\n}\n","/**\n * Compares two values using the specified comparison operator.\n *\n * Supports various comparison types including equality, numerical comparisons,\n * string operations, and regular expression matching. Type coercion is applied\n * for numerical and string operations as needed.\n *\n * @param actual - The value to compare\n * @param expected - The value to compare against\n * @param operator - Comparison operator to use\n * @returns True if the comparison succeeds, false otherwise\n *\n * @example\n * ```typescript\n * // Equality checks\n * compareValues(10, 10, 'equals') // true\n * compareValues('test', 'other', 'notEquals') // true\n *\n * // Numerical comparisons\n * compareValues(15, 10, 'greater') // true\n * compareValues('5', 3, 'greaterOrEqual') // true (coerced to numbers)\n *\n * // String operations\n * compareValues('hello world', 'world', 'contains') // true\n * compareValues('prefix-test', 'prefix', 'startsWith') // true\n * compareValues('test.jpg', '.jpg', 'endsWith') // true\n *\n * // Regular expression matching\n * compareValues('test123', '^test\\\\d+$', 'matches') // true\n * compareValues('invalid', '[invalid', 'matches') // false (invalid regex)\n * ```\n */\nexport function compareValues(actual: unknown, expected: unknown, operator: string): boolean {\n switch (operator) {\n case 'equals':\n return actual === expected;\n case 'notEquals':\n return actual !== expected;\n case 'greater':\n return Number(actual) > Number(expected);\n case 'less':\n return Number(actual) < Number(expected);\n case 'greaterOrEqual':\n return Number(actual) >= Number(expected);\n case 'lessOrEqual':\n return Number(actual) <= Number(expected);\n case 'contains':\n return String(actual).includes(String(expected));\n case 'startsWith':\n return String(actual).startsWith(String(expected));\n case 'endsWith':\n return String(actual).endsWith(String(expected));\n case 'matches':\n try {\n return new RegExp(String(expected)).test(String(actual));\n } catch {\n return false;\n }\n default:\n return false;\n }\n}\n\n/**\n * Retrieves a nested value from an object using dot notation path.\n *\n * Safely traverses object properties using a dot-separated path string.\n * Returns undefined if any part of the path is missing or if the traversal\n * encounters a non-object value.\n *\n * @param obj - The object to traverse\n * @param path - Dot-separated path to the desired property\n * @returns The value at the specified path, or undefined if not found\n *\n * @example\n * ```typescript\n * const data = {\n * user: {\n * profile: {\n * name: 'John',\n * age: 30\n * },\n * settings: { theme: 'dark' }\n * }\n * };\n *\n * getNestedValue(data, 'user.profile.name') // 'John'\n * getNestedValue(data, 'user.settings.theme') // 'dark'\n * getNestedValue(data, 'user.profile.email') // undefined\n * getNestedValue(data, 'nonexistent.path') // undefined\n * getNestedValue(null, 'any.path') // undefined\n * ```\n */\nexport function getNestedValue(obj: unknown, path: string): unknown {\n return path.split('.').reduce((current: unknown, key: string) => {\n return current && typeof current === 'object' ? (current as Record<string, unknown>)[key] : undefined;\n }, obj);\n}\n","/**\n * Token types for expression parsing\n */\nexport enum TokenType {\n // Literals\n NUMBER = 'NUMBER',\n STRING = 'STRING',\n TRUE = 'TRUE',\n FALSE = 'FALSE',\n NULL = 'NULL',\n UNDEFINED = 'UNDEFINED',\n\n // Identifiers\n IDENTIFIER = 'IDENTIFIER',\n\n // Operators\n PLUS = 'PLUS',\n MINUS = 'MINUS',\n MULTIPLY = 'MULTIPLY',\n DIVIDE = 'DIVIDE',\n MODULO = 'MODULO',\n\n // Comparison\n EQUAL = 'EQUAL',\n NOT_EQUAL = 'NOT_EQUAL',\n GREATER = 'GREATER',\n LESS = 'LESS',\n GREATER_EQUAL = 'GREATER_EQUAL',\n LESS_EQUAL = 'LESS_EQUAL',\n\n // Logical\n AND = 'AND',\n OR = 'OR',\n NOT = 'NOT',\n\n // Punctuation\n DOT = 'DOT',\n COMMA = 'COMMA',\n LPAREN = 'LPAREN',\n RPAREN = 'RPAREN',\n LBRACKET = 'LBRACKET',\n RBRACKET = 'RBRACKET',\n\n // Special\n EOF = 'EOF',\n TYPEOF = 'TYPEOF',\n}\n\n/**\n * Token with type, value, and position\n */\nexport interface Token {\n type: TokenType;\n value: string;\n position: number;\n}\n\n/**\n * AST Node types\n */\nexport type ASTNode = LiteralNode | IdentifierNode | MemberAccessNode | BinaryOpNode | UnaryOpNode | CallExpressionNode | ArrayLiteralNode;\n\nexport interface LiteralNode {\n type: 'Literal';\n value: string | number | boolean | null | undefined;\n}\n\nexport interface IdentifierNode {\n type: 'Identifier';\n name: string;\n}\n\nexport interface MemberAccessNode {\n type: 'MemberAccess';\n object: ASTNode;\n property: string;\n}\n\nexport interface BinaryOpNode {\n type: 'BinaryOp';\n operator: string;\n left: ASTNode;\n right: ASTNode;\n}\n\nexport interface UnaryOpNode {\n type: 'UnaryOp';\n operator: string;\n operand: ASTNode;\n}\n\nexport interface CallExpressionNode {\n type: 'CallExpression';\n callee: ASTNode;\n arguments: ASTNode[];\n}\n\nexport interface ArrayLiteralNode {\n type: 'ArrayLiteral';\n elements: ASTNode[];\n}\n\n/**\n * Parser error with position information\n */\nexport class ExpressionParserError extends Error {\n constructor(\n message: string,\n public position: number,\n public expression: string,\n ) {\n super(`${message} at position ${position} in expression: ${expression}`);\n this.name = 'ExpressionParserError';\n }\n}\n","import { Token, TokenType, ExpressionParserError } from './types';\n\n/**\n * Tokenizes an expression string into tokens\n */\nexport class Tokenizer {\n private position = 0;\n private readonly expression: string;\n\n constructor(expression: string) {\n this.expression = expression;\n }\n\n /**\n * Tokenize the entire expression\n */\n tokenize(): Token[] {\n const tokens: Token[] = [];\n\n while (this.position < this.expression.length) {\n this.skipWhitespace();\n\n if (this.position >= this.expression.length) {\n break;\n }\n\n const token = this.nextToken();\n tokens.push(token);\n }\n\n tokens.push({ type: TokenType.EOF, value: '', position: this.position });\n return tokens;\n }\n\n private skipWhitespace(): void {\n while (this.position < this.expression.length && /\\s/.test(this.expression[this.position])) {\n this.position++;\n }\n }\n\n private nextToken(): Token {\n const char = this.expression[this.position];\n\n // String literals\n if (char === '\"' || char === \"'\") {\n return this.readString(char);\n }\n\n // Numbers\n if (/[0-9]/.test(char)) {\n return this.readNumber();\n }\n\n // Identifiers and keywords\n if (/[a-zA-Z_$]/.test(char)) {\n return this.readIdentifierOrKeyword();\n }\n\n // Operators and punctuation\n return this.readOperatorOrPunctuation();\n }\n\n private readString(quote: string): Token {\n const start = this.position;\n this.position++; // Skip opening quote\n\n let value = '';\n while (this.position < this.expression.length) {\n const char = this.expression[this.position];\n\n if (char === quote) {\n this.position++; // Skip closing quote\n return { type: TokenType.STRING, value, position: start };\n }\n\n if (char === '\\\\' && this.position + 1 < this.expression.length) {\n // Handle escape sequences\n this.position++;\n const nextChar = this.expression[this.position];\n switch (nextChar) {\n case 'n':\n value += '\\n';\n break;\n case 't':\n value += '\\t';\n break;\n case 'r':\n value += '\\r';\n break;\n case '\\\\':\n value += '\\\\';\n break;\n case quote:\n value += quote;\n break;\n default:\n value += nextChar;\n }\n this.position++;\n } else {\n value += char;\n this.position++;\n }\n }\n\n throw new ExpressionParserError('[Dynamic Forms] Unterminated string literal', start, this.expression);\n }\n\n private readNumber(): Token {\n const start = this.position;\n let value = '';\n\n while (this.position < this.expression.length && /[0-9.]/.test(this.expression[this.position])) {\n value += this.expression[this.position];\n this.position++;\n }\n\n return { type: TokenType.NUMBER, value, position: start };\n }\n\n private readIdentifierOrKeyword(): Token {\n const start = this.position;\n let value = '';\n\n while (this.position < this.expression.length && /[a-zA-Z0-9_$]/.test(this.expression[this.position])) {\n value += this.expression[this.position];\n this.position++;\n }\n\n // Check for keywords\n const type = this.getKeywordType(value);\n return { type, value, position: start };\n }\n\n private getKeywordType(value: string): TokenType {\n switch (value) {\n case 'true':\n return TokenType.TRUE;\n case 'false':\n return TokenType.FALSE;\n case 'null':\n return TokenType.NULL;\n case 'undefined':\n return TokenType.UNDEFINED;\n case 'typeof':\n return TokenType.TYPEOF;\n default:\n return TokenType.IDENTIFIER;\n }\n }\n\n private readOperatorOrPunctuation(): Token {\n const start = this.position;\n const char = this.expression[this.position];\n const nextChar = this.position + 1 < this.expression.length ? this.expression[this.position + 1] : '';\n const thirdChar = this.position + 2 < this.expression.length ? this.expression[this.position + 2] : '';\n\n // Three-character operators - check these first!\n const threeChar = char + nextChar + thirdChar;\n if (threeChar === '===') {\n this.position += 3;\n return { type: TokenType.EQUAL, value: '===', position: start };\n }\n if (threeChar === '!==') {\n this.position += 3;\n return { type: TokenType.NOT_EQUAL, value: '!==', position: start };\n }\n\n // Two-character operators\n const twoChar = char + nextChar;\n switch (twoChar) {\n case '==':\n this.position += 2;\n return { type: TokenType.EQUAL, value: '==', position: start };\n case '!=':\n this.position += 2;\n return { type: TokenType.NOT_EQUAL, value: '!=', position: start };\n case '>=':\n this.position += 2;\n return { type: TokenType.GREATER_EQUAL, value: '>=', position: start };\n case '<=':\n this.position += 2;\n return { type: TokenType.LESS_EQUAL, value: '<=', position: start };\n case '&&':\n this.position += 2;\n return { type: TokenType.AND, value: '&&', position: start };\n case '||':\n this.position += 2;\n return { type: TokenType.OR, value: '||', position: start };\n }\n\n // Single-character operators and punctuation\n this.position++;\n switch (char) {\n case '+':\n return { type: TokenType.PLUS, value: '+', position: start };\n case '-':\n return { type: TokenType.MINUS, value: '-', position: start };\n case '*':\n return { type: TokenType.MULTIPLY, value: '*', position: start };\n case '/':\n return { type: TokenType.DIVIDE, value: '/', position: start };\n case '%':\n return { type: TokenType.MODULO, value: '%', position: start };\n case '>':\n return { type: TokenType.GREATER, value: '>', position: start };\n case '<':\n return { type: TokenType.LESS, value: '<', position: start };\n case '!':\n return { type: TokenType.NOT, value: '!', position: start };\n case '.':\n return { type: TokenType.DOT, value: '.', position: start };\n case ',':\n return { type: TokenType.COMMA, value: ',', position: start };\n case '(':\n return { type: TokenType.LPAREN, value: '(', position: start };\n case ')':\n return { type: TokenType.RPAREN, value: ')', position: start };\n case '[':\n return { type: TokenType.LBRACKET, value: '[', position: start };\n case ']':\n return { type: TokenType.RBRACKET, value: ']', position: start };\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unexpected character: ${char}`, start, this.expression);\n }\n }\n}\n","import { Token, TokenType, ASTNode, ExpressionParserError } from './types';\nimport { Tokenizer } from './tokenizer';\n\n/**\n * Parses tokens into an Abstract Syntax Tree (AST)\n * Uses recursive descent parsing with operator precedence\n */\nexport class Parser {\n private tokens: Token[] = [];\n private current = 0;\n private readonly expression: string;\n\n constructor(expression: string) {\n this.expression = expression;\n }\n\n /**\n * Parse the expression into an AST\n */\n parse(): ASTNode {\n const tokenizer = new Tokenizer(this.expression);\n this.tokens = tokenizer.tokenize();\n this.current = 0;\n\n if (this.isAtEnd()) {\n throw new ExpressionParserError('[Dynamic Forms] Empty expression', 0, this.expression);\n }\n\n return this.parseExpression();\n }\n\n private parseExpression(): ASTNode {\n return this.parseLogicalOr();\n }\n\n private parseLogicalOr(): ASTNode {\n let node = this.parseLogicalAnd();\n\n while (this.match(TokenType.OR)) {\n const operator = this.previous().value;\n const right = this.parseLogicalAnd();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseLogicalAnd(): ASTNode {\n let node = this.parseEquality();\n\n while (this.match(TokenType.AND)) {\n const operator = this.previous().value;\n const right = this.parseEquality();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseEquality(): ASTNode {\n let node = this.parseComparison();\n\n while (this.match(TokenType.EQUAL, TokenType.NOT_EQUAL)) {\n const operator = this.previous().value;\n const right = this.parseComparison();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseComparison(): ASTNode {\n let node = this.parseAddition();\n\n while (this.match(TokenType.GREATER, TokenType.GREATER_EQUAL, TokenType.LESS, TokenType.LESS_EQUAL)) {\n const operator = this.previous().value;\n const right = this.parseAddition();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseAddition(): ASTNode {\n let node = this.parseMultiplication();\n\n while (this.match(TokenType.PLUS, TokenType.MINUS)) {\n const operator = this.previous().value;\n const right = this.parseMultiplication();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseMultiplication(): ASTNode {\n let node = this.parseUnary();\n\n while (this.match(TokenType.MULTIPLY, TokenType.DIVIDE, TokenType.MODULO)) {\n const operator = this.previous().value;\n const right = this.parseUnary();\n node = { type: 'BinaryOp', operator, left: node, right };\n }\n\n return node;\n }\n\n private parseUnary(): ASTNode {\n if (this.match(TokenType.NOT, TokenType.MINUS, TokenType.PLUS, TokenType.TYPEOF)) {\n const operator = this.previous().value;\n const operand = this.parseUnary();\n return { type: 'UnaryOp', operator, operand };\n }\n\n return this.parsePostfix();\n }\n\n private parsePostfix(): ASTNode {\n let node = this.parsePrimary();\n\n while (true) {\n if (this.match(TokenType.DOT)) {\n // Member access: obj.property\n if (!this.check(TokenType.IDENTIFIER)) {\n throw new ExpressionParserError('[Dynamic Forms] Expected property name after \".\"', this.peek().position, this.expression);\n }\n const property = this.advance().value;\n node = { type: 'MemberAccess', object: node, property };\n } else if (this.match(TokenType.LPAREN)) {\n // Function call: func()\n const args = this.parseArgumentList();\n this.consume(TokenType.RPAREN, 'Expected \")\" after arguments');\n node = { type: 'CallExpression', callee: node, arguments: args };\n } else {\n break;\n }\n }\n\n return node;\n }\n\n private parsePrimary(): ASTNode {\n // Literals\n if (this.match(TokenType.TRUE)) {\n return { type: 'Literal', value: true };\n }\n\n if (this.match(TokenType.FALSE)) {\n return { type: 'Literal', value: false };\n }\n\n if (this.match(TokenType.NULL)) {\n return { type: 'Literal', value: null };\n }\n\n if (this.match(TokenType.UNDEFINED)) {\n return { type: 'Literal', value: undefined };\n }\n\n if (this.match(TokenType.NUMBER)) {\n return { type: 'Literal', value: parseFloat(this.previous().value) };\n }\n\n if (this.match(TokenType.STRING)) {\n return { type: 'Literal', value: this.previous().value };\n }\n\n // Array literal\n if (this.match(TokenType.LBRACKET)) {\n const elements = this.parseArrayElements();\n this.consume(TokenType.RBRACKET, 'Expected \"]\" after array elements');\n return { type: 'ArrayLiteral', elements };\n }\n\n // Identifier\n if (this.match(TokenType.IDENTIFIER)) {\n return { type: 'Identifier', name: this.previous().value };\n }\n\n // Grouped expression\n if (this.match(TokenType.LPAREN)) {\n const expr = this.parseExpression();\n this.consume(TokenType.RPAREN, 'Expected \")\" after expression');\n return expr;\n }\n\n throw new ExpressionParserError(`[Dynamic Forms] Unexpected token: ${this.peek().value}`, this.peek().position, this.expression);\n }\n\n private parseArgumentList(): ASTNode[] {\n const args: ASTNode[] = [];\n\n if (!this.check(TokenType.RPAREN)) {\n do {\n args.push(this.parseExpression());\n } while (this.match(TokenType.COMMA));\n }\n\n return args;\n }\n\n private parseArrayElements(): ASTNode[] {\n const elements: ASTNode[] = [];\n\n if (!this.check(TokenType.RBRACKET)) {\n do {\n elements.push(this.parseExpression());\n } while (this.match(TokenType.COMMA));\n }\n\n return elements;\n }\n\n private match(...types: TokenType[]): boolean {\n for (const type of types) {\n if (this.check(type)) {\n this.advance();\n return true;\n }\n }\n return false;\n }\n\n private check(type: TokenType): boolean {\n if (this.isAtEnd()) return false;\n return this.peek().type === type;\n }\n\n private advance(): Token {\n if (!this.isAtEnd()) this.current++;\n return this.previous();\n }\n\n private isAtEnd(): boolean {\n return this.peek().type === TokenType.EOF;\n }\n\n private peek(): Token {\n return this.tokens[this.current];\n }\n\n private previous(): Token {\n return this.tokens[this.current - 1];\n }\n\n private consume(type: TokenType, message: string): Token {\n if (this.check(type)) return this.advance();\n\n throw new ExpressionParserError(`[Dynamic Forms] ${message}`, this.peek().position, this.expression);\n }\n}\n","import { ASTNode, ExpressionParserError } from './types';\n\n/**\n * Evaluation context for safe expression evaluation\n */\nexport interface EvaluationScope {\n [key: string]: unknown;\n}\n\n/**\n * Security Model: Whitelist-only approach for method calls\n *\n * A method is considered SAFE if it meets ALL criteria:\n * 1. Pure data access/transformation (no side effects)\n * 2. No code execution capabilities\n * 3. No global state modification\n * 4. No prototype chain modification\n * 5. No information disclosure about system internals\n *\n * Methods NOT included (unsafe):\n * - constructor: Could enable code execution via Function constructor\n * - valueOf: Could enable type confusion attacks\n * - __proto__, __defineGetter__, etc: Direct prototype manipulation\n * - hasOwnProperty, isPrototypeOf, propertyIsEnumerable: Leak object structure\n * - toLocaleString: Could expose locale/system information\n */\n\n/**\n * Type-safe method whitelists derived from TypeScript primitive types\n * Only methods explicitly listed here are allowed - this is a whitelist-only approach\n */\nconst STRING_SAFE_METHODS: ReadonlyArray<keyof string> = [\n 'charAt',\n 'charCodeAt',\n 'concat',\n 'endsWith',\n 'includes',\n 'indexOf',\n 'lastIndexOf',\n 'match',\n 'padEnd',\n 'padStart',\n 'repeat',\n 'replace',\n 'search',\n 'slice',\n 'split',\n 'startsWith',\n 'substring',\n 'toLowerCase',\n 'toUpperCase',\n 'trim',\n 'trimEnd',\n 'trimStart',\n 'toString',\n] as const;\n\nconst NUMBER_SAFE_METHODS: ReadonlyArray<keyof number> = ['toExponential', 'toFixed', 'toPrecision', 'toString'] as const;\n\nconst ARRAY_SAFE_METHODS: ReadonlyArray<keyof Array<unknown>> = [\n 'concat',\n 'every',\n 'filter',\n 'find',\n 'findIndex',\n 'flat',\n 'flatMap',\n 'includes',\n 'indexOf',\n 'join',\n 'lastIndexOf',\n 'map',\n 'reduce',\n 'reduceRight',\n 'slice',\n 'some',\n 'toString',\n 'entries',\n 'keys',\n 'values',\n] as const;\n\nconst DATE_SAFE_METHODS: ReadonlyArray<keyof Date> = [\n 'getDate',\n 'getDay',\n 'getFullYear',\n 'getHours',\n 'getMilliseconds',\n 'getMinutes',\n 'getMonth',\n 'getSeconds',\n 'getTime',\n 'getTimezoneOffset',\n 'getUTCDate',\n 'getUTCDay',\n 'getUTCFullYear',\n 'getUTCHours',\n 'getUTCMilliseconds',\n 'getUTCMinutes',\n 'getUTCMonth',\n 'getUTCSeconds',\n 'toDateString',\n 'toISOString',\n 'toJSON',\n 'toString',\n 'toTimeString',\n 'toUTCString',\n] as const;\n\n/**\n * Whitelist of safe methods that can be called on values\n * Using Set for O(1) lookup performance\n */\nconst SAFE_METHODS: Record<string, ReadonlySet<string>> = {\n string: new Set(STRING_SAFE_METHODS as readonly string[]),\n number: new Set(NUMBER_SAFE_METHODS as readonly string[]),\n array: new Set(ARRAY_SAFE_METHODS as readonly string[]),\n date: new Set(DATE_SAFE_METHODS as readonly string[]),\n};\n\n/**\n * Blacklist of property names that should not be accessible\n * These properties can leak information about object structure or enable attacks\n */\nconst BLOCKED_PROPERTIES = new Set<string>([\n 'constructor',\n '__proto__',\n 'prototype',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__',\n]);\n\n/**\n * Safely evaluates an AST node with a given context\n */\nexport class Evaluator {\n private readonly scope: EvaluationScope;\n private readonly expression: string;\n\n constructor(scope: EvaluationScope, expression: string) {\n this.scope = scope;\n this.expression = expression;\n }\n\n /**\n * Evaluate an AST node\n */\n evaluate(node: ASTNode): unknown {\n switch (node.type) {\n case 'Literal':\n return node.value;\n\n case 'Identifier':\n return this.evaluateIdentifier(node.name);\n\n case 'MemberAccess':\n return this.evaluateMemberAccess(node);\n\n case 'BinaryOp':\n return this.evaluateBinaryOp(node);\n\n case 'UnaryOp':\n return this.evaluateUnaryOp(node);\n\n case 'CallExpression':\n return this.evaluateCallExpression(node);\n\n case 'ArrayLiteral':\n return this.evaluateArrayLiteral(node);\n\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unknown node type: ${(node as { type: string }).type}`, 0, this.expression);\n }\n }\n\n private evaluateIdentifier(name: string): unknown {\n if (!(name in this.scope)) {\n return undefined;\n }\n return this.scope[name];\n }\n\n private evaluateMemberAccess(node: { object: ASTNode; property: string }): unknown {\n const obj = this.evaluate(node.object);\n\n if (obj === null || obj === undefined) {\n return undefined;\n }\n\n // Block access to dangerous properties that could leak information or enable attacks\n if (BLOCKED_PROPERTIES.has(node.property)) {\n throw new ExpressionParserError(\n `[Dynamic Forms] Property \"${node.property}\" is not accessible for security reasons`,\n 0,\n this.expression,\n );\n }\n\n // Allow property access on plain objects and primitives\n if (typeof obj === 'object' || typeof obj === 'string' || typeof obj === 'number') {\n return (obj as Record<string, unknown>)[node.property];\n }\n\n return undefined;\n }\n\n private evaluateBinaryOp(node: { operator: string; left: ASTNode; right: ASTNode }): unknown {\n const left = this.evaluate(node.left);\n const right = this.evaluate(node.right);\n\n switch (node.operator) {\n // Arithmetic\n case '+':\n return (left as number) + (right as number);\n case '-':\n return (left as number) - (right as number);\n case '*':\n return (left as number) * (right as number);\n case '/':\n return (left as number) / (right as number);\n case '%':\n return (left as number) % (right as number);\n\n // Comparison - using == and != intentionally for loose equality\n case '==':\n return left == right;\n case '===':\n return left === right;\n case '!=':\n return left != right;\n case '!==':\n return left !== right;\n case '>':\n return (left as number) > (right as number);\n case '<':\n return (left as number) < (right as number);\n case '>=':\n return (left as number) >= (right as number);\n case '<=':\n return (left as number) <= (right as number);\n\n // Logical\n case '&&':\n return left && right;\n case '||':\n return left || right;\n\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unknown binary operator: ${node.operator}`, 0, this.expression);\n }\n }\n\n private evaluateUnaryOp(node: { operator: string; operand: ASTNode }): unknown {\n const operand = this.evaluate(node.operand);\n\n switch (node.operator) {\n case '!':\n return !operand;\n case '-':\n return -(operand as number);\n case '+':\n return +(operand as number);\n case 'typeof':\n return typeof operand;\n default:\n throw new ExpressionParserError(`[Dynamic Forms] Unknown unary operator: ${node.operator}`, 0, this.expression);\n }\n }\n\n private evaluateCallExpression(node: { callee: ASTNode; arguments: ASTNode[] }): unknown {\n // Only allow method calls (member access), not arbitrary function calls\n if (node.callee.type !== 'MemberAccess') {\n throw new ExpressionParserError('[Dynamic Forms] Only method calls are allowed, not arbitrary function calls', 0, this.expression);\n }\n\n const obj = this.evaluate(node.callee.object);\n const methodName = node.callee.property;\n\n // Block access to dangerous properties (must check before method call)\n if (BLOCKED_PROPERTIES.has(methodName)) {\n throw new ExpressionParserError(\n `[Dynamic Forms] Property \"${methodName}\" is not accessible for security reasons`,\n 0,\n this.expression,\n );\n }\n\n // Check if the method is in the whitelist\n if (!this.isMethodSafe(obj, methodName)) {\n throw new ExpressionParserError(`[Dynamic Forms] Method \"${methodName}\" is not allowed for security reasons`, 0, this.expression);\n }\n\n // Evaluate arguments\n const args = node.arguments.map((arg) => this.evaluate(arg));\n\n // Call the method with proper `this` binding\n const method = (obj as Record<string, unknown>)[methodName];\n if (typeof method === 'function') {\n // Use .call() to properly bind `this` context\n return (method as (...args: unknown[]) => unknown).call(obj, ...args);\n }\n\n return undefined;\n }\n\n private evaluateArrayLiteral(node: { elements: ASTNode[] }): unknown {\n return node.elements.map((element) => this.evaluate(element));\n }\n\n private isMethodSafe(obj: unknown, methodName: string): boolean {\n if (obj === null || obj === undefined) {\n return false;\n }\n\n const type = Array.isArray(obj) ? 'array' : obj instanceof Date ? 'date' : typeof obj;\n\n const safeMethods = SAFE_METHODS[type];\n if (!safeMethods) {\n return false;\n }\n\n return safeMethods.has(methodName);\n }\n}\n","import { Parser } from './parser';\nimport { Evaluator, EvaluationScope } from './evaluator';\nimport { ASTNode, ExpressionParserError } from './types';\n\n/**\n * Maximum cache size to prevent memory issues\n */\nconst MAX_AST_CACHE_SIZE = 1000;\n\n/**\n * LRU Cache implementation for AST nodes\n * Tracks access order to evict least-recently-used entries\n */\nclass LRUCache<K, V> {\n private cache = new Map<K, V>();\n private maxSize: number;\n\n constructor(maxSize: number) {\n this.maxSize = maxSize;\n }\n\n get(key: K): V | undefined {\n const value = this.cache.get(key);\n if (value !== undefined) {\n // Move to end (most recently used)\n this.cache.delete(key);\n this.cache.set(key, value);\n }\n return value;\n }\n\n set(key: K, value: V): void {\n // Delete if exists to update position\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n\n // Add to end (most recently used)\n this.cache.set(key, value);\n\n // Evict least recently used if over limit\n if (this.cache.size > this.maxSize) {\n const firstKey = this.cache.keys().next().value;\n if (firstKey !== undefined) {\n this.cache.delete(firstKey);\n }\n }\n }\n\n clear(): void {\n this.cache.clear();\n }\n\n get size(): number {\n return this.cache.size;\n }\n}\n\n/**\n * Cache for parsed AST nodes to improve performance\n */\nconst astCache = new LRUCache<string, ASTNode>(MAX_AST_CACHE_SIZE);\n\n/**\n * Secure expression parser that uses AST-based evaluation instead of eval() or new Function()\n *\n * This parser provides:\n * - Security: No arbitrary code execution, only whitelisted operations\n * - Performance: AST caching for repeated expressions\n * - Better errors: Clear error messages with position information\n * - Type safety: Strongly typed AST and evaluation\n */\nexport class ExpressionParser {\n /**\n * Parse an expression string into an AST\n * Results are cached for performance using LRU eviction\n */\n static parse(expression: string): ASTNode {\n // Check cache first\n const cached = astCache.get(expression);\n if (cached) {\n return cached;\n }\n\n // Parse the expression\n const parser = new Parser(expression);\n const ast = parser.parse();\n\n // Cache the result (LRU cache handles eviction automatically)\n astCache.set(expression, ast);\n\n return ast;\n }\n\n /**\n * Evaluate an expression with a given scope\n */\n static evaluate(expression: string, scope: EvaluationScope): unknown {\n try {\n const ast = this.parse(expression);\n const evaluator = new Evaluator(scope, expression);\n return evaluator.evaluate(ast);\n } catch (error) {\n if (error instanceof ExpressionParserError) {\n throw error;\n }\n // Wrap other errors for consistency\n throw new ExpressionParserError(\n `[Dynamic Forms] Error evaluating expression: ${error instanceof Error ? error.message : String(error)}`,\n 0,\n expression,\n );\n }\n }\n\n /**\n * Clear the AST cache\n */\n static clearCache(): void {\n astCache.clear();\n }\n\n /**\n * Get cache statistics\n */\n static getCacheStats(): { size: number; maxSize: number } {\n return {\n size: astCache.size,\n maxSize: MAX_AST_CACHE_SIZE,\n };\n }\n}\n","import { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { compareValues, getNestedValue } from './value-utils';\nimport { ExpressionParser } from './parser/expression-parser';\n\n/**\n * Evaluate conditional expression\n * Uses secure AST-based parsing for JavaScript expressions\n */\nexport function evaluateCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n switch (expression.type) {\n case 'fieldValue':\n return evaluateFieldValueCondition(expression, context);\n\n case 'formValue':\n return evaluateFormValueCondition(expression, context);\n\n case 'javascript':\n return evaluateJavaScriptExpression(expression, context);\n\n case 'custom':\n return evaluateCustomFunction(expression, context);\n\n case 'and':\n return evaluateAndCondition(expression, context);\n\n case 'or':\n return evaluateOrCondition(expression, context);\n\n default:\n return false;\n }\n}\n\nfunction evaluateFieldValueCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.fieldPath || !expression.operator) return false;\n\n const fieldValue = getNestedValue(context.formValue, expression.fieldPath);\n return compareValues(fieldValue, expression.value, expression.operator);\n}\n\nfunction evaluateFormValueCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.operator) return false;\n return compareValues(context.formValue, expression.value, expression.operator);\n}\n\nfunction evaluateJavaScriptExpression(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.expression) return false;\n\n try {\n // Use secure AST-based expression parser instead of new Function()\n const result = ExpressionParser.evaluate(expression.expression, context);\n return !!result;\n } catch (error) {\n console.error('[Dynamic Forms] Error evaluating JavaScript expression:', expression.expression, error);\n return false;\n }\n}\n\nfunction evaluateCustomFunction(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.expression) return false;\n\n const customFn = context.customFunctions?.[expression.expression];\n if (!customFn) {\n console.error('[Dynamic Forms] Custom function not found:', expression.expression);\n return false;\n }\n\n try {\n return !!customFn(context);\n } catch (error) {\n console.error('[Dynamic Forms] Error executing custom function:', expression.expression, error);\n return false;\n }\n}\n\nfunction evaluateAndCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.conditions || expression.conditions.length === 0) return false;\n\n // All conditions must be true for AND logic\n return expression.conditions.every((condition) => evaluateCondition(condition, context));\n}\n\nfunction evaluateOrCondition(expression: ConditionalExpression, context: EvaluationContext): boolean {\n if (!expression.conditions || expression.conditions.length === 0) return false;\n\n // At least one condition must be true for OR logic\n return expression.conditions.some((condition) => evaluateCondition(condition, context));\n}\n","import { inject } from '@angular/core';\nimport { FieldContext, LogicFn } from '@angular/forms/signals';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { FieldContextRegistryService } from '../registry/field-context-registry.service';\nimport { FunctionRegistryService } from '../registry/function-registry.service';\nimport { evaluateCondition } from './condition-evaluator';\n\n/**\n * Create a logic function from a conditional expression.\n *\n * This function is used for creating logic functions for hidden, readonly, disabled, and required.\n * It uses the REACTIVE evaluation context, which allows the logic function to create\n * reactive dependencies on form values. When dependent fields change, the logic function\n * will be automatically re-evaluated.\n *\n * NOTE: For validators, use createEvaluationContext directly (with untracked) to prevent\n * infinite reactive loops. Validators with cross-field dependencies should be hoisted\n * to form-level using validateTree.\n */\nexport function createLogicFunction<TValue>(expression: ConditionalExpression): LogicFn<TValue, boolean> {\n // Inject services during factory creation, not during execution\n const functionRegistry = inject(FunctionRegistryService);\n const fieldContextRegistry = inject(FieldContextRegistryService);\n\n return (ctx: FieldContext<TValue>) => {\n // Create REACTIVE evaluation context for logic functions\n // This allows logic to re-evaluate when dependent fields change\n const evaluationContext = fieldContextRegistry.createReactiveEvaluationContext(ctx, functionRegistry.getCustomFunctions());\n\n return evaluateCondition(expression, evaluationContext);\n };\n}\n","import { inject } from '@angular/core';\nimport { FieldContext, LogicFn } from '@angular/forms/signals';\nimport { FieldContextRegistryService } from '../registry/field-context-registry.service';\nimport { ExpressionParser } from '../expressions/parser/expression-parser';\n\n/**\n * Create a dynamic value function from an expression string\n * Uses secure AST-based parsing instead of eval() or new Function()\n */\nexport function createDynamicValueFunction<TValue, TReturn>(expression: string): LogicFn<TValue, TReturn> {\n return (ctx: FieldContext<TValue>) => {\n // Create evaluation context using the registry-based approach\n const fieldContextRegistry = inject(FieldContextRegistryService);\n const evaluationContext = fieldContextRegistry.createEvaluationContext(ctx);\n\n try {\n // Use secure AST-based expression parser\n return ExpressionParser.evaluate(expression, evaluationContext) as TReturn;\n } catch (error) {\n console.error('[Dynamic Forms] Error evaluating dynamic expression:', expression, error);\n return undefined as TReturn;\n }\n };\n}\n","import { ConditionalExpression } from '../expressions/conditional-expression';\n\n/**\n * Special form-state conditions for button disabled logic.\n *\n * These conditions evaluate form or page-level state rather than field values,\n * and are primarily used for controlling button disabled states.\n *\n * @example\n * ```typescript\n * // Disable submit button when form is invalid or submitting\n * {\n * key: 'submit',\n * type: 'submit',\n * label: 'Submit',\n * logic: [\n * { type: 'disabled', condition: 'formInvalid' },\n * { type: 'disabled', condition: 'formSubmitting' },\n * ]\n * }\n *\n * // Disable next button when current page is invalid\n * nextButton({\n * key: 'next',\n * label: 'Next',\n * logic: [\n * { type: 'disabled', condition: 'pageInvalid' },\n * ]\n * })\n * ```\n *\n * @public\n */\nexport type FormStateCondition =\n /** True when form.valid() === false */\n | 'formInvalid'\n /** True when form.submitting() === true */\n | 'formSubmitting'\n /** True when fields on the current page are invalid (for paged forms) */\n | 'pageInvalid';\n\n/**\n * Configuration for conditional field logic.\n *\n * Defines how field behavior changes based on conditions.\n * Supports hiding, disabling, making readonly, or requiring fields\n * based on form state or field values.\n *\n * @example\n * ```typescript\n * // Hide email field when contact method is not email\n * {\n * type: 'hidden',\n * condition: {\n * type: 'fieldValue',\n * fieldPath: 'contactMethod',\n * operator: 'notEquals',\n * value: 'email'\n * }\n * }\n *\n * // Disable button when form is submitting\n * {\n * type: 'disabled',\n * condition: 'formSubmitting'\n * }\n * ```\n *\n * @public\n */\nexport interface LogicConfig {\n /**\n * Logic type identifier.\n *\n * - `hidden`: Hide the field from view (still participates in form state)\n * - `readonly`: Make the field read-only\n * - `disabled`: Disable user interaction\n * - `required`: Make the field required\n */\n type: 'hidden' | 'readonly' | 'disabled' | 'required';\n\n /**\n * Condition that determines when this logic applies.\n *\n * Can be:\n * - `boolean`: Static value (always applies or never applies)\n * - `ConditionalExpression`: Expression evaluated against field/form values\n * - `FormStateCondition`: Special form/page state check (for buttons)\n *\n * @example\n * ```typescript\n * // Static condition\n * condition: true\n *\n * // Field value condition\n * condition: {\n * type: 'fieldValue',\n * fieldPath: 'status',\n * operator: 'equals',\n * value: 'locked'\n * }\n *\n * // Form state condition (for buttons)\n * condition: 'formSubmitting'\n * ```\n */\n condition: ConditionalExpression | boolean | FormStateCondition;\n}\n\n/**\n * Type guard to check if a condition is a FormStateCondition.\n *\n * @param condition - The condition to check\n * @returns true if the condition is a FormStateCondition\n *\n * @public\n */\nexport function isFormStateCondition(condition: LogicConfig['condition']): condition is FormStateCondition {\n return typeof condition === 'string' && ['formInvalid', 'formSubmitting', 'pageInvalid'].includes(condition);\n}\n","import { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { FormStateCondition, isFormStateCondition, LogicConfig } from '../../models/logic/logic-config';\nimport { CustomValidatorConfig, ValidatorConfig } from '../../models/validation/validator-config';\nimport { SchemaApplicationConfig } from '../../models/schemas/schema-definition';\nimport { CustomFunctionScope } from '../expressions/custom-function-types';\n\n/**\n * Regular expression to detect formValue property access in expressions.\n * Matches patterns like: formValue.fieldName, formValue['fieldName'], formValue[\"fieldName\"]\n */\nconst FORM_VALUE_ACCESS_PATTERN = /\\bformValue\\s*(?:\\.|\\[)/;\n\n/**\n * Regular expressions to extract field paths from formValue expressions.\n */\nconst FORM_VALUE_DOT_PATTERN = /\\bformValue\\.(\\w+)/g;\nconst FORM_VALUE_BRACKET_SINGLE_PATTERN = /\\bformValue\\s*\\[\\s*'(\\w+)'\\s*\\]/g;\nconst FORM_VALUE_BRACKET_DOUBLE_PATTERN = /\\bformValue\\s*\\[\\s*\"(\\w+)\"\\s*\\]/g;\n\n/**\n * Context for cross-field detection, providing access to function scope information.\n */\nexport interface CrossFieldDetectionContext {\n /**\n * Lookup function to get the scope of a registered custom function.\n *\n * @param functionName The name of the custom function\n * @returns The function's scope, or undefined if not registered\n */\n getFunctionScope?: (functionName: string) => CustomFunctionScope | undefined;\n}\n\n/**\n * Detects if a ConditionalExpression references other fields (cross-field).\n *\n * This is the core detection function that handles ALL expression types:\n * - `fieldValue` with `fieldPath` → Always cross-field\n * - `formValue` → Always cross-field\n * - `javascript` with `formValue.*` in expression → Cross-field\n * - `custom` → Checks registered function scope, defaults to cross-field if unknown\n * - `and`/`or` → Recursively check nested conditions\n *\n * @param expr The conditional expression to analyze\n * @param context Optional context providing function scope lookup\n * @returns true if the expression references other fields\n */\nexport function isCrossFieldExpression(\n expr: ConditionalExpression | boolean | FormStateCondition | undefined,\n context?: CrossFieldDetectionContext,\n): boolean {\n // Boolean, undefined, or FormStateCondition (form-level state checks) are not cross-field\n if (expr === undefined || typeof expr === 'boolean' || isFormStateCondition(expr)) {\n return false;\n }\n\n switch (expr.type) {\n case 'fieldValue':\n // fieldPath means it references another field's value\n return !!expr.fieldPath;\n\n case 'formValue':\n // formValue type always accesses the form state\n return true;\n\n case 'javascript':\n // Check for formValue.* patterns in the expression string\n return FORM_VALUE_ACCESS_PATTERN.test(expr.expression || '');\n\n case 'custom': {\n // For custom functions, determine scope from registry or default to cross-field.\n // The expression.expression property holds the function name.\n //\n // Look up function scope from registry if context is provided\n const functionName = expr.expression;\n if (context?.getFunctionScope && functionName) {\n const scope = context.getFunctionScope(functionName);\n if (scope === 'field') {\n // Function is explicitly marked as field-scoped (no cross-field deps)\n return false;\n }\n // 'form' scope or undefined → treat as cross-field\n }\n\n // Default: conservative approach - assume cross-field\n return true;\n }\n\n case 'and':\n case 'or':\n // Recursively check nested conditions, passing context through\n return (expr.conditions || []).some((c) => isCrossFieldExpression(c, context));\n\n default:\n return false;\n }\n}\n\n/**\n * Extracts field dependencies from a ConditionalExpression.\n *\n * Returns an array of field keys that the expression depends on.\n * For `formValue` type without specific field, returns ['*'] to indicate\n * dependency on the entire form.\n *\n * @param expr The conditional expression to analyze\n * @returns Array of field keys that this expression depends on\n */\nexport function extractExpressionDependencies(expr: ConditionalExpression | boolean | undefined): string[] {\n if (expr === undefined || typeof expr === 'boolean') {\n return [];\n }\n\n const deps = new Set<string>();\n\n switch (expr.type) {\n case 'fieldValue':\n if (expr.fieldPath) {\n // Extract root field name (before any dots for nested paths)\n deps.add(expr.fieldPath.split('.')[0]);\n }\n break;\n\n case 'formValue':\n // Full form access - depends on everything\n deps.add('*');\n break;\n\n case 'javascript':\n // Extract from formValue.* patterns in expression\n extractFromExpressionString(expr.expression || '', deps);\n break;\n\n case 'custom':\n // Custom functions have full form access - conservative approach\n deps.add('*');\n break;\n\n case 'and':\n case 'or':\n // Recursively extract from nested conditions\n for (const condition of expr.conditions || []) {\n extractExpressionDependencies(condition).forEach((d) => deps.add(d));\n }\n break;\n }\n\n return Array.from(deps);\n}\n\n/**\n * Extracts field names from a JavaScript expression string.\n * Handles both dot notation (formValue.field) and bracket notation (formValue['field']).\n */\nexport function extractStringDependencies(expression: string): string[] {\n const deps = new Set<string>();\n extractFromExpressionString(expression, deps);\n return Array.from(deps);\n}\n\n/** Internal helper that populates a Set with dependencies from an expression string. */\nfunction extractFromExpressionString(expression: string, deps: Set<string>): void {\n // Extract from dot notation: formValue.fieldName\n const dotMatches = expression.matchAll(FORM_VALUE_DOT_PATTERN);\n for (const match of dotMatches) {\n deps.add(match[1]);\n }\n\n // Extract from bracket notation with single quotes: formValue['fieldName']\n const bracketSingleMatches = expression.matchAll(FORM_VALUE_BRACKET_SINGLE_PATTERN);\n for (const match of bracketSingleMatches) {\n deps.add(match[1]);\n }\n\n // Extract from bracket notation with double quotes: formValue[\"fieldName\"]\n const bracketDoubleMatches = expression.matchAll(FORM_VALUE_BRACKET_DOUBLE_PATTERN);\n for (const match of bracketDoubleMatches) {\n deps.add(match[1]);\n }\n}\n\n// ============================================================================\n// Validator Detection\n// ============================================================================\n\n/**\n * Detects if a custom validator configuration references formValue (cross-field validation).\n *\n * @param config The custom validator configuration to check\n * @returns true if the validator references formValue\n */\nexport function isCrossFieldValidator(config: CustomValidatorConfig): boolean {\n if (!config.expression) {\n return false;\n }\n return FORM_VALUE_ACCESS_PATTERN.test(config.expression);\n}\n\n/**\n * Detects if a built-in validator has a dynamic expression that references formValue.\n *\n * Built-in validators (min, max, pattern, etc.) can have dynamic expressions\n * like `{ type: 'min', expression: 'formValue.minAge' }`.\n *\n * @param config The validator configuration to check\n * @returns true if the validator has a cross-field dynamic expression\n */\nexport function isCrossFieldBuiltInValidator(config: ValidatorConfig): boolean {\n if (config.type === 'custom') {\n return false; // Custom validators handled separately\n }\n\n // Check if expression property references formValue\n if ('expression' in config && typeof config.expression === 'string') {\n return FORM_VALUE_ACCESS_PATTERN.test(config.expression);\n }\n\n return false;\n}\n\n/**\n * Detects if a validator's `when` condition is cross-field.\n *\n * @param config The validator configuration to check\n * @param context Optional context providing function scope lookup\n * @returns true if the when condition references other fields\n */\nexport function hasCrossFieldWhenCondition(config: ValidatorConfig, context?: CrossFieldDetectionContext): boolean {\n if (!('when' in config) || !config.when) {\n return false;\n }\n return isCrossFieldExpression(config.when as ConditionalExpression, context);\n}\n\n// ============================================================================\n// Logic Detection\n// ============================================================================\n\n/**\n * Detects if a LogicConfig has a cross-field condition.\n *\n * @param config The logic configuration to check\n * @param context Optional context providing function scope lookup\n * @returns true if the logic condition references other fields\n */\nexport function isCrossFieldLogic(config: LogicConfig, context?: CrossFieldDetectionContext): boolean {\n return isCrossFieldExpression(config.condition, context);\n}\n\n// ============================================================================\n// Schema Detection\n// ============================================================================\n\n/**\n * Detects if a SchemaApplicationConfig has a cross-field condition.\n *\n * @param config The schema application configuration to check\n * @param context Optional context providing function scope lookup\n * @returns true if the schema condition references other fields\n */\nexport function isCrossFieldSchema(config: SchemaApplicationConfig, context?: CrossFieldDetectionContext): boolean {\n if (config.type !== 'applyWhen' || !config.condition) {\n return false;\n }\n return isCrossFieldExpression(config.condition, context);\n}\n","import type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport {\n email,\n FieldContext,\n LogicFn,\n max,\n maxLength,\n min,\n minLength,\n PathKind,\n pattern,\n required,\n SchemaPathRules,\n validate,\n validateAsync,\n validateHttp,\n ValidationError,\n} from '@angular/forms/signals';\nimport { inject } from '@angular/core';\nimport {\n AsyncValidatorConfig,\n BuiltInValidatorConfig,\n CustomValidatorConfig,\n HttpValidatorConfig,\n ValidatorConfig,\n} from '../../models/validation/validator-config';\nimport { createLogicFunction } from '../expressions/logic-function-factory';\nimport { createDynamicValueFunction } from '../values/dynamic-value-factory';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { FunctionRegistryService } from '../registry/function-registry.service';\nimport { FieldContextRegistryService } from '../registry/field-context-registry.service';\nimport { ExpressionParser } from '../expressions/parser/expression-parser';\nimport { isCrossFieldValidator, isCrossFieldBuiltInValidator, hasCrossFieldWhenCondition } from '../cross-field/cross-field-detector';\n\n/**\n * Helper to create conditional logic function from when expression.\n * Returns undefined if no when condition is specified.\n * Reduces duplication across validator types.\n */\nfunction createConditionalLogic<TValue>(when: ConditionalExpression | undefined): LogicFn<TValue, boolean> | undefined {\n return when ? (createLogicFunction(when) as LogicFn<TValue, boolean>) : undefined;\n}\n\n/**\n * Safely cast a SchemaPathTree to SchemaPath with Supported rules.\n *\n * This is safe when TValue is not an AbstractControl, because:\n * - SchemaPathTree<T> for non-AbstractControl is: SchemaPath<T, Supported> & {...nested}\n * - The intersection type is structurally compatible with SchemaPath<T, Supported>\n * - We only work with signal forms, never reactive forms (AbstractControl)\n *\n * TypeScript can't automatically narrow this because SchemaPathTree is defined as a\n * conditional type, but at runtime the value is always the correct type for our use case.\n */\nfunction toSupportedPath<TValue, TPathKind extends PathKind = PathKind.Root>(\n path: SchemaPath<TValue, any, TPathKind> | SchemaPathTree<TValue, TPathKind>,\n): SchemaPath<TValue, SchemaPathRules.Supported, TPathKind> {\n // The cast is safe because SchemaPathTree extends SchemaPath, and we constrain TValue\n // to exclude AbstractControl in our public APIs (we never pass reactive form controls)\n return path as SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>;\n}\n\n/**\n * Apply validator configuration to field path, following the logic pattern.\n *\n * Accepts both SchemaPath and SchemaPathTree to support being called from both\n * individual field mappings and schema functions.\n *\n * Note: ValidatorConfig is runtime configuration that doesn't encode the field's\n * TypeScript type. The type assertions to specific types (string, number) are safe\n * because Angular's validators perform runtime value checks regardless of the static\n * type parameter.\n *\n * Cross-field validators (those referencing formValue.*) are skipped at field level.\n * They are collected by the parent form component using collectCrossFieldEntries\n * and executed at form level using validateTree.\n *\n * @param config The validator configuration\n * @param fieldPath The field path to apply the validator to\n * @param fieldKey Optional field key (used for logging)\n */\nexport function applyValidator(config: ValidatorConfig, fieldPath: SchemaPath<any> | SchemaPathTree<any>, fieldKey?: string): void {\n const path = toSupportedPath(fieldPath);\n\n // Check if this is a built-in validator with a cross-field expression\n // These are collected at form level - skip here\n if (isCrossFieldBuiltInValidator(config)) {\n // Cross-field validators are handled at form level via validateTree\n return;\n }\n\n // Check if the validator has a cross-field `when` condition\n // These are collected at form level - skip here\n if (hasCrossFieldWhenCondition(config)) {\n // Cross-field validators are handled at form level via validateTree\n return;\n }\n\n switch (config.type) {\n case 'required':\n if (config.when) {\n const whenLogic = createLogicFunction(config.when);\n required(path, { when: whenLogic });\n } else {\n required(path);\n }\n break;\n\n case 'email':\n email(fieldPath as SchemaPath<string>);\n break;\n\n case 'min':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMin = createDynamicValueFunction<string | number | null, number | undefined>(config.expression);\n min(fieldPath as SchemaPath<number>, dynamicMin);\n } else {\n min(fieldPath as SchemaPath<number>, config.value);\n }\n }\n break;\n\n case 'max':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMax = createDynamicValueFunction<string | number | null, number | undefined>(config.expression);\n max(fieldPath as SchemaPath<number>, dynamicMax);\n } else {\n max(fieldPath as SchemaPath<number>, config.value);\n }\n }\n break;\n\n case 'minLength':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMinLength = createDynamicValueFunction<string, number>(config.expression);\n minLength(fieldPath as SchemaPath<string>, dynamicMinLength);\n } else {\n minLength(fieldPath as SchemaPath<string>, config.value);\n }\n }\n break;\n\n case 'maxLength':\n if (typeof config.value === 'number') {\n if (config.expression) {\n const dynamicMaxLength = createDynamicValueFunction<string, number>(config.expression);\n // MaxLength validator expects SchemaPath<string>\n maxLength(fieldPath as SchemaPath<string, SchemaPathRules.Supported>, dynamicMaxLength);\n } else {\n maxLength(fieldPath as SchemaPath<string, SchemaPathRules.Supported>, config.value);\n }\n }\n break;\n\n case 'pattern':\n if (config.value instanceof RegExp || typeof config.value === 'string') {\n const regexPattern = typeof config.value === 'string' ? new RegExp(config.value) : config.value;\n if (config.expression) {\n const dynamicPattern = createDynamicValueFunction<string | undefined, RegExp | undefined>(config.expression);\n // Pattern validator expects SchemaPath<string>\n pattern(\n fieldPath as SchemaPath<string, SchemaPathRules.Supported>,\n dynamicPattern as LogicFn<string | undefined, RegExp | undefined>,\n );\n } else {\n pattern(fieldPath as SchemaPath<string, SchemaPathRules.Supported>, regexPattern);\n }\n }\n break;\n\n case 'custom':\n applyCustomValidator(config, path, fieldKey);\n break;\n\n case 'customAsync':\n applyAsyncValidator(config, path);\n break;\n\n case 'customHttp':\n applyHttpValidator(config, path);\n break;\n }\n}\n\n/**\n * Apply custom validator to field path using Angular's public validate() API\n * Supports both function-based and expression-based validators.\n *\n * Cross-field validators (those referencing formValue.*) are skipped at field level.\n * They are collected at form level and executed via validateTree.\n *\n * @param config The custom validator configuration\n * @param fieldPath The field path to apply validation to\n * @param fieldKey Optional field key (used for logging)\n */\nfunction applyCustomValidator(config: CustomValidatorConfig, fieldPath: SchemaPath<any>, fieldKey?: string): void {\n // Check if this is a cross-field validator - skip at field level\n if (isCrossFieldValidator(config)) {\n // Cross-field validators are handled at form level via validateTree\n return;\n }\n\n // Non-cross-field validators: apply at field level as before\n let validatorFn: (ctx: FieldContext<any>) => ValidationError | ValidationError[] | null;\n\n if (config.expression) {\n // Expression-based validator\n validatorFn = createExpressionValidator<any>(config);\n } else if (config.functionName) {\n // Function-based validator\n validatorFn = createFunctionValidator<any>(config);\n } else {\n console.warn('[Dynamic Forms] Custom validator must have either \"expression\" or \"functionName\"');\n return;\n }\n\n // Apply with conditional logic if specified\n const whenLogic = createConditionalLogic<any>(config.when);\n if (whenLogic) {\n const conditionalValidator = (ctx: FieldContext<any>) => {\n if (!whenLogic(ctx)) {\n return null; // Condition not met, skip validation\n }\n return validatorFn(ctx);\n };\n validate(fieldPath, conditionalValidator);\n } else {\n validate(fieldPath, validatorFn);\n }\n}\n\n/**\n * Create a function-based validator using registered validator functions\n */\nfunction createFunctionValidator<TValue>(\n config: CustomValidatorConfig,\n): (ctx: FieldContext<TValue>) => ValidationError | ValidationError[] | null {\n const registry = inject(FunctionRegistryService);\n const validatorFn = registry.getValidator(config.functionName!);\n\n if (!validatorFn) {\n console.warn(\n `[Dynamic Forms] Custom validator \"${config.functionName}\" not found in registry. ` +\n `Ensure it's registered using customFnConfig.validators or check the function name for typos.`,\n );\n return () => null;\n }\n\n return (ctx: FieldContext<TValue>): ValidationError | ValidationError[] | null => {\n return validatorFn(ctx, config.params);\n };\n}\n\n/**\n * Create an expression-based validator using secure AST evaluation\n */\nfunction createExpressionValidator<TValue>(\n config: CustomValidatorConfig,\n): (ctx: FieldContext<TValue>) => ValidationError | ValidationError[] | null {\n const fieldContextRegistry = inject(FieldContextRegistryService);\n const functionRegistry = inject(FunctionRegistryService);\n\n return (ctx: FieldContext<TValue>): ValidationError | ValidationError[] | null => {\n try {\n // Create evaluation context from FieldContext\n const evaluationContext = fieldContextRegistry.createEvaluationContext(ctx, functionRegistry.getCustomFunctions());\n\n // Evaluate expression securely using AST parser\n const result = ExpressionParser.evaluate(config.expression!, evaluationContext);\n\n // If expression returns truthy, validation passes (no error)\n // If expression returns falsy, validation fails\n if (result) {\n return null; // Validation passes\n }\n\n // Validation failed - return error with kind\n const kind = config.kind || 'custom';\n const validationError: ValidationError = { kind };\n\n // Evaluate and include errorParams for message interpolation\n if (config.errorParams) {\n Object.entries(config.errorParams).forEach(([key, expression]) => {\n try {\n (validationError as unknown as Record<string, unknown>)[key] = ExpressionParser.evaluate(expression, evaluationContext);\n } catch (err) {\n console.warn(`[Dynamic Forms] Error evaluating errorParam \"${key}\":`, expression, err);\n }\n });\n }\n\n return validationError;\n } catch (error) {\n // Gracefully degrade on errors (e.g., typos in field names, undefined functions)\n // Log to console for debugging while keeping form functional\n console.error('[Dynamic Forms] Error evaluating custom validator expression:', config.expression, error);\n return { kind: config.kind || 'custom' };\n }\n };\n}\n\n/**\n * Apply async validator to field path using Angular's public validateAsync() API\n *\n * Angular's validateAsync uses the resource API, which requires:\n * - params: Function that computes params from field context\n * - factory: Function that creates ResourceRef from params signal\n * - onSuccess: Maps resource result to validation errors\n * - onError: Optional handler for resource errors\n */\nfunction applyAsyncValidator(config: AsyncValidatorConfig, fieldPath: SchemaPath<any, SchemaPathRules.Supported>): void {\n const registry = inject(FunctionRegistryService);\n\n // Get async validator config from registry\n const validatorConfig = registry.getAsyncValidator(config.functionName);\n\n if (!validatorConfig) {\n console.warn(\n `[Dynamic Forms] Async validator \"${config.functionName}\" not found in registry. ` +\n `Ensure it's registered using customFnConfig.asyncValidators or check the function name for typos.`,\n );\n return;\n }\n\n // Build Angular's AsyncValidatorOptions\n const asyncOptions = {\n params: (ctx: FieldContext<any>) => {\n return validatorConfig.params(ctx, config.params);\n },\n factory: validatorConfig.factory,\n onSuccess: validatorConfig.onSuccess,\n onError: validatorConfig.onError,\n };\n\n // Apply with conditional logic if specified\n const whenLogic = createConditionalLogic<any>(config.when);\n if (whenLogic) {\n // For conditional async validators, we wrap the params function\n const conditionalOptions = {\n ...asyncOptions,\n params: (ctx: FieldContext<any>) => {\n if (!whenLogic(ctx)) {\n return undefined; // Skip validation when condition not met\n }\n return asyncOptions.params(ctx);\n },\n };\n // TypeScript needs help with the ResourceRef generic - the types are correct at runtime\n validateAsync(fieldPath, conditionalOptions as Parameters<typeof validateAsync>[1]);\n } else {\n validateAsync(fieldPath, asyncOptions as Parameters<typeof validateAsync>[1]);\n }\n}\n\n/**\n * Apply HTTP validator to field path using Angular's public validateHttp() API\n *\n * Angular's validateHttp requires:\n * - request: Function that returns URL string or HttpResourceRequest\n * - onSuccess: Maps HTTP response to validation errors (inverted logic!)\n * - onError: Optional handler for HTTP errors\n */\nfunction applyHttpValidator(config: HttpValidatorConfig, fieldPath: SchemaPath<any>): void {\n const registry = inject(FunctionRegistryService);\n\n // Get HTTP validator config from registry\n const httpValidatorConfig = registry.getHttpValidator(config.functionName);\n\n if (!httpValidatorConfig) {\n console.warn(\n `[Dynamic Forms] HTTP validator \"${config.functionName}\" not found in registry. ` +\n `Ensure it's registered using customFnConfig.httpValidators or check the function name for typos.`,\n );\n return;\n }\n\n // Build Angular's HttpValidatorOptions\n const httpOptions = {\n request: (ctx: FieldContext<any>) => {\n return httpValidatorConfig.request(ctx, config.params);\n },\n onSuccess: httpValidatorConfig.onSuccess,\n onError: httpValidatorConfig.onError,\n };\n\n // Apply with conditional logic if specified\n const whenLogic = createConditionalLogic<any>(config.when);\n if (whenLogic) {\n // For conditional HTTP validators, we wrap the request function\n const conditionalOptions = {\n ...httpOptions,\n request: (ctx: FieldContext<any>) => {\n if (!whenLogic(ctx)) {\n return undefined; // Skip validation when condition not met\n }\n return httpOptions.request(ctx);\n },\n };\n // TypeScript needs help with the HttpResourceRequest generic - the types are correct at runtime\n validateHttp(fieldPath, conditionalOptions as Parameters<typeof validateHttp>[1]);\n } else {\n validateHttp(fieldPath, httpOptions as Parameters<typeof validateHttp>[1]);\n }\n}\n\n/**\n * Apply multiple validators to a field path\n *\n * @param configs Array of validator configurations\n * @param fieldPath The field path to apply validators to\n * @param fieldKey Optional field key (used for logging)\n */\nexport function applyValidators(configs: ValidatorConfig[], fieldPath: SchemaPath<any> | SchemaPathTree<any>, fieldKey?: string): void {\n configs.forEach((config) => applyValidator(config, fieldPath, fieldKey));\n}\n","import { disabled, hidden, readonly, required, SchemaPathRules, PathKind, LogicFn } from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { LogicConfig } from '../../models/logic/logic-config';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { createLogicFunction } from '../expressions/logic-function-factory';\n\n/**\n * A logic function that can be used with Angular Signal Forms.\n * Accepts either a simple () => boolean or a LogicFn that takes FieldContext.\n */\ntype AnyLogicFn<TValue> = LogicFn<TValue, boolean> | (() => boolean);\n\n/**\n * Safely cast a SchemaPathTree to SchemaPath with Supported rules.\n * See validator-factory.ts for detailed explanation of why this is safe.\n */\nfunction toSupportedPath<TValue, TPathKind extends PathKind = PathKind.Root>(\n path: SchemaPath<TValue, any, TPathKind> | SchemaPathTree<TValue, TPathKind>,\n): SchemaPath<TValue, SchemaPathRules.Supported, TPathKind> {\n return path as SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>;\n}\n\n/**\n * Apply logic configuration to field path.\n * Accepts both SchemaPath and SchemaPathTree for flexibility.\n *\n * Cross-field logic (referencing formValue.*) is handled automatically by\n * createLogicFunction which uses RootFormRegistryService to access the\n * root form value. No special context or pre-computed signals needed.\n *\n * @param config The logic configuration\n * @param fieldPath The Angular Signal Forms path\n */\nexport function applyLogic<TValue>(config: LogicConfig, fieldPath: SchemaPath<TValue> | SchemaPathTree<TValue>): void {\n const path = toSupportedPath(fieldPath);\n\n // Handle static boolean conditions\n if (typeof config.condition === 'boolean') {\n const staticLogicFn = () => config.condition as boolean;\n applyLogicFn(config.type, path, staticLogicFn);\n return;\n }\n\n // Create logic function from condition expression\n // Cross-field references (formValue.*) are handled automatically via RootFormRegistryService\n const condition = config.condition as ConditionalExpression;\n const logicFn = createLogicFunction(condition);\n applyLogicFn(config.type, path, logicFn);\n}\n\n/**\n * Applies a logic function to a path for a specific logic type.\n */\nfunction applyLogicFn<TValue>(type: LogicConfig['type'], path: SchemaPath<TValue>, logicFn: AnyLogicFn<TValue>): void {\n switch (type) {\n case 'hidden':\n hidden(path, logicFn);\n break;\n\n case 'readonly':\n readonly(path, logicFn);\n break;\n\n case 'disabled':\n disabled(path, logicFn);\n break;\n\n case 'required':\n required(path, { when: logicFn });\n break;\n }\n}\n\n/**\n * Apply multiple logic configurations to a field path\n *\n * @param configs Array of logic configurations\n * @param fieldPath The Angular Signal Forms path\n */\nexport function applyMultipleLogic<TValue>(configs: LogicConfig[], fieldPath: SchemaPath<TValue> | SchemaPathTree<TValue>): void {\n configs.forEach((config) => applyLogic(config, fieldPath));\n}\n","import { Injectable } from '@angular/core';\nimport { SchemaDefinition } from '../../models/schemas/schema-definition';\n\n@Injectable()\nexport class SchemaRegistryService {\n private readonly registeredSchemas = new Map<string, SchemaDefinition>();\n\n /**\n * Register a reusable schema\n */\n registerSchema(schema: SchemaDefinition): void {\n this.registeredSchemas.set(schema.name, schema);\n }\n\n /**\n * Get registered schema by name\n */\n getSchema(name: string): SchemaDefinition | undefined {\n return this.registeredSchemas.get(name);\n }\n\n /**\n * Get all registered schemas\n */\n getAllSchemas(): Map<string, SchemaDefinition> {\n return new Map(this.registeredSchemas);\n }\n\n /**\n * Clear all registered schemas\n */\n clearSchemas(): void {\n this.registeredSchemas.clear();\n }\n\n /**\n * Resolve schema from string reference or direct definition\n */\n resolveSchema(schema: string | SchemaDefinition): SchemaDefinition | null {\n if (typeof schema === 'string') {\n return this.getSchema(schema) || null;\n }\n return schema;\n }\n}\n","/**\n * Create a type predicate function from a predicate string\n */\nexport function createTypePredicateFunction<T = unknown>(predicate: string): (value: unknown) => value is T {\n return (value: unknown): value is T => {\n try {\n const func = new Function('value', `return ${predicate};`);\n return func(value);\n } catch (error) {\n console.error('[Dynamic Forms] Error evaluating type predicate:', predicate, error);\n return false;\n }\n };\n}\n","import { inject } from '@angular/core';\nimport { apply, applyEach, applyWhen, applyWhenValue, SchemaOrSchemaFn } from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { SchemaApplicationConfig, SchemaDefinition } from '../models/schemas/schema-definition';\nimport { SchemaRegistryService } from './registry/schema-registry.service';\nimport { createLogicFunction } from './expressions/logic-function-factory';\nimport { createTypePredicateFunction } from './values/type-predicate-factory';\nimport { applyValidator } from './validation/validator-factory';\nimport { applyLogic } from './logic/logic-applicator';\n\n/**\n * Apply schema configuration.\n * Accepts both SchemaPath and SchemaPathTree for flexibility.\n *\n * Note: We cast fieldPath to suppress TypeScript's union type errors. This is safe because:\n * 1. We only use signal forms (not AbstractControl), so SchemaPathTree is always the supported branch\n * 2. The Angular apply functions accept SchemaPath with any value type\n * 3. The actual schema application happens at runtime via the schema function\n */\nexport function applySchema(config: SchemaApplicationConfig, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n const schemaRegistry = inject(SchemaRegistryService);\n const schema = schemaRegistry.resolveSchema(config.schema);\n\n if (!schema) {\n const availableSchemas = Array.from(schemaRegistry.getAllSchemas().keys()).join(', ') || '<none>';\n console.error(\n `[Dynamic Forms] Schema not found: '${config.schema}'. ` +\n `Available schemas: ${availableSchemas}. ` +\n `Ensure the schema is registered in your schema registry.`,\n );\n return;\n }\n\n const schemaFn = createSchemaFunction(schema);\n\n // Cast to suppress union type errors - safe because we only use signal forms (see function docs)\n const path = fieldPath as SchemaPath<any>;\n\n switch (config.type) {\n case 'apply':\n apply(path, schemaFn);\n break;\n\n case 'applyWhen':\n if (config.condition) {\n const conditionFn = createLogicFunction(config.condition);\n applyWhen(path, conditionFn, schemaFn);\n }\n break;\n\n case 'applyWhenValue':\n if (config.typePredicate) {\n const predicate = createTypePredicateFunction(config.typePredicate);\n applyWhenValue(path, predicate, schemaFn);\n }\n break;\n\n case 'applyEach':\n applyEach(path as SchemaPath<any[]>, schemaFn);\n break;\n }\n}\n\n/**\n * Create a schema function from schema definition.\n *\n * Schema functions receive SchemaPathTree which includes both the base SchemaPath\n * and nested child access properties. The validator/logic/schema application functions\n * accept SchemaPath | SchemaPathTree, so we can pass the path directly.\n */\nexport function createSchemaFunction<T = unknown>(schema: SchemaDefinition): SchemaOrSchemaFn<T> {\n return (path: SchemaPathTree<T>) => {\n // Apply validators - path is SchemaPathTree which is accepted by applyValidator\n schema.validators?.forEach((validatorConfig) => {\n applyValidator(validatorConfig, path);\n });\n\n // Apply logic - path is SchemaPathTree which is accepted by applyLogic\n schema.logic?.forEach((logicConfig) => {\n applyLogic(logicConfig, path);\n });\n\n // Apply sub-schemas - path is SchemaPathTree which is accepted by applySchema\n schema.subSchemas?.forEach((subSchemaConfig) => {\n applySchema(subSchemaConfig, path);\n });\n };\n}\n","import { FieldComponent, FieldDef } from '../base/field-def';\nimport { GroupAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Group field interface for creating logical field groupings that map to object values\n * Groups create nested form structures where child field values are collected into an object\n * This is a programmatic grouping only - users cannot customize this field type\n *\n * TypeScript cannot enforce field nesting rules due to circular dependency limitations.\n * For documentation: Groups should contain rows and leaf fields, but NOT pages or other groups.\n * Runtime validation enforces these rules.\n */\nexport interface GroupField<TFields extends readonly GroupAllowedChildren[] = readonly GroupAllowedChildren[]> extends FieldDef<never> {\n type: 'group';\n\n readonly fields: TFields;\n\n /** Groups do not have a label property - they are logical containers only **/\n readonly label?: never;\n}\n\n/**\n * Type guard for GroupField with proper type narrowing\n */\nexport function isGroupField(field: FieldDef<any>): field is GroupField {\n return field.type === 'group' && 'fields' in field;\n}\n\nexport type GroupComponent<T extends GroupAllowedChildren[]> = FieldComponent<GroupField<T>>;\n","import { FieldComponent, FieldDef } from '../base/field-def';\nimport { ArrayAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Array field interface for creating dynamic field collections that map to array values.\n *\n * Key concepts:\n * - The `fields` array defines the TEMPLATE (single field definition), not instances\n * - Array items are created/removed dynamically at runtime via event bus\n * - For primitive arrays: Use a leaf field as template → `['value1', 'value2']`\n * - For object arrays: Use a group field as template → `[{key1: val1}, {key2: val2}]`\n *\n * @example\n * // Primitive array (flat values)\n * {\n * key: 'tags',\n * type: 'array',\n * fields: [{ key: 'tag', type: 'input' }]\n * }\n * // Creates: { tags: ['tag1', 'tag2', 'tag3'] }\n *\n * @example\n * // Object array (nested groups)\n * {\n * key: 'contacts',\n * type: 'array',\n * fields: [{\n * type: 'group',\n * fields: [\n * { key: 'name', type: 'input' },\n * { key: 'email', type: 'input' }\n * ]\n * }]\n * }\n * // Creates: { contacts: [{name: '', email: ''}, {name: '', email: ''}] }\n *\n * Nesting constraints: Arrays can contain rows, leaf fields, or groups (for object arrays),\n * but NOT pages or other arrays. Runtime validation enforces these rules.\n */\nexport interface ArrayField<TFields extends readonly ArrayAllowedChildren[] = readonly ArrayAllowedChildren[]> extends FieldDef<never> {\n type: 'array';\n\n /**\n * Template field definition(s) that will be cloned for each array item.\n * Typically contains a single field definition:\n * - For flat arrays: A leaf field (input, select, checkbox, etc.)\n * - For object arrays: A group field containing multiple child fields\n */\n readonly fields: TFields;\n\n /** Array fields do not have a label property **/\n readonly label?: never;\n}\n\n/**\n * Type guard for ArrayField with proper type narrowing\n */\nexport function isArrayField(field: FieldDef<any>): field is ArrayField {\n return field.type === 'array' && 'fields' in field;\n}\n\nexport type ArrayComponent<T extends ArrayAllowedChildren[]> = FieldComponent<ArrayField<T>>;\n","import { FieldComponent, FieldDef } from '../base/field-def';\nimport { RowAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Row field interface for creating horizontal layouts\n * This is a special field type that contains other definitions arranged horizontally\n * The row itself doesn't have a value - it's a layout container\n * This is a programmatic field type only - users cannot customize this field type\n *\n * TypeScript cannot enforce field nesting rules due to circular dependency limitations.\n * For documentation: Rows should contain groups and leaf fields, but NOT pages or other rows.\n * Runtime validation enforces these rules.\n */\nexport interface RowField<TFields extends readonly RowAllowedChildren[] = readonly RowAllowedChildren[]> extends FieldDef<never> {\n type: 'row';\n\n /** Child definitions to render within this row */\n readonly fields: TFields;\n\n /** Row fields do not have a label property **/\n readonly label?: never;\n}\n\n/**\n * Type guard for RowField with proper type narrowing\n */\nexport function isRowField(field: FieldDef<any>): field is RowField {\n return field.type === 'row' && 'fields' in field && Array.isArray((field as RowField).fields);\n}\n\nexport type RowComponent = FieldComponent<RowField<RowAllowedChildren[]>>;\n","import { FieldDef } from '../base/field-def';\nimport { PageAllowedChildren } from '../../models/types/nesting-constraints';\nimport { isRowField } from './row-field';\nimport { isGroupField } from './group-field';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\n\n/**\n * Logic configuration for page fields.\n * Pages only support the 'hidden' logic type since they are layout containers,\n * not form controls (they can't be readonly, disabled, or required).\n */\nexport interface PageLogicConfig {\n /** Only 'hidden' is supported for pages */\n type: 'hidden';\n\n /**\n * Condition that determines when this page is hidden.\n * Can be a boolean or a conditional expression evaluated against form values.\n */\n condition: ConditionalExpression | boolean;\n}\n\n/**\n * Page field interface for creating top-level page layouts\n * This is a special field type that contains other field definitions\n * The page itself doesn't have a value - it's a layout container like row\n * Pages can only be used at the top level and cannot be nested\n * This is a programmatic field type only - users cannot customize this field type\n *\n * TypeScript cannot enforce field nesting rules due to circular dependency limitations.\n * For documentation: Pages should contain rows, groups, and leaf fields, but NOT other pages.\n * Runtime validation enforces these rules.\n */\nexport interface PageField<TFields extends readonly PageAllowedChildren[] = PageAllowedChildren[]> extends FieldDef<never> {\n type: 'page';\n\n /** Child field definitions to render within this page */\n readonly fields: TFields;\n\n /** Page fields do not have a label property **/\n readonly label?: never;\n\n /**\n * Logic configurations for conditional page visibility.\n * Only 'hidden' type logic is supported for pages.\n *\n * @example\n * ```typescript\n * {\n * key: 'businessPage',\n * type: 'page',\n * logic: [{\n * type: 'hidden',\n * condition: {\n * type: 'fieldValue',\n * fieldPath: 'accountType',\n * operator: 'notEquals',\n * value: 'business',\n * },\n * }],\n * fields: [...]\n * }\n * ```\n */\n readonly logic?: PageLogicConfig[];\n}\n\n/**\n * Type guard for PageField with proper type narrowing\n */\nexport function isPageField(field: FieldDef<unknown>): field is PageField {\n return field.type === 'page' && 'fields' in field && Array.isArray((field as PageField).fields);\n}\n\n/**\n * Validates that a page field doesn't contain nested page fields\n * @param pageField The page field to validate\n * @returns true if valid (no nested pages), false otherwise\n */\nexport function validatePageNesting(pageField: PageField): boolean {\n return !hasNestedPages(pageField.fields);\n}\n\n/**\n * Type guard to check if a field is a container with fields property\n */\nfunction isContainerWithFields(field: FieldDef<unknown>): field is FieldDef<unknown> & { readonly fields: readonly FieldDef<unknown>[] } {\n return (isRowField(field) || isGroupField(field)) && 'fields' in field && Array.isArray((field as { fields: unknown }).fields);\n}\n\n/**\n * Recursively checks if fields contain any nested page fields\n * @param fields Array of field definitions to check\n * @returns true if nested pages found, false otherwise\n */\nfunction hasNestedPages(fields: readonly FieldDef<unknown>[]): boolean {\n for (const field of fields) {\n if (isPageField(field)) {\n return true;\n }\n\n // Check row and group fields for nested pages\n if (isContainerWithFields(field)) {\n if (hasNestedPages(field.fields)) {\n return true;\n }\n }\n }\n return false;\n}\n","import {\n disabled,\n email,\n hidden,\n max,\n maxLength,\n min,\n minLength,\n pattern,\n readonly,\n required,\n SchemaPathRules,\n PathKind,\n applyEach,\n schema,\n} from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { FieldDef } from '../definitions/base/field-def';\nimport { FieldWithValidation } from '../definitions/base/field-with-validation';\nimport { applyValidator } from './validation/validator-factory';\nimport { applyLogic } from './logic/logic-applicator';\nimport { applySchema } from './schema-application';\nimport { isGroupField } from '../definitions/default/group-field';\nimport { isArrayField } from '../definitions/default/array-field';\nimport { isPageField } from '../definitions/default/page-field';\nimport { isRowField } from '../definitions/default/row-field';\n\n/**\n * Safely cast a SchemaPathTree to SchemaPath with Supported rules.\n * See validator-factory.ts for detailed explanation of why this is safe.\n */\nfunction toSupportedPath<TValue, TPathKind extends PathKind = PathKind.Root>(\n path: SchemaPath<TValue, any, TPathKind> | SchemaPathTree<TValue, TPathKind>,\n): SchemaPath<TValue, SchemaPathRules.Supported, TPathKind> {\n return path as SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>;\n}\n\n/**\n * Single entry point to map field data into form\n * This is the main function that should be called from the dynamic form component\n *\n * Cross-field logic (formValue.*) is handled automatically by createLogicFunction\n * which uses RootFormRegistryService. No special context needed.\n *\n * Cross-field validators are skipped at field level - they are collected and\n * applied at form level using validateTree.\n *\n * @param fieldDef The field definition to map\n * @param fieldPath The Angular Signal Forms schema path\n */\nexport function mapFieldToForm(fieldDef: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n // Cast to FieldWithValidation to access validation properties\n const validationField = fieldDef as FieldDef<any> & FieldWithValidation;\n\n // Special handling for page fields - flatten child fields to root level\n if (isPageField(fieldDef)) {\n mapPageFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Special handling for row fields - flatten child fields to root level (like pages)\n if (isRowField(fieldDef)) {\n mapRowFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Special handling for group fields - apply child field validations to the parent form schema\n if (isGroupField(fieldDef)) {\n mapGroupFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Special handling for array fields - apply child field validations to the parent form schema\n if (isArrayField(fieldDef)) {\n mapArrayFieldToForm(fieldDef, fieldPath);\n return;\n }\n\n // Apply simple validation rules from field properties (backward compatibility)\n applySimpleValidationRules(validationField, fieldPath);\n\n // Apply advanced validators if they exist\n // Cross-field validators are skipped here (detected by validator-factory)\n // and applied at form level via validateTree\n if (validationField.validators) {\n validationField.validators.forEach((validatorConfig) => {\n applyValidator(validatorConfig, fieldPath, fieldDef.key);\n });\n }\n\n // Apply logic if it exists\n // Cross-field logic (formValue.*) is handled automatically by createLogicFunction\n if (validationField.logic) {\n validationField.logic.forEach((logicConfig) => {\n applyLogic(logicConfig, fieldPath);\n });\n }\n\n // Apply schemas if they exist\n if (validationField.schemas) {\n validationField.schemas.forEach((schemaConfig) => {\n applySchema(schemaConfig, fieldPath);\n });\n }\n\n // Handle any additional field-specific configuration\n mapFieldSpecificConfiguration(fieldDef, fieldPath);\n}\n\n/**\n * Apply simple validation rules from field properties for backward compatibility\n *\n * Note: This function accepts SchemaPath<any> because FieldDef doesn't encode\n * the field's TypeScript type at compile time. The validators are applied based\n * on runtime FieldDef properties (email, min, max, etc.). The type assertions\n * to specific types (string, number) are safe because:\n * 1. Angular's validators perform runtime value checks, not compile-time type checks\n * 2. The FieldDef properties indicate which validator to apply\n * 3. The SchemaPath type parameter is primarily for IDE autocomplete/type inference\n */\nfunction applySimpleValidationRules(fieldDef: FieldDef<any> & FieldWithValidation, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n const path = toSupportedPath(fieldPath);\n\n // Required validator\n if (fieldDef.required) {\n required(path);\n }\n\n // Email validator\n if (fieldDef.email) {\n // Email validator expects SchemaPath<string>\n email(path as SchemaPath<string, SchemaPathRules.Supported>);\n }\n\n // Numeric validators (min/max)\n // Support both 'min'/'max' (from FieldWithValidation) and 'minValue'/'maxValue' (from SliderField)\n const minVal = fieldDef.min ?? (fieldDef as any).minValue ?? (fieldDef.props as any)?.min;\n const maxVal = fieldDef.max ?? (fieldDef as any).maxValue ?? (fieldDef.props as any)?.max;\n\n if (minVal !== undefined) {\n // Min validator expects SchemaPath<number>\n min(path as SchemaPath<number, SchemaPathRules.Supported>, minVal);\n }\n\n if (maxVal !== undefined) {\n // Max validator expects SchemaPath<number>\n max(path as SchemaPath<number, SchemaPathRules.Supported>, maxVal);\n }\n\n // String length validators\n if (fieldDef.minLength !== undefined) {\n // MinLength validator expects SchemaPath<string>\n minLength(path as SchemaPath<string, SchemaPathRules.Supported>, fieldDef.minLength);\n }\n\n if (fieldDef.maxLength !== undefined) {\n // MaxLength validator expects SchemaPath<string>\n maxLength(path as SchemaPath<string, SchemaPathRules.Supported>, fieldDef.maxLength);\n }\n\n // Pattern validator\n if (fieldDef.pattern) {\n const regexPattern = typeof fieldDef.pattern === 'string' ? new RegExp(fieldDef.pattern) : fieldDef.pattern;\n // Pattern validator expects SchemaPath<string>\n pattern(path as SchemaPath<string, SchemaPathRules.Supported>, regexPattern);\n }\n}\n\n/**\n * Handle field-specific configuration that doesn't fit into validators/logic/schemas\n */\nfunction mapFieldSpecificConfiguration(fieldDef: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n // Handle disabled state\n if (fieldDef.disabled) {\n disabled(toSupportedPath(fieldPath));\n }\n\n // Handle readonly state\n if (fieldDef.readonly) {\n readonly(toSupportedPath(fieldPath));\n }\n\n // Handle hidden state (hidden() requires a logic function, so we provide a static true)\n if (fieldDef.hidden) {\n hidden(toSupportedPath(fieldPath), () => true);\n }\n\n // Handle any additional configuration specific to the field type\n // This can be extended as needed for specific field requirements\n\n // Example: if field has custom form integration requirements\n if ('customFormConfig' in fieldDef && fieldDef.customFormConfig) {\n console.log('Custom form configuration detected for field:', fieldDef.key);\n // Handle custom configuration here\n }\n}\n\n/**\n * Common helper to map child fields to their parent form paths\n * @param fields - Array of child field definitions\n * @param parentPath - The parent field path\n */\nfunction mapChildFieldsToForm<TValue>(fields: FieldDef<any>[], parentPath: SchemaPath<TValue> | SchemaPathTree<TValue>): void {\n for (const childField of fields) {\n if (!childField.key) {\n continue;\n }\n\n // Type assertion needed due to dynamic field keys\n const childPath = (parentPath as any)[childField.key] as SchemaPath<any> | SchemaPathTree<any> | undefined;\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n}\n\n/**\n * Maps page field children to the root form schema\n * Page fields are layout containers that don't create their own form controls\n * Their children are flattened to the root level of the form\n */\nfunction mapPageFieldToForm(pageField: FieldDef<any>, rootPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isPageField(pageField) || !pageField.fields) {\n return;\n }\n\n const fields = pageField.fields as FieldDef<any>[];\n mapChildFieldsToForm(fields, rootPath);\n}\n\n/**\n * Maps row field children to the root form schema\n * Row fields are layout containers (horizontal) that don't create their own form controls\n * Their children are flattened to the root level of the form, similar to page fields\n */\nfunction mapRowFieldToForm(rowField: FieldDef<any>, rootPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isRowField(rowField) || !rowField.fields) {\n return;\n }\n\n const fields = rowField.fields as FieldDef<any>[];\n mapChildFieldsToForm(fields, rootPath);\n}\n\n/**\n * Maps group field children to the parent form schema\n * This ensures that validation from child fields is applied to the parent form\n */\nfunction mapGroupFieldToForm(groupField: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isGroupField(groupField) || !groupField.fields) {\n return;\n }\n\n const fields = groupField.fields as FieldDef<any>[];\n mapChildFieldsToForm(fields, fieldPath);\n}\n\n/**\n * Maps array field to the parent form schema using applyEach.\n *\n * Array fields are fundamentally different from groups:\n * - The fields array is a TEMPLATE (single field definition), not instances\n * - Array items are created/removed dynamically at runtime\n * - applyEach creates proper FieldTree structure for each array item\n *\n * By using applyEach, Angular Signal Forms will:\n * 1. Create FieldTree instances for each array item\n * 2. Apply the item schema (validation, logic) to each item\n * 3. Allow array items to be accessed via arrayFieldTree[index]\n */\nfunction mapArrayFieldToForm(arrayField: FieldDef<any>, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void {\n if (!isArrayField(arrayField) || !arrayField.fields || arrayField.fields.length === 0) {\n return;\n }\n\n // Get the template field (first field in array.fields)\n const templateField = arrayField.fields[0];\n\n // Create an item schema from the template field\n const itemSchema = schema<any>((itemPath: SchemaPathTree<any>) => {\n // Handle container fields (row, group) that have nested fields\n if (isRowField(templateField) || isPageField(templateField)) {\n // Row/page templates flatten their children - apply child validations directly to item\n if (templateField.fields && Array.isArray(templateField.fields)) {\n for (const childField of templateField.fields as FieldDef<any>[]) {\n if (!childField.key) continue;\n const childPath = (itemPath as unknown as Record<string, SchemaPathTree<any>>)[childField.key];\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n }\n } else if (isGroupField(templateField)) {\n // Group template - apply child validations to the item\n if (templateField.fields && Array.isArray(templateField.fields)) {\n for (const childField of templateField.fields as FieldDef<any>[]) {\n if (!childField.key) continue;\n const childPath = (itemPath as unknown as Record<string, SchemaPathTree<any>>)[childField.key];\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n }\n } else {\n // Simple field template - apply validation directly\n mapFieldToForm(templateField, itemPath);\n }\n });\n\n // Apply the item schema to each array element\n applyEach(fieldPath as SchemaPath<any[]>, itemSchema);\n\n // TODO: Support array-level validation (min/max length, unique items, etc.)\n // This would be applied to the array field itself, not individual items:\n // if (arrayField.minLength) minLength(fieldPath, arrayField.minLength);\n // if (arrayField.maxLength) maxLength(fieldPath, arrayField.maxLength);\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { FieldTypeDefinition, getFieldValueHandling } from '../../models/field-type';\n\n/**\n * Generates appropriate default values for different field types in dynamic forms.\n *\n * Uses registry configuration to determine how each field type should handle values.\n * Supports exclude/flatten/include modes based on field type registration.\n *\n * @param field - Field definition to generate default value for\n * @param registry - Field type registry for value handling configuration\n * @returns Appropriate default value based on field type and configuration\n *\n * @example\n * ```typescript\n * // Basic input field defaults to empty string\n * getFieldDefaultValue({ type: 'input', key: 'email' }, registry); // ''\n *\n * // Excluded fields (like text/row) return undefined\n * getFieldDefaultValue({ type: 'text', key: 'label' }, registry); // undefined\n *\n * // Group field returns object with child defaults\n * getFieldDefaultValue({\n * type: 'group',\n * key: 'address',\n * fields: [\n * { type: 'input', key: 'street' },\n * { type: 'input', key: 'city', value: 'New York' }\n * ]\n * }, registry); // { street: '', city: 'New York' }\n * ```\n */\nexport function getFieldDefaultValue(field: FieldDef<unknown>, registry: Map<string, FieldTypeDefinition>): unknown {\n const valueHandling = getFieldValueHandling(field.type, registry);\n\n // Fields with 'exclude' handling don't contribute values\n if (valueHandling === 'exclude') {\n return undefined;\n }\n\n // Flatten fields (row/page) return flattened object of children's values\n // This is used by array fields to get the template structure\n // Note: fieldsToDefaultValues will skip these at top-level since they have keys and return objects\n if (valueHandling === 'flatten' && 'fields' in field && field.fields) {\n const childFields = field.fields as readonly FieldDef<unknown>[];\n\n // Collect only fields that contribute values (exclude buttons, text, etc.)\n const flattenedValues: Record<string, unknown> = {};\n for (const childField of childFields) {\n if ('key' in childField && childField.key) {\n const childValue = getFieldDefaultValue(childField, registry);\n if (childValue !== undefined) {\n flattenedValues[childField.key] = childValue;\n }\n }\n }\n\n // Return flattened object if there are any values, otherwise undefined\n return Object.keys(flattenedValues).length > 0 ? flattenedValues : undefined;\n }\n\n // Group fields with 'include' handling create nested objects\n if (field.type === 'group' && 'fields' in field) {\n const fields = field.fields as readonly FieldDef<unknown>[];\n if (!fields || fields.length === 0) {\n return undefined;\n }\n\n const groupDefaults: Record<string, unknown> = {};\n for (const childField of fields) {\n const childValueHandling = getFieldValueHandling(childField.type, registry);\n\n // Flatten row/page fields into the group (they are presentational containers)\n if (childValueHandling === 'flatten' && 'fields' in childField && childField.fields) {\n const nestedFields = childField.fields as readonly FieldDef<unknown>[];\n for (const nestedField of nestedFields) {\n if ('key' in nestedField && nestedField.key) {\n const nestedValue = getFieldDefaultValue(nestedField, registry);\n if (nestedValue !== undefined) {\n groupDefaults[nestedField.key] = nestedValue;\n }\n }\n }\n } else if ('key' in childField && childField.key) {\n const childValue = getFieldDefaultValue(childField, registry);\n if (childValue !== undefined) {\n groupDefaults[childField.key] = childValue;\n }\n }\n }\n return groupDefaults;\n }\n\n // Check for defaultValue first (used for reset/clear operations)\n if ('defaultValue' in field && (field as any).defaultValue !== undefined && (field as any).defaultValue !== null) {\n return (field as any).defaultValue;\n }\n\n // Use explicit value if provided, with type-specific handling for null\n if ('value' in field) {\n // If value is explicitly set (even to null/undefined), respect it\n if (field.value !== null && field.value !== undefined) {\n return field.value;\n }\n\n // Handle explicit null: use type-specific default\n if (field.value === null) {\n return field.type === 'checkbox' ? false : '';\n }\n\n // Handle explicit undefined: fall through to type-specific defaults\n }\n\n // Type-specific defaults when no value is specified\n if (field.type === 'checkbox') {\n return false;\n }\n\n if (field.type === 'array') {\n return [];\n }\n\n // Number inputs need a number type default for Angular signal forms\n // to use valueAsNumber for coercion. NaN is ideal because:\n // - typeof NaN === 'number' (triggers Angular's valueAsNumber path)\n // - NaN displays as empty in number inputs\n // - valueAsNumber returns NaN when input is cleared\n if (field.type === 'input' && 'props' in field) {\n const props = field.props as { type?: string } | undefined;\n if (props?.type === 'number') {\n return NaN;\n }\n }\n\n return '';\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { isPageField } from '../../definitions/default/page-field';\nimport { isRowField } from '../../definitions/default/row-field';\nimport { isGroupField } from '../../definitions/default/group-field';\nimport { isArrayField } from '../../definitions/default/array-field';\nimport { ContainerFieldTypes, LeafFieldTypes, RegisteredFieldTypes } from '../registry/field-registry';\n\n/**\n * Type guard to check if a field definition has child fields.\n * This is a looser check that works with FieldDef<unknown> without requiring RegisteredFieldTypes.\n */\nexport function hasChildFields<T>(\n field: FieldDef<T>,\n): field is FieldDef<T> & { fields: FieldDef<unknown>[] | Record<string, FieldDef<unknown>> } {\n return 'fields' in field && field.fields != null;\n}\n\n/** Container field type names */\nconst CONTAINER_TYPES = new Set(['page', 'row', 'group', 'array']);\n\n/**\n * Type guard to check if a field is a container field (page, row, group, or array)\n * Container fields have a 'fields' property and don't contribute values directly.\n * This overload works with RegisteredFieldTypes for full type narrowing.\n */\nexport function isContainerField(field: RegisteredFieldTypes): field is ContainerFieldTypes;\n/**\n * Type guard to check if a field is a container field (page, row, group, or array).\n * This overload works with any FieldDef for looser type checking.\n */\nexport function isContainerField(field: FieldDef<unknown>): boolean;\nexport function isContainerField(field: FieldDef<unknown> | RegisteredFieldTypes): boolean {\n return CONTAINER_TYPES.has(field.type);\n}\n\n/**\n * Type guard to check if a field is a leaf field (value or display field)\n * Leaf fields don't have children and either contribute values or display content\n */\nexport function isLeafField(field: RegisteredFieldTypes): field is LeafFieldTypes {\n return !isContainerField(field);\n}\n\n/**\n * Type guard to check if a field has a value property (value-bearing field)\n * These fields contribute to the form value output\n * Note: Using `unknown` in the Extract condition to match any value type\n */\nexport function isValueBearingField(field: RegisteredFieldTypes): field is Extract<RegisteredFieldTypes, { value: unknown }> {\n return 'value' in field;\n}\n\n/**\n * Type guard to check if a field is excluded from form values (display-only field)\n * Currently this includes text fields and any other fields without a value property\n */\nexport function isDisplayOnlyField(field: RegisteredFieldTypes): boolean {\n return field.type === 'text' || isContainerField(field);\n}\n\n// Re-export the specific type guards for convenience\nexport { isPageField, isRowField, isGroupField, isArrayField };\n","import { inject, untracked } from '@angular/core';\nimport { Schema, schema, validateTree, FieldContext, ValidationError, FieldTree } from '@angular/forms/signals';\nimport type { SchemaPath, SchemaPathTree } from '@angular/forms/signals';\nimport { FieldDef } from '../definitions/base/field-def';\nimport { mapFieldToForm } from './form-mapping';\nimport { FieldTypeDefinition, getFieldValueHandling } from '../models/field-type';\nimport { getFieldDefaultValue } from '../utils/default-value/default-value';\nimport { CrossFieldValidatorEntry } from './cross-field/cross-field-types';\nimport { FunctionRegistryService } from './registry/function-registry.service';\nimport { ExpressionParser } from './expressions/parser/expression-parser';\nimport { evaluateCondition } from './expressions/condition-evaluator';\nimport { CustomValidatorConfig, ValidatorConfig } from '../models/validation/validator-config';\nimport { hasChildFields } from '../models/types/type-guards';\n\nconst emailPattern = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\n/**\n * Creates an Angular signal forms schema from field definitions\n * This is the single entry point at dynamic form level that replaces createSchemaFromFields\n * Uses the new modular signal forms adapter structure\n *\n * Cross-field logic (formValue.*) is handled automatically by createLogicFunction\n * which uses RootFormRegistryService. No special context needed.\n *\n * Cross-field validators are passed directly and applied at form level using validateTree.\n *\n * @param fields Field definitions to create schema from\n * @param registry Field type registry\n * @param crossFieldValidators Optional array of collected cross-field validators\n */\nexport function createSchemaFromFields<TModel = unknown>(\n fields: FieldDef<any>[],\n registry: Map<string, FieldTypeDefinition>,\n crossFieldValidators?: CrossFieldValidatorEntry[],\n): Schema<TModel> {\n // Inject services for cross-field validation\n // These will be available because createSchemaFromFields is called within runInInjectionContext\n const functionRegistry = inject(FunctionRegistryService);\n\n return schema<TModel>((path) => {\n for (const fieldDef of fields) {\n const valueHandling = getFieldValueHandling(fieldDef.type, registry);\n\n // Handle different value handling modes\n if (valueHandling === 'exclude') {\n // Skip fields that don't contribute to form values\n continue;\n }\n\n if (valueHandling === 'flatten' && hasChildFields(fieldDef)) {\n // Handle both array (page/row fields) and object (group fields)\n const fieldsArray = Array.isArray(fieldDef.fields) ? fieldDef.fields : Object.values(fieldDef.fields);\n for (const childField of fieldsArray) {\n if (!childField.key) continue;\n\n const childPath = path[childField.key as keyof typeof path] as SchemaPath<unknown>;\n if (childPath) {\n mapFieldToForm(childField, childPath);\n }\n }\n continue;\n }\n\n // Regular field processing for 'include' fields\n const fieldPath = path[fieldDef.key as keyof typeof path] as SchemaPath<unknown>;\n\n if (!fieldPath) {\n continue;\n }\n\n // Use the new modular form mapping function\n // This will progressively apply validators, logic, and schemas\n // Cross-field logic is handled automatically via RootFormRegistryService\n mapFieldToForm(fieldDef, fieldPath);\n }\n\n // Apply cross-field validators using validateTree\n if (crossFieldValidators && crossFieldValidators.length > 0) {\n applyCrossFieldTreeValidator(path as SchemaPathTree<TModel>, crossFieldValidators, functionRegistry);\n }\n });\n}\n\n/**\n * Applies cross-field validators using Angular's validateTree API.\n *\n * This is the key integration point that routes cross-field validation errors\n * to the appropriate target fields via Angular's form state system.\n *\n * The validateTree function allows returning errors with a `field` property\n * that targets specific fields, which Angular automatically routes to those\n * fields' errors() signal.\n *\n * Supports two types of hoisted validators:\n * 1. Custom validators with cross-field expressions (e.g., `formValue.password === formValue.confirmPassword`)\n * 2. Built-in validators with cross-field `when` conditions (e.g., `required` when `country === 'USA'`)\n *\n * @param rootPath The root schema path tree\n * @param validators Array of collected cross-field validators\n * @param functionRegistry Registry containing custom functions for expression evaluation\n */\nfunction applyCrossFieldTreeValidator<TModel>(\n rootPath: SchemaPathTree<TModel>,\n validators: CrossFieldValidatorEntry[],\n functionRegistry: FunctionRegistryService,\n): void {\n // Get custom functions for expression evaluation\n const customFunctions = functionRegistry.getCustomFunctions();\n\n validateTree(rootPath as SchemaPath<TModel>, (ctx: FieldContext<TModel>) => {\n if (validators.length === 0) {\n return null; // ValidationSuccess - no errors\n }\n\n // Read form value reactively - don't wrap in untracked() so Angular can track dependencies\n const formValue = ctx.value() as Record<string, unknown>;\n const errors: ValidationError.WithOptionalField[] = [];\n\n for (const entry of validators) {\n const { sourceFieldKey, config } = entry;\n\n try {\n const error = evaluateCrossFieldValidator(entry, formValue, sourceFieldKey, ctx, customFunctions);\n\n if (error) {\n errors.push(error);\n }\n } catch (err) {\n console.error(`[Dynamic Forms] Error evaluating cross-field validator for ${sourceFieldKey}:`, err);\n\n // On error, add a validation error to indicate the failure\n // Use ctx.field[key] to access the field tree for dynamic field names\n const targetField = (ctx.field as Record<string, FieldTree<unknown>>)[sourceFieldKey];\n\n if (targetField) {\n const customConfig = config as CustomValidatorConfig;\n errors.push({\n kind: customConfig.kind || config.type || 'custom',\n field: targetField,\n });\n }\n }\n }\n\n return errors.length > 0 ? errors : null;\n });\n}\n\n/**\n * Evaluates a single cross-field validator entry and returns an error if validation fails.\n */\nfunction evaluateCrossFieldValidator<TModel>(\n entry: CrossFieldValidatorEntry,\n formValue: Record<string, unknown>,\n sourceFieldKey: string,\n ctx: FieldContext<TModel>,\n customFunctions: Record<string, unknown>,\n): ValidationError.WithOptionalField | null {\n const { config } = entry;\n const fieldValue = formValue[sourceFieldKey];\n\n // Create evaluation context for condition/expression evaluation\n const evaluationContext = {\n fieldValue,\n formValue,\n fieldPath: sourceFieldKey,\n customFunctions,\n };\n\n // Check if this is a custom validator (with expression) or a built-in validator (with when condition)\n if (config.type === 'custom') {\n return evaluateCustomCrossFieldValidator(config as CustomValidatorConfig, evaluationContext, sourceFieldKey, ctx);\n } else {\n // Built-in validator with cross-field when condition\n return evaluateBuiltInCrossFieldValidator(config, evaluationContext, sourceFieldKey, ctx);\n }\n}\n\n/**\n * Evaluates a custom cross-field validator with an expression.\n */\nfunction evaluateCustomCrossFieldValidator<TModel>(\n config: CustomValidatorConfig,\n evaluationContext: Record<string, unknown>,\n sourceFieldKey: string,\n ctx: FieldContext<TModel>,\n): ValidationError.WithOptionalField | null {\n if (!config.expression) {\n return null;\n }\n\n const { fieldValue, formValue } = evaluationContext as { fieldValue: unknown; formValue: Record<string, unknown> };\n\n // First, evaluate the when condition if present\n // If the condition is false, the validator doesn't apply (validation passes)\n if (config.when) {\n const conditionMet = evaluateCondition(config.when, {\n fieldValue,\n formValue,\n fieldPath: sourceFieldKey,\n customFunctions: (evaluationContext.customFunctions as Record<string, (ctx: unknown) => unknown>) || {},\n });\n\n if (!conditionMet) {\n return null; // Condition not met, skip validation\n }\n }\n\n // Evaluate expression using the secure AST parser\n const result = ExpressionParser.evaluate(config.expression, evaluationContext);\n\n // If expression returns truthy, validation passes (no error)\n if (result) {\n return null;\n }\n\n // Validation failed - create error targeting the source field\n // Use ctx.field[key] to access the field tree for dynamic field names\n const targetField = (ctx.field as Record<string, FieldTree<unknown>>)[sourceFieldKey];\n\n if (!targetField) {\n return null;\n }\n\n const errorObj: Record<string, unknown> = {\n kind: config.kind || 'custom',\n field: targetField,\n };\n\n // Evaluate and include errorParams for message interpolation\n if (config.errorParams) {\n for (const [key, expression] of Object.entries(config.errorParams)) {\n try {\n errorObj[key] = ExpressionParser.evaluate(expression, evaluationContext);\n } catch {\n // Ignore evaluation errors for params\n }\n }\n }\n\n return errorObj as unknown as ValidationError.WithOptionalField;\n}\n\n/**\n * Evaluates a built-in validator with a cross-field when condition.\n * First checks the when condition, then applies the built-in validation logic.\n */\nfunction evaluateBuiltInCrossFieldValidator<TModel>(\n config: ValidatorConfig,\n evaluationContext: Record<string, unknown>,\n sourceFieldKey: string,\n ctx: FieldContext<TModel>,\n): ValidationError.WithOptionalField | null {\n const { fieldValue, formValue } = evaluationContext as { fieldValue: unknown; formValue: Record<string, unknown> };\n\n // First, evaluate the when condition\n // If the condition is false, the validator doesn't apply (validation passes)\n if (config.when) {\n const conditionMet = evaluateCondition(config.when, {\n fieldValue,\n formValue,\n fieldPath: sourceFieldKey,\n customFunctions: (evaluationContext.customFunctions as Record<string, (ctx: unknown) => unknown>) || {},\n });\n\n if (!conditionMet) {\n return null; // Condition not met, skip validation\n }\n }\n\n // Now apply the built-in validation logic based on the validator type\n const isValid = applyBuiltInValidationLogic(config, fieldValue);\n\n if (isValid) {\n return null; // Validation passed\n }\n\n // Validation failed - create error targeting the source field\n // Use ctx.field[key] to access the field tree for dynamic field names\n const targetField = (ctx.field as Record<string, FieldTree<unknown>>)[sourceFieldKey];\n if (!targetField) {\n return null;\n }\n\n return {\n kind: config.type,\n field: targetField,\n } as ValidationError.WithOptionalField;\n}\n\n/**\n * Applies built-in validation logic based on the validator type.\n * Returns true if validation passes, false if it fails.\n */\nfunction applyBuiltInValidationLogic(config: ValidatorConfig, fieldValue: unknown): boolean {\n switch (config.type) {\n case 'required':\n // Required: value must be non-null, non-undefined, and non-empty string\n if (fieldValue === null || fieldValue === undefined) {\n return false;\n }\n if (typeof fieldValue === 'string' && fieldValue.trim() === '') {\n return false;\n }\n return true;\n\n case 'min':\n // Min: numeric value must be >= min\n if (fieldValue === null || fieldValue === undefined) {\n return true; // Empty values pass min validation (use required for emptiness)\n }\n if ('value' in config && typeof config.value === 'number') {\n return (fieldValue as number) >= config.value;\n }\n return true;\n\n case 'max':\n // Max: numeric value must be <= max\n if (fieldValue === null || fieldValue === undefined) {\n return true;\n }\n if ('value' in config && typeof config.value === 'number') {\n return (fieldValue as number) <= config.value;\n }\n return true;\n\n case 'minLength':\n // MinLength: string length must be >= minLength\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n if ('value' in config && typeof config.value === 'number') {\n return String(fieldValue).length >= config.value;\n }\n return true;\n\n case 'maxLength':\n // MaxLength: string length must be <= maxLength\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n if ('value' in config && typeof config.value === 'number') {\n return String(fieldValue).length <= config.value;\n }\n return true;\n\n case 'email':\n // Email: must match email pattern\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n\n return emailPattern.test(String(fieldValue));\n\n case 'pattern':\n // Pattern: must match regex pattern\n if (fieldValue === null || fieldValue === undefined || fieldValue === '') {\n return true;\n }\n if ('value' in config && config.value) {\n const regex = config.value instanceof RegExp ? config.value : new RegExp(String(config.value));\n return regex.test(String(fieldValue));\n }\n return true;\n\n default:\n // Unknown validator type, consider valid\n return true;\n }\n}\n\n/**\n * Utility to convert field definitions to default values object\n */\nexport function fieldsToDefaultValues<TModel = unknown>(fields: FieldDef<any>[], registry: Map<string, FieldTypeDefinition>): TModel {\n const defaultValues: Record<string, unknown> = {};\n\n for (const field of fields) {\n if (!field.key) continue;\n\n // Skip flatten fields (row/page) at top level - they are presentational containers\n const valueHandling = getFieldValueHandling(field.type, registry);\n if (valueHandling === 'flatten') {\n continue;\n }\n\n const value = getFieldDefaultValue(field, registry);\n if (value !== undefined) {\n defaultValues[field.key] = value;\n }\n }\n\n return defaultValues as TModel;\n}\n","import { Injectable } from '@angular/core';\nimport { filter, Observable, Subject } from 'rxjs';\nimport { FormEvent, FormEventConstructor } from './interfaces/form-event';\n\n/**\n * Event bus service for form-wide event communication.\n *\n * Provides type-safe event dispatching and subscription for form components\n * to communicate without direct coupling. Uses RxJS observables for reactive\n * event handling and supports both single event type and multiple event type subscriptions.\n *\n * @example\n * ```typescript\n * @Component({\n * providers: [EventBus]\n * })\n * export class MyFormComponent {\n * constructor(private eventBus: EventBus) {\n * // Subscribe to form submission events\n * this.eventBus.on<SubmitEvent>('submit').subscribe(() => {\n * console.log('Form was submitted');\n * });\n *\n * // Subscribe to multiple event types\n * this.eventBus.on<SubmitEvent | FormResetEvent>(['submit', 'form-reset']).subscribe(event => {\n * console.log('Form event:', event.type);\n * });\n * }\n *\n * onSubmit() {\n * // Dispatch a submit event\n * this.eventBus.dispatch(SubmitEvent);\n * }\n * }\n * ```\n */\n@Injectable()\nexport class EventBus {\n private pipeline$ = new Subject<FormEvent>();\n\n events$ = this.pipeline$.asObservable();\n\n /**\n * Dispatches an event to all subscribers.\n *\n * Creates an instance of the provided event constructor and broadcasts it\n * through the event pipeline to all active subscribers.\n *\n * @param eventConstructor - Constructor function for the event to dispatch\n *\n * @example\n * ```typescript\n * // Dispatch a submit event\n * eventBus.dispatch(SubmitEvent);\n *\n * // Dispatch a custom event\n * eventBus.dispatch(CustomFormEvent);\n * ```\n */\n dispatch<T extends FormEventConstructor>(eventConstructor: T, ...args: any[]): void {\n this.pipeline$.next(new eventConstructor(...args));\n }\n\n /**\n * Subscribes to events of a specific type.\n *\n * @param eventType - The type of event to subscribe to\n * @returns Observable that emits events of the specified type\n */\n on<T extends FormEvent>(eventType: T['type']): Observable<T>;\n /**\n * Subscribes to events of multiple types.\n *\n * @param eventType - Array of event types to subscribe to\n * @returns Observable that emits events matching any of the specified types\n */\n on<T extends FormEvent>(eventType: Array<T['type']>): Observable<T>;\n /**\n * Subscribes to form events with type-safe filtering.\n *\n * Provides a reactive stream of events filtered by type. Supports both single\n * event type subscriptions and multi-type subscriptions for flexible event handling.\n *\n * @param eventType - Event type string or array of event type strings to filter by\n * @returns Observable stream of filtered events\n *\n * @example\n * ```typescript\n * // Subscribe to a single event type\n * eventBus.on<SubmitEvent>('submit').subscribe(event => {\n * console.log('Submit event received');\n * });\n *\n * // Subscribe to multiple event types\n * eventBus.on<SubmitEvent | FormResetEvent | ValidationErrorEvent>(['submit', 'form-reset', 'validation-error']).subscribe(event => {\n * switch (event.type) {\n * case 'submit':\n * handleSubmit();\n * break;\n * case 'form-reset':\n * handleReset();\n * break;\n * case 'validation-error':\n * handleValidationError();\n * break;\n * }\n * });\n * ```\n */\n on<T extends FormEvent>(eventType: T['type'] | Array<T['type']>): Observable<T> {\n if (Array.isArray(eventType)) {\n return this.pipeline$.pipe(filter((event): event is T => eventType.includes(event.type)));\n }\n\n return this.pipeline$.pipe(filter((event): event is T => event.type === eventType));\n }\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class SubmitEvent implements FormEvent {\n readonly type = 'submit' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class ComponentInitializedEvent implements FormEvent {\n readonly type = 'component-initialized' as const;\n\n constructor(\n public componentType: 'dynamic-form' | 'page' | 'row' | 'group',\n public componentId: string,\n ) {}\n}\n","import { Injector, Signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { Observable } from 'rxjs';\nimport { filter, map, scan, shareReplay, switchMap, take } from 'rxjs/operators';\nimport { EventBus } from '../../events/event.bus';\nimport { ComponentInitializedEvent } from '../../events/constants/component-initialized.event';\n\n/**\n * Creates an observable that tracks component initialization progress.\n *\n * This function returns an observable that emits when all expected components\n * have been initialized. It uses the scan operator to accumulate initialization\n * events and emits true when the count reaches the expected total.\n *\n * @param eventBus - The event bus instance to subscribe to\n * @param expectedCount - Total number of components expected to initialize\n * @returns Observable<boolean> that emits true when all components are initialized\n *\n * @example\n * ```typescript\n * const eventBus = inject(EventBus);\n * const totalComponents = 5; // 1 dynamic-form + 2 pages + 1 row + 1 group\n *\n * const allInitialized$ = createInitializationTracker(eventBus, totalComponents);\n *\n * allInitialized$.subscribe(isComplete => {\n * if (isComplete) {\n * console.log('All components are initialized!');\n * }\n * });\n * ```\n */\nexport function createInitializationTracker(eventBus: EventBus, expectedCount: number): Observable<boolean> {\n return eventBus.on<ComponentInitializedEvent>('component-initialized').pipe(\n scan((count, _event) => count + 1, 0),\n map((currentCount) => currentCount >= expectedCount),\n filter((isComplete) => isComplete),\n );\n}\n\n/**\n * Creates an observable that tracks component initialization progress with detailed status.\n *\n * This function returns an observable that emits the current count and completion status\n * for each initialization event, providing more granular tracking capabilities.\n *\n * @param eventBus - The event bus instance to subscribe to\n * @param expectedCount - Total number of components expected to initialize\n * @returns Observable with current count, expected count, and completion status\n *\n * @example\n * ```typescript\n * const eventBus = inject(EventBus);\n * const totalComponents = 5;\n *\n * const progress$ = createDetailedInitializationTracker(eventBus, totalComponents);\n *\n * progress$.subscribe(({ currentCount, expectedCount, isComplete }) => {\n * console.log(`Progress: ${currentCount}/${expectedCount} (${isComplete ? 'Complete' : 'In Progress'})`);\n * });\n * ```\n */\nexport function createDetailedInitializationTracker(\n eventBus: EventBus,\n expectedCount: number,\n): Observable<{ currentCount: number; expectedCount: number; isComplete: boolean }> {\n return eventBus.on<ComponentInitializedEvent>('component-initialized').pipe(\n scan((count, _event) => count + 1, 0),\n map((currentCount) => ({\n currentCount,\n expectedCount,\n isComplete: currentCount >= expectedCount,\n })),\n );\n}\n\n/**\n * Options for setting up initialization tracking.\n */\nexport interface InitializationTrackingOptions {\n eventBus: EventBus;\n totalComponentsCount: Signal<number>;\n injector: Injector;\n componentId: string;\n}\n\n/**\n * Creates an observable that tracks when all form components are initialized.\n * Uses shareReplay({ bufferSize: 1, refCount: false }) to ensure exactly one emission\n * that can be received by late subscribers and keeps the subscription alive.\n *\n * This utility function replaces the manual ReplaySubject pattern for tracking initialization.\n * The count includes container components (dynamic-form, pages, rows, groups).\n *\n * @param options - Configuration options for initialization tracking\n * @returns Observable<boolean> that emits true when all components are initialized\n *\n * @example\n * ```typescript\n * const eventBus = inject(EventBus);\n * const totalComponents = computed(() => countContainerComponents(fields));\n *\n * readonly initialized$ = setupInitializationTracking({\n * eventBus,\n * totalComponentsCount: totalComponents,\n * injector: this.injector,\n * componentId: 'dynamic-form'\n * });\n * ```\n */\nexport function setupInitializationTracking(options: InitializationTrackingOptions): Observable<boolean> {\n const { eventBus, totalComponentsCount, injector, componentId } = options;\n\n return toObservable(totalComponentsCount, { injector }).pipe(\n take(1),\n switchMap((count) => {\n if (count === 1) {\n // Only dynamic-form component, emit immediately when it initializes\n return eventBus.on<ComponentInitializedEvent>('component-initialized').pipe(\n filter((event) => event.componentType === 'dynamic-form' && event.componentId === componentId),\n map(() => true),\n take(1),\n );\n }\n\n return createInitializationTracker(eventBus, count);\n }),\n shareReplay({ bufferSize: 1, refCount: false }),\n );\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { isPageField } from '../../definitions/default/page-field';\nimport { RegisteredFieldTypes } from '../registry/field-registry';\n\n// Re-export isPageField for external usage\nexport { isPageField };\n\n/**\n * Type guard to check if a field is a container with fields\n */\nfunction isContainerWithFields(field: FieldDef<any>): field is FieldDef<any> & { fields: FieldDef<any>[] } {\n return (\n (field.type === 'row' || field.type === 'group' || field.type === 'page') &&\n 'fields' in field &&\n Array.isArray((field as FieldDef<any> & { fields: FieldDef<any>[] }).fields)\n );\n}\n\n/**\n * Form mode enumeration distinguishing between paged and non-paged forms\n */\nexport type FormMode = 'paged' | 'non-paged';\n\n/**\n * Result of form mode detection with validation details\n */\nexport interface FormModeDetectionResult {\n /** The detected form mode */\n mode: FormMode;\n /** Whether the form configuration is valid for the detected mode */\n isValid: boolean;\n /** Array of validation errors if form is invalid */\n errors: string[];\n}\n\n/**\n * Type guard for paged form configurations\n * A paged form has ALL root-level fields of type 'page'\n */\nexport function isPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n if (!fields || fields.length === 0) {\n return false;\n }\n\n return fields.every((field) => isPageField(field));\n}\n\n/**\n * Type guard for non-paged form configurations\n * A non-paged form has NO page fields at any level\n */\nexport function isNonPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n if (!fields || fields.length === 0) {\n return true; // Empty form is considered non-paged\n }\n\n return !hasAnyPageFields(fields);\n}\n\n/**\n * Detects the form mode and validates the configuration\n * @param fields The form field definitions\n * @returns Detection result with mode and validation status\n */\nexport function detectFormMode<TFields extends RegisteredFieldTypes[]>(fields: TFields): FormModeDetectionResult {\n if (!fields || fields.length === 0) {\n return {\n mode: 'non-paged',\n isValid: true,\n errors: [],\n };\n }\n\n const hasPageFields = fields.some((field) => isPageField(field));\n const allPagesAtRoot = fields.every((field) => isPageField(field));\n const hasNestedPages = hasNestedPageFields(fields);\n\n // Determine mode and validate\n if (hasPageFields) {\n const errors: string[] = [];\n\n // For paged forms, ALL root fields must be pages\n if (!allPagesAtRoot) {\n errors.push('Mixed page and non-page fields at root level. In paged forms, ALL root-level fields must be of type \"page\".');\n }\n\n // Check for nested pages in any page field\n if (hasNestedPages) {\n errors.push('Page fields cannot contain nested page fields at any level.');\n }\n\n return {\n mode: 'paged',\n isValid: errors.length === 0,\n errors,\n };\n } else {\n // Non-paged form\n const errors: string[] = [];\n\n // Non-paged forms cannot have page fields anywhere\n if (hasAnyPageFields(fields)) {\n errors.push('Page fields are not allowed in non-paged forms.');\n }\n\n return {\n mode: 'non-paged',\n isValid: errors.length === 0,\n errors,\n };\n }\n}\n\n/**\n * Recursively checks if any field definition is a page field\n * @param fields Array of field definitions to check\n * @returns true if any page field is found at any level\n */\nfunction hasAnyPageFields(fields: FieldDef<any>[]): boolean {\n for (const field of fields) {\n if (isPageField(field)) {\n return true;\n }\n\n // Check nested fields in container types\n if (isContainerWithFields(field) && (field.type === 'row' || field.type === 'group')) {\n if (hasAnyPageFields(field.fields)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Checks if fields contain nested page fields within their children\n * (This is different from hasAnyPageFields as it checks NESTED pages, not root pages)\n * @param fields Array of field definitions to check\n * @returns true if nested page fields found\n */\nfunction hasNestedPageFields(fields: FieldDef<any>[]): boolean {\n for (const field of fields) {\n // If this is a page field, check if its children contain pages\n if (isPageField(field) && isContainerWithFields(field)) {\n if (hasAnyPageFields(field.fields)) {\n return true;\n }\n }\n\n // Check other container types for nested pages\n if (isContainerWithFields(field) && (field.type === 'row' || field.type === 'group')) {\n if (hasNestedPageFields(field.fields)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Type predicate for valid paged form configurations\n */\nexport function isValidPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n const result = detectFormMode(fields);\n return result.mode === 'paged' && result.isValid;\n}\n\n/**\n * Type predicate for valid non-paged form configurations\n */\nexport function isValidNonPagedForm<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n const result = detectFormMode(fields);\n return result.mode === 'non-paged' && result.isValid;\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { isRowField } from '../../definitions/default/row-field';\nimport { isGroupField } from '../../definitions/default/group-field';\nimport { isArrayField } from '../../definitions/default/array-field';\nimport { FieldTypeDefinition, getFieldValueHandling } from '../../models/field-type';\n\n/**\n * Represents a field definition that has been processed through the flattening algorithm.\n *\n * Guarantees that the field has a valid key property, either from the original\n * field definition or auto-generated during the flattening process.\n *\n * @public\n */\nexport interface FlattenedField extends FieldDef<unknown> {\n /** Guaranteed non-empty key for form binding and field identification */\n readonly key: string;\n}\n\n/**\n * Flattens a hierarchical field structure into a linear array for form processing.\n *\n * Handles different field types with specific flattening strategies:\n * - **Page fields**: Children are flattened and merged into the result (no wrapper)\n * - **Row fields**: Children are flattened and merged into the result (no wrapper), unless preserveRows=true\n * - **Group fields**: Maintains group structure with flattened children nested under the group key\n * - **Array fields**: Maintains array structure with flattened children nested under the array key\n * - **Other fields**: Pass through unchanged with guaranteed key generation\n *\n * Auto-generates keys for fields missing the key property to ensure form binding works correctly.\n *\n * @param fields - Array of field definitions that may contain nested structures\n * @param registry - Field type registry for determining value handling behavior\n * @param options - Configuration options for flattening behavior\n * @param options.preserveRows - When true, keep row fields in structure for DOM rendering (grid layout)\n * @returns Flattened array of field definitions with guaranteed keys\n *\n * @example\n * ```typescript\n * const hierarchicalFields = [\n * {\n * type: 'row',\n * fields: [\n * { type: 'input', key: 'firstName' },\n * { type: 'input', key: 'lastName' }\n * ]\n * },\n * {\n * type: 'group',\n * key: 'address',\n * fields: [\n * { type: 'input', key: 'street' },\n * { type: 'input', key: 'city' }\n * ]\n * }\n * ];\n *\n * const flattened = flattenFields(hierarchicalFields, registry);\n * // Result: [\n * // { type: 'input', key: 'firstName' },\n * // { type: 'input', key: 'lastName' },\n * // { type: 'group', key: 'address', fields: [...] }\n * // ]\n * ```\n *\n * @example\n * ```typescript\n * // Auto-key generation for fields without keys\n * const fieldsWithoutKeys = [\n * { type: 'input', label: 'Name' },\n * { type: 'button', label: 'Submit' }\n * ];\n *\n * const flattened = flattenFields(fieldsWithoutKeys, registry);\n * // Result: [\n * // { type: 'input', label: 'Name', key: 'auto_field_0' },\n * // { type: 'button', label: 'Submit', key: 'auto_field_1' }\n * // ]\n * ```\n *\n * @public\n */\nexport function flattenFields(\n fields: FieldDef<unknown>[],\n registry: Map<string, FieldTypeDefinition>,\n options: { preserveRows?: boolean } = {},\n): FlattenedField[] {\n const result: FlattenedField[] = [];\n let autoKeyCounter = 0;\n\n // Process each field using appropriate strategy based on field type and configuration\n for (const field of fields) {\n // Step 1: Determine how this field type should handle its value in the form\n // valueHandling can be: 'include', 'exclude', or 'flatten'\n const valueHandling = getFieldValueHandling(field.type, registry);\n\n // Step 2: Check if this is a row field that should be preserved for DOM rendering\n // Row fields need to render their container element for grid layouts to work\n if (options.preserveRows && isRowField(field)) {\n if (field.fields) {\n // Normalize field children to array format (handles both array and object syntax)\n const fieldsArray = Array.isArray(field.fields) ? field.fields : Object.values(field.fields);\n\n // Recursively flatten children while preserving row structure\n const flattenedChildren = flattenFields(fieldsArray as FieldDef<unknown>[], registry, options);\n\n // Keep the row field in the result with its flattened children\n // This allows the row component to render its container while children are flattened\n result.push({\n ...field,\n fields: flattenedChildren,\n key: field.key || `auto_row_${autoKeyCounter++}`,\n } as FlattenedField);\n }\n } else if (valueHandling === 'flatten' && 'fields' in field) {\n // Step 3: Handle fields with 'flatten' value handling (typically page/row fields)\n // These fields are pure containers - merge their children directly into the parent level\n if (field.fields) {\n const fieldsArray = Array.isArray(field.fields) ? field.fields : Object.values(field.fields);\n const flattenedChildren = flattenFields(fieldsArray as FieldDef<unknown>[], registry, options);\n\n // Spread children directly into result - the container field itself is discarded\n // This is used for page fields (form structure) and row fields (form values)\n result.push(...flattenedChildren);\n }\n } else if (isGroupField(field)) {\n // Step 4: Handle group fields - preserve structure for nested form values\n // Group fields create a nested object in the form value: { groupKey: { field1: value1, ... } }\n const childFieldsArray = Object.values(field.fields) as FieldDef<unknown>[];\n const flattenedChildren = flattenFields(childFieldsArray, registry, options);\n\n // Keep the group field with its recursively flattened children nested under its key\n result.push({\n ...field,\n fields: flattenedChildren,\n key: field.key || `auto_group_${autoKeyCounter++}`,\n } as FlattenedField);\n } else if (isArrayField(field)) {\n // Step 5: Handle array fields - preserve structure for array form values\n // Array fields create an array in the form value: { arrayKey: [item1, item2, ...] }\n const childFieldsArray = Object.values(field.fields) as FieldDef<unknown>[];\n const flattenedChildren = flattenFields(childFieldsArray, registry, options);\n\n // Keep the array field with its template definition nested under its key\n result.push({\n ...field,\n fields: flattenedChildren,\n key: field.key || `auto_array_${autoKeyCounter++}`,\n } as FlattenedField);\n } else {\n // Step 6: Handle all other fields (inputs, buttons, etc.) - pass through unchanged\n // These fields are leaf nodes that don't contain children and map directly to form controls\n const key = field.key || `auto_field_${autoKeyCounter++}`;\n result.push({\n ...field,\n key,\n } as FlattenedField);\n }\n }\n\n return result;\n}\n","import { FieldDef } from '../../definitions/base/field-def';\nimport { FieldWithValidation } from '../../definitions/base/field-with-validation';\nimport { LogicConfig } from '../../models/logic/logic-config';\nimport { ValidatorConfig, CustomValidatorConfig, BuiltInValidatorConfig } from '../../models/validation/validator-config';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { SchemaApplicationConfig } from '../../models/schemas/schema-definition';\nimport { hasChildFields } from '../../models/types/type-guards';\nimport {\n isCrossFieldExpression,\n isCrossFieldValidator,\n isCrossFieldBuiltInValidator,\n hasCrossFieldWhenCondition,\n isCrossFieldLogic,\n isCrossFieldSchema,\n extractExpressionDependencies,\n extractStringDependencies,\n} from './cross-field-detector';\nimport { CrossFieldValidatorEntry, CrossFieldLogicEntry, CrossFieldSchemaEntry, LogicType } from './cross-field-types';\n\n/** Collected cross-field entries from traversing field definitions. */\nexport interface CrossFieldCollection {\n validators: CrossFieldValidatorEntry[];\n logic: CrossFieldLogicEntry[];\n schemas: CrossFieldSchemaEntry[];\n}\n\n/** Creates an empty cross-field collection. */\nexport function createEmptyCollection(): CrossFieldCollection {\n return {\n validators: [],\n logic: [],\n schemas: [],\n };\n}\n\n/** Traverses field definitions and collects cross-field entries (validators, logic, schemas). */\nexport function collectCrossFieldEntries(fields: FieldDef<unknown>[]): CrossFieldCollection {\n const collection = createEmptyCollection();\n traverseFields(fields, collection);\n return collection;\n}\n\nfunction traverseFields(fields: FieldDef<unknown>[], collection: CrossFieldCollection): void {\n for (const field of fields) {\n collectFromField(field, collection);\n\n // Recursively process container fields (page, row, group, array)\n if (hasChildFields(field)) {\n const childFields = Array.isArray(field.fields) ? field.fields : Object.values(field.fields);\n traverseFields(childFields as FieldDef<unknown>[], collection);\n }\n }\n}\n\nfunction collectFromField(field: FieldDef<unknown>, collection: CrossFieldCollection): void {\n const fieldKey = field.key;\n if (!fieldKey) return;\n\n const validationField = field as FieldDef<unknown> & FieldWithValidation;\n\n // Collect cross-field validators\n if (validationField.validators) {\n for (const config of validationField.validators) {\n const entry = tryCreateValidatorEntry(fieldKey, config);\n if (entry) {\n collection.validators.push(entry);\n }\n }\n }\n\n // Collect cross-field logic\n if (validationField.logic) {\n for (const config of validationField.logic) {\n const entry = tryCreateLogicEntry(fieldKey, config);\n if (entry) {\n collection.logic.push(entry);\n }\n }\n }\n\n // Collect cross-field schemas\n if (validationField.schemas) {\n for (const config of validationField.schemas) {\n const entry = tryCreateSchemaEntry(fieldKey, config);\n if (entry) {\n collection.schemas.push(entry);\n }\n }\n }\n}\n\n/** Returns a validator entry if cross-field, null otherwise. */\nfunction tryCreateValidatorEntry(fieldKey: string, config: ValidatorConfig): CrossFieldValidatorEntry | null {\n // Check for custom validators with cross-field expressions\n if (config.type === 'custom') {\n const customConfig = config as CustomValidatorConfig;\n if (isCrossFieldValidator(customConfig)) {\n return {\n sourceFieldKey: fieldKey,\n config,\n dependsOn: extractStringDependencies(customConfig.expression || ''),\n category: 'validator',\n };\n }\n }\n\n // Check for built-in validators with cross-field dynamic expressions\n if (isCrossFieldBuiltInValidator(config)) {\n const builtInConfig = config as BuiltInValidatorConfig;\n return {\n sourceFieldKey: fieldKey,\n config: convertBuiltInToCustomValidator(builtInConfig),\n validatorType: config.type,\n dependsOn: extractStringDependencies(builtInConfig.expression || ''),\n category: 'validator',\n };\n }\n\n // Check for validators with cross-field when conditions\n if (hasCrossFieldWhenCondition(config)) {\n const whenCondition = config.when as ConditionalExpression;\n return {\n sourceFieldKey: fieldKey,\n config,\n validatorType: config.type,\n dependsOn: extractExpressionDependencies(whenCondition),\n category: 'validator',\n };\n }\n\n return null;\n}\n\n/** Returns a logic entry if cross-field, null otherwise. */\nfunction tryCreateLogicEntry(fieldKey: string, config: LogicConfig): CrossFieldLogicEntry | null {\n if (!isCrossFieldLogic(config)) {\n return null;\n }\n\n const condition = config.condition as ConditionalExpression;\n return {\n sourceFieldKey: fieldKey,\n logicType: config.type as LogicType,\n condition,\n config,\n dependsOn: extractExpressionDependencies(condition),\n category: 'logic',\n };\n}\n\n/** Returns a schema entry if cross-field, null otherwise. */\nfunction tryCreateSchemaEntry(fieldKey: string, config: SchemaApplicationConfig): CrossFieldSchemaEntry | null {\n if (!isCrossFieldSchema(config)) {\n return null;\n }\n\n const condition = config.condition as ConditionalExpression;\n return {\n sourceFieldKey: fieldKey,\n config,\n condition,\n dependsOn: extractExpressionDependencies(condition),\n category: 'schema',\n };\n}\n\n/** Converts a built-in validator with cross-field expression to a custom validator. */\nfunction convertBuiltInToCustomValidator(config: BuiltInValidatorConfig): CustomValidatorConfig {\n const expression = config.expression!;\n let validationExpression: string;\n\n switch (config.type) {\n case 'min':\n validationExpression = `fieldValue == null || fieldValue >= (${expression})`;\n break;\n case 'max':\n validationExpression = `fieldValue == null || fieldValue <= (${expression})`;\n break;\n case 'minLength':\n validationExpression = `fieldValue == null || (typeof fieldValue !== 'string' && !Array.isArray(fieldValue)) || fieldValue.length >= (${expression})`;\n break;\n case 'maxLength':\n validationExpression = `fieldValue == null || (typeof fieldValue !== 'string' && !Array.isArray(fieldValue)) || fieldValue.length <= (${expression})`;\n break;\n case 'pattern':\n validationExpression = `fieldValue == null || new RegExp(${expression}).test(fieldValue)`;\n break;\n default:\n throw new Error(`Cannot convert ${config.type} validator to custom validator`);\n }\n\n return {\n type: 'custom',\n expression: validationExpression,\n kind: config.type,\n when: config.when,\n errorParams: {\n [config.type]: expression,\n },\n };\n}\n","import { detectFormMode, FormModeDetectionResult, isPageField } from '../../models/types/form-mode';\nimport { RegisteredFieldTypes } from '../../models/registry';\nimport { validatePageNesting } from '../../definitions/default/page-field';\n\n/**\n * Comprehensive form configuration validator that checks:\n * 1. Form mode consistency (paged vs non-paged)\n * 2. Page nesting rules\n * 3. Field placement constraints\n */\nexport class FormModeValidator {\n /**\n * Validates a form configuration and returns detailed validation results\n * @param fields The form field definitions to validate\n * @returns Validation result with mode detection and error details\n */\n static validateFormConfiguration<TFields extends RegisteredFieldTypes[]>(fields: TFields): FormConfigurationValidationResult {\n const modeDetection = detectFormMode(fields);\n const additionalErrors: string[] = [];\n\n // Additional validation for paged forms\n if (modeDetection.mode === 'paged' && modeDetection.isValid) {\n // Validate each page field individually\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i];\n if (isPageField(field)) {\n if (!validatePageNesting(field)) {\n additionalErrors.push(\n `Page field at index ${i} (key: \"${field.key || 'unknown'}\") contains nested page fields, which is not allowed.`,\n );\n }\n }\n }\n }\n\n const allErrors = [...modeDetection.errors, ...additionalErrors];\n const isFullyValid = modeDetection.isValid && additionalErrors.length === 0;\n\n return {\n mode: modeDetection.mode,\n isValid: isFullyValid,\n errors: allErrors,\n warnings: this.generateWarnings(fields, modeDetection),\n };\n }\n\n /**\n * Validates form configuration and throws an error if invalid\n * @param fields The form field definitions to validate\n * @throws Error with detailed validation messages if form is invalid\n */\n static validateFormConfigurationOrThrow<TFields extends RegisteredFieldTypes[]>(fields: TFields): void {\n const result = this.validateFormConfiguration(fields);\n\n if (!result.isValid) {\n const errorMessage = [\n `[Dynamic Forms] Invalid form configuration (${result.mode} mode):`,\n ...result.errors.map((error) => ` - ${error}`),\n ].join('\\n');\n\n throw new Error(errorMessage);\n }\n }\n\n /**\n * Generates helpful warnings for form configurations\n * @param fields The form field definitions\n * @param modeDetection The mode detection result\n * @returns Array of warning messages\n */\n private static generateWarnings<TFields extends RegisteredFieldTypes[]>(\n fields: TFields,\n modeDetection: FormModeDetectionResult,\n ): string[] {\n const warnings: string[] = [];\n\n // Warn about single page forms\n if (modeDetection.mode === 'paged' && fields.length === 1) {\n warnings.push('Single page form detected. Consider using non-paged mode for better performance if page navigation is not needed.');\n }\n\n // Warn about empty pages\n if (modeDetection.mode === 'paged') {\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i];\n if (isPageField(field)) {\n if (!field.fields || field.fields.length === 0) {\n warnings.push(`Page field at index ${i} (key: \"${field.key || 'unknown'}\") contains no fields and will render as empty.`);\n }\n }\n }\n }\n\n return warnings;\n }\n}\n\n/**\n * Extended validation result including warnings\n */\nexport interface FormConfigurationValidationResult extends FormModeDetectionResult {\n /** Array of warning messages that don't prevent form operation */\n warnings: string[];\n}\n\n/**\n * Convenience function for quick form mode validation\n * @param fields The form field definitions to validate\n * @returns True if form configuration is valid, false otherwise\n */\nexport function isValidFormConfiguration<TFields extends RegisteredFieldTypes[]>(fields: TFields): boolean {\n return FormModeValidator.validateFormConfiguration(fields).isValid;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class NextPageEvent implements FormEvent {\n readonly type = 'next-page' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class PageChangeEvent implements FormEvent {\n readonly type = 'page-change' as const;\n\n constructor(\n /** The current page index (0-based) */\n public readonly currentPageIndex: number,\n /** Total number of pages */\n public readonly totalPages: number,\n /** Previous page index (0-based), undefined if first navigation */\n public readonly previousPageIndex?: number,\n ) {}\n}\n","import { FormEvent } from '../interfaces/form-event';\n\nexport class PreviousPageEvent implements FormEvent {\n readonly type = 'previous-page' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\nimport { ArrayAllowedChildren } from '../../models/types/nesting-constraints';\n\n/**\n * Event dispatched to add a new item to an array field.\n *\n * This event is used to dynamically add items to array fields at runtime.\n * The array field component listens for this event and adds a new item\n * based on the provided field template, or uses the array's own template if not provided.\n *\n * @example\n * ```typescript\n * // Add item using array's own template\n * eventBus.dispatch(AddArrayItemEvent, 'contacts');\n *\n * // Add item with explicit field template\n * const fieldTemplate = { key: 'email', type: 'input' };\n * eventBus.dispatch(AddArrayItemEvent, 'contacts', fieldTemplate);\n *\n * // Add item at specific index\n * eventBus.dispatch(AddArrayItemEvent, 'contacts', fieldTemplate, 2);\n * ```\n */\nexport class AddArrayItemEvent implements FormEvent {\n readonly type = 'add-array-item' as const;\n\n constructor(\n /** The key of the array field to add an item to */\n public readonly arrayKey: string,\n /**\n * Optional field template definition to render for the new array item.\n * If not provided, the array field component will use its own template.\n */\n public readonly field?: ArrayAllowedChildren,\n /** Optional index where to insert the item (defaults to end of array) */\n public readonly index?: number,\n ) {}\n}\n","import { FormEvent } from '../interfaces/form-event';\n\n/**\n * Event dispatched to remove an item from an array field.\n *\n * This event is used to dynamically remove items from array fields at runtime.\n * The array field component listens for this event and removes the item\n * at the specified index.\n *\n * @example\n * ```typescript\n * // Remove item at index 1 from 'contacts' array\n * eventBus.dispatch(RemoveArrayItemEvent, 'contacts', 1);\n *\n * // Remove last item\n * eventBus.dispatch(RemoveArrayItemEvent, 'contacts');\n * ```\n */\nexport class RemoveArrayItemEvent implements FormEvent {\n readonly type = 'remove-array-item' as const;\n\n constructor(\n /** The key of the array field to remove an item from */\n public readonly arrayKey: string,\n /** Index of the item to remove (defaults to last item) */\n public readonly index?: number,\n ) {}\n}\n","import { FormEvent } from '../interfaces/form-event';\n\n/**\n * Event dispatched when the form should be reset to its default values.\n *\n * This event instructs the dynamic form component to restore all field values\n * to their initial default values as defined in the form configuration.\n *\n * @example\n * ```typescript\n * // Dispatch from a button component\n * eventBus.dispatch(FormResetEvent);\n * ```\n *\n * @example\n * ```typescript\n * // Listen for reset events\n * eventBus.on<FormResetEvent>('form-reset').subscribe(() => {\n * console.log('Form was reset to defaults');\n * });\n * ```\n */\nexport class FormResetEvent implements FormEvent {\n readonly type = 'form-reset' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\n\n/**\n * Event dispatched when the form should be cleared.\n *\n * This event instructs the dynamic form component to clear all field values,\n * resetting them to empty/undefined state regardless of their default values.\n *\n * @example\n * ```typescript\n * // Dispatch from a button component\n * eventBus.dispatch(FormClearEvent);\n * ```\n *\n * @example\n * ```typescript\n * // Listen for clear events\n * eventBus.on<FormClearEvent>('form-clear').subscribe(() => {\n * console.log('Form was cleared');\n * });\n * ```\n */\nexport class FormClearEvent implements FormEvent {\n readonly type = 'form-clear' as const;\n}\n","import { FormEvent } from '../interfaces/form-event';\nimport { PageOrchestratorState } from '../../core/page-orchestrator/page-orchestrator.interfaces';\n\nexport class PageNavigationStateChangeEvent implements FormEvent {\n type = 'page-navigation-state-change' as const;\n\n constructor(public state: PageOrchestratorState) {}\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { EventBus } from '../../events/event.bus';\nimport { NextPageEvent, PageChangeEvent, PreviousPageEvent } from '../../events/constants';\nimport { NavigationResult, PageOrchestratorState } from './page-orchestrator.interfaces';\nimport { PageField, PageLogicConfig } from '../../definitions/default/page-field';\nimport { FieldSignalContext } from '../../mappers/types';\nimport PageFieldComponent from '../../fields/page/page-field.component';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { PageNavigationStateChangeEvent } from '../../events/constants/page-navigation-state-change.event';\nimport { FieldTree } from '@angular/forms/signals';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { RootFormRegistryService } from '../registry/root-form-registry.service';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\nimport { evaluateCondition } from '../expressions/condition-evaluator';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { FunctionRegistryService } from '../registry/function-registry.service';\n\n/**\n * PageOrchestrator manages page navigation and visibility for paged forms.\n * It acts as an intermediary between the DynamicForm component and PageField components,\n * handling page state management and navigation events without interfering with form data.\n *\n * This component uses declarative rendering with @defer blocks for optimal performance,\n * ensuring that non-visible pages are lazily loaded only when needed.\n *\n * Key responsibilities:\n * - Manage current page index state\n * - Handle navigation events (next/previous)\n * - Declaratively render pages with deferred loading\n * - Emit page change events\n * - Validate navigation boundaries\n *\n * @example\n * ```html\n * <div page-orchestrator\n * [pageFields]=\"pageFields\"\n * [form]=\"form\"\n * [fieldSignalContext]=\"fieldSignalContext\"\n * [config]=\"orchestratorConfig\"\n * (pageChanged)=\"onPageChanged($event)\"\n * (navigationStateChanged)=\"onNavigationStateChanged($event)\">\n * </div>\n * ```\n */\n@Component({\n selector: 'div[page-orchestrator]',\n imports: [PageFieldComponent],\n template: `\n @for (pageField of pageFields(); track pageField.key; let i = $index) {\n @if (i === state().currentPageIndex || i === state().currentPageIndex + 1 || i === state().currentPageIndex - 1) {\n <!-- Current and adjacent pages (±1): render immediately for flicker-free navigation -->\n @defer (on immediate) {\n <section\n page-field\n [field]=\"pageField\"\n [key]=\"pageField.key\"\n [pageIndex]=\"i\"\n [isVisible]=\"i === state().currentPageIndex\"\n ></section>\n } @placeholder {\n <div class=\"df-page-placeholder\" [attr.data-page-index]=\"i\" [attr.data-page-key]=\"pageField.key\"></div>\n }\n } @else {\n <!-- Distant pages: defer until browser is idle for memory savings -->\n @defer (on idle) {\n <section page-field [field]=\"pageField\" [key]=\"pageField.key\" [pageIndex]=\"i\" [isVisible]=\"false\"></section>\n } @placeholder {\n <div class=\"df-page-placeholder\" [attr.data-page-index]=\"i\" [attr.data-page-key]=\"pageField.key\"></div>\n }\n }\n }\n `,\n styleUrl: './page-orchestrator.component.scss',\n host: {\n class: 'df-page-orchestrator',\n '[attr.data-current-page]': 'state().currentPageIndex',\n '[attr.data-total-pages]': 'state().totalPages',\n },\n providers: [\n {\n provide: FIELD_SIGNAL_CONTEXT,\n useFactory: (orchestrator: PageOrchestratorComponent) => orchestrator.extendedFieldSignalContext(),\n deps: [PageOrchestratorComponent],\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PageOrchestratorComponent {\n private readonly eventBus = inject(EventBus);\n private readonly rootFormRegistry = inject(RootFormRegistryService);\n private readonly functionRegistry = inject(FunctionRegistryService);\n\n /**\n * Array of page field definitions to render\n */\n pageFields = input.required<PageField[]>();\n\n /**\n * Root form instance from parent DynamicForm\n */\n form = input.required<FieldTree<any>>();\n\n /**\n * Field signal context for child fields\n */\n fieldSignalContext = input.required<FieldSignalContext>();\n\n /**\n * Computed signal that tracks which pages are hidden.\n * Returns an array of booleans where true means the page is hidden.\n * This signal is reactive and will re-evaluate when form values change.\n */\n readonly pageHiddenStates = computed(() => {\n const pages = this.pageFields();\n const formValue = this.rootFormRegistry.getFormValue();\n\n return pages.map((page) => this.evaluatePageHidden(page, formValue));\n });\n\n /**\n * Computed signal that returns indices of visible (non-hidden) pages.\n * This is used for navigation to skip hidden pages.\n */\n readonly visiblePageIndices = computed(() => {\n const hiddenStates = this.pageHiddenStates();\n return hiddenStates\n .map((hidden, index) => ({ index, hidden }))\n .filter((item) => !item.hidden)\n .map((item) => item.index);\n });\n\n /**\n * Internal signal for current page index that tracks with page fields.\n * This tracks the actual page index, not the visible page index.\n *\n * Note: We only track pageFields().length to handle page additions/removals.\n * The hidden state changes should NOT reset the current page index -\n * that would cause unwanted navigation when form values change.\n */\n private readonly currentPageIndex = linkedSignal(() => {\n const totalPages = this.pageFields().length;\n\n if (totalPages === 0) return 0;\n\n // Start on page 0 (will be adjusted if page 0 is hidden by initial navigation)\n return 0;\n });\n\n /**\n * Computed state for the orchestrator\n */\n readonly state = computed<PageOrchestratorState>(() => {\n const currentIndex = this.currentPageIndex();\n const totalPages = this.pageFields().length;\n const visibleIndices = this.visiblePageIndices();\n\n // Find where the current index is in the visible pages list\n const currentVisiblePosition = visibleIndices.indexOf(currentIndex);\n const isFirstVisiblePage = currentVisiblePosition === 0 || currentVisiblePosition === -1;\n const isLastVisiblePage = currentVisiblePosition >= visibleIndices.length - 1;\n\n return {\n currentPageIndex: currentIndex,\n totalPages,\n isFirstPage: isFirstVisiblePage,\n isLastPage: isLastVisiblePage,\n navigationDisabled: false,\n };\n });\n\n /**\n * Signal indicating whether all fields on the current page are valid.\n *\n * This is used by next page buttons to determine their disabled state.\n * Returns `true` if all fields on the current page pass validation,\n * `false` otherwise.\n *\n * @returns `true` if current page is valid, `false` otherwise\n */\n readonly currentPageValid = computed(() => {\n const currentIndex = this.currentPageIndex();\n const pages = this.pageFields();\n const form = this.form();\n\n // No pages or invalid index\n if (pages.length === 0 || currentIndex >= pages.length) {\n return true;\n }\n\n const currentPage = pages[currentIndex];\n const pageFields = currentPage.fields || [];\n\n // Check validity of each field on the current page\n // Fields are stored at root level in the form (pages don't add nesting)\n for (const fieldDef of pageFields) {\n const fieldKey = fieldDef.key;\n if (!fieldKey) continue;\n\n // Access the field from the form using dynamic key access\n const field = (form as Record<string, unknown>)[fieldKey];\n if (field && typeof field === 'function') {\n const fieldState = (field as () => { valid: () => boolean })();\n if (fieldState && typeof fieldState.valid === 'function' && !fieldState.valid()) {\n return false;\n }\n }\n }\n\n return true;\n });\n\n /**\n * Extended field signal context that includes currentPageValid.\n *\n * This extends the parent context from DynamicForm with page-specific\n * information needed by button mappers (e.g., next button needs to know\n * if the current page is valid).\n */\n readonly extendedFieldSignalContext = computed(() => ({\n ...this.fieldSignalContext(),\n currentPageValid: this.currentPageValid,\n }));\n\n constructor() {\n // Setup event listeners for navigation\n this.setupEventListeners();\n }\n\n /**\n * Navigate to the next visible page, skipping hidden pages.\n * @returns Navigation result\n */\n navigateToNextPage(): NavigationResult {\n const currentState = this.state();\n const visibleIndices = this.visiblePageIndices();\n\n if (currentState.isLastPage) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Already on the last visible page',\n };\n }\n\n if (currentState.navigationDisabled) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Navigation is currently disabled',\n };\n }\n\n // Find the next visible page after the current index\n const currentVisiblePosition = visibleIndices.indexOf(currentState.currentPageIndex);\n if (currentVisiblePosition === -1 || currentVisiblePosition >= visibleIndices.length - 1) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'No next visible page available',\n };\n }\n\n const nextVisiblePageIndex = visibleIndices[currentVisiblePosition + 1];\n return this.navigateToPage(nextVisiblePageIndex);\n }\n\n /**\n * Navigate to the previous visible page, skipping hidden pages.\n * @returns Navigation result\n */\n navigateToPreviousPage(): NavigationResult {\n const currentState = this.state();\n const visibleIndices = this.visiblePageIndices();\n\n if (currentState.isFirstPage) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Already on the first visible page',\n };\n }\n\n if (currentState.navigationDisabled) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'Navigation is currently disabled',\n };\n }\n\n // Find the previous visible page before the current index\n const currentVisiblePosition = visibleIndices.indexOf(currentState.currentPageIndex);\n if (currentVisiblePosition <= 0) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: 'No previous visible page available',\n };\n }\n\n const prevVisiblePageIndex = visibleIndices[currentVisiblePosition - 1];\n return this.navigateToPage(prevVisiblePageIndex);\n }\n\n /**\n * Navigate to a specific page index\n * @param pageIndex The target page index (0-based)\n * @returns Navigation result\n */\n navigateToPage(pageIndex: number): NavigationResult {\n const currentState = this.state();\n const totalPages = currentState.totalPages;\n\n // Validate page index\n if (pageIndex < 0 || pageIndex >= totalPages) {\n return {\n success: false,\n newPageIndex: currentState.currentPageIndex,\n error: `Invalid page index: ${pageIndex}. Valid range is 0 to ${totalPages - 1}`,\n };\n }\n\n // Check if already on target page\n if (pageIndex === currentState.currentPageIndex) {\n return {\n success: true,\n newPageIndex: pageIndex,\n };\n }\n\n // Perform navigation\n const previousIndex = currentState.currentPageIndex;\n this.currentPageIndex.set(pageIndex);\n\n // Emit page change event\n this.eventBus.dispatch(PageChangeEvent, pageIndex, totalPages, previousIndex);\n\n return {\n success: true,\n newPageIndex: pageIndex,\n };\n }\n\n /**\n * Set up event listeners for navigation events\n */\n private setupEventListeners(): void {\n // Listen for next page events\n this.eventBus\n .on<NextPageEvent>('next-page')\n .pipe(takeUntilDestroyed())\n .subscribe(() => {\n this.navigateToNextPage();\n });\n\n // Listen for previous page events\n this.eventBus\n .on<PreviousPageEvent>('previous-page')\n .pipe(takeUntilDestroyed())\n .subscribe(() => {\n this.navigateToPreviousPage();\n });\n\n explicitEffect([this.state], ([state]) => this.eventBus.dispatch(PageNavigationStateChangeEvent, state));\n }\n\n /**\n * Evaluates whether a page should be hidden based on its logic configuration.\n * A page is hidden if ANY of its hidden logic conditions evaluate to true.\n *\n * @param page The page field to evaluate\n * @param formValue The current form value to evaluate against\n * @returns true if the page should be hidden, false otherwise\n */\n private evaluatePageHidden(page: PageField, formValue: unknown): boolean {\n // If no logic defined, page is visible\n if (!page.logic || page.logic.length === 0) {\n return false;\n }\n\n // Filter to only hidden logic (pages only support hidden type)\n const hiddenLogic = page.logic.filter((l): l is PageLogicConfig => l.type === 'hidden');\n\n // If no hidden logic, page is visible\n if (hiddenLogic.length === 0) {\n return false;\n }\n\n // Check each hidden logic - if ANY condition is true, the page is hidden\n for (const logic of hiddenLogic) {\n // Handle static boolean conditions\n if (typeof logic.condition === 'boolean') {\n if (logic.condition) {\n return true;\n }\n continue;\n }\n\n // Evaluate conditional expression\n const condition = logic.condition as ConditionalExpression;\n const context: EvaluationContext = {\n fieldValue: null, // Pages don't have field values\n formValue: (formValue ?? {}) as Record<string, unknown>,\n fieldPath: page.key || '',\n customFunctions: this.functionRegistry.getCustomFunctions(),\n };\n\n if (evaluateCondition(condition, context)) {\n return true;\n }\n }\n\n return false;\n }\n}\n","import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n inject,\n Injector,\n input,\n InputSignal,\n linkedSignal,\n model,\n OnDestroy,\n runInInjectionContext,\n signal,\n Signal,\n untracked,\n} from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { form } from '@angular/forms/signals';\nimport { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { EMPTY, forkJoin, map, of, pipe, scan, switchMap } from 'rxjs';\nimport { derivedFromDeferred } from './utils/derived-from-deferred/derived-from-deferred';\nimport { reconcileFields, ResolvedField, resolveField } from './utils/resolve-field/resolve-field';\nimport { createSubmissionHandler } from './utils/submission-handler/submission-handler';\nimport { keyBy, memoize, isEqual } from './utils/object-utils';\nimport { FIELD_SIGNAL_CONTEXT } from './models/field-signal-context.token';\nimport { FieldTypeDefinition } from './models/field-type';\nimport { FormConfig, FormOptions } from './models/form-config';\nimport { RegisteredFieldTypes } from './models/registry/field-registry';\nimport { injectFieldRegistry } from './utils/inject-field-registry/inject-field-registry';\nimport { createSchemaFromFields } from './core/schema-builder';\nimport { EventBus } from './events/event.bus';\nimport { SubmitEvent } from './events/constants/submit.event';\nimport { ComponentInitializedEvent } from './events/constants/component-initialized.event';\nimport { setupInitializationTracking } from './utils/initialization-tracker/initialization-tracker';\nimport { FormMode, InferFormValue, isContainerField } from './models/types';\nimport { flattenFields } from './utils/flattener/field-flattener';\nimport { FieldDef } from './definitions/base/field-def';\nimport { isPageField, PageField } from './definitions/default/page-field';\nimport { getFieldDefaultValue } from './utils/default-value/default-value';\nimport { FieldSignalContext } from './mappers/types';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { FieldContextRegistryService, FunctionRegistryService, RootFormRegistryService, SchemaRegistryService } from './core/registry';\nimport { detectFormMode, FormModeDetectionResult } from './models/types/form-mode';\nimport { collectCrossFieldEntries } from './core/cross-field/cross-field-collector';\nimport { FormModeValidator } from './utils/form-validation/form-mode-validator';\nimport { PageOrchestratorComponent } from './core/page-orchestrator';\nimport { FormClearEvent } from './events/constants/form-clear.event';\nimport { FormResetEvent } from './events/constants/form-reset.event';\nimport { PageChangeEvent } from './events/constants/page-change.event';\nimport { PageNavigationStateChangeEvent } from './events/constants/page-navigation-state-change.event';\n\n/**\n * Dynamic form component that renders a complete form based on configuration.\n *\n * This is the main entry point for the dynamic form system. It handles form state management,\n * validation, field rendering, and event coordination using Angular's signal-based reactive forms.\n *\n * @typeParam TFields - Array of registered field types available for this form\n * @typeParam TModel - The strongly-typed interface for form values\n *\n * @example\n *```html\n * <form\n * [dynamic-form]=\"formConfig\"\n * [(value)]=\"formData\"\n * (submitted)=\"handleSubmit($event)\"\n * (validityChange)=\"handleValidityChange($event)\">\n * </form>\n * ```\n */\n@Component({\n selector: 'form[dynamic-form]',\n imports: [NgComponentOutlet, PageOrchestratorComponent],\n template: `\n @if (formModeDetection().mode === 'paged') {\n <div page-orchestrator [pageFields]=\"pageFieldDefinitions()\" [form]=\"$any(form())\" [fieldSignalContext]=\"fieldSignalContext()\"></div>\n } @else {\n @for (field of resolvedFields(); track field.key) {\n <ng-container *ngComponentOutlet=\"field.component; injector: field.injector; inputs: field.inputs()\" />\n }\n }\n `,\n styleUrl: './dynamic-form.component.scss',\n providers: [EventBus, SchemaRegistryService, FunctionRegistryService, RootFormRegistryService, FieldContextRegistryService],\n host: {\n class: 'df-dynamic-form df-form',\n '[class.disabled]': 'disabled()',\n '[class.df-form-paged]': 'formModeDetection().mode === \"paged\"',\n '[class.df-form-non-paged]': 'formModeDetection().mode === \"non-paged\"',\n '[attr.data-form-mode]': 'formModeDetection().mode',\n '(submit)': 'onNativeSubmit($event)',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[], TModel = InferFormValue<TFields>>\n implements OnDestroy\n{\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly injector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n private readonly rootFormRegistry = inject(RootFormRegistryService);\n private readonly functionRegistry = inject(FunctionRegistryService);\n private readonly schemaRegistry = inject(SchemaRegistryService);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Form configuration defining the structure, validation, and behavior. */\n config: InputSignal<FormConfig<TFields>> = input.required<FormConfig<TFields>>({ alias: 'dynamic-form' });\n\n /** Runtime form options that override config options when provided. */\n formOptions = input<FormOptions | undefined>(undefined);\n\n /** Form values for two-way data binding. */\n value = model<Partial<TModel> | undefined>(undefined);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Memoized Functions\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly memoizedFlattenFields = memoize(\n (fields: FieldDef<unknown>[], registry: Map<string, FieldTypeDefinition>) => flattenFields(fields, registry),\n (fields, registry) => {\n const fieldKeys = fields.map((f) => `${f.key || ''}:${f.type}`).join('|');\n const registryKeys = Array.from(registry.keys()).sort().join('|');\n return `${fieldKeys}__${registryKeys}`;\n },\n );\n\n private readonly memoizedFlattenFieldsForRendering = memoize(\n (fields: FieldDef<unknown>[], registry: Map<string, FieldTypeDefinition>) => flattenFields(fields, registry, { preserveRows: true }),\n (fields, registry) => {\n const fieldKeys = fields.map((f) => `${f.key || ''}:${f.type}`).join('|');\n const registryKeys = Array.from(registry.keys()).sort().join('|');\n return `render_${fieldKeys}__${registryKeys}`;\n },\n );\n\n private readonly memoizedKeyBy = memoize(\n <T extends { key: string }>(fields: T[]) => keyBy(fields, 'key'),\n (fields) => fields.map((f) => f.key).join('|'),\n );\n\n private readonly memoizedDefaultValues = memoize(\n <T extends FieldDef<unknown>>(fieldsById: Record<string, T>, registry: Map<string, FieldTypeDefinition>) => {\n const result: Record<string, unknown> = {};\n for (const [key, field] of Object.entries(fieldsById)) {\n const value = getFieldDefaultValue(field, registry);\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result as TModel;\n },\n (fieldsById, registry) => {\n const fieldKeys = Object.keys(fieldsById).sort().join('|');\n const registryKeys = Array.from(registry.keys()).sort().join('|');\n return `defaults_${fieldKeys}__${registryKeys}`;\n },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n readonly formModeDetection = computed<FormModeDetectionResult>(() => {\n const config = this.config();\n const fields = config.fields || [];\n const detection = detectFormMode(fields);\n const validation = FormModeValidator.validateFormConfiguration(fields);\n\n if (!validation.isValid) {\n console.error('[Dynamic Forms] Invalid form configuration:', validation.errors);\n }\n\n if (validation.warnings.length > 0) {\n console.warn('[Dynamic Forms] Form configuration warnings:', validation.warnings);\n }\n\n return detection;\n });\n\n private readonly formSetup = computed(() => {\n const config = this.config();\n const modeDetection = this.formModeDetection();\n const registry = this.rawFieldRegistry();\n\n this.registerValidatorsFromConfig(config);\n\n if (config.fields && config.fields.length > 0) {\n return this.createFormSetupFromConfig(config.fields, modeDetection.mode, registry);\n }\n\n return this.createEmptyFormSetup(registry);\n });\n\n readonly pageFieldDefinitions = computed(() => {\n const config = this.config();\n const mode = this.formModeDetection().mode;\n\n if (mode === 'paged' && config.fields) {\n return config.fields.filter(isPageField);\n }\n\n return [] as PageField[];\n });\n\n readonly effectiveFormOptions = computed(() => {\n const config = this.config();\n const configOptions = config.options || {};\n const inputOptions = this.formOptions();\n return { ...configOptions, ...inputOptions };\n });\n\n readonly fieldSignalContext = computed<FieldSignalContext<TModel>>(() => ({\n injector: this.injector,\n value: this.value,\n defaultValues: this.defaultValues,\n form: this.form(),\n defaultValidationMessages: this.config().defaultValidationMessages,\n formOptions: this.effectiveFormOptions(),\n }));\n\n private readonly fieldInjector = computed(() =>\n Injector.create({\n parent: this.injector,\n providers: [\n {\n provide: FIELD_SIGNAL_CONTEXT,\n useValue: this.fieldSignalContext(),\n },\n ],\n }),\n );\n\n readonly defaultValues = linkedSignal(() => this.formSetup().defaultValues);\n\n private readonly entity = linkedSignal(() => {\n const inputValue = this.value();\n const defaults = this.defaultValues();\n const setup = this.formSetup();\n\n const combined = { ...defaults, ...inputValue };\n\n if (setup.schemaFields && setup.schemaFields.length > 0) {\n const validKeys = new Set(setup.schemaFields.map((field) => field.key).filter((key: string | undefined) => key !== undefined));\n const filtered: Record<string, unknown> = {};\n for (const key of Object.keys(combined)) {\n if (validKeys.has(key)) {\n filtered[key] = (combined as Record<string, unknown>)[key];\n }\n }\n return filtered as TModel;\n }\n\n return combined as TModel;\n });\n\n readonly form = computed<ReturnType<typeof form<TModel>>>(() => {\n return runInInjectionContext(this.injector, () => {\n const setup = this.formSetup();\n let formInstance: ReturnType<typeof form<TModel>>;\n\n untracked(() => this.rootFormRegistry.registerFormValueSignal(this.entity as Signal<Record<string, unknown>>));\n\n if (setup.schemaFields && setup.schemaFields.length > 0) {\n const crossFieldCollection = collectCrossFieldEntries(setup.schemaFields as FieldDef<unknown>[]);\n const schema = createSchemaFromFields(setup.schemaFields, setup.registry, crossFieldCollection.validators);\n formInstance = untracked(() => form(this.entity, schema));\n } else {\n formInstance = untracked(() => form(this.entity));\n }\n\n untracked(() => this.rootFormRegistry.registerRootForm(formInstance));\n\n return formInstance;\n });\n });\n\n private readonly componentId = 'dynamic-form';\n\n private readonly totalComponentsCount = computed(() => {\n const fields = this.formSetup().fields;\n if (!fields) {\n return 1;\n }\n\n const registry = this.rawFieldRegistry();\n const flatFields = flattenFields(fields, registry);\n const componentCount = flatFields.filter(isContainerField).length;\n\n return componentCount + 1;\n });\n\n private readonly fieldsSource = computed(() => this.formSetup().fields);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public State Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Collects errors from async field component loading for error boundary patterns. */\n readonly fieldLoadingErrors = signal<Array<{ fieldType: string; fieldKey: string; error: Error }>>([]);\n\n /** Current form values (reactive). */\n readonly formValue = computed(() => this.form()().value());\n\n /** Whether the form is currently valid. */\n readonly valid = computed(() => this.form()().valid());\n\n /** Whether the form is currently invalid. */\n readonly invalid = computed(() => this.form()().invalid());\n\n /** Whether any form field has been modified. */\n readonly dirty = computed(() => this.form()().dirty());\n\n /** Whether any form field has been touched (blurred). */\n readonly touched = computed(() => this.form()().touched());\n\n /** Current validation errors from all fields. */\n readonly errors = computed(() => this.form()().errors());\n\n /** Whether the form is disabled (from options or form state). */\n readonly disabled = computed(() => {\n const optionsDisabled = this.effectiveFormOptions().disabled;\n const formDisabled = this.form()().disabled();\n return optionsDisabled ?? formDisabled;\n });\n\n /** Whether the form is currently submitting. */\n readonly submitting = computed(() => this.form()().submitting());\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Initialization\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly initialized$ = setupInitializationTracking({\n eventBus: this.eventBus,\n totalComponentsCount: this.totalComponentsCount,\n injector: this.injector,\n componentId: this.componentId,\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Outputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Emits when form validity changes. */\n readonly validityChange = outputFromObservable(toObservable(this.valid));\n\n /** Emits when form dirty state changes. */\n readonly dirtyChange = outputFromObservable(toObservable(this.dirty));\n\n /**\n * Emits form values when submitted (via SubmitEvent).\n * Note: Does not emit when `submission.action` is configured - use one or the other.\n */\n readonly submitted = outputFromObservable(\n this.eventBus.on<SubmitEvent>('submit').pipe(\n switchMap(() => {\n const submissionConfig = this.config().submission;\n\n if (submissionConfig?.action) {\n console.warn(\n '[Dynamic Forms] Both `submission.action` and `(submitted)` output are configured. ' +\n 'When using `submission.action`, the `(submitted)` output will not emit. ' +\n 'Use either `submission.action` OR `(submitted)`, not both.',\n );\n return EMPTY;\n }\n\n return of(this.value());\n }),\n ),\n );\n\n /** Emits when form is reset to default values. */\n readonly reset = outputFromObservable(this.eventBus.on<FormResetEvent>('form-reset'));\n\n /** Emits when form is cleared to empty state. */\n readonly cleared = outputFromObservable(this.eventBus.on<FormClearEvent>('form-clear'));\n\n /** Emits all form events for custom event handling. */\n readonly events = outputFromObservable(this.eventBus.events$);\n\n /**\n * Emits when all form components are initialized and ready for interaction.\n * Useful for E2E testing to ensure the form is fully rendered before interaction.\n */\n readonly initialized = outputFromObservable(this.initialized$);\n\n /** Emits when the current page changes in paged forms. */\n readonly onPageChange = outputFromObservable(this.eventBus.on<PageChangeEvent>('page-change'));\n\n /** Emits when page navigation state changes (canGoNext, canGoPrevious, etc.). */\n readonly onPageNavigationStateChange = outputFromObservable(\n this.eventBus.on<PageNavigationStateChangeEvent>('page-navigation-state-change'),\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Field Resolution\n // ─────────────────────────────────────────────────────────────────────────────\n\n protected readonly resolvedFields = derivedFromDeferred(\n this.fieldsSource,\n pipe(\n switchMap((fields) => {\n if (!fields || fields.length === 0) {\n return of([] as (ResolvedField | undefined)[]);\n }\n const context = {\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n registry: this.rawFieldRegistry(),\n injector: this.fieldInjector(),\n destroyRef: this.destroyRef,\n onError: (fieldDef: FieldDef<unknown>, error: unknown) => {\n const fieldKey = fieldDef.key || '<no key>';\n this.fieldLoadingErrors.update((errors) => [\n ...errors,\n {\n fieldType: fieldDef.type,\n fieldKey,\n error: error instanceof Error ? error : new Error(String(error)),\n },\n ]);\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${fieldDef.type}' (key: ${fieldKey}). ` +\n `Ensure the field type is registered in your field registry.`,\n error,\n );\n },\n };\n return forkJoin(fields.map((f) => resolveField(f, context)));\n }),\n map((fields) => fields.filter((f): f is ResolvedField => f !== undefined)),\n scan(reconcileFields, [] as ResolvedField[]),\n ),\n { initialValue: [] as ResolvedField[], injector: this.injector },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Constructor\n // ─────────────────────────────────────────────────────────────────────────────\n\n constructor() {\n this.setupEffects();\n this.setupEventHandlers();\n }\n\n /**\n * Handles native form submission triggered by:\n * - Pressing Enter in an input field\n * - Clicking a button with type=\"submit\"\n * - Programmatic form.submit() calls\n *\n * This method prevents the default form submission behavior (page reload)\n * and dispatches a SubmitEvent through the EventBus for processing.\n *\n * @param event - The native submit event from the form element\n */\n protected onNativeSubmit(event: Event): void {\n event.preventDefault();\n this.eventBus.dispatch(SubmitEvent);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Private Methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n private setupEffects(): void {\n // Sync entity changes to the value signal\n explicitEffect([this.entity], ([currentEntity]) => {\n const currentValue = this.value();\n if (!isEqual(currentEntity, currentValue)) {\n this.value.set(currentEntity);\n }\n });\n\n // Clear loading errors when config changes\n explicitEffect([this.config], () => {\n this.fieldLoadingErrors.set([]);\n });\n\n // Emit initialization event for paged forms\n explicitEffect([this.formModeDetection, this.pageFieldDefinitions], ([{ mode }, pages]) => {\n if (mode === 'paged' && pages.length > 0) {\n this.eventBus.dispatch(ComponentInitializedEvent, 'dynamic-form', this.componentId);\n }\n });\n\n // Emit initialization event for non-paged forms\n explicitEffect([this.resolvedFields, this.formModeDetection], ([fields, { mode }]) => {\n if (mode === 'non-paged' && fields.length > 0) {\n afterNextRender(\n () => {\n this.eventBus.dispatch(ComponentInitializedEvent, 'dynamic-form', this.componentId);\n },\n { injector: this.injector },\n );\n }\n });\n }\n\n private setupEventHandlers(): void {\n // Handle form reset events\n this.eventBus\n .on<FormResetEvent>('form-reset')\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.onFormReset());\n\n // Handle form clear events\n this.eventBus\n .on<FormClearEvent>('form-clear')\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.onFormClear());\n\n // Handle form submission\n createSubmissionHandler({\n eventBus: this.eventBus,\n configSignal: this.config,\n formSignal: this.form,\n })\n .pipe(takeUntilDestroyed())\n .subscribe();\n }\n\n private registerValidatorsFromConfig({ customFnConfig, schemas }: FormConfig<TFields>): void {\n if (schemas) {\n schemas.forEach((schema) => {\n this.schemaRegistry.registerSchema(schema);\n });\n }\n\n if (!customFnConfig) {\n return;\n }\n\n if (customFnConfig.customFunctions) {\n Object.entries(customFnConfig.customFunctions).forEach(([name, fn]) => {\n this.functionRegistry.registerCustomFunction(name, fn);\n });\n }\n\n this.functionRegistry.setValidators(customFnConfig.validators);\n this.functionRegistry.setAsyncValidators(customFnConfig.asyncValidators);\n this.functionRegistry.setHttpValidators(customFnConfig.httpValidators);\n }\n\n private createFormSetupFromConfig(fields: FieldDef<unknown>[], mode: FormMode, registry: Map<string, FieldTypeDefinition>) {\n const flattenedFields = this.memoizedFlattenFields(fields, registry);\n const flattenedFieldsForRendering = this.memoizedFlattenFieldsForRendering(fields, registry);\n const fieldsById = this.memoizedKeyBy(flattenedFields);\n const defaultValues = this.memoizedDefaultValues(fieldsById, registry);\n const fieldsToRender = mode === 'paged' ? [] : flattenedFieldsForRendering;\n\n return {\n fields: fieldsToRender,\n schemaFields: flattenedFields,\n originalFields: fields,\n defaultValues,\n schema: undefined,\n mode,\n registry,\n };\n }\n\n private createEmptyFormSetup(registry: Map<string, FieldTypeDefinition>) {\n return {\n fields: [],\n schemaFields: [],\n defaultValues: {} as TModel,\n schema: undefined,\n mode: 'non-paged' as const,\n registry,\n };\n }\n\n private onFormReset(): void {\n const defaults = this.defaultValues();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.form()().value.set(defaults as any);\n this.value.set(defaults as Partial<TModel>);\n }\n\n private onFormClear(): void {\n const emptyValue = {} as Partial<TModel>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.form()().value.set(emptyValue as any);\n this.value.set(emptyValue);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────────────────────────\n\n ngOnDestroy(): void {\n this.rootFormRegistry.unregisterForm();\n }\n}\n","import { computed, Signal } from '@angular/core';\nimport { ArrayField } from '../../definitions/default/array-field';\n\n/**\n * Maps an array field definition to component inputs.\n *\n * Array components create nested form structures under the array's key.\n * The array component will inject the parent FIELD_SIGNAL_CONTEXT and create\n * a scoped child injector for its array item fields.\n *\n * @param fieldDef The array field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function arrayFieldMapper(fieldDef: ArrayField): Signal<Record<string, unknown>> {\n // Array inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, Signal } from '@angular/core';\nimport { GroupField } from '../../definitions/default/group-field';\n\n/**\n * Maps a group field definition to component inputs.\n *\n * Group components create nested form structures under the group's key.\n * The group component will inject the parent FIELD_SIGNAL_CONTEXT and create\n * a scoped child injector for its nested fields.\n *\n * @param fieldDef The group field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function groupFieldMapper(fieldDef: GroupField): Signal<Record<string, unknown>> {\n // Group inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, Signal } from '@angular/core';\nimport { RowField } from '../../definitions/default/row-field';\n\n/**\n * Maps a row field definition to component inputs.\n *\n * Row components are layout containers that don't change the form shape.\n * The row component will inject FIELD_SIGNAL_CONTEXT directly.\n *\n * @param fieldDef The row field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function rowFieldMapper(fieldDef: RowField): Signal<Record<string, unknown>> {\n // Row inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, Signal } from '@angular/core';\nimport { PageField } from '../../definitions/default/page-field';\n\n/**\n * Maps a page field definition to component inputs.\n *\n * Page fields are layout containers that don't modify the form context.\n * The page component will inject FIELD_SIGNAL_CONTEXT directly.\n *\n * @param fieldDef The page field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function pageFieldMapper(fieldDef: PageField): Signal<Record<string, unknown>> {\n // Page inputs are static (no reactive dependencies)\n return computed(() => ({\n key: fieldDef.key,\n field: fieldDef,\n }));\n}\n","import { computed, inject, Signal } from '@angular/core';\nimport { TextField } from '../../definitions/default/text-field';\nimport { buildBaseInputs } from '../base/base-field-mapper';\nimport { RootFormRegistryService } from '../../core/registry/root-form-registry.service';\nimport { FunctionRegistryService } from '../../core/registry/function-registry.service';\nimport { evaluateCondition } from '../../core/expressions/condition-evaluator';\nimport { EvaluationContext } from '../../models/expressions/evaluation-context';\nimport { ConditionalExpression } from '../../models/expressions/conditional-expression';\n\n/**\n * Maps a text field definition to component inputs.\n *\n * Text fields are display-only fields that don't participate in the form schema.\n * This mapper handles the `logic` configuration by creating reactive signals\n * that evaluate conditions using the form value from RootFormRegistryService.\n *\n * @param fieldDef The text field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function textFieldMapper(fieldDef: TextField): Signal<Record<string, unknown>> {\n const rootFormRegistry = inject(RootFormRegistryService);\n const functionRegistry = inject(FunctionRegistryService);\n\n // Build base inputs (static, from field definition)\n const baseInputs = buildBaseInputs(fieldDef);\n\n // Create computed signal for hidden state based on logic configuration\n const hiddenLogic = fieldDef.logic?.filter((l) => l.type === 'hidden') ?? [];\n\n // Return computed signal for reactive updates\n return computed(() => {\n const inputs: Record<string, unknown> = { ...baseInputs };\n\n // Evaluate hidden logic if present\n if (hiddenLogic.length > 0) {\n const formValue = rootFormRegistry.getFormValue();\n const customFunctions = functionRegistry.getCustomFunctions();\n\n // Create evaluation context without a specific field value\n // (text fields don't have their own value in the form)\n const evaluationContext: EvaluationContext = {\n fieldValue: undefined,\n formValue,\n fieldPath: fieldDef.key,\n customFunctions,\n };\n\n // Evaluate all hidden logic conditions - if ANY is true, the field is hidden\n inputs['hidden'] = hiddenLogic.some((logic) => {\n if (typeof logic.condition === 'boolean') {\n return logic.condition;\n }\n return evaluateCondition(logic.condition as ConditionalExpression, evaluationContext);\n });\n }\n\n return inputs;\n });\n}\n","import { FieldTypeDefinition } from '../models/field-type';\nimport { arrayFieldMapper } from '../mappers/array/array-field-mapper';\nimport { groupFieldMapper } from '../mappers/group/group-field-mapper';\nimport { rowFieldMapper } from '../mappers/row/row-field-mapper';\nimport { pageFieldMapper } from '../mappers/page/page-field-mapper';\nimport { textFieldMapper } from '../mappers/text/text-field-mapper';\n\n/**\n * Built-in field types provided by the dynamic form library.\n *\n * These core field types handle form structure and layout. They are automatically\n * registered when using provideDynamicForm() and form the foundation for building\n * complex form layouts with nested fields and multi-step flows.\n *\n * @example\n * ```typescript\n * // Row field for horizontal layout\n * { type: 'row', fields: [\n * { type: 'input', key: 'firstName' },\n * { type: 'input', key: 'lastName' }\n * ]}\n *\n * // Group field for nested form sections\n * { type: 'group', key: 'address', fields: [\n * { type: 'input', key: 'street' },\n * { type: 'input', key: 'city' }\n * ]}\n *\n * // Array field for array-based form sections\n * { type: 'array', key: 'items', fields: [\n * { type: 'input', key: 'name' },\n * { type: 'input', key: 'quantity' }\n * ]}\n *\n * // Page field for multi-step forms\n * { type: 'page', key: 'step1', fields: [...] }\n * ```\n */\nexport const BUILT_IN_FIELDS: FieldTypeDefinition[] = [\n {\n name: 'row',\n loadComponent: () => import('../fields/row/row-field.component'),\n mapper: rowFieldMapper,\n valueHandling: 'flatten',\n },\n {\n name: 'group',\n loadComponent: () => import('../fields/group/group-field.component'),\n mapper: groupFieldMapper,\n valueHandling: 'include',\n },\n {\n name: 'array',\n loadComponent: () => import('../fields/array/array-field.component'),\n mapper: arrayFieldMapper,\n valueHandling: 'include',\n },\n {\n name: 'page',\n loadComponent: () => import('../fields/page/page-field.component'),\n mapper: pageFieldMapper,\n valueHandling: 'flatten',\n },\n {\n name: 'text',\n loadComponent: () => import('../fields/text/text-field.component'),\n mapper: textFieldMapper,\n valueHandling: 'exclude',\n },\n];\n","import { EnvironmentProviders, makeEnvironmentProviders, Provider } from '@angular/core';\nimport { FIELD_REGISTRY, FieldTypeDefinition } from '../models/field-type';\nimport { BUILT_IN_FIELDS } from './built-in-fields';\nimport { FieldDef } from '../definitions/base/field-def';\n\n// Re-export global types for module augmentation\nexport type { DynamicFormFieldRegistry, AvailableFieldTypes } from '../models/registry';\nexport type { RegisteredFieldTypes } from '../models/types';\n\n/**\n * Field type definitions with optional config providers\n */\ntype FieldTypeDefinitionsWithConfig = FieldTypeDefinition[] & {\n __configProviders?: Provider[];\n};\n\n/**\n * Extract FieldDef type from FieldTypeDefinition\n */\ntype ExtractFieldDef<T> = T extends FieldTypeDefinition<infer F> ? F : never;\n\n/**\n * Union of all FieldDef types from provided field types\n */\ntype FieldDefUnion<T extends FieldTypeDefinition[]> = ExtractFieldDef<T[number]>;\n\n/**\n * Infer form value type from field definitions\n */\ntype InferFormValue<TFieldDefs extends FieldDef<any>[]> = {\n [K in TFieldDefs[number]['key']]: any; // TODO: extract actual value type from field\n};\n\n/**\n * Provider result with type inference\n */\ntype ProvideDynamicFormResult<T extends FieldTypeDefinition[]> = EnvironmentProviders & {\n __fieldDefs?: FieldDefUnion<T>;\n __formValue?: InferFormValue<FieldDefUnion<T>[]>;\n};\n\n/**\n * Provider function to configure the dynamic form system with field types and options.\n *\n * This function creates environment providers that can be used at application or route level\n * to register field types. It provides type-safe field registration with automatic type inference.\n *\n * @param fieldTypes - Custom field type definitions to register alongside built-in types\n * @returns Environment providers for dependency injection with type inference\n *\n * @example\n * ```typescript\n * // Application-level setup\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideDynamicForm(...withMaterialFields())\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Route-level setup\n * const routes: Routes = [\n * {\n * path: 'form',\n * component: FormComponent,\n * providers: [provideDynamicForm(...withMaterialFields())]\n * }\n * ];\n * ```\n *\n * @example\n * ```typescript\n * // Custom field types with type inference\n * import { CustomFieldType, AnotherFieldType } from './custom-fields';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDynamicForm(CustomFieldType, AnotherFieldType)\n * ]\n * };\n * ```\n *\n * @typeParam T - Array of field type definitions for type inference\n *\n * @public\n */\nexport function provideDynamicForm<const T extends FieldTypeDefinition[]>(...fieldTypes: T): ProvideDynamicFormResult<T> {\n const fields = [...BUILT_IN_FIELDS, ...fieldTypes];\n\n // Extract config providers from field type arrays\n const configProviders: Provider[] = [];\n fieldTypes.forEach((fieldTypeArray) => {\n const fieldTypeWithConfig = fieldTypeArray as unknown as FieldTypeDefinitionsWithConfig;\n if (fieldTypeWithConfig.__configProviders) {\n configProviders.push(...fieldTypeWithConfig.__configProviders);\n }\n });\n\n return makeEnvironmentProviders([\n {\n provide: FIELD_REGISTRY,\n useFactory: () => {\n const registry = new Map();\n // Add custom field types\n fields.forEach((fieldType) => {\n if (registry.has(fieldType.name)) {\n console.warn(`[Dynamic Forms] Field type \"${fieldType.name}\" is already registered. Overwriting.`);\n }\n registry.set(fieldType.name, fieldType);\n });\n return registry;\n },\n },\n ...configProviders,\n ]) as ProvideDynamicFormResult<T>;\n}\n\n/**\n * Extract FieldDef types from provider result\n */\nexport type ExtractFieldDefs<T> = T extends { __fieldDefs?: infer F } ? F : never;\n\n/**\n * Extract form value type from provider result\n */\nexport type ExtractFormValue<T> = T extends { __formValue?: infer V } ? V : never;\n","import { computed, Signal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\nimport { FormOptions, NextButtonOptions, SubmitButtonOptions } from '../../models/form-config';\nimport { LogicConfig, FormStateCondition, isFormStateCondition } from '../../models/logic';\nimport { ConditionalExpression } from '../../models/expressions';\nimport { evaluateCondition } from '../expressions';\n\n/**\n * Context for resolving button disabled state.\n *\n * @public\n */\nexport interface ButtonLogicContext {\n /** The form's FieldTree instance */\n form: FieldTree<unknown>;\n\n /** Form-level options */\n formOptions?: FormOptions;\n\n /** Field-level logic array (if provided) */\n fieldLogic?: LogicConfig[];\n\n /** Explicit disabled state from field definition */\n explicitlyDisabled?: boolean;\n\n /** Current page validity signal (for paged forms) */\n currentPageValid?: Signal<boolean>;\n\n /** Current form value for evaluating conditional expressions */\n formValue?: unknown;\n}\n\n/**\n * Default options for submit button disabled behavior.\n */\nconst DEFAULT_SUBMIT_BUTTON_OPTIONS: Required<SubmitButtonOptions> = {\n disableWhenInvalid: true,\n disableWhileSubmitting: true,\n};\n\n/**\n * Default options for next button disabled behavior.\n */\nconst DEFAULT_NEXT_BUTTON_OPTIONS: Required<NextButtonOptions> = {\n disableWhenPageInvalid: true,\n disableWhileSubmitting: true,\n};\n\n/**\n * Evaluates a FormStateCondition against the current form/page state.\n *\n * @param condition - The form state condition to evaluate\n * @param ctx - The button logic context\n * @returns true if the condition is met (button should be disabled)\n */\nfunction evaluateFormStateCondition(condition: FormStateCondition, ctx: ButtonLogicContext): boolean {\n const form = ctx.form();\n\n switch (condition) {\n case 'formInvalid':\n return !form.valid();\n\n case 'formSubmitting':\n return form.submitting();\n\n case 'pageInvalid':\n return ctx.currentPageValid ? !ctx.currentPageValid() : false;\n\n default:\n return false;\n }\n}\n\n/**\n * Evaluates a single logic condition (boolean, FormStateCondition, or ConditionalExpression).\n *\n * @param condition - The condition to evaluate\n * @param ctx - The button logic context\n * @returns true if the condition is met\n */\nfunction evaluateLogicCondition(condition: LogicConfig['condition'], ctx: ButtonLogicContext): boolean {\n // Boolean condition\n if (typeof condition === 'boolean') {\n return condition;\n }\n\n // FormStateCondition (string)\n if (isFormStateCondition(condition)) {\n return evaluateFormStateCondition(condition, ctx);\n }\n\n // ConditionalExpression\n const formValue = (ctx.formValue ?? ctx.form().value()) as Record<string, unknown>;\n const evaluationContext = {\n fieldValue: undefined,\n formValue,\n fieldPath: '',\n };\n\n return evaluateCondition(condition as ConditionalExpression, evaluationContext);\n}\n\n/**\n * Checks if any disabled logic condition is met in the field's logic array.\n *\n * @param fieldLogic - Array of logic configurations\n * @param ctx - The button logic context\n * @returns true if any disabled condition is met\n */\nfunction hasFieldLevelDisabledCondition(fieldLogic: LogicConfig[] | undefined, ctx: ButtonLogicContext): boolean {\n if (!fieldLogic || fieldLogic.length === 0) {\n return false;\n }\n\n return fieldLogic.filter((logic) => logic.type === 'disabled').some((logic) => evaluateLogicCondition(logic.condition, ctx));\n}\n\n/**\n * Checks if the field has explicit logic that should override form-level defaults.\n *\n * When a field has its own disabled logic defined, it indicates the user wants\n * custom control over the disabled state, so form-level defaults should be ignored.\n *\n * @param fieldLogic - Array of logic configurations\n * @returns true if field has its own disabled logic\n */\nfunction hasCustomDisabledLogic(fieldLogic: LogicConfig[] | undefined): boolean {\n if (!fieldLogic || fieldLogic.length === 0) {\n return false;\n }\n\n return fieldLogic.some((logic) => logic.type === 'disabled');\n}\n\n/**\n * Resolves the disabled state for a submit button.\n *\n * The disabled state is determined by (in order of precedence):\n * 1. Explicit `disabled: true` on the field definition\n * 2. Field-level `logic` array (if present, overrides form-level defaults)\n * 3. Form-level `options.submitButton` defaults\n *\n * @param ctx - The button logic context\n * @returns A computed signal that returns true when the button should be disabled\n *\n * @example\n * ```typescript\n * const disabled = resolveSubmitButtonDisabled({\n * form: formInstance,\n * formOptions: config.options,\n * fieldLogic: buttonField.logic,\n * explicitlyDisabled: buttonField.disabled,\n * });\n *\n * // Use in template\n * <button [disabled]=\"disabled()\">Submit</button>\n * ```\n *\n * @public\n */\nexport function resolveSubmitButtonDisabled(ctx: ButtonLogicContext): Signal<boolean> {\n return computed(() => {\n // 1. Explicit disabled always wins\n if (ctx.explicitlyDisabled) {\n return true;\n }\n\n // 2. If field has custom disabled logic, use it exclusively\n if (hasCustomDisabledLogic(ctx.fieldLogic)) {\n return hasFieldLevelDisabledCondition(ctx.fieldLogic, ctx);\n }\n\n // 3. Apply form-level defaults\n const options = {\n ...DEFAULT_SUBMIT_BUTTON_OPTIONS,\n ...ctx.formOptions?.submitButton,\n };\n\n const form = ctx.form();\n\n if (options.disableWhenInvalid && !form.valid()) {\n return true;\n }\n\n if (options.disableWhileSubmitting && form.submitting()) {\n return true;\n }\n\n return false;\n });\n}\n\n/**\n * Resolves the disabled state for a next page button.\n *\n * The disabled state is determined by (in order of precedence):\n * 1. Explicit `disabled: true` on the field definition\n * 2. Field-level `logic` array (if present, overrides form-level defaults)\n * 3. Form-level `options.nextButton` defaults\n *\n * @param ctx - The button logic context\n * @returns A computed signal that returns true when the button should be disabled\n *\n * @example\n * ```typescript\n * const disabled = resolveNextButtonDisabled({\n * form: formInstance,\n * formOptions: config.options,\n * fieldLogic: buttonField.logic,\n * explicitlyDisabled: buttonField.disabled,\n * currentPageValid: pageOrchestrator.currentPageValid,\n * });\n * ```\n *\n * @public\n */\nexport function resolveNextButtonDisabled(ctx: ButtonLogicContext): Signal<boolean> {\n return computed(() => {\n // 1. Explicit disabled always wins\n if (ctx.explicitlyDisabled) {\n return true;\n }\n\n // 2. If field has custom disabled logic, use it exclusively\n if (hasCustomDisabledLogic(ctx.fieldLogic)) {\n return hasFieldLevelDisabledCondition(ctx.fieldLogic, ctx);\n }\n\n // 3. Apply form-level defaults\n const options = {\n ...DEFAULT_NEXT_BUTTON_OPTIONS,\n ...ctx.formOptions?.nextButton,\n };\n\n const form = ctx.form();\n\n if (options.disableWhenPageInvalid && ctx.currentPageValid && !ctx.currentPageValid()) {\n return true;\n }\n\n if (options.disableWhileSubmitting && form.submitting()) {\n return true;\n }\n\n return false;\n });\n}\n","import { FieldDef } from './field-def';\nimport { FieldWithValidation } from './field-with-validation';\nimport { WithInputSignals } from '../../models/component-type';\nimport { Prettify } from '../../models/prettify';\nimport { DynamicText } from '../../models/types/dynamic-text';\n\n/**\n * Supported primitive value types for form fields.\n * This type represents all possible value types that can be used in form fields.\n */\nexport type ValueType = string | number | boolean | Date | object | unknown[];\n\nexport interface BaseValueField<TProps, TValue> extends FieldDef<TProps>, FieldWithValidation {\n value?: TValue;\n\n /**\n * Placeholder text displayed when the field is empty.\n * Supports static strings, Observables, and Signals for dynamic content.\n */\n placeholder?: DynamicText;\n\n required?: boolean;\n}\n\nexport function isValueField<TProps>(field: FieldDef<TProps>): field is BaseValueField<TProps, ValueType> {\n return 'value' in field;\n}\n\ntype ExcludedKeys =\n | 'type'\n | 'conditionals'\n | 'value'\n | 'valueType'\n | 'disabled'\n | 'readonly'\n | 'hidden'\n | 'col'\n | 'minValue'\n | 'maxValue'\n | 'step'\n // Exclude validation config, but keep validationMessages for component use\n | 'required'\n | 'email'\n | 'min'\n | 'max'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'validators'\n | 'logic'\n | 'schemas';\n\nexport type ValueFieldComponent<T extends BaseValueField<any, unknown>> = Prettify<WithInputSignals<Omit<T, ExcludedKeys>>>;\n","import { FieldDef } from './field-def';\nimport { FieldWithValidation } from './field-with-validation';\nimport { WithInputSignals } from '../../models/component-type';\nimport { Prettify } from '../../models/prettify';\nimport { DynamicText } from '../../models/types/dynamic-text';\n\nexport interface BaseCheckedField<TProps> extends FieldDef<TProps>, FieldWithValidation {\n value?: boolean;\n\n /**\n * Placeholder text displayed when the field is empty.\n * Supports static strings, Observables, and Signals for dynamic content.\n */\n placeholder?: DynamicText;\n\n required?: boolean;\n}\n\nexport function isCheckedField<TProps>(field: FieldDef<TProps>): field is BaseCheckedField<TProps> {\n return field.type === 'checkbox';\n}\n\ntype ExcludedKeys = 'type' | 'conditionals' | 'value' | 'disabled' | 'readonly' | 'hidden' | 'col' | keyof FieldWithValidation;\n\nexport type CheckedFieldComponent<T extends BaseCheckedField<any>> = Prettify<WithInputSignals<Omit<T, ExcludedKeys>>>;\n","/**\n * Context for token resolution in event args\n */\nexport interface TokenContext {\n /** Current field key */\n key?: string;\n /** Array index if field is inside an array */\n index?: number;\n /** Parent array field key if field is inside an array */\n arrayKey?: string;\n /** Current form value for complex indexing */\n formValue?: unknown;\n}\n\n/**\n * Resolves special tokens in event arguments to their actual values\n *\n * Supported tokens:\n * - $key: The current field key\n * - $index: The array index (if inside an array field)\n * - $arrayKey: The parent array field key (if inside an array field)\n * - formValue: Reference to the current form value for indexing\n *\n * @param args - Array of arguments that may contain tokens\n * @param context - Context object containing token values\n * @returns Array with resolved values\n *\n * @example\n * resolveTokens(['$arrayKey', '$index'], { arrayKey: 'contacts', index: 2 })\n * // Returns: ['contacts', 2]\n *\n * @example\n * resolveTokens(['$key', 'static'], { key: 'myField' })\n * // Returns: ['myField', 'static']\n */\nexport function resolveTokens(\n args: readonly (string | number | boolean | null | undefined)[],\n context: TokenContext,\n): (string | number | boolean | null | undefined | unknown)[] {\n return args.map((arg) => {\n // Only process string tokens\n if (typeof arg !== 'string') {\n return arg;\n }\n\n // Check for token patterns\n switch (arg) {\n case '$key':\n return context.key;\n case '$index':\n return context.index;\n case '$arrayKey':\n return context.arrayKey;\n case 'formValue':\n return context.formValue;\n default:\n // Return as-is if not a recognized token\n return arg;\n }\n });\n}\n","import { isSignal, Signal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\n\ninterface ChildData {\n reader: FieldTree<unknown>;\n}\n\ninterface ChildrenData {\n byPropertyKey: Map<string, ChildData>;\n}\n\nexport interface FormInternals<T = unknown> {\n structure: {\n childrenMap: () => ChildrenData;\n };\n fieldProxy?: FieldTree<T>;\n}\n\ntype FormInput = FormInternals | Signal<FormInternals> | unknown;\n\n/**\n * Type guard to check if a value has the FormInternals structure.\n */\nexport function isFormInternals(value: unknown): value is FormInternals {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'structure' in value &&\n typeof (value as FormInternals).structure?.childrenMap === 'function'\n );\n}\n\n/**\n * Type guard that unwraps signals and checks for FormInternals structure.\n * Use this when the input might be a signal wrapping FormInternals.\n */\nexport function hasFormStructure(form: FormInput): form is FormInternals | Signal<FormInternals> {\n const unwrapped = isSignal(form) ? form() : form;\n return isFormInternals(unwrapped);\n}\n\n/**\n * Unwraps a signal if needed and returns the FormInternals or null.\n */\nfunction unwrapFormInput(form: FormInput): FormInternals | null {\n const unwrapped = isSignal(form) ? form() : form;\n return isFormInternals(unwrapped) ? unwrapped : null;\n}\n\nexport function getChildrenMap(form: FormInput): Map<string, FieldTree<unknown>> | null {\n const target = unwrapFormInput(form);\n if (!target) {\n return null;\n }\n\n const result = target.structure.childrenMap();\n const normalizedMap = new Map<string, FieldTree<unknown>>();\n for (const [key, childData] of result.byPropertyKey) {\n normalizedMap.set(key, childData.reader);\n }\n return normalizedMap;\n}\n\nexport function getFieldProxy<T = unknown>(node: unknown): FieldTree<T> | null {\n if (!isFormInternals(node)) {\n return null;\n }\n return (node.fieldProxy as FieldTree<T>) ?? null;\n}\n\nexport function getChildFieldTree(form: unknown, key: string): FieldTree<unknown> | null {\n const childrenMap = getChildrenMap(form);\n return childrenMap?.get(key) ?? null;\n}\n","import { BaseValueField } from '../../definitions/base/base-value-field';\nimport { computed, inject, isSignal, Signal } from '@angular/core';\nimport { buildBaseInputs } from '../base/base-field-mapper';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { omit } from '../../utils/object-utils';\nimport { getChildrenMap, getFieldProxy } from '../../utils/form-internals/form-internals';\nimport { ValidationMessages } from '../../models/validation-types';\n\n/**\n * Context for value field mapping, containing resolved field proxy and default validation messages.\n * Used by specialized mappers to avoid duplicate context resolution.\n */\nexport interface ValueFieldContext {\n fieldProxy: unknown;\n defaultValidationMessages: ValidationMessages | undefined;\n}\n\n/**\n * Resolves the field proxy and default validation messages from the form context.\n * Must be called within an injection context.\n *\n * @param fieldKey The key of the field to resolve\n * @returns The resolved context with field proxy and validation messages\n */\nexport function resolveValueFieldContext(fieldKey: string): ValueFieldContext {\n const context = inject(FIELD_SIGNAL_CONTEXT);\n\n // Get form-level validation messages\n const defaultValidationMessages = context.defaultValidationMessages;\n\n // Get the form root to access field proxy\n const formRoot = context.form();\n const childrenMap = getChildrenMap(formRoot);\n\n // Resolve field proxy\n let fieldProxy: unknown = undefined;\n\n if (!childrenMap) {\n // No childrenMap - the form might be a FormRecord where fields are direct properties\n // First check if formRoot itself has fieldProxy (for FieldTree items)\n const rootFieldProxy = getFieldProxy(formRoot);\n if (rootFieldProxy) {\n fieldProxy = rootFieldProxy;\n } else {\n // Try accessing the field as a direct property on formRoot (FormRecord case)\n // This handles forms created with form(entity, schema) where fields are accessible as formRoot[key]\n const formField = (formRoot as unknown as Record<string, unknown>)[fieldKey];\n const resolvedProxy = getFieldProxy(formField);\n if (resolvedProxy) {\n fieldProxy = resolvedProxy;\n } else if (isSignal(formField) || formField) {\n // The field itself might be the proxy (signal), or might have a different structure\n // Try using the field directly as the proxy\n fieldProxy = formField;\n }\n }\n } else {\n // Standard field access for non-array keys via childrenMap lookup\n const formField = childrenMap.get(fieldKey);\n if (formField) {\n fieldProxy = formField;\n }\n }\n\n return { fieldProxy, defaultValidationMessages };\n}\n\n/**\n * Builds the base inputs for a value field.\n * This is a helper function used by valueFieldMapper and specialized mappers.\n *\n * @param fieldDef The value field definition\n * @param ctx The resolved value field context\n * @returns Record of input names to values\n */\nexport function buildValueFieldInputs<TProps, TValue = unknown>(\n fieldDef: BaseValueField<TProps, TValue>,\n ctx: ValueFieldContext,\n): Record<string, unknown> {\n const omittedFields = omit(fieldDef, ['value']);\n const baseInputs = buildBaseInputs(omittedFields);\n\n const inputs: Record<string, unknown> = {\n ...baseInputs,\n // Always pass validationMessages (or empty object) - required for error display signals\n validationMessages: fieldDef.validationMessages ?? {},\n };\n\n // Value field specific properties\n if (fieldDef.placeholder !== undefined) {\n inputs['placeholder'] = fieldDef.placeholder;\n }\n\n if (ctx.defaultValidationMessages !== undefined) {\n inputs['defaultValidationMessages'] = ctx.defaultValidationMessages;\n }\n\n if (ctx.fieldProxy !== undefined) {\n inputs['field'] = ctx.fieldProxy;\n }\n\n return inputs;\n}\n\n/**\n * Maps a value field definition to component inputs.\n *\n * Value fields are input fields that contribute to the form's value (text, number, etc.).\n * This mapper injects FIELD_SIGNAL_CONTEXT to access the form structure and retrieve the field proxy.\n *\n * For fields with specific properties (select, datepicker, textarea, slider), use the specialized mappers:\n * - selectFieldMapper: for fields with options (select, radio, multi-checkbox)\n * - datepickerFieldMapper: for fields with minDate, maxDate, startAt\n * - textareaFieldMapper: for fields with rows, cols\n * - sliderFieldMapper: for fields with minValue, maxValue, step\n *\n * @param fieldDef The value field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function valueFieldMapper<TProps = unknown, TValue = unknown>(\n fieldDef: BaseValueField<TProps, TValue>,\n): Signal<Record<string, unknown>> {\n const ctx = resolveValueFieldContext(fieldDef.key);\n\n return computed(() => buildValueFieldInputs(fieldDef, ctx));\n}\n","import { BaseCheckedField } from '../../definitions/base/base-checked-field';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { computed, inject, Signal } from '@angular/core';\nimport { buildBaseInputs } from '../base/base-field-mapper';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { omit } from '../../utils/object-utils';\nimport { getChildrenMap } from '../../utils/form-internals/form-internals';\n\n/**\n * Maps a checkbox/toggle field definition to component inputs.\n *\n * Checkbox fields are checked fields that contribute to the form's value as boolean.\n * This mapper injects FIELD_SIGNAL_CONTEXT to access the form structure and retrieve the field proxy.\n *\n * @param fieldDef The checkbox field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function checkboxFieldMapper(fieldDef: BaseCheckedField<unknown>): Signal<Record<string, unknown>> {\n const context = inject(FIELD_SIGNAL_CONTEXT);\n const omittedFields = omit(fieldDef, ['value']) as FieldDef<unknown>;\n\n // Build base inputs (static, from field definition)\n const baseInputs = buildBaseInputs(omittedFields);\n\n // Get form-level validation messages (static)\n const defaultValidationMessages = context.defaultValidationMessages;\n\n // Get the form root to access field proxy\n const formRoot = context.form();\n const childrenMap = getChildrenMap(formRoot);\n\n // Resolve field proxy (static - determined once during mapping)\n let fieldProxy: unknown = undefined;\n\n if (childrenMap) {\n const formField = childrenMap.get(fieldDef.key);\n if (formField) {\n fieldProxy = formField;\n }\n }\n\n // Return computed signal for reactive updates\n return computed(() => {\n const inputs: Record<string, unknown> = {\n ...baseInputs,\n // Always pass validationMessages (or empty object) - required for error display signals\n validationMessages: fieldDef.validationMessages ?? {},\n };\n\n // Checked field specific property: placeholder\n if (fieldDef.placeholder !== undefined) {\n inputs['placeholder'] = fieldDef.placeholder;\n }\n\n if (defaultValidationMessages !== undefined) {\n inputs['defaultValidationMessages'] = defaultValidationMessages;\n }\n\n if (fieldProxy !== undefined) {\n inputs['field'] = fieldProxy;\n }\n\n return inputs;\n });\n}\n","import { computed, Signal } from '@angular/core';\nimport { SelectField } from '../../definitions/default/select-field';\nimport { RadioField } from '../../definitions/default/radio-field';\nimport { MultiCheckboxField } from '../../definitions/default/multi-checkbox-field';\nimport { BaseValueField } from '../../definitions/base/base-value-field';\nimport { resolveValueFieldContext, buildValueFieldInputs } from '../value/value-field.mapper';\n\n/**\n * Field types that have an options property.\n */\nexport type FieldWithOptions<T = unknown, TProps = unknown> =\n | SelectField<T, TProps>\n | RadioField<T, TProps>\n | MultiCheckboxField<T, TProps>;\n\n/**\n * Maps a field with options (select, radio, multi-checkbox) to component inputs.\n *\n * Extends the base value field mapper by adding the options property.\n *\n * @param fieldDef The field definition with options\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function optionsFieldMapper<T, TProps>(fieldDef: FieldWithOptions<T, TProps>): Signal<Record<string, unknown>> {\n const ctx = resolveValueFieldContext(fieldDef.key);\n\n return computed(() => {\n // Cast to BaseValueField - safe because all FieldWithOptions types extend BaseValueField\n const inputs = buildValueFieldInputs(fieldDef as BaseValueField<TProps, unknown>, ctx);\n\n // Add options property\n inputs['options'] = fieldDef.options;\n\n return inputs;\n });\n}\n","import { computed, Signal } from '@angular/core';\nimport { DatepickerField } from '../../definitions/default/datepicker-field';\nimport { resolveValueFieldContext, buildValueFieldInputs } from '../value/value-field.mapper';\n\n/**\n * Maps a datepicker field to component inputs.\n *\n * Extends the base value field mapper by adding datepicker-specific properties:\n * - minDate: Minimum selectable date\n * - maxDate: Maximum selectable date\n * - startAt: Initial date to display when opening the picker\n *\n * @param fieldDef The datepicker field definition\n * @returns Signal containing Record of input names to values for ngComponentOutlet\n */\nexport function datepickerFieldMapper<TProps>(fieldDef: DatepickerField<TProps>): Signal<Record<string, unknown>> {\n const ctx = resolveValueFieldContext(fieldDef.key);\n\n return computed(() => {\n const inputs = buildValueFieldInputs(fieldDef, ctx);\n\n // Add datepicker-specific properties\n if (fieldDef.minDate !== undefined) {\n inputs['minDate'] = fieldDef.minDate;\n }\n if (fieldDef.maxDate !== undefined) {\n inputs['maxDate'] = fieldDef.maxDate;\n }\n if (fieldDef.startAt !== undefined) {\n inputs['startAt'] = fieldDef.startAt;\n }\n\n return inputs;\n });\n}\n","import { isSignal, Injector } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { isObservable, Observable, of } from 'rxjs';\nimport { DynamicText } from '../models/types/dynamic-text';\n\n/**\n * Converts DynamicText (string | Observable | Signal) to Observable<string>\n * Unifies all three types into a consistent Observable stream\n *\n * @param value - The dynamic text value to convert\n * @param injector - Optional injector for signal conversion\n * @returns Observable<string> - The value as an observable stream\n */\nexport function dynamicTextToObservable(value: DynamicText | undefined, injector?: Injector): Observable<string> {\n if (value === undefined) {\n return of('');\n }\n\n if (isObservable(value)) {\n return value;\n }\n\n if (isSignal(value)) {\n return toObservable(value, { injector });\n }\n\n return of(String(value));\n}\n","import { Signal, computed } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\n\n/**\n * Computed signal that determines if errors should be displayed\n * Based on field's invalid, touched, and error count\n *\n * @param field - Signal containing FieldTree\n * @returns Signal<boolean> - True if errors should be displayed\n */\nexport function shouldShowErrors<T>(field: Signal<FieldTree<T>>): Signal<boolean> {\n return computed(() => {\n const fieldTree = field();\n const control = fieldTree();\n return control.invalid() && control.touched() && control.errors().length > 0;\n });\n}\n","import { ValidationError } from '../models/validation-types';\n\n/**\n * Interpolates {{param}} placeholders in message with error values\n *\n * @param message - Message template with {{param}} placeholders\n * @param error - Validation error containing parameter values\n * @returns Message with interpolated parameters\n *\n * @example\n * interpolateParams(\"Min value is {{min}}\", { kind: 'min', min: 5 })\n * // Returns: \"Min value is 5\"\n */\nexport function interpolateParams(message: string, error: ValidationError): string {\n let result = message;\n const params = extractErrorParams(error);\n\n Object.entries(params).forEach(([key, value]) => {\n const placeholder = new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g');\n result = result.replace(placeholder, safeToString(value));\n });\n\n return result;\n}\n\n/**\n * Safely converts a value to a string, handling complex objects\n * @internal\n */\nfunction safeToString(value: unknown): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n // Handle primitives directly\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n\n // Handle RegExp (has its own toString)\n if (value instanceof RegExp) {\n return value.toString();\n }\n\n // Handle Date\n if (value instanceof Date) {\n return value.toISOString();\n }\n\n // Handle arrays\n if (Array.isArray(value)) {\n return value.join(', ');\n }\n\n // For objects, try JSON.stringify first, fall back to empty string\n try {\n // Check if object has a custom toString that's not Object.prototype.toString\n if (typeof value === 'object' && value.toString !== Object.prototype.toString) {\n return value.toString();\n }\n // Otherwise use JSON representation\n return JSON.stringify(value);\n } catch {\n // If JSON.stringify fails (circular reference, etc.), return empty string\n return '[object]';\n }\n}\n\n/**\n * Extracts parameter values from validation error\n * @internal\n */\nfunction extractErrorParams(error: ValidationError): Record<string, unknown> {\n const params: Record<string, unknown> = {};\n\n // Common validation error parameters\n if ('min' in error) params.min = error.min;\n if ('max' in error) params.max = error.max;\n if ('requiredLength' in error) params.requiredLength = error.requiredLength;\n if ('actualLength' in error) params.actualLength = error.actualLength;\n if ('pattern' in error) params.pattern = error.pattern;\n if ('actual' in error) params.actual = error.actual;\n if ('expected' in error) params.expected = error.expected;\n\n // Include all custom properties from error object (for custom validators)\n // Skip 'kind' as it's the error type identifier, not a parameter\n Object.keys(error).forEach((key) => {\n if (key !== 'kind' && !(key in params)) {\n params[key] = error[key as keyof ValidationError];\n }\n });\n\n return params;\n}\n","import { computed, inject, Injector, signal, Signal } from '@angular/core';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { FieldTree, ValidationError } from '@angular/forms/signals';\nimport { combineLatest, Observable, of } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { ValidationMessages } from '../models/validation-types';\nimport { dynamicTextToObservable } from './dynamic-text-to-observable';\nimport { interpolateParams } from './interpolate-params';\n\n/**\n * Resolved validation error with interpolated message\n */\nexport interface ResolvedError {\n kind: string;\n message: string;\n}\n\n/**\n * Factory function that creates a signal of resolved validation errors\n * Handles async resolution of DynamicText validation messages\n *\n * @param field - Signal containing FieldTree\n * @param validationMessages - Signal containing custom field-level validation messages\n * @param defaultValidationMessages - Signal containing default validation messages (fallback)\n * @param injector - Optional injector for DynamicText resolution\n * @returns Signal<ResolvedError[]> - Reactively resolved error messages\n *\n * @example\n * ```typescript\n * readonly resolvedErrors = createResolvedErrorsSignal(\n * this.field,\n * this.validationMessages,\n * this.defaultValidationMessages\n * );\n * ```\n */\nexport function createResolvedErrorsSignal<T>(\n field: Signal<FieldTree<T>>,\n validationMessages: Signal<ValidationMessages | undefined>,\n defaultValidationMessages: Signal<ValidationMessages | undefined> = signal(undefined),\n injector = inject(Injector),\n): Signal<ResolvedError[]> {\n // Ensure validationMessages is never undefined (mappers pass {} if not defined)\n const messages = computed(() => validationMessages() ?? {});\n const defaultMessages = computed(() => defaultValidationMessages() ?? {});\n\n // Create a computed signal that reads the actual errors from the field\n // This ensures the signal tracks changes to field().errors(), not just the field reference\n const errors = computed(() => {\n const control = field()();\n return control.errors();\n });\n\n // Convert signals to observables using toObservable with injector\n const errors$ = toObservable(errors, { injector });\n const messages$ = toObservable(messages, { injector });\n const defaultMessages$ = toObservable(defaultMessages, { injector });\n\n // Combine observables and process errors\n const resolvedErrors$ = combineLatest([errors$, messages$, defaultMessages$]).pipe(\n switchMap(([currentErrors, msgs, defaultMsgs]) => {\n // No errors - return empty array\n if (!currentErrors || currentErrors.length === 0) {\n return of([]);\n }\n\n // Create observable for each error's resolved message\n const errorResolvers = currentErrors.map((error: ValidationError) => resolveErrorMessage(error, msgs, defaultMsgs, injector));\n\n // Combine all error message observables into single array emission, filtering out nulls\n return errorResolvers.length > 0\n ? combineLatest(errorResolvers).pipe(map((errors) => errors.filter((e): e is ResolvedError => e !== null)))\n : of([]);\n }),\n );\n\n // Convert observable back to signal using toSignal with injector\n // toSignal properly handles the injection context and manages subscriptions\n return toSignal(resolvedErrors$, { initialValue: [] as ResolvedError[], injector });\n}\n\n/**\n * Resolves a single error message from DynamicText sources with fallback logic\n * Priority: field-level message → default message → no message (logs warning)\n * @internal\n */\nfunction resolveErrorMessage(\n error: ValidationError,\n fieldMessages: ValidationMessages,\n defaultMessages: ValidationMessages,\n injector: Injector,\n): Observable<ResolvedError | null> {\n // Check for field-level custom message first\n const fieldMessage = fieldMessages[error.kind];\n\n // Fall back to default message if no field-level message exists\n const defaultMessage = defaultMessages[error.kind];\n\n // Determine which message to use: field-level → default\n const messageToUse = fieldMessage ?? defaultMessage;\n\n // If no message found, log warning and return null (will be filtered out)\n if (!messageToUse) {\n console.warn(\n `[Dynamic Forms] No validation message found for error kind \"${error.kind}\". ` +\n `Please provide a message via field-level validationMessages or form-level defaultValidationMessages.`,\n );\n return of(null);\n }\n\n // Convert DynamicText to Observable\n const messageObservable = dynamicTextToObservable(messageToUse, injector);\n\n // Apply parameter interpolation to support {{param}} syntax\n return messageObservable.pipe(\n map((msg) => ({\n kind: error.kind,\n message: interpolateParams(msg, error),\n })),\n );\n}\n","import { inject, Injector, isSignal, Pipe, PipeTransform } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { isObservable, Observable, of } from 'rxjs';\nimport { DynamicText } from '../../models/types/dynamic-text';\n\n/**\n * Pipe that handles dynamic text resolution with support for static strings,\n * Observables, and Signals.\n *\n * Supports:\n * - Static strings (pass-through)\n * - Observables (subscribed internally)\n * - Signals (converted to Observable using toObservable for reactivity)\n *\n * @example\n * ```html\n * <!-- Static string -->\n * {{ 'Hello World' | dynamicText | async }}\n *\n * <!-- Observable -->\n * {{ transloco.selectTranslate('key') | dynamicText | async }}\n *\n * <!-- Signal -->\n * {{ myTextSignal | dynamicText | async }}\n * ```\n *\n * @public\n */\n@Pipe({\n name: 'dynamicText',\n standalone: true,\n})\nexport class DynamicTextPipe implements PipeTransform {\n private readonly injector = inject(Injector);\n\n /**\n * Transforms dynamic text input into a resolved string value\n *\n * @param value - The dynamic text value to resolve\n * @returns The resolved string value as an Observable\n */\n transform(value: DynamicText | undefined): Observable<string> {\n if (isObservable(value)) {\n return value;\n }\n\n if (isSignal(value)) {\n return toObservable(value, { injector: this.injector });\n }\n\n return of(value || '');\n }\n}\n","import { afterNextRender, Injector } from '@angular/core';\nimport { EventBus } from '../../events/event.bus';\nimport { ComponentInitializedEvent } from '../../events/constants/component-initialized.event';\n\n/**\n * Component type for initialization events.\n */\nexport type InitializationComponentType = 'dynamic-form' | 'group' | 'row' | 'page' | 'array';\n\n/**\n * Emits a component initialization event after the next render cycle.\n *\n * This utility is used by container components (group, row, page, array) to signal\n * that their child fields have been resolved and rendered. The event is dispatched\n * through the EventBus and is used by the initialization tracking system.\n *\n * @param eventBus - The EventBus instance to dispatch the event on\n * @param componentType - The type of component being initialized\n * @param componentKey - The unique key/id of the component\n * @param injector - The injector to use for afterNextRender scheduling\n */\nexport function emitComponentInitialized(\n eventBus: EventBus,\n componentType: InitializationComponentType,\n componentKey: string,\n injector: Injector,\n): void {\n afterNextRender(\n () => {\n try {\n eventBus.dispatch(ComponentInitializedEvent, componentType, componentKey);\n } catch {\n // Input not available - component may have been destroyed\n }\n },\n { injector },\n );\n}\n","import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, Injector, input } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { forkJoin, map, of, pipe, scan, switchMap } from 'rxjs';\nimport { derivedFromDeferred } from '../../utils/derived-from-deferred/derived-from-deferred';\nimport { reconcileFields, ResolvedField, resolveField } from '../../utils/resolve-field/resolve-field';\nimport { emitComponentInitialized } from '../../utils/emit-initialization/emit-initialization';\nimport { RowField } from '../../definitions/default/row-field';\nimport { injectFieldRegistry } from '../../utils/inject-field-registry/inject-field-registry';\nimport { EventBus } from '../../events/event.bus';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\n\n/**\n * Layout container for horizontal field arrangement.\n *\n * Does not create a new form context - fields share the parent's context.\n * Field values are flattened into the parent form (no nesting under row key).\n * Purely a visual/layout container with no impact on form structure.\n */\n@Component({\n selector: 'div[row-field]',\n imports: [NgComponentOutlet],\n template: `\n @for (field of resolvedFields(); track field.key) {\n <ng-container *ngComponentOutlet=\"field.component; injector: field.injector; inputs: field.inputs()\" />\n }\n `,\n styleUrl: './row-field.component.scss',\n host: {\n class: 'df-field df-row',\n '[class.disabled]': 'disabled()',\n '[id]': '`${key()}`',\n '[attr.data-testid]': 'key()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class RowFieldComponent {\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly injector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n field = input.required<RowField>();\n key = input.required<string>();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly disabled = computed(() => {\n try {\n return this.field().disabled || false;\n } catch {\n return false;\n }\n });\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Field Resolution\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly fieldsSource = computed(() => this.field().fields || []);\n\n protected readonly resolvedFields = derivedFromDeferred(\n this.fieldsSource,\n pipe(\n switchMap((fields) => {\n if (!fields || fields.length === 0) {\n return of([] as (ResolvedField | undefined)[]);\n }\n const rowKey = this.field().key || '<no key>';\n const context = {\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n registry: this.rawFieldRegistry(),\n injector: this.injector,\n destroyRef: this.destroyRef,\n onError: (fieldDef: FieldDef<unknown>, error: unknown) => {\n const fieldKey = fieldDef.key || '<no key>';\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${fieldDef.type}' (key: ${fieldKey}) ` +\n `within row '${rowKey}'. Ensure the field type is registered in your field registry.`,\n error,\n );\n },\n };\n return forkJoin(fields.map((f) => resolveField(f as FieldDef<unknown>, context)));\n }),\n map((fields) => fields.filter((f): f is ResolvedField => f !== undefined)),\n scan(reconcileFields, [] as ResolvedField[]),\n ),\n { initialValue: [] as ResolvedField[], injector: this.injector },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Constructor\n // ─────────────────────────────────────────────────────────────────────────────\n\n constructor() {\n this.setupEffects();\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Private Methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n private setupEffects(): void {\n // Emit initialization event when fields are resolved\n explicitEffect([this.resolvedFields], ([fields]) => {\n if (fields.length > 0) {\n emitComponentInitialized(this.eventBus, 'row', this.field().key, this.injector);\n }\n });\n }\n}\n\nexport { RowFieldComponent };\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n inject,\n Injector,\n input,\n linkedSignal,\n runInInjectionContext,\n untracked,\n} from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { outputFromObservable, toObservable } from '@angular/core/rxjs-interop';\nimport { forkJoin, map, of, pipe, scan, switchMap } from 'rxjs';\nimport { derivedFromDeferred } from '../../utils/derived-from-deferred/derived-from-deferred';\nimport { reconcileFields, ResolvedField, resolveField } from '../../utils/resolve-field/resolve-field';\nimport { emitComponentInitialized } from '../../utils/emit-initialization/emit-initialization';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { keyBy, mapValues, memoize } from '../../utils/object-utils';\nimport { GroupField } from '../../definitions/default/group-field';\nimport { injectFieldRegistry } from '../../utils/inject-field-registry/inject-field-registry';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { form } from '@angular/forms/signals';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldSignalContext } from '../../mappers/types';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { getFieldDefaultValue } from '../../utils/default-value/default-value';\nimport { createSchemaFromFields } from '../../core/schema-builder';\nimport { EventBus } from '../../events/event.bus';\nimport { SubmitEvent } from '../../events/constants/submit.event';\nimport { flattenFields } from '../../utils/flattener/field-flattener';\nimport { getChildFieldTree } from '../../utils/form-internals/form-internals';\n\n/**\n * Container component for rendering nested form groups.\n *\n * Creates a scoped form context with its own validation state.\n * Child fields receive a FIELD_SIGNAL_CONTEXT scoped to this group's form instance.\n * Group values are nested under the group's key in the parent form.\n */\n@Component({\n selector: 'fieldset[group-field]',\n imports: [NgComponentOutlet],\n template: `\n @for (field of resolvedFields(); track field.key) {\n <ng-container *ngComponentOutlet=\"field.component; injector: field.injector; inputs: field.inputs()\" />\n }\n `,\n styleUrl: './group-field.component.scss',\n host: {\n class: 'df-field df-group',\n role: 'group',\n '[class.disabled]': 'disabled()',\n '[id]': '`${key()}`',\n '[attr.data-testid]': 'key()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class GroupFieldComponent<TModel = Record<string, unknown>> {\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly parentFieldSignalContext = inject(FIELD_SIGNAL_CONTEXT) as FieldSignalContext<TModel>;\n private readonly injector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Memoized Functions\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly memoizedFlattenFields = memoize(\n (fields: readonly FieldDef<unknown>[], registry: Map<string, FieldTypeDefinition>) => flattenFields([...fields], registry),\n (fields, registry) =>\n JSON.stringify(fields.map((f) => ({ key: f.key, type: f.type }))) + '_' + Array.from(registry.keys()).sort().join(','),\n );\n\n private readonly memoizedKeyBy = memoize(\n <T extends { key: string }>(fields: T[]) => keyBy(fields, 'key'),\n (fields) => fields.map((f) => f.key).join(','),\n );\n\n private readonly memoizedDefaultValues = memoize(\n <T extends FieldDef<unknown>>(fieldsById: Record<string, T>, registry: Map<string, FieldTypeDefinition>) =>\n mapValues(fieldsById, (field) => getFieldDefaultValue(field, registry)),\n (fieldsById, registry) => Object.keys(fieldsById).sort().join(',') + '_' + Array.from(registry.keys()).sort().join(','),\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n field = input.required<GroupField>();\n key = input.required<string>();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n private readonly formSetup = computed(() => {\n try {\n const groupField = this.field();\n const registry = this.rawFieldRegistry();\n\n if (groupField.fields && groupField.fields.length > 0) {\n const flattenedFields = this.memoizedFlattenFields(groupField.fields, registry);\n const fieldsById = this.memoizedKeyBy(flattenedFields);\n const defaultValues = this.memoizedDefaultValues(fieldsById, registry);\n\n return {\n fields: flattenedFields,\n originalFields: groupField.fields,\n defaultValues,\n registry,\n };\n }\n\n return {\n fields: [],\n originalFields: [],\n defaultValues: {},\n registry,\n };\n } catch {\n return {\n fields: [],\n originalFields: [],\n defaultValues: {},\n registry: this.rawFieldRegistry(),\n };\n }\n });\n\n readonly defaultValues = linkedSignal(() => this.formSetup().defaultValues);\n\n private readonly entity = linkedSignal(() => {\n const parentValue = this.parentFieldSignalContext.value();\n const groupKey = this.field().key;\n const defaults = this.defaultValues();\n const groupValue = (parentValue as Record<string, unknown>)?.[groupKey] || {};\n return { ...defaults, ...groupValue };\n });\n\n private readonly form = computed(() => {\n return runInInjectionContext(this.injector, () => {\n const setup = this.formSetup();\n\n if (setup.fields.length > 0) {\n const schema = createSchemaFromFields(setup.fields, setup.registry);\n return untracked(() => form(this.entity, schema));\n }\n\n return untracked(() => form(this.entity));\n });\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public State Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly formValue = computed(() => this.entity());\n readonly valid = computed(() => this.form()().valid());\n readonly invalid = computed(() => this.form()().invalid());\n readonly dirty = computed(() => this.form()().dirty());\n readonly touched = computed(() => this.form()().touched());\n readonly errors = computed(() => this.form()().errors());\n readonly disabled = computed(() => this.form()().disabled());\n\n /**\n * Get the nested FieldTree from the parent form for this group.\n * This allows child fields to update the parent form directly,\n * avoiding the need for separate form synchronization.\n */\n private readonly nestedFieldTree = computed(() => {\n const parentForm = this.parentFieldSignalContext.form();\n const groupKey = this.field().key;\n return getChildFieldTree(parentForm, groupKey);\n });\n\n private readonly groupInjector = computed(() => {\n const nestedTree = this.nestedFieldTree();\n\n // Use the nested FieldTree from parent if available, otherwise fall back to our own form\n // The nested FieldTree ensures changes propagate directly to the parent form\n const formToProvide = nestedTree ?? this.form();\n\n const groupFieldSignalContext: FieldSignalContext<Record<string, unknown>> = {\n injector: this.injector,\n value: this.parentFieldSignalContext.value,\n defaultValues: this.defaultValues,\n form: (() => formToProvide) as unknown as ReturnType<typeof form<Record<string, unknown>>>,\n defaultValidationMessages: this.parentFieldSignalContext.defaultValidationMessages,\n };\n\n return Injector.create({\n parent: this.injector,\n providers: [\n {\n provide: FIELD_SIGNAL_CONTEXT,\n useValue: groupFieldSignalContext,\n },\n ],\n });\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Outputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly validityChange = outputFromObservable(toObservable(this.valid));\n readonly dirtyChange = outputFromObservable(toObservable(this.dirty));\n readonly submitted = outputFromObservable(this.eventBus.on<SubmitEvent>('submit'));\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Field Resolution\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly fieldsSource = computed(() => this.formSetup().fields);\n\n protected readonly resolvedFields = derivedFromDeferred(\n this.fieldsSource,\n pipe(\n switchMap((fields) => {\n if (!fields || fields.length === 0) {\n return of([] as (ResolvedField | undefined)[]);\n }\n const groupKey = this.field().key;\n const context = {\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n registry: this.rawFieldRegistry(),\n injector: this.groupInjector(),\n destroyRef: this.destroyRef,\n onError: (fieldDef: FieldDef<unknown>, error: unknown) => {\n const fieldKey = fieldDef.key || '<no key>';\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${fieldDef.type}' (key: ${fieldKey}) ` +\n `within group '${groupKey}'. Ensure the field type is registered in your field registry.`,\n error,\n );\n },\n };\n return forkJoin(fields.map((f) => resolveField(f, context)));\n }),\n map((fields) => fields.filter((f): f is ResolvedField => f !== undefined)),\n scan(reconcileFields, [] as ResolvedField[]),\n ),\n { initialValue: [] as ResolvedField[], injector: this.injector },\n );\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Constructor\n // ─────────────────────────────────────────────────────────────────────────────\n\n constructor() {\n this.setupEffects();\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Private Methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n private setupEffects(): void {\n // Emit initialization event when fields are resolved\n explicitEffect([this.resolvedFields], ([fields]) => {\n if (fields.length > 0) {\n emitComponentInitialized(this.eventBus, 'group', this.field().key, this.injector);\n }\n });\n }\n}\n\nexport { GroupFieldComponent };\n","import { Injector, Signal, type Type } from '@angular/core';\n\n/**\n * Generates a unique identifier for array items.\n * Uses crypto.randomUUID() for collision-free IDs that remain stable across position changes.\n */\nexport function generateArrayItemId(): string {\n return crypto.randomUUID();\n}\n\n/**\n * Resolved array item ready for declarative rendering with ngComponentOutlet.\n * Each item has a stable unique ID and a linkedSignal-based index that\n * automatically updates when items are added/removed.\n */\nexport interface ResolvedArrayItem {\n /** Unique identifier for this item (stable across position changes). */\n id: string;\n /** The loaded component type. */\n component: Type<unknown>;\n /** Injector providing ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT. */\n injector: Injector;\n /** Inputs signal for ngComponentOutlet - evaluated in template for reactivity. */\n inputs: Signal<Record<string, unknown>>;\n}\n\n/**\n * Safely extracts an array value from a model object.\n * Returns empty array if the key doesn't exist or value isn't an array.\n */\nexport function getArrayValue<TModel>(value: Partial<TModel> | undefined, key: string): unknown[] {\n const arrayValue = (value as Record<string, unknown>)?.[key];\n return Array.isArray(arrayValue) ? arrayValue : [];\n}\n\n/**\n * Discriminated union of possible differential update operations.\n * Enables optimized array updates without full recreation when possible.\n */\nexport type DifferentialUpdateOperation =\n | { type: 'clear' }\n | { type: 'initial'; fieldTreesLength: number }\n | { type: 'append'; startIndex: number; endIndex: number }\n | { type: 'pop'; newLength: number }\n | { type: 'recreate' }\n | { type: 'none' };\n\n/**\n * Determines the optimal differential update operation based on current and new state.\n *\n * Operations:\n * - Clear all (empty array)\n * - Initial render (no existing items)\n * - Append only (items added at end)\n * - Pop only (items removed from end)\n * - None (same length - items update via linkedSignal)\n */\nexport function determineDifferentialOperation(currentItems: ResolvedArrayItem[], newLength: number): DifferentialUpdateOperation {\n const currentLength = currentItems.length;\n\n if (newLength === 0) {\n return { type: 'clear' };\n }\n\n if (currentLength === 0) {\n return { type: 'initial', fieldTreesLength: newLength };\n }\n\n // For all length changes, we optimize by assuming existing items stay in place.\n // Items handle their own value updates via linkedSignal - no need to compare snapshots.\n // Snapshot comparison was causing false \"recreate\" when existing items had been edited.\n\n if (newLength > currentLength) {\n // Items added - append new ones, existing items stay\n return { type: 'append', startIndex: currentLength, endIndex: newLength };\n }\n\n if (newLength < currentLength) {\n // Items removed - pop from end, remaining items stay\n return { type: 'pop', newLength };\n }\n\n // Same length - no structural change, items update via linkedSignal\n return { type: 'none' };\n}\n","import { Injector, runInInjectionContext, Signal, untracked, linkedSignal } from '@angular/core';\nimport { FieldTree, form } from '@angular/forms/signals';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { ArrayField } from '../../definitions/default/array-field';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { ArrayContext, FieldSignalContext } from '../../mappers/types';\nimport { ARRAY_CONTEXT, FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { mapFieldToInputs } from '../field-mapper/field-mapper';\nimport { flattenFields } from '../flattener/field-flattener';\nimport { createSchemaFromFields } from '../../core/schema-builder';\nimport { getArrayValue } from './array-field.types';\n\n/**\n * Options for creating an array item injector.\n */\nexport interface CreateArrayItemInjectorOptions<TModel> {\n /** The field tree for this item (null for object items without existing FieldTree). */\n fieldTree: FieldTree<unknown> | null;\n /** The field template defining the array item structure. */\n template: FieldDef<unknown>;\n /** Signal containing the current index (uses linkedSignal for auto-updates). */\n indexSignal: Signal<number>;\n /** Parent context for accessing form state and values. */\n parentFieldSignalContext: FieldSignalContext<TModel>;\n /** Parent injector for creating scoped child injector. */\n parentInjector: Injector;\n /** Field registry for looking up field type definitions. */\n registry: Map<string, FieldTypeDefinition>;\n /** The array field definition containing this item. */\n arrayField: ArrayField;\n}\n\n/**\n * Result of creating an array item injector.\n */\nexport interface ArrayItemInjectorResult {\n /** Scoped injector providing ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT. */\n injector: Injector;\n /** Inputs signal for ngComponentOutlet, mapped from the field template. */\n inputs: Signal<Record<string, unknown>>;\n}\n\n/**\n * Syncs item form value changes back to the parent form's array.\n * This effect watches the item form value and updates the parent array when changes occur.\n */\nfunction syncItemToParent<TModel>(\n itemFormInstance: ReturnType<typeof form<unknown>>,\n parentFieldSignalContext: FieldSignalContext<TModel>,\n arrayKey: string,\n indexSignal: Signal<number>,\n injector: Injector,\n): void {\n // Track if we're currently syncing to prevent loops\n let isSyncing = false;\n\n runInInjectionContext(injector, () => {\n // The form instance is callable - call it to get the form state with .value()\n explicitEffect([() => itemFormInstance().value()], ([itemValue]) => {\n if (isSyncing) return;\n\n const parentForm = parentFieldSignalContext.form();\n const parentValue = untracked(() => parentForm.value()) as Record<string, unknown>;\n const currentArray = getArrayValue(parentValue as Partial<TModel>, arrayKey);\n const idx = untracked(() => indexSignal());\n\n // Only sync if value actually changed\n if (idx >= 0 && idx < currentArray.length && currentArray[idx] !== itemValue) {\n isSyncing = true;\n const newArray = [...currentArray];\n newArray[idx] = itemValue;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentForm.value.set({ ...parentValue, [arrayKey]: newArray } as any);\n isSyncing = false;\n }\n });\n });\n}\n\n/**\n * Creates an injector and inputs for an array item.\n *\n * Handles different item types (flatten, group, regular) by creating appropriate\n * form references and scoped injectors with ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT.\n * Sets up two-way sync to propagate item form changes back to the parent form.\n */\nexport function createArrayItemInjectorAndInputs<TModel>(options: CreateArrayItemInjectorOptions<TModel>): ArrayItemInjectorResult {\n const { fieldTree, template, indexSignal, parentFieldSignalContext, parentInjector, registry, arrayField } = options;\n\n // Create item form - uses linkedSignal that derives from parent\n const formRef =\n fieldTree ??\n createObjectItemForm({\n template,\n indexSignal,\n parentFieldSignalContext,\n parentInjector,\n registry,\n arrayKey: arrayField.key,\n });\n\n const injector = createItemInjector({\n formRef,\n indexSignal,\n parentFieldSignalContext,\n parentInjector,\n arrayField,\n });\n\n // Set up two-way sync: item form changes -> parent form array\n // Only sync for locally created forms (not external FieldTrees)\n if (!fieldTree) {\n syncItemToParent(formRef as ReturnType<typeof form<unknown>>, parentFieldSignalContext, arrayField.key, indexSignal, injector);\n }\n\n const inputs = runInInjectionContext(injector, () => {\n return mapFieldToInputs(template, registry);\n });\n\n return { injector, inputs };\n}\n\ninterface CreateObjectItemFormOptions<TModel> {\n template: FieldDef<unknown>;\n indexSignal: Signal<number>;\n parentFieldSignalContext: FieldSignalContext<TModel>;\n parentInjector: Injector;\n registry: Map<string, FieldTypeDefinition>;\n arrayKey: string;\n}\n\n/**\n * Creates a local form for an object array item using linkedSignal.\n * The linkedSignal derives from the parent array at the current index.\n *\n * For array items, we always create a form with a schema to ensure proper field structure.\n * This is needed for valueFieldMapper to find fields via childrenMap.\n */\nfunction createObjectItemForm<TModel>(options: CreateObjectItemFormOptions<TModel>): ReturnType<typeof form<unknown>> {\n const { template, indexSignal, parentFieldSignalContext, parentInjector, registry, arrayKey } = options;\n\n const itemEntity = linkedSignal(() => {\n const parentValue = parentFieldSignalContext.value();\n const arrayValue = getArrayValue(parentValue as Partial<TModel>, arrayKey);\n return arrayValue[indexSignal()] ?? {};\n });\n\n const nestedFields = 'fields' in template && Array.isArray(template.fields) ? template.fields : [];\n\n return runInInjectionContext(parentInjector, () => {\n // Determine which fields to include in the schema\n // - If template has nested fields (e.g., row with children), use those\n // - Otherwise use the template itself as a single-field schema\n const schemaFields = nestedFields.length > 0 ? nestedFields : [template];\n const flattenedFields = flattenFields(schemaFields, registry);\n const schema = createSchemaFromFields(flattenedFields, registry);\n return untracked(() => form(itemEntity, schema));\n });\n}\n\ninterface CreateItemInjectorOptions<TModel> {\n formRef: FieldTree<unknown> | ReturnType<typeof form<unknown>>;\n indexSignal: Signal<number>;\n parentFieldSignalContext: FieldSignalContext<TModel>;\n parentInjector: Injector;\n arrayField: ArrayField;\n}\n\n/**\n * Creates a scoped injector for an array item.\n * Provides both FIELD_SIGNAL_CONTEXT (for form access) and ARRAY_CONTEXT (for position awareness).\n */\nfunction createItemInjector<TModel>(options: CreateItemInjectorOptions<TModel>): Injector {\n const { formRef, indexSignal, parentFieldSignalContext, parentInjector, arrayField } = options;\n\n const arrayContext: ArrayContext = {\n arrayKey: arrayField.key,\n index: indexSignal,\n formValue: parentFieldSignalContext.value(),\n field: arrayField,\n };\n\n const itemFieldSignalContext: FieldSignalContext<unknown> = {\n injector: undefined as unknown as Injector,\n value: parentFieldSignalContext.value,\n defaultValues: () => ({}),\n // formRef is already the form instance (result of form()), no need to wrap in another function\n form: formRef as unknown as ReturnType<typeof form<unknown>>,\n defaultValidationMessages: parentFieldSignalContext.defaultValidationMessages,\n };\n\n const injector = Injector.create({\n parent: parentInjector,\n providers: [\n { provide: FIELD_SIGNAL_CONTEXT, useValue: itemFieldSignalContext },\n { provide: ARRAY_CONTEXT, useValue: arrayContext },\n ],\n });\n\n itemFieldSignalContext.injector = injector;\n\n return injector;\n}\n","import { DestroyRef, Injector, linkedSignal, Signal } from '@angular/core';\nimport { FieldTree } from '@angular/forms/signals';\nimport { catchError, from, map, Observable, of } from 'rxjs';\nimport { ArrayField } from '../../definitions/default/array-field';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { FieldSignalContext } from '../../mappers/types';\nimport { FieldTypeDefinition } from '../../models/field-type';\nimport { generateArrayItemId, ResolvedArrayItem } from './array-field.types';\nimport { createArrayItemInjectorAndInputs } from './create-array-item-injector';\n\n/**\n * Options for resolving an array item.\n */\nexport interface ResolveArrayItemOptions<TModel> {\n /** The field tree for this item (null for object items). */\n fieldTree: FieldTree<unknown> | null;\n /** The initial index of this item in the array. */\n index: number;\n /** The field template defining the array item structure. */\n template: FieldDef<unknown>;\n /** The array field definition containing this item. */\n arrayField: ArrayField;\n /** Signal containing ordered item IDs for reactive index derivation. */\n itemOrderSignal: Signal<string[]>;\n /** Parent context for accessing form state and values. */\n parentFieldSignalContext: FieldSignalContext<TModel>;\n /** Parent injector for creating scoped child injector. */\n parentInjector: Injector;\n /** Field registry for looking up field type definitions. */\n registry: Map<string, FieldTypeDefinition>;\n /** DestroyRef to abort resolution if component is destroyed. */\n destroyRef: DestroyRef;\n /** Function to async load the component for the field type. */\n loadTypeComponent: (type: string) => Promise<unknown>;\n}\n\n/**\n * Resolves a single array item for declarative rendering.\n *\n * Uses linkedSignal for the index, which automatically updates when itemOrderSignal changes.\n * This enables position-aware updates without recreating components when items are reordered.\n */\nexport function resolveArrayItem<TModel>(options: ResolveArrayItemOptions<TModel>): Observable<ResolvedArrayItem | undefined> {\n const {\n fieldTree,\n index,\n template,\n arrayField,\n itemOrderSignal,\n parentFieldSignalContext,\n parentInjector,\n registry,\n destroyRef,\n loadTypeComponent,\n } = options;\n\n return from(loadTypeComponent(template.type)).pipe(\n map((component) => {\n if (destroyRef.destroyed) {\n return undefined;\n }\n\n const itemId = generateArrayItemId();\n\n const indexSignal = linkedSignal(() => {\n const order = itemOrderSignal();\n const idx = order.indexOf(itemId);\n return idx >= 0 ? idx : index;\n });\n\n const { injector, inputs } = createArrayItemInjectorAndInputs({\n fieldTree,\n template,\n indexSignal,\n parentFieldSignalContext,\n parentInjector,\n registry,\n arrayField,\n });\n\n return {\n id: itemId,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: component as any,\n injector,\n inputs,\n };\n }),\n catchError((error) => {\n if (!destroyRef.destroyed) {\n console.error(\n `[Dynamic Forms] Failed to load component for field type '${template.type}' at index ${index} ` +\n `within array '${arrayField.key}'. Ensure the field type is registered in your field registry.`,\n error,\n );\n }\n return of(undefined);\n }),\n );\n}\n","import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, Injector, input, linkedSignal, signal } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter, forkJoin, map, Observable, of } from 'rxjs';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { ArrayField } from '../../definitions/default/array-field';\nimport { injectFieldRegistry } from '../../utils/inject-field-registry/inject-field-registry';\nimport { FieldTree } from '@angular/forms/signals';\nimport { FieldDef } from '../../definitions/base/field-def';\nimport { getFieldDefaultValue } from '../../utils/default-value/default-value';\nimport { getFieldValueHandling } from '../../models/field-type';\nimport { emitComponentInitialized } from '../../utils/emit-initialization/emit-initialization';\nimport { AddArrayItemEvent } from '../../events/constants/add-array-item.event';\nimport { RemoveArrayItemEvent } from '../../events/constants/remove-array-item.event';\nimport { EventBus } from '../../events/event.bus';\nimport { FieldSignalContext } from '../../mappers/types';\nimport { FIELD_SIGNAL_CONTEXT } from '../../models/field-signal-context.token';\nimport { getChildFieldTree } from '../../utils/form-internals/form-internals';\nimport { determineDifferentialOperation, getArrayValue, ResolvedArrayItem } from '../../utils/array-field/array-field.types';\nimport { resolveArrayItem } from '../../utils/array-field/resolve-array-item';\n\n/**\n * Container component for rendering dynamic arrays of fields.\n *\n * Supports add/remove operations via AddArrayItemEvent and RemoveArrayItemEvent.\n * Uses differential updates to optimize rendering - only recreates items when necessary.\n * Each item gets a scoped injector with ARRAY_CONTEXT for position-aware operations.\n */\n@Component({\n selector: 'array-field',\n imports: [NgComponentOutlet],\n template: `\n @for (item of resolvedItems(); track item.id) {\n <ng-container *ngComponentOutlet=\"item.component; injector: item.injector; inputs: item.inputs()\" />\n }\n `,\n styleUrl: './array-field.component.scss',\n host: {\n class: 'df-field df-array',\n '[id]': '`${key()}`',\n '[attr.data-testid]': 'key()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class ArrayFieldComponent<TModel = Record<string, unknown>> {\n // ─────────────────────────────────────────────────────────────────────────────\n // Dependencies\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly fieldRegistry = injectFieldRegistry();\n private readonly parentFieldSignalContext = inject(FIELD_SIGNAL_CONTEXT) as FieldSignalContext<TModel>;\n private readonly parentInjector = inject(Injector);\n private readonly eventBus = inject(EventBus);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Inputs\n // ─────────────────────────────────────────────────────────────────────────────\n\n field = input.required<ArrayField>();\n key = input.required<string>();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Computed Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly rawFieldRegistry = computed(() => this.fieldRegistry.raw);\n\n private readonly fieldTemplate = computed<FieldDef<unknown> | null>(() => {\n const arrayField = this.field();\n return arrayField.fields && arrayField.fields.length > 0 ? arrayField.fields[0] : null;\n });\n\n private readonly arrayFieldTrees = computed<readonly (FieldTree<unknown> | null)[]>(() => {\n const arrayKey = this.field().key;\n const parentForm = this.parentFieldSignalContext.form();\n const arrayValue = getArrayValue(this.parentFieldSignalContext.value(), arrayKey);\n\n if (arrayValue.length === 0) return [];\n\n // Get the array FieldTree from the parent form\n const arrayFieldTree = getChildFieldTree(parentForm, arrayKey);\n if (!arrayFieldTree) return arrayValue.map(() => null);\n\n // Access array items via bracket notation - Angular Signal Forms arrays support this\n // The type is ReadonlyArrayLike<MaybeFieldTree<U, number>>\n const arrayWithIndex = arrayFieldTree as unknown as readonly (FieldTree<unknown> | undefined)[];\n\n const items: (FieldTree<unknown> | null)[] = [];\n for (let i = 0; i < arrayValue.length; i++) {\n // Access item FieldTree directly via bracket notation\n const itemFieldTree = arrayWithIndex[i];\n items.push(itemFieldTree ?? null);\n }\n\n return items;\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // State Signals\n // ─────────────────────────────────────────────────────────────────────────────\n\n private readonly resolvedItemsSignal = signal<ResolvedArrayItem[]>([]);\n private readonly updateVersion = signal(0);\n private readonly itemOrderSignal = linkedSignal(() => this.resolvedItemsSignal().map((item) => item.id));\n\n readonly resolvedItems = linkedSignal(() => this.resolvedItemsSignal());\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Constructor\n // ─────────────────────────────────────────────────────────────────────────────\n\n constructor() {\n this.setupEffects();\n this.setupEventHandlers();\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Private Methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n private setupEffects(): void {\n // Sync field components when array data changes\n explicitEffect([this.arrayFieldTrees], ([fieldTrees]) => {\n this.updateVersion.update((v) => v + 1);\n const currentVersion = this.updateVersion();\n this.performDifferentialUpdate(fieldTrees, currentVersion);\n });\n }\n\n private setupEventHandlers(): void {\n // Handle add item events\n this.eventBus\n .on<AddArrayItemEvent>('add-array-item')\n .pipe(\n takeUntilDestroyed(),\n filter((event) => event.arrayKey === this.key()),\n )\n .subscribe((event) => this.addItem(event.field ?? this.fieldTemplate(), event.index));\n\n // Handle remove item events\n this.eventBus\n .on<RemoveArrayItemEvent>('remove-array-item')\n .pipe(\n takeUntilDestroyed(),\n filter((event) => event.arrayKey === this.key()),\n )\n .subscribe((event) => this.removeItem(event.index));\n }\n\n private performDifferentialUpdate(fieldTrees: readonly (FieldTree<unknown> | null)[], updateId: number): void {\n const resolvedItems = this.resolvedItemsSignal();\n const operation = determineDifferentialOperation(resolvedItems, fieldTrees.length);\n\n switch (operation.type) {\n case 'clear':\n this.resolvedItemsSignal.set([]);\n break;\n case 'initial':\n this.resolveAllItems(fieldTrees, updateId);\n break;\n case 'append':\n this.appendItems(fieldTrees, operation.startIndex, operation.endIndex, updateId);\n break;\n case 'pop':\n this.resolvedItemsSignal.set(resolvedItems.slice(0, operation.newLength));\n break;\n case 'recreate':\n this.resolvedItemsSignal.set([]);\n this.resolveAllItems(fieldTrees, updateId);\n break;\n case 'none':\n break;\n }\n }\n\n private resolveAllItems(fieldTrees: readonly (FieldTree<unknown> | null)[], updateId: number): void {\n if (fieldTrees.length === 0) {\n this.resolvedItemsSignal.set([]);\n return;\n }\n\n const itemObservables = fieldTrees.map((fieldTree, i) => this.createResolveItemObservable(fieldTree, i));\n\n forkJoin(itemObservables)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((items) => items.filter((item): item is ResolvedArrayItem => item !== undefined)),\n )\n .subscribe((newItems) => {\n if (updateId === this.updateVersion()) {\n this.resolvedItemsSignal.set(newItems);\n emitComponentInitialized(this.eventBus, 'array', this.field().key, this.parentInjector);\n }\n });\n }\n\n private appendItems(fieldTrees: readonly (FieldTree<unknown> | null)[], startIndex: number, endIndex: number, updateId: number): void {\n const itemsToResolve = fieldTrees.slice(startIndex, endIndex);\n if (itemsToResolve.length === 0) return;\n\n const itemObservables = itemsToResolve.map((fieldTree, i) => this.createResolveItemObservable(fieldTree, startIndex + i));\n\n forkJoin(itemObservables)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((items) => items.filter((item): item is ResolvedArrayItem => item !== undefined)),\n )\n .subscribe((newItems) => {\n if (updateId === this.updateVersion()) {\n this.resolvedItemsSignal.update((current) => [...current, ...newItems]);\n }\n });\n }\n\n private createResolveItemObservable(fieldTree: FieldTree<unknown> | null, index: number): Observable<ResolvedArrayItem | undefined> {\n const template = this.fieldTemplate();\n if (!template) return of(undefined);\n\n return resolveArrayItem({\n fieldTree,\n index,\n template,\n arrayField: this.field(),\n itemOrderSignal: this.itemOrderSignal,\n parentFieldSignalContext: this.parentFieldSignalContext,\n parentInjector: this.parentInjector,\n registry: this.rawFieldRegistry(),\n destroyRef: this.destroyRef,\n loadTypeComponent: (type: string) => this.fieldRegistry.loadTypeComponent(type),\n });\n }\n\n private addItem(fieldTemplate: FieldDef<unknown> | null, index?: number): void {\n if (!fieldTemplate) {\n console.error(\n `[Dynamic Forms] Cannot add item to array '${this.field().key}': no field template provided. ` +\n 'Ensure the array field has a fields property with at least one field definition.',\n );\n return;\n }\n\n const arrayKey = this.field().key;\n const formObject = this.parentFieldSignalContext.form();\n const currentValue = formObject.value() as TModel;\n const currentArray = getArrayValue(currentValue as Partial<TModel>, arrayKey);\n const insertIndex = index !== undefined ? Math.min(index, currentArray.length) : currentArray.length;\n\n const rawValue = getFieldDefaultValue(fieldTemplate, this.rawFieldRegistry());\n const valueHandling = getFieldValueHandling(fieldTemplate.type, this.rawFieldRegistry());\n\n // For fields with 'include' value handling (bare fields like input, checkbox, etc.),\n // wrap the value in an object using the field's key since arrays contain objects\n const value = valueHandling === 'include' && fieldTemplate.key ? { [fieldTemplate.key]: rawValue } : rawValue;\n\n const newArray = [...currentArray];\n newArray.splice(insertIndex, 0, value);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formObject.value.set({ ...currentValue, [arrayKey]: newArray } as any);\n }\n\n private removeItem(index?: number): void {\n const arrayKey = this.field().key;\n const formObject = this.parentFieldSignalContext.form();\n const currentValue = formObject.value() as TModel;\n const currentArray = getArrayValue(currentValue as Partial<TModel>, arrayKey);\n\n if (currentArray.length === 0) return;\n\n const removeIndex = index !== undefined ? Math.min(index, currentArray.length - 1) : currentArray.length - 1;\n const newArray = [...currentArray];\n newArray.splice(removeIndex, 1);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formObject.value.set({ ...currentValue, [arrayKey]: newArray } as any);\n }\n}\n\nexport { ArrayFieldComponent };\n","/**\n * @ng-forge/dynamic-forms\n *\n * Dynamic forms library for Angular applications.\n *\n * ## Public API (for end users)\n * - DynamicForm component\n * - provideDynamicForm() for configuration\n * - FormConfig and field definition types\n * - Event classes (SubmitEvent, PageChangeEvent, etc.)\n *\n * ## Integration API (for UI library authors building Material, Bootstrap, etc.)\n * - Mappers (baseFieldMapper, valueFieldMapper, etc.)\n * - FieldTypeDefinition for registering field types\n * - DynamicTextPipe, shouldShowErrors, createResolvedErrorsSignal\n * - EventBus for custom event handling\n */\n\n// ============================================================\n// PUBLIC API - For end users\n// ============================================================\n\n// Core Component\nexport { DynamicForm } from './dynamic-form.component';\n\n// Provider System\nexport { provideDynamicForm } from './providers';\nexport type { ExtractFieldDefs, ExtractFormValue } from './providers';\n\n// Configuration Types\nexport type { CustomFnConfig, FormConfig, FormOptions } from './models';\n\nexport type { DynamicText, FieldOption, ValidationError, ValidationMessages } from './models';\n\n// Submission Config\nexport type { SubmissionConfig, SubmissionActionResult, SubmitButtonOptions, NextButtonOptions } from './models';\n\n// Form State Condition\nexport type { FormStateCondition } from './models';\nexport { isFormStateCondition } from './models';\n\n// Button Logic Resolver (for UI library authors)\nexport { resolveSubmitButtonDisabled, resolveNextButtonDisabled } from './core/logic';\nexport type { ButtonLogicContext } from './core/logic';\n\n// Field Definition Types\nexport type {\n ArrayField,\n BaseCheckedField,\n BaseValueField,\n ButtonField,\n CheckboxField,\n CheckedFieldComponent,\n DatepickerField,\n DatepickerProps,\n FieldComponent,\n FieldDef,\n FieldWithValidation,\n GroupField,\n InputField,\n InputProps,\n MultiCheckboxField,\n PageField,\n RadioField,\n RowField,\n SelectField,\n SelectProps,\n SliderField,\n TextareaField,\n TextareaProps,\n TextElementType,\n TextField,\n TextProps,\n ToggleField,\n ValueFieldComponent,\n ValueType,\n} from './definitions';\n\nexport { isCheckedField, isValueField } from './definitions';\n\n// Validation Config Types\nexport type {\n AsyncValidatorConfig,\n BaseValidatorConfig,\n BuiltInValidatorConfig,\n CustomValidatorConfig,\n HttpValidatorConfig,\n ValidatorConfig,\n} from './models';\n\n// Validator Function Types (for customFnConfig)\nexport type { AsyncCustomValidator, CustomValidator, HttpCustomValidator } from './core/validation';\n\n// Logic & Expression Types\nexport type { ConditionalExpression, EvaluationContext, LogicConfig } from './models';\n\n// Schema Types\nexport type { SchemaApplicationConfig, SchemaDefinition } from './models';\n\n// Registry Types (for module augmentation)\nexport type {\n AvailableFieldTypes,\n ContainerFieldTypes,\n DynamicFormFieldRegistry,\n ExtractField,\n FieldRegistryContainers,\n FieldRegistryLeaves,\n LeafFieldTypes,\n NarrowField,\n NarrowFields,\n RegisteredFieldTypes,\n} from './models';\n\n// Utility Types\nexport type {\n ArrayAllowedChildren,\n FieldPathAccess,\n FormMode,\n FormModeDetectionResult,\n GroupAllowedChildren,\n InferFormValue,\n PageAllowedChildren,\n Prettify,\n RowAllowedChildren,\n WithInputSignals,\n} from './models';\n\n// Type Guards\nexport {\n isArrayField,\n isContainerField,\n isDisplayOnlyField,\n isGroupField,\n isLeafField,\n isPageField,\n isRowField,\n isValueBearingField,\n} from './models';\n\n// Events\nexport {\n AddArrayItemEvent,\n FormClearEvent,\n FormResetEvent,\n NextPageEvent,\n PageChangeEvent,\n PreviousPageEvent,\n RemoveArrayItemEvent,\n SubmitEvent,\n} from './events';\n\nexport type { FormEvent } from './events';\n\n// ============================================================\n// INTEGRATION API - For UI library authors\n// (Material, Bootstrap, PrimeNG, Ionic, etc.)\n// ============================================================\n\n// Mappers - for creating FieldTypeDefinition\nexport {\n arrayFieldMapper,\n baseFieldMapper,\n buildBaseInputs,\n checkboxFieldMapper,\n datepickerFieldMapper,\n groupFieldMapper,\n pageFieldMapper,\n optionsFieldMapper,\n rowFieldMapper,\n valueFieldMapper,\n} from './mappers';\n\nexport type { ArrayContext, FieldSignalContext, MapperFn } from './mappers';\n\n// Field Type Definition - for registering custom field types\nexport type { FieldTypeDefinition, ValueHandlingMode } from './models';\nexport { FIELD_REGISTRY, getFieldValueHandling } from './models';\n\n// Signal Context - injection tokens for field components\nexport { ARRAY_CONTEXT, FIELD_SIGNAL_CONTEXT } from './models';\n\n// Error Display Utilities - for field components\nexport { createResolvedErrorsSignal, shouldShowErrors } from './utils';\nexport type { ResolvedError } from './utils';\n\n// Dynamic Text - for translatable labels\nexport { dynamicTextToObservable } from './utils';\nexport { DynamicTextPipe } from './pipes';\n\n// Container Components - for building custom containers\nexport { ArrayFieldComponent, GroupFieldComponent, RowFieldComponent } from './fields';\n\n// Validation - for applying validators in custom fields\nexport { applyValidator, applyValidators } from './core/validation';\nexport type { HttpResourceRequest } from './core/validation';\n\n// Event Utilities - for custom event handling\nexport { EventBus } from './events';\nexport { resolveTokens } from './events';\nexport type { ArrayItemContext, FormEventConstructor, TokenContext } from './events';\n\n// Registry Utilities\nexport { injectFieldRegistry } from './utils/inject-field-registry/inject-field-registry';\nexport { BUILT_IN_FIELDS } from './providers';\n\n// Event Args Type\nexport type { EventArgs } from './definitions';\n\n// Form Internals - for advanced container field implementations\nexport { getChildFieldTree, getChildrenMap, getFieldProxy, hasFormStructure } from './utils/form-internals';\nexport type { FormInternals } from './utils/form-internals';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["toSupportedPath","isContainerWithFields","map","filter","switchMap","scan"],"mappings":";;;;;;;;;AA+BA;;AAEG;AACH,SAAS,aAAa,CAAC,KAAc,EAAA;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtE;AAEA;;AAEG;AACH,SAAS,cAAc,CAAC,KAAc,EAAA;AACpC,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrI;AAyDA;SACgB,mBAAmB,CACjC,MAAuE,EACvE,QAAsE,EACtE,OAAsC,EAAA;AAEtC,IAAA,MAAM,SAAS,GAAkB,KAAK,CAAC,MAAK;;AAE1C,QAAA,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;AACpB,YAAA,OAAO,YAAY,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC7D;;AAGA,QAAA,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,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