/// import "dmn-js-properties-panel/dist/assets/dmn-js-properties-panel.css"; import "dmn-js/dist/assets/diagram-js.css"; import "dmn-js/dist/assets/dmn-font/css/dmn-embedded.css"; import "dmn-js/dist/assets/dmn-js-decision-table-controls.css"; import "dmn-js/dist/assets/dmn-js-decision-table.css"; import "dmn-js/dist/assets/dmn-js-drd.css"; import "dmn-js/dist/assets/dmn-js-literal-expression.css"; import "dmn-js/dist/assets/dmn-js-shared.css"; import Modeler from "dmn-js/lib/Modeler"; import { EventCallback } from "../GlobalEventListenerUtil"; export interface ViewsChangedEvent { activeView: DmnView | undefined; views: DmnView[]; } export interface DmnView { element: any; id: string; name: string; type: "drd" | "decisionTable" | "literalExpression"; } export interface DmnViewer { /** * Returns a named component. * * @param name The name * @param strict If an error should be thrown if the component does not exist. If false, null * will be returned. */ get: (name: string, strict?: boolean) => any; /** * Registers a new event handler. * * @param event The event name * @param handler The handler */ on: (event: string, handler: (event: any) => void) => void; /** * Unregisters a previously registered event handler. * * @param event The event name * @param handler The handler */ off: (event: string, handler: (event: any) => void) => void; } export interface CustomDmnJsModelerOptions { /** * The ID of the div to use as host for the properties panel. The div must be present inside * the page HTML. If missing or undefined is passed, no properties panel will be initialized. */ propertiesPanel?: string; /** * The ID of the div to use as host for the editor itself. The div must be present inside the * page HTML. */ container: string; /** * The options passed to dmn-js. Will be merged with the options defined by this library, * with the latter taking precedence in case of conflict. * CAUTION: If you pass invalid properties, the modeler can break! */ dmnJsOptions?: any; } declare class CustomDmnJsModeler extends Modeler { /** * Creates a new instance of the bpmn-js modeler. * * @param options The options to include */ constructor(options: CustomDmnJsModelerOptions); /** * Saves the editor content as XML. */ save(params: { format: boolean; }): Promise<{ xml: string; }>; /** * Imports the specified XML. * * @param xml The XML to import * @param open Whether to open the view after importing */ import(xml: string, open?: boolean): Promise<{ warnings: ImportWarning[]; }>; /** * Returns whether the command stack contains any actions that can be undone. * Can be used to determine if the undo button should be enabled or not. */ canUndo(): boolean; /** * Returns whether the command stack contains any actions that can be repeated. * Can be used to determine if the redo button should be enabled or not. */ canRedo(): boolean; /** * Returns the size of the current selection. */ getSelectionSize(): number; /** * Binds the keyboard to the curretn document. * Keyboard shortcuts will trigger actions in the editor after this has been called. */ bindKeyboard(): void; /** * Unbinds the keyboard from the current document. * Keyboard shortcuts won't work anymore after this has been called. */ unbindKeyboard(): void; /** * Returns the current stack index. */ getStackIndex(): number; /** * Instructs the command stack to undo the last action. */ undo(): void; /** * Instructs the command stack to repeat the last undone action. */ redo(): void; /** * Registers a global event listener that will receive all bpmn-js events. * * @param listener The listener to register */ registerGlobalEventListener(listener: EventCallback): void; /** * Unregisters a previously registered global event listener. * * @param listener The listener to unregister */ unregisterGlobalEventListener(listener: EventCallback): void; } export default CustomDmnJsModeler;