@linkurious/ogma-linkurious-parser 4.1.14 → 4.2.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.
@@ -1,8 +1,7 @@
1
- import { Transformation, NodeList, StyleRule, PixelSize, Point } from '@linkurious/ogma';
1
+ import type { NodeList, PixelSize, Point, Transformation } from '@linkurious/ogma';
2
2
  import { IVizNodeGroupInfo, LkEdgeData, LkNodeData, NodeGroupingRule } from '@linkurious/rest-client';
3
3
  import { LKOgma } from '../index';
4
4
  export declare const LKE_NODE_GROUPING_EDGE = "LKE_NODE_GROUPING_EDGE";
5
- export declare const LKE_NODE_GROUPING_NODE = "LKE_NODE_GROUPING_NODE";
6
5
  interface CircularLayoutOptions {
7
6
  radii: PixelSize[] | number[];
8
7
  cx?: number;
@@ -15,14 +14,17 @@ interface CircularLayoutOptions {
15
14
  export declare class NodeGroupingTransformation {
16
15
  transformation?: Transformation<LkNodeData, LkEdgeData>;
17
16
  groupRule?: NodeGroupingRule;
18
- nodeGroupingStyleRule?: StyleRule<LkNodeData, LkEdgeData>;
17
+ private _nodeGroupingStyleRule?;
19
18
  private _ogma;
19
+ private _nodeGroupingCollapsedStyleRule?;
20
+ private _collapsedDefaultValue;
21
+ private _nodeGroupingAttributes;
20
22
  constructor(ogma: LKOgma);
21
23
  /**
22
24
  * Set the grouping rule
23
25
  * @param rule of grouping
24
26
  */
25
- setGroupingRule(rule: NodeGroupingRule | undefined): void;
27
+ setGroupingRule(rule?: NodeGroupingRule): void;
26
28
  /**
27
29
  * create a node grouping transformation
28
30
  * It uses groupRule to define the rule
@@ -39,38 +41,46 @@ export declare class NodeGroupingTransformation {
39
41
  */
40
42
  initNodeGroupingStyle(): void;
41
43
  refreshNodeGroupingStyle(): Promise<void>;
42
- /**
43
- * run layout on all subnodes of virtual nodes
44
- */
45
- runLayoutOnAllSubNodes(): Promise<void>;
46
44
  /**
47
45
  * Run the layout on the subnodes of the virtual node
48
46
  * @param subNodes nodes part of a virtual node
49
47
  */
50
- runSubNodesLayout(subNodes: NodeList<LkNodeData, LkEdgeData>): Promise<void>;
48
+ runSubNodesLayout(subNodes: NodeList<LkNodeData, LkEdgeData>): Promise<Point[] | undefined | void>;
51
49
  /**
52
50
  * Get the virtual nodes of the transformation
53
51
  * @private
54
52
  */
55
53
  getVirtualNodesOfTransformation(): NodeList<LkNodeData, LkEdgeData>;
56
54
  /**
57
- * Set the node group pin
55
+ * Set node initial attributes
58
56
  * @param nodeGroups object containing the node group id and the layoutable attribute
59
57
  */
60
- setNodeGroupPin(nodeGroups: IVizNodeGroupInfo[]): Promise<void>;
58
+ setNodeGroupingAttributes(nodeGroups: IVizNodeGroupInfo[]): void;
59
+ /**
60
+ * set collapse default value, this will be the state of newly created groups
61
+ */
62
+ setCollapseDefaultValue(value: boolean): void;
61
63
  /**
62
64
  * Return the caption of a virtual node
63
65
  * @param node reference to the virtual node
64
66
  */
65
67
  private _getNodeGroupingCaption;
68
+ private _getAdjacentEdgeNodeGroupingCaption;
69
+ private _getPropertyValueNodeGroupingCaption;
66
70
  /**
67
71
  * Run the circle pack layout on the subnodes
68
72
  * @param subNodes
69
73
  */
70
74
  private _runCirclePack;
75
+ /**
76
+ * return a grid layout when nodes are represented by multiple chains (a)-(b)-(c)-(d)
77
+ */
71
78
  private _runChainLayout;
72
79
  private _runForceLayout;
73
80
  private _isRuleNotApplicableToNode;
81
+ private _isRelationshipRuleNotApplicableToNode;
82
+ private hasEdgeOfType;
83
+ private _isPropertyRuleNotApplicableToNode;
74
84
  /**
75
85
  * Unpin list of nodes
76
86
  * @param nodes
@@ -87,8 +97,23 @@ export declare class NodeGroupingTransformation {
87
97
  * Return a hashed string that represents the group id
88
98
  */
89
99
  private _findNodeGroupId;
100
+ /**
101
+ * For a relation type grouping rule, return the central node from one of the nodes in the group
102
+ */
103
+ private static _getGroupCentralNode;
90
104
  _runCircularLayout({ radii, clockwise, cx, cy, startAngle, getRadius, distanceRatio }: CircularLayoutOptions): Point[];
91
105
  private _runTwoNodesLayout;
92
- private isStar;
106
+ private _getPropertyValueGroupId;
107
+ private _getAdjacentEdgeGroupId;
108
+ /**
109
+ * Initialize the style for the intermediate group state, when transitioning from expanded to collapsed
110
+ */
111
+ private _initIntermediateGroupStyle;
112
+ private _getDefaultCollapsedState;
113
+ private _getDefaultLayoutableValue;
114
+ /**
115
+ * Set styles for the class "filtered"
116
+ */
117
+ private _setSubSelectedClass;
93
118
  }
94
119
  export {};
@@ -1,9 +1,9 @@
1
- import { NodeList, EdgeList } from '@linkurious/ogma';
1
+ import { EdgeList, NodeList } from '@linkurious/ogma';
2
2
  import { LkEdgeData, LkNodeData } from '@linkurious/rest-client';
3
3
  import { LKOgma } from '../index';
4
4
  import { OgmaStore } from './OgmaStore';
5
5
  export interface OgmaState {
6
- selection: NodeList<LkNodeData, LkEdgeData> | EdgeList<LkEdgeData, LkNodeData>;
6
+ selection: NodeList<LkNodeData, LkEdgeData> | EdgeList<LkEdgeData, LkNodeData> | undefined;
7
7
  items: {
8
8
  node: Array<string | number>;
9
9
  edge: Array<string | number>;
@@ -41,7 +41,3 @@ export declare class RxViz {
41
41
  */
42
42
  private storeEdgeSelection;
43
43
  }
44
- export declare class DummyNodeList {
45
- size: number;
46
- isNode: boolean;
47
- }
@@ -1,5 +1,5 @@
1
1
  import { EntityType, LkEdgeData, LkNodeData } from '@linkurious/rest-client';
2
- import { Edge, Node } from '@linkurious/ogma';
2
+ import type { Edge, Node } from '@linkurious/ogma';
3
3
  import { OgmaState } from './reactive';
4
4
  export type SelectionState = 'selection' | 'multiSelection' | 'noSelection';
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { IEdgeStyle, INodeStyle, IStyleRule, OgmaEdgeShape, OgmaNodeShape, TextOptions } from '@linkurious/rest-client';
2
- import { LKOgma, StyleRule as LKStyleRule, StyleType } from '../..';
2
+ import { LKOgma, NodeAttributes, StyleRule as LKStyleRule, StyleType } from '../..';
3
3
  export interface StylesConfig {
4
4
  nodeColorStyleRules: Array<LKStyleRule>;
5
5
  nodeIconStyleRules: Array<LKStyleRule>;
@@ -9,6 +9,8 @@ export interface StylesConfig {
9
9
  edgeWidthStyleRules: Array<LKStyleRule>;
10
10
  edgeShapeStyleRules?: Array<LKStyleRule>;
11
11
  }
12
+ export declare const DEFAULT_OGMA_FONT = "'roboto', sans-serif";
13
+ export declare const CLEAR_FONT_COLOR = "#FFF";
12
14
  export declare const FILTER_OPACITY = 0.2;
13
15
  export declare class StylesViz {
14
16
  private _ogma;
@@ -42,6 +44,8 @@ export declare class StylesViz {
42
44
  };
43
45
  baseUrl?: string;
44
46
  });
47
+ get nodeAttributes(): NodeAttributes;
48
+ get nodeFont(): string | undefined;
45
49
  /**
46
50
  * Set nodes default styles based on the configuration
47
51
  */
@@ -1,5 +1,5 @@
1
1
  import { GenericObject, IEdgeGroupStyle, LkEdgeData, LkNodeData } from '@linkurious/rest-client';
2
- import { StyleRule, Transformation } from '@linkurious/ogma';
2
+ import type { StyleRule, Transformation } from '@linkurious/ogma';
3
3
  import { LKOgma } from '../index';
4
4
  export declare class TransformationsViz {
5
5
  private _ogma;
@@ -1,5 +1,6 @@
1
1
  import { ForceLayoutMode, HierarchicalLayoutMode, IOgmaConfig, LkEdgeData, LkNodeData, PopulatedVisualization, VizEdge, VizNode } from '@linkurious/rest-client';
2
- import Ogma, { EdgeList, ForceLayoutOptions, HierarchicalLayoutOptions, NodeId, NodeList, NonObjectPropertyWatcher, RadialLayoutOptions, RawEdge, RawGraph } from '@linkurious/ogma';
2
+ import type { EdgeList, ForceLayoutOptions, HierarchicalLayoutOptions, NodeId, NodeList, NonObjectPropertyWatcher, RadialLayoutOptions, RawEdge, RawGraph } from '@linkurious/ogma';
3
+ import Ogma from '@linkurious/ogma';
3
4
  import { StylesViz } from './features/styles';
4
5
  import { TransformationsViz } from './features/transformations';
5
6
  import { CaptionsViz } from './features/captions';
@@ -11,13 +12,6 @@ interface AddItemOptions {
11
12
  batchSize?: number;
12
13
  virtual?: boolean;
13
14
  }
14
- export declare const FORCE_LAYOUT_CONFIG: {
15
- steps: number;
16
- alignSiblings: boolean;
17
- charge: number;
18
- theta: number;
19
- duration: number;
20
- };
21
15
  export declare class LKOgma extends Ogma<LkNodeData, LkEdgeData> {
22
16
  private _configuration;
23
17
  LKStyles: StylesViz;
@@ -98,4 +92,16 @@ export declare class LKOgma extends Ogma<LkNodeData, LkEdgeData> {
98
92
  * Updates the Ogma config when config changes in LKE. If init, options were already set by the Ogma.reset()
99
93
  */
100
94
  setConfigOgma(configuration?: IOgmaConfig, init?: boolean, baseUrl?: string): void;
95
+ /**
96
+ * An override of the Ogma method getSelectedNodes
97
+ * originally it was returning only the visible selected nodes
98
+ * but we need to return all selected nodes, including the one that are part of collapsed groups
99
+ */
100
+ getSelectedNodes(): NodeList<LkNodeData, LkEdgeData>;
101
+ /**
102
+ * An override of the Ogma method clearSelection
103
+ * originally it was unselecting only the visible selected nodes
104
+ * but we need also to unselect invisible nodes, including the one that are part of collapsed groups
105
+ */
106
+ clearSelection(): void;
101
107
  }
@@ -1,4 +1,4 @@
1
- import { Color } from '@linkurious/ogma';
1
+ import type { Color } from '@linkurious/ogma';
2
2
  import { IEdgeStyle, LkEdgeData, OgmaEdgeShape } from '@linkurious/rest-client';
3
3
  import { StyleRule } from './styleRule';
4
4
  import { ItemAttributes } from './itemAttributes';
@@ -1,4 +1,4 @@
1
- import { Color } from '@linkurious/ogma';
1
+ import type { Color } from '@linkurious/ogma';
2
2
  import { IEdgeStyle, INodeStyle, IStyleAutoRange } from '@linkurious/rest-client';
3
3
  import { StyleRule } from './styleRule';
4
4
  import { NodeSizeExtrema } from './nodeAttributes';
@@ -1,4 +1,4 @@
1
- import { Color } from '@linkurious/ogma';
1
+ import type { Color } from '@linkurious/ogma';
2
2
  import { IImageDataValue, INodeStyle, IStyleIcon, IStyleImage, LkNodeData, OgmaNodeShape } from '@linkurious/rest-client';
3
3
  import { StyleRule } from './styleRule';
4
4
  import { ItemAttributes } from './itemAttributes';
@@ -1,5 +1,13 @@
1
- import { Color, NodeList, Node, EdgeList, Edge, NodeId } from '@linkurious/ogma';
1
+ import type { Color, Edge, EdgeList, Node, NodeId, NodeList } from '@linkurious/ogma';
2
2
  import { LkEdgeData, LkNodeData } from '@linkurious/rest-client';
3
+ export declare const FORCE_LAYOUT_CONFIG: {
4
+ steps: number;
5
+ alignSiblings: boolean;
6
+ charge: number;
7
+ theta: number;
8
+ duration: number;
9
+ gravity: number;
10
+ };
3
11
  export declare class OgmaTools {
4
12
  /**
5
13
  * Get the amount of hidden neighbors from a list of nodes
@@ -23,6 +31,18 @@ export declare class OgmaTools {
23
31
  static isBright(color: Color): boolean;
24
32
  static isNode(item: Node<LkNodeData, LkEdgeData> | Edge<LkEdgeData, LkNodeData>): item is Node<LkNodeData, LkEdgeData>;
25
33
  static isNodeList(items: NodeList<LkNodeData, LkEdgeData> | EdgeList<LkEdgeData, LkNodeData>): items is NodeList<LkNodeData, LkEdgeData>;
26
- static topologicalSort(nodes: NodeList): NodeId[];
34
+ /**
35
+ * Transform a nodelist to an array of node ids sorted by position in a chain and the length of the chain
36
+ * A chain is: (a)-(b)-(c)-(d)
37
+ */
38
+ static topologicalSort(nodes: NodeList): {
39
+ chain: NodeId[];
40
+ numberOfChain: number;
41
+ };
27
42
  static isStar(nodes: NodeList): false | Node<any, any>;
43
+ /**
44
+ * Return true if the group is collapsed
45
+ */
46
+ static isGroupCollapsed(node: Node): boolean;
47
+ static setCollapsedGroupProperty(node: Node<LkNodeData>, collapsed: boolean): void;
28
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linkurious/ogma-linkurious-parser",
3
- "version": "4.1.14",
3
+ "version": "4.2.1",
4
4
  "author": "Linkurious SAS",
5
5
  "description": "Parse and load a Linkurious visualization in Ogma with one line of code ",
6
6
  "files": [
@@ -15,7 +15,7 @@
15
15
  "module": "./dist/index.mjs",
16
16
  "types": "./dist/index.d.ts",
17
17
  "engines": {
18
- "node": "20.18.2"
18
+ "node": "22.15.1"
19
19
  },
20
20
  "exports": {
21
21
  ".": {
@@ -58,11 +58,11 @@
58
58
  "sha1": "1.1.1"
59
59
  },
60
60
  "peerDependencies": {
61
- "@linkurious/ogma": "5.1.1"
61
+ "@linkurious/ogma": "5.2.6"
62
62
  },
63
63
  "devDependencies": {
64
- "@linkurious/ogma": "5.1.1",
65
- "@linkurious/rest-client": "4.1.14",
64
+ "@linkurious/ogma": "5.2.6",
65
+ "@linkurious/rest-client": "4.2.1",
66
66
  "@types/chai": "4.2.17",
67
67
  "@types/lodash": "4.14.182",
68
68
  "@types/mocha": "5.2.7",