import { default as React } from 'react'; import { LookupColumnDef } from '@object-ui/types'; /** * Cell renderer function signature — matches `getCellRenderer` from * `@object-ui/fields`. Re-declared here (rather than imported from * RecordPickerDialog) so this module sits BELOW both consumers in the import * graph and neither surface can pull the other in. */ export type LookupCellRendererResolver = (fieldType: string) => React.FC<{ value: any; field: any; }>; /** * A select option as the object schema declares it — `{ value, label }` plus * whatever the renderer also reads (`color`, …), which the i18n translation * carries through untouched. */ export type SchemaOption = { value: any; label: string; [key: string]: any; }; /** Translate a schema field's options through the shared i18n option path. */ export type OptionTranslator = (objectName: string, fieldName: string, options: SchemaOption[]) => SchemaOption[]; /** * Normalise a lookup_columns entry (string | LookupColumnDef) into a * concrete LookupColumnDef object. */ export declare function normalizeColumn(col: string | LookupColumnDef): LookupColumnDef; /** * Pretty-print a field name as a column header label. * Converts snake_case / camelCase to Title Case. */ export declare function fieldToLabel(field: string): string; /** * Resolve a field's select options from the referenced object's schema field * definition (`fieldsMeta[field]`), translated through the shared i18n option * path. * * This is the SINGLE source for every surface that needs option labels: the * picker table cells (#3333), the picker's filter panel select inputs (#3336) * and the inline dropdown's option preview (#5492) — so a picker column, the * filter input for that same column and the dropdown row can never disagree * about what an option is called. * * Returns `undefined` when the schema field declares no options: a select * field with no authored options genuinely has nothing to offer, and * synthesising entries from the loaded page's raw stored values would paper * over the metadata gap with a list that changes per page. */ export declare function resolveSchemaOptions(meta: { options?: unknown; } | undefined, objectName: string, fieldName: string, translateOptions: OptionTranslator): SchemaOption[] | undefined; /** * Field descriptors handed to the type-aware cell renderers, enriched from the * referenced object's schema (`fieldsMeta`) the same way the list view enriches * its columns. This is what lets a `select` column resolve its option label * (options + i18n) instead of title-casing the raw value (#3333), and what * carries `reference` / `reference_to` through to the lookup cell renderer so * an unresolved foreign-key id resolves to a name (#5492). * * Columns whose def carries no `type` inherit the schema field's type, so * string-authored `lookup_columns` format identically to object-authored ones. */ export declare function buildLookupColumnDescriptors(columns: LookupColumnDef[], fieldsMeta: Record | undefined, objectName: string, translateOptions: OptionTranslator): Record; export interface LookupColumnRenderContext { /** Field descriptors from {@link buildLookupColumnDescriptors}. */ descriptors: Record; /** Type-aware renderer resolver; when absent every cell degrades to text. */ cellRenderer?: LookupCellRendererResolver; /** The referenced object's `titleFormat`, applied to the display column. */ titleFormat?: string | null; /** The lookup's display field — the column the title template stands in for. */ displayField?: string; /** Locale for the plain-text `$date` fallback. */ displayLocale?: string; } /** * Render one column of one candidate record. * * Order: * 1. `titleFormat` template, for the display column only — so users see a * human-readable name instead of a raw id when the display field * (commonly defaulted to `name`) does not exist on the record. * 2. the type-aware cell renderer for the column's field descriptor. * 3. a plain-text fallback for columns with no descriptor / no resolver. * * Step 3 never blanks a populated value: an object with no recognised shape * keeps its JSON and a primitive keeps its `String()` form. That floor is * deliberate — an unresolved reference showing its bare id is strictly better * than a silently empty column (objectui#5492). */ export declare function renderLookupColumnValue(record: any, col: LookupColumnDef, ctx: LookupColumnRenderContext): React.ReactNode;