/** * @author Martin Karkowski * @email m.karkowski@zema.de * @create date 2020-03-12 12:43:07 * @modify date 2020-07-22 21:53:48 * @desc [description] */ import { IBaseNodeOptions } from '../../../@zema/ZISS-Network/type/IBaseNodeOptions'; import { IBaseEdgeOptions } from '../../../@zema/ZISS-Network/type/IBaseEdgeOptions'; import { IUndoRedoGraph } from './IGraph'; import { ITemplate, IMustacheTemplate } from './ITemplate'; import { IVisjsOptions } from './IVisjsOptions'; import { IEditPage } from '../edit-pages/edit-pages.interface'; import { IBasicLayoutComponent, IMinProvidedDataSet, IToolbarConfig, ISelectionConfig, ISelectionTemplate } from '../../gui-components-basic-layout/types/interfaces'; import { ZemaServiceProvider } from '../../../@zema/zema-service-provider.service'; import { Type } from '@angular/core'; /** * Custom Callback Object. * * @export * @interface ICallbackData * @extends {IMinProvidedDataSet} * @template N * @template E */ export interface ICallbackData extends IMinProvidedDataSet { network: IUndoRedoGraph, options: IVisjsOptions, selectedNodes: Array, selectedEdges: Array, component: IGraphToolComponent>, zemaService: ZemaServiceProvider, selectedTemplate: ITemplate | IMustacheTemplate } export interface IGraphToolComponent { options: { addEdgeCallback?: (edgeData: E, callback: (edgeData: E) => void) => void; editOnSelect?: boolean; editOnChange?: boolean; parseFunctions?: boolean; enableContextMenu?: boolean; enableEditing?: boolean; hidePanelOnDeselect?: boolean; hideToolbar?: boolean; hideRightPanel?: boolean; } /** * Element Containing the Layout * * @type {IBasicLayoutComponent,ICallbackData>} * @memberof IGraphToolComponent */ layout: IBasicLayoutComponent | IMustacheTemplate, D> /** * Flag, which will be used to Controll, whether JSON should contain functions or not. * * @type {boolean} * @memberof IGraphToolComponent */ parseFunctions: boolean; /** * The Options of the VISJS-Graph (Unterlying Graph to Render the Network) * Will be used as Input. * * @type {IVisjsOptions} * @memberof IGraphToolComponent */ visjsOptions: IVisjsOptions; /** * Array containing the Rendered Nodes. Will be used as Input. * * @type {(Array)} * @memberof IGraphToolComponent */ nodes: Array; /** * Array containing the Rendered Edges. Will be used as Input. * * @type {(Array)} * @memberof IGraphToolComponent */ edges: Array; /** * The Toolbar. Will be used as Input. * * @type {IToolbarConfig>} * @memberof IGraphToolComponent */ toolbar: IToolbarConfig> /** * The Underlying Network. * * @type {IUndoRedoGraph} * @memberof IGraphToolComponent */ network: IUndoRedoGraph; /** * Element containing the Mouse Position. */ readonly mousePos: { x: number, y: number }; /** * Function to Load the Graph based on a JSON string * @param data The parsed Graph * @param overwrite Option to overwrite or add the content */ loadJSON(data: string, overwrite?: boolean): void; /** * A Function to open Up an Edit-Window, * Rendering the content of the Component. */ openEditInterface>( /*** The Angular Component */ component: Type, /** The Stettings, of the Component */ settings: { inputTemplate?: ITemplate, [index: string]: any, }, title: string, /** callback, if the Sucess-Button is pressed */ sucessCallback: (data: { template : ITemplate, callback?: (template: ITemplate) => ITemplate }) => void, mode?: 'sidebar' | 'popup'): void; addNode(pos: { x: number, y: number }): void; /** * Function to Update the Data of a Node. * @param selection The Selected Node. */ updateNode(selection: Array): void; /** * Function, which is used to Update an Edge * @param edge The Corresponding Edge, which will be updated. */ updateEdges(edge: E): void; /** * Function, which will be used to update the Templates */ updateTemplates?: (templates: ISelectionConfig>) => void; /** * Enable Hotkeys */ enableHotkeys(): void; /** * Disable Hotkeys */ disableHotkeys(): void; /** * Read Data from the Clipboard */ pasteFromClipboard(): void; /** * Function will copy Data to the Clipboard. * * @memberof IGraphToolComponent */ generateTemplateData(): ISelectionTemplate ; /** * Function to paste the copied Element * @param template The Template * @param position The Position, where the Elements should be added * @param useExistingNodesForEdges Flag to toggle using already existings nodes for connections */ paste( template: { nodes: N[], edges: E[], }, position: { x: number, y: number }, useExistingNodesForEdges: boolean): void; /** * Function to copy the selected Elements. */ copySelectionToClipboard(): void; readDataFromClipboard(): Promise; }