import { HeadlessEditor, HeadlessEditorOptions, type JsonNode } from 'headless-json-editor'; import { WidgetComponent, WidgetPlugin } from './decorators'; /** * Register a list of widgets for all new editor instances per default * * If a list of widgets is added to editor.widgets, this default list will be overriden * * @example * import { setDefaultWidgets } from '@sagold/react-json-editor'; * import widgets from '@sagold/rje-mantine-widgets'; * setDefaultWidgets(widgets); * * @param widgets list of widgets to set per default */ export declare function setDefaultWidgets(widgets: WidgetPlugin[]): void; export type EditorOptions = HeadlessEditorOptions & { /** The list of available widgets to render the JSON Schema tree. Each node in the tree should have a matching widget to be rendered or the editor will either ignore or show an error using an Error Widget if added. */ widgets?: WidgetPlugin[]; /** Set to `true` to update form data on each keystroke instead of on blur. Only applied to supporting editors */ liveUpdate?: boolean; /** Set to true to deactivate all forms */ disabled?: boolean; }; type WidgetOptions = { /** if all supporting editors should update on each keystroke instead of on blur. Defaults to false */ liveUpdate?: boolean; /** if true disables all editors */ disabled?: boolean; }; /** * `new Editor` returns your editor-instance containing a JSON Schema tree, registered widgets and plugins and the overall state of the data. * * @example * import { Editor } from '@sagold/react-json-editor'; * * const editor = new Editor(options); * * @caveat Each JSON Schema requires a valid JSON Schema type keyword * * @returns Returns an `editor` instance */ export declare class Editor extends HeadlessEditor { widgets: WidgetPlugin[]; widgetOptions: WidgetOptions; constructor(options: EditorOptions); /** * Use `editor.getWidget` to find a widget matching the requested `JsonNode` * * @param node - is a JsonNode belonging to the root JsonNode of this editor, or the root itself. You can get the root by calling `editor.getNode()` or any nested root by specifying a JSON Pointer to the data `editor.getNode("#/header/title")`; * @param options - can be passed to the lookup function, which will be available in a WidgetPlugin's use-function: `use(node, options) => boolean`. Usually, options are passed to getWidget as well as to the widget itself * @returns The **Widget component** to render the given node or undefined */ getWidget(node: JsonNode, options?: Record): WidgetComponent; } export {};