/** * Field Engine โ€” Pure functions for deriving UI descriptors from field definitions. * * All functions are pure (no React hooks, no side effects). * `code` and `name` fields are ALWAYS sortable regardless of the `sortable` flag. * * @module fieldEngine * @see FMPV-MVWC-E001-S004 */ import type { MasterPatternViewDefinition, MasterPatternViewFieldDefinition, MasterPatternViewInputType, MasterPatternViewLookupConfig, FilterOperator, SelectOption } from '../types'; /** * Returns the flat list of all field definitions from a definition object. * * Handles both shapes: * - `sections` present โ†’ flattens all section fields into one array * - `fields` present โ†’ returns it directly (backward compat) * * Use this everywhere instead of `definition.fields` directly. */ export declare function getAllFields(definition: MasterPatternViewDefinition): MasterPatternViewFieldDefinition[]; export interface ListColumnDescriptor { fieldName: string; label: string; dataType: string; sortable: boolean; inputType: MasterPatternViewInputType; } export interface FormInputDescriptor { fieldName: string; label: string; inputType: MasterPatternViewInputType; isRequired: boolean; maxLength?: number; colSize?: number | { sm?: number; md?: number; lg?: number; }; options?: SelectOption[]; lookupConfig?: MasterPatternViewLookupConfig; } export interface FilterControlDescriptor { fieldName: string; label: string; dataType: string; inputType: MasterPatternViewInputType; filterOperator: FilterOperator; } export interface QuickFilterDescriptor { fieldName: string; label: string; inputType: MasterPatternViewInputType; } export interface SortableFieldDescriptor { fieldName: string; label: string; } /** * Resolves the Tailwind col-span class for a field based on its colSize definition. * Respects responsive colSize objects (uses md breakpoint, then lg, then sm). * Defaults to col-span-12 for textarea, col-span-6 for everything else. */ export declare function computeColSpanClass(field: Pick): string; /** * Resolves the input type for a field. * If `inputType` is explicitly set, returns it. Otherwise infers from `dataType`. */ export declare function inferInputType(field: Pick): MasterPatternViewInputType; /** * Validates field definitions for mutual exclusivity violations. * Warns when `isOverridable` and `isCompanyOnly` are both `true` on the same field. * Per PRD ยง4.3 these flags are mutually exclusive. */ export declare function validateFieldDefinitions(fields: MasterPatternViewFieldDefinition[]): void; /** * Derives list column descriptors from field definitions. * Only includes fields with `showInList: true`. * Column order: explicit `listOrder` if any field defines it; otherwise preserves array declaration order. * `code` and `name` are always sortable. */ export declare function deriveListColumns(fields: MasterPatternViewFieldDefinition[]): ListColumnDescriptor[]; /** * Derives form input descriptors from field definitions. * Only includes fields with `showInForm: true`, optionally filtered by tab. * Field order within each section is controlled by `formOrder` (independent of `listOrder`). */ export declare function deriveFormInputs(fields: MasterPatternViewFieldDefinition[], tab?: string): FormInputDescriptor[]; /** * Derives filter control descriptors from field definitions. * Only includes fields with `filterable: true`. */ export declare function deriveFilterControls(fields: MasterPatternViewFieldDefinition[]): FilterControlDescriptor[]; /** * Derives quick filter descriptors (max 3) from field definitions. * Only includes fields with `quickFilter: true`. */ export declare function deriveQuickFilters(fields: MasterPatternViewFieldDefinition[]): QuickFilterDescriptor[]; /** * Derives all sortable fields, always including `code` and `name`. * Used by the SortDropdown component. */ export declare function deriveSortableFields(fields: MasterPatternViewFieldDefinition[]): SortableFieldDescriptor[]; //# sourceMappingURL=fieldEngine.d.ts.map