/** * Utility for matching field configurations between readonly and editable view definitions. * * This module provides functionality to find editable field configurations from a view definition * by matching property names. Useful when you have a readonly view and need to find the corresponding * editable configuration for rendering. * * Two-step matching algorithm: * 1. Collect all children whose config.value matches the field name → return all matches * 2. If no value matches found, collect all children whose config.authorContext matches * the field name AND type === "View" → resolve views and return all resolved matches */ import type { ComponentMetadataConfig } from '../interpreter/types'; type ViewNode = Omit & { config?: Record; children?: ViewNode[]; }; export type ViewResolver = (name: string) => ViewNode[] | ViewNode | null | undefined; /** * Result of a successful field match */ export interface MatchedFieldConfig { /** The field type (e.g., 'ObjectReference', 'TextInput', 'View') */ type?: string; /** The field configuration object (or resolved view for View types) */ config: Record; /** Path to the field in the view tree for debugging */ path?: string; children?: ViewNode[]; } /** * Finds all editable field configurations for a given field name in a view definition. * * Algorithm: * Step 1 – Collect all children whose `config.value` references the field name. * If any found, return them (skip Step 2). * Step 2 – If no value matches, collect all children whose `config.authorContext` * references the field name AND whose `type` is `"View"`. * Resolve each view by its `name` via `resolveView(name)` and return * all resolved views. * * @param fieldName - The property name to find (e.g. 'CaseRefTable', 'pyDescription', 'Product') * @param caseClass - The case class for resolving the edit view * @param viewResolver - Resolver function for view metadata * @returns All matched configs (value matches take priority over authorContext matches) */ export declare function getEditableFieldConfig(fieldName: string, caseClass: string, viewResolver: ViewResolver): MatchedFieldConfig[]; export {};