1 | import { Token } from '@lumino/coreutils';
|
2 | import type { Field } from '@rjsf/core';
|
3 | /**
|
4 | * A registry for rendering fields used in the FormEditor component.
|
5 | */
|
6 | export declare class FormComponentRegistry implements IFormComponentRegistry {
|
7 | /**
|
8 | * Adds a renderer for a given id - if the id is already in use, returns false.
|
9 | * Otherwise, returns true.
|
10 | * @param id - Unique ID for the given renderer.
|
11 | * @param renderer - A function that takes props and returns a rendered component
|
12 | * @returns - Whether the renderer was added successfully. False if the id is already in use.
|
13 | */
|
14 | addRenderer(id: string, renderer: Field): boolean;
|
15 | /**
|
16 | * Returns all registered renderers in dictionary form.
|
17 | * @returns - A dictionary that maps an id to a renderer.
|
18 | */
|
19 | get renderers(): {
|
20 | [id: string]: Field;
|
21 | };
|
22 | /**
|
23 | * Returns the renderer for the given id
|
24 | * @param id - The unique id for the renderer.
|
25 | * @returns - A function that takes props and returns a rendered component.
|
26 | */
|
27 | getRenderer(id: string): Field;
|
28 | private _renderers;
|
29 | }
|
30 | /**
|
31 | * A registry for rendering fields used in the FormEditor component.
|
32 | */
|
33 | export interface IFormComponentRegistry {
|
34 | /**
|
35 | * Adds a renderer for a given id - if the id is already in use, returns false.
|
36 | * Otherwise, returns true.
|
37 | * @param id - Unique ID for the given renderer.
|
38 | * @param renderer - A function that takes props and returns a rendered component
|
39 | * @returns - Whether the renderer was added successfully. False if the id is already in use.
|
40 | */
|
41 | addRenderer: (id: string, renderer: Field) => void;
|
42 | /**
|
43 | * Returns the renderer for the given id
|
44 | * @param id - The unique id for the renderer.
|
45 | * @returns - A function that takes props and returns a rendered component.
|
46 | */
|
47 | getRenderer: (id: string) => Field;
|
48 | /**
|
49 | * Returns all registered renderers in dictionary form.
|
50 | * @returns - A dictionary that maps an id to a renderer.
|
51 | */
|
52 | renderers: {
|
53 | [id: string]: Field;
|
54 | };
|
55 | }
|
56 | export declare const IFormComponentRegistry: Token<IFormComponentRegistry>;
|