@hpcc-js/common 3.6.2 → 3.6.5

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 +1 -1
  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 +4 -4
  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 +839 -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/HTMLWidget.ts CHANGED
@@ -1,191 +1,191 @@
1
- import { select as d3Select } from "d3-selection";
2
- import { Widget } from "./Widget.ts";
3
-
4
- export class HTMLWidget extends Widget {
5
-
6
- private observer;
7
- protected _drawStartPos: "origin" | "center";
8
- protected _boundingBox;
9
-
10
- constructor() {
11
- super();
12
-
13
- this._drawStartPos = "origin";
14
- this._tag = "div";
15
- this._boundingBox = null;
16
- }
17
-
18
- calcFrameWidth(element) {
19
- const retVal = parseFloat(element.style("padding-left")) +
20
- parseFloat(element.style("padding-right")) +
21
- parseFloat(element.style("margin-left")) +
22
- parseFloat(element.style("margin-right")) +
23
- parseFloat(element.style("border-left-width")) +
24
- parseFloat(element.style("border-right-width"))
25
- ;
26
- return retVal;
27
- }
28
-
29
- calcWidth(element) {
30
- return parseFloat(element.style("width")) - this.calcFrameWidth(element);
31
- }
32
-
33
- calcFrameHeight(element) {
34
- const retVal = parseFloat(element.style("padding-top")) +
35
- parseFloat(element.style("padding-bottom")) +
36
- parseFloat(element.style("margin-top")) +
37
- parseFloat(element.style("margin-bottom")) +
38
- parseFloat(element.style("border-top-width")) +
39
- parseFloat(element.style("border-bottom-width"))
40
- ;
41
- return retVal;
42
- }
43
-
44
- calcHeight(element) {
45
- return parseFloat(element.style("height")) + this.calcFrameHeight(element);
46
- }
47
-
48
- hasHScroll(element?) {
49
- element = element || this._element;
50
- return element.property("scrollWidth") > element.property("clientWidth");
51
- }
52
-
53
- hasVScroll(element?) {
54
- element = element || this._element;
55
- return element.property("scrollHeight") > element.property("clientHeight");
56
- }
57
-
58
- clientWidth() {
59
- return this._size.width - this.calcFrameWidth(this._element);
60
- }
61
-
62
- clientHeight() {
63
- return this._size.height - this.calcFrameHeight(this._element);
64
- }
65
-
66
- getBBox(refresh = false, round = false) {
67
- if (refresh || this._boundingBox === null) {
68
- const domNode = this._element.node() ? this._element.node().firstElementChild : null; // Needs to be first child, as element has its width/height forced onto it.
69
- if (domNode instanceof Element) {
70
- const rect = domNode.getBoundingClientRect();
71
- this._boundingBox = {
72
- x: rect.left,
73
- y: rect.top,
74
- width: rect.width,
75
- height: rect.height
76
- };
77
- }
78
- }
79
- if (this._boundingBox === null) {
80
- return {
81
- x: 0,
82
- y: 0,
83
- width: 0,
84
- height: 0
85
- };
86
- }
87
- return {
88
- x: (round ? Math.round(this._boundingBox.x) : this._boundingBox.x) * this._widgetScale,
89
- y: (round ? Math.round(this._boundingBox.y) : this._boundingBox.y) * this._widgetScale,
90
- width: (round ? Math.round(this._boundingBox.width) : this._boundingBox.width) * this._widgetScale,
91
- height: (round ? Math.round(this._boundingBox.height) : this._boundingBox.height) * this._widgetScale
92
- };
93
- }
94
-
95
- reposition(pos?) {
96
- // const retVal = super.reposition(pos);
97
- if (this._placeholderElement) {
98
- this._placeholderElement
99
- .style("left", pos.x + "px")
100
- .style("top", pos.y + "px")
101
- ;
102
- }
103
- return this;
104
- }
105
-
106
- resize(size?) {
107
- const retVal = super.resize(size);
108
- if (this._placeholderElement) {
109
- this._placeholderElement
110
- .style("width", this._size.width + "px")
111
- .style("height", this._size.height + "px")
112
- ;
113
- }
114
- return retVal;
115
- }
116
-
117
- // Properties ---
118
- target(): null | HTMLElement | SVGElement;
119
- target(_: null | string | HTMLElement | SVGElement): this;
120
- target(_?: null | string | HTMLElement | SVGElement): null | HTMLElement | SVGElement | this {
121
- const retVal = super.target.apply(this, arguments);
122
- if (arguments.length) {
123
- if (this._target instanceof SVGElement) {
124
- // Target is a SVG Node, so create an item in the Overlay and force it "over" the overlay element (cough) ---
125
- this._isRootNode = false;
126
- const overlay = this.locateOverlayNode();
127
- this._placeholderElement = overlay.append("div")
128
- .style("position", "absolute")
129
- .style("top", "0px")
130
- .style("left", "0px")
131
- .style("overflow", "hidden")
132
- ;
133
- this._overlayElement = d3Select(this._target);
134
-
135
- this._prevPos = null;
136
- this.observer = new MutationObserver(_mutation => {
137
- this.syncOverlay();
138
- });
139
-
140
- let domNode = this._overlayElement.node();
141
- while (domNode) {
142
- this.observer.observe(domNode, { attributes: true });
143
- domNode = domNode.parentNode;
144
- }
145
- } else if (this._target) { // HTMLElement
146
- this._placeholderElement = d3Select(this._target);
147
- if (!this._size.width && !this._size.height) {
148
- const width = parseFloat(this._placeholderElement.style("width"));
149
- const height = parseFloat(this._placeholderElement.style("height"));
150
- this.size({
151
- width,
152
- height
153
- });
154
- }
155
- this._placeholderElement = d3Select(this._target).append("div");
156
- }
157
- }
158
- return retVal;
159
- }
160
-
161
- postUpdate(domNode, element) {
162
- super.postUpdate(domNode, element);
163
- if (this._drawStartPos === "origin") {
164
- this._element
165
- .style("position", "relative")
166
- .style("left", this._pos.x + "px")
167
- .style("top", this._pos.y + "px")
168
- ;
169
- } else {
170
- const bbox = this.getBBox(true);
171
- this._element
172
- .style("position", "relative")
173
- .style("float", "left")
174
- .style("left", this._pos.x + (this._size.width - bbox.width) / 2 + "px")
175
- .style("top", this._pos.y + (this._size.height - bbox.height) / 2 + "px")
176
- ;
177
- }
178
- }
179
-
180
- exit(domNode?, element?) {
181
- if (this.observer) {
182
- this.observer.disconnect();
183
- }
184
- this._prevPos = null;
185
- if (this._placeholderElement) {
186
- this._placeholderElement.remove();
187
- }
188
- super.exit(domNode, element);
189
- }
190
- }
191
- HTMLWidget.prototype._class += " common_HTMLWidget";
1
+ import { select as d3Select } from "d3-selection";
2
+ import { Widget } from "./Widget.ts";
3
+
4
+ export class HTMLWidget extends Widget {
5
+
6
+ private observer;
7
+ protected _drawStartPos: "origin" | "center";
8
+ protected _boundingBox;
9
+
10
+ constructor() {
11
+ super();
12
+
13
+ this._drawStartPos = "origin";
14
+ this._tag = "div";
15
+ this._boundingBox = null;
16
+ }
17
+
18
+ calcFrameWidth(element) {
19
+ const retVal = parseFloat(element.style("padding-left")) +
20
+ parseFloat(element.style("padding-right")) +
21
+ parseFloat(element.style("margin-left")) +
22
+ parseFloat(element.style("margin-right")) +
23
+ parseFloat(element.style("border-left-width")) +
24
+ parseFloat(element.style("border-right-width"))
25
+ ;
26
+ return retVal;
27
+ }
28
+
29
+ calcWidth(element) {
30
+ return parseFloat(element.style("width")) - this.calcFrameWidth(element);
31
+ }
32
+
33
+ calcFrameHeight(element) {
34
+ const retVal = parseFloat(element.style("padding-top")) +
35
+ parseFloat(element.style("padding-bottom")) +
36
+ parseFloat(element.style("margin-top")) +
37
+ parseFloat(element.style("margin-bottom")) +
38
+ parseFloat(element.style("border-top-width")) +
39
+ parseFloat(element.style("border-bottom-width"))
40
+ ;
41
+ return retVal;
42
+ }
43
+
44
+ calcHeight(element) {
45
+ return parseFloat(element.style("height")) + this.calcFrameHeight(element);
46
+ }
47
+
48
+ hasHScroll(element?) {
49
+ element = element || this._element;
50
+ return element.property("scrollWidth") > element.property("clientWidth");
51
+ }
52
+
53
+ hasVScroll(element?) {
54
+ element = element || this._element;
55
+ return element.property("scrollHeight") > element.property("clientHeight");
56
+ }
57
+
58
+ clientWidth() {
59
+ return this._size.width - this.calcFrameWidth(this._element);
60
+ }
61
+
62
+ clientHeight() {
63
+ return this._size.height - this.calcFrameHeight(this._element);
64
+ }
65
+
66
+ getBBox(refresh = false, round = false) {
67
+ if (refresh || this._boundingBox === null) {
68
+ const domNode = this._element.node() ? this._element.node().firstElementChild : null; // Needs to be first child, as element has its width/height forced onto it.
69
+ if (domNode instanceof Element) {
70
+ const rect = domNode.getBoundingClientRect();
71
+ this._boundingBox = {
72
+ x: rect.left,
73
+ y: rect.top,
74
+ width: rect.width,
75
+ height: rect.height
76
+ };
77
+ }
78
+ }
79
+ if (this._boundingBox === null) {
80
+ return {
81
+ x: 0,
82
+ y: 0,
83
+ width: 0,
84
+ height: 0
85
+ };
86
+ }
87
+ return {
88
+ x: (round ? Math.round(this._boundingBox.x) : this._boundingBox.x) * this._widgetScale,
89
+ y: (round ? Math.round(this._boundingBox.y) : this._boundingBox.y) * this._widgetScale,
90
+ width: (round ? Math.round(this._boundingBox.width) : this._boundingBox.width) * this._widgetScale,
91
+ height: (round ? Math.round(this._boundingBox.height) : this._boundingBox.height) * this._widgetScale
92
+ };
93
+ }
94
+
95
+ reposition(pos?) {
96
+ // const retVal = super.reposition(pos);
97
+ if (this._placeholderElement) {
98
+ this._placeholderElement
99
+ .style("left", pos.x + "px")
100
+ .style("top", pos.y + "px")
101
+ ;
102
+ }
103
+ return this;
104
+ }
105
+
106
+ resize(size?) {
107
+ const retVal = super.resize(size);
108
+ if (this._placeholderElement) {
109
+ this._placeholderElement
110
+ .style("width", this._size.width + "px")
111
+ .style("height", this._size.height + "px")
112
+ ;
113
+ }
114
+ return retVal;
115
+ }
116
+
117
+ // Properties ---
118
+ target(): null | HTMLElement | SVGElement;
119
+ target(_: null | string | HTMLElement | SVGElement): this;
120
+ target(_?: null | string | HTMLElement | SVGElement): null | HTMLElement | SVGElement | this {
121
+ const retVal = super.target.apply(this, arguments);
122
+ if (arguments.length) {
123
+ if (this._target instanceof SVGElement) {
124
+ // Target is a SVG Node, so create an item in the Overlay and force it "over" the overlay element (cough) ---
125
+ this._isRootNode = false;
126
+ const overlay = this.locateOverlayNode();
127
+ this._placeholderElement = overlay.append("div")
128
+ .style("position", "absolute")
129
+ .style("top", "0px")
130
+ .style("left", "0px")
131
+ .style("overflow", "hidden")
132
+ ;
133
+ this._overlayElement = d3Select(this._target);
134
+
135
+ this._prevPos = null;
136
+ this.observer = new MutationObserver(_mutation => {
137
+ this.syncOverlay();
138
+ });
139
+
140
+ let domNode = this._overlayElement.node();
141
+ while (domNode) {
142
+ this.observer.observe(domNode, { attributes: true });
143
+ domNode = domNode.parentNode;
144
+ }
145
+ } else if (this._target) { // HTMLElement
146
+ this._placeholderElement = d3Select(this._target);
147
+ if (!this._size.width && !this._size.height) {
148
+ const width = parseFloat(this._placeholderElement.style("width"));
149
+ const height = parseFloat(this._placeholderElement.style("height"));
150
+ this.size({
151
+ width,
152
+ height
153
+ });
154
+ }
155
+ this._placeholderElement = d3Select(this._target).append("div");
156
+ }
157
+ }
158
+ return retVal;
159
+ }
160
+
161
+ postUpdate(domNode, element) {
162
+ super.postUpdate(domNode, element);
163
+ if (this._drawStartPos === "origin") {
164
+ this._element
165
+ .style("position", "relative")
166
+ .style("left", this._pos.x + "px")
167
+ .style("top", this._pos.y + "px")
168
+ ;
169
+ } else {
170
+ const bbox = this.getBBox(true);
171
+ this._element
172
+ .style("position", "relative")
173
+ .style("float", "left")
174
+ .style("left", this._pos.x + (this._size.width - bbox.width) / 2 + "px")
175
+ .style("top", this._pos.y + (this._size.height - bbox.height) / 2 + "px")
176
+ ;
177
+ }
178
+ }
179
+
180
+ exit(domNode?, element?) {
181
+ if (this.observer) {
182
+ this.observer.disconnect();
183
+ }
184
+ this._prevPos = null;
185
+ if (this._placeholderElement) {
186
+ this._placeholderElement.remove();
187
+ }
188
+ super.exit(domNode, element);
189
+ }
190
+ }
191
+ HTMLWidget.prototype._class += " common_HTMLWidget";
package/src/IList.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface IList {
2
- click(d);
3
- dblclick(d);
4
- }
1
+ export interface IList {
2
+ click(d);
3
+ dblclick(d);
4
+ }
package/src/IMenu.ts CHANGED
@@ -1,5 +1,5 @@
1
- export interface IMenu {
2
- click(d);
3
- preShowMenu(d);
4
- postHideMenu(d);
5
- }
1
+ export interface IMenu {
2
+ click(d);
3
+ preShowMenu(d);
4
+ postHideMenu(d);
5
+ }
package/src/Icon.css CHANGED
@@ -1,9 +1,9 @@
1
- .common_Icon .common_FAChar .common_Text {
2
- fill: white;
3
- }
4
- .common_Icon .common_FAChar .common_Text,
5
- .common_Icon .common_FAChar .common_Text g,
6
- .common_Icon .common_FAChar .common_Text text,
7
- .common_Icon .common_FAChar .common_Text tspan {
8
- pointer-events: none;
9
- }
1
+ .common_Icon .common_FAChar .common_Text {
2
+ fill: white;
3
+ }
4
+ .common_Icon .common_FAChar .common_Text,
5
+ .common_Icon .common_FAChar .common_Text g,
6
+ .common_Icon .common_FAChar .common_Text text,
7
+ .common_Icon .common_FAChar .common_Text tspan {
8
+ pointer-events: none;
9
+ }