@hpcc-js/common 2.65.0 → 2.66.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.
Files changed (93) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.es6.js +7098 -7070
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +7141 -7107
  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 +21 -38
  10. package/src/CanvasWidget.ts +31 -31
  11. package/src/Class.ts +67 -67
  12. package/src/Database.ts +856 -856
  13. package/src/Entity.ts +235 -235
  14. package/src/EntityCard.ts +66 -66
  15. package/src/EntityPin.ts +103 -103
  16. package/src/EntityRect.css +15 -15
  17. package/src/EntityRect.ts +236 -236
  18. package/src/EntityVertex.ts +86 -86
  19. package/src/FAChar.css +2 -2
  20. package/src/FAChar.ts +82 -82
  21. package/src/HTMLWidget.ts +191 -191
  22. package/src/IList.ts +4 -4
  23. package/src/IMenu.ts +5 -5
  24. package/src/Icon.css +9 -9
  25. package/src/Icon.ts +164 -164
  26. package/src/Image.ts +95 -95
  27. package/src/List.css +13 -13
  28. package/src/List.ts +99 -99
  29. package/src/Menu.css +23 -23
  30. package/src/Menu.ts +138 -138
  31. package/src/Palette.ts +341 -341
  32. package/src/Platform.ts +125 -125
  33. package/src/ProgressBar.ts +105 -105
  34. package/src/PropertyExt.ts +793 -793
  35. package/src/ResizeSurface.css +39 -39
  36. package/src/ResizeSurface.ts +221 -221
  37. package/src/SVGWidget.ts +567 -567
  38. package/src/SVGZoomWidget.css +12 -12
  39. package/src/SVGZoomWidget.ts +416 -416
  40. package/src/Shape.css +3 -3
  41. package/src/Shape.ts +186 -186
  42. package/src/Surface.css +35 -35
  43. package/src/Surface.ts +350 -350
  44. package/src/Text.css +4 -4
  45. package/src/Text.ts +131 -131
  46. package/src/TextBox.css +4 -4
  47. package/src/TextBox.ts +168 -168
  48. package/src/TitleBar.css +99 -99
  49. package/src/TitleBar.ts +401 -401
  50. package/src/Transition.ts +45 -45
  51. package/src/Utility.ts +820 -820
  52. package/src/Widget.css +8 -8
  53. package/src/Widget.ts +712 -712
  54. package/src/WidgetArray.ts +13 -13
  55. package/src/__package__.ts +2 -2
  56. package/src/index.ts +55 -55
  57. package/types/CanvasWidget.d.ts +8 -8
  58. package/types/Class.d.ts +12 -12
  59. package/types/Database.d.ts +136 -136
  60. package/types/Entity.d.ts +88 -88
  61. package/types/EntityCard.d.ts +13 -13
  62. package/types/EntityPin.d.ts +22 -22
  63. package/types/EntityRect.d.ts +45 -45
  64. package/types/EntityVertex.d.ts +30 -30
  65. package/types/FAChar.d.ts +29 -29
  66. package/types/HTMLWidget.d.ts +27 -27
  67. package/types/IList.d.ts +4 -4
  68. package/types/IMenu.d.ts +5 -5
  69. package/types/Icon.d.ts +62 -62
  70. package/types/Image.d.ts +33 -33
  71. package/types/List.d.ts +15 -15
  72. package/types/Menu.d.ts +28 -28
  73. package/types/Palette.d.ts +19 -19
  74. package/types/Platform.d.ts +5 -5
  75. package/types/ProgressBar.d.ts +21 -21
  76. package/types/PropertyExt.d.ts +114 -114
  77. package/types/ResizeSurface.d.ts +23 -23
  78. package/types/SVGWidget.d.ts +77 -77
  79. package/types/SVGZoomWidget.d.ts +68 -68
  80. package/types/Shape.d.ts +34 -34
  81. package/types/Surface.d.ts +69 -69
  82. package/types/Text.d.ts +37 -37
  83. package/types/TextBox.d.ts +76 -76
  84. package/types/TitleBar.d.ts +117 -117
  85. package/types/Transition.d.ts +11 -11
  86. package/types/Utility.d.ts +100 -100
  87. package/types/Utility.d.ts.map +1 -1
  88. package/types/Widget.d.ts +149 -149
  89. package/types/WidgetArray.d.ts +6 -6
  90. package/types/__package__.d.ts +3 -3
  91. package/types/index.d.ts +52 -52
  92. package/types-3.4/Utility.d.ts +1 -1
  93. package/types-3.4/__package__.d.ts +2 -2
package/src/List.ts CHANGED
@@ -1,99 +1,99 @@
1
- import { IList } from "./IList";
2
- import { SVGWidget } from "./SVGWidget";
3
- import { TextBox } from "./TextBox";
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
- anchor: { (): string; (_: string): List; };
96
- }
97
- List.prototype._class += " common_List";
98
-
99
- List.prototype.publish("anchor", "start", "set", "Anchor Position", ["", "start", "middle", "end"], { tags: ["Private"] });
1
+ import { IList } from "./IList";
2
+ import { SVGWidget } from "./SVGWidget";
3
+ import { TextBox } from "./TextBox";
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
+ anchor: { (): string; (_: string): List; };
96
+ }
97
+ List.prototype._class += " common_List";
98
+
99
+ 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,138 +1,138 @@
1
- import { event as d3Event, select as d3Select } from "d3-selection";
2
- import { Icon } from "./Icon";
3
- import { IMenu } from "./IMenu";
4
- import { List } from "./List";
5
- import { SVGWidget } from "./SVGWidget";
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
- console.log("click: body - " + context._id);
55
- if (context._open) {
56
- context.hideMenu();
57
- }
58
- })
59
- ;
60
- }
61
-
62
- hideMenu() {
63
- d3Select("body")
64
- .on("click." + this._id, null)
65
- ;
66
- this._open = false;
67
- this._list
68
- .data([])
69
- .render()
70
- ;
71
- this.postHideMenu();
72
- }
73
-
74
- enter(domNode, element) {
75
- super.enter(domNode, element);
76
-
77
- this._icon
78
- .target(domNode)
79
- .render()
80
- ;
81
-
82
- this._list
83
- .target(domNode)
84
- .render()
85
- ;
86
-
87
- const context = this;
88
- this._icon.element()
89
- .on("click", function () {
90
- d3Event.stopPropagation();
91
- context.toggleMenu();
92
- })
93
- ;
94
- }
95
-
96
- update(domNode, element) {
97
- super.update(domNode, element);
98
- element
99
- .classed("disabled", this.data().length === 0)
100
- ;
101
-
102
- this._icon
103
- .faChar(this.faChar())
104
- .paddingPercent(this.paddingPercent())
105
- .render()
106
- ;
107
- }
108
-
109
- exit(domNode, element) {
110
- this._icon
111
- .target(null)
112
- ;
113
-
114
- this._list
115
- .target(null)
116
- ;
117
-
118
- super.exit(domNode, element);
119
- }
120
-
121
- // Events ---
122
- click(d) {
123
- console.log("Click: " + d);
124
- }
125
- preShowMenu() {
126
- console.log("preShowMenu");
127
- }
128
- postHideMenu() {
129
- console.log("postHideMenu");
130
- }
131
-
132
- faChar: { (): string; (_: string): Menu; };
133
- paddingPercent: { (): number; (_: number): Menu; };
134
- }
135
- Menu.prototype._class += " common_Menu";
136
-
137
- Menu.prototype.publishProxy("faChar", "_icon", null, "\uf0c9");
138
- Menu.prototype.publishProxy("paddingPercent", "_icon", null, 10);
1
+ import { event as d3Event, select as d3Select } from "d3-selection";
2
+ import { Icon } from "./Icon";
3
+ import { IMenu } from "./IMenu";
4
+ import { List } from "./List";
5
+ import { SVGWidget } from "./SVGWidget";
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
+ console.log("click: body - " + context._id);
55
+ if (context._open) {
56
+ context.hideMenu();
57
+ }
58
+ })
59
+ ;
60
+ }
61
+
62
+ hideMenu() {
63
+ d3Select("body")
64
+ .on("click." + this._id, null)
65
+ ;
66
+ this._open = false;
67
+ this._list
68
+ .data([])
69
+ .render()
70
+ ;
71
+ this.postHideMenu();
72
+ }
73
+
74
+ enter(domNode, element) {
75
+ super.enter(domNode, element);
76
+
77
+ this._icon
78
+ .target(domNode)
79
+ .render()
80
+ ;
81
+
82
+ this._list
83
+ .target(domNode)
84
+ .render()
85
+ ;
86
+
87
+ const context = this;
88
+ this._icon.element()
89
+ .on("click", function () {
90
+ d3Event.stopPropagation();
91
+ context.toggleMenu();
92
+ })
93
+ ;
94
+ }
95
+
96
+ update(domNode, element) {
97
+ super.update(domNode, element);
98
+ element
99
+ .classed("disabled", this.data().length === 0)
100
+ ;
101
+
102
+ this._icon
103
+ .faChar(this.faChar())
104
+ .paddingPercent(this.paddingPercent())
105
+ .render()
106
+ ;
107
+ }
108
+
109
+ exit(domNode, element) {
110
+ this._icon
111
+ .target(null)
112
+ ;
113
+
114
+ this._list
115
+ .target(null)
116
+ ;
117
+
118
+ super.exit(domNode, element);
119
+ }
120
+
121
+ // Events ---
122
+ click(d) {
123
+ console.log("Click: " + d);
124
+ }
125
+ preShowMenu() {
126
+ console.log("preShowMenu");
127
+ }
128
+ postHideMenu() {
129
+ console.log("postHideMenu");
130
+ }
131
+
132
+ faChar: { (): string; (_: string): Menu; };
133
+ paddingPercent: { (): number; (_: number): Menu; };
134
+ }
135
+ Menu.prototype._class += " common_Menu";
136
+
137
+ Menu.prototype.publishProxy("faChar", "_icon", null, "\uf0c9");
138
+ Menu.prototype.publishProxy("paddingPercent", "_icon", null, 10);