nope/resources/ui/graph/interfaces/ITemplate.ts
2020-10-25 21:14:51 +01:00

47 lines
1.5 KiB
TypeScript

/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2019-05-03 09:45:08
* @modify date 2020-07-22 21:53:21
* @desc [description]
*/
import { IBaseNodeOptions } from '../../../@zema/ZISS-Network/type/IBaseNodeOptions';
import { IBaseEdgeOptions } from '../../../@zema/ZISS-Network/type/IBaseEdgeOptions';
import { IJsonSchema } from '../../../@zema/ZISS-TypeScript-Library/src/JSON';
import { ILogicCallbackData } from '../../gui-component-logic-editor/interfaces/ILogicCallbackData';
export interface ITemplate<T extends IBaseNodeOptions, K extends IBaseEdgeOptions> {
type: 'elements'
/**
* Array of Nodes, containing all
* selected Nodes (idx 0 = the one
* which will be added first and will
* be edited, by the Edit-Pages)
* and Subnodes of the Node.
*/
nodes: Array<T>;
/**
* All Edges which are Selected.
* (idx 0 = the one which will be
* added first and will be edited,
* by the Edit-Pages)
*/
edges: Array<K>;
}
export interface IMustacheTemplate {
type: 'mustache'
/** The Mustache Template */
mustache: string;
/** The Schema for the Query */
schema: IJsonSchema;
/** Sample Data => Required for Rendering */
example: {
[index: string]: any
}
// Function to Adapt the Template.
adaptSchema? (template: IMustacheTemplate, data: ILogicCallbackData): IMustacheTemplate,
adaptData? (data: ILogicCallbackData, genObject: {[index: string] : any}): {[index: string] : any}
}