import { Activator } from "../../Activator";
import { FormHost, defs, Facility } from "../../forms/FormHost";
import { Lookup } from "../../Collections";
import { FormElementRegistration } from "../..";
export { defs };
/** Defines what the renderer exposes. */
export interface FormActor {
    /** Returns the element with the given name. If the element does not exist an error will be thrown. */
    getElement(element: string | defs.Element, event?: defs.Event): defs.Element;
    getElementRegistration(element: defs.Element): FormElementRegistration | undefined;
    /** Returns the name of the given element. If the element does not exist an error will be thrown. */
    getElementName(element: defs.Element | string, event?: defs.Event): string;
    /** Sets element visibility to false. */
    hideElement(element: defs.Element): void;
    /** Sets element visibility to true. */
    showElement(element: defs.Element): void;
    /** Assigns an error message to an element. */
    setElementError(elementName: string, error: string, markdown?: boolean): void;
    /** Finds the specified item and sets it as the current one. Returns true if a match was found, false otherwise. */
    setCurrentItem(elementName: string, value: defs.Value | defs.Text | defs.Item, matchType: defs.ItemMatchType): boolean;
    /** Assigns a property to an element, or overwrites an existing property. */
    assignElementProperty(elementName: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
    /** Assigns an items property to an element. */
    assignItemsToElement(elementName: string, items: Lookup<defs.Item>, reset?: boolean): void;
    /** Assigns a property to an element item, or overwrites an existing property. */
    assignElementItemProperty(elementName: string, itemKey: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
    /** Filters the items of an element based on heuristics. */
    filterItems(elementName: string, phrase: string): boolean;
    /**
     * Adds the supplied element to the form.
     * @param elementName The unique name for the element.
     * @param type The type of element to add.
     * @param element The contents of the element to add.
     */
    addElement(elementName: string, type: string, element: defs.Element): defs.Element;
}
/**
 * Renders a form on behalf of the DisplayForm activity.
 */
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;
    /** Used to request that the form spins without blocking the application. */
    spinNoBlock(): boolean;
    hideElement(element: defs.Element): void;
    showElement(element: defs.Element): void;
    setCurrentItem(elementName: string, searchValue: defs.Value | defs.Text | defs.Item, itemMatchType: defs.ItemMatchType): boolean;
    setElementError(elementName: string, error: string, markdown?: boolean): void;
    assignElementProperty(elementName: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
    assignItemsToElement(elementName: string, items: Lookup<defs.Item>, reset?: boolean): void;
    assignElementItemProperty(elementName: string, itemKey: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
    deriveLocale(facility?: Facility): string;
    /** Disposes the form renderer. */
    dispose(): boolean;
    /** Loads the form. */
    load(): boolean;
    /** Loads the form with a new definition. */
    load(form: defs.Form, template?: defs.Form): boolean;
    /**
     * 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;
    /**
     * 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, 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, event?: defs.Event): string;
    getElementRegistration(element: defs.Element): FormElementRegistration | undefined;
    /** Renders form text as HTML. */
    renderHtml(content: defs.Text, htmlContentCategory?: defs.HTMLContentCategory): string;
    /** Renders form text as plain text. */
    renderText(content: defs.Text): string;
    /** Filters the items of an element based on heuristics. */
    filterItems(elementName: string, input: string): boolean;
    private isStatus;
    protected getText(content: defs.Text): defs.Text;
    renderCustom(component: {}, element: defs.Element): JSX.Element;
    addElement(elementName: string, type: string, element: defs.Element): defs.Element;
}
