@hpcc-js/html 3.2.9 → 3.2.10
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/dist/index.js +394 -179
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -9
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable:
|
|
3
|
-
var
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
5
|
import { HTMLWidget, select, format } from "@hpcc-js/common";
|
|
5
6
|
import { scopedLogger } from "@hpcc-js/util";
|
|
6
7
|
import { React } from "@hpcc-js/react";
|
|
7
|
-
const PKG_NAME = "@hpcc-js/html"
|
|
8
|
-
|
|
8
|
+
const PKG_NAME = "@hpcc-js/html";
|
|
9
|
+
const PKG_VERSION = "3.1.1";
|
|
10
|
+
const BUILD_VERSION = "3.2.1";
|
|
11
|
+
const _HTMLTooltip = class _HTMLTooltip extends HTMLWidget {
|
|
9
12
|
constructor() {
|
|
10
13
|
super();
|
|
11
14
|
__publicField(this, "_triggerElement");
|
|
@@ -13,48 +16,78 @@ class HTMLTooltip extends HTMLWidget {
|
|
|
13
16
|
__publicField(this, "_prevContentNode");
|
|
14
17
|
__publicField(this, "_tooltipElement");
|
|
15
18
|
__publicField(this, "_arrowElement");
|
|
16
|
-
__publicField(this, "_tooltipHTMLCallback", (data) => "<b>_tooltipHTMLCallback is undefined</b>");
|
|
19
|
+
__publicField(this, "_tooltipHTMLCallback", /* @__PURE__ */ __name((data) => "<b>_tooltipHTMLCallback is undefined</b>", "_tooltipHTMLCallback"));
|
|
17
20
|
__publicField(this, "_logger", scopedLogger("html/HTMLTooltip"));
|
|
18
21
|
__publicField(this, "_cursorLoc");
|
|
19
|
-
__publicField(this, "_closing",
|
|
20
|
-
this.visible(
|
|
22
|
+
__publicField(this, "_closing", false);
|
|
23
|
+
this.visible(false);
|
|
21
24
|
}
|
|
22
25
|
tooltipHTML(_) {
|
|
23
|
-
|
|
26
|
+
this._tooltipHTMLCallback = _;
|
|
27
|
+
return this;
|
|
24
28
|
}
|
|
25
29
|
tooltipContent(_) {
|
|
26
|
-
|
|
30
|
+
if (!arguments.length) return this._contentNode;
|
|
31
|
+
this._contentNode = _;
|
|
32
|
+
return this;
|
|
27
33
|
}
|
|
28
34
|
triggerElement(_) {
|
|
29
|
-
|
|
35
|
+
this._triggerElement = _;
|
|
36
|
+
return this;
|
|
30
37
|
}
|
|
31
38
|
enter(domNode, element) {
|
|
32
39
|
super.enter(domNode, element);
|
|
33
40
|
const body = select("body");
|
|
34
|
-
this._tooltipElement = body.append("div").attr("class", "tooltip-div").style("z-index", "2147483638").style("position", "fixed")
|
|
41
|
+
this._tooltipElement = body.append("div").attr("class", "tooltip-div").style("z-index", "2147483638").style("position", "fixed");
|
|
42
|
+
this._arrowElement = body.append("div").attr("class", "arrow-div").style("z-index", "2147483638").style("position", "fixed");
|
|
35
43
|
}
|
|
36
44
|
update(domNode, element) {
|
|
37
|
-
|
|
45
|
+
super.update(domNode, element);
|
|
46
|
+
if (this._contentNode !== this._prevContentNode) {
|
|
38
47
|
const node = this._tooltipElement.node();
|
|
39
48
|
[...node.querySelectorAll("*")].map((n) => n.__data__).filter((n) => n).forEach((w) => {
|
|
40
|
-
typeof w.target
|
|
41
|
-
|
|
49
|
+
if (typeof w.target === "function") {
|
|
50
|
+
w.target(null);
|
|
51
|
+
}
|
|
52
|
+
if (typeof w.exit === "function") {
|
|
53
|
+
w.exit();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
node.innerHTML = "";
|
|
57
|
+
node.appendChild(this._contentNode);
|
|
58
|
+
this._prevContentNode = this._contentNode;
|
|
59
|
+
}
|
|
60
|
+
if (this._contentNode) {
|
|
61
|
+
this.onShowContent(this._contentNode);
|
|
62
|
+
} else {
|
|
63
|
+
this._tooltipElement.html(() => {
|
|
64
|
+
return this._tooltipHTMLCallback(this.data());
|
|
65
|
+
});
|
|
42
66
|
}
|
|
43
|
-
if (this.
|
|
67
|
+
if (this.fitContent()) {
|
|
44
68
|
this._tooltipElement.style("width", "auto").style("height", "auto").style("padding", "0px").style("box-sizing", "content-box");
|
|
45
69
|
const rect = this._tooltipElement.node().getBoundingClientRect();
|
|
46
|
-
this.tooltipWidth_default(rect.width)
|
|
70
|
+
this.tooltipWidth_default(rect.width);
|
|
71
|
+
this.tooltipHeight_default(rect.height);
|
|
47
72
|
}
|
|
48
|
-
this._closing =
|
|
73
|
+
this._closing = false;
|
|
74
|
+
this._tooltipElement.style("background-color", this.tooltipColor()).style("color", this.fontColor()).style("width", this.tooltipWidth() + "px").style("height", this.tooltipHeight() + "px").style("opacity", 1).style("padding", this.padding() + "px").style("pointer-events", this.enablePointerEvents() ? "all" : "none").style("box-sizing", "content-box");
|
|
75
|
+
this._arrowElement.style("opacity", 1).style("pointer-events", "none");
|
|
76
|
+
this.updateTooltipPosition();
|
|
49
77
|
}
|
|
50
78
|
onShowContent(node) {
|
|
51
79
|
}
|
|
52
80
|
updateTooltipPosition() {
|
|
53
|
-
const bbox = this.calcReferenceBBox()
|
|
54
|
-
|
|
81
|
+
const bbox = this.calcReferenceBBox();
|
|
82
|
+
const direction = this.calcTooltipDirection(bbox);
|
|
83
|
+
const box = bbox[direction];
|
|
84
|
+
this._tooltipElement.style("top", box.y + "px").style("left", box.x + "px");
|
|
85
|
+
this.setArrowPosition(box, direction);
|
|
86
|
+
return box;
|
|
55
87
|
}
|
|
56
88
|
calcTooltipDirection(bbox) {
|
|
57
|
-
const directions = Object.keys(bbox)
|
|
89
|
+
const directions = Object.keys(bbox);
|
|
90
|
+
const defaultDirection = this.direction();
|
|
58
91
|
directions.sort((a, b) => a === defaultDirection ? -1 : 1);
|
|
59
92
|
const windowRect = {
|
|
60
93
|
top: 0,
|
|
@@ -69,45 +102,84 @@ class HTMLTooltip extends HTMLWidget {
|
|
|
69
102
|
width: this.tooltipWidth(),
|
|
70
103
|
height: this.tooltipHeight()
|
|
71
104
|
};
|
|
72
|
-
if (this.rectFits(tooltipRect, windowRect))
|
|
105
|
+
if (this.rectFits(tooltipRect, windowRect)) {
|
|
73
106
|
return directions[i];
|
|
107
|
+
}
|
|
74
108
|
}
|
|
75
|
-
|
|
109
|
+
this._logger.warning(`Tooltip doesn't fit in the window for any of the directions. Defaulting to '${defaultDirection}'`);
|
|
110
|
+
this._logger.debug(windowRect);
|
|
111
|
+
this._logger.debug({
|
|
76
112
|
top: bbox[defaultDirection].y,
|
|
77
113
|
left: bbox[defaultDirection].x,
|
|
78
114
|
width: this.tooltipWidth(),
|
|
79
115
|
height: this.tooltipHeight()
|
|
80
|
-
})
|
|
116
|
+
});
|
|
117
|
+
return defaultDirection;
|
|
81
118
|
}
|
|
82
119
|
rectFits(innerRect, outerRect) {
|
|
83
120
|
return innerRect.top >= outerRect.top && innerRect.left >= outerRect.left && innerRect.width + innerRect.left <= outerRect.width + outerRect.left && innerRect.height + innerRect.top <= outerRect.height + outerRect.top;
|
|
84
121
|
}
|
|
85
122
|
setArrowPosition(point, direction) {
|
|
86
|
-
let top
|
|
87
|
-
|
|
123
|
+
let top;
|
|
124
|
+
let left;
|
|
125
|
+
let visibleBorderStyle = "border-top-color";
|
|
126
|
+
this._arrowElement.style("border", `${this.arrowHeight()}px solid ${this.tooltipColor()}`).style("border-top-color", "transparent").style("border-right-color", "transparent").style("border-bottom-color", "transparent").style("border-left-color", "transparent");
|
|
127
|
+
switch (direction) {
|
|
88
128
|
case "n":
|
|
89
|
-
top = point.y + this.tooltipHeight() + this.padding() * 2
|
|
129
|
+
top = point.y + this.tooltipHeight() + this.padding() * 2;
|
|
130
|
+
left = point.x + this.tooltipWidth() / 2 - this.arrowWidth() / 2 + this.padding();
|
|
131
|
+
visibleBorderStyle = "border-top-color";
|
|
132
|
+
this._arrowElement.style("border-top-width", `${this.arrowHeight()}px`).style("border-bottom-width", "0px").style("border-left-width", `${this.arrowWidth() / 2}px`).style("border-right-width", `${this.arrowWidth() / 2}px`);
|
|
90
133
|
break;
|
|
91
134
|
case "s":
|
|
92
|
-
top = point.y - this.arrowHeight()
|
|
135
|
+
top = point.y - this.arrowHeight();
|
|
136
|
+
left = point.x + this.padding() + this.tooltipWidth() / 2 - this.arrowWidth() / 2;
|
|
137
|
+
visibleBorderStyle = "border-bottom-color";
|
|
138
|
+
this._arrowElement.style("border-top-width", "0px").style("border-bottom-width", `${this.arrowHeight()}px`).style("border-left-width", `${this.arrowWidth() / 2}px`).style("border-right-width", `${this.arrowWidth() / 2}px`);
|
|
93
139
|
break;
|
|
94
140
|
case "e":
|
|
95
|
-
top = point.y + this.tooltipHeight() / 2 + this.padding() - this.arrowWidth() / 2
|
|
141
|
+
top = point.y + this.tooltipHeight() / 2 + this.padding() - this.arrowWidth() / 2;
|
|
142
|
+
left = point.x - this.arrowHeight();
|
|
143
|
+
visibleBorderStyle = "border-right-color";
|
|
144
|
+
this._arrowElement.style("border-top-width", `${this.arrowWidth() / 2}px`).style("border-bottom-width", `${this.arrowWidth() / 2}px`).style("border-left-width", "0px").style("border-right-width", `${this.arrowHeight()}px`);
|
|
96
145
|
break;
|
|
97
146
|
case "w":
|
|
98
|
-
top = point.y + this.tooltipHeight() / 2 - this.arrowWidth() / 2 + this.padding()
|
|
147
|
+
top = point.y + this.tooltipHeight() / 2 - this.arrowWidth() / 2 + this.padding();
|
|
148
|
+
left = point.x + this.tooltipWidth() + this.padding() * 2;
|
|
149
|
+
visibleBorderStyle = "border-left-color";
|
|
150
|
+
this._arrowElement.style("border-top-width", `${this.arrowWidth() / 2}px`).style("border-bottom-width", `${this.arrowWidth() / 2}px`).style("border-left-width", `${this.arrowHeight()}px`).style("border-right-width", "0px");
|
|
99
151
|
break;
|
|
100
152
|
}
|
|
101
|
-
|
|
153
|
+
if (typeof top !== "undefined" && typeof left !== "undefined") {
|
|
154
|
+
this._arrowElement.style("top", top + "px").style("left", left + "px").style(visibleBorderStyle, this.tooltipColor()).style("opacity", 1);
|
|
155
|
+
} else {
|
|
156
|
+
this._arrowElement.style("opacity", 0);
|
|
157
|
+
}
|
|
158
|
+
return point;
|
|
102
159
|
}
|
|
103
160
|
getReferenceNode() {
|
|
104
|
-
|
|
161
|
+
if (!this._triggerElement) {
|
|
162
|
+
return this.element().node().parentNode.parentNode;
|
|
163
|
+
}
|
|
164
|
+
return this._triggerElement.node();
|
|
105
165
|
}
|
|
106
166
|
calcReferenceBBox() {
|
|
107
167
|
const node = this.getReferenceNode();
|
|
108
168
|
let { top, left, width, height } = node.getBoundingClientRect();
|
|
109
|
-
const wholeW = this.tooltipWidth()
|
|
110
|
-
|
|
169
|
+
const wholeW = this.tooltipWidth();
|
|
170
|
+
const wholeH = this.tooltipHeight();
|
|
171
|
+
const halfW = wholeW / 2;
|
|
172
|
+
const halfH = wholeH / 2;
|
|
173
|
+
const arrowH = this.arrowHeight();
|
|
174
|
+
const p = this.padding();
|
|
175
|
+
const p2 = p * 2;
|
|
176
|
+
if (this.followCursor() && this._cursorLoc) {
|
|
177
|
+
left = this._cursorLoc[0];
|
|
178
|
+
top = this._cursorLoc[1];
|
|
179
|
+
width = 1;
|
|
180
|
+
height = 1;
|
|
181
|
+
}
|
|
182
|
+
const bbox = {
|
|
111
183
|
n: {
|
|
112
184
|
x: left + width / 2 - halfW - p,
|
|
113
185
|
y: top - wholeH - arrowH - p2
|
|
@@ -141,26 +213,44 @@ class HTMLTooltip extends HTMLWidget {
|
|
|
141
213
|
y: top + height
|
|
142
214
|
}
|
|
143
215
|
};
|
|
216
|
+
return bbox;
|
|
144
217
|
}
|
|
145
218
|
mouseout() {
|
|
146
|
-
this._closing =
|
|
147
|
-
|
|
148
|
-
|
|
219
|
+
this._closing = true;
|
|
220
|
+
this._tooltipElement.on("mouseover", () => {
|
|
221
|
+
this._closing = false;
|
|
222
|
+
});
|
|
223
|
+
this._tooltipElement.on("mouseout", () => {
|
|
149
224
|
this.mouseout();
|
|
150
|
-
})
|
|
151
|
-
|
|
225
|
+
});
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
if (this._closing) {
|
|
228
|
+
this.visible(false);
|
|
229
|
+
}
|
|
152
230
|
}, this.closeDelay());
|
|
153
231
|
}
|
|
154
232
|
visible(_) {
|
|
155
|
-
|
|
233
|
+
if (!arguments.length) return super.visible();
|
|
234
|
+
if (this._arrowElement) {
|
|
235
|
+
this._arrowElement.style("visibility", _ ? "visible" : "hidden");
|
|
236
|
+
this._tooltipElement.style("visibility", _ ? "visible" : "hidden");
|
|
237
|
+
}
|
|
238
|
+
super.visible(_);
|
|
239
|
+
return this;
|
|
156
240
|
}
|
|
157
241
|
exit(domNode, element) {
|
|
158
|
-
|
|
242
|
+
if (this._arrowElement) {
|
|
243
|
+
this._arrowElement.remove();
|
|
244
|
+
this._tooltipElement.remove();
|
|
245
|
+
}
|
|
246
|
+
super.exit(domNode, element);
|
|
159
247
|
}
|
|
160
|
-
}
|
|
248
|
+
};
|
|
249
|
+
__name(_HTMLTooltip, "HTMLTooltip");
|
|
250
|
+
let HTMLTooltip = _HTMLTooltip;
|
|
161
251
|
HTMLTooltip.prototype._class += " html_HTMLTooltip";
|
|
162
|
-
HTMLTooltip.prototype.publish("fitContent",
|
|
163
|
-
HTMLTooltip.prototype.publish("followCursor",
|
|
252
|
+
HTMLTooltip.prototype.publish("fitContent", false, "boolean", "If true, tooltip will grow to fit its html content");
|
|
253
|
+
HTMLTooltip.prototype.publish("followCursor", false, "boolean", "If true, tooltip will display relative to cursor location");
|
|
164
254
|
HTMLTooltip.prototype.publish("closeDelay", 400, "number", "Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)");
|
|
165
255
|
HTMLTooltip.prototype.publish("direction", "n", "set", "Direction in which to display the tooltip", ["n", "s", "e", "w", "ne", "nw", "se", "sw"]);
|
|
166
256
|
HTMLTooltip.prototype.publish("padding", 8, "number", "Padding (pixels)");
|
|
@@ -170,8 +260,8 @@ HTMLTooltip.prototype.publish("fontColor", "#FFF", "html-color", "The default fo
|
|
|
170
260
|
HTMLTooltip.prototype.publish("tooltipColor", "#000000EE", "html-color", "Background color of the tooltip");
|
|
171
261
|
HTMLTooltip.prototype.publish("tooltipWidth", 200, "number", "Width of the tooltip (not including arrow) (pixels)");
|
|
172
262
|
HTMLTooltip.prototype.publish("tooltipHeight", 200, "number", "Height of the tooltip (not including arrow) (pixels)");
|
|
173
|
-
HTMLTooltip.prototype.publish("enablePointerEvents",
|
|
174
|
-
class
|
|
263
|
+
HTMLTooltip.prototype.publish("enablePointerEvents", false, "boolean", "If true, the 'pointer-events: all' style will be used");
|
|
264
|
+
const _SimpleTable = class _SimpleTable extends HTMLWidget {
|
|
175
265
|
constructor() {
|
|
176
266
|
super();
|
|
177
267
|
__publicField(this, "_table");
|
|
@@ -183,22 +273,33 @@ class SimpleTable extends HTMLWidget {
|
|
|
183
273
|
return this.data();
|
|
184
274
|
}
|
|
185
275
|
enter(domNode, element) {
|
|
186
|
-
super.enter(domNode, element)
|
|
276
|
+
super.enter(domNode, element);
|
|
277
|
+
this._table = element.append("table");
|
|
278
|
+
this._thead = this._table.append("thead");
|
|
279
|
+
this._theadRow = this._thead.append("tr");
|
|
280
|
+
this._tbody = this._table.append("tbody");
|
|
187
281
|
}
|
|
188
282
|
update(domNode, element) {
|
|
189
|
-
super.update(domNode, element)
|
|
283
|
+
super.update(domNode, element);
|
|
284
|
+
this._table.style("width", this.autoWidth() ? "auto" : "100%");
|
|
190
285
|
const theadTrSelection = this._theadRow.selectAll("th").data(this.columns());
|
|
191
|
-
theadTrSelection.enter().append("th").attr("class", (n, i) => `th-${i}`).merge(theadTrSelection).text((_d) => _d.toString())
|
|
286
|
+
theadTrSelection.enter().append("th").attr("class", (n, i) => `th-${i}`).merge(theadTrSelection).text((_d) => _d.toString());
|
|
287
|
+
theadTrSelection.exit().remove();
|
|
192
288
|
const trSelection = this._tbody.selectAll("tr").data(this.transformData());
|
|
193
289
|
trSelection.enter().append("tr").merge(trSelection).each(function(d) {
|
|
194
|
-
const
|
|
195
|
-
tdSelection.
|
|
196
|
-
|
|
290
|
+
const tr = select(this);
|
|
291
|
+
const tdSelection = tr.selectAll("td").data(d);
|
|
292
|
+
tdSelection.enter().append("td").attr("class", (n, i) => `col-${i}`).merge(tdSelection).text((_d) => _d.toString());
|
|
293
|
+
tdSelection.exit().remove();
|
|
294
|
+
});
|
|
295
|
+
trSelection.exit().remove();
|
|
197
296
|
}
|
|
198
|
-
}
|
|
297
|
+
};
|
|
298
|
+
__name(_SimpleTable, "SimpleTable");
|
|
299
|
+
let SimpleTable = _SimpleTable;
|
|
199
300
|
SimpleTable.prototype._class += " html_SimpleTable";
|
|
200
|
-
SimpleTable.prototype.publish("autoWidth",
|
|
201
|
-
class
|
|
301
|
+
SimpleTable.prototype.publish("autoWidth", false, "boolean", "If true, table width will be set to 'auto'. If false, the width is set to '100%'");
|
|
302
|
+
const _StyledTable = class _StyledTable extends SimpleTable {
|
|
202
303
|
constructor() {
|
|
203
304
|
super();
|
|
204
305
|
}
|
|
@@ -208,12 +309,17 @@ class StyledTable extends SimpleTable {
|
|
|
208
309
|
});
|
|
209
310
|
}
|
|
210
311
|
update(domNode, element) {
|
|
211
|
-
super.update(domNode, element)
|
|
312
|
+
super.update(domNode, element);
|
|
313
|
+
element.selectAll("tr,th,td").attr("style", "").style("font-family", this.fontFamily()).style("color", this.fontColor());
|
|
314
|
+
this.theadColumnStyles().forEach((styleObj, i) => {
|
|
212
315
|
this.applyStyleObject(element.select(`.th-${i}`), styleObj);
|
|
213
|
-
})
|
|
316
|
+
});
|
|
317
|
+
this.tbodyColumnStyles().forEach((styleObj, i) => {
|
|
214
318
|
this.applyStyleObject(element.selectAll(`.col-${i}`), styleObj);
|
|
215
319
|
});
|
|
216
|
-
const evenRowStylesExist = Object.keys(this.evenRowStyles()).length > 0
|
|
320
|
+
const evenRowStylesExist = Object.keys(this.evenRowStyles()).length > 0;
|
|
321
|
+
const lastRowStylesExist = Object.keys(this.lastRowStyles()).length > 0;
|
|
322
|
+
const tbodyRows = element.selectAll("tbody > tr");
|
|
217
323
|
if (evenRowStylesExist) {
|
|
218
324
|
const tbodyEvenRows = tbodyRows.select(function(d, i) {
|
|
219
325
|
return i % 2 ? this : null;
|
|
@@ -227,7 +333,9 @@ class StyledTable extends SimpleTable {
|
|
|
227
333
|
this.applyStyleObject(tbodyLastRow, this.lastRowStyles());
|
|
228
334
|
}
|
|
229
335
|
}
|
|
230
|
-
}
|
|
336
|
+
};
|
|
337
|
+
__name(_StyledTable, "StyledTable");
|
|
338
|
+
let StyledTable = _StyledTable;
|
|
231
339
|
StyledTable.prototype._class += " html_StyledTable";
|
|
232
340
|
StyledTable.prototype.publish("fontFamily", "Verdana", "string", "Base font-family used within the table");
|
|
233
341
|
StyledTable.prototype.publish("fontColor", "#333", "string", "Base font color used within the table");
|
|
@@ -235,7 +343,7 @@ StyledTable.prototype.publish("theadColumnStyles", [], "array", 'Array of object
|
|
|
235
343
|
StyledTable.prototype.publish("tbodyColumnStyles", [], "array", 'Array of objects containing styles for the tbody columns (ex: [{"color":"red"},{"color":"blue"}])');
|
|
236
344
|
StyledTable.prototype.publish("lastRowStyles", {}, "object", 'Object containing styles for the last row (ex: {"color":"red"})');
|
|
237
345
|
StyledTable.prototype.publish("evenRowStyles", {}, "object", 'Object containing styles for even rows (ex: {"background-color":"#AAA"})');
|
|
238
|
-
class
|
|
346
|
+
const _BreakdownTable = class _BreakdownTable extends StyledTable {
|
|
239
347
|
constructor() {
|
|
240
348
|
super();
|
|
241
349
|
// protected _table;
|
|
@@ -247,27 +355,45 @@ class BreakdownTable extends StyledTable {
|
|
|
247
355
|
return this.breakdownData(rowCount);
|
|
248
356
|
}
|
|
249
357
|
breakdownData(limit) {
|
|
250
|
-
const len = this.data().length
|
|
358
|
+
const len = this.data().length;
|
|
359
|
+
const sum = this.data().reduce((acc, row) => acc + row[1], 0);
|
|
360
|
+
const data = [];
|
|
251
361
|
let percSum = 0;
|
|
252
362
|
this.data().sort((a, b) => a[1] > b[1] ? -1 : 1);
|
|
253
|
-
const
|
|
254
|
-
|
|
363
|
+
const hiddenRowCount = len - limit;
|
|
364
|
+
const showOther = hiddenRowCount > 0;
|
|
365
|
+
this.data().filter((_, i) => showOther ? i < limit - 1 : true).forEach((row) => {
|
|
255
366
|
const perc = Math.round(row[1] / sum * 100);
|
|
256
|
-
percSum += perc
|
|
257
|
-
|
|
258
|
-
|
|
367
|
+
percSum += perc;
|
|
368
|
+
data.push([row[0], perc + "%"]);
|
|
369
|
+
});
|
|
370
|
+
if (showOther) {
|
|
371
|
+
const otherLabel = `${this.otherLabel()} (${len - limit + 1})`;
|
|
372
|
+
const otherPercentage = "~" + (100 - percSum) + "%";
|
|
259
373
|
data.push([otherLabel, otherPercentage]);
|
|
260
374
|
}
|
|
261
375
|
return data;
|
|
262
376
|
}
|
|
263
377
|
calculateRowCount() {
|
|
264
|
-
const theadRowHeight = this.columns().length > 0 ? this.thFontSize() + 5 : 0
|
|
265
|
-
|
|
378
|
+
const theadRowHeight = this.columns().length > 0 ? this.thFontSize() + 5 : 0;
|
|
379
|
+
const tbodyRowHeight = this.fontSize() + 5;
|
|
380
|
+
const tbodyAvailableHeight = this.height() - theadRowHeight;
|
|
381
|
+
const rowCount = Math.floor(tbodyAvailableHeight / tbodyRowHeight);
|
|
382
|
+
return rowCount;
|
|
266
383
|
}
|
|
267
384
|
enter(domNode, element) {
|
|
268
|
-
super.enter(domNode, element)
|
|
269
|
-
|
|
270
|
-
|
|
385
|
+
super.enter(domNode, element);
|
|
386
|
+
this._tooltip = new HTMLTooltip().target(domNode);
|
|
387
|
+
this._tooltip.tooltipHTML((data) => {
|
|
388
|
+
const rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
|
|
389
|
+
const rowHeight = Math.max(...data.map((row) => this.textSize(row[0], this.fontFamily(), this.fontSize()).height)) ?? this.fontSize();
|
|
390
|
+
const widestLabel = Math.max(...data.map((row) => this.textSize(row[0], this.fontFamily(), this.fontSize()).width));
|
|
391
|
+
const widestPerc = 30;
|
|
392
|
+
const colCount = 2;
|
|
393
|
+
const w = colCount * (widestLabel + widestPerc) + this._tooltip.padding() * 2;
|
|
394
|
+
const h = rowHeight * Math.ceil((data.length - rowCount) / colCount) + this._tooltip.padding() * 2;
|
|
395
|
+
this._tooltip.tooltipWidth(w);
|
|
396
|
+
this._tooltip.tooltipHeight(h);
|
|
271
397
|
const otherData = this.breakdownData(this.data().length).slice(rowCount - 1);
|
|
272
398
|
return `<div style="
|
|
273
399
|
width: 100%;
|
|
@@ -282,85 +408,95 @@ class BreakdownTable extends StyledTable {
|
|
|
282
408
|
});
|
|
283
409
|
}
|
|
284
410
|
update(domNode, element) {
|
|
285
|
-
|
|
411
|
+
this.theadColumnStyles_default([
|
|
286
412
|
{
|
|
287
|
-
color: this.thFirstColor(),
|
|
413
|
+
"color": this.thFirstColor(),
|
|
288
414
|
"font-size": this.thFontSize() + "px",
|
|
289
415
|
"font-weight": this.thFontWeight(),
|
|
290
416
|
"text-align": this.labelAlignment(),
|
|
291
|
-
width: "auto",
|
|
292
|
-
padding: "0px"
|
|
417
|
+
"width": "auto",
|
|
418
|
+
"padding": "0px"
|
|
293
419
|
},
|
|
294
420
|
{
|
|
295
|
-
width: "1%",
|
|
421
|
+
"width": "1%",
|
|
296
422
|
"font-size": this.thFontSize() + "px",
|
|
297
423
|
"font-weight": this.thFontWeight(),
|
|
298
424
|
"text-align": this.percentageAlignment(),
|
|
299
|
-
padding: "0px"
|
|
425
|
+
"padding": "0px"
|
|
300
426
|
}
|
|
301
|
-
])
|
|
427
|
+
]);
|
|
428
|
+
this.tbodyColumnStyles_default([
|
|
302
429
|
{
|
|
303
|
-
color: this.topLabelColor(),
|
|
430
|
+
"color": this.topLabelColor(),
|
|
304
431
|
"font-size": this.fontSize() + "px",
|
|
305
432
|
"font-weight": "normal",
|
|
306
433
|
"text-align": this.labelAlignment(),
|
|
307
|
-
width: "auto",
|
|
308
|
-
padding: "0px"
|
|
434
|
+
"width": "auto",
|
|
435
|
+
"padding": "0px"
|
|
309
436
|
},
|
|
310
437
|
{
|
|
311
|
-
color: this.topPercentageColor(),
|
|
438
|
+
"color": this.topPercentageColor(),
|
|
312
439
|
"font-size": this.fontSize() + "px",
|
|
313
440
|
"font-weight": "normal",
|
|
314
441
|
"text-align": this.percentageAlignment(),
|
|
315
|
-
width: "1%",
|
|
316
|
-
padding: "0px"
|
|
442
|
+
"width": "1%",
|
|
443
|
+
"padding": "0px"
|
|
317
444
|
}
|
|
318
|
-
])
|
|
445
|
+
]);
|
|
446
|
+
this.lastRowStyles_default([
|
|
319
447
|
{
|
|
320
|
-
color: this.otherLabelColor(),
|
|
448
|
+
"color": this.otherLabelColor(),
|
|
321
449
|
"font-size": this.fontSize() + "px",
|
|
322
450
|
"font-weight": this.otherLabelBold() ? "bold" : "normal",
|
|
323
451
|
"text-align": this.labelAlignment(),
|
|
324
|
-
width: "auto",
|
|
325
|
-
padding: "0px"
|
|
452
|
+
"width": "auto",
|
|
453
|
+
"padding": "0px"
|
|
326
454
|
},
|
|
327
455
|
{
|
|
328
|
-
color: this.otherLabelColor(),
|
|
456
|
+
"color": this.otherLabelColor(),
|
|
329
457
|
"font-size": this.fontSize() + "px",
|
|
330
458
|
"font-weight": this.otherPercentageBold() ? "bold" : "normal",
|
|
331
459
|
"text-align": this.percentageAlignment(),
|
|
332
|
-
width: "1%",
|
|
333
|
-
padding: "0px"
|
|
460
|
+
"width": "1%",
|
|
461
|
+
"padding": "0px"
|
|
334
462
|
}
|
|
335
|
-
])
|
|
336
|
-
|
|
463
|
+
]);
|
|
464
|
+
super.update(domNode, element);
|
|
465
|
+
const rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
|
|
466
|
+
if (rowCount < this.data().length) {
|
|
467
|
+
const lastRow = element.select("tbody > tr:last-child");
|
|
468
|
+
const context = this;
|
|
337
469
|
lastRow.on("mouseout.tooltip", (d) => {
|
|
338
|
-
context._tooltip._triggerElement = lastRow
|
|
470
|
+
context._tooltip._triggerElement = lastRow;
|
|
471
|
+
context._tooltip.visible(false).render();
|
|
339
472
|
}).on("mouseenter.tooltip", (d) => {
|
|
340
|
-
context._tooltip._triggerElement = lastRow
|
|
473
|
+
context._tooltip._triggerElement = lastRow;
|
|
474
|
+
context._tooltip.direction("n").data(context.data()).visible(true).render();
|
|
341
475
|
});
|
|
342
476
|
}
|
|
343
477
|
}
|
|
344
|
-
}
|
|
478
|
+
};
|
|
479
|
+
__name(_BreakdownTable, "BreakdownTable");
|
|
480
|
+
let BreakdownTable = _BreakdownTable;
|
|
345
481
|
BreakdownTable.prototype._class += " html_BreakdownTable";
|
|
346
|
-
BreakdownTable.prototype.publish("useCalculatedRowCount",
|
|
347
|
-
BreakdownTable.prototype.publish("rowCount", 5, "number", "Number of total rows to display (including the 'other' row)", void 0, { disable: (w) => w.useCalculatedRowCount() });
|
|
482
|
+
BreakdownTable.prototype.publish("useCalculatedRowCount", true, "boolean", "If true, rowCount will be calculated and its default will be overwritten");
|
|
483
|
+
BreakdownTable.prototype.publish("rowCount", 5, "number", "Number of total rows to display (including the 'other' row)", void 0, { disable: /* @__PURE__ */ __name((w) => w.useCalculatedRowCount(), "disable") });
|
|
348
484
|
BreakdownTable.prototype.publish("fontSize", 14, "number", "Font size (pixels)");
|
|
349
485
|
BreakdownTable.prototype.publish("labelAlignment", "left", "set", "Alignment of the label column text", ["left", "center", "right"]);
|
|
350
486
|
BreakdownTable.prototype.publish("percentageAlignment", "center", "set", "Alignment of the percentage column text", ["left", "center", "right"]);
|
|
351
487
|
BreakdownTable.prototype.publish("topLabelColor", "#333", "html-color", "Color of displayed 'top' labels");
|
|
352
488
|
BreakdownTable.prototype.publish("topPercentageColor", "#1A99D5", "html-color", "Color of displayed 'top' percentages");
|
|
353
|
-
BreakdownTable.prototype.publish("topPercentageBold",
|
|
489
|
+
BreakdownTable.prototype.publish("topPercentageBold", true, "html-color", "If true, the 'top' percentages will be bold");
|
|
354
490
|
BreakdownTable.prototype.publish("otherLabel", "Other", "string", "Label text for the 'other' row");
|
|
355
491
|
BreakdownTable.prototype.publish("otherLabelColor", "#AAA", "html-color", "Color of the 'other' label");
|
|
356
|
-
BreakdownTable.prototype.publish("otherLabelBold",
|
|
492
|
+
BreakdownTable.prototype.publish("otherLabelBold", false, "html-color", "If true, the 'other' label will be bold");
|
|
357
493
|
BreakdownTable.prototype.publish("otherPercentageColor", "#AAA", "html-color", "Color of the 'other' percentage");
|
|
358
|
-
BreakdownTable.prototype.publish("otherPercentageBold",
|
|
494
|
+
BreakdownTable.prototype.publish("otherPercentageBold", false, "html-color", "If true, the 'other' percentage will be bold");
|
|
359
495
|
BreakdownTable.prototype.publish("thFontWeight", "bold", "string", "Font weight for th elements");
|
|
360
496
|
BreakdownTable.prototype.publish("thFontSize", 26, "number", "Font size for th elements");
|
|
361
497
|
BreakdownTable.prototype.publish("thFirstColor", "#333", "html-color", "Text color of the first th element");
|
|
362
498
|
BreakdownTable.prototype.publish("thLastColor", "#333", "html-color", "Text color of the last th element");
|
|
363
|
-
class
|
|
499
|
+
const _JSXWidget = class _JSXWidget extends HTMLWidget {
|
|
364
500
|
constructor() {
|
|
365
501
|
super(...arguments);
|
|
366
502
|
__publicField(this, "rootNode");
|
|
@@ -368,14 +504,18 @@ class JSXWidget extends HTMLWidget {
|
|
|
368
504
|
jsxRender(jsx, domNode) {
|
|
369
505
|
this.rootNode = React.render(jsx, domNode, this.rootNode);
|
|
370
506
|
}
|
|
371
|
-
}
|
|
372
|
-
|
|
507
|
+
};
|
|
508
|
+
__name(_JSXWidget, "JSXWidget");
|
|
509
|
+
__publicField(_JSXWidget, "Component", React.Component);
|
|
510
|
+
__publicField(_JSXWidget, "createElement", React.createElement);
|
|
511
|
+
let JSXWidget = _JSXWidget;
|
|
373
512
|
JSXWidget.prototype._class += " html_JSXWidget";
|
|
374
|
-
class
|
|
513
|
+
const _VNode = class _VNode {
|
|
375
514
|
constructor(attrs, children) {
|
|
376
515
|
__publicField(this, "_attrs");
|
|
377
516
|
__publicField(this, "_children");
|
|
378
|
-
this._attrs = attrs
|
|
517
|
+
this._attrs = attrs;
|
|
518
|
+
this._children = children;
|
|
379
519
|
}
|
|
380
520
|
type() {
|
|
381
521
|
return "div";
|
|
@@ -390,25 +530,32 @@ class VNode {
|
|
|
390
530
|
return this._children;
|
|
391
531
|
}
|
|
392
532
|
update(targetElement) {
|
|
393
|
-
for (const key in this._attrs)
|
|
533
|
+
for (const key in this._attrs) {
|
|
394
534
|
targetElement.attr(key, this._attrs[key]);
|
|
535
|
+
}
|
|
395
536
|
}
|
|
396
537
|
render(targetElement) {
|
|
397
538
|
const thisElement = targetElement.selectAll(`${targetElement.node().tagName} > *`).data([this]);
|
|
398
|
-
|
|
539
|
+
thisElement.exit().remove();
|
|
540
|
+
return thisElement.enter().append(this.type()).attr("reactd3", 0).merge(thisElement).each(function(d) {
|
|
399
541
|
const element = select(this);
|
|
400
|
-
d.update(element)
|
|
542
|
+
d.update(element);
|
|
543
|
+
d.renderChildren(element);
|
|
401
544
|
});
|
|
402
545
|
}
|
|
403
546
|
renderChildren(targetElement) {
|
|
404
547
|
const thisElement = targetElement.selectAll(`${targetElement.node().tagName} > *`).data(this._children);
|
|
405
|
-
|
|
548
|
+
thisElement.exit().remove();
|
|
549
|
+
return thisElement.enter().append((d) => document.createElement(d.type())).attr("reactd3", (_d, i) => i).merge(thisElement).each(function(d) {
|
|
406
550
|
const element = select(this);
|
|
407
|
-
d.update(element)
|
|
551
|
+
d.update(element);
|
|
552
|
+
d.renderChildren(element);
|
|
408
553
|
});
|
|
409
554
|
}
|
|
410
|
-
}
|
|
411
|
-
|
|
555
|
+
};
|
|
556
|
+
__name(_VNode, "VNode");
|
|
557
|
+
let VNode = _VNode;
|
|
558
|
+
const _ConstVNode = class _ConstVNode extends VNode {
|
|
412
559
|
constructor(type, attrs, children) {
|
|
413
560
|
super(attrs, children);
|
|
414
561
|
__publicField(this, "_type");
|
|
@@ -417,8 +564,10 @@ class ConstVNode extends VNode {
|
|
|
417
564
|
type() {
|
|
418
565
|
return this._type;
|
|
419
566
|
}
|
|
420
|
-
}
|
|
421
|
-
|
|
567
|
+
};
|
|
568
|
+
__name(_ConstVNode, "ConstVNode");
|
|
569
|
+
let ConstVNode = _ConstVNode;
|
|
570
|
+
const _TextVNode = class _TextVNode extends VNode {
|
|
422
571
|
constructor(text) {
|
|
423
572
|
super({}, []);
|
|
424
573
|
__publicField(this, "_text");
|
|
@@ -428,52 +577,75 @@ class TextVNode extends VNode {
|
|
|
428
577
|
return "span";
|
|
429
578
|
}
|
|
430
579
|
update(targetElement) {
|
|
431
|
-
super.update(targetElement)
|
|
580
|
+
super.update(targetElement);
|
|
581
|
+
targetElement.text(this._text);
|
|
432
582
|
}
|
|
433
|
-
}
|
|
583
|
+
};
|
|
584
|
+
__name(_TextVNode, "TextVNode");
|
|
585
|
+
let TextVNode = _TextVNode;
|
|
434
586
|
function isReactFn(_) {
|
|
435
|
-
return typeof _
|
|
587
|
+
return typeof _ === "function";
|
|
436
588
|
}
|
|
589
|
+
__name(isReactFn, "isReactFn");
|
|
437
590
|
function isIVNode(_) {
|
|
438
591
|
return _.prototype && _.prototype instanceof VNode;
|
|
439
592
|
}
|
|
440
|
-
|
|
593
|
+
__name(isIVNode, "isIVNode");
|
|
594
|
+
const _ReactD3 = class _ReactD3 {
|
|
441
595
|
// static createElementXXX(type: string | ReactFn | IVNode, attrs: { [key: string]: string }, ...children: Array<string | VNode>): VNode {
|
|
442
596
|
static createElement(type, attrs, ...children) {
|
|
443
|
-
|
|
597
|
+
if (isIVNode(type)) {
|
|
598
|
+
return new type(attrs);
|
|
599
|
+
} else if (isReactFn(type)) {
|
|
600
|
+
return type(attrs);
|
|
601
|
+
}
|
|
602
|
+
return new ConstVNode(type, attrs, children.map((child) => {
|
|
603
|
+
if (typeof child === "string") {
|
|
604
|
+
return new TextVNode(child);
|
|
605
|
+
}
|
|
606
|
+
return child;
|
|
607
|
+
}));
|
|
444
608
|
}
|
|
445
609
|
static render(vdom, targetElement) {
|
|
446
610
|
vdom.render(targetElement);
|
|
447
611
|
}
|
|
448
|
-
}
|
|
612
|
+
};
|
|
613
|
+
__name(_ReactD3, "ReactD3");
|
|
614
|
+
let ReactD3 = _ReactD3;
|
|
449
615
|
var l;
|
|
450
|
-
l = { __e: function(n, l2, u2, t) {
|
|
616
|
+
l = { __e: /* @__PURE__ */ __name(function(n, l2, u2, t) {
|
|
451
617
|
for (var i, r, o; l2 = l2.__; ) if ((i = l2.__c) && !i.__) try {
|
|
452
|
-
if ((r = i.constructor) && r.getDerivedStateFromError
|
|
618
|
+
if ((r = i.constructor) && null != r.getDerivedStateFromError && (i.setState(r.getDerivedStateFromError(n)), o = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), o = i.__d), o) return i.__E = i;
|
|
453
619
|
} catch (l3) {
|
|
454
620
|
n = l3;
|
|
455
621
|
}
|
|
456
622
|
throw n;
|
|
457
|
-
} },
|
|
623
|
+
}, "__e") }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout;
|
|
458
624
|
var f = 0;
|
|
459
625
|
function u(e, t, n, o, i, u2) {
|
|
460
626
|
t || (t = {});
|
|
461
627
|
var a, c, p = t;
|
|
462
|
-
if ("ref" in p) for (c in p = {}, t)
|
|
628
|
+
if ("ref" in p) for (c in p = {}, t) "ref" == c ? a = t[c] : p[c] = t[c];
|
|
463
629
|
var l$1 = { type: e, props: p, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f, __i: -1, __u: 0, __source: i, __self: u2 };
|
|
464
630
|
return l.vnode && l.vnode(l$1), l$1;
|
|
465
631
|
}
|
|
466
|
-
|
|
632
|
+
__name(u, "u");
|
|
633
|
+
const _VizComponent = class _VizComponent extends JSXWidget.Component {
|
|
467
634
|
constructor() {
|
|
468
635
|
super(...arguments);
|
|
469
636
|
__publicField(this, "widget");
|
|
470
637
|
}
|
|
471
638
|
refreshProps() {
|
|
472
|
-
for (const key in this.props)
|
|
473
|
-
this.widget[key] && typeof this.widget[key]
|
|
639
|
+
for (const key in this.props) {
|
|
640
|
+
if (this.widget[key] && typeof this.widget[key] === "function") {
|
|
641
|
+
this.widget[key](this.props[key]);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
474
644
|
}
|
|
475
645
|
componentDidMount() {
|
|
476
|
-
this.widget = new this.props.type().target(this.base)
|
|
646
|
+
this.widget = new this.props.type().target(this.base);
|
|
647
|
+
this.refreshProps();
|
|
648
|
+
this.widget.render();
|
|
477
649
|
}
|
|
478
650
|
componentWillUnmount() {
|
|
479
651
|
this.widget.target(null).render();
|
|
@@ -482,20 +654,28 @@ class VizComponent extends JSXWidget.Component {
|
|
|
482
654
|
return /* @__PURE__ */ u("div", { style: this.props.style });
|
|
483
655
|
}
|
|
484
656
|
componentDidUpdate() {
|
|
485
|
-
this.refreshProps()
|
|
657
|
+
this.refreshProps();
|
|
658
|
+
this.widget.render();
|
|
486
659
|
}
|
|
487
|
-
}
|
|
488
|
-
|
|
660
|
+
};
|
|
661
|
+
__name(_VizComponent, "VizComponent");
|
|
662
|
+
let VizComponent = _VizComponent;
|
|
663
|
+
const _VizInstance = class _VizInstance extends JSXWidget.Component {
|
|
489
664
|
constructor() {
|
|
490
665
|
super(...arguments);
|
|
491
666
|
__publicField(this, "widget");
|
|
492
667
|
}
|
|
493
668
|
refreshProps() {
|
|
494
|
-
for (const key in this.props)
|
|
495
|
-
this.widget[key] && typeof this.widget[key]
|
|
669
|
+
for (const key in this.props) {
|
|
670
|
+
if (this.widget[key] && typeof this.widget[key] === "function") {
|
|
671
|
+
this.widget[key](this.props[key]);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
496
674
|
}
|
|
497
675
|
componentDidMount() {
|
|
498
|
-
this.widget = this.props.instance.target(this.base)
|
|
676
|
+
this.widget = this.props.instance.target(this.base);
|
|
677
|
+
this.refreshProps();
|
|
678
|
+
this.widget.render();
|
|
499
679
|
}
|
|
500
680
|
componentWillUnmount() {
|
|
501
681
|
this.widget.target(null).render();
|
|
@@ -504,60 +684,73 @@ class VizInstance extends JSXWidget.Component {
|
|
|
504
684
|
return /* @__PURE__ */ u("div", { style: this.props.style });
|
|
505
685
|
}
|
|
506
686
|
componentDidUpdate() {
|
|
507
|
-
this.refreshProps()
|
|
687
|
+
this.refreshProps();
|
|
688
|
+
this.widget.render();
|
|
508
689
|
}
|
|
509
|
-
}
|
|
510
|
-
|
|
690
|
+
};
|
|
691
|
+
__name(_VizInstance, "VizInstance");
|
|
692
|
+
let VizInstance = _VizInstance;
|
|
693
|
+
const _StatsTable = class _StatsTable extends StyledTable {
|
|
511
694
|
transformData() {
|
|
512
|
-
const totalRow = [["Total", 0, 0]]
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
695
|
+
const totalRow = [["Total", 0, 0]];
|
|
696
|
+
const data = this.data();
|
|
697
|
+
data.forEach((row) => {
|
|
698
|
+
totalRow[0][1] += row[1];
|
|
699
|
+
totalRow[0][2] += row[2];
|
|
700
|
+
});
|
|
701
|
+
return data.concat(totalRow).map((row) => {
|
|
702
|
+
return [
|
|
703
|
+
row[0],
|
|
704
|
+
this.secondColumnFormat_exists() ? format(this.secondColumnFormat())(row[1]) : row[1],
|
|
705
|
+
this.thirdColumnFormat_exists() ? format(this.thirdColumnFormat())(row[2]) : row[2]
|
|
706
|
+
];
|
|
707
|
+
});
|
|
520
708
|
}
|
|
521
709
|
update(domNode, element) {
|
|
522
710
|
this.tbodyColumnStyles_default([
|
|
523
711
|
{
|
|
524
712
|
"font-weight": "bold",
|
|
525
|
-
width: this.firstColumnWidth(),
|
|
713
|
+
"width": this.firstColumnWidth(),
|
|
526
714
|
"text-align": "left"
|
|
527
715
|
},
|
|
528
716
|
{
|
|
529
|
-
width: this.secondColumnWidth(),
|
|
717
|
+
"width": this.secondColumnWidth(),
|
|
530
718
|
"text-align": "right"
|
|
531
719
|
},
|
|
532
720
|
{
|
|
533
|
-
width: this.thirdColumnWidth(),
|
|
721
|
+
"width": this.thirdColumnWidth(),
|
|
534
722
|
"text-align": "right"
|
|
535
723
|
}
|
|
536
|
-
])
|
|
724
|
+
]);
|
|
725
|
+
this.evenRowStyles_default([
|
|
537
726
|
{
|
|
538
727
|
"font-weight": "bold",
|
|
539
|
-
width: this.firstColumnWidth(),
|
|
728
|
+
"width": this.firstColumnWidth(),
|
|
540
729
|
"text-align": "left",
|
|
541
730
|
"font-color": this.evenRowFontColor(),
|
|
542
731
|
"background-color": this.evenRowBackgroundColor()
|
|
543
732
|
},
|
|
544
733
|
{
|
|
545
|
-
width: this.secondColumnWidth(),
|
|
734
|
+
"width": this.secondColumnWidth(),
|
|
546
735
|
"text-align": "right",
|
|
547
736
|
"font-color": this.evenRowFontColor(),
|
|
548
737
|
"background-color": this.evenRowBackgroundColor()
|
|
549
738
|
},
|
|
550
739
|
{
|
|
551
|
-
width: this.thirdColumnWidth(),
|
|
740
|
+
"width": this.thirdColumnWidth(),
|
|
552
741
|
"text-align": "right",
|
|
553
742
|
"font-color": this.evenRowFontColor(),
|
|
554
743
|
"background-color": this.evenRowBackgroundColor()
|
|
555
744
|
}
|
|
556
|
-
])
|
|
745
|
+
]);
|
|
746
|
+
this.lastRowStyles_default({
|
|
557
747
|
"font-weight": "bold"
|
|
558
|
-
})
|
|
748
|
+
});
|
|
749
|
+
super.update(domNode, element);
|
|
559
750
|
}
|
|
560
|
-
}
|
|
751
|
+
};
|
|
752
|
+
__name(_StatsTable, "StatsTable");
|
|
753
|
+
let StatsTable = _StatsTable;
|
|
561
754
|
StatsTable.prototype._class += " html_StatsTable";
|
|
562
755
|
StatsTable.prototype.publish("labelColor", "#333", "html-color", "Color of the text in the first column");
|
|
563
756
|
StatsTable.prototype.publish("primaryValueColor", "#333", "html-color", "Color of the text in the second column");
|
|
@@ -567,17 +760,20 @@ StatsTable.prototype.publish("evenRowFontColor", "#333", "html-color", "Font col
|
|
|
567
760
|
StatsTable.prototype.publish("firstColumnWidth", "auto", "string", "CSS style applied as the 'width' for the first column (ex: 40px)");
|
|
568
761
|
StatsTable.prototype.publish("secondColumnWidth", "1%", "string", "CSS style applied as the 'width' for the second column (ex: 40px)");
|
|
569
762
|
StatsTable.prototype.publish("thirdColumnWidth", "1%", "string", "CSS style applied as the 'width' for the third column (ex: 40px)");
|
|
570
|
-
StatsTable.prototype.publish("secondColumnFormat", "$,.0f", "string", "d3-format specifier applied to the second column's values", void 0, { optional:
|
|
571
|
-
StatsTable.prototype.publish("thirdColumnFormat", null, "string", "d3-format specifier applied to the third column's values", void 0, { optional:
|
|
572
|
-
class
|
|
763
|
+
StatsTable.prototype.publish("secondColumnFormat", "$,.0f", "string", "d3-format specifier applied to the second column's values", void 0, { optional: true });
|
|
764
|
+
StatsTable.prototype.publish("thirdColumnFormat", null, "string", "d3-format specifier applied to the third column's values", void 0, { optional: true });
|
|
765
|
+
const _Item = class _Item extends HTMLWidget {
|
|
573
766
|
constructor(owner) {
|
|
574
767
|
super();
|
|
575
768
|
__publicField(this, "_owner");
|
|
576
|
-
this._owner = owner
|
|
769
|
+
this._owner = owner;
|
|
770
|
+
this._tag = "a";
|
|
577
771
|
}
|
|
578
|
-
}
|
|
772
|
+
};
|
|
773
|
+
__name(_Item, "Item");
|
|
774
|
+
let Item = _Item;
|
|
579
775
|
Item.prototype._class += " html_Item";
|
|
580
|
-
class
|
|
776
|
+
const _Button = class _Button extends Item {
|
|
581
777
|
constructor(owner, icon) {
|
|
582
778
|
super(owner);
|
|
583
779
|
__publicField(this, "_icon");
|
|
@@ -587,29 +783,40 @@ class Button extends Item {
|
|
|
587
783
|
return this._icon;
|
|
588
784
|
}
|
|
589
785
|
enter(domNode, element) {
|
|
590
|
-
super.enter(domNode, element)
|
|
786
|
+
super.enter(domNode, element);
|
|
787
|
+
element.attr("href", "#").on("click", (d, idx, groups) => this._owner.titleBarClick(this, d, idx, groups)).append("i").attr("class", `fa ${this._icon} fa-lg fa-fw`);
|
|
591
788
|
}
|
|
592
|
-
}
|
|
789
|
+
};
|
|
790
|
+
__name(_Button, "Button");
|
|
791
|
+
let Button = _Button;
|
|
593
792
|
Button.prototype._class += " html_Button";
|
|
594
|
-
class
|
|
793
|
+
const _ToggleButton = class _ToggleButton extends Button {
|
|
595
794
|
enter(domNode, element) {
|
|
596
795
|
element.on("click.sel", (d, idx, groups) => {
|
|
597
|
-
this.selected(!this.selected())
|
|
598
|
-
|
|
796
|
+
this.selected(!this.selected());
|
|
797
|
+
this.render();
|
|
798
|
+
});
|
|
799
|
+
super.enter(domNode, element);
|
|
599
800
|
}
|
|
600
801
|
update(domNode, element) {
|
|
601
|
-
super.update(domNode, element)
|
|
802
|
+
super.update(domNode, element);
|
|
803
|
+
this._element.classed("selected", this.selected());
|
|
602
804
|
}
|
|
603
|
-
}
|
|
805
|
+
};
|
|
806
|
+
__name(_ToggleButton, "ToggleButton");
|
|
807
|
+
let ToggleButton = _ToggleButton;
|
|
604
808
|
ToggleButton.prototype._class += " html_ToggleButton";
|
|
605
|
-
ToggleButton.prototype.publish("selected",
|
|
606
|
-
class
|
|
809
|
+
ToggleButton.prototype.publish("selected", false, "boolean");
|
|
810
|
+
const _Spacer = class _Spacer extends Item {
|
|
607
811
|
enter(domNode, element) {
|
|
608
|
-
super.enter(domNode, element)
|
|
812
|
+
super.enter(domNode, element);
|
|
813
|
+
element.attr("class", "spacer").attr("href", "#").append("i");
|
|
609
814
|
}
|
|
610
|
-
}
|
|
815
|
+
};
|
|
816
|
+
__name(_Spacer, "Spacer");
|
|
817
|
+
let Spacer = _Spacer;
|
|
611
818
|
Spacer.prototype._class += " html_Spacer";
|
|
612
|
-
class
|
|
819
|
+
const _TitleBar = class _TitleBar extends JSXWidget {
|
|
613
820
|
constructor() {
|
|
614
821
|
super();
|
|
615
822
|
__publicField(this, "_divMain");
|
|
@@ -617,20 +824,28 @@ class TitleBar extends JSXWidget {
|
|
|
617
824
|
__publicField(this, "_divTitle");
|
|
618
825
|
}
|
|
619
826
|
enter(domNode, element) {
|
|
620
|
-
super.enter(domNode, element)
|
|
827
|
+
super.enter(domNode, element);
|
|
828
|
+
this._divMain = element.append("div").attr("class", "main");
|
|
829
|
+
this._divIconBar = this._divMain.append("div").attr("class", "icon-bar");
|
|
830
|
+
this._divTitle = this._divMain.append("div").attr("class", "title");
|
|
621
831
|
}
|
|
622
832
|
update(domNode, element) {
|
|
623
|
-
super.update(domNode, element)
|
|
833
|
+
super.update(domNode, element);
|
|
834
|
+
this._divTitle.text(this.title());
|
|
624
835
|
const icons = this._divIconBar.selectAll(".icon-bar-item").data(this.buttons());
|
|
625
836
|
icons.enter().append("div").attr("class", "icon-bar-item").each(function(d) {
|
|
626
837
|
d.target(this);
|
|
627
838
|
}).merge(icons).each(function(d) {
|
|
628
839
|
d.render();
|
|
629
|
-
})
|
|
840
|
+
});
|
|
841
|
+
icons.exit().each(function(d) {
|
|
630
842
|
d.target(null);
|
|
631
|
-
}).remove()
|
|
843
|
+
}).remove();
|
|
844
|
+
icons.order();
|
|
632
845
|
}
|
|
633
|
-
}
|
|
846
|
+
};
|
|
847
|
+
__name(_TitleBar, "TitleBar");
|
|
848
|
+
let TitleBar = _TitleBar;
|
|
634
849
|
TitleBar.prototype._class += " html_TitleBar";
|
|
635
850
|
TitleBar.prototype.publish("title", "", "string");
|
|
636
851
|
TitleBar.prototype.publish("buttons", [], "widgetArray");
|
|
@@ -655,4 +870,4 @@ export {
|
|
|
655
870
|
VizInstance
|
|
656
871
|
};
|
|
657
872
|
//# sourceMappingURL=index.js.map
|
|
658
|
-
|
|
873
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode("#wrap{width:100%}#left,#right{padding:5px}#left{background-color:red;text-align:left;display:block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#right{background-color:orange;float:right;text-align:right;white-space:nowrap}.html_TitleBar>.main{width:100%;display:block}.html_TitleBar .title{padding:4px;text-align:left;display:block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;font-size:20px;font-weight:700}.html_TitleBar .icon-bar{padding:4px;float:right;text-align:right;white-space:nowrap;line-height:28px}.html_TitleBar .icon-bar-item{display:inline}.html_TitleBar .icon-bar-item>div{display:inline}.html_TitleBar .icon-bar a{text-align:center;padding-top:4px;padding-bottom:4px;transition:all .3s ease;color:#a9a9a9}.html_TitleBar .icon-bar a:hover{background-color:#f5f5f5}.html_TitleBar .icon-bar a.selected{background-color:#efe5e5}.html_TitleBar .icon-bar a.spacer{text-align:center;padding-top:2px;padding-left:8px;padding-bottom:0;color:none}.html_TitleBar .icon-bar a.spacer:hover{background-color:transparent}.html_TitleBar .icon-bar .active{background-color:#4caf50}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
|