nope/resources/ui/graph/defaults/default.sidebar.ts
2020-10-25 21:14:51 +01:00

400 lines
19 KiB
TypeScript

/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2019-05-06 08:28:53
* @modify date 2020-03-12 12:51:19
* @desc [description]
*/
import { IBaseNodeOptions } from '../../../@zema/ZISS-Network/type/IBaseNodeOptions';
import { IBaseEdgeOptions } from '../../../@zema/ZISS-Network/type/IBaseEdgeOptions';
import { IConnectorNode } from '../../../@zema/ZISS-Network/addition-nodes/IConnectorNode';
import { ISelectionConfig } from '../../gui-components-basic-layout/types/interfaces';
import { ITemplate } from '../interfaces/ITemplate';
/**
* Function to Generate the Default Configuration of the Selection Sidebar.
* In this Object default Shapes for a Product, Process and Equipment are
* provided.
*/
export function generateDefaultSelection(): ISelectionConfig<ITemplate<IBaseNodeOptions | IConnectorNode, IBaseEdgeOptions>> {
return {
/** Defaultly no Favorites will be provided */
favorites: [],
elements: {
nodes: {
items: [
{
group: true,
text: 'Graph',
elements: [
{
/** A Swimlane for adding addition Elements */
keywords: ['swimlane','horizontal'],
text: 'Horizontal Swimlane',
template: {
type: 'elements',
nodes: [
{
id: '',
font: {
background: 'white'
},
label: 'label',
shape: 'swimlane-horizontal'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['swimlane','vertical'],
text: 'Vertical Swimlane',
template: {
type: 'elements',
nodes: [
{
id: '',
font: {
background: 'white'
},
label: 'label',
shape: 'swimlane-vertical'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['rectangle'],
text: 'Rectangle',
template: {
type: 'elements',
nodes: [
{
id: '',
dropable: true,
label: 'label',
shape: 'box'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['circle'],
text: 'Circle',
template: {
type: 'elements',
nodes: [
{
id: '',
dropable: true,
label: 'label',
shape: 'circle'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['ellipse'],
text: 'Ellipse',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'ellipse'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['hexagon'],
text: 'Hexagon',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'hexagon'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['triangle'],
text: 'Triangle',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'triangle'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['triangle-down'],
text: 'Triangle-Down',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'triangleDown'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['square'],
text: 'Square',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'square'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['diamond'],
text: 'Diamond',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'diamond'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['star'],
text: 'Star',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'star'
}
], edges: []
}
},
{
/** A Swimlane for adding addition Elements */
keywords: ['database'],
text: 'Database',
template: {
type: 'elements',
nodes: [
{
id: '',
label: 'label',
shape: 'database'
}
], edges: []
}
}
]
},
{
group: true,
text: 'Products',
elements: [
{
keywords: ['test', 'generic', 'product'],
text: 'Sample Product',
template: {
type: 'elements',
nodes: [
{
id: 'parent',
label: 'label',
shape: 'product',
receiveDropableElements: true,
editorComponentSelector: 'parent',
dropable: true,
segment: {
description: {
label: 'Description',
// Defined Background-Color
hidden: false,
// Defined Height
height: 50
}
}
},
{
id: 'resizer',
shape: 'dot',
color: 'black',
size: 5,
isResizer: true,
resizingSegment: 'container',
parent: 'parent',
level: 1,
},
{
id: 'connector',
shape: 'dot',
color: 'black',
size: 5,
isConnector: true,
connectorSegment: 'container',
parent: 'parent',
level: 1,
}
], edges: []
}
}
]
},
{
group: true,
text: 'Process',
elements: [
{
keywords: ['test', 'generic', 'process'],
text: 'Sample Process',
template: {
type: 'elements',
nodes: [
{
id: 'parent',
label: 'label',
shape: 'process',
editorComponentSelector: 'parent',
receiveDropableElements: true,
dropable: true,
segment: {
description: {
label: 'Description',
// Defined Background-Color
hidden: false,
// Defined Height
height: 50
}
}
},
{
id: '',
shape: 'dot',
color: 'black',
size: 5,
isResizer: true,
resizingSegment: 'container',
parent: 'parent',
level: 1,
}
], edges: []
}
}
]
},
{
group: true,
text: 'Equipment',
elements: [
{
keywords: ['test', 'generic', 'equipment'],
text: 'Sample Equipment',
template: {
type: 'elements',
nodes: [
{
id: 'parent',
label: 'label',
shape: 'equipment',
editorComponentSelector: 'parent',
receiveDropableElements: true,
dropable: true,
segment: {
description: {
label: 'Description',
// Defined Background-Color
hidden: false,
// Defined Height
height: 50
}
}
},
{
id: '',
shape: 'dot',
color: 'black',
size: 5,
isResizer: true,
resizingSegment: 'container',
parent: 'parent',
level: 1,
}
], edges: []
}
}
]
}
],
label: 'Nodes',
id: 'nodes'
},
edges: {
items: [
{
text: 'Normal-Line',
keywords: ['edge','dash','dashes'],
template: {
type: 'elements',
edges: [
{
to: 'replaced',
from: 'replaced',
dashes: false,
}
],
nodes: []
}
},
{
text: 'Dashed-Line',
keywords: ['edge','dash','dashes'],
template: {
type: 'elements',
edges: [
{
to: 'replaced',
from: 'replaced',
dashes: true,
}
],
nodes: []
}
}
],
id: 'edges',
label: 'Edges'
}
}
}
}