@linkurious/ogma-linkurious-parser 3.0.2 → 3.0.6
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/ogma/index.js +2 -2
- package/dist/ogma/index.js.map +1 -1
- package/package.json +8 -6
package/dist/ogma/index.js
CHANGED
|
@@ -326,7 +326,7 @@ var LKOgma = /** @class */ (function (_super) {
|
|
|
326
326
|
LKOgma.prototype.getNonFilteredEdges = function (items) {
|
|
327
327
|
return tools_1.Tools.isDefined(items)
|
|
328
328
|
? this.getEdges(items).filter(function (i) { return !i.hasClass('filtered'); })
|
|
329
|
-
: this.getEdges().filter(function (i) { return !i.hasClass('filtered'); });
|
|
329
|
+
: this.getEdges('raw').filter(function (i) { return !i.hasClass('filtered'); });
|
|
330
330
|
};
|
|
331
331
|
/**
|
|
332
332
|
* Return the list of filtered edges
|
|
@@ -334,7 +334,7 @@ var LKOgma = /** @class */ (function (_super) {
|
|
|
334
334
|
LKOgma.prototype.getFilteredEdges = function (items) {
|
|
335
335
|
return tools_1.Tools.isDefined(items)
|
|
336
336
|
? this.getEdges(items).filter(function (i) { return i.hasClass('filtered'); })
|
|
337
|
-
: this.getEdges().filter(function (i) { return i.hasClass('filtered'); });
|
|
337
|
+
: this.getEdges('raw').filter(function (i) { return i.hasClass('filtered'); });
|
|
338
338
|
};
|
|
339
339
|
/**
|
|
340
340
|
* Do a full reset on ogma and streams of ogma
|
package/dist/ogma/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ogma/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAUiC;AACjC,8CAUc;AAEd,wBAA8B;AAC9B,wCAAqC;AAErC,4CAA4C;AAC5C,8DAA8D;AAC9D,gDAAgD;AAChD,gDAA0C;AAG1C,6BAAqC;AAA7B,sBAAA,OAA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ceLayoutMode,\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 '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 '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 private _reactive: RxViz;\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\n constructor(configuration: IOgmaConfig) {\n // set Ogma global configuration\n super(configuration);\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 Object.setPrototypeOf(this, new.target.prototype);\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 this._reactive = new RxViz(this);\n this.store = this._reactive.store;\n this.initSelection();\n this.initStyles(configuration);\n this.initCaptions(configuration);\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 initStyles(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 initCaptions(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 public getRadialLayoutParams(rootNode: string, duration = 0): RadialLayoutOptions {\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().filter((i) => !i.hasClass('filtered'));\n }\n\n /**\n * Return the list of filtered edges\n */\n public getFilteredEdges(items?: Array<any>): EdgeList<LkEdgeData, LkNodeData> {\n return Tools.isDefined(items)\n ? this.getEdges(items).filter((i) => i.hasClass('filtered'))\n : this.getEdges().filter((i) => i.hasClass('filtered'));\n }\n\n /**\n * Do a full reset on ogma and streams of ogma\n */\n public shutDown() {\n this.destroy();\n if (this.store) {\n this.store.clear();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ogma/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAUiC;AACjC,8CAUc;AAEd,wBAA8B;AAC9B,wCAAqC;AAErC,4CAA4C;AAC5C,8DAA8D;AAC9D,gDAAgD;AAChD,gDAA0C;AAG1C,6BAAqC;AAA7B,sBAAA,OAAO,CAAQ;AACV,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAOtC;IAA4B,0BAA4B;IAWtD,gBAAY,aAA0B;;QAAtC;QACE,gCAAgC;QAChC,kBAAM,aAAa,CAAC,SAoCrB;QAnCC,KAAI,CAAC,qBAAqB,GAAG,KAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC;YAClE,IAAI,EAAE,YAAY;YAClB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,KAAI,CAAC,eAAe,GAAG,KAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC;YAC5D,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,WAAW,SAAS,CAAC,CAAC;QAClD,oEAAoE;QACpE,KAAI,CAAC,UAAU,CAAC;YACd,YAAY,EAAE;gBACZ,IAAI,EAAE;oBACJ,QAAQ,EAAE,UAAC,MAAW;wBACpB,OAAO,GAAG,GAAG,MAAM,CAAC,gBAAgB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C;YAC3B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAtB,CAAsB,CAAC;YAC5D,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAtB,CAAsB,CAAC,CAAC;IACjE,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;IACH,aAAC;AAAD,CAAC,AAjRD,CAA4B,cAAI,GAiR/B;AAjRY,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 '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 '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 private _reactive: RxViz;\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\n constructor(configuration: IOgmaConfig) {\n // set Ogma global configuration\n super(configuration);\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 Object.setPrototypeOf(this, new.target.prototype);\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 this._reactive = new RxViz(this);\n this.store = this._reactive.store;\n this.initSelection();\n this.initStyles(configuration);\n this.initCaptions(configuration);\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 initStyles(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 initCaptions(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 public getRadialLayoutParams(rootNode: string, duration = 0): RadialLayoutOptions {\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(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 * Do a full reset on ogma and streams of ogma\n */\n public shutDown() {\n this.destroy();\n if (this.store) {\n this.store.clear();\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkurious/ogma-linkurious-parser",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
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,8 +13,8 @@
|
|
|
13
13
|
"main": "./dist/index.js",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": "14.
|
|
17
|
-
"npm": "6.14.
|
|
16
|
+
"node": "14.18.1",
|
|
17
|
+
"npm": "6.14.15"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"prepare": "tsc -b",
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
"clean": "rm -rf node_modules; rm -rf package-lock.json; rm -rf dist",
|
|
28
28
|
"lint": "eslint --fix --ext .ts .",
|
|
29
29
|
"lint:ci": "eslint -f checkstyle -o reports/checkstyle.xml --ext .ts .",
|
|
30
|
+
"latest:develop-maintenance": "npm install --save-exact @linkurious/rest-client@lk-develop-maintenance",
|
|
30
31
|
"latest:develop-stable": "npm install --save-exact @linkurious/rest-client@lk-develop-stable",
|
|
31
32
|
"latest:develop": "npm install --save-exact @linkurious/rest-client@lk-develop",
|
|
32
33
|
"latest:develop-next": "npm install --save-exact @linkurious/rest-client@lk-develop-next",
|
|
34
|
+
"latest:master-maintenance": "npm install --save-exact @linkurious/rest-client@lk-master-maintenance",
|
|
33
35
|
"latest:master-stable": "npm install --save-exact @linkurious/rest-client@lk-master-stable",
|
|
34
36
|
"latest:master": "npm install --save-exact @linkurious/rest-client@lk-master",
|
|
35
37
|
"bump:patch": "bump2version patch && npm version --no-git-tag-version patch",
|
|
@@ -44,14 +46,14 @@
|
|
|
44
46
|
"homepage": "",
|
|
45
47
|
"dependencies": {
|
|
46
48
|
"lodash": "4.17.21",
|
|
47
|
-
"rxjs": "6.
|
|
49
|
+
"rxjs": "6.6.7",
|
|
48
50
|
"sha1": "1.1.1"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
|
-
"ogma": "3.
|
|
53
|
+
"ogma": "3.4.7"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@linkurious/rest-client": "3.0.
|
|
56
|
+
"@linkurious/rest-client": "3.0.6",
|
|
55
57
|
"@rollup/plugin-buble": "0.21.3",
|
|
56
58
|
"@rollup/plugin-commonjs": "17.0.0",
|
|
57
59
|
"@rollup/plugin-json": "4.1.0",
|