@hpcc-js/graph 2.87.3 → 2.87.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 (60) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +256 -256
  3. package/dist/index.es6.js +3 -3
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.min.js.map +1 -1
  9. package/package.json +8 -8
  10. package/src/AdjacencyGraph.ts +224 -224
  11. package/src/Edge.css +23 -23
  12. package/src/Edge.ts +257 -257
  13. package/src/Graph.css +18 -18
  14. package/src/Graph.ts +1075 -1075
  15. package/src/GraphData.ts +187 -187
  16. package/src/GraphLayouts.ts +173 -173
  17. package/src/Sankey.css +46 -46
  18. package/src/Sankey.ts +291 -291
  19. package/src/Subgraph.css +10 -10
  20. package/src/Subgraph.ts +165 -165
  21. package/src/Vertex.css +3 -3
  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/graph2/dataGraph.ts +305 -305
  32. package/src/graph2/graph.css +34 -34
  33. package/src/graph2/graph.ts +135 -135
  34. package/src/graph2/graphReactT.ts +44 -44
  35. package/src/graph2/graphT.ts +1330 -1330
  36. package/src/graph2/index.ts +7 -7
  37. package/src/graph2/layouts/circle.ts +37 -37
  38. package/src/graph2/layouts/dagre.ts +132 -132
  39. package/src/graph2/layouts/dagreWorker.ts +35 -35
  40. package/src/graph2/layouts/forceDirected.ts +117 -117
  41. package/src/graph2/layouts/forceDirectedWorker.ts +30 -30
  42. package/src/graph2/layouts/geoForceDirected.ts +112 -112
  43. package/src/graph2/layouts/graphviz.ts +124 -124
  44. package/src/graph2/layouts/graphvizWorker.ts +71 -71
  45. package/src/graph2/layouts/index.ts +7 -7
  46. package/src/graph2/layouts/layout.ts +105 -105
  47. package/src/graph2/layouts/null.ts +35 -35
  48. package/src/graph2/layouts/placeholders.ts +103 -103
  49. package/src/graph2/layouts/tree.ts +328 -328
  50. package/src/graph2/liteMap.ts +72 -72
  51. package/src/graph2/liteSVGZooom.ts +61 -61
  52. package/src/graph2/sankeyGraph.css +45 -45
  53. package/src/graph2/sankeyGraph.ts +316 -316
  54. package/src/graph2/subgraph.tsx +30 -30
  55. package/src/graph2/vertex.tsx +31 -31
  56. package/src/index.ts +8 -8
  57. package/src/test.ts +649 -649
  58. package/types/__package__.d.ts +2 -2
  59. package/types/__package__.d.ts.map +1 -1
  60. package/types-3.4/__package__.d.ts +2 -2
package/src/Subgraph.ts CHANGED
@@ -1,165 +1,165 @@
1
- import { Icon, Palette, SVGWidget, Text } from "@hpcc-js/common";
2
- import "d3-transition";
3
-
4
- import "../src/Subgraph.css";
5
-
6
- const TITLE_SIZE = 14;
7
- const MINMAX_SIZE = 18;
8
-
9
- export type SubgraphMinState = "normal" | "partial";
10
-
11
- export class Subgraph extends SVGWidget {
12
- protected _border;
13
- protected _textWidget = new Text()
14
- .anchor("start")
15
- .fontSize(TITLE_SIZE)
16
- ;
17
- protected _buttonMin = new Icon()
18
- .diameter(MINMAX_SIZE)
19
- .shape_colorStroke("#1f77b4")
20
- .shape_colorFill("#dcf1ff")
21
- .image_colorFill("#1f77b4")
22
- .on("click", () => {
23
- this.minClick();
24
- }, true)
25
- .on("dblclick", () => {
26
- }, true)
27
- ;
28
-
29
- protected _minState: SubgraphMinState = "normal";
30
-
31
- constructor() {
32
- super();
33
- }
34
-
35
- minState(): SubgraphMinState;
36
- minState(_: SubgraphMinState): this;
37
- minState(_?: SubgraphMinState): SubgraphMinState | this {
38
- if (!arguments.length) return this._minState;
39
- this._minState = _;
40
- return this;
41
- }
42
-
43
- calcIcon() {
44
- switch (this._minState) {
45
- case "normal":
46
- return "\uf2d2";
47
- case "partial":
48
- return "\uf2d0";
49
- }
50
- }
51
-
52
- getBBox(refresh = false, round = false) {
53
- const width = this.width();
54
- const height = this.height();
55
- return {
56
- x: -width / 2,
57
- y: -height / 2 - TITLE_SIZE,
58
- width,
59
- height
60
- };
61
- }
62
-
63
- enter(domNode, element) {
64
- super.enter(domNode, element);
65
- this._border = element.append("rect").attr("class", "border");
66
- this._textWidget.target(domNode);
67
- this._buttonMin.target(domNode);
68
- }
69
-
70
- update(domNode, element) {
71
- super.update(domNode, element);
72
-
73
- const bbox = this.getBBox();
74
-
75
- this._border
76
- .attr("x", bbox.x)
77
- .attr("y", bbox.y)
78
- .attr("width", bbox.width)
79
- .attr("height", bbox.height)
80
- .style("fill", this.border_colorFill())
81
- .style("stroke", this.border_colorStroke())
82
- ;
83
-
84
- if (this.border_colorFill_exists() && !this.title_colorFill_exists()) {
85
- this.title_colorFill(Palette.textColor(this.border_colorFill()));
86
- }
87
- this._textWidget
88
- .pos({ x: bbox.x + 4, y: bbox.y + TITLE_SIZE })
89
- .width(this.width() - 8)
90
- .text(this.showTitle() ? this.title() : "")
91
- .render()
92
- ;
93
-
94
- this._buttonMin
95
- .visible(this.showMinMax())
96
- .pos({ x: bbox.x + bbox.width - (MINMAX_SIZE / 2 + 4), y: bbox.y + (MINMAX_SIZE / 2 + 4) })
97
- .faChar(this.calcIcon())
98
- .render()
99
- ;
100
- }
101
-
102
- exit(domNode, element) {
103
- this._buttonMin.target(null);
104
- this._textWidget.target(null);
105
- this._border.remove();
106
- super.exit(domNode, element);
107
- }
108
-
109
- intersection(pointA, pointB) {
110
- const hits = [];
111
- let nearest = null;
112
- hits.forEach(function (item) {
113
- if (nearest === null || nearest.d > item.d) {
114
- nearest = item;
115
- }
116
- });
117
- return nearest && nearest.i ? nearest.i : null;
118
- }
119
-
120
- click(d) {
121
- }
122
-
123
- minClick() {
124
- switch (this._minState) {
125
- case "normal":
126
- this._minState = "partial";
127
- break;
128
- case "partial":
129
- this._minState = "normal";
130
- break;
131
- }
132
- this._buttonMin
133
- .faChar(this.calcIcon()) // max:f2d0, restore: f2d2, min: f2d1
134
- .render()
135
- ;
136
- }
137
- }
138
- Subgraph.prototype._class += " graph_Subgraph";
139
-
140
- export interface Subgraph {
141
- border_colorStroke(): string;
142
- border_colorStroke(_: string): this;
143
- border_colorFill(): string;
144
- border_colorFill(_: string): this;
145
- border_colorFill_exists: () => boolean;
146
- showTitle(): boolean;
147
- showTitle(_: boolean): this;
148
- title(): string;
149
- title(_: string): this;
150
- titleFontSize(): string;
151
- titleFontSize(_: string): this;
152
- title_colorFill(): string;
153
- title_colorFill(_: string): this;
154
- title_colorFill_exists: () => boolean;
155
- showMinMax(): boolean;
156
- showMinMax(_: boolean): this;
157
- }
158
-
159
- Subgraph.prototype.publish("border_colorStroke", null, "html-color", "Stroke Color", null, { optional: true });
160
- Subgraph.prototype.publish("border_colorFill", null, "html-color", "Fill Color", null, { optional: true });
161
- Subgraph.prototype.publish("showTitle", true, "boolean", "Show Title", null, { tags: ["Basic"] });
162
- Subgraph.prototype.publish("title", "", "string", "Title", null, { tags: ["Basic"] });
163
- Subgraph.prototype.publishProxy("titleFontSize", "_textWidget", "fontSize");
164
- Subgraph.prototype.publishProxy("title_colorFill", "_textWidget", "colorFill");
165
- Subgraph.prototype.publish("showMinMax", false, "boolean", "Show Min/Max", null, { tags: ["Basic"] });
1
+ import { Icon, Palette, SVGWidget, Text } from "@hpcc-js/common";
2
+ import "d3-transition";
3
+
4
+ import "../src/Subgraph.css";
5
+
6
+ const TITLE_SIZE = 14;
7
+ const MINMAX_SIZE = 18;
8
+
9
+ export type SubgraphMinState = "normal" | "partial";
10
+
11
+ export class Subgraph extends SVGWidget {
12
+ protected _border;
13
+ protected _textWidget = new Text()
14
+ .anchor("start")
15
+ .fontSize(TITLE_SIZE)
16
+ ;
17
+ protected _buttonMin = new Icon()
18
+ .diameter(MINMAX_SIZE)
19
+ .shape_colorStroke("#1f77b4")
20
+ .shape_colorFill("#dcf1ff")
21
+ .image_colorFill("#1f77b4")
22
+ .on("click", () => {
23
+ this.minClick();
24
+ }, true)
25
+ .on("dblclick", () => {
26
+ }, true)
27
+ ;
28
+
29
+ protected _minState: SubgraphMinState = "normal";
30
+
31
+ constructor() {
32
+ super();
33
+ }
34
+
35
+ minState(): SubgraphMinState;
36
+ minState(_: SubgraphMinState): this;
37
+ minState(_?: SubgraphMinState): SubgraphMinState | this {
38
+ if (!arguments.length) return this._minState;
39
+ this._minState = _;
40
+ return this;
41
+ }
42
+
43
+ calcIcon() {
44
+ switch (this._minState) {
45
+ case "normal":
46
+ return "\uf2d2";
47
+ case "partial":
48
+ return "\uf2d0";
49
+ }
50
+ }
51
+
52
+ getBBox(refresh = false, round = false) {
53
+ const width = this.width();
54
+ const height = this.height();
55
+ return {
56
+ x: -width / 2,
57
+ y: -height / 2 - TITLE_SIZE,
58
+ width,
59
+ height
60
+ };
61
+ }
62
+
63
+ enter(domNode, element) {
64
+ super.enter(domNode, element);
65
+ this._border = element.append("rect").attr("class", "border");
66
+ this._textWidget.target(domNode);
67
+ this._buttonMin.target(domNode);
68
+ }
69
+
70
+ update(domNode, element) {
71
+ super.update(domNode, element);
72
+
73
+ const bbox = this.getBBox();
74
+
75
+ this._border
76
+ .attr("x", bbox.x)
77
+ .attr("y", bbox.y)
78
+ .attr("width", bbox.width)
79
+ .attr("height", bbox.height)
80
+ .style("fill", this.border_colorFill())
81
+ .style("stroke", this.border_colorStroke())
82
+ ;
83
+
84
+ if (this.border_colorFill_exists() && !this.title_colorFill_exists()) {
85
+ this.title_colorFill(Palette.textColor(this.border_colorFill()));
86
+ }
87
+ this._textWidget
88
+ .pos({ x: bbox.x + 4, y: bbox.y + TITLE_SIZE })
89
+ .width(this.width() - 8)
90
+ .text(this.showTitle() ? this.title() : "")
91
+ .render()
92
+ ;
93
+
94
+ this._buttonMin
95
+ .visible(this.showMinMax())
96
+ .pos({ x: bbox.x + bbox.width - (MINMAX_SIZE / 2 + 4), y: bbox.y + (MINMAX_SIZE / 2 + 4) })
97
+ .faChar(this.calcIcon())
98
+ .render()
99
+ ;
100
+ }
101
+
102
+ exit(domNode, element) {
103
+ this._buttonMin.target(null);
104
+ this._textWidget.target(null);
105
+ this._border.remove();
106
+ super.exit(domNode, element);
107
+ }
108
+
109
+ intersection(pointA, pointB) {
110
+ const hits = [];
111
+ let nearest = null;
112
+ hits.forEach(function (item) {
113
+ if (nearest === null || nearest.d > item.d) {
114
+ nearest = item;
115
+ }
116
+ });
117
+ return nearest && nearest.i ? nearest.i : null;
118
+ }
119
+
120
+ click(d) {
121
+ }
122
+
123
+ minClick() {
124
+ switch (this._minState) {
125
+ case "normal":
126
+ this._minState = "partial";
127
+ break;
128
+ case "partial":
129
+ this._minState = "normal";
130
+ break;
131
+ }
132
+ this._buttonMin
133
+ .faChar(this.calcIcon()) // max:f2d0, restore: f2d2, min: f2d1
134
+ .render()
135
+ ;
136
+ }
137
+ }
138
+ Subgraph.prototype._class += " graph_Subgraph";
139
+
140
+ export interface Subgraph {
141
+ border_colorStroke(): string;
142
+ border_colorStroke(_: string): this;
143
+ border_colorFill(): string;
144
+ border_colorFill(_: string): this;
145
+ border_colorFill_exists: () => boolean;
146
+ showTitle(): boolean;
147
+ showTitle(_: boolean): this;
148
+ title(): string;
149
+ title(_: string): this;
150
+ titleFontSize(): string;
151
+ titleFontSize(_: string): this;
152
+ title_colorFill(): string;
153
+ title_colorFill(_: string): this;
154
+ title_colorFill_exists: () => boolean;
155
+ showMinMax(): boolean;
156
+ showMinMax(_: boolean): this;
157
+ }
158
+
159
+ Subgraph.prototype.publish("border_colorStroke", null, "html-color", "Stroke Color", null, { optional: true });
160
+ Subgraph.prototype.publish("border_colorFill", null, "html-color", "Fill Color", null, { optional: true });
161
+ Subgraph.prototype.publish("showTitle", true, "boolean", "Show Title", null, { tags: ["Basic"] });
162
+ Subgraph.prototype.publish("title", "", "string", "Title", null, { tags: ["Basic"] });
163
+ Subgraph.prototype.publishProxy("titleFontSize", "_textWidget", "fontSize");
164
+ Subgraph.prototype.publishProxy("title_colorFill", "_textWidget", "colorFill");
165
+ Subgraph.prototype.publish("showMinMax", false, "boolean", "Show Min/Max", null, { tags: ["Basic"] });
package/src/Vertex.css CHANGED
@@ -1,3 +1,3 @@
1
- .graph_Vertex.selected .common_Shape {
2
- stroke:red !important;
3
- }
1
+ .graph_Vertex.selected .common_Shape {
2
+ stroke:red !important;
3
+ }