@linkurious/ogma-linkurious-parser 3.1.11 → 3.1.13
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/README.md
CHANGED
|
@@ -67,28 +67,32 @@ var TransformationsViz = /** @class */ (function () {
|
|
|
67
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
68
68
|
var _this = this;
|
|
69
69
|
return __generator(this, function (_a) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
if (!(this.transformation === undefined)) return [3 /*break*/, 1];
|
|
73
|
+
this.transformation = this._ogma.transformations.addEdgeGrouping({
|
|
74
|
+
separateEdgesByDirection: true,
|
|
75
|
+
selector: function (edge) {
|
|
76
|
+
return _this.groupedEdges[edge.getData('type')];
|
|
77
|
+
},
|
|
78
|
+
groupIdFunction: function (edge) { return edge.getData('type'); },
|
|
79
|
+
generator: function (edges) {
|
|
80
|
+
return {
|
|
81
|
+
data: {
|
|
82
|
+
properties: {
|
|
83
|
+
originalType: edges.getData('type')[0]
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return [3 /*break*/, 3];
|
|
90
|
+
case 1: return [4 /*yield*/, this.transformation.refresh()];
|
|
91
|
+
case 2:
|
|
92
|
+
_a.sent();
|
|
93
|
+
_a.label = 3;
|
|
94
|
+
case 3: return [2 /*return*/];
|
|
87
95
|
}
|
|
88
|
-
else {
|
|
89
|
-
this.transformation.refresh();
|
|
90
|
-
}
|
|
91
|
-
return [2 /*return*/];
|
|
92
96
|
});
|
|
93
97
|
});
|
|
94
98
|
};
|
|
@@ -96,27 +100,22 @@ var TransformationsViz = /** @class */ (function () {
|
|
|
96
100
|
* init edge grouping style
|
|
97
101
|
*/
|
|
98
102
|
TransformationsViz.prototype.initEdgeGroupingStyle = function () {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return edge.getData(['properties', 'originalType']) + " - " + size;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
style: 'bold'
|
|
110
|
-
} }),
|
|
111
|
-
edgeSelector: function (edge) {
|
|
112
|
-
return edge.isVirtual() &&
|
|
113
|
-
edge.getSubEdges() &&
|
|
114
|
-
edge.getSubEdges().filter(function (e) { return !e.hasClass('filtered'); }).size > 0;
|
|
103
|
+
this.edgeGroupingStyleRule = this._ogma.styles.addRule({
|
|
104
|
+
edgeAttributes: __assign(__assign(__assign({}, DEFAULT_EDGE_GROUP_STYLE), this.edgeGroupStyle), { text: {
|
|
105
|
+
content: function (edge) {
|
|
106
|
+
if (edge !== undefined && edge.getSubEdges() !== null) {
|
|
107
|
+
var size = edge.getSubEdges().filter(function (e) { return !e.hasClass('filtered'); }).size;
|
|
108
|
+
return edge.getData(['properties', 'originalType']) + " - " + size;
|
|
109
|
+
}
|
|
115
110
|
},
|
|
116
|
-
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
style: 'bold'
|
|
112
|
+
} }),
|
|
113
|
+
edgeSelector: function (edge) {
|
|
114
|
+
return edge.isVirtual() &&
|
|
115
|
+
edge.getSubEdges() &&
|
|
116
|
+
edge.getSubEdges().filter(function (e) { return !e.hasClass('filtered'); }).size > 0;
|
|
117
|
+
},
|
|
118
|
+
edgeDependencies: { self: { data: true } }
|
|
120
119
|
});
|
|
121
120
|
};
|
|
122
121
|
TransformationsViz.prototype.refreshEdgeGroupingStyle = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformations.js","sourceRoot":"","sources":["../../../src/ogma/features/transformations.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeb,IAAM,wBAAwB,GAS1B;IACF,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,OAAO;KACd;IACD,KAAK,EAAE,GAAG;CACX,CAAC;AAEF;IAOE,4BAAY,IAAY;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACU,+CAAkB,GAA/B
|
|
1
|
+
{"version":3,"file":"transformations.js","sourceRoot":"","sources":["../../../src/ogma/features/transformations.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeb,IAAM,wBAAwB,GAS1B;IACF,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,OAAO;KACd;IACD,KAAK,EAAE,GAAG;CACX,CAAC;AAEF;IAOE,4BAAY,IAAY;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACU,+CAAkB,GAA/B;;;;;;6BACM,CAAA,IAAI,CAAC,cAAc,KAAK,SAAS,CAAA,EAAjC,wBAAiC;wBACnC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC;4BAC/D,wBAAwB,EAAE,IAAI;4BAC9B,QAAQ,EAAE,UAAC,IAAI;gCACb,OAAO,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;4BACjD,CAAC;4BACD,eAAe,EAAE,UAAC,IAAI,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G,CAAC;YAFnE,CAEmE;YACrE,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,EAAC;SACvC,CAAC,CAAC;IACL,CAAC;IAEM,qDAAwB,GAA/B;QACE,IAAI,IAAI,CAAC,qBAAqB,KAAK,SAAS,EAAE;YAC5C,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;SACtC;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,gDAAkB","sourcesContent":["'use strict';\n\nimport {GenericObject, IEdgeGroupStyle, LkEdgeData, LkNodeData} from '@linkurious/rest-client';\nimport {\n Edge,\n EdgeExtremity,\n EdgeStyle,\n EdgeType,\n PixelSize,\n StyleRule,\n Transformation\n} from '@linkurious/ogma';\n\nimport {LKOgma} from '../index';\n\nconst DEFAULT_EDGE_GROUP_STYLE: {\n color: string;\n shape: {\n body?: EdgeType;\n head?: EdgeExtremity;\n tail?: EdgeExtremity;\n style?: EdgeStyle;\n };\n width: PixelSize;\n} = {\n color: '#000000',\n shape: {\n style: 'dashed',\n head: 'arrow'\n },\n width: 1.5\n};\n\nexport class TransformationsViz {\n private _ogma: LKOgma;\n public groupedEdges: GenericObject<boolean>;\n public edgeGroupStyle!: IEdgeGroupStyle;\n public transformation!: Transformation<LkNodeData, LkEdgeData>;\n public edgeGroupingStyleRule!: StyleRule<LkNodeData, LkEdgeData>;\n\n constructor(ogma: LKOgma) {\n this._ogma = ogma;\n this.groupedEdges = {};\n }\n\n /**\n * create an edge grouping transformation by edge type\n */\n public async initTransformation(): Promise<void> {\n if (this.transformation === undefined) {\n this.transformation = this._ogma.transformations.addEdgeGrouping({\n separateEdgesByDirection: true,\n selector: (edge) => {\n return this.groupedEdges[edge.getData('type')];\n },\n groupIdFunction: (edge) => edge.getData('type'),\n generator: (edges) => {\n return {\n data: {\n properties: {\n originalType: edges.getData('type')[0]\n }\n }\n };\n }\n });\n } else {\n await this.transformation.refresh();\n }\n }\n\n /**\n * init edge grouping style\n */\n public initEdgeGroupingStyle(): void {\n this.edgeGroupingStyleRule = this._ogma.styles.addRule({\n edgeAttributes: {\n ...DEFAULT_EDGE_GROUP_STYLE,\n ...(this.edgeGroupStyle as any),\n text: {\n content: (edge: Edge<LkEdgeData> | undefined) => {\n if (edge !== undefined && edge.getSubEdges() !== null) {\n const size = edge.getSubEdges()!.filter((e) => !e.hasClass('filtered')).size;\n return `${edge.getData(['properties', 'originalType'])} - ${size}`;\n }\n },\n style: 'bold'\n }\n },\n edgeSelector: (edge) =>\n edge.isVirtual() &&\n edge.getSubEdges() &&\n edge.getSubEdges()!.filter((e) => !e.hasClass('filtered')).size > 0,\n edgeDependencies: {self: {data: true}}\n });\n }\n\n public refreshEdgeGroupingStyle(): void {\n if (this.edgeGroupingStyleRule !== undefined) {\n this.edgeGroupingStyleRule.refresh();\n }\n }\n}\n"]}
|
package/dist/ogma/index.js
CHANGED
|
@@ -268,23 +268,31 @@ var LKOgma = /** @class */ (function (_super) {
|
|
|
268
268
|
return __awaiter(this, void 0, void 0, function () {
|
|
269
269
|
var styles;
|
|
270
270
|
return __generator(this, function (_a) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
271
|
+
switch (_a.label) {
|
|
272
|
+
case 0: return [4 /*yield*/, this.init(visualization)];
|
|
273
|
+
case 1:
|
|
274
|
+
_a.sent();
|
|
275
|
+
styles = __1.StyleRules.sanitizeStylesIndex(visualization.design.styles);
|
|
276
|
+
this.LKStyles.initNodeColors(styles.node);
|
|
277
|
+
this.LKStyles.initNodesIcons(styles.node);
|
|
278
|
+
this.LKStyles.initNodesSizes(styles.node);
|
|
279
|
+
this.LKStyles.initNodesShapes(styles.node);
|
|
280
|
+
this.LKStyles.initEdgesWidth(styles.edge);
|
|
281
|
+
this.LKStyles.initEdgesShape(styles.edge);
|
|
282
|
+
this.LKStyles.initEdgesColor(styles.edge);
|
|
283
|
+
return [4 /*yield*/, this.LKCaptions.initVizCaptions({
|
|
284
|
+
node: visualization.nodeFields.captions || {},
|
|
285
|
+
edge: visualization.edgeFields.captions || {}
|
|
286
|
+
})];
|
|
287
|
+
case 2:
|
|
288
|
+
_a.sent();
|
|
289
|
+
this.LKTransformation.groupedEdges = visualization.edgeGrouping;
|
|
290
|
+
return [4 /*yield*/, this.LKTransformation.initTransformation()];
|
|
291
|
+
case 3:
|
|
292
|
+
_a.sent();
|
|
293
|
+
this.LKTransformation.initEdgeGroupingStyle();
|
|
294
|
+
return [2 /*return*/];
|
|
295
|
+
}
|
|
288
296
|
});
|
|
289
297
|
});
|
|
290
298
|
};
|
|
@@ -314,16 +322,11 @@ var LKOgma = /** @class */ (function (_super) {
|
|
|
314
322
|
* Adding edges to the graph after filtering disconnected ones
|
|
315
323
|
*/
|
|
316
324
|
LKOgma.prototype.addEdges = function (edges, options) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return __generator(this, function (_a) {
|
|
321
|
-
filteredEdges = edges.filter(function (edge) {
|
|
322
|
-
return _this.getNode(edge.source) !== undefined && _this.getNode(edge.target) !== undefined;
|
|
323
|
-
});
|
|
324
|
-
return [2 /*return*/, _super.prototype.addEdges.call(this, filteredEdges, options)];
|
|
325
|
-
});
|
|
325
|
+
var _this = this;
|
|
326
|
+
var filteredEdges = edges.filter(function (edge) {
|
|
327
|
+
return _this.getNode(edge.source) !== undefined && _this.getNode(edge.target) !== undefined;
|
|
326
328
|
});
|
|
329
|
+
return _super.prototype.addEdges.call(this, filteredEdges, options);
|
|
327
330
|
};
|
|
328
331
|
/**
|
|
329
332
|
* Return the list of non filtered nodes
|
package/dist/ogma/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js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outMode,\n HierarchicalLayoutMode,\n IOgmaConfig,\n LkEdgeData,\n LkNodeData,\n PopulatedVisualization,\n VizEdge,\n VizNode\n} from '@linkurious/rest-client';\nimport Ogma, {\n EdgeList,\n ForceLayoutOptions,\n HierarchicalLayoutOptions,\n NodeList,\n NonObjectPropertyWatcher,\n RadialLayoutOptions,\n RawEdge,\n RawGraph,\n RawNode\n} from '@linkurious/ogma';\n\nimport {StyleRules} from '..';\nimport {Tools} from '../tools/tools';\n\nimport {StylesViz} from './features/styles';\nimport {TransformationsViz} from './features/transformations';\nimport {CaptionsViz} from './features/captions';\nimport {RxViz} from './features/reactive';\nimport {OgmaStore} from './features/OgmaStore';\n\nexport {default as Ogma} from '@linkurious/ogma';\nexport const ANIMATION_DURATION = 750;\n\ninterface AddItemOptions {\n batchSize?: number;\n virtual?: boolean;\n}\n\nexport class LKOgma extends Ogma<LkNodeData, LkEdgeData> {\n public LKStyles!: StylesViz;\n public LKCaptions!: CaptionsViz;\n public LKTransformation!: TransformationsViz;\n // Trigger an event with node category changes\n public nodeCategoriesWatcher!: NonObjectPropertyWatcher<LkNodeData, LkEdgeData>;\n // Trigger an event with edge type changes\n public edgeTypeWatcher!: NonObjectPropertyWatcher<LkNodeData, LkEdgeData>;\n public store!: OgmaStore;\n private _reactive!: RxViz;\n\n constructor(private _configuration: IOgmaConfig) {\n // set Ogma global configuration\n super(_configuration);\n Object.setPrototypeOf(this, new.target.prototype);\n this.initOgmaLinkuriousParser(true);\n }\n\n private initOgmaLinkuriousParser(init?: boolean): void {\n this.nodeCategoriesWatcher = this.schema.watchNodeNonObjectProperty({\n path: 'categories',\n unwindArrays: true,\n filter: 'all'\n });\n this.edgeTypeWatcher = this.schema.watchEdgeNonObjectProperty({\n path: 'type',\n filter: 'all'\n });\n // set ogma max zoom value and selection with mouse option (false?)\n this.setOptions({\n interactions: {\n zoom: {\n maxValue: (params: any) => {\n return 128 / params.smallestNodeSize;\n }\n },\n selection: {\n enabled: false\n }\n }\n });\n\n // only instantiate the store once when app is starting\n if (this._reactive === undefined) {\n this._reactive = new RxViz(this);\n this.store = this._reactive.store;\n } else {\n // if store already exist, but ogma was reset, create new ogma event listener\n this._reactive.listenToSelectionEvents();\n }\n this.initSelection();\n this.setConfigOgma(this._configuration, init);\n this.LKTransformation = new TransformationsViz(this);\n\n this.LKStyles.setNodesDefaultHalo();\n this.LKStyles.setEdgesDefaultHalo();\n this.LKStyles.setBadgeRule();\n this.LKStyles.setFilterClass();\n }\n\n /**\n * Initialize selection behavior\n */\n public initSelection(): void {\n this.events.onClick((e) => {\n if (e !== undefined && e.button === 'left') {\n if (e.target !== null) {\n const multiSelectionKey = navigator.platform === 'MacIntel' ? 'cmd' : 'ctrl';\n if (this.keyboard.isKeyPressed(multiSelectionKey)) {\n if (e.target.isNode && this.getSelectedEdges().size > 0) {\n this.getSelectedEdges().setSelected(false);\n }\n if (!e.target.isNode && this.getSelectedNodes().size > 0) {\n this.getSelectedNodes().setSelected(false);\n }\n if (e.target.isSelected()) {\n e.target.setSelected(false);\n } else {\n e.target.setSelected(true);\n }\n } else {\n this.getSelectedNodes().setSelected(false);\n this.getSelectedEdges().setSelected(false);\n e.target.setSelected(true);\n }\n } else {\n this.getSelectedNodes().setSelected(false);\n this.getSelectedEdges().setSelected(false);\n }\n }\n });\n }\n\n private setStyles(configuration: IOgmaConfig): void {\n this.LKStyles = new StylesViz(this, {\n node: configuration?.options?.styles?.node || {},\n edge: configuration?.options?.styles?.edge || {}\n });\n this.LKStyles.setNodesDefaultStyles();\n this.LKStyles.setEdgesDefaultStyles();\n }\n\n private setCaptions(configuration: IOgmaConfig): void {\n const nodeMaxTextLength = configuration?.options?.styles?.node?.text?.maxTextLength;\n const edgeMaxTextLength = configuration?.options?.styles?.edge?.text?.maxTextLength;\n this.LKCaptions = new CaptionsViz(this, nodeMaxTextLength, edgeMaxTextLength);\n }\n\n /**\n * Returns Ogma Layout parameters according to visualization layout settings\n * */\n public getForceLayoutParams(mode: ForceLayoutMode, duration = 0): ForceLayoutOptions {\n let dynamicSteps = 300 - ((300 - 40) / 5000) * this.getNodes().size;\n if (dynamicSteps < 40) {\n dynamicSteps = 40;\n }\n return {\n steps: mode === ForceLayoutMode.FAST ? dynamicSteps : 300,\n alignSiblings: this.getNodes().size > 3,\n duration: duration,\n charge: 20,\n gravity: 0.08,\n theta: this.getNodes().size > 100 ? 0.8 : 0.34\n };\n }\n\n public getRadialLayoutParams(\n rootNode: string,\n duration = 0\n ): RadialLayoutOptions<unknown, unknown> {\n return {\n centralNode: rootNode,\n radiusDelta: 1,\n nodeGap: 10,\n repulsion: this.getNodes().size > 80 ? 1 : 6,\n duration: duration\n };\n }\n\n public getHierarchicalLayoutParams(\n mode: HierarchicalLayoutMode,\n rootNode: string,\n duration = 0\n ): HierarchicalLayoutOptions {\n return {\n direction: mode,\n roots: [rootNode],\n duration: duration\n };\n }\n\n /**\n * Initialize graph.\n * add nodes and edges to the viz and init the selection.\n */\n public async init(visualization: {nodes: Array<VizNode>; edges: Array<VizEdge>}): Promise<void> {\n this.clearGraph();\n let selectedEntityType: EntityType | undefined = undefined;\n let selectedElements: Array<string> = [];\n // need to remove selected in every items before adding them to Ogma\n const fixedNodes = visualization.nodes.map((node) => {\n if (node.attributes.selected) {\n selectedEntityType = EntityType.NODE;\n selectedElements.push(node.id);\n }\n delete node.attributes.selected;\n return node;\n });\n const fixedEdges = visualization.edges.map((edge) => {\n if (edge.attributes !== undefined) {\n if (edge.attributes.selected) {\n if (selectedEntityType === undefined || selectedEntityType === EntityType.NODE) {\n selectedEntityType = EntityType.EDGE;\n selectedElements = [];\n }\n selectedElements.push(edge.id);\n }\n delete edge.attributes.selected;\n }\n return edge;\n });\n await this.addGraphAfterValidation({\n nodes: fixedNodes as Array<RawNode<LkNodeData>>,\n edges: fixedEdges as Array<RawEdge<LkEdgeData>>\n });\n if (selectedEntityType === EntityType.NODE) {\n this.getNodes(selectedElements).setSelected(true);\n } else if (selectedEntityType === EntityType.EDGE) {\n this.getEdges(selectedElements).setSelected(true);\n }\n }\n\n public async initVisualization(visualization: PopulatedVisualization) {\n this.init(visualization);\n const styles = StyleRules.sanitizeStylesIndex(visualization.design.styles);\n this.LKStyles.initNodeColors(styles.node);\n this.LKStyles.initNodesIcons(styles.node);\n this.LKStyles.initNodesSizes(styles.node);\n this.LKStyles.initNodesShapes(styles.node);\n this.LKStyles.initEdgesWidth(styles.edge);\n this.LKStyles.initEdgesShape(styles.edge);\n this.LKStyles.initEdgesColor(styles.edge);\n this.LKCaptions.initVizCaptions({\n node: visualization.nodeFields.captions || {},\n edge: visualization.edgeFields.captions || {}\n });\n this.LKTransformation.groupedEdges = visualization.edgeGrouping;\n this.LKTransformation.initTransformation();\n this.LKTransformation.initEdgeGroupingStyle();\n }\n\n /**\n * Adding nodes then adding edges to the graph\n */\n public async addGraphAfterValidation(\n graph: RawGraph<LkNodeData, LkEdgeData>\n ): Promise<{\n nodes: NodeList<LkNodeData>;\n edges: EdgeList<LkEdgeData>;\n }> {\n const addedNodes = await this.addNodes(graph.nodes);\n const addedEdges = await this.addEdges(graph.edges);\n return {\n nodes: addedNodes,\n edges: addedEdges\n };\n }\n\n /**\n * Adding edges to the graph after filtering disconnected ones\n */\n public async addEdges(\n edges: Array<RawEdge<LkEdgeData>>,\n options?: AddItemOptions\n ): Promise<EdgeList> {\n const filteredEdges = edges.filter((edge) => {\n return this.getNode(edge.source) !== undefined && this.getNode(edge.target) !== undefined;\n });\n return super.addEdges(filteredEdges, options);\n }\n\n /**\n * Return the list of non filtered nodes\n */\n public getNonFilteredNodes(items?: Array<any>): NodeList<LkNodeData, LkEdgeData> {\n return Tools.isDefined(items)\n ? this.getNodes(items).filter((i) => !i.hasClass('filtered'))\n : this.getNodes().filter((i) => !i.hasClass('filtered'));\n }\n\n /**\n * Return the list of filtered nodes\n */\n public getFilteredNodes(items?: Array<any>): NodeList<LkNodeData, LkEdgeData> {\n return Tools.isDefined(items)\n ? this.getNodes(items).filter((i) => i.hasClass('filtered'))\n : this.getNodes().filter((i) => i.hasClass('filtered'));\n }\n\n /**\n * Return the list of non filtered edges\n */\n public getNonFilteredEdges(items?: Array<any>): EdgeList<LkEdgeData, LkNodeData> {\n return Tools.isDefined(items)\n ? this.getEdges(items).filter((i) => !i.hasClass('filtered'))\n : this.getEdges('raw').filter((i) => !i.hasClass('filtered'));\n }\n\n /**\n * Return the list of filtered edges\n */\n public getFilteredEdges(\n items?: Array<any>,\n filter: 'visible' | 'raw' | 'all' = 'raw'\n ): EdgeList<LkEdgeData, LkNodeData> {\n return Tools.isDefined(items)\n ? this.getEdges(items).filter((i) => i.hasClass('filtered'))\n : this.getEdges(filter).filter((i) => i.hasClass('filtered'));\n }\n\n /**\n * Do a full reset on ogma and streams of ogma\n */\n public shutDown(): void {\n this.destroy();\n if (this.store) {\n this.store.clear();\n }\n }\n\n /**\n * Reset the Ogma instance so that it can be used fresh in the next visulization\n */\n public clearOgmaState(): void {\n this.reset();\n if (this.store) {\n this.store.clear();\n }\n this.initOgmaLinkuriousParser();\n }\n\n /**\n * Updates the Ogma config when config changes in LKE. If init, options were already set by the Ogma.reset()\n */\n public setConfigOgma(configuration?: IOgmaConfig, init?: boolean): void {\n if (configuration) {\n // here we make sure that the internal config object is updated and we have the correct one when resetting\n this._configuration = configuration;\n }\n if (!init) {\n this.setOptions({\n ...this._configuration.options,\n renderer: this._configuration.renderer\n });\n }\n this.setStyles(this._configuration);\n this.setCaptions(this._configuration);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ogma/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAUiC;AACjC,0DAU0B;AAE1B,wBAA8B;AAC9B,wCAAqC;AAErC,4CAA4C;AAC5C,8DAA8D;AAC9D,gDAAgD;AAChD,gDAA0C;AAG1C,yCAAiD;AAAzC,sBAAA,OAAO,CAAQ;AACV,QAAA,kBAA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AAC,MAAM,CAAC,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAtB,CAAsB,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,yBAAQ,GAAf;QACE,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SACpB;IACH,CAAC;IAED;;OAEG;IACI,+BAAc,GAArB;QACE,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SACpB;QACD,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,8BAAa,GAApB,UAAqB,aAA2B,EAAE,IAAc;QAC9D,IAAI,aAAa,EAAE;YACjB,0GAA0G;YAC1G,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;SACrC;QACD,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,CAAC,UAAU,uBACV,IAAI,CAAC,cAAc,CAAC,OAAO,KAC9B,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,IACtC,CAAC;SACJ;QACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;IACH,aAAC;AAAD,CAAC,AA3TD,CAA4B,cAAI,GA2T/B;AA3TY,wBAAM","sourcesContent":["import {\n EntityType,\n ForceLayoutMode,\n HierarchicalLayoutMode,\n IOgmaConfig,\n LkEdgeData,\n LkNodeData,\n PopulatedVisualization,\n VizEdge,\n VizNode\n} from '@linkurious/rest-client';\nimport Ogma, {\n EdgeList,\n ForceLayoutOptions,\n HierarchicalLayoutOptions,\n NodeList,\n NonObjectPropertyWatcher,\n RadialLayoutOptions,\n RawEdge,\n RawGraph,\n RawNode\n} from '@linkurious/ogma';\n\nimport {StyleRules} from '..';\nimport {Tools} from '../tools/tools';\n\nimport {StylesViz} from './features/styles';\nimport {TransformationsViz} from './features/transformations';\nimport {CaptionsViz} from './features/captions';\nimport {RxViz} from './features/reactive';\nimport {OgmaStore} from './features/OgmaStore';\n\nexport {default as Ogma} from '@linkurious/ogma';\nexport const ANIMATION_DURATION = 750;\n\ninterface AddItemOptions {\n batchSize?: number;\n virtual?: boolean;\n}\n\nexport class LKOgma extends Ogma<LkNodeData, LkEdgeData> {\n public LKStyles!: StylesViz;\n public LKCaptions!: CaptionsViz;\n public LKTransformation!: TransformationsViz;\n // Trigger an event with node category changes\n public nodeCategoriesWatcher!: NonObjectPropertyWatcher<LkNodeData, LkEdgeData>;\n // Trigger an event with edge type changes\n public edgeTypeWatcher!: NonObjectPropertyWatcher<LkNodeData, LkEdgeData>;\n public store!: OgmaStore;\n private _reactive!: RxViz;\n\n constructor(private _configuration: IOgmaConfig) {\n // set Ogma global configuration\n super(_configuration);\n Object.setPrototypeOf(this, new.target.prototype);\n this.initOgmaLinkuriousParser(true);\n }\n\n private initOgmaLinkuriousParser(init?: boolean): void {\n this.nodeCategoriesWatcher = this.schema.watchNodeNonObjectProperty({\n path: 'categories',\n unwindArrays: true,\n filter: 'all'\n });\n this.edgeTypeWatcher = this.schema.watchEdgeNonObjectProperty({\n path: 'type',\n filter: 'all'\n });\n // set ogma max zoom value and selection with mouse option (false?)\n this.setOptions({\n interactions: {\n zoom: {\n maxValue: (params: any) => {\n return 128 / params.smallestNodeSize;\n }\n },\n selection: {\n enabled: false\n }\n }\n });\n\n // only instantiate the store once when app is starting\n if (this._reactive === undefined) {\n this._reactive = new RxViz(this);\n this.store = this._reactive.store;\n } else {\n // if store already exist, but ogma was reset, create new ogma event listener\n this._reactive.listenToSelectionEvents();\n }\n this.initSelection();\n this.setConfigOgma(this._configuration, init);\n this.LKTransformation = new TransformationsViz(this);\n\n this.LKStyles.setNodesDefaultHalo();\n this.LKStyles.setEdgesDefaultHalo();\n this.LKStyles.setBadgeRule();\n this.LKStyles.setFilterClass();\n }\n\n /**\n * Initialize selection behavior\n */\n public initSelection(): void {\n this.events.onClick((e) => {\n if (e !== undefined && e.button === 'left') {\n if (e.target !== null) {\n const multiSelectionKey = navigator.platform === 'MacIntel' ? 'cmd' : 'ctrl';\n if (this.keyboard.isKeyPressed(multiSelectionKey)) {\n if (e.target.isNode && this.getSelectedEdges().size > 0) {\n this.getSelectedEdges().setSelected(false);\n }\n if (!e.target.isNode && this.getSelectedNodes().size > 0) {\n this.getSelectedNodes().setSelected(false);\n }\n if (e.target.isSelected()) {\n e.target.setSelected(false);\n } else {\n e.target.setSelected(true);\n }\n } else {\n this.getSelectedNodes().setSelected(false);\n this.getSelectedEdges().setSelected(false);\n e.target.setSelected(true);\n }\n } else {\n this.getSelectedNodes().setSelected(false);\n this.getSelectedEdges().setSelected(false);\n }\n }\n });\n }\n\n private setStyles(configuration: IOgmaConfig): void {\n this.LKStyles = new StylesViz(this, {\n node: configuration?.options?.styles?.node || {},\n edge: configuration?.options?.styles?.edge || {}\n });\n this.LKStyles.setNodesDefaultStyles();\n this.LKStyles.setEdgesDefaultStyles();\n }\n\n private setCaptions(configuration: IOgmaConfig): void {\n const nodeMaxTextLength = configuration?.options?.styles?.node?.text?.maxTextLength;\n const edgeMaxTextLength = configuration?.options?.styles?.edge?.text?.maxTextLength;\n this.LKCaptions = new CaptionsViz(this, nodeMaxTextLength, edgeMaxTextLength);\n }\n\n /**\n * Returns Ogma Layout parameters according to visualization layout settings\n * */\n public getForceLayoutParams(mode: ForceLayoutMode, duration = 0): ForceLayoutOptions {\n let dynamicSteps = 300 - ((300 - 40) / 5000) * this.getNodes().size;\n if (dynamicSteps < 40) {\n dynamicSteps = 40;\n }\n return {\n steps: mode === ForceLayoutMode.FAST ? dynamicSteps : 300,\n alignSiblings: this.getNodes().size > 3,\n duration: duration,\n charge: 20,\n gravity: 0.08,\n theta: this.getNodes().size > 100 ? 0.8 : 0.34\n };\n }\n\n public getRadialLayoutParams(\n rootNode: string,\n duration = 0\n ): RadialLayoutOptions<unknown, unknown> {\n return {\n centralNode: rootNode,\n radiusDelta: 1,\n nodeGap: 10,\n repulsion: this.getNodes().size > 80 ? 1 : 6,\n duration: duration\n };\n }\n\n public getHierarchicalLayoutParams(\n mode: HierarchicalLayoutMode,\n rootNode: string,\n duration = 0\n ): HierarchicalLayoutOptions {\n return {\n direction: mode,\n roots: [rootNode],\n duration: duration\n };\n }\n\n /**\n * Initialize graph.\n * add nodes and edges to the viz and init the selection.\n */\n public async init(visualization: {nodes: Array<VizNode>; edges: Array<VizEdge>}): Promise<void> {\n this.clearGraph();\n let selectedEntityType: EntityType | undefined = undefined;\n let selectedElements: Array<string> = [];\n // need to remove selected in every items before adding them to Ogma\n const fixedNodes = visualization.nodes.map((node) => {\n if (node.attributes.selected) {\n selectedEntityType = EntityType.NODE;\n selectedElements.push(node.id);\n }\n delete node.attributes.selected;\n return node;\n });\n const fixedEdges = visualization.edges.map((edge) => {\n if (edge.attributes !== undefined) {\n if (edge.attributes.selected) {\n if (selectedEntityType === undefined || selectedEntityType === EntityType.NODE) {\n selectedEntityType = EntityType.EDGE;\n selectedElements = [];\n }\n selectedElements.push(edge.id);\n }\n delete edge.attributes.selected;\n }\n return edge;\n });\n await this.addGraphAfterValidation({\n nodes: fixedNodes as Array<RawNode<LkNodeData>>,\n edges: fixedEdges as Array<RawEdge<LkEdgeData>>\n });\n if (selectedEntityType === EntityType.NODE) {\n this.getNodes(selectedElements).setSelected(true);\n } else if (selectedEntityType === EntityType.EDGE) {\n this.getEdges(selectedElements).setSelected(true);\n }\n }\n\n public async initVisualization(visualization: PopulatedVisualization): Promise<void> {\n await this.init(visualization);\n const styles = StyleRules.sanitizeStylesIndex(visualization.design.styles);\n this.LKStyles.initNodeColors(styles.node);\n this.LKStyles.initNodesIcons(styles.node);\n this.LKStyles.initNodesSizes(styles.node);\n this.LKStyles.initNodesShapes(styles.node);\n this.LKStyles.initEdgesWidth(styles.edge);\n this.LKStyles.initEdgesShape(styles.edge);\n this.LKStyles.initEdgesColor(styles.edge);\n await this.LKCaptions.initVizCaptions({\n node: visualization.nodeFields.captions || {},\n edge: visualization.edgeFields.captions || {}\n });\n this.LKTransformation.groupedEdges = visualization.edgeGrouping;\n await this.LKTransformation.initTransformation();\n this.LKTransformation.initEdgeGroupingStyle();\n }\n\n /**\n * Adding nodes then adding edges to the graph\n */\n public async addGraphAfterValidation(\n graph: RawGraph<LkNodeData, LkEdgeData>\n ): Promise<{\n nodes: NodeList<LkNodeData>;\n edges: EdgeList<LkEdgeData>;\n }> {\n const addedNodes = await this.addNodes(graph.nodes);\n const addedEdges = await this.addEdges(graph.edges);\n return {\n nodes: addedNodes,\n edges: addedEdges\n };\n }\n\n /**\n * Adding edges to the graph after filtering disconnected ones\n */\n public addEdges(edges: Array<RawEdge<LkEdgeData>>, options?: AddItemOptions): Promise<EdgeList> {\n const filteredEdges = edges.filter((edge) => {\n return this.getNode(edge.source) !== undefined && this.getNode(edge.target) !== undefined;\n });\n return super.addEdges(filteredEdges, options);\n }\n\n /**\n * Return the list of non filtered nodes\n */\n public getNonFilteredNodes(items?: Array<any>): NodeList<LkNodeData, LkEdgeData> {\n return Tools.isDefined(items)\n ? this.getNodes(items).filter((i) => !i.hasClass('filtered'))\n : this.getNodes().filter((i) => !i.hasClass('filtered'));\n }\n\n /**\n * Return the list of filtered nodes\n */\n public getFilteredNodes(items?: Array<any>): NodeList<LkNodeData, LkEdgeData> {\n return Tools.isDefined(items)\n ? this.getNodes(items).filter((i) => i.hasClass('filtered'))\n : this.getNodes().filter((i) => i.hasClass('filtered'));\n }\n\n /**\n * Return the list of non filtered edges\n */\n public getNonFilteredEdges(items?: Array<any>): EdgeList<LkEdgeData, LkNodeData> {\n return Tools.isDefined(items)\n ? this.getEdges(items).filter((i) => !i.hasClass('filtered'))\n : this.getEdges('raw').filter((i) => !i.hasClass('filtered'));\n }\n\n /**\n * Return the list of filtered edges\n */\n public getFilteredEdges(\n items?: Array<any>,\n filter: 'visible' | 'raw' | 'all' = 'raw'\n ): EdgeList<LkEdgeData, LkNodeData> {\n return Tools.isDefined(items)\n ? this.getEdges(items).filter((i) => i.hasClass('filtered'))\n : this.getEdges(filter).filter((i) => i.hasClass('filtered'));\n }\n\n /**\n * Do a full reset on ogma and streams of ogma\n */\n public shutDown(): void {\n this.destroy();\n if (this.store) {\n this.store.clear();\n }\n }\n\n /**\n * Reset the Ogma instance so that it can be used fresh in the next visulization\n */\n public clearOgmaState(): void {\n this.reset();\n if (this.store) {\n this.store.clear();\n }\n this.initOgmaLinkuriousParser();\n }\n\n /**\n * Updates the Ogma config when config changes in LKE. If init, options were already set by the Ogma.reset()\n */\n public setConfigOgma(configuration?: IOgmaConfig, init?: boolean): void {\n if (configuration) {\n // here we make sure that the internal config object is updated and we have the correct one when resetting\n this._configuration = configuration;\n }\n if (!init) {\n this.setOptions({\n ...this._configuration.options,\n renderer: this._configuration.renderer\n });\n }\n this.setStyles(this._configuration);\n this.setCaptions(this._configuration);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkurious/ogma-linkurious-parser",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.13",
|
|
4
4
|
"author": "Linkurious SAS",
|
|
5
5
|
"description": "Parse and load a Linkurious visualization in Ogma with one line of code ",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"main": "./dist/index.js",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": "16.
|
|
16
|
+
"node": "16.19.0"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"prepare": "tsc -b",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"sha1": "1.1.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@linkurious/ogma": "4.1.
|
|
52
|
+
"@linkurious/ogma": "4.1.6"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@linkurious/ogma": "4.1.
|
|
56
|
-
"@linkurious/rest-client": "3.1.
|
|
55
|
+
"@linkurious/ogma": "4.1.6",
|
|
56
|
+
"@linkurious/rest-client": "3.1.13",
|
|
57
57
|
"@rollup/plugin-buble": "0.21.3",
|
|
58
58
|
"@rollup/plugin-commonjs": "17.0.0",
|
|
59
59
|
"@rollup/plugin-json": "4.1.0",
|