@hpcc-js/common 2.73.2 → 2.73.3

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 (55) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.es6.js +28 -28
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +30 -30
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/package.json +3 -3
  9. package/src/CanvasWidget.ts +31 -31
  10. package/src/Class.ts +67 -67
  11. package/src/Database.ts +856 -856
  12. package/src/Entity.ts +235 -235
  13. package/src/EntityCard.ts +66 -66
  14. package/src/EntityPin.ts +103 -103
  15. package/src/EntityRect.css +15 -15
  16. package/src/EntityRect.ts +236 -236
  17. package/src/EntityVertex.ts +86 -86
  18. package/src/FAChar.css +2 -2
  19. package/src/FAChar.ts +82 -82
  20. package/src/HTMLWidget.ts +191 -191
  21. package/src/IList.ts +4 -4
  22. package/src/IMenu.ts +5 -5
  23. package/src/Icon.css +9 -9
  24. package/src/Icon.ts +164 -164
  25. package/src/Image.ts +95 -95
  26. package/src/List.css +13 -13
  27. package/src/List.ts +99 -99
  28. package/src/Menu.css +23 -23
  29. package/src/Menu.ts +134 -134
  30. package/src/Palette.ts +341 -341
  31. package/src/Platform.ts +125 -125
  32. package/src/ProgressBar.ts +105 -105
  33. package/src/PropertyExt.ts +793 -793
  34. package/src/ResizeSurface.css +39 -39
  35. package/src/ResizeSurface.ts +221 -221
  36. package/src/SVGWidget.ts +567 -567
  37. package/src/SVGZoomWidget.css +12 -12
  38. package/src/SVGZoomWidget.ts +426 -426
  39. package/src/Shape.css +3 -3
  40. package/src/Shape.ts +186 -186
  41. package/src/Surface.css +35 -35
  42. package/src/Surface.ts +349 -349
  43. package/src/Text.css +4 -4
  44. package/src/Text.ts +131 -131
  45. package/src/TextBox.css +4 -4
  46. package/src/TextBox.ts +168 -168
  47. package/src/TitleBar.css +99 -99
  48. package/src/TitleBar.ts +401 -401
  49. package/src/Transition.ts +45 -45
  50. package/src/Utility.ts +839 -839
  51. package/src/Widget.css +8 -8
  52. package/src/Widget.ts +730 -730
  53. package/src/WidgetArray.ts +13 -13
  54. package/src/__package__.ts +3 -3
  55. package/src/index.ts +55 -55
package/src/Shape.css CHANGED
@@ -1,4 +1,4 @@
1
- .common_Shape {
2
- fill: #1f77b4;
3
- stroke: #1f77b4;
1
+ .common_Shape {
2
+ fill: #1f77b4;
3
+ stroke: #1f77b4;
4
4
  }
package/src/Shape.ts CHANGED
@@ -1,186 +1,186 @@
1
- import { select as d3Select } from "d3-selection";
2
- import { SVGWidget } from "./SVGWidget";
3
-
4
- import "../src/Shape.css";
5
-
6
- export class Shape extends SVGWidget {
7
- protected _tooltipElement;
8
-
9
- constructor() {
10
- super();
11
- }
12
-
13
- contains(point) {
14
- switch (this.shape()) {
15
- case "circle":
16
- return this.containsCircle(this.radius(), point);
17
- }
18
- return SVGWidget.prototype.intersection.apply(this, arguments);
19
- }
20
-
21
- intersection(pointA, pointB) {
22
- switch (this.shape()) {
23
- case "circle":
24
- return this.intersectCircle(this.radius(), pointA, pointB);
25
- }
26
- return SVGWidget.prototype.intersection.apply(this, arguments);
27
- }
28
-
29
- enter(domNode, element) {
30
- super.enter(domNode, element);
31
- delete this._prevHash;
32
- }
33
-
34
- _prevHash;
35
- update(_domNode, element) {
36
- const shape = element.selectAll("rect,circle,ellipse,path").data([this.shape()], function (d) { return d; });
37
- const hash = this.hashSum();
38
- if (this._prevHash !== hash) {
39
- this._prevHash = hash;
40
-
41
- const context = this;
42
- shape.enter().append(this.getShapeElementTag(this.shape()))
43
- .attr("class", "common_Shape")
44
- .each(function () {
45
- const element2 = d3Select(this);
46
- context._tooltipElement = element2.append("title");
47
- })
48
- .on("click", () => {
49
- this.click();
50
- })
51
- .on("dblclick", () => {
52
- this.dblclick();
53
- })
54
- .merge(shape)
55
- .style("fill", this.colorFill())
56
- .style("stroke", this.colorStroke())
57
- .each(function () {
58
- const element2 = d3Select(this);
59
- context._tooltipElement.text(context.tooltip());
60
- switch (context.shape()) {
61
- case "circle":
62
- const radius = context.radius();
63
- element2
64
- .attr("r", radius)
65
- ;
66
- break;
67
- case "square":
68
- const width = Math.max(context.width(), context.height());
69
- element2
70
- .attr("x", -width / 2)
71
- .attr("y", -width / 2)
72
- .attr("rx", context.cornerRadius())
73
- .attr("ry", context.cornerRadius())
74
- .attr("width", width)
75
- .attr("height", width)
76
- ;
77
- break;
78
- case "rect":
79
- element2
80
- .attr("x", -context.width() / 2)
81
- .attr("y", -context.height() / 2)
82
- .attr("rx", context.cornerRadius())
83
- .attr("ry", context.cornerRadius())
84
- .attr("width", context.width())
85
- .attr("height", context.height())
86
- ;
87
- break;
88
- case "ellipse":
89
- element2
90
- .attr("rx", context.width() / 2)
91
- .attr("ry", context.height() / 2)
92
- ;
93
- break;
94
- case "pin":
95
- element2
96
- .attr("d", context.pinPath())
97
- ;
98
- break;
99
- }
100
- })
101
- ;
102
- shape.exit().remove();
103
- }
104
- }
105
- getShapeElementTag(_shape) {
106
- switch (_shape) {
107
- case "square":
108
- return "rect";
109
- case "pin":
110
- return "path";
111
- }
112
- return _shape;
113
- }
114
- pinPath() {
115
- const radius = this.cornerRadius();
116
- const arrow_h = this.arrowHeight();
117
- const arrow_w = this.arrowWidth();
118
- const width = this.width();
119
- const height = this.height() - arrow_h;
120
- const x = 0 - width / 2;
121
- const y = 0 - height;
122
- const arrow_b = (width - radius * 2 - arrow_w) / 2;
123
- return "M" + x + "," + y +
124
- "a" + -radius + "," + -radius + " 0 0 1 " + radius + "," + -radius +
125
- "h" + (width + -radius * 2) +
126
- "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius +
127
- "v" + (height + -radius * 2) +
128
- "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius +
129
- "h" + -arrow_b +
130
- "l" + -arrow_w / 2 + "," + arrow_h +
131
- "l" + -arrow_w / 2 + "," + -arrow_h +
132
- "h" + -arrow_b +
133
- "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius +
134
- "z";
135
- }
136
-
137
- click() {
138
- }
139
-
140
- dblclick() {
141
- }
142
-
143
- }
144
- Shape.prototype._class += " common_Shape";
145
-
146
- export interface Shape {
147
- shape(): string;
148
- shape(_: string): this;
149
- colorStroke(): string;
150
- colorStroke(_: string): this;
151
- colorFill(): string;
152
- colorFill(_: string): this;
153
- colorFill_exists(): boolean;
154
- radius(): number;
155
- radius(_: number): this;
156
- cornerRadius(): number;
157
- cornerRadius(_: number): this;
158
- arrowHeight(): number;
159
- arrowHeight(_: number): this;
160
- arrowWidth(): number;
161
- arrowWidth(_: number): this;
162
- tooltip(): string;
163
- tooltip(_: string): this;
164
- }
165
-
166
- Shape.prototype.publish("shape", "circle", "set", "Shape Type", ["circle", "square", "rect", "ellipse", "pin"], { tags: ["Private"] });
167
- Shape.prototype.publish("width", 24, "number", "Width", null, { tags: ["Private"] });
168
- Shape.prototype.publish("height", 24, "number", "Height", null, { tags: ["Private"] });
169
- Shape.prototype.publish("colorStroke", null, "html-color", "Stroke Color", null, { optional: true });
170
- Shape.prototype.publish("colorFill", null, "html-color", "Fill Color", null, { optional: true });
171
- Shape.prototype.publish("radius", null, "number", "Radius", null, { tags: ["Private"] });
172
- Shape.prototype.publish("cornerRadius", 3, "number", "cornerRadius");
173
- Shape.prototype.publish("arrowHeight", 5, "number", "arrowHeight");
174
- Shape.prototype.publish("arrowWidth", 10, "number", "arrowWidth");
175
- Shape.prototype.publish("tooltip", "", "string", "Tooltip", null, { tags: ["Private"] });
176
-
177
- const _origRadius = Shape.prototype.radius;
178
- Shape.prototype.radius = function (_?) {
179
- const retVal = _origRadius.apply(this, arguments);
180
- if (arguments.length) {
181
- this.width(_);
182
- this.height(_);
183
- return retVal;
184
- }
185
- return Math.max(this.width(), this.height()) / 2;
186
- };
1
+ import { select as d3Select } from "d3-selection";
2
+ import { SVGWidget } from "./SVGWidget";
3
+
4
+ import "../src/Shape.css";
5
+
6
+ export class Shape extends SVGWidget {
7
+ protected _tooltipElement;
8
+
9
+ constructor() {
10
+ super();
11
+ }
12
+
13
+ contains(point) {
14
+ switch (this.shape()) {
15
+ case "circle":
16
+ return this.containsCircle(this.radius(), point);
17
+ }
18
+ return SVGWidget.prototype.intersection.apply(this, arguments);
19
+ }
20
+
21
+ intersection(pointA, pointB) {
22
+ switch (this.shape()) {
23
+ case "circle":
24
+ return this.intersectCircle(this.radius(), pointA, pointB);
25
+ }
26
+ return SVGWidget.prototype.intersection.apply(this, arguments);
27
+ }
28
+
29
+ enter(domNode, element) {
30
+ super.enter(domNode, element);
31
+ delete this._prevHash;
32
+ }
33
+
34
+ _prevHash;
35
+ update(_domNode, element) {
36
+ const shape = element.selectAll("rect,circle,ellipse,path").data([this.shape()], function (d) { return d; });
37
+ const hash = this.hashSum();
38
+ if (this._prevHash !== hash) {
39
+ this._prevHash = hash;
40
+
41
+ const context = this;
42
+ shape.enter().append(this.getShapeElementTag(this.shape()))
43
+ .attr("class", "common_Shape")
44
+ .each(function () {
45
+ const element2 = d3Select(this);
46
+ context._tooltipElement = element2.append("title");
47
+ })
48
+ .on("click", () => {
49
+ this.click();
50
+ })
51
+ .on("dblclick", () => {
52
+ this.dblclick();
53
+ })
54
+ .merge(shape)
55
+ .style("fill", this.colorFill())
56
+ .style("stroke", this.colorStroke())
57
+ .each(function () {
58
+ const element2 = d3Select(this);
59
+ context._tooltipElement.text(context.tooltip());
60
+ switch (context.shape()) {
61
+ case "circle":
62
+ const radius = context.radius();
63
+ element2
64
+ .attr("r", radius)
65
+ ;
66
+ break;
67
+ case "square":
68
+ const width = Math.max(context.width(), context.height());
69
+ element2
70
+ .attr("x", -width / 2)
71
+ .attr("y", -width / 2)
72
+ .attr("rx", context.cornerRadius())
73
+ .attr("ry", context.cornerRadius())
74
+ .attr("width", width)
75
+ .attr("height", width)
76
+ ;
77
+ break;
78
+ case "rect":
79
+ element2
80
+ .attr("x", -context.width() / 2)
81
+ .attr("y", -context.height() / 2)
82
+ .attr("rx", context.cornerRadius())
83
+ .attr("ry", context.cornerRadius())
84
+ .attr("width", context.width())
85
+ .attr("height", context.height())
86
+ ;
87
+ break;
88
+ case "ellipse":
89
+ element2
90
+ .attr("rx", context.width() / 2)
91
+ .attr("ry", context.height() / 2)
92
+ ;
93
+ break;
94
+ case "pin":
95
+ element2
96
+ .attr("d", context.pinPath())
97
+ ;
98
+ break;
99
+ }
100
+ })
101
+ ;
102
+ shape.exit().remove();
103
+ }
104
+ }
105
+ getShapeElementTag(_shape) {
106
+ switch (_shape) {
107
+ case "square":
108
+ return "rect";
109
+ case "pin":
110
+ return "path";
111
+ }
112
+ return _shape;
113
+ }
114
+ pinPath() {
115
+ const radius = this.cornerRadius();
116
+ const arrow_h = this.arrowHeight();
117
+ const arrow_w = this.arrowWidth();
118
+ const width = this.width();
119
+ const height = this.height() - arrow_h;
120
+ const x = 0 - width / 2;
121
+ const y = 0 - height;
122
+ const arrow_b = (width - radius * 2 - arrow_w) / 2;
123
+ return "M" + x + "," + y +
124
+ "a" + -radius + "," + -radius + " 0 0 1 " + radius + "," + -radius +
125
+ "h" + (width + -radius * 2) +
126
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius +
127
+ "v" + (height + -radius * 2) +
128
+ "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius +
129
+ "h" + -arrow_b +
130
+ "l" + -arrow_w / 2 + "," + arrow_h +
131
+ "l" + -arrow_w / 2 + "," + -arrow_h +
132
+ "h" + -arrow_b +
133
+ "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius +
134
+ "z";
135
+ }
136
+
137
+ click() {
138
+ }
139
+
140
+ dblclick() {
141
+ }
142
+
143
+ }
144
+ Shape.prototype._class += " common_Shape";
145
+
146
+ export interface Shape {
147
+ shape(): string;
148
+ shape(_: string): this;
149
+ colorStroke(): string;
150
+ colorStroke(_: string): this;
151
+ colorFill(): string;
152
+ colorFill(_: string): this;
153
+ colorFill_exists(): boolean;
154
+ radius(): number;
155
+ radius(_: number): this;
156
+ cornerRadius(): number;
157
+ cornerRadius(_: number): this;
158
+ arrowHeight(): number;
159
+ arrowHeight(_: number): this;
160
+ arrowWidth(): number;
161
+ arrowWidth(_: number): this;
162
+ tooltip(): string;
163
+ tooltip(_: string): this;
164
+ }
165
+
166
+ Shape.prototype.publish("shape", "circle", "set", "Shape Type", ["circle", "square", "rect", "ellipse", "pin"], { tags: ["Private"] });
167
+ Shape.prototype.publish("width", 24, "number", "Width", null, { tags: ["Private"] });
168
+ Shape.prototype.publish("height", 24, "number", "Height", null, { tags: ["Private"] });
169
+ Shape.prototype.publish("colorStroke", null, "html-color", "Stroke Color", null, { optional: true });
170
+ Shape.prototype.publish("colorFill", null, "html-color", "Fill Color", null, { optional: true });
171
+ Shape.prototype.publish("radius", null, "number", "Radius", null, { tags: ["Private"] });
172
+ Shape.prototype.publish("cornerRadius", 3, "number", "cornerRadius");
173
+ Shape.prototype.publish("arrowHeight", 5, "number", "arrowHeight");
174
+ Shape.prototype.publish("arrowWidth", 10, "number", "arrowWidth");
175
+ Shape.prototype.publish("tooltip", "", "string", "Tooltip", null, { tags: ["Private"] });
176
+
177
+ const _origRadius = Shape.prototype.radius;
178
+ Shape.prototype.radius = function (_?) {
179
+ const retVal = _origRadius.apply(this, arguments);
180
+ if (arguments.length) {
181
+ this.width(_);
182
+ this.height(_);
183
+ return retVal;
184
+ }
185
+ return Math.max(this.width(), this.height()) / 2;
186
+ };
package/src/Surface.css CHANGED
@@ -1,35 +1,35 @@
1
- .common_Surface .container .common_Shape {
2
- fill: #f9fcff;
3
- stroke: #1f77b4;
4
- stroke-width: 1.0px;
5
- }
6
-
7
- .common_Surface .title {
8
- cursor: move;
9
- }
10
-
11
- .common_Surface .title .common_Shape {
12
- fill: #1f77b4;
13
- stroke: #1f77b4;
14
- stroke-width: 1.0px;
15
- }
16
-
17
- .common_Surface .title text {
18
- fill: white;
19
- stroke: none;
20
- }
21
-
22
- .svg-button-container {
23
- position: fixed;
24
- }
25
-
26
- .svg-button-container .surface-button {
27
- position: relative;
28
- background: transparent;
29
- border: none;
30
- opacity: 0.8;
31
- color: #fff;
32
- }
33
-
34
- .svg-button-container .surface-button:hover { opacity: 1; }
35
- .svg-button-container .surface-button:active { opacity: 0.5; }
1
+ .common_Surface .container .common_Shape {
2
+ fill: #f9fcff;
3
+ stroke: #1f77b4;
4
+ stroke-width: 1.0px;
5
+ }
6
+
7
+ .common_Surface .title {
8
+ cursor: move;
9
+ }
10
+
11
+ .common_Surface .title .common_Shape {
12
+ fill: #1f77b4;
13
+ stroke: #1f77b4;
14
+ stroke-width: 1.0px;
15
+ }
16
+
17
+ .common_Surface .title text {
18
+ fill: white;
19
+ stroke: none;
20
+ }
21
+
22
+ .svg-button-container {
23
+ position: fixed;
24
+ }
25
+
26
+ .svg-button-container .surface-button {
27
+ position: relative;
28
+ background: transparent;
29
+ border: none;
30
+ opacity: 0.8;
31
+ color: #fff;
32
+ }
33
+
34
+ .svg-button-container .surface-button:hover { opacity: 1; }
35
+ .svg-button-container .surface-button:active { opacity: 0.5; }