-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.js
159 lines (158 loc) · 3.54 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
export const CONFIG = {
TEST: {
USER: "Luigi Test",
EMAIL: "luigi.test05@gmail.com",
CANVAS: false,
ATTRIBUTE: false,
PALETTE: false,
ACTIVITY: false,
},
LAYER: {
META: "META",
MODEL: "MODEL",
},
WIDGET: {
NAME: {
MAIN: "Canvas",
PALETTE: "Palette",
ATTRIBUTE: "Property Browser",
ACTIVITY: "User Activity",
GUIDANCE: "Guidance",
HEATMAP: "Heatmap",
METADATA: "METADATA",
OPENAPI: "Metadata Widget",
DEBUG: "Debug",
IMSLD_EXPORT: "IMSLD Export",
JSON_EXPORT: "JSON Export",
VIEWCONTROL: "View Control",
},
},
ENTITY: {
NODE: "node",
EDGE: "edge",
ATTR: "attr",
VAL: "val",
},
IWC: {
FLAG: {
PUBLISH_GLOBAL: "PUBLISH_GLOBAL",
PUBLISH_LOCAL: "PUBLISH_LOCAL",
},
ACTION: {
SYNC: "ACTION_SYNC",
DATA: "ACTION_DATA",
DATA_ARRAY: "ACTION_DATA_ARRAY",
},
POSITION: {
NODE: {
ADD: 0,
DEL: 0,
POS: 1,
Z: 2,
DIM: 3,
},
EDGE: {
ADD: 0,
DEL: 0,
MOV: 1,
},
ATTR: {
ADD: 0,
DEL: 0,
},
},
},
OPERATION: {
TYPE: {
INSERT: "insert",
UPDATE: "update",
DELETE: "delete",
},
},
ACTIVITY: {
TYPE: {
NODEADD: 0,
EDGEADD: 1,
NODEDEL: 2,
EDGEDEL: 3,
NODEATTRCHANGE: 4,
},
},
DATA: {
RELATION: {
GLOBAL: {
MAIN: {
MAIN: {
OPERATION: "MAIN2MAIN4OPERATION",
},
},
},
LOCAL: {
PALETTE: {
MAIN: {
TOOLSELECTION: "PALETTE2MAIN4TOOLSELECTION",
},
},
MAIN: {
ATTRIBUTE: {
NODESELECTION: "MAIN2ATTRIBUTE4NODESELECTION",
NODEADDITION: "MAIN2ATTRIBUTE4NODEADDITION",
ATTRIBUTECHANGE: "MAIN2ATTRIBUTE4ATTRIBUTECHANGE",
},
ACTIVITY: {
NEWACTIVITY: "MAIN2ACTIVITY4NEWACTIVITY",
},
PALETTE: {
TOOLSELECTION: "MAIN2PALETTE4TOOLSELECTION",
},
},
ATTRIBUTE: {
MAIN: {
ATTRIBUTECHANGE: "ATTRIBUTE2MAIN4ATTRIBUTECHANGE",
},
},
},
},
},
NS: {
PERSON: {
TITLE: "http://purl.org/dc/terms/title",
JABBERID: "http://xmlns.com/foaf/0.1/jabberID",
MBOX: "http://xmlns.com/foaf/0.1/mbox",
},
MY: {
MODEL: "my:ns:model",
METAMODEL: "my:ns:metamodel",
INSTANCE: "my:ns:instance",
VIEWPOINT: "my:ns:viewpoint",
VIEW: "my:ns:view",
COPY: "my:ns:copy",
GUIDANCEMODEL: "my:ns:guidancemodel",
METAMODELPREVIEW: "my:ns:metamodelpreview",
GUIDANCEMETAMODEL: "my:ns:guidancemetamodel",
LOGICALGUIDANCEREPRESENTATION: "my:ns:logicalguidancerepresentation",
},
},
};
/**
* Gets the html tag name of a widget.
* Use this function to get the tag name of a or your own widget.
* @example getWidgetTagName("My Widget") // returns "my-widget-widget"
* @param {*} name name of the widget
* @returns {string} tag name of the widget
*/
export function getWidgetTagName(name) {
if (!name) return;
if (
!Object.values(CONFIG.WIDGET.NAME).some(
(n) => n.toLocaleLowerCase() === name.toLocaleLowerCase()
)
) {
console.warn(
`Widget name ${name} is not defined in config.js. Add it to the CONFIG.WIDGET.NAME object.`
);
}
let widgetName = name;
widgetName = widgetName.replace(/\s+/g, "-");
return `${widgetName}-widget`.toLowerCase();
}