@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/Icon.ts CHANGED
@@ -1,164 +1,164 @@
1
- import { FAChar } from "./FAChar";
2
- import { textColor } from "./Palette";
3
- import { Shape } from "./Shape";
4
- import { SVGWidget } from "./SVGWidget";
5
-
6
- import "../src/Icon.css";
7
-
8
- export class Icon extends SVGWidget {
9
-
10
- protected _shapeWidget;
11
- protected _faChar;
12
- protected _defs;
13
- protected _root;
14
- protected _tooltipElement;
15
-
16
- constructor() {
17
- super();
18
-
19
- this._shapeWidget = new Shape();
20
- this._faChar = new FAChar();
21
- }
22
-
23
- getBBox(refresh = false, round = false) {
24
- const diameter = this.diameter();
25
- return {
26
- x: - diameter / 2,
27
- y: - diameter / 2,
28
- width: diameter,
29
- height: diameter
30
- };
31
- }
32
-
33
- contains(point) {
34
- return this._shapeWidget.contains(point);
35
- }
36
-
37
- intersection(pointA, pointB) {
38
- return this._shapeWidget.intersection(pointA, pointB);
39
- }
40
-
41
- enter(domNode, element) {
42
- super.enter(domNode, element);
43
- delete this._prevHash;
44
- this._defs = element.append("defs");
45
- this._defs.append("clipPath")
46
- .attr("id", "clip_" + this.id() + "_circle")
47
- .append("circle")
48
- .attr("x", 0)
49
- .attr("y", 0)
50
- ;
51
- this._defs.append("clipPath")
52
- .attr("id", "clip_" + this.id() + "_square")
53
- .append("rect")
54
- ;
55
- this._root = element.append("g");
56
- this._shapeWidget
57
- .target(this._root.node())
58
- ;
59
- this._faChar
60
- .target(element.node())
61
- ;
62
- this._tooltipElement = element.append("title");
63
- const context = this;
64
- element
65
- .on("click", function (el) {
66
- context.click(el);
67
- })
68
- .on("dblclick", function (el) {
69
- context.dblclick(el);
70
- })
71
- ;
72
- }
73
-
74
- click(_domNode) {
75
- // console.log("Clicked the icon");
76
- }
77
-
78
- dblclick(_domNode) {
79
- // console.log("Double clicked the icon");
80
- }
81
-
82
- _prevHash;
83
- update(domNode, element) {
84
- super.update(domNode, element);
85
- const hash = this.hashSum();
86
- if (this._prevHash !== hash) {
87
- this._prevHash = hash;
88
-
89
- const diameter = this.diameter();
90
- const radius = diameter / 2;
91
- this._defs.select("circle")
92
- .attr("r", radius)
93
- ;
94
- this._defs.select("rect")
95
- .attr("x", -radius)
96
- .attr("y", -radius)
97
- .attr("width", diameter)
98
- .attr("height", diameter)
99
- ;
100
- this._faChar
101
- .fontSize(diameter * (100 - this.paddingPercent()) / 100)
102
- .render()
103
- ;
104
- this._shapeWidget
105
- .shape(this.shape())
106
- .width(diameter)
107
- .height(diameter)
108
- .render()
109
- ;
110
- const image = this._root.selectAll("image").data(this.imageUrl() ? [this.imageUrl()] : [], function (d) { return d; });
111
- image.enter()
112
- .append("image")
113
- .attr("xlink:href", this.imageUrl())
114
- .merge(image)
115
- .attr("clip-path", "url(#clip_" + this.id() + "_" + this.shape() + ")")
116
- .attr("x", -radius)
117
- .attr("y", -radius)
118
- .attr("width", diameter)
119
- .attr("height", diameter)
120
- ;
121
- if (this.shape_colorFill_exists() && !this.image_colorFill_exists()) {
122
- this.image_colorFill(textColor(this.shape_colorFill()));
123
- }
124
- image.exit()
125
- .remove()
126
- ;
127
- this._tooltipElement.text(this.tooltip());
128
- }
129
- }
130
-
131
- exit(domNode, element) {
132
- super.exit(domNode, element);
133
- this._shapeWidget
134
- .target(null)
135
- ;
136
- this._faChar
137
- .target(null)
138
- ;
139
- }
140
-
141
- shape: { (): string; (_: string): Icon; };
142
- faChar: { (): string; (_: string): Icon; };
143
- imageUrl: { (): string; (_: string): Icon; };
144
- image_colorFill: { (): string; (_: string): Icon; };
145
- image_colorFill_exists: () => boolean;
146
- tooltip: { (): string; (_: string): Icon; };
147
- diameter: { (): number; (_: number): Icon; };
148
- paddingPercent: { (): number; (_: number): Icon; };
149
- shape_colorFill: { (): string; (_: string): Icon; };
150
- shape_colorFill_exists: () => boolean;
151
- shape_colorStroke: { (): string; (_: string): Icon; };
152
- }
153
- Icon.prototype._class += " common_Icon";
154
-
155
- Icon.prototype.publish("shape", "circle", "set", "Shape Type", ["circle", "square"], { tags: ["Private"] });
156
- Icon.prototype.publishProxy("faChar", "_faChar", "char");
157
- Icon.prototype.publishProxy("fontFamily", "_faChar", "text_fontFamily");
158
- Icon.prototype.publish("imageUrl", null, "string", "Image URL", null, { optional: true });
159
- Icon.prototype.publishProxy("image_colorFill", "_faChar", "text_colorFill");
160
- Icon.prototype.publish("tooltip", "", "string", "Tooltip", null, { tags: ["Private"] });
161
- Icon.prototype.publish("diameter", 24, "number", "Diameter", null, { tags: ["Private"] });
162
- Icon.prototype.publish("paddingPercent", 45, "number", "Padding Percent", null, { tags: ["Private"] });
163
- Icon.prototype.publishProxy("shape_colorFill", "_shapeWidget", "colorFill");
164
- Icon.prototype.publishProxy("shape_colorStroke", "_shapeWidget", "colorStroke");
1
+ import { FAChar } from "./FAChar";
2
+ import { textColor } from "./Palette";
3
+ import { Shape } from "./Shape";
4
+ import { SVGWidget } from "./SVGWidget";
5
+
6
+ import "../src/Icon.css";
7
+
8
+ export class Icon extends SVGWidget {
9
+
10
+ protected _shapeWidget;
11
+ protected _faChar;
12
+ protected _defs;
13
+ protected _root;
14
+ protected _tooltipElement;
15
+
16
+ constructor() {
17
+ super();
18
+
19
+ this._shapeWidget = new Shape();
20
+ this._faChar = new FAChar();
21
+ }
22
+
23
+ getBBox(refresh = false, round = false) {
24
+ const diameter = this.diameter();
25
+ return {
26
+ x: - diameter / 2,
27
+ y: - diameter / 2,
28
+ width: diameter,
29
+ height: diameter
30
+ };
31
+ }
32
+
33
+ contains(point) {
34
+ return this._shapeWidget.contains(point);
35
+ }
36
+
37
+ intersection(pointA, pointB) {
38
+ return this._shapeWidget.intersection(pointA, pointB);
39
+ }
40
+
41
+ enter(domNode, element) {
42
+ super.enter(domNode, element);
43
+ delete this._prevHash;
44
+ this._defs = element.append("defs");
45
+ this._defs.append("clipPath")
46
+ .attr("id", "clip_" + this.id() + "_circle")
47
+ .append("circle")
48
+ .attr("x", 0)
49
+ .attr("y", 0)
50
+ ;
51
+ this._defs.append("clipPath")
52
+ .attr("id", "clip_" + this.id() + "_square")
53
+ .append("rect")
54
+ ;
55
+ this._root = element.append("g");
56
+ this._shapeWidget
57
+ .target(this._root.node())
58
+ ;
59
+ this._faChar
60
+ .target(element.node())
61
+ ;
62
+ this._tooltipElement = element.append("title");
63
+ const context = this;
64
+ element
65
+ .on("click", function (el) {
66
+ context.click(el);
67
+ })
68
+ .on("dblclick", function (el) {
69
+ context.dblclick(el);
70
+ })
71
+ ;
72
+ }
73
+
74
+ click(_domNode) {
75
+ // console.log("Clicked the icon");
76
+ }
77
+
78
+ dblclick(_domNode) {
79
+ // console.log("Double clicked the icon");
80
+ }
81
+
82
+ _prevHash;
83
+ update(domNode, element) {
84
+ super.update(domNode, element);
85
+ const hash = this.hashSum();
86
+ if (this._prevHash !== hash) {
87
+ this._prevHash = hash;
88
+
89
+ const diameter = this.diameter();
90
+ const radius = diameter / 2;
91
+ this._defs.select("circle")
92
+ .attr("r", radius)
93
+ ;
94
+ this._defs.select("rect")
95
+ .attr("x", -radius)
96
+ .attr("y", -radius)
97
+ .attr("width", diameter)
98
+ .attr("height", diameter)
99
+ ;
100
+ this._faChar
101
+ .fontSize(diameter * (100 - this.paddingPercent()) / 100)
102
+ .render()
103
+ ;
104
+ this._shapeWidget
105
+ .shape(this.shape())
106
+ .width(diameter)
107
+ .height(diameter)
108
+ .render()
109
+ ;
110
+ const image = this._root.selectAll("image").data(this.imageUrl() ? [this.imageUrl()] : [], function (d) { return d; });
111
+ image.enter()
112
+ .append("image")
113
+ .attr("xlink:href", this.imageUrl())
114
+ .merge(image)
115
+ .attr("clip-path", "url(#clip_" + this.id() + "_" + this.shape() + ")")
116
+ .attr("x", -radius)
117
+ .attr("y", -radius)
118
+ .attr("width", diameter)
119
+ .attr("height", diameter)
120
+ ;
121
+ if (this.shape_colorFill_exists() && !this.image_colorFill_exists()) {
122
+ this.image_colorFill(textColor(this.shape_colorFill()));
123
+ }
124
+ image.exit()
125
+ .remove()
126
+ ;
127
+ this._tooltipElement.text(this.tooltip());
128
+ }
129
+ }
130
+
131
+ exit(domNode, element) {
132
+ super.exit(domNode, element);
133
+ this._shapeWidget
134
+ .target(null)
135
+ ;
136
+ this._faChar
137
+ .target(null)
138
+ ;
139
+ }
140
+
141
+ shape: { (): string; (_: string): Icon; };
142
+ faChar: { (): string; (_: string): Icon; };
143
+ imageUrl: { (): string; (_: string): Icon; };
144
+ image_colorFill: { (): string; (_: string): Icon; };
145
+ image_colorFill_exists: () => boolean;
146
+ tooltip: { (): string; (_: string): Icon; };
147
+ diameter: { (): number; (_: number): Icon; };
148
+ paddingPercent: { (): number; (_: number): Icon; };
149
+ shape_colorFill: { (): string; (_: string): Icon; };
150
+ shape_colorFill_exists: () => boolean;
151
+ shape_colorStroke: { (): string; (_: string): Icon; };
152
+ }
153
+ Icon.prototype._class += " common_Icon";
154
+
155
+ Icon.prototype.publish("shape", "circle", "set", "Shape Type", ["circle", "square"], { tags: ["Private"] });
156
+ Icon.prototype.publishProxy("faChar", "_faChar", "char");
157
+ Icon.prototype.publishProxy("fontFamily", "_faChar", "text_fontFamily");
158
+ Icon.prototype.publish("imageUrl", null, "string", "Image URL", null, { optional: true });
159
+ Icon.prototype.publishProxy("image_colorFill", "_faChar", "text_colorFill");
160
+ Icon.prototype.publish("tooltip", "", "string", "Tooltip", null, { tags: ["Private"] });
161
+ Icon.prototype.publish("diameter", 24, "number", "Diameter", null, { tags: ["Private"] });
162
+ Icon.prototype.publish("paddingPercent", 45, "number", "Padding Percent", null, { tags: ["Private"] });
163
+ Icon.prototype.publishProxy("shape_colorFill", "_shapeWidget", "colorFill");
164
+ Icon.prototype.publishProxy("shape_colorStroke", "_shapeWidget", "colorStroke");
package/src/Image.ts CHANGED
@@ -1,95 +1,95 @@
1
- import { select as d3Select } from "d3-selection";
2
- import { HTMLWidget } from "./HTMLWidget";
3
-
4
- export class Image extends HTMLWidget {
5
- private _imgElement;
6
-
7
- constructor() {
8
- super();
9
- }
10
-
11
- enter(domNode, element) {
12
- super.enter(domNode, element);
13
- }
14
-
15
- update(domNode, element) {
16
- super.update(domNode, element);
17
- const context = this;
18
- const img = element.selectAll("img").data(this.source() ? [this.source()] : [], function (d) { return d; });
19
- img.enter()
20
- .append("img")
21
- .attr("src", this.source())
22
- .style("opacity", 0)
23
- .on("load", function () {
24
- context._imgElement = d3Select(this);
25
- context.styleImageElement();
26
- context._imgElement.style("opacity", 1);
27
- })
28
- ;
29
- this.styleImageElement();
30
- img.exit()
31
- .remove()
32
- ;
33
- }
34
-
35
- styleImageElement() {
36
- if (!this._imgElement) return;
37
- switch (this.sizing()) {
38
- case "actual":
39
- this._imgElement.style("width", "auto");
40
- this._imgElement.style("height", "auto");
41
- break;
42
- case "fit":
43
- if (this.lockAspectRatio()) {
44
- this._imgElement.style("width", "auto");
45
- this._imgElement.style("height", "auto");
46
- const bbox = this._imgElement.node().getBoundingClientRect();
47
- const xScale = bbox.width / this.width();
48
- const yScale = bbox.height / this.height();
49
- if (xScale > yScale) {
50
- this._imgElement.style("width", this.width() + "px");
51
- this._imgElement.style("height", (bbox.height / xScale) + "px");
52
- } else {
53
- this._imgElement.style("width", (bbox.width / yScale) + "px");
54
- this._imgElement.style("height", this.height() + "px");
55
- }
56
- } else {
57
- this._imgElement.style("width", this.width() + "px");
58
- this._imgElement.style("height", this.height() + "px");
59
- }
60
- break;
61
- case "custom":
62
- this._imgElement.style("width", this.customWidth());
63
- this._imgElement.style("height", this.customHeight());
64
- break;
65
- }
66
- switch (this.alignment()) {
67
- case "origin":
68
- break;
69
- case "center":
70
- const bbox = this._imgElement.node().getBoundingClientRect();
71
- this._imgElement.style("margin-left", `${(this.width() - bbox.width) / 2}px`);
72
- this._imgElement.style("margin-top", `${(this.height() - bbox.height) / 2}px`);
73
- break;
74
- }
75
- }
76
-
77
- exit(domNode, element) {
78
- super.exit(domNode, element);
79
- }
80
-
81
- source: { (): string; (_: string): Image; };
82
- sizing: { (): string; (_: string): Image; };
83
- customWidth: { (): string; (_: string): Image; };
84
- customHeight: { (): string; (_: string): Image; };
85
- lockAspectRatio: { (): boolean; (_: boolean): Image; };
86
- alignment: { (): string; (_: string): Image; };
87
- }
88
- Image.prototype._class += " common_Image";
89
-
90
- Image.prototype.publish("source", null, "string", "Image Source", null, { tags: ["Basic"] });
91
- Image.prototype.publish("sizing", "actual", "set", "Controls sizing mode", ["actual", "fit", "custom"], { tags: ["Basic"] });
92
- Image.prototype.publish("customWidth", "50%", "string", "Applies this width to IMG element if 'sizing' is set to 'custom' (user should set 'px' or 'em' etc.)", null, { tags: ["Basic"], disable: (w) => w.sizing() !== "custom" });
93
- Image.prototype.publish("customHeight", "20%", "string", "Applies this height to IMG element if 'sizing' is set to 'custom' (user should set 'px' or 'em' etc.)", null, { tags: ["Basic"], disable: (w) => w.sizing() !== "custom" });
94
- Image.prototype.publish("lockAspectRatio", true, "boolean", "Locks the aspect ratio when scaling/stretching", null, { tags: ["Basic"], disable: (w) => w.sizing() !== "fit" });
95
- Image.prototype.publish("alignment", "center", "set", "Image Alignment", ["center", "origin"], { tags: ["Basic"] });
1
+ import { select as d3Select } from "d3-selection";
2
+ import { HTMLWidget } from "./HTMLWidget";
3
+
4
+ export class Image extends HTMLWidget {
5
+ private _imgElement;
6
+
7
+ constructor() {
8
+ super();
9
+ }
10
+
11
+ enter(domNode, element) {
12
+ super.enter(domNode, element);
13
+ }
14
+
15
+ update(domNode, element) {
16
+ super.update(domNode, element);
17
+ const context = this;
18
+ const img = element.selectAll("img").data(this.source() ? [this.source()] : [], function (d) { return d; });
19
+ img.enter()
20
+ .append("img")
21
+ .attr("src", this.source())
22
+ .style("opacity", 0)
23
+ .on("load", function () {
24
+ context._imgElement = d3Select(this);
25
+ context.styleImageElement();
26
+ context._imgElement.style("opacity", 1);
27
+ })
28
+ ;
29
+ this.styleImageElement();
30
+ img.exit()
31
+ .remove()
32
+ ;
33
+ }
34
+
35
+ styleImageElement() {
36
+ if (!this._imgElement) return;
37
+ switch (this.sizing()) {
38
+ case "actual":
39
+ this._imgElement.style("width", "auto");
40
+ this._imgElement.style("height", "auto");
41
+ break;
42
+ case "fit":
43
+ if (this.lockAspectRatio()) {
44
+ this._imgElement.style("width", "auto");
45
+ this._imgElement.style("height", "auto");
46
+ const bbox = this._imgElement.node().getBoundingClientRect();
47
+ const xScale = bbox.width / this.width();
48
+ const yScale = bbox.height / this.height();
49
+ if (xScale > yScale) {
50
+ this._imgElement.style("width", this.width() + "px");
51
+ this._imgElement.style("height", (bbox.height / xScale) + "px");
52
+ } else {
53
+ this._imgElement.style("width", (bbox.width / yScale) + "px");
54
+ this._imgElement.style("height", this.height() + "px");
55
+ }
56
+ } else {
57
+ this._imgElement.style("width", this.width() + "px");
58
+ this._imgElement.style("height", this.height() + "px");
59
+ }
60
+ break;
61
+ case "custom":
62
+ this._imgElement.style("width", this.customWidth());
63
+ this._imgElement.style("height", this.customHeight());
64
+ break;
65
+ }
66
+ switch (this.alignment()) {
67
+ case "origin":
68
+ break;
69
+ case "center":
70
+ const bbox = this._imgElement.node().getBoundingClientRect();
71
+ this._imgElement.style("margin-left", `${(this.width() - bbox.width) / 2}px`);
72
+ this._imgElement.style("margin-top", `${(this.height() - bbox.height) / 2}px`);
73
+ break;
74
+ }
75
+ }
76
+
77
+ exit(domNode, element) {
78
+ super.exit(domNode, element);
79
+ }
80
+
81
+ source: { (): string; (_: string): Image; };
82
+ sizing: { (): string; (_: string): Image; };
83
+ customWidth: { (): string; (_: string): Image; };
84
+ customHeight: { (): string; (_: string): Image; };
85
+ lockAspectRatio: { (): boolean; (_: boolean): Image; };
86
+ alignment: { (): string; (_: string): Image; };
87
+ }
88
+ Image.prototype._class += " common_Image";
89
+
90
+ Image.prototype.publish("source", null, "string", "Image Source", null, { tags: ["Basic"] });
91
+ Image.prototype.publish("sizing", "actual", "set", "Controls sizing mode", ["actual", "fit", "custom"], { tags: ["Basic"] });
92
+ Image.prototype.publish("customWidth", "50%", "string", "Applies this width to IMG element if 'sizing' is set to 'custom' (user should set 'px' or 'em' etc.)", null, { tags: ["Basic"], disable: (w) => w.sizing() !== "custom" });
93
+ Image.prototype.publish("customHeight", "20%", "string", "Applies this height to IMG element if 'sizing' is set to 'custom' (user should set 'px' or 'em' etc.)", null, { tags: ["Basic"], disable: (w) => w.sizing() !== "custom" });
94
+ Image.prototype.publish("lockAspectRatio", true, "boolean", "Locks the aspect ratio when scaling/stretching", null, { tags: ["Basic"], disable: (w) => w.sizing() !== "fit" });
95
+ Image.prototype.publish("alignment", "center", "set", "Image Alignment", ["center", "origin"], { tags: ["Basic"] });
package/src/List.css CHANGED
@@ -1,13 +1,13 @@
1
- .common_List .common_TextBox .common_Shape {
2
- fill: #dcf1ff;
3
- stroke: #dcf1ff;
4
- }
5
-
6
- .common_List .common_TextBox .common_Text {
7
- pointer-events: none;
8
- }
9
-
10
- .common_List .common_TextBox .common_Shape:hover {
11
- fill: white;
12
- stroke: white;
13
- }
1
+ .common_List .common_TextBox .common_Shape {
2
+ fill: #dcf1ff;
3
+ stroke: #dcf1ff;
4
+ }
5
+
6
+ .common_List .common_TextBox .common_Text {
7
+ pointer-events: none;
8
+ }
9
+
10
+ .common_List .common_TextBox .common_Shape:hover {
11
+ fill: white;
12
+ stroke: white;
13
+ }