import { FormHost, defs } from "../../forms/FormHost"; import type { ElementPosition } from "./FormActor"; import type FormActor from "./FormActor"; import type { Activator } from "../../Activator"; import type { FormElementRegistration } from "../../forms/index"; export { defs }; /** * Renders a form on behalf of the DisplayForm activity. * @public */ export declare class FormRenderer extends FormHost implements FormActor { static type: string; /** Creates a form renderer. */ static create(): FormRenderer; /** Creates a custom form renderer. */ static createCustom(): FormRenderer; /** Register this renderer class as the form renderer. */ static register(activator: Activator): void; addElement(elementName: string, type: string, element: defs.Element, elementPosition?: ElementPosition): defs.Element; assignElementItemProperty(elementName: string, itemKey: string, propertyName: string, propertyValue: any, markdown?: boolean): void; assignElementProperty(elementName: string, propertyName: string, propertyValue: any, markdown?: boolean, event?: Partial | boolean): void; assignItemsToElement(elementName: string, items: Record, reset?: boolean): void; cancelTool(): void; deriveLocale(): string; /** Disposes the form renderer. */ dispose(): boolean; /** Filters the items of an element based on heuristics. */ filterItems(elementName: string, input: string): boolean; /** * Returns the specified element or throws an error with a helpful message * if the element does not exist. Throwing an error now makes it easier * to debug than further downstream when it could be less obvious. * Having a shared method allows us to have consistent behaviour and a * consistent message. * * If the supplied element is already an instance of an Element, it is * returned. * * If it is a string, it is looked up. * * If an element was not supplied, we check the supplied event to attempt * to get the element name from there and subsequently look it up. * * This method throws a FormElementNotFoundError if an element name was * supplied but not found, or if the element named in the event was not * found. * * This method throws a NoFormElementAvailableError if no element name was * specified and there was none specified in the event either. * * @param element The name of a form element, or the element itself. * @param event The event for the form. */ getElement(element: string | defs.Element | undefined, event?: defs.Event): defs.Element; /** * Returns the name of the specified element or throws an error with a * helpful message if the element does not exist. Throwing an error now * makes it easier to debug than further downstream when it could be less * obvious. Having a shared method allows us to have consistent behaviour * and a consistent message. * If the supplied element is already a string, it is returned. * * If it is an actual instance of Element, it is looked up. * * If an element was not supplied, we check the supplied event to attempt * to get the element name from there. * * This method throws a FormElementNotFoundError if an element instance was * supplied but not found. * * This method throws a NoFormElementAvailableError if no element name was * specified and there was none in the event either. * * @param element The name of a form element, or the element itself. * @param event The event for the form. */ getElementName(element: defs.Element | string | undefined, event?: defs.Event): string; getElementRegistration(element: defs.Element): FormElementRegistration | undefined; hideElement(element: defs.Element): void; /** * Checks to see if the other FormRenderer is related to this one. * If two forms share the same ambient state, they belong to the * same workflow. Otherwise they may yet be related if the other belongs to * a workflow that is an ancestor of the current workflow. * @param other The other FormRenderer to compare to this one. */ isRelated(other: FormRenderer): any; /** Loads the form. */ load(): boolean; /** Loads the form with a new definition. */ load(form: defs.Form, template?: defs.Form): boolean; /** Renders form text as plain text. */ renderText(content: defs.Text | undefined): string; setCurrentItem(elementName: string, searchValue: defs.Value | defs.Text | defs.Item, itemMatchType: defs.ItemMatchType): boolean; setElementError(elementName: string, error: string | undefined, markdown?: boolean): void; showElement(element: defs.Element): void; /** Used to request that the form spins without blocking the application. */ spinNoBlock(): boolean; translateText(content: string | defs.StatusRef | undefined): string | undefined; translateText(content: defs.MarkdownRef | undefined): defs.MarkdownRef | undefined; translateText(content: defs.Text | undefined): string | defs.MarkdownRef | undefined; protected getText(content: defs.Text | undefined): defs.Text | undefined; }