@hpcc-js/common 3.7.5 → 3.7.7
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.
- package/LICENSE +43 -43
- package/README.md +59 -59
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +7 -5
- package/src/CanvasWidget.ts +31 -31
- package/src/Class.ts +72 -72
- package/src/Database.ts +859 -860
- package/src/Entity.ts +235 -235
- package/src/EntityCard.ts +66 -66
- package/src/EntityPin.ts +103 -103
- package/src/EntityRect.css +15 -15
- package/src/EntityRect.ts +254 -254
- package/src/EntityVertex.ts +86 -86
- package/src/FAChar.css +2 -2
- package/src/FAChar.ts +89 -89
- package/src/HTMLWidget.ts +191 -191
- package/src/IList.ts +4 -4
- package/src/IMenu.ts +5 -5
- package/src/Icon.css +9 -9
- package/src/Icon.ts +176 -176
- package/src/Image.ts +104 -104
- package/src/List.css +12 -12
- package/src/List.ts +102 -102
- package/src/Menu.css +22 -22
- package/src/Menu.ts +139 -139
- package/src/Palette.ts +341 -341
- package/src/Platform.ts +124 -125
- package/src/ProgressBar.ts +115 -115
- package/src/PropertyExt.ts +770 -770
- package/src/ResizeSurface.css +38 -38
- package/src/ResizeSurface.ts +225 -225
- package/src/SVGWidget.ts +583 -583
- package/src/SVGZoomWidget.css +11 -11
- package/src/SVGZoomWidget.ts +427 -427
- package/src/Shape.css +3 -3
- package/src/Shape.ts +186 -186
- package/src/Surface.css +39 -39
- package/src/Surface.ts +364 -364
- package/src/Text.css +3 -3
- package/src/Text.ts +131 -131
- package/src/TextBox.css +3 -3
- package/src/TextBox.ts +183 -183
- package/src/TitleBar.css +114 -114
- package/src/TitleBar.ts +407 -407
- package/src/Transition.ts +45 -45
- package/src/Utility.ts +843 -843
- package/src/Widget.css +7 -7
- package/src/Widget.ts +731 -731
- package/src/WidgetArray.ts +15 -15
- package/src/__package__.ts +3 -3
- package/src/index.ts +55 -55
- package/types/Database.d.ts +1 -1
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,10 +1,10 @@
|
|
|
1
|
-
.common_Icon .common_FAChar .common_Text {
|
|
2
|
-
fill: white;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.common_Icon .common_FAChar .common_Text,
|
|
6
|
-
.common_Icon .common_FAChar .common_Text g,
|
|
7
|
-
.common_Icon .common_FAChar .common_Text text,
|
|
8
|
-
.common_Icon .common_FAChar .common_Text tspan {
|
|
9
|
-
pointer-events: none;
|
|
1
|
+
.common_Icon .common_FAChar .common_Text {
|
|
2
|
+
fill: white;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.common_Icon .common_FAChar .common_Text,
|
|
6
|
+
.common_Icon .common_FAChar .common_Text g,
|
|
7
|
+
.common_Icon .common_FAChar .common_Text text,
|
|
8
|
+
.common_Icon .common_FAChar .common_Text tspan {
|
|
9
|
+
pointer-events: none;
|
|
10
10
|
}
|