///
import { MutableRefObject, Context, ReactNode, DependencyList } from 'react';
import ReactDOM from 'react-dom/client';
import { Definition, RootEditorContext, SimpleEvent, Designer, ToolboxConfiguration, DefinitionChangedEvent, RootEditorProvider, StepEditorProvider, StepsConfiguration, ValidatorConfiguration, PlaceholderConfiguration, KeyboardConfiguration, PreferenceStorage, CustomActionHandler, DesignerExtension, I18n, Step, StepEditorContext } from 'sequential-workflow-designer';
declare class Presenter {
static render(className: string, rootRef: MutableRefObject, element: JSX.Element): HTMLElement;
static tryDestroy(rootRef: MutableRefObject): void;
}
declare global {
interface Window {
sqdRootEditorContext?: Context | null>;
}
}
interface RootEditorWrapper {
readonly properties: TDefinition['properties'];
readonly definition: TDefinition;
readonly isReadonly: boolean;
setProperty(name: keyof TDefinition['properties'], value: TDefinition['properties'][typeof name]): void;
}
declare function useRootEditor(): RootEditorWrapper;
interface RootEditorWrapperContextProps {
children: ReactNode;
definition: Definition;
context: RootEditorContext;
isReadonly: boolean;
}
declare function RootEditorWrapperContext(props: RootEditorWrapperContextProps): JSX.Element;
interface WrappedDefinition {
readonly value: TDefinition;
readonly isValid: boolean | undefined;
}
declare function wrapDefinition(value: TDefinition, isValid?: boolean): WrappedDefinition;
declare class SequentialWorkflowDesignerController {
static create(): SequentialWorkflowDesignerController;
/**
* @description Event that is raised when the controller is ready to be used.
*/
readonly onIsReadyChanged: SimpleEvent;
private designer;
private constructor();
/**
* @description Moves the viewport to the step with the animation.
*/
readonly moveViewportToStep: (stepId: string) => void;
/**
* @description Updates all badges.
*/
readonly updateBadges: () => void;
/**
* @description Rerender the root component and all its children.
*/
readonly updateRootComponent: () => void;
/**
* @description Updates the layout of the designer.
*/
readonly updateLayout: () => void;
/**
* Replaces the current definition with a new one and adds the previous definition to the undo stack.
* @param definition A new definition.
*/
readonly replaceDefinition: (definition: Definition) => Promise;
/**
* @returns `true` if the controller is ready to be used, `false` otherwise.
*/
isReady(): boolean;
setDesigner(designer: Designer | null): void;
private getDesigner;
}
declare function useSequentialWorkflowDesignerController(deps?: DependencyList): SequentialWorkflowDesignerController;
type ReactToolboxConfiguration = Omit;
interface SequentialWorkflowDesignerProps {
definition: WrappedDefinition;
onDefinitionChange: (state: WrappedDefinition, event?: DefinitionChangedEvent) => void;
selectedStepId?: string | null;
onSelectedStepIdChanged?: (stepId: string | null) => void;
onStepUnselectionBlocked?: (targetStepId: string | null) => void;
isReadonly?: boolean;
rootEditor: false | JSX.Element | RootEditorProvider;
stepEditor: false | JSX.Element | StepEditorProvider;
isEditorCollapsed?: boolean;
onIsEditorCollapsedChanged?: (isCollapsed: boolean) => void;
theme?: string;
undoStackSize?: number;
stepsConfiguration: StepsConfiguration;
validatorConfiguration?: ValidatorConfiguration;
placeholderConfiguration?: PlaceholderConfiguration;
toolboxConfiguration: false | ReactToolboxConfiguration;
isToolboxCollapsed?: boolean;
onIsToolboxCollapsedChanged?: (isCollapsed: boolean) => void;
/**
* @description If true, the control bar will be displayed.
*/
controlBar: boolean;
contextMenu?: boolean;
keyboard?: boolean | KeyboardConfiguration;
preferenceStorage?: PreferenceStorage;
controller?: SequentialWorkflowDesignerController;
customActionHandler?: CustomActionHandler;
extensions?: DesignerExtension[];
i18n?: I18n;
}
declare function SequentialWorkflowDesigner(props: SequentialWorkflowDesignerProps): JSX.Element;
declare global {
interface Window {
sqdStepEditorContext?: Context;
}
}
interface StepEditorWrapper {
readonly id: string;
readonly type: TStep['type'];
readonly componentType: TStep['componentType'];
readonly name: string;
readonly properties: TStep['properties'];
readonly step: TStep;
readonly definition: TDefinition;
readonly isReadonly: boolean;
setName(name: string): void;
setProperty(name: keyof TStep['properties'], value: TStep['properties'][typeof name]): void;
notifyPropertiesChanged(): void;
notifyChildrenChanged(): void;
}
declare function useStepEditor(): StepEditorWrapper;
interface StepEditorWrapperContextProps {
children: ReactNode;
step: Step;
definition: Definition;
context: StepEditorContext;
isReadonly: boolean;
}
declare function StepEditorWrapperContext(props: StepEditorWrapperContextProps): JSX.Element;
export { Presenter, RootEditorWrapperContext, SequentialWorkflowDesigner, SequentialWorkflowDesignerController, StepEditorWrapperContext, useRootEditor, useSequentialWorkflowDesignerController, useStepEditor, wrapDefinition };
export type { ReactToolboxConfiguration, RootEditorWrapper, RootEditorWrapperContextProps, SequentialWorkflowDesignerProps, StepEditorWrapper, StepEditorWrapperContextProps, WrappedDefinition };