UNPKG

1.65 kBTypeScriptView Raw
1import { Token } from '@lumino/coreutils';
2import type { Field, Widget } from '@rjsf/utils';
3/**
4 * Form renderer interface.
5 */
6export interface IFormRenderer {
7 /**
8 * A React component with properties FieldProps.
9 */
10 fieldRenderer?: Field;
11 /**
12 * A React component with properties WidgetProps.
13 */
14 widgetRenderer?: Widget;
15}
16/**
17 * A registry for rendering fields used in the FormEditor component.
18 */
19export interface IFormRendererRegistry {
20 /**
21 * Adds a renderer for a given property of a given settings plugin.
22 *
23 * The id must follow that structure `<ISettingRegistry.IPlugin.id>.<propertyName>`
24 *
25 * @param id - Unique ID for the given renderer.
26 * @param renderer - A renderer interfacing IFormRenderer.
27 */
28 addRenderer: (id: string, renderer: IFormRenderer) => void;
29 /**
30 * Returns the component for the given id
31 * @param id - The unique id for the component.
32 * @returns - A component interfacing IFormComponent.
33 */
34 getRenderer: (id: string) => IFormRenderer;
35 /**
36 * Returns all registered renderers in dictionary form.
37 * @returns - A dictionary that maps an id to a renderer.
38 */
39 renderers: {
40 [id: string]: IFormRenderer;
41 };
42}
43/**
44 * The token for the form component registry.
45 */
46export declare const IFormRendererRegistry: Token<IFormRendererRegistry>;
47/**
48 * Placeholder for future icon manager class to assist with
49 * overriding/replacing particular sets of icons
50 */
51export interface ILabIconManager {
52}
53/**
54 * The ILabIconManager token.
55 */
56export declare const ILabIconManager: Token<ILabIconManager>;