nope/resources/ui/graph/defaults/default.elements.ts
2020-10-29 19:20:42 +01:00

368 lines
13 KiB
TypeScript

/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2019-05-06 08:28:53
* @modify date 2020-10-29 19:18:14
* @desc [description]
*/
import { ISelection } from '../../layout/interfaces/ISelection';
import { IBasicTemplate } from '../interfaces/IBasicTemplate';
/**
* 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<N=any,E=any>(): ISelection<IBasicTemplate<N,E>>
{
const ret: ISelection<IBasicTemplate<N,E>> = [
{
groupName: 'Graph Elements',
items: [
{
keywords: 'swimlane,horizontal',
label: 'Horizontal Swimlane',
template: {
type: 'element',
nodes: [
{
id: '',
font: {
background: 'white'
},
label: 'label',
shape: 'swimlane-horizontal'
}
], edges: []
}
},
{
keywords: 'swimlane,vertical',
label: 'Vertical Swimlane',
template: {
type: 'element',
nodes: [
{
id: '',
font: {
background: 'white'
},
label: 'label',
shape: 'swimlane-vertical'
}
], edges: []
}
},
{
keywords: 'rectangle',
label: 'Rectangle',
template: {
type: 'element',
nodes: [
{
id: '',
dropable: true,
label: 'label',
shape: 'box'
}
], edges: []
}
},
{
keywords: 'circle',
label: 'Circle',
template: {
type: 'element',
nodes: [
{
id: '',
dropable: true,
label: 'label',
shape: 'circle'
}
], edges: []
}
},
{
keywords: 'ellipse',
label: 'Ellipse',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'ellipse'
}
], edges: []
}
},
{
keywords: 'hexagon',
label: 'Hexagon',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'hexagon'
}
], edges: []
}
},
{
keywords: 'triangle',
label: 'Triangle',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'triangle'
}
], edges: []
}
},
{
keywords: 'triangle-down',
label: 'Triangle-Down',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'triangleDown'
}
], edges: []
}
},
{
keywords: 'square',
label: 'Square',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'square'
}
], edges: []
}
},
{
keywords: 'diamond',
label: 'Diamond',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'diamond'
}
], edges: []
}
},
{
keywords: 'star',
label: 'Star',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'star'
}
], edges: []
}
},
{
keywords:'database',
label: 'Database',
template: {
type: 'element',
nodes: [
{
id: '',
label: 'label',
shape: 'database'
}
], edges: []
}
}
]
}, {
groupName: 'Products',
items: [
{
keywords: 'generic,roduct',
label: 'Sample Product',
template: {
type: 'element',
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: []
}
}
]
},{
groupName: 'Process',
items: [
{
keywords: 'generic,process',
label: 'Sample Process',
template: {
type: 'element',
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: []
}
}
]
},{
groupName: 'Equipment',
items: [
{
keywords: 'generic,equipment',
label: 'Sample Equipment',
template: {
type: 'element',
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: []
}
}
]
}, {
groupName: 'Edges',
items: [
{
label: 'Normal-Line',
keywords: 'edge,dash,dashes',
template: {
type: 'element',
edges: [
{
to: 'replaced',
from: 'replaced',
dashes: false,
}
],
nodes: []
}
},
{
label: 'Dashed-Line',
keywords: 'edge,dash,dashes',
template: {
type: 'element',
edges: [
{
to: 'replaced',
from: 'replaced',
dashes: true,
}
],
nodes: []
}
}
]
}
]
return ret;
}