import type { Resolver } from "../lib/resolver.js"; import type { RPath, SchemaValue } from "../core/index.js"; import type { CompatibleComponentType, ComponentDefinitions, ComponentProps, FoundationalComponentType } from "./components.js"; import type { Config } from "./config.js"; import type { ActionField, FieldAction } from "./field-actions.js"; import type { TranslatorDefinitions } from "./translation.js"; export interface UiOptions { /** * Overrides the title of the field. */ title?: string; /** * Overrides form translation */ translations?: Partial; /** * Field action */ action?: FieldAction; /** * A typed field action takes precedence over `action` */ actions?: Partial<{ [T in ActionField]: FieldAction; }>; } export type UiOption = (opt: O) => UiOptions[O]; export interface UiOptionsRegistry { } export type ResolvableUiOption = { [K in keyof UiOptionsRegistry as UiOptionsRegistry[K] extends T ? K : never]: `registry:${K}`; }[keyof UiOptionsRegistry] | T; export type ResolvableUiOptions = { [K in keyof UiOptions]: ResolvableUiOption; }; export interface UiSchemaContent { /** * Extendable set of UI options */ "ui:options"?: ResolvableUiOptions; /** * Components override */ "ui:components"?: Partial<{ [T in FoundationalComponentType]: Exclude, T> | ComponentDefinitions[T]; }>; items?: UiSchemaDefinition | UiSchemaDefinition[]; anyOf?: UiSchemaDefinition[]; oneOf?: UiSchemaDefinition[]; additionalProperties?: UiSchemaDefinition; additionalPropertyKeyInput?: UiSchemaDefinition; additionalItems?: UiSchemaDefinition; } export type UiSchema = UiSchemaContent & { [key: string]: UiSchemaContent[keyof UiSchemaContent]; }; export interface UiSchemaRef { $ref: string; } export type UiSchemaDefinition = UiSchema | UiSchemaRef; export type UiSchemaRoot = UiSchemaDefinition & { "ui:globalOptions"?: ResolvableUiOptions; "ui:definitions"?: Record; }; export type ExtraUiOptions = Resolver>, Partial>; export declare function isUiSchemaRef(def: UiSchemaDefinition | undefined): def is UiSchemaRef; export declare function resolveUiRef(rootSchema: UiSchemaRoot, schemaDef: UiSchemaDefinition | undefined): UiSchema | undefined; export declare function resolveUiOption(uiSchemaRoot: UiSchemaRoot, uiOptionsRegistry: UiOptionsRegistry, uiSchema: UiSchema, option: O): UiOptions[O] | undefined; export declare function getUiSchemaByPath(rootSchema: UiSchemaRoot, schemaDef: UiSchemaDefinition | undefined, path: RPath): UiSchema | undefined; export declare function getRootUiSchemaTitleByPath(uiSchemaRoot: UiSchemaRoot, path: RPath): ResolvableUiOption;