@hpcc-js/graph 3.7.2 → 3.7.4

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.
Files changed (82) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +256 -256
  3. package/dist/assets/dagre-B-z4SP0u.js.map +1 -1
  4. package/dist/assets/graphviz-BK7FEJlA.js.map +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.umd.cjs +2 -2
  8. package/dist/index.umd.cjs.map +1 -1
  9. package/package.json +8 -8
  10. package/src/AdjacencyGraph.ts +224 -224
  11. package/src/Edge.css +22 -22
  12. package/src/Edge.ts +257 -257
  13. package/src/Graph.css +18 -18
  14. package/src/Graph.ts +1077 -1077
  15. package/src/GraphData.ts +187 -187
  16. package/src/GraphLayouts.ts +214 -214
  17. package/src/Sankey.css +44 -44
  18. package/src/Sankey.ts +304 -304
  19. package/src/Subgraph.css +9 -9
  20. package/src/Subgraph.ts +165 -165
  21. package/src/Vertex.css +2 -2
  22. package/src/Vertex.ts +282 -282
  23. package/src/__package__.ts +3 -3
  24. package/src/__tests__/data.ts +444 -444
  25. package/src/__tests__/index.ts +1 -1
  26. package/src/__tests__/test1.ts +18 -18
  27. package/src/__tests__/test2.ts +80 -80
  28. package/src/__tests__/test3.ts +46 -46
  29. package/src/__tests__/test4.ts +66 -66
  30. package/src/__tests__/test5.ts +85 -85
  31. package/src/common/graphT.css +38 -38
  32. package/src/common/graphT.ts +1363 -1363
  33. package/src/common/index.ts +3 -3
  34. package/src/common/layouts/circle.ts +37 -37
  35. package/src/common/layouts/dagre.ts +145 -145
  36. package/src/common/layouts/dagreWorker.ts +24 -24
  37. package/src/common/layouts/forceDirected.ts +117 -117
  38. package/src/common/layouts/forceDirectedWorker.ts +22 -22
  39. package/src/common/layouts/geoForceDirected.ts +112 -112
  40. package/src/common/layouts/graphviz.ts +137 -137
  41. package/src/common/layouts/graphvizWorker.ts +27 -27
  42. package/src/common/layouts/index.ts +7 -7
  43. package/src/common/layouts/layout.ts +147 -147
  44. package/src/common/layouts/null.ts +39 -39
  45. package/src/common/layouts/placeholders.ts +113 -113
  46. package/src/common/layouts/tree.ts +326 -326
  47. package/src/common/layouts/workers/dagre.ts +46 -46
  48. package/src/common/layouts/workers/dagreOptions.ts +35 -35
  49. package/src/common/layouts/workers/forceDirected.ts +38 -38
  50. package/src/common/layouts/workers/forceDirectedOptions.ts +30 -30
  51. package/src/common/layouts/workers/graphviz.ts +225 -225
  52. package/src/common/layouts/workers/graphvizOptions.ts +70 -70
  53. package/src/common/liteMap.ts +72 -72
  54. package/src/common/liteSVGZooom.ts +61 -61
  55. package/src/common/sankeyGraph.css +44 -44
  56. package/src/common/sankeyGraph.ts +345 -345
  57. package/src/html/annotation.ts +71 -71
  58. package/src/html/component.ts +18 -18
  59. package/src/html/edge.ts +15 -15
  60. package/src/html/graphHtml.ts +11 -11
  61. package/src/html/graphHtmlT.ts +117 -117
  62. package/src/html/icon.ts +64 -64
  63. package/src/html/image.ts +26 -26
  64. package/src/html/imageChar.ts +18 -18
  65. package/src/html/index.ts +8 -8
  66. package/src/html/intersection.ts +110 -110
  67. package/src/html/shape.ts +141 -141
  68. package/src/html/text.ts +59 -59
  69. package/src/html/textBox.ts +45 -45
  70. package/src/html/vertex.ts +67 -67
  71. package/src/index.ts +10 -10
  72. package/src/react/dataGraph.ts +345 -345
  73. package/src/react/graphReact.ts +177 -177
  74. package/src/react/graphReactT.ts +44 -44
  75. package/src/react/index.ts +4 -4
  76. package/src/react/subgraph.tsx +30 -30
  77. package/src/react/vertex.tsx +31 -31
  78. package/types/Edge.d.ts +1 -1
  79. package/types/Graph.d.ts +1 -1
  80. package/types/Sankey.d.ts +1 -1
  81. package/types/Subgraph.d.ts +1 -1
  82. package/types/Vertex.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/graph",
3
- "version": "3.7.2",
3
+ "version": "3.7.4",
4
4
  "description": "hpcc-js - Viz Graph",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
@@ -38,17 +38,17 @@
38
38
  "update-major": "npx --yes npm-check-updates -u"
39
39
  },
40
40
  "dependencies": {
41
- "@hpcc-js/api": "^3.4.13",
42
- "@hpcc-js/common": "^3.7.3",
43
- "@hpcc-js/html": "^3.3.13",
44
- "@hpcc-js/react": "^3.4.13",
45
- "@hpcc-js/util": "^3.5.2"
41
+ "@hpcc-js/api": "^3.4.15",
42
+ "@hpcc-js/common": "^3.7.5",
43
+ "@hpcc-js/html": "^3.3.15",
44
+ "@hpcc-js/react": "^3.4.15",
45
+ "@hpcc-js/util": "^3.5.4"
46
46
  },
47
47
  "optionalPeerDependencies": {
48
48
  "react": ">=17.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@hpcc-js/esbuild-plugins": "^1.8.5",
51
+ "@hpcc-js/esbuild-plugins": "^1.8.7",
52
52
  "@hpcc-js/wasm-graphviz": "1.21.2",
53
53
  "@types/d3-transition": "1.3.6",
54
54
  "@types/dagre": "0.7.54",
@@ -73,5 +73,5 @@
73
73
  "url": "https://github.com/hpcc-systems/Visualization/issues"
74
74
  },
75
75
  "homepage": "https://github.com/hpcc-systems/Visualization",
76
- "gitHead": "eab3a48367063ed368bdd82c05de6a822ee308aa"
76
+ "gitHead": "f8bdd58fc6914054a2313a87bbe1257dc9720545"
77
77
  }
@@ -1,224 +1,224 @@
1
- import { PropertyExt } from "@hpcc-js/common";
2
- import { hashSum } from "@hpcc-js/util";
3
- import { Edge } from "./Edge.ts";
4
- import { Graph, IGraphData } from "./Graph.ts";
5
- import { IAnnotation, Vertex } from "./Vertex.ts";
6
-
7
- interface IAnnotationIndexes {
8
- iconCol: number;
9
- iconFillCol: number;
10
- tooltipCol: number;
11
- shapeStrokeCol: number;
12
- shapeFillCol: number;
13
- }
14
-
15
- export class Annotation extends PropertyExt {
16
- protected _owner: AdjacencyGraph;
17
-
18
- owner(): AdjacencyGraph;
19
- owner(_: AdjacencyGraph): this;
20
- owner(_?: AdjacencyGraph): AdjacencyGraph | this {
21
- if (!arguments.length) return this._owner;
22
- this._owner = _;
23
- return this;
24
- }
25
-
26
- valid(): boolean {
27
- return !!this.iconColumn();
28
- }
29
-
30
- indexes(): IAnnotationIndexes {
31
- const columns = this._owner.columns();
32
- return {
33
- iconCol: columns.indexOf(this.iconColumn()),
34
- iconFillCol: columns.indexOf(this.iconFillColumn()),
35
- tooltipCol: columns.indexOf(this.tooltipColumn()),
36
- shapeStrokeCol: columns.indexOf(this.shapeStrokeColumn()),
37
- shapeFillCol: columns.indexOf(this.shapeFillColumn())
38
- };
39
- }
40
-
41
- mapper(): (row) => IAnnotation {
42
- const indexes = this.indexes();
43
- return (row) => ({
44
- faChar: row[indexes.iconCol],
45
- tooltip: row[indexes.tooltipCol],
46
- shape_colorFill: row[indexes.shapeFillCol] || this.shapeFillDefault(),
47
- shape_colorStroke: row[indexes.shapeStrokeCol] || this.shapeStrokeDefault(),
48
- image_colorFill: row[indexes.iconFillCol] || this.iconFillDefault()
49
- });
50
- }
51
- }
52
- Annotation.prototype._class += " graph_Annotation";
53
- export interface Annotation {
54
- iconColumn(): string;
55
- iconColumn(_: string): this;
56
- iconFillDefault(): string;
57
- iconFillDefault(_: string): this;
58
- iconFillColumn(): string;
59
- iconFillColumn(_: string): this;
60
- tooltipColumn(): string;
61
- tooltipColumn(_: string): this;
62
- shapeStrokeDefault(): string;
63
- shapeStrokeDefault(_: string): this;
64
- shapeStrokeColumn(): string;
65
- shapeStrokeColumn(_: string): this;
66
- shapeFillDefault(): string;
67
- shapeFillDefault(_: string): this;
68
- shapeFillColumn(): string;
69
- shapeFillColumn(_: string): this;
70
- }
71
- Annotation.prototype.publish("iconColumn", "", "set", "Icon column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
72
- Annotation.prototype.publish("iconFillDefault", "white", "html-color", "Icon fill default color");
73
- Annotation.prototype.publish("iconFillColumn", "", "set", "Icon fill color column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
74
- Annotation.prototype.publish("tooltipColumn", "", "set", "Tooltip column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
75
- Annotation.prototype.publish("shapeStrokeDefault", "darkred", "html-color", "Shape stroke default color");
76
- Annotation.prototype.publish("shapeStrokeColumn", "", "set", "Shape stroke color column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
77
- Annotation.prototype.publish("shapeFillDefault", "red", "html-color", "Shape fill default color");
78
- Annotation.prototype.publish("shapeFillColumn", "", "set", "Shape fill color column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
79
-
80
- export class AdjacencyGraph extends Graph {
81
-
82
- private _vertexMap: { [key: string]: Vertex } = {};
83
- private _edgeMap: { [key: string]: Edge } = {};
84
- private _prevAdjacencyDataHash: string;
85
- private _merge: boolean = false;
86
- private _adjacencyData: object[] = [];
87
-
88
- constructor() {
89
- super();
90
- }
91
-
92
- linksColumns(): string[] {
93
- const linksCol: number = this.columns().indexOf(this.linksColumn());
94
- const linksField = this._db.field(linksCol);
95
- if (linksField) {
96
- return linksField.children().map(field => field.label());
97
- }
98
- return [];
99
- }
100
-
101
- validAnnotations() {
102
- return this.annotations().filter(a => a.valid());
103
- }
104
-
105
- updateData() {
106
- const prevAdjacencyDataHash = hashSum([this._adjacencyData, this.uidColumn(), this.labelColumn(), this.iconColumn(), this.linksColumn(), this.linkUidColumn(), this.linkLabelColumn(), this.validAnnotations().map(a => a.hashSum())]);
107
- if (this._prevAdjacencyDataHash !== prevAdjacencyDataHash) {
108
- this._prevAdjacencyDataHash = prevAdjacencyDataHash;
109
-
110
- const columns = this.columns();
111
- const uidCol: number = columns.indexOf(this.uidColumn());
112
- const labelCol: number = columns.indexOf(this.labelColumn());
113
- const iconCol: number = columns.indexOf(this.iconColumn());
114
- const linksCol: number = columns.indexOf(this.linksColumn());
115
-
116
- const linksColumns = this.linksColumns();
117
- const linksUidCol: number = linksColumns.indexOf(this.linkUidColumn());
118
- const linksLabelCol: number = linksColumns.indexOf(this.linkLabelColumn());
119
-
120
- const annotationMappers = this.validAnnotations().map(a => a.mapper());
121
-
122
- const vertexMap: { [key: string]: Vertex } = {};
123
- const edgeMap: { [key: string]: Edge } = {};
124
- const graphData: IGraphData = {
125
- vertices: this._adjacencyData.map(row => {
126
- const uid = row[uidCol];
127
- if (uid !== undefined) {
128
- let retVal = vertexMap[uid] || this._vertexMap[uid];
129
- if (!retVal) {
130
- retVal = new Vertex();
131
- }
132
- vertexMap[uid] = retVal;
133
-
134
- retVal
135
- .text(row[labelCol])
136
- .data(row)
137
- .faChar(row[iconCol])
138
- .annotationIcons(annotationMappers.map(am => am(row)))
139
- ;
140
-
141
- return retVal;
142
- }
143
- }).filter(v => !!v),
144
- edges: []
145
- };
146
- for (const row of this._adjacencyData) {
147
- const uid = row[uidCol];
148
- const links = row[linksCol];
149
- if (uid !== undefined && links !== undefined) {
150
- for (const childRow of links) {
151
- const linkUid = childRow[linksUidCol];
152
- const linkLabel = childRow[linksLabelCol];
153
- const edgeID = `${uid}->${linkUid}`;
154
- let retVal = edgeMap[edgeID] || this._edgeMap[edgeID];
155
- if (!retVal) {
156
- if (vertexMap[uid] && vertexMap[linkUid]) {
157
- retVal = new Edge()
158
- .sourceVertex(vertexMap[uid])
159
- .targetVertex(vertexMap[linkUid])
160
- .data(childRow)
161
- ;
162
- } else {
163
- console.warn("Missing vertices for edge: " + edgeID);
164
- }
165
- }
166
- if (retVal) {
167
- retVal.text(linkLabel);
168
- edgeMap[edgeID] = retVal;
169
- graphData.edges.push(retVal);
170
- }
171
- }
172
- }
173
- }
174
- this._vertexMap = vertexMap;
175
- this._edgeMap = edgeMap;
176
- super.data(graphData, this._merge);
177
- }
178
- }
179
-
180
- data(): IGraphData;
181
- data(_: IGraphData, merge?: boolean): this;
182
- data(_?: IGraphData | object[], merge?: boolean): IGraphData | object[] | this {
183
- if (!arguments.length) return this._adjacencyData;
184
- if (_ instanceof Array) {
185
- this._merge = merge;
186
- this._adjacencyData = _;
187
- return this;
188
- }
189
- throw new Error("Invalid data shape.");
190
- }
191
-
192
- update(domNode, element) {
193
- this.updateData();
194
- super.update(domNode, element);
195
- }
196
-
197
- click(row, col, sel) {
198
- }
199
- }
200
- AdjacencyGraph.prototype._class += " graph_AdjacencyGraph";
201
-
202
- export interface AdjacencyGraph {
203
- uidColumn(): string;
204
- uidColumn(_: string): this;
205
- labelColumn(): string;
206
- labelColumn(_: string): this;
207
- iconColumn(): string;
208
- iconColumn(_: string): this;
209
- linksColumn(): string;
210
- linksColumn(_: string): this;
211
- linkUidColumn(): string;
212
- linkUidColumn(_: string): this;
213
- linkLabelColumn(): string;
214
- linkLabelColumn(_: string): this;
215
- annotations(): Annotation[];
216
- annotations(_: Annotation[]): this;
217
- }
218
- AdjacencyGraph.prototype.publish("uidColumn", "", "set", "UID column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
219
- AdjacencyGraph.prototype.publish("labelColumn", "", "set", "Label column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
220
- AdjacencyGraph.prototype.publish("iconColumn", "", "set", "Icon column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
221
- AdjacencyGraph.prototype.publish("linksColumn", "", "set", "Links column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
222
- AdjacencyGraph.prototype.publish("linkUidColumn", "", "set", "Link UID column", function (this: AdjacencyGraph) { return this.linksColumns(); }, { optional: true });
223
- AdjacencyGraph.prototype.publish("linkLabelColumn", "", "set", "Link Label column", function (this: AdjacencyGraph) { return this.linksColumns(); }, { optional: true });
224
- AdjacencyGraph.prototype.publish("annotations", [], "propertyArray", "Annotations", null, { autoExpand: Annotation });
1
+ import { PropertyExt } from "@hpcc-js/common";
2
+ import { hashSum } from "@hpcc-js/util";
3
+ import { Edge } from "./Edge.ts";
4
+ import { Graph, IGraphData } from "./Graph.ts";
5
+ import { IAnnotation, Vertex } from "./Vertex.ts";
6
+
7
+ interface IAnnotationIndexes {
8
+ iconCol: number;
9
+ iconFillCol: number;
10
+ tooltipCol: number;
11
+ shapeStrokeCol: number;
12
+ shapeFillCol: number;
13
+ }
14
+
15
+ export class Annotation extends PropertyExt {
16
+ protected _owner: AdjacencyGraph;
17
+
18
+ owner(): AdjacencyGraph;
19
+ owner(_: AdjacencyGraph): this;
20
+ owner(_?: AdjacencyGraph): AdjacencyGraph | this {
21
+ if (!arguments.length) return this._owner;
22
+ this._owner = _;
23
+ return this;
24
+ }
25
+
26
+ valid(): boolean {
27
+ return !!this.iconColumn();
28
+ }
29
+
30
+ indexes(): IAnnotationIndexes {
31
+ const columns = this._owner.columns();
32
+ return {
33
+ iconCol: columns.indexOf(this.iconColumn()),
34
+ iconFillCol: columns.indexOf(this.iconFillColumn()),
35
+ tooltipCol: columns.indexOf(this.tooltipColumn()),
36
+ shapeStrokeCol: columns.indexOf(this.shapeStrokeColumn()),
37
+ shapeFillCol: columns.indexOf(this.shapeFillColumn())
38
+ };
39
+ }
40
+
41
+ mapper(): (row) => IAnnotation {
42
+ const indexes = this.indexes();
43
+ return (row) => ({
44
+ faChar: row[indexes.iconCol],
45
+ tooltip: row[indexes.tooltipCol],
46
+ shape_colorFill: row[indexes.shapeFillCol] || this.shapeFillDefault(),
47
+ shape_colorStroke: row[indexes.shapeStrokeCol] || this.shapeStrokeDefault(),
48
+ image_colorFill: row[indexes.iconFillCol] || this.iconFillDefault()
49
+ });
50
+ }
51
+ }
52
+ Annotation.prototype._class += " graph_Annotation";
53
+ export interface Annotation {
54
+ iconColumn(): string;
55
+ iconColumn(_: string): this;
56
+ iconFillDefault(): string;
57
+ iconFillDefault(_: string): this;
58
+ iconFillColumn(): string;
59
+ iconFillColumn(_: string): this;
60
+ tooltipColumn(): string;
61
+ tooltipColumn(_: string): this;
62
+ shapeStrokeDefault(): string;
63
+ shapeStrokeDefault(_: string): this;
64
+ shapeStrokeColumn(): string;
65
+ shapeStrokeColumn(_: string): this;
66
+ shapeFillDefault(): string;
67
+ shapeFillDefault(_: string): this;
68
+ shapeFillColumn(): string;
69
+ shapeFillColumn(_: string): this;
70
+ }
71
+ Annotation.prototype.publish("iconColumn", "", "set", "Icon column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
72
+ Annotation.prototype.publish("iconFillDefault", "white", "html-color", "Icon fill default color");
73
+ Annotation.prototype.publish("iconFillColumn", "", "set", "Icon fill color column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
74
+ Annotation.prototype.publish("tooltipColumn", "", "set", "Tooltip column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
75
+ Annotation.prototype.publish("shapeStrokeDefault", "darkred", "html-color", "Shape stroke default color");
76
+ Annotation.prototype.publish("shapeStrokeColumn", "", "set", "Shape stroke color column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
77
+ Annotation.prototype.publish("shapeFillDefault", "red", "html-color", "Shape fill default color");
78
+ Annotation.prototype.publish("shapeFillColumn", "", "set", "Shape fill color column", function (this: Annotation) { return this._owner.columns(); }, { optional: true });
79
+
80
+ export class AdjacencyGraph extends Graph {
81
+
82
+ private _vertexMap: { [key: string]: Vertex } = {};
83
+ private _edgeMap: { [key: string]: Edge } = {};
84
+ private _prevAdjacencyDataHash: string;
85
+ private _merge: boolean = false;
86
+ private _adjacencyData: object[] = [];
87
+
88
+ constructor() {
89
+ super();
90
+ }
91
+
92
+ linksColumns(): string[] {
93
+ const linksCol: number = this.columns().indexOf(this.linksColumn());
94
+ const linksField = this._db.field(linksCol);
95
+ if (linksField) {
96
+ return linksField.children().map(field => field.label());
97
+ }
98
+ return [];
99
+ }
100
+
101
+ validAnnotations() {
102
+ return this.annotations().filter(a => a.valid());
103
+ }
104
+
105
+ updateData() {
106
+ const prevAdjacencyDataHash = hashSum([this._adjacencyData, this.uidColumn(), this.labelColumn(), this.iconColumn(), this.linksColumn(), this.linkUidColumn(), this.linkLabelColumn(), this.validAnnotations().map(a => a.hashSum())]);
107
+ if (this._prevAdjacencyDataHash !== prevAdjacencyDataHash) {
108
+ this._prevAdjacencyDataHash = prevAdjacencyDataHash;
109
+
110
+ const columns = this.columns();
111
+ const uidCol: number = columns.indexOf(this.uidColumn());
112
+ const labelCol: number = columns.indexOf(this.labelColumn());
113
+ const iconCol: number = columns.indexOf(this.iconColumn());
114
+ const linksCol: number = columns.indexOf(this.linksColumn());
115
+
116
+ const linksColumns = this.linksColumns();
117
+ const linksUidCol: number = linksColumns.indexOf(this.linkUidColumn());
118
+ const linksLabelCol: number = linksColumns.indexOf(this.linkLabelColumn());
119
+
120
+ const annotationMappers = this.validAnnotations().map(a => a.mapper());
121
+
122
+ const vertexMap: { [key: string]: Vertex } = {};
123
+ const edgeMap: { [key: string]: Edge } = {};
124
+ const graphData: IGraphData = {
125
+ vertices: this._adjacencyData.map(row => {
126
+ const uid = row[uidCol];
127
+ if (uid !== undefined) {
128
+ let retVal = vertexMap[uid] || this._vertexMap[uid];
129
+ if (!retVal) {
130
+ retVal = new Vertex();
131
+ }
132
+ vertexMap[uid] = retVal;
133
+
134
+ retVal
135
+ .text(row[labelCol])
136
+ .data(row)
137
+ .faChar(row[iconCol])
138
+ .annotationIcons(annotationMappers.map(am => am(row)))
139
+ ;
140
+
141
+ return retVal;
142
+ }
143
+ }).filter(v => !!v),
144
+ edges: []
145
+ };
146
+ for (const row of this._adjacencyData) {
147
+ const uid = row[uidCol];
148
+ const links = row[linksCol];
149
+ if (uid !== undefined && links !== undefined) {
150
+ for (const childRow of links) {
151
+ const linkUid = childRow[linksUidCol];
152
+ const linkLabel = childRow[linksLabelCol];
153
+ const edgeID = `${uid}->${linkUid}`;
154
+ let retVal = edgeMap[edgeID] || this._edgeMap[edgeID];
155
+ if (!retVal) {
156
+ if (vertexMap[uid] && vertexMap[linkUid]) {
157
+ retVal = new Edge()
158
+ .sourceVertex(vertexMap[uid])
159
+ .targetVertex(vertexMap[linkUid])
160
+ .data(childRow)
161
+ ;
162
+ } else {
163
+ console.warn("Missing vertices for edge: " + edgeID);
164
+ }
165
+ }
166
+ if (retVal) {
167
+ retVal.text(linkLabel);
168
+ edgeMap[edgeID] = retVal;
169
+ graphData.edges.push(retVal);
170
+ }
171
+ }
172
+ }
173
+ }
174
+ this._vertexMap = vertexMap;
175
+ this._edgeMap = edgeMap;
176
+ super.data(graphData, this._merge);
177
+ }
178
+ }
179
+
180
+ data(): IGraphData;
181
+ data(_: IGraphData, merge?: boolean): this;
182
+ data(_?: IGraphData | object[], merge?: boolean): IGraphData | object[] | this {
183
+ if (!arguments.length) return this._adjacencyData;
184
+ if (_ instanceof Array) {
185
+ this._merge = merge;
186
+ this._adjacencyData = _;
187
+ return this;
188
+ }
189
+ throw new Error("Invalid data shape.");
190
+ }
191
+
192
+ update(domNode, element) {
193
+ this.updateData();
194
+ super.update(domNode, element);
195
+ }
196
+
197
+ click(row, col, sel) {
198
+ }
199
+ }
200
+ AdjacencyGraph.prototype._class += " graph_AdjacencyGraph";
201
+
202
+ export interface AdjacencyGraph {
203
+ uidColumn(): string;
204
+ uidColumn(_: string): this;
205
+ labelColumn(): string;
206
+ labelColumn(_: string): this;
207
+ iconColumn(): string;
208
+ iconColumn(_: string): this;
209
+ linksColumn(): string;
210
+ linksColumn(_: string): this;
211
+ linkUidColumn(): string;
212
+ linkUidColumn(_: string): this;
213
+ linkLabelColumn(): string;
214
+ linkLabelColumn(_: string): this;
215
+ annotations(): Annotation[];
216
+ annotations(_: Annotation[]): this;
217
+ }
218
+ AdjacencyGraph.prototype.publish("uidColumn", "", "set", "UID column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
219
+ AdjacencyGraph.prototype.publish("labelColumn", "", "set", "Label column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
220
+ AdjacencyGraph.prototype.publish("iconColumn", "", "set", "Icon column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
221
+ AdjacencyGraph.prototype.publish("linksColumn", "", "set", "Links column", function (this: AdjacencyGraph) { return this.columns(); }, { optional: true });
222
+ AdjacencyGraph.prototype.publish("linkUidColumn", "", "set", "Link UID column", function (this: AdjacencyGraph) { return this.linksColumns(); }, { optional: true });
223
+ AdjacencyGraph.prototype.publish("linkLabelColumn", "", "set", "Link Label column", function (this: AdjacencyGraph) { return this.linksColumns(); }, { optional: true });
224
+ AdjacencyGraph.prototype.publish("annotations", [], "propertyArray", "Annotations", null, { autoExpand: Annotation });
package/src/Edge.css CHANGED
@@ -1,23 +1,23 @@
1
- .graph_Edge {
2
- fill: none;
3
- stroke: #656565;
4
- stroke-width: 1.0px;
5
- }
6
-
7
- .graph_Edge .common_TextBox .common_Text {
8
- fill: black;
9
- stroke: none;
10
- }
11
-
12
- .graph_Edge .common_TextBox .common_Shape {
13
- fill: white;
14
- stroke: none;
15
- }
16
-
17
- .graph_Edge.selected {
18
- stroke: red !important;
19
- }
20
-
21
- .graph_Edge.selected .common_Text {
22
- fill: red !important;
1
+ .graph_Edge {
2
+ fill: none;
3
+ stroke: #656565;
4
+ stroke-width: 1.0px;
5
+ }
6
+
7
+ .graph_Edge .common_TextBox .common_Text {
8
+ fill: black;
9
+ stroke: none;
10
+ }
11
+
12
+ .graph_Edge .common_TextBox .common_Shape {
13
+ fill: white;
14
+ stroke: none;
15
+ }
16
+
17
+ .graph_Edge.selected {
18
+ stroke: red !important;
19
+ }
20
+
21
+ .graph_Edge.selected .common_Text {
22
+ fill: red !important;
23
23
  }