@hpcc-js/common 3.6.5 → 3.7.0

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 (54) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.js +4 -4
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.cjs +1 -1
  6. package/dist/index.umd.cjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/CanvasWidget.ts +31 -31
  9. package/src/Class.ts +72 -72
  10. package/src/Database.ts +860 -860
  11. package/src/Entity.ts +235 -235
  12. package/src/EntityCard.ts +66 -66
  13. package/src/EntityPin.ts +103 -103
  14. package/src/EntityRect.css +15 -15
  15. package/src/EntityRect.ts +254 -254
  16. package/src/EntityVertex.ts +86 -86
  17. package/src/FAChar.css +2 -2
  18. package/src/FAChar.ts +89 -89
  19. package/src/HTMLWidget.ts +191 -191
  20. package/src/IList.ts +4 -4
  21. package/src/IMenu.ts +5 -5
  22. package/src/Icon.css +9 -9
  23. package/src/Icon.ts +176 -176
  24. package/src/Image.ts +104 -104
  25. package/src/List.css +13 -13
  26. package/src/List.ts +102 -102
  27. package/src/Menu.css +23 -23
  28. package/src/Menu.ts +139 -139
  29. package/src/Palette.ts +341 -341
  30. package/src/Platform.ts +125 -125
  31. package/src/ProgressBar.ts +115 -115
  32. package/src/PropertyExt.ts +770 -770
  33. package/src/ResizeSurface.css +39 -39
  34. package/src/ResizeSurface.ts +225 -225
  35. package/src/SVGWidget.ts +583 -583
  36. package/src/SVGZoomWidget.css +12 -12
  37. package/src/SVGZoomWidget.ts +427 -427
  38. package/src/Shape.css +3 -3
  39. package/src/Shape.ts +186 -186
  40. package/src/Surface.css +35 -35
  41. package/src/Surface.ts +364 -364
  42. package/src/Text.css +4 -4
  43. package/src/Text.ts +131 -131
  44. package/src/TextBox.css +4 -4
  45. package/src/TextBox.ts +183 -183
  46. package/src/TitleBar.css +114 -114
  47. package/src/TitleBar.ts +407 -407
  48. package/src/Transition.ts +45 -45
  49. package/src/Utility.ts +843 -839
  50. package/src/Widget.css +8 -8
  51. package/src/Widget.ts +731 -731
  52. package/src/WidgetArray.ts +15 -15
  53. package/src/__package__.ts +3 -3
  54. package/src/index.ts +55 -55
package/src/List.ts CHANGED
@@ -1,102 +1,102 @@
1
- import { IList } from "./IList.ts";
2
- import { SVGWidget } from "./SVGWidget.ts";
3
- import { TextBox } from "./TextBox.ts";
4
-
5
- import "../src/List.css";
6
-
7
- export class List extends SVGWidget implements IList {
8
-
9
- protected _listWidgets;
10
-
11
- constructor() {
12
- super();
13
-
14
- this._listWidgets = {};
15
- }
16
-
17
- update(domNode, element) {
18
- super.update(domNode, element);
19
- const context = this;
20
-
21
- const line = element.selectAll(".line").data(this.data(), function (d) { return d; });
22
- const lineEnter = line.enter().append("g")
23
- .attr("class", "line")
24
- .each(function (d) {
25
- const newTextBox = new TextBox()
26
- .target(this)
27
- .paddingTop(0)
28
- .paddingBottom(0)
29
- .paddingLeft(8)
30
- .paddingRight(8)
31
- .text(d)
32
- .render()
33
- ;
34
- newTextBox.element()
35
- .on("click", function (d2) {
36
- context.click(d2.text());
37
- })
38
- .on("dblclick", function (d2) {
39
- context.dblclick(d2.text());
40
- })
41
- ;
42
- context._listWidgets[d] = newTextBox;
43
- })
44
- ;
45
-
46
- let listHeight = 0;
47
- let listWidth = 0;
48
- for (const key in this._listWidgets) {
49
- if (!this._listWidgets.hasOwnProperty(key)) continue;
50
- const bbox = this._listWidgets[key].getBBox();
51
- listHeight += bbox.height;
52
- if (listWidth < bbox.width)
53
- listWidth = bbox.width;
54
- }
55
-
56
- let yPos = -listHeight / 2; // + lineHeight / 2;
57
- lineEnter.merge(line).each(function (d) {
58
- const widget = context._listWidgets[d];
59
- const bbox = widget.getBBox();
60
- widget
61
- .pos({ x: 0, y: yPos + bbox.height / 2 })
62
- .anchor(context.anchor())
63
- .fixedSize({ width: listWidth, height: bbox.height })
64
- .render()
65
- ;
66
- yPos += bbox.height;
67
- });
68
- line.exit()
69
- .remove()
70
- .each(function (d) {
71
- context._listWidgets[d].target(null);
72
- delete context._listWidgets[d];
73
- })
74
- ;
75
- }
76
-
77
- exit(domNode, element) {
78
- for (const key in this._listWidgets) {
79
- if (this._listWidgets.hasOwnProperty(key)) {
80
- this._listWidgets[key].target(null);
81
- }
82
- }
83
- super.exit(domNode, element);
84
- }
85
-
86
- // Events ---
87
- click(d) {
88
- // console.log("Click: " + d);
89
- }
90
-
91
- dblclick(d) {
92
- // console.log("Double click: " + d);
93
- }
94
- }
95
- List.prototype._class += " common_List";
96
-
97
- export interface List {
98
- anchor(): "" | "start" | "middle" | "end";
99
- anchor(_: "" | "start" | "middle" | "end"): this;
100
- }
101
-
102
- List.prototype.publish("anchor", "start", "set", "Anchor Position", ["", "start", "middle", "end"], { tags: ["Private"] });
1
+ import { IList } from "./IList.ts";
2
+ import { SVGWidget } from "./SVGWidget.ts";
3
+ import { TextBox } from "./TextBox.ts";
4
+
5
+ import "../src/List.css";
6
+
7
+ export class List extends SVGWidget implements IList {
8
+
9
+ protected _listWidgets;
10
+
11
+ constructor() {
12
+ super();
13
+
14
+ this._listWidgets = {};
15
+ }
16
+
17
+ update(domNode, element) {
18
+ super.update(domNode, element);
19
+ const context = this;
20
+
21
+ const line = element.selectAll(".line").data(this.data(), function (d) { return d; });
22
+ const lineEnter = line.enter().append("g")
23
+ .attr("class", "line")
24
+ .each(function (d) {
25
+ const newTextBox = new TextBox()
26
+ .target(this)
27
+ .paddingTop(0)
28
+ .paddingBottom(0)
29
+ .paddingLeft(8)
30
+ .paddingRight(8)
31
+ .text(d)
32
+ .render()
33
+ ;
34
+ newTextBox.element()
35
+ .on("click", function (d2) {
36
+ context.click(d2.text());
37
+ })
38
+ .on("dblclick", function (d2) {
39
+ context.dblclick(d2.text());
40
+ })
41
+ ;
42
+ context._listWidgets[d] = newTextBox;
43
+ })
44
+ ;
45
+
46
+ let listHeight = 0;
47
+ let listWidth = 0;
48
+ for (const key in this._listWidgets) {
49
+ if (!this._listWidgets.hasOwnProperty(key)) continue;
50
+ const bbox = this._listWidgets[key].getBBox();
51
+ listHeight += bbox.height;
52
+ if (listWidth < bbox.width)
53
+ listWidth = bbox.width;
54
+ }
55
+
56
+ let yPos = -listHeight / 2; // + lineHeight / 2;
57
+ lineEnter.merge(line).each(function (d) {
58
+ const widget = context._listWidgets[d];
59
+ const bbox = widget.getBBox();
60
+ widget
61
+ .pos({ x: 0, y: yPos + bbox.height / 2 })
62
+ .anchor(context.anchor())
63
+ .fixedSize({ width: listWidth, height: bbox.height })
64
+ .render()
65
+ ;
66
+ yPos += bbox.height;
67
+ });
68
+ line.exit()
69
+ .remove()
70
+ .each(function (d) {
71
+ context._listWidgets[d].target(null);
72
+ delete context._listWidgets[d];
73
+ })
74
+ ;
75
+ }
76
+
77
+ exit(domNode, element) {
78
+ for (const key in this._listWidgets) {
79
+ if (this._listWidgets.hasOwnProperty(key)) {
80
+ this._listWidgets[key].target(null);
81
+ }
82
+ }
83
+ super.exit(domNode, element);
84
+ }
85
+
86
+ // Events ---
87
+ click(d) {
88
+ // console.log("Click: " + d);
89
+ }
90
+
91
+ dblclick(d) {
92
+ // console.log("Double click: " + d);
93
+ }
94
+ }
95
+ List.prototype._class += " common_List";
96
+
97
+ export interface List {
98
+ anchor(): "" | "start" | "middle" | "end";
99
+ anchor(_: "" | "start" | "middle" | "end"): this;
100
+ }
101
+
102
+ List.prototype.publish("anchor", "start", "set", "Anchor Position", ["", "start", "middle", "end"], { tags: ["Private"] });
package/src/Menu.css CHANGED
@@ -1,23 +1,23 @@
1
- .common_Menu .common_FAChar {
2
- fill: white;
3
- cursor: pointer;
4
- }
5
-
6
- .common_Menu.disabled .common_FAChar {
7
- visibility: hidden;
8
- cursor: inherit;
9
- }
10
-
11
- .common_Menu .common_List .common_TextBox .common_Shape {
12
- fill: #1f77b4;
13
- stroke: #1f77b4;
14
- }
15
-
16
- .common_Menu .common_List .common_TextBox .common_Text {
17
- fill: white;
18
- }
19
-
20
- .common_Menu .common_List .common_TextBox .common_Shape:hover {
21
- fill: #ff7f0e;
22
- stroke: #ff7f0e;
23
- }
1
+ .common_Menu .common_FAChar {
2
+ fill: white;
3
+ cursor: pointer;
4
+ }
5
+
6
+ .common_Menu.disabled .common_FAChar {
7
+ visibility: hidden;
8
+ cursor: inherit;
9
+ }
10
+
11
+ .common_Menu .common_List .common_TextBox .common_Shape {
12
+ fill: #1f77b4;
13
+ stroke: #1f77b4;
14
+ }
15
+
16
+ .common_Menu .common_List .common_TextBox .common_Text {
17
+ fill: white;
18
+ }
19
+
20
+ .common_Menu .common_List .common_TextBox .common_Shape:hover {
21
+ fill: #ff7f0e;
22
+ stroke: #ff7f0e;
23
+ }
package/src/Menu.ts CHANGED
@@ -1,139 +1,139 @@
1
- import { event as d3Event, select as d3Select } from "d3-selection";
2
- import { Icon } from "./Icon.ts";
3
- import { IMenu } from "./IMenu.ts";
4
- import { List } from "./List.ts";
5
- import { SVGWidget } from "./SVGWidget.ts";
6
-
7
- import "../src/Menu.css";
8
-
9
- export class Menu extends SVGWidget implements IMenu {
10
- protected _icon = new Icon().shape("square").diameter(14).paddingPercent(0);
11
- protected _list = new List();
12
- protected _open;
13
-
14
- constructor() {
15
- super();
16
-
17
- const context = this;
18
- this._list.click = function (d) {
19
- d3Event.stopPropagation();
20
- context.hideMenu();
21
- context.click(d);
22
- };
23
- this._open = false;
24
- }
25
-
26
- toggleMenu() {
27
- if (!this._open) {
28
- this.showMenu();
29
- } else {
30
- this.hideMenu();
31
- }
32
- }
33
-
34
- showMenu() {
35
- this.preShowMenu();
36
- this._open = true;
37
- this._list
38
- .data(this.data())
39
- .render()
40
- ;
41
-
42
- const bbox = this._icon.getBBox(true);
43
- const menuBBox = this._list.getBBox(true);
44
- const pos = {
45
- x: bbox.width / 2 - menuBBox.width / 2,
46
- y: bbox.height / 2 + menuBBox.height / 2
47
- };
48
- this._list
49
- .move(pos)
50
- ;
51
- const context = this;
52
- d3Select("body")
53
- .on("click." + this._id, function () {
54
- if (context._open) {
55
- context.hideMenu();
56
- }
57
- })
58
- ;
59
- }
60
-
61
- hideMenu() {
62
- d3Select("body")
63
- .on("click." + this._id, null)
64
- ;
65
- this._open = false;
66
- this._list
67
- .data([])
68
- .render()
69
- ;
70
- this.postHideMenu();
71
- }
72
-
73
- enter(domNode, element) {
74
- super.enter(domNode, element);
75
-
76
- this._icon
77
- .target(domNode)
78
- .render()
79
- ;
80
-
81
- this._list
82
- .target(domNode)
83
- .render()
84
- ;
85
-
86
- const context = this;
87
- this._icon.element()
88
- .on("click", function () {
89
- d3Event.stopPropagation();
90
- context.toggleMenu();
91
- })
92
- ;
93
- }
94
-
95
- update(domNode, element) {
96
- super.update(domNode, element);
97
- element
98
- .classed("disabled", this.data().length === 0)
99
- ;
100
-
101
- this._icon
102
- .faChar(this.faChar())
103
- .paddingPercent(this.paddingPercent())
104
- .render()
105
- ;
106
- }
107
-
108
- exit(domNode, element) {
109
- this._icon
110
- .target(null)
111
- ;
112
-
113
- this._list
114
- .target(null)
115
- ;
116
-
117
- super.exit(domNode, element);
118
- }
119
-
120
- // Events ---
121
- click(d) {
122
- }
123
- preShowMenu() {
124
- }
125
- postHideMenu() {
126
- }
127
-
128
- }
129
- Menu.prototype._class += " common_Menu";
130
-
131
- export interface Menu {
132
- faChar(): string;
133
- faChar(_: string): this;
134
- paddingPercent(): number;
135
- paddingPercent(_: number): this;
136
- }
137
-
138
- Menu.prototype.publishProxy("faChar", "_icon", null, "\uf0c9");
139
- Menu.prototype.publishProxy("paddingPercent", "_icon", null, 10);
1
+ import { event as d3Event, select as d3Select } from "d3-selection";
2
+ import { Icon } from "./Icon.ts";
3
+ import { IMenu } from "./IMenu.ts";
4
+ import { List } from "./List.ts";
5
+ import { SVGWidget } from "./SVGWidget.ts";
6
+
7
+ import "../src/Menu.css";
8
+
9
+ export class Menu extends SVGWidget implements IMenu {
10
+ protected _icon = new Icon().shape("square").diameter(14).paddingPercent(0);
11
+ protected _list = new List();
12
+ protected _open;
13
+
14
+ constructor() {
15
+ super();
16
+
17
+ const context = this;
18
+ this._list.click = function (d) {
19
+ d3Event.stopPropagation();
20
+ context.hideMenu();
21
+ context.click(d);
22
+ };
23
+ this._open = false;
24
+ }
25
+
26
+ toggleMenu() {
27
+ if (!this._open) {
28
+ this.showMenu();
29
+ } else {
30
+ this.hideMenu();
31
+ }
32
+ }
33
+
34
+ showMenu() {
35
+ this.preShowMenu();
36
+ this._open = true;
37
+ this._list
38
+ .data(this.data())
39
+ .render()
40
+ ;
41
+
42
+ const bbox = this._icon.getBBox(true);
43
+ const menuBBox = this._list.getBBox(true);
44
+ const pos = {
45
+ x: bbox.width / 2 - menuBBox.width / 2,
46
+ y: bbox.height / 2 + menuBBox.height / 2
47
+ };
48
+ this._list
49
+ .move(pos)
50
+ ;
51
+ const context = this;
52
+ d3Select("body")
53
+ .on("click." + this._id, function () {
54
+ if (context._open) {
55
+ context.hideMenu();
56
+ }
57
+ })
58
+ ;
59
+ }
60
+
61
+ hideMenu() {
62
+ d3Select("body")
63
+ .on("click." + this._id, null)
64
+ ;
65
+ this._open = false;
66
+ this._list
67
+ .data([])
68
+ .render()
69
+ ;
70
+ this.postHideMenu();
71
+ }
72
+
73
+ enter(domNode, element) {
74
+ super.enter(domNode, element);
75
+
76
+ this._icon
77
+ .target(domNode)
78
+ .render()
79
+ ;
80
+
81
+ this._list
82
+ .target(domNode)
83
+ .render()
84
+ ;
85
+
86
+ const context = this;
87
+ this._icon.element()
88
+ .on("click", function () {
89
+ d3Event.stopPropagation();
90
+ context.toggleMenu();
91
+ })
92
+ ;
93
+ }
94
+
95
+ update(domNode, element) {
96
+ super.update(domNode, element);
97
+ element
98
+ .classed("disabled", this.data().length === 0)
99
+ ;
100
+
101
+ this._icon
102
+ .faChar(this.faChar())
103
+ .paddingPercent(this.paddingPercent())
104
+ .render()
105
+ ;
106
+ }
107
+
108
+ exit(domNode, element) {
109
+ this._icon
110
+ .target(null)
111
+ ;
112
+
113
+ this._list
114
+ .target(null)
115
+ ;
116
+
117
+ super.exit(domNode, element);
118
+ }
119
+
120
+ // Events ---
121
+ click(d) {
122
+ }
123
+ preShowMenu() {
124
+ }
125
+ postHideMenu() {
126
+ }
127
+
128
+ }
129
+ Menu.prototype._class += " common_Menu";
130
+
131
+ export interface Menu {
132
+ faChar(): string;
133
+ faChar(_: string): this;
134
+ paddingPercent(): number;
135
+ paddingPercent(_: number): this;
136
+ }
137
+
138
+ Menu.prototype.publishProxy("faChar", "_icon", null, "\uf0c9");
139
+ Menu.prototype.publishProxy("paddingPercent", "_icon", null, 10);