@esfaenza/es-diagrams 12.2.8 → 12.2.12
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/bundles/esfaenza-es-diagrams.umd.js +107 -5
- package/bundles/esfaenza-es-diagrams.umd.js.map +1 -1
- package/esfaenza-es-diagrams.metadata.json +1 -1
- package/esm2015/lib/components/es-diagram.component.js +105 -4
- package/esm2015/lib/services/es-diagram.loc.js +3 -2
- package/esm2015/lib/services/es-diagram.service.js +2 -2
- package/fesm2015/esfaenza-es-diagrams.js +107 -5
- package/fesm2015/esfaenza-es-diagrams.js.map +1 -1
- package/lib/components/es-diagram.component.d.ts +49 -0
- package/lib/services/es-diagram.loc.d.ts +4 -0
- package/package.json +9 -9
|
@@ -938,7 +938,8 @@
|
|
|
938
938
|
"is loaded and managed directly by this library. You don't need to import it or use it directly, just be sure to set the relative options": { "en-US": "is loaded and managed directly by this library. You don't need to import it or use it directly, just be sure to set the relative options", "it-IT": "viene caricato e gestito nativamente dalla libreria. Non c'è bisogno di reimportarlo, né di configurarlo (usare le opzioni specifiche)" },
|
|
939
939
|
"If you don't specify a source and a target for an edge you have to write its id in the format {source}-{target}": { "en-US": "If you don't specify a source and a target for an edge you have to write its id in the format {source}-{target}", "it-IT": "Se non è specificata una sorgente e una destinazione per il collegamento è opportuno scriverne l'id nel formato {sorgente}-{destinazione}" },
|
|
940
940
|
"Elements have been changed after diagram initialization": { "en-US": "Elements have been changed after diagram initialization", "it-IT": "Rilevato un cambio di Elementi dopo l'inizializzazione del Diagramma" },
|
|
941
|
-
"Layout have been changed after diagram initialization": { "en-US": "Layout have been changed after diagram initialization", "it-IT": "Rilevato un cambio di Layout dopo l'inizializzazione del Diagramma" }
|
|
941
|
+
"Layout have been changed after diagram initialization": { "en-US": "Layout have been changed after diagram initialization", "it-IT": "Rilevato un cambio di Layout dopo l'inizializzazione del Diagramma" },
|
|
942
|
+
"Cannot update NodeHTMLTemplates as they don't seem to be used": { "en-US": "Cannot update NodeHTMLTemplates as they don't seem to be used", "it-IT": "Impossibile aggiornare i NodeHTMLTemplates dato che non sembra siano utilizzati" }
|
|
942
943
|
};
|
|
943
944
|
|
|
944
945
|
/** @ignore */ var cytoscape$1 = cy___namespace;
|
|
@@ -986,7 +987,7 @@
|
|
|
986
987
|
return [3 /*break*/, 6];
|
|
987
988
|
case 1: return [2 /*return*/, import('cytoscape-cxtmenu').then(function (module) { return _this.modulesCache[moduleId] = module.default; }).catch(function (err) { return _this.handleError(moduleId, err); })];
|
|
988
989
|
case 2: return [2 /*return*/, import('cytoscape-expand-collapse').then(function (module) { return _this.modulesCache[moduleId] = module.default; }).catch(function (err) { return _this.handleError(moduleId, err); })];
|
|
989
|
-
case 3: return [2 /*return*/, import('cytoscape-html-node').then(function (module) { return _this.modulesCache[moduleId] = module.register; }).catch(function (err) { return _this.handleError(moduleId, err); })];
|
|
990
|
+
case 3: return [2 /*return*/, import('@esfaenza/cytoscape-html-node').then(function (module) { return _this.modulesCache[moduleId] = module.register; }).catch(function (err) { return _this.handleError(moduleId, err); })];
|
|
990
991
|
case 4: return [4 /*yield*/, import('dagre').catch(function (err) { return _this.handleError("dagre", err); })];
|
|
991
992
|
case 5:
|
|
992
993
|
_b.sent();
|
|
@@ -1296,6 +1297,27 @@
|
|
|
1296
1297
|
* Funziona solamente se il **Layout** corrente del diagramma supporta le animazioni
|
|
1297
1298
|
*/
|
|
1298
1299
|
this.AnimateLayoutChanges = true;
|
|
1300
|
+
/**
|
|
1301
|
+
* Attiva una modalità di selezione "smart"... o perlomeno "smarter" del default di Cytoscape.
|
|
1302
|
+
*
|
|
1303
|
+
* - Il click di un elemento non selezionato lo seleziona
|
|
1304
|
+
* - Il click di un elemento selezionato lo deseleziona
|
|
1305
|
+
* - Lo stato di selezione viene persistito sull'oggetto originale invece di rimanere in un internal
|
|
1306
|
+
* - All'assegnazione di oggetti selezionati, questi vengono marcati correttamente con l'overlay di selezione
|
|
1307
|
+
*
|
|
1308
|
+
* N.B: la chiamata all'evento **onNodeClick** avviene **DOPO** la gestione della selezione
|
|
1309
|
+
*/
|
|
1310
|
+
this.SmartSelection = false;
|
|
1311
|
+
/**
|
|
1312
|
+
* CSS per la graficazione della selezione dei nodi. Quando un nodo verrà selezionato avrà sopra di se un overlay che 'sborda' di **overlay-padding** pixel,
|
|
1313
|
+
* di colore **overlay-color** e con un opacità **overlay-opacity**
|
|
1314
|
+
*
|
|
1315
|
+
* Assegnando "{}" a questo input, la Smart selection viene gestita ma la gestione grafica è affidata all'utente,
|
|
1316
|
+
* ad esempio usando dei **NodeHTMLTemplates** che definiscano selettori su nodi ":selected"
|
|
1317
|
+
*
|
|
1318
|
+
* @default {'overlay-color':'blue','overlay-opacity':0.5,'overlay-padding':7}
|
|
1319
|
+
*/
|
|
1320
|
+
this.SmartSelectionStyles = null;
|
|
1299
1321
|
/**
|
|
1300
1322
|
* Periodo di throttle da quando viene effettuato un resize a quando ricalcolare le dimensioni del diagramma.
|
|
1301
1323
|
*
|
|
@@ -1342,6 +1364,14 @@
|
|
|
1342
1364
|
* Evento lanciato al click di un nodo, contiene l'oggetto **data** del nodo in questione
|
|
1343
1365
|
*/
|
|
1344
1366
|
this.onNodeClick = new i0.EventEmitter();
|
|
1367
|
+
/**
|
|
1368
|
+
* Evento lanciato alla selezione o deselezione di un nodo, contiene l'oggetto **data** del nodo in questione e informazioni sul suo stato di selezione
|
|
1369
|
+
*/
|
|
1370
|
+
this.onNodeSelection = new i0.EventEmitter();
|
|
1371
|
+
/**
|
|
1372
|
+
* Evento lanciato al termine del Layouting. Se si vuole eseguire codice dopo che il Layout è fatto e completamente graficato, questo è il punto
|
|
1373
|
+
*/
|
|
1374
|
+
this.onLayoutDone = new i0.EventEmitter();
|
|
1345
1375
|
/**
|
|
1346
1376
|
* Evento lanciato al termine del caricamento del diagramma
|
|
1347
1377
|
*/
|
|
@@ -1354,6 +1384,10 @@
|
|
|
1354
1384
|
* Api dell'estensione expand-collapse per permettere di effettuare operazioni dall'esterno del diagramma. Vengono valorizzate se **UseExpandCollapse** è **true**
|
|
1355
1385
|
*/
|
|
1356
1386
|
this.ExpandCollapseApi = null;
|
|
1387
|
+
/**
|
|
1388
|
+
* Api dell'estensione html-node per permettere di effettuare operazioni dall'esterno del diagramma. Vengono valorizzate se sono impostati dei **NodeHTMLTemplates**
|
|
1389
|
+
*/
|
|
1390
|
+
this.HtmlNodeApi = null;
|
|
1357
1391
|
}
|
|
1358
1392
|
/**
|
|
1359
1393
|
* @ignore
|
|
@@ -1408,6 +1442,8 @@
|
|
|
1408
1442
|
if (elements && elements.length && elements.length > 0) {
|
|
1409
1443
|
this.reviewCytoscapeElements(elements, previous_elements);
|
|
1410
1444
|
this.cy.add(elements);
|
|
1445
|
+
if (this.SmartSelection)
|
|
1446
|
+
this.setupElementsSelectionIfNeeded();
|
|
1411
1447
|
// Se solo gli elementi cambiano, riapplico il Layout precedente
|
|
1412
1448
|
if (!layoutChanges && this.LastLayout) {
|
|
1413
1449
|
// Se devo animare le modifche al layout forzo il parametro relativo
|
|
@@ -1452,12 +1488,42 @@
|
|
|
1452
1488
|
// Se devo aggiornare in automatico in base alla dimensione del contenitore collego il ResizeObserver
|
|
1453
1489
|
if (this.AutoupdateSize)
|
|
1454
1490
|
this.listenOnChanges();
|
|
1491
|
+
if (this.SmartSelection) {
|
|
1492
|
+
this.setupSelectionStyles();
|
|
1493
|
+
this.setupElementsSelectionIfNeeded();
|
|
1494
|
+
}
|
|
1455
1495
|
this.onLoaded.emit();
|
|
1456
1496
|
return [2 /*return*/];
|
|
1457
1497
|
}
|
|
1458
1498
|
});
|
|
1459
1499
|
});
|
|
1460
1500
|
};
|
|
1501
|
+
/**
|
|
1502
|
+
* Prende tutti gli elementi appena assegnati, e se qualcuno era selezionato la situazione viene persistita su cytoscape
|
|
1503
|
+
*/
|
|
1504
|
+
EsDiagramComponent.prototype.setupElementsSelectionIfNeeded = function () {
|
|
1505
|
+
for (var i = 0; i < this.Elements.length; i++) {
|
|
1506
|
+
var eldata = this.Elements[i].data;
|
|
1507
|
+
if (eldata.__selected) {
|
|
1508
|
+
var el = this.cy.$id(eldata.id);
|
|
1509
|
+
el.select();
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
/**
|
|
1514
|
+
* Carica gli stili per mostrare carina la selezione dei nodi
|
|
1515
|
+
*/
|
|
1516
|
+
EsDiagramComponent.prototype.setupSelectionStyles = function () {
|
|
1517
|
+
var cssItem = this.SmartSelectionStyles || {
|
|
1518
|
+
'overlay-color': 'blue',
|
|
1519
|
+
'overlay-opacity': 0.5,
|
|
1520
|
+
'overlay-padding': 7
|
|
1521
|
+
};
|
|
1522
|
+
// Backdoor per poter assegnare "{}" a SmartSelectionStyles in modo di utilizzare la smart selection ma senza che nessuno stile venga applicato
|
|
1523
|
+
// ad esempio qualora si volesse utilizzare l'htmlnode per gestire la grafica degli elementi selezionati
|
|
1524
|
+
if (cssItem['overlay-color'] && cssItem['overlay-opacity'] && cssItem['overlay-padding'])
|
|
1525
|
+
this.cy.style().selector('node:selected').css(cssItem);
|
|
1526
|
+
};
|
|
1461
1527
|
/**
|
|
1462
1528
|
* Registra l'ascolto al contenitore del grafico e in caso di modifiche alla dimensione, al massimo una volta ogni 500 millisecondi, lo ridisegna
|
|
1463
1529
|
*/
|
|
@@ -1481,7 +1547,32 @@
|
|
|
1481
1547
|
EsDiagramComponent.prototype.bindCytoscapeEvents = function () {
|
|
1482
1548
|
var _this = this;
|
|
1483
1549
|
this.cy.bind('click', 'node', function (event) {
|
|
1484
|
-
|
|
1550
|
+
var targetData = event.target.data();
|
|
1551
|
+
if (_this.SmartSelection) {
|
|
1552
|
+
var id = targetData.id;
|
|
1553
|
+
var el = _this.cy.$id(id);
|
|
1554
|
+
var selected = el.selected();
|
|
1555
|
+
el.selectify();
|
|
1556
|
+
if (selected)
|
|
1557
|
+
el.unselect();
|
|
1558
|
+
else
|
|
1559
|
+
el.select();
|
|
1560
|
+
el.unselectify();
|
|
1561
|
+
// Questo va anche nella lista degli elementi originali (this.Elements) dato che cytoscape li prende per riferimento (bbbbbravo cyto-chan)
|
|
1562
|
+
el.data("__selected", !selected);
|
|
1563
|
+
}
|
|
1564
|
+
_this.onNodeClick.emit({ data: targetData });
|
|
1565
|
+
});
|
|
1566
|
+
this.cy.bind('select', 'node', function (event) {
|
|
1567
|
+
var targetData = event.target.data();
|
|
1568
|
+
_this.onNodeSelection.emit({ data: targetData, selected: true });
|
|
1569
|
+
});
|
|
1570
|
+
this.cy.bind('layoutstop', function (event) {
|
|
1571
|
+
_this.onLayoutDone.emit();
|
|
1572
|
+
});
|
|
1573
|
+
this.cy.bind('unselect', 'node', function (event) {
|
|
1574
|
+
var targetData = event.target.data();
|
|
1575
|
+
_this.onNodeSelection.emit({ data: targetData, selected: false });
|
|
1485
1576
|
});
|
|
1486
1577
|
// Altri eventi...
|
|
1487
1578
|
};
|
|
@@ -1551,8 +1642,8 @@
|
|
|
1551
1642
|
}
|
|
1552
1643
|
// Utilizzo dell'HTML node
|
|
1553
1644
|
if (this.NodeHTMLTemplates && this.NodeHTMLTemplates.length > 0) {
|
|
1554
|
-
|
|
1555
|
-
|
|
1645
|
+
this.HtmlNodeApi = anyCy.htmlnode();
|
|
1646
|
+
this.HtmlNodeApi.createHtmlNode(cytoscape, this.cy, this.NodeHTMLTemplates);
|
|
1556
1647
|
}
|
|
1557
1648
|
// Utilizzo del Context Menu
|
|
1558
1649
|
if (this.UseContextMenu)
|
|
@@ -1564,6 +1655,13 @@
|
|
|
1564
1655
|
if (this.ExtensionModulesApplyer)
|
|
1565
1656
|
this.ExtensionModulesApplyer(this.cy);
|
|
1566
1657
|
};
|
|
1658
|
+
EsDiagramComponent.prototype.updateCardData = function () {
|
|
1659
|
+
if (!this.HtmlNodeApi) {
|
|
1660
|
+
this.service.log("E", "Cannot update NodeHTMLTemplates as they don't seem to be used");
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
this.HtmlNodeApi.update();
|
|
1664
|
+
};
|
|
1567
1665
|
/**
|
|
1568
1666
|
* Metodo interno per il caricamento dei moduli di estensione
|
|
1569
1667
|
*
|
|
@@ -1680,12 +1778,16 @@
|
|
|
1680
1778
|
AutoupdateSize: [{ type: i0.Input }],
|
|
1681
1779
|
PreserveElementsPosition: [{ type: i0.Input }],
|
|
1682
1780
|
AnimateLayoutChanges: [{ type: i0.Input }],
|
|
1781
|
+
SmartSelection: [{ type: i0.Input }],
|
|
1782
|
+
SmartSelectionStyles: [{ type: i0.Input }],
|
|
1683
1783
|
ResizeThrottleTime: [{ type: i0.Input }],
|
|
1684
1784
|
Layout: [{ type: i0.Input }],
|
|
1685
1785
|
NodeHTMLTemplates: [{ type: i0.Input }],
|
|
1686
1786
|
ExtensionModulesImporter: [{ type: i0.Input }],
|
|
1687
1787
|
ExtensionModulesApplyer: [{ type: i0.Input }],
|
|
1688
1788
|
onNodeClick: [{ type: i0.Output }],
|
|
1789
|
+
onNodeSelection: [{ type: i0.Output }],
|
|
1790
|
+
onLayoutDone: [{ type: i0.Output }],
|
|
1689
1791
|
onLoaded: [{ type: i0.Output }]
|
|
1690
1792
|
};
|
|
1691
1793
|
|