@linkurious/ogma-linkurious-parser 3.1.13 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/captions/captions.js +42 -54
- package/dist/captions/captions.js.map +1 -1
- package/dist/filters/filters.d.ts +1 -1
- package/dist/filters/filters.js +55 -76
- package/dist/filters/filters.js.map +1 -1
- package/dist/index.js +34 -33
- package/dist/index.js.map +1 -1
- package/dist/ogma/features/OgmaStore.js +16 -30
- package/dist/ogma/features/OgmaStore.js.map +1 -1
- package/dist/ogma/features/captions.js +43 -87
- package/dist/ogma/features/captions.js.map +1 -1
- package/dist/ogma/features/reactive.js +58 -75
- package/dist/ogma/features/reactive.js.map +1 -1
- package/dist/ogma/features/selectors.d.ts +5 -5
- package/dist/ogma/features/selectors.js +25 -16
- package/dist/ogma/features/selectors.js.map +1 -1
- package/dist/ogma/features/styles.js +115 -137
- package/dist/ogma/features/styles.js.map +1 -1
- package/dist/ogma/features/transformations.js +39 -87
- package/dist/ogma/features/transformations.js.map +1 -1
- package/dist/ogma/index.js +140 -230
- package/dist/ogma/index.js.map +1 -1
- package/dist/styles/edgeAttributes.js +31 -47
- package/dist/styles/edgeAttributes.js.map +1 -1
- package/dist/styles/itemAttributes.js +33 -42
- package/dist/styles/itemAttributes.js.map +1 -1
- package/dist/styles/nodeAttributes.js +49 -71
- package/dist/styles/nodeAttributes.js.map +1 -1
- package/dist/styles/styleRule.js +57 -68
- package/dist/styles/styleRule.js.map +1 -1
- package/dist/styles/styleRules.js +150 -192
- package/dist/styles/styleRules.js.map +1 -1
- package/dist/tools/colorPalette.js +1 -0
- package/dist/tools/colorPalette.js.map +1 -1
- package/dist/tools/ogmaTool.js +28 -30
- package/dist/tools/ogmaTool.js.map +1 -1
- package/dist/tools/tools.js +88 -91
- package/dist/tools/tools.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
exports.StylesViz = exports.FILTER_OPACITY = void 0;
|
|
4
|
+
const __1 = require("../..");
|
|
5
|
+
const tools_1 = require("../../tools/tools");
|
|
6
|
+
const HOVERED_SELECTED_NODE_STYLE = {
|
|
17
7
|
text: {
|
|
18
8
|
style: 'bold',
|
|
19
9
|
backgroundColor: '#fff',
|
|
@@ -22,7 +12,7 @@ var HOVERED_SELECTED_NODE_STYLE = {
|
|
|
22
12
|
outerStroke: { width: 2 },
|
|
23
13
|
outline: false
|
|
24
14
|
};
|
|
25
|
-
|
|
15
|
+
const HOVERED_SELECTED_EDGE_STYLE = {
|
|
26
16
|
text: {
|
|
27
17
|
style: 'bold',
|
|
28
18
|
backgroundColor: '#fff',
|
|
@@ -30,25 +20,25 @@ var HOVERED_SELECTED_EDGE_STYLE = {
|
|
|
30
20
|
},
|
|
31
21
|
outline: false
|
|
32
22
|
};
|
|
33
|
-
|
|
23
|
+
const NODE_HALO_CONFIGURATION = {
|
|
34
24
|
color: '#FFF',
|
|
35
25
|
width: 7,
|
|
36
26
|
scalingMethod: 'scaled',
|
|
37
27
|
strokeWidth: 0,
|
|
38
28
|
hideNonAdjacentEdges: false
|
|
39
29
|
};
|
|
40
|
-
|
|
30
|
+
const EDGE_HALO_CONFIGURATION = {
|
|
41
31
|
color: '#FFF',
|
|
42
32
|
scalingMethod: 'scaled',
|
|
43
33
|
width: 4
|
|
44
34
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const DEFAULT_OGMA_FONT = "'roboto', sans-serif";
|
|
36
|
+
const DARK_FONT_COLOR = '#000';
|
|
37
|
+
const CLEAR_FONT_COLOR = '#FFF';
|
|
38
|
+
const ITEM_DEFAULT_COLOR = '#7f7f7f';
|
|
49
39
|
exports.FILTER_OPACITY = 0.2;
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
class StylesViz {
|
|
41
|
+
constructor(ogma, configuration) {
|
|
52
42
|
this._nodeAttributes = new __1.NodeAttributes({});
|
|
53
43
|
this._edgeAttributes = new __1.EdgeAttributes({});
|
|
54
44
|
this._ogma = ogma;
|
|
@@ -57,7 +47,7 @@ var StylesViz = /** @class */ (function () {
|
|
|
57
47
|
/**
|
|
58
48
|
* Set nodes default styles based on the configuration
|
|
59
49
|
*/
|
|
60
|
-
|
|
50
|
+
setNodesDefaultStyles() {
|
|
61
51
|
// setting selection and hover attributes
|
|
62
52
|
this._ogma.styles.setHoveredNodeAttributes(HOVERED_SELECTED_NODE_STYLE);
|
|
63
53
|
this._ogma.styles.setSelectedNodeAttributes(HOVERED_SELECTED_NODE_STYLE);
|
|
@@ -65,6 +55,7 @@ var StylesViz = /** @class */ (function () {
|
|
|
65
55
|
this._nodeDefaultStylesRules = this._ogma.styles.addRule({
|
|
66
56
|
nodeAttributes: {
|
|
67
57
|
text: {
|
|
58
|
+
padding: 5,
|
|
68
59
|
minVisibleSize: this._defaultConfiguration.node.text !== undefined &&
|
|
69
60
|
this._defaultConfiguration.node.text.minVisibleSize
|
|
70
61
|
? this._defaultConfiguration.node.text.minVisibleSize
|
|
@@ -109,11 +100,11 @@ var StylesViz = /** @class */ (function () {
|
|
|
109
100
|
outline: false
|
|
110
101
|
}
|
|
111
102
|
});
|
|
112
|
-
}
|
|
103
|
+
}
|
|
113
104
|
/**
|
|
114
105
|
* Set edges default styles based on the configuration
|
|
115
106
|
*/
|
|
116
|
-
|
|
107
|
+
setEdgesDefaultStyles() {
|
|
117
108
|
// setting selection and hover attributes
|
|
118
109
|
this._ogma.styles.setHoveredEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);
|
|
119
110
|
this._ogma.styles.setSelectedEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);
|
|
@@ -154,23 +145,22 @@ var StylesViz = /** @class */ (function () {
|
|
|
154
145
|
color: ITEM_DEFAULT_COLOR
|
|
155
146
|
}
|
|
156
147
|
});
|
|
157
|
-
}
|
|
148
|
+
}
|
|
158
149
|
/**
|
|
159
150
|
* Set nodes default styles based on the configuration
|
|
160
151
|
*/
|
|
161
|
-
|
|
162
|
-
var _this = this;
|
|
152
|
+
setNodesDefaultHalo() {
|
|
163
153
|
// setting default halo style
|
|
164
154
|
this._nodeDefaultHaloRules = this._ogma.styles.addRule({
|
|
165
|
-
nodeSelector:
|
|
155
|
+
nodeSelector: (node) => node && !node.hasClass('filtered'),
|
|
166
156
|
nodeAttributes: {
|
|
167
|
-
halo:
|
|
157
|
+
halo: (node) => {
|
|
168
158
|
if (node !== undefined &&
|
|
169
159
|
!node.hasClass('filtered') &&
|
|
170
160
|
(node.isSelected() ||
|
|
171
161
|
node.getAdjacentNodes({}).isSelected().includes(true) ||
|
|
172
162
|
node.getAdjacentEdges().isSelected().includes(true))) {
|
|
173
|
-
return
|
|
163
|
+
return Object.assign(Object.assign({}, NODE_HALO_CONFIGURATION), { scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled' });
|
|
174
164
|
}
|
|
175
165
|
return null;
|
|
176
166
|
}
|
|
@@ -189,23 +179,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
189
179
|
}
|
|
190
180
|
}
|
|
191
181
|
});
|
|
192
|
-
}
|
|
182
|
+
}
|
|
193
183
|
/**
|
|
194
184
|
* Set edges default styles based on the configuration
|
|
195
185
|
*/
|
|
196
|
-
|
|
197
|
-
var _this = this;
|
|
186
|
+
setEdgesDefaultHalo() {
|
|
198
187
|
// setting default halo styles
|
|
199
188
|
this._edgeDefaultHaloRules = this._ogma.styles.addRule({
|
|
200
|
-
edgeSelector:
|
|
201
|
-
return edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered');
|
|
202
|
-
},
|
|
189
|
+
edgeSelector: (edge) => edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered'),
|
|
203
190
|
edgeAttributes: {
|
|
204
|
-
halo:
|
|
191
|
+
halo: (edge) => {
|
|
205
192
|
if (edge &&
|
|
206
193
|
!edge.hasClass('filtered') &&
|
|
207
194
|
(edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())) {
|
|
208
|
-
return
|
|
195
|
+
return Object.assign(Object.assign({}, EDGE_HALO_CONFIGURATION), { scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled' });
|
|
209
196
|
}
|
|
210
197
|
return null;
|
|
211
198
|
}
|
|
@@ -221,36 +208,36 @@ var StylesViz = /** @class */ (function () {
|
|
|
221
208
|
}
|
|
222
209
|
}
|
|
223
210
|
});
|
|
224
|
-
}
|
|
211
|
+
}
|
|
225
212
|
/**
|
|
226
213
|
* Return the default node radius set in configuration or 5
|
|
227
214
|
*
|
|
228
215
|
* @returns {number}
|
|
229
216
|
*/
|
|
230
|
-
|
|
217
|
+
defaultNodeRadius(styles) {
|
|
231
218
|
return this.defaultStylesHas(styles, ['nodeRadius']) ? styles.nodeRadius : 5;
|
|
232
|
-
}
|
|
219
|
+
}
|
|
233
220
|
/**
|
|
234
221
|
* Return the default edge width set in configuration or 1
|
|
235
222
|
*
|
|
236
223
|
* @returns {number}
|
|
237
224
|
*/
|
|
238
|
-
|
|
225
|
+
defaultEdgeWidth(styles) {
|
|
239
226
|
return this.defaultStylesHas(styles, ['edgeWidth']) ? styles.edgeWidth : 1;
|
|
240
|
-
}
|
|
227
|
+
}
|
|
241
228
|
/**
|
|
242
229
|
* Check if a style property exists in the default styles object
|
|
243
230
|
*/
|
|
244
|
-
|
|
231
|
+
defaultStylesHas(styles, propertyPath) {
|
|
245
232
|
if (!tools_1.Tools.isDefined(styles)) {
|
|
246
233
|
return false;
|
|
247
234
|
}
|
|
248
235
|
return tools_1.Tools.getIn(styles, propertyPath) !== undefined;
|
|
249
|
-
}
|
|
236
|
+
}
|
|
250
237
|
/**
|
|
251
238
|
* Set styles for the class "filtered"
|
|
252
239
|
*/
|
|
253
|
-
|
|
240
|
+
setFilterClass() {
|
|
254
241
|
this._ogma.styles.createClass({
|
|
255
242
|
name: 'filtered',
|
|
256
243
|
nodeAttributes: {
|
|
@@ -287,11 +274,11 @@ var StylesViz = /** @class */ (function () {
|
|
|
287
274
|
width: 0.2
|
|
288
275
|
}
|
|
289
276
|
});
|
|
290
|
-
}
|
|
277
|
+
}
|
|
291
278
|
/**
|
|
292
279
|
* Set the class for exported nodes and edges
|
|
293
280
|
*/
|
|
294
|
-
|
|
281
|
+
setExportClass(textWrappingLength) {
|
|
295
282
|
if (!this._exportClass) {
|
|
296
283
|
this._exportClass = this._ogma.styles.createClass({
|
|
297
284
|
name: 'exported',
|
|
@@ -322,29 +309,28 @@ var StylesViz = /** @class */ (function () {
|
|
|
322
309
|
}
|
|
323
310
|
});
|
|
324
311
|
}
|
|
325
|
-
}
|
|
312
|
+
}
|
|
326
313
|
/**
|
|
327
314
|
* Set the rule to display badges
|
|
328
315
|
*/
|
|
329
|
-
|
|
330
|
-
var _this = this;
|
|
316
|
+
setBadgeRule() {
|
|
331
317
|
this._ogma.styles.createClass({
|
|
332
318
|
name: 'degreeIndicator',
|
|
333
319
|
nodeAttributes: {
|
|
334
320
|
badges: {
|
|
335
|
-
topRight:
|
|
321
|
+
topRight: (node) => {
|
|
336
322
|
if (node !== undefined) {
|
|
337
|
-
|
|
338
|
-
|
|
323
|
+
const degree = tools_1.Tools.getHiddenNeighbors(node.toList());
|
|
324
|
+
const badgeContent = tools_1.Tools.formatNumber(degree);
|
|
339
325
|
if (degree > 0) {
|
|
340
|
-
|
|
326
|
+
const nodeColor = Array.isArray(node.getAttribute('color'))
|
|
341
327
|
? node.getAttribute('color')[0]
|
|
342
328
|
: node.getAttribute('color');
|
|
343
|
-
|
|
329
|
+
const textColor = __1.OgmaTools.isBright(nodeColor)
|
|
344
330
|
? DARK_FONT_COLOR
|
|
345
331
|
: CLEAR_FONT_COLOR;
|
|
346
|
-
|
|
347
|
-
|
|
332
|
+
const isSupernode = node.getData(['statistics', 'supernode']);
|
|
333
|
+
let content = null;
|
|
348
334
|
if (+badgeContent !== 0) {
|
|
349
335
|
content = isSupernode ? badgeContent + '+' : badgeContent;
|
|
350
336
|
}
|
|
@@ -356,9 +342,9 @@ var StylesViz = /** @class */ (function () {
|
|
|
356
342
|
color: null
|
|
357
343
|
},
|
|
358
344
|
text: {
|
|
359
|
-
font:
|
|
360
|
-
|
|
361
|
-
?
|
|
345
|
+
font: this._defaultConfiguration.node.text !== undefined &&
|
|
346
|
+
this._defaultConfiguration.node.text.font !== undefined
|
|
347
|
+
? this._defaultConfiguration.node.text.font
|
|
362
348
|
: DEFAULT_OGMA_FONT,
|
|
363
349
|
scale: 0.4,
|
|
364
350
|
color: textColor,
|
|
@@ -375,12 +361,12 @@ var StylesViz = /** @class */ (function () {
|
|
|
375
361
|
name: 'pinnedIndicator',
|
|
376
362
|
nodeAttributes: {
|
|
377
363
|
badges: {
|
|
378
|
-
bottomRight:
|
|
364
|
+
bottomRight: (node) => {
|
|
379
365
|
if (node !== undefined && !node.getAttribute('layoutable')) {
|
|
380
|
-
|
|
366
|
+
const nodeColor = Array.isArray(node.getAttribute('color'))
|
|
381
367
|
? node.getAttribute('color')[0]
|
|
382
368
|
: node.getAttribute('color');
|
|
383
|
-
|
|
369
|
+
const textColor = __1.OgmaTools.isBright(nodeColor)
|
|
384
370
|
? DARK_FONT_COLOR
|
|
385
371
|
: CLEAR_FONT_COLOR;
|
|
386
372
|
return {
|
|
@@ -405,43 +391,42 @@ var StylesViz = /** @class */ (function () {
|
|
|
405
391
|
self: { attributes: ['layoutable'] }
|
|
406
392
|
}
|
|
407
393
|
});
|
|
408
|
-
this._ogma.events.on('addNodes',
|
|
409
|
-
this._ogma.events.on('addNodes',
|
|
410
|
-
}
|
|
394
|
+
this._ogma.events.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('degreeIndicator'));
|
|
395
|
+
this._ogma.events.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('pinnedIndicator'));
|
|
396
|
+
}
|
|
411
397
|
/**
|
|
412
398
|
* Delete the rule to display badges
|
|
413
399
|
*/
|
|
414
|
-
|
|
400
|
+
deleteBadgeRule() {
|
|
415
401
|
this._ogma.getNodes().removeClasses(['degreeIndicator', 'pinnedIndicator'], 0);
|
|
416
|
-
}
|
|
402
|
+
}
|
|
417
403
|
/**
|
|
418
404
|
* set text overlap to true or false
|
|
419
405
|
*
|
|
420
406
|
* @param {boolean} overlap
|
|
421
407
|
*/
|
|
422
|
-
|
|
408
|
+
toggleTextOverlap(overlap) {
|
|
423
409
|
this._ogma.setOptions({ texts: { preventOverlap: overlap } });
|
|
424
|
-
}
|
|
410
|
+
}
|
|
425
411
|
/**
|
|
426
412
|
* refresh nodes and edge rules
|
|
427
413
|
*
|
|
428
414
|
*/
|
|
429
|
-
|
|
415
|
+
refreshRules() {
|
|
430
416
|
this._nodeDefaultStylesRules.refresh();
|
|
431
417
|
this._edgeDefaultStylesRules.refresh();
|
|
432
|
-
}
|
|
418
|
+
}
|
|
433
419
|
/**
|
|
434
420
|
* Create / refresh an ogma rule for node colors
|
|
435
421
|
*/
|
|
436
|
-
|
|
437
|
-
var _this = this;
|
|
422
|
+
refreshNodeColors(colorStyleRules) {
|
|
438
423
|
if (!tools_1.Tools.isDefined(this._ogmaNodeColor)) {
|
|
439
424
|
this._nodeAttributes.refresh({ color: colorStyleRules });
|
|
440
425
|
this._ogmaNodeColor = this._ogma.styles.addRule({
|
|
441
426
|
nodeAttributes: {
|
|
442
|
-
color:
|
|
427
|
+
color: (node) => {
|
|
443
428
|
if (node !== undefined) {
|
|
444
|
-
return
|
|
429
|
+
return this._nodeAttributes.color(node.getData());
|
|
445
430
|
}
|
|
446
431
|
}
|
|
447
432
|
},
|
|
@@ -454,60 +439,59 @@ var StylesViz = /** @class */ (function () {
|
|
|
454
439
|
// TODO refresh node icons when moving the code from LKE
|
|
455
440
|
// this.refreshIconsColor();
|
|
456
441
|
}
|
|
457
|
-
}
|
|
442
|
+
}
|
|
458
443
|
/**
|
|
459
444
|
* Return an array of StyleRules with only the style that need to be applied
|
|
460
445
|
*/
|
|
461
|
-
|
|
446
|
+
getStyleRule(state, styleType) {
|
|
462
447
|
return new __1.StyleRules(state)[styleType];
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
448
|
+
}
|
|
449
|
+
initNodeColors(nodeRules) {
|
|
450
|
+
const nodeColorRules = this.getStyleRule(nodeRules, __1.StyleType.COLOR);
|
|
466
451
|
this.refreshNodeColors(nodeColorRules);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
452
|
+
}
|
|
453
|
+
initNodesIcons(nodeRules) {
|
|
454
|
+
const nodeIconsRules = this.getStyleRule(nodeRules, __1.StyleType.ICON);
|
|
470
455
|
this.refreshNodeIcons(nodeIconsRules);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
456
|
+
}
|
|
457
|
+
initNodesSizes(nodeRules) {
|
|
458
|
+
const nodeSizeRules = this.getStyleRule(nodeRules, __1.StyleType.SIZE);
|
|
474
459
|
this.refreshNodeSize(nodeSizeRules);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
460
|
+
}
|
|
461
|
+
initNodesShapes(nodeRules) {
|
|
462
|
+
const nodeShapesRules = this.getStyleRule(nodeRules, __1.StyleType.SHAPE);
|
|
478
463
|
this.refreshNodeShape(nodeShapesRules);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
464
|
+
}
|
|
465
|
+
initEdgesWidth(edgeRules) {
|
|
466
|
+
const edgesWidthRules = this.getStyleRule(edgeRules, __1.StyleType.WIDTH);
|
|
482
467
|
this.refreshEdgeWidth(edgesWidthRules);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
468
|
+
}
|
|
469
|
+
initEdgesShape(edgeRules) {
|
|
470
|
+
const edgesShapeRules = this.getStyleRule(edgeRules, __1.StyleType.SHAPE);
|
|
486
471
|
this.refreshEdgeShape(edgesShapeRules);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
|
|
472
|
+
}
|
|
473
|
+
initEdgesColor(edgeRules) {
|
|
474
|
+
const edgesColorRules = this.getStyleRule(edgeRules, __1.StyleType.COLOR);
|
|
490
475
|
this.refreshEdgeColors(edgesColorRules);
|
|
491
|
-
}
|
|
476
|
+
}
|
|
492
477
|
/**
|
|
493
478
|
* Create / refresh an ogma rule for node icons
|
|
494
479
|
*
|
|
495
480
|
* @param {Array<any>} iconStyleRules
|
|
496
481
|
*/
|
|
497
|
-
|
|
498
|
-
var _this = this;
|
|
482
|
+
refreshNodeIcons(iconStyleRules) {
|
|
499
483
|
if (!tools_1.Tools.isDefined(this._ogmaNodeIcon)) {
|
|
500
484
|
this._nodeAttributes.refresh({ icon: iconStyleRules });
|
|
501
485
|
this._ogmaNodeIcon = this._ogma.styles.addRule({
|
|
502
486
|
nodeAttributes: {
|
|
503
|
-
icon:
|
|
487
|
+
icon: (node) => {
|
|
504
488
|
if (node !== undefined) {
|
|
505
|
-
return
|
|
489
|
+
return this._nodeAttributes.icon(node.getData()).icon;
|
|
506
490
|
}
|
|
507
491
|
},
|
|
508
|
-
image:
|
|
492
|
+
image: (node) => {
|
|
509
493
|
if (node !== undefined) {
|
|
510
|
-
return
|
|
494
|
+
return this._nodeAttributes.icon(node.getData()).image;
|
|
511
495
|
}
|
|
512
496
|
}
|
|
513
497
|
},
|
|
@@ -518,21 +502,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
518
502
|
this._nodeAttributes.refresh({ icon: iconStyleRules });
|
|
519
503
|
this._ogmaNodeIcon.refresh();
|
|
520
504
|
}
|
|
521
|
-
}
|
|
505
|
+
}
|
|
522
506
|
/**
|
|
523
507
|
* Create / refresh an ogma rule for node sizes
|
|
524
508
|
*
|
|
525
509
|
* @param {Array<any>} sizeStyleRules
|
|
526
510
|
*/
|
|
527
|
-
|
|
528
|
-
var _this = this;
|
|
511
|
+
refreshNodeSize(sizeStyleRules) {
|
|
529
512
|
if (!tools_1.Tools.isDefined(this._ogmaNodeSize)) {
|
|
530
513
|
this._nodeAttributes.refresh({ size: sizeStyleRules });
|
|
531
514
|
this._ogmaNodeSize = this._ogma.styles.addRule({
|
|
532
515
|
nodeAttributes: {
|
|
533
|
-
radius:
|
|
516
|
+
radius: (node) => {
|
|
534
517
|
if (node !== undefined) {
|
|
535
|
-
return
|
|
518
|
+
return this._nodeAttributes.size(node.getData());
|
|
536
519
|
}
|
|
537
520
|
}
|
|
538
521
|
},
|
|
@@ -543,21 +526,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
543
526
|
this._nodeAttributes.refresh({ size: sizeStyleRules });
|
|
544
527
|
this._ogmaNodeSize.refresh();
|
|
545
528
|
}
|
|
546
|
-
}
|
|
529
|
+
}
|
|
547
530
|
/**
|
|
548
531
|
* Create / refresh an ogma rule for node images
|
|
549
532
|
*
|
|
550
533
|
* @param {Array<any>} shapeStyleRules
|
|
551
534
|
*/
|
|
552
|
-
|
|
553
|
-
var _this = this;
|
|
535
|
+
refreshNodeShape(shapeStyleRules) {
|
|
554
536
|
if (!tools_1.Tools.isDefined(this._ogmaNodeShape)) {
|
|
555
537
|
this._nodeAttributes.refresh({ shape: shapeStyleRules });
|
|
556
538
|
this._ogmaNodeShape = this._ogma.styles.addRule({
|
|
557
539
|
nodeAttributes: {
|
|
558
|
-
shape:
|
|
540
|
+
shape: (node) => {
|
|
559
541
|
if (node !== undefined) {
|
|
560
|
-
return
|
|
542
|
+
return this._nodeAttributes.shape(node.getData());
|
|
561
543
|
}
|
|
562
544
|
}
|
|
563
545
|
},
|
|
@@ -568,19 +550,18 @@ var StylesViz = /** @class */ (function () {
|
|
|
568
550
|
this._nodeAttributes.refresh({ shape: shapeStyleRules });
|
|
569
551
|
this._ogmaNodeShape.refresh();
|
|
570
552
|
}
|
|
571
|
-
}
|
|
553
|
+
}
|
|
572
554
|
/**
|
|
573
555
|
* Create / refresh an ogma rule for edge colors
|
|
574
556
|
*/
|
|
575
|
-
|
|
576
|
-
var _this = this;
|
|
557
|
+
refreshEdgeColors(colorStyleRules) {
|
|
577
558
|
if (!tools_1.Tools.isDefined(this._ogmaEdgeColor)) {
|
|
578
559
|
this._edgeAttributes.refresh({ color: colorStyleRules });
|
|
579
560
|
this._ogmaEdgeColor = this._ogma.styles.addRule({
|
|
580
561
|
edgeAttributes: {
|
|
581
|
-
color:
|
|
562
|
+
color: (edge) => {
|
|
582
563
|
if (edge !== undefined) {
|
|
583
|
-
return
|
|
564
|
+
return this._edgeAttributes.color(edge.getData());
|
|
584
565
|
}
|
|
585
566
|
}
|
|
586
567
|
},
|
|
@@ -591,21 +572,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
591
572
|
this._edgeAttributes.refresh({ color: colorStyleRules });
|
|
592
573
|
this._ogmaEdgeColor.refresh();
|
|
593
574
|
}
|
|
594
|
-
}
|
|
575
|
+
}
|
|
595
576
|
/**
|
|
596
577
|
* Create / refresh an ogma rule for edge width
|
|
597
578
|
*
|
|
598
579
|
* @param {Array<LKStyleRule>} widthStyleRules
|
|
599
580
|
*/
|
|
600
|
-
|
|
601
|
-
var _this = this;
|
|
581
|
+
refreshEdgeWidth(widthStyleRules) {
|
|
602
582
|
if (!tools_1.Tools.isDefined(this._ogmaEdgeWidth)) {
|
|
603
583
|
this._edgeAttributes.refresh({ width: widthStyleRules });
|
|
604
584
|
this._ogmaEdgeWidth = this._ogma.styles.addRule({
|
|
605
585
|
edgeAttributes: {
|
|
606
|
-
width:
|
|
586
|
+
width: (edge) => {
|
|
607
587
|
if (edge !== undefined) {
|
|
608
|
-
return
|
|
588
|
+
return this._edgeAttributes.width(edge.getData());
|
|
609
589
|
}
|
|
610
590
|
}
|
|
611
591
|
},
|
|
@@ -618,21 +598,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
618
598
|
this._edgeAttributes.refresh({ width: widthStyleRules });
|
|
619
599
|
this._ogmaEdgeWidth.refresh();
|
|
620
600
|
}
|
|
621
|
-
}
|
|
601
|
+
}
|
|
622
602
|
/**
|
|
623
603
|
* Create / refresh an ogma rule for edge width
|
|
624
604
|
*
|
|
625
605
|
* @param {Array<LKStyleRule>} shapeStyleRules
|
|
626
606
|
*/
|
|
627
|
-
|
|
628
|
-
var _this = this;
|
|
607
|
+
refreshEdgeShape(shapeStyleRules) {
|
|
629
608
|
if (!tools_1.Tools.isDefined(this._ogmaEdgeShape)) {
|
|
630
609
|
this._edgeAttributes.refresh({ shape: shapeStyleRules });
|
|
631
610
|
this._ogmaEdgeShape = this._ogma.styles.addRule({
|
|
632
611
|
edgeAttributes: {
|
|
633
|
-
shape:
|
|
612
|
+
shape: (edge) => {
|
|
634
613
|
if (edge !== undefined) {
|
|
635
|
-
return
|
|
614
|
+
return this._edgeAttributes.shape(edge.getData());
|
|
636
615
|
}
|
|
637
616
|
}
|
|
638
617
|
},
|
|
@@ -643,8 +622,7 @@ var StylesViz = /** @class */ (function () {
|
|
|
643
622
|
this._edgeAttributes.refresh({ shape: shapeStyleRules });
|
|
644
623
|
this._ogmaEdgeShape.refresh();
|
|
645
624
|
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
}());
|
|
625
|
+
}
|
|
626
|
+
}
|
|
649
627
|
exports.StylesViz = StylesViz;
|
|
650
628
|
//# sourceMappingURL=styles.js.map
|