@canard/schema-form
Version:
React-based component library that renders forms based on JSON Schema with plugin system support for validators and UI components
20 lines (19 loc) • 1.1 kB
TypeScript
import { type ResolveSchema } from '../../helpers/jsonSchema';
import type { JsonSchemaWithVirtual, ObjectValue } from '../../types';
import { ContextNode } from './ContextNode';
import { type SchemaNodeFactory } from './type';
/**
* Creates a context ObjectNode for sharing form-wide data across all nodes.
* @note The context node is a terminal ObjectNode with no validation.
* @param defaultValue - Initial value for the context node
* @returns An ObjectNode instance for form-wide context data
*/
export declare const contextNodeFactory: (defaultValue?: ObjectValue) => ContextNode;
/**
* Creates a SchemaNode factory function that matches the JSON Schema type.
* @note Before creating SchemaNode, it resolves the references in the JSON Schema.
* @typeParam Schema - The JSON Schema type
* @param resolveSchema - Schema resolution function used to resolve references
* @returns A factory function that creates SchemaNode instances
*/
export declare const createSchemaNodeFactory: <Schema extends JsonSchemaWithVirtual>(resolveSchema: ResolveSchema | null) => SchemaNodeFactory<Schema>;