@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
37 lines (36 loc) • 1.89 kB
TypeScript
import { AnyComponentSchema } from '@open-formulieren/types';
import { IntlShape } from 'react-intl';
import { ComponentDefinition } from '../../types';
/**
* Get the components for a given dropzone.
*/
export declare const getDropzoneComponents: (components: ComponentDefinition[], dropzoneId: string) => ComponentDefinition[] | undefined;
/**
* Create a new component with a unique key for the given component type.
*
* The componentDefinitions are used to create a truly unique key.
*/
export declare const createComponent: <S extends AnyComponentSchema>(componentType: S["type"], uniquifyKey: (key: string) => string, intl: IntlShape) => S;
/**
* Remove the placeholder from the components.
*/
export declare const removePlaceholder: (components: ComponentDefinition[]) => void;
/**
* Remove a component from the components collection, using the component key as an
* identifier.
*/
export declare const removeComponent: (components: ComponentDefinition[], componentKey: string) => void;
/**
* Search for the placeholder in the components and replace it with the given component.
*/
export declare const replacePlaceholderWithComponent: (componentDefinitions: ComponentDefinition[], component: AnyComponentSchema) => void;
/**
* Replace a component in the components with the given component.
*/
export declare const replaceComponent: (componentDefinitions: ComponentDefinition[], componentToReplaceKey: string, component: AnyComponentSchema) => void;
/**
* Insert a component definition (a placeholder or component) at the given index in the
* given dropzone.
*/
export declare const insertComponentDefinition: (index: number, componentDefinitions: ComponentDefinition[], dropzoneId: string, componentDefinition: ComponentDefinition) => void;
export declare function assertNoPlaceholders(components: ComponentDefinition[]): asserts components is AnyComponentSchema[];