@hpcc-js/html 2.42.12 → 2.42.14

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 CHANGED
@@ -1,1042 +1,1050 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/common'), require('@hpcc-js/util')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/common', '@hpcc-js/util'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/html"] = {}, global["@hpcc-js/common"], global["@hpcc-js/util"]));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/common'), require('@hpcc-js/util')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/common', '@hpcc-js/util'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/html"] = {}, global["@hpcc-js/common"], global["@hpcc-js/util"]));
5
5
  })(this, (function (exports, common, util) { 'use strict';
6
6
 
7
- var PKG_NAME = "@hpcc-js/html";
8
- var PKG_VERSION = "2.42.12";
9
- var BUILD_VERSION = "2.104.28";
7
+ var PKG_NAME = "@hpcc-js/html";
8
+ var PKG_VERSION = "2.42.14";
9
+ var BUILD_VERSION = "2.104.32";
10
10
 
11
- /******************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
- /* global Reflect, Promise */
26
-
27
- var extendStatics = function(d, b) {
28
- extendStatics = Object.setPrototypeOf ||
29
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
31
- return extendStatics(d, b);
32
- };
33
-
34
- function __extends(d, b) {
35
- if (typeof b !== "function" && b !== null)
36
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
- extendStatics(d, b);
38
- function __() { this.constructor = d; }
39
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
- }
41
-
42
- function __spreadArray(to, from, pack) {
43
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
- if (ar || !(i in from)) {
45
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
- ar[i] = from[i];
47
- }
48
- }
49
- return to.concat(ar || Array.prototype.slice.call(from));
50
- }
11
+ /******************************************************************************
12
+ Copyright (c) Microsoft Corporation.
51
13
 
52
- var HTMLTooltip = /** @class */ (function (_super) {
53
- __extends(HTMLTooltip, _super);
54
- function HTMLTooltip() {
55
- var _this = _super.call(this) || this;
56
- _this._tooltipHTMLCallback = function (data) { return "<b>_tooltipHTMLCallback is undefined</b>"; };
57
- _this._logger = util.scopedLogger("html/HTMLTooltip");
58
- _this._closing = false;
59
- _this.visible(false);
60
- return _this;
61
- }
62
- HTMLTooltip.prototype.tooltipHTML = function (_) {
63
- this._tooltipHTMLCallback = _;
64
- return this;
65
- };
66
- HTMLTooltip.prototype.tooltipContent = function (_) {
67
- if (!arguments.length)
68
- return this._contentNode;
69
- this._contentNode = _;
70
- return this;
71
- };
72
- HTMLTooltip.prototype.triggerElement = function (_) {
73
- this._triggerElement = _;
74
- return this;
75
- };
76
- HTMLTooltip.prototype.enter = function (domNode, element) {
77
- _super.prototype.enter.call(this, domNode, element);
78
- var body = common.select("body");
79
- this._tooltipElement = body.append("div")
80
- .attr("class", "tooltip-div")
81
- .style("z-index", "2147483638")
82
- .style("position", "fixed");
83
- this._arrowElement = body.append("div")
84
- .attr("class", "arrow-div")
85
- .style("z-index", "2147483638")
86
- .style("position", "fixed");
87
- };
88
- HTMLTooltip.prototype.update = function (domNode, element) {
89
- var _this = this;
90
- _super.prototype.update.call(this, domNode, element);
91
- if (this._contentNode !== this._prevContentNode) {
92
- var node = this._tooltipElement.node();
93
- __spreadArray([], node.querySelectorAll("*"), true).map(function (n) { return n.__data__; })
94
- .filter(function (n) { return n; })
95
- .forEach(function (w) {
96
- if (typeof w.target === "function") {
97
- w.target(null);
98
- }
99
- if (typeof w.exit === "function") {
100
- w.exit();
101
- }
102
- });
103
- node.innerHTML = "";
104
- node.appendChild(this._contentNode);
105
- this._prevContentNode = this._contentNode;
106
- }
107
- if (this._contentNode) {
108
- this.onShowContent(this._contentNode);
109
- }
110
- else {
111
- this._tooltipElement
112
- .html(function () {
113
- return _this._tooltipHTMLCallback(_this.data());
114
- });
115
- }
116
- if (this.fitContent()) {
117
- this._tooltipElement
118
- .style("width", "auto")
119
- .style("height", "auto")
120
- .style("padding", "0px")
121
- .style("box-sizing", "content-box");
122
- var rect = this._tooltipElement.node().getBoundingClientRect();
123
- this.tooltipWidth_default(rect.width);
124
- this.tooltipHeight_default(rect.height);
125
- }
126
- this._closing = false;
127
- this._tooltipElement
128
- .style("background-color", this.tooltipColor())
129
- .style("color", this.fontColor())
130
- .style("width", this.tooltipWidth() + "px")
131
- .style("height", this.tooltipHeight() + "px")
132
- .style("opacity", 1)
133
- .style("padding", this.padding() + "px")
134
- .style("pointer-events", this.enablePointerEvents() ? "all" : "none")
135
- .style("box-sizing", "content-box");
136
- this._arrowElement
137
- .style("opacity", 1)
138
- .style("pointer-events", "none");
139
- this.updateTooltipPosition();
140
- };
141
- HTMLTooltip.prototype.onShowContent = function (node) {
142
- };
143
- HTMLTooltip.prototype.updateTooltipPosition = function () {
144
- var bbox = this.calcReferenceBBox();
145
- var direction = this.calcTooltipDirection(bbox);
146
- var box = bbox[direction];
147
- this._tooltipElement
148
- .style("top", box.y + "px")
149
- .style("left", box.x + "px");
150
- this.setArrowPosition(box, direction);
151
- return box;
152
- };
153
- HTMLTooltip.prototype.calcTooltipDirection = function (bbox) {
154
- var directions = Object.keys(bbox);
155
- var defaultDirection = this.direction();
156
- directions.sort(function (a, b) { return a === defaultDirection ? -1 : 1; });
157
- var windowRect = {
158
- top: 0,
159
- left: 0,
160
- width: window.innerWidth,
161
- height: window.innerHeight
162
- };
163
- for (var i = 0; i < directions.length; i++) {
164
- var tooltipRect = {
165
- top: bbox[directions[i]].y,
166
- left: bbox[directions[i]].x,
167
- width: this.tooltipWidth(),
168
- height: this.tooltipHeight()
169
- };
170
- if (this.rectFits(tooltipRect, windowRect)) {
171
- return directions[i];
172
- }
173
- }
174
- this._logger.warning("Tooltip doesn't fit in the window for any of the directions. Defaulting to '".concat(defaultDirection, "'"));
175
- this._logger.debug(windowRect);
176
- this._logger.debug({
177
- top: bbox[defaultDirection].y,
178
- left: bbox[defaultDirection].x,
179
- width: this.tooltipWidth(),
180
- height: this.tooltipHeight()
181
- });
182
- return defaultDirection;
183
- };
184
- HTMLTooltip.prototype.rectFits = function (innerRect, outerRect) {
185
- return (innerRect.top >= outerRect.top &&
186
- innerRect.left >= outerRect.left &&
187
- innerRect.width + innerRect.left <= outerRect.width + outerRect.left &&
188
- innerRect.height + innerRect.top <= outerRect.height + outerRect.top);
189
- };
190
- HTMLTooltip.prototype.setArrowPosition = function (point, direction) {
191
- var top;
192
- var left;
193
- var visibleBorderStyle = "border-top-color";
194
- this._arrowElement
195
- .style("border", "".concat(this.arrowHeight(), "px solid ").concat(this.tooltipColor()))
196
- .style("border-top-color", "transparent")
197
- .style("border-right-color", "transparent")
198
- .style("border-bottom-color", "transparent")
199
- .style("border-left-color", "transparent");
200
- switch (direction) {
201
- case "n":
202
- top = point.y + this.tooltipHeight() + (this.padding() * 2);
203
- left = point.x + (this.tooltipWidth() / 2) - (this.arrowWidth() / 2) + this.padding();
204
- visibleBorderStyle = "border-top-color";
205
- this._arrowElement
206
- .style("border-top-width", "".concat(this.arrowHeight(), "px"))
207
- .style("border-bottom-width", "0px")
208
- .style("border-left-width", "".concat(this.arrowWidth() / 2, "px"))
209
- .style("border-right-width", "".concat(this.arrowWidth() / 2, "px"));
210
- break;
211
- case "s":
212
- top = point.y - this.arrowHeight();
213
- left = point.x + this.padding() + (this.tooltipWidth() / 2) - (this.arrowWidth() / 2);
214
- visibleBorderStyle = "border-bottom-color";
215
- this._arrowElement
216
- .style("border-top-width", "0px")
217
- .style("border-bottom-width", "".concat(this.arrowHeight(), "px"))
218
- .style("border-left-width", "".concat(this.arrowWidth() / 2, "px"))
219
- .style("border-right-width", "".concat(this.arrowWidth() / 2, "px"));
220
- break;
221
- case "e":
222
- top = point.y + (this.tooltipHeight() / 2) + this.padding() - (this.arrowWidth() / 2);
223
- left = point.x - this.arrowHeight();
224
- visibleBorderStyle = "border-right-color";
225
- this._arrowElement
226
- .style("border-top-width", "".concat(this.arrowWidth() / 2, "px"))
227
- .style("border-bottom-width", "".concat(this.arrowWidth() / 2, "px"))
228
- .style("border-left-width", "0px")
229
- .style("border-right-width", "".concat(this.arrowHeight(), "px"));
230
- break;
231
- case "w":
232
- top = point.y + (this.tooltipHeight() / 2) - (this.arrowWidth() / 2) + this.padding();
233
- left = point.x + this.tooltipWidth() + (this.padding() * 2);
234
- visibleBorderStyle = "border-left-color";
235
- this._arrowElement
236
- .style("border-top-width", "".concat(this.arrowWidth() / 2, "px"))
237
- .style("border-bottom-width", "".concat(this.arrowWidth() / 2, "px"))
238
- .style("border-left-width", "".concat(this.arrowHeight(), "px"))
239
- .style("border-right-width", "0px");
240
- break;
241
- }
242
- if (typeof top !== "undefined" && typeof left !== "undefined") {
243
- this._arrowElement
244
- .style("top", top + "px")
245
- .style("left", left + "px")
246
- .style(visibleBorderStyle, this.tooltipColor())
247
- .style("opacity", 1);
248
- }
249
- else {
250
- this._arrowElement
251
- .style("opacity", 0);
252
- }
253
- return point;
254
- };
255
- HTMLTooltip.prototype.getReferenceNode = function () {
256
- if (!this._triggerElement) {
257
- return this.element().node().parentNode.parentNode;
258
- }
259
- return this._triggerElement.node();
260
- };
261
- HTMLTooltip.prototype.calcReferenceBBox = function () {
262
- var node = this.getReferenceNode();
263
- var _a = node.getBoundingClientRect(), top = _a.top, left = _a.left, width = _a.width, height = _a.height;
264
- var wholeW = this.tooltipWidth();
265
- var wholeH = this.tooltipHeight();
266
- var halfW = wholeW / 2;
267
- var halfH = wholeH / 2;
268
- var arrowH = this.arrowHeight();
269
- var p = this.padding();
270
- var p2 = p * 2;
271
- if (this.followCursor() && this._cursorLoc) {
272
- left = this._cursorLoc[0];
273
- top = this._cursorLoc[1];
274
- width = 1;
275
- height = 1;
276
- }
277
- var bbox = {
278
- n: {
279
- x: left + (width / 2) - halfW - p,
280
- y: top - wholeH - arrowH - p2
281
- },
282
- e: {
283
- x: left + width + arrowH,
284
- y: top + (height / 2) - halfH - p
285
- },
286
- s: {
287
- x: left + (width / 2) - halfW - p,
288
- y: top + height + arrowH
289
- },
290
- w: {
291
- x: left - wholeW - arrowH - p2,
292
- y: top + (height / 2) - halfH - p
293
- },
294
- nw: {
295
- x: left - wholeW - p2,
296
- y: top - wholeH - p2
297
- },
298
- ne: {
299
- x: left + width,
300
- y: top - wholeH - p2
301
- },
302
- se: {
303
- x: left + width,
304
- y: top + height
305
- },
306
- sw: {
307
- x: left - wholeW - p2,
308
- y: top + height
309
- }
310
- };
311
- return bbox;
312
- };
313
- HTMLTooltip.prototype.mouseout = function () {
314
- var _this = this;
315
- this._closing = true;
316
- this._tooltipElement.on("mouseover", function () {
317
- _this._closing = false;
318
- });
319
- this._tooltipElement.on("mouseout", function () {
320
- _this.mouseout();
321
- });
322
- setTimeout(function () {
323
- if (_this._closing) {
324
- _this.visible(false);
325
- }
326
- }, this.closeDelay());
327
- };
328
- HTMLTooltip.prototype.visible = function (_) {
329
- if (!arguments.length)
330
- return _super.prototype.visible.call(this);
331
- if (this._arrowElement) {
332
- this._arrowElement.style("visibility", _ ? "visible" : "hidden");
333
- this._tooltipElement.style("visibility", _ ? "visible" : "hidden");
334
- }
335
- _super.prototype.visible.call(this, _);
336
- return this;
337
- };
338
- HTMLTooltip.prototype.exit = function (domNode, element) {
339
- if (this._arrowElement) {
340
- this._arrowElement.remove();
341
- this._tooltipElement.remove();
342
- }
343
- _super.prototype.exit.call(this, domNode, element);
344
- };
345
- return HTMLTooltip;
346
- }(common.HTMLWidget));
347
- HTMLTooltip.prototype._class += " html_HTMLTooltip";
348
- HTMLTooltip.prototype.publish("fitContent", false, "boolean", "If true, tooltip will grow to fit its html content");
349
- HTMLTooltip.prototype.publish("followCursor", false, "boolean", "If true, tooltip will display relative to cursor location");
350
- HTMLTooltip.prototype.publish("closeDelay", 400, "number", "Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)");
351
- HTMLTooltip.prototype.publish("direction", "n", "set", "Direction in which to display the tooltip", ["n", "s", "e", "w", "ne", "nw", "se", "sw"]);
352
- HTMLTooltip.prototype.publish("padding", 8, "number", "Padding (pixels)");
353
- HTMLTooltip.prototype.publish("arrowWidth", 16, "number", "Width (or height depending on direction) of the tooltip arrow (pixels)");
354
- HTMLTooltip.prototype.publish("arrowHeight", 8, "number", "Height (or width depending on direction) of the tooltip arrow (pixels)");
355
- HTMLTooltip.prototype.publish("fontColor", "#FFF", "html-color", "The default font color for text in the tooltip");
356
- HTMLTooltip.prototype.publish("tooltipColor", "#000000EE", "html-color", "Background color of the tooltip");
357
- HTMLTooltip.prototype.publish("tooltipWidth", 200, "number", "Width of the tooltip (not including arrow) (pixels)");
358
- HTMLTooltip.prototype.publish("tooltipHeight", 200, "number", "Height of the tooltip (not including arrow) (pixels)");
359
- HTMLTooltip.prototype.publish("enablePointerEvents", false, "boolean", "If true, the 'pointer-events: all' style will be used");
14
+ Permission to use, copy, modify, and/or distribute this software for any
15
+ purpose with or without fee is hereby granted.
360
16
 
361
- var SimpleTable = /** @class */ (function (_super) {
362
- __extends(SimpleTable, _super);
363
- function SimpleTable() {
364
- return _super.call(this) || this;
365
- }
366
- SimpleTable.prototype.transformData = function () {
367
- return this.data();
368
- };
369
- SimpleTable.prototype.enter = function (domNode, element) {
370
- _super.prototype.enter.call(this, domNode, element);
371
- this._table = element.append("table");
372
- this._thead = this._table.append("thead");
373
- this._theadRow = this._thead.append("tr");
374
- this._tbody = this._table.append("tbody");
375
- };
376
- SimpleTable.prototype.update = function (domNode, element) {
377
- _super.prototype.update.call(this, domNode, element);
378
- this._table
379
- .style("width", this.autoWidth() ? "auto" : "100%");
380
- var theadTrSelection = this._theadRow.selectAll("th").data(this.columns());
381
- theadTrSelection.enter()
382
- .append("th")
383
- .attr("class", function (n, i) { return "th-".concat(i); })
384
- .merge(theadTrSelection)
385
- .text(function (_d) { return (_d).toString(); });
386
- theadTrSelection.exit().remove();
387
- var trSelection = this._tbody.selectAll("tr").data(this.transformData());
388
- trSelection.enter()
389
- .append("tr")
390
- .merge(trSelection)
391
- .each(function (d) {
392
- var tr = common.select(this);
393
- var tdSelection = tr.selectAll("td").data(d);
394
- tdSelection.enter()
395
- .append("td")
396
- .attr("class", function (n, i) { return "col-".concat(i); })
397
- .merge(tdSelection)
398
- .text(function (_d) { return (_d).toString(); });
399
- tdSelection.exit().remove();
400
- });
401
- trSelection.exit().remove();
402
- };
403
- return SimpleTable;
404
- }(common.HTMLWidget));
405
- SimpleTable.prototype._class += " html_SimpleTable";
406
- SimpleTable.prototype.publish("autoWidth", false, "boolean", "If true, table width will be set to 'auto'. If false, the width is set to '100%'");
17
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
+ PERFORMANCE OF THIS SOFTWARE.
24
+ ***************************************************************************** */
25
+ /* global Reflect, Promise, SuppressedError, Symbol */
407
26
 
408
- var StyledTable = /** @class */ (function (_super) {
409
- __extends(StyledTable, _super);
410
- function StyledTable() {
411
- return _super.call(this) || this;
412
- }
413
- StyledTable.prototype.applyStyleObject = function (selection, styleObject) {
414
- Object.keys(styleObject).forEach(function (styleName) {
415
- selection.style(styleName, styleObject[styleName]);
416
- });
417
- };
418
- StyledTable.prototype.update = function (domNode, element) {
419
- var _this = this;
420
- _super.prototype.update.call(this, domNode, element);
421
- element.selectAll("tr,th,td")
422
- .attr("style", "")
423
- .style("font-family", this.fontFamily())
424
- .style("color", this.fontColor());
425
- this.theadColumnStyles().forEach(function (styleObj, i) {
426
- _this.applyStyleObject(element.select(".th-".concat(i)), styleObj);
427
- });
428
- this.tbodyColumnStyles().forEach(function (styleObj, i) {
429
- _this.applyStyleObject(element.selectAll(".col-".concat(i)), styleObj);
430
- });
431
- var evenRowStylesExist = Object.keys(this.evenRowStyles()).length > 0;
432
- var lastRowStylesExist = Object.keys(this.lastRowStyles()).length > 0;
433
- var tbodyRows = element.selectAll("tbody > tr");
434
- if (evenRowStylesExist) {
435
- var tbodyEvenRows = tbodyRows.select(function (d, i) { return i % 2 ? this : null; });
436
- this.applyStyleObject(tbodyEvenRows, this.evenRowStyles());
437
- }
438
- if (lastRowStylesExist) {
439
- var tbodyLastRow = tbodyRows.select(function (d, i, arr) { return i === arr.length - 1 ? this : null; });
440
- this.applyStyleObject(tbodyLastRow, this.lastRowStyles());
441
- }
442
- };
443
- return StyledTable;
444
- }(SimpleTable));
445
- StyledTable.prototype._class += " html_StyledTable";
446
- StyledTable.prototype.publish("fontFamily", "Verdana", "string", "Base font-family used within the table");
447
- StyledTable.prototype.publish("fontColor", "#333", "string", "Base font color used within the table");
448
- StyledTable.prototype.publish("theadColumnStyles", [], "array", 'Array of objects containing styles for the thead columns (ex: [{"color":"red"},{"color":"blue"}])');
449
- StyledTable.prototype.publish("tbodyColumnStyles", [], "array", 'Array of objects containing styles for the tbody columns (ex: [{"color":"red"},{"color":"blue"}])');
450
- StyledTable.prototype.publish("lastRowStyles", {}, "object", 'Object containing styles for the last row (ex: {"color":"red"})');
451
- StyledTable.prototype.publish("evenRowStyles", {}, "object", 'Object containing styles for even rows (ex: {"background-color":"#AAA"})');
27
+ var extendStatics = function(d, b) {
28
+ extendStatics = Object.setPrototypeOf ||
29
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
31
+ return extendStatics(d, b);
32
+ };
33
+
34
+ function __extends(d, b) {
35
+ if (typeof b !== "function" && b !== null)
36
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
+ extendStatics(d, b);
38
+ function __() { this.constructor = d; }
39
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
+ }
452
41
 
453
- var BreakdownTable = /** @class */ (function (_super) {
454
- __extends(BreakdownTable, _super);
455
- function BreakdownTable() {
456
- return _super.call(this) || this;
42
+ function __spreadArray(to, from, pack) {
43
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
+ if (ar || !(i in from)) {
45
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
+ ar[i] = from[i];
457
47
  }
458
- BreakdownTable.prototype.transformData = function () {
459
- var rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
460
- return this.breakdownData(rowCount);
461
- };
462
- BreakdownTable.prototype.breakdownData = function (limit) {
463
- var len = this.data().length;
464
- var sum = this.data().reduce(function (acc, row) { return acc + row[1]; }, 0);
465
- var data = [];
466
- var percSum = 0;
467
- this.data().sort(function (a, b) { return a[1] > b[1] ? -1 : 1; });
468
- var hiddenRowCount = len - limit;
469
- var showOther = hiddenRowCount > 0;
470
- this.data()
471
- .filter(function (_, i) { return showOther ? i < limit - 1 : true; })
472
- .forEach(function (row) {
473
- var perc = Math.round((row[1] / sum) * 100);
474
- percSum += perc;
475
- data.push([row[0], perc + "%"]);
476
- });
477
- if (showOther) {
478
- var otherLabel = "".concat(this.otherLabel(), " (").concat(len - limit + 1, ")");
479
- var otherPercentage = "~" + (100 - percSum) + "%";
480
- data.push([otherLabel, otherPercentage]);
481
- }
482
- return data;
483
- };
484
- BreakdownTable.prototype.calculateRowCount = function () {
485
- var theadRowHeight = this.columns().length > 0 ? this.thFontSize() + 5 : 0;
486
- var tbodyRowHeight = this.fontSize() + 5;
487
- var tbodyAvailableHeight = this.height() - theadRowHeight;
488
- var rowCount = Math.floor(tbodyAvailableHeight / tbodyRowHeight);
489
- return rowCount;
490
- };
491
- BreakdownTable.prototype.enter = function (domNode, element) {
492
- var _this = this;
493
- _super.prototype.enter.call(this, domNode, element);
494
- this._tooltip = new HTMLTooltip()
495
- .target(domNode);
496
- this._tooltip
497
- .tooltipHTML(function (data) {
498
- var rowCount = _this.useCalculatedRowCount() ? _this.calculateRowCount() : _this.rowCount();
499
- var rowHeight = _this.fontSize();
500
- var widestLabel = Math.max.apply(Math, data.map(function (row) { return _this.textSize(row[0], "Verdana", _this.fontSize()).width; }));
501
- var widestPerc = 30;
502
- var colCount = 2;
503
- var w = colCount * (widestLabel + widestPerc) + (_this._tooltip.padding() * 2);
504
- var h = rowHeight * Math.ceil((data.length - rowCount) / colCount) + (_this._tooltip.padding() * 2);
505
- _this._tooltip.tooltipWidth(w);
506
- _this._tooltip.tooltipHeight(h);
507
- var otherData = _this.breakdownData(_this.data().length).slice(rowCount - 1);
508
- return "<div style=\"\n width: 100%;\n height: 100%;\n font-size: ".concat(_this.fontSize(), "px\n \">").concat(otherData.map(function (row) { return "<div style=\"\n float:left;\n width:".concat(Math.floor(99 / colCount), "%;\n \">").concat(row[0], ": ").concat(row[1], "</div>"); }).join(""), "</div>");
509
- });
510
- };
511
- BreakdownTable.prototype.update = function (domNode, element) {
512
- this.theadColumnStyles_default([
513
- {
514
- "color": this.thFirstColor(),
515
- "font-size": this.thFontSize() + "px",
516
- "font-weight": this.thFontWeight(),
517
- "text-align": this.labelAlignment(),
518
- "width": "auto",
519
- "padding": "0px"
520
- },
521
- {
522
- "width": "1%",
523
- "font-size": this.thFontSize() + "px",
524
- "font-weight": this.thFontWeight(),
525
- "text-align": this.percentageAlignment(),
526
- "padding": "0px"
527
- }
528
- ]);
529
- this.tbodyColumnStyles_default([
530
- {
531
- "color": this.topLabelColor(),
532
- "font-size": this.fontSize() + "px",
533
- "font-weight": "normal",
534
- "text-align": this.labelAlignment(),
535
- "width": "auto",
536
- "padding": "0px"
537
- },
538
- {
539
- "color": this.topPercentageColor(),
540
- "font-size": this.fontSize() + "px",
541
- "font-weight": "normal",
542
- "text-align": this.percentageAlignment(),
543
- "width": "1%",
544
- "padding": "0px"
545
- }
546
- ]);
547
- this.lastRowStyles_default([
548
- {
549
- "color": this.otherLabelColor(),
550
- "font-size": this.fontSize() + "px",
551
- "font-weight": this.otherLabelBold() ? "bold" : "normal",
552
- "text-align": this.labelAlignment(),
553
- "width": "auto",
554
- "padding": "0px"
555
- },
556
- {
557
- "color": this.otherLabelColor(),
558
- "font-size": this.fontSize() + "px",
559
- "font-weight": this.otherPercentageBold() ? "bold" : "normal",
560
- "text-align": this.percentageAlignment(),
561
- "width": "1%",
562
- "padding": "0px"
563
- }
564
- ]);
565
- _super.prototype.update.call(this, domNode, element);
566
- var rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
567
- if (rowCount < this.data().length) {
568
- var lastRow_1 = element.select("tbody > tr:last-child");
569
- var context_1 = this;
570
- lastRow_1
571
- .on("mouseout.tooltip", function (d) {
572
- context_1._tooltip._triggerElement = lastRow_1;
573
- context_1._tooltip
574
- .visible(false)
575
- .render();
576
- })
577
- .on("mouseenter.tooltip", function (d) {
578
- context_1._tooltip._triggerElement = lastRow_1;
579
- context_1._tooltip
580
- .direction("n")
581
- .data(context_1.data())
582
- .visible(true)
583
- .render();
584
- });
585
- }
586
- };
587
- return BreakdownTable;
588
- }(StyledTable));
589
- BreakdownTable.prototype._class += " html_BreakdownTable";
590
- BreakdownTable.prototype.publish("useCalculatedRowCount", true, "boolean", "If true, rowCount will be calculated and its default will be overwritten");
591
- BreakdownTable.prototype.publish("rowCount", 5, "number", "Number of total rows to display (including the 'other' row)", undefined, { disable: function (w) { return w.useCalculatedRowCount(); } });
592
- BreakdownTable.prototype.publish("fontSize", 14, "number", "Font size (pixels)");
593
- BreakdownTable.prototype.publish("labelAlignment", "left", "set", "Alignment of the label column text", ["left", "center", "right"]);
594
- BreakdownTable.prototype.publish("percentageAlignment", "center", "set", "Alignment of the percentage column text", ["left", "center", "right"]);
595
- BreakdownTable.prototype.publish("topLabelColor", "#333", "html-color", "Color of displayed 'top' labels");
596
- BreakdownTable.prototype.publish("topPercentageColor", "#1A99D5", "html-color", "Color of displayed 'top' percentages");
597
- BreakdownTable.prototype.publish("topPercentageBold", true, "html-color", "If true, the 'top' percentages will be bold");
598
- BreakdownTable.prototype.publish("otherLabel", "Other", "string", "Label text for the 'other' row");
599
- BreakdownTable.prototype.publish("otherLabelColor", "#AAA", "html-color", "Color of the 'other' label");
600
- BreakdownTable.prototype.publish("otherLabelBold", false, "html-color", "If true, the 'other' label will be bold");
601
- BreakdownTable.prototype.publish("otherPercentageColor", "#AAA", "html-color", "Color of the 'other' percentage");
602
- BreakdownTable.prototype.publish("otherPercentageBold", false, "html-color", "If true, the 'other' percentage will be bold");
603
- BreakdownTable.prototype.publish("thFontWeight", "bold", "string", "Font weight for th elements");
604
- BreakdownTable.prototype.publish("thFontSize", 26, "number", "Font size for th elements");
605
- BreakdownTable.prototype.publish("thFirstColor", "#333", "html-color", "Text color of the first th element");
606
- BreakdownTable.prototype.publish("thLastColor", "#333", "html-color", "Text color of the last th element");
48
+ }
49
+ return to.concat(ar || Array.prototype.slice.call(from));
50
+ }
607
51
 
608
- var n,l$1,u$1,t$1,o$1,r$1,f$1,c$1={},s$1=[],a$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v$1=Array.isArray;function h$1(n,l){for(var u in l)n[u]=l[u];return n}function p$1(n){var l=n.parentNode;l&&l.removeChild(n);}function y(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d$1(l,f,t,o,null)}function d$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function k$1(n){return n.children}function b$1(n,l){this.props=n,this.context=l;}function g$1(n,l){if(null==l)return n.__?g$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?g$1(n):null}function m$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return m$1(n)}}function w$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!x.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||r$1)(x);}function x(){var n,l,u,i,o,r,e,c;for(t$1.sort(f$1);n=t$1.shift();)n.__d&&(l=t$1.length,i=void 0,o=void 0,e=(r=(u=n).__v).__e,(c=u.__P)&&(i=[],(o=h$1({},r)).__v=r.__v+1,L(c,r,o,u.__n,void 0!==c.ownerSVGElement,null!=r.__h?[e]:null,i,null==e?g$1(r):e,r.__h),M(i,r),r.__e!=e&&m$1(r)),t$1.length>l&&t$1.sort(f$1));x.__r=0;}function P(n,l,u,i,t,o,r,f,e,a){var h,p,y,_,b,m,w,x=i&&i.__k||s$1,P=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _||"function"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?d$1(null,_,null,null,_):v$1(_)?d$1(k$1,{children:_},null,null,null):_.__b>0?d$1(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(y=x[h])||y&&_.key==y.key&&_.type===y.type)x[h]=void 0;else for(p=0;p<P;p++){if((y=x[p])&&_.key==y.key&&_.type===y.type){x[p]=void 0;break}y=null;}L(n,_,y=y||c$1,t,o,r,f,e,a),b=_.__e,(p=_.ref)&&y.ref!=p&&(w||(w=[]),y.ref&&w.push(y.ref,null,_),w.push(p,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===y.__k?_.__d=e=C(_,e,n):e=$(n,_,y,x,b,e),"function"==typeof u.type&&(u.__d=e)):e&&y.__e==e&&e.parentNode!=n&&(e=g$1(y));}for(u.__e=m,h=P;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=A(i).nextSibling),q(x[h],x[h]));if(w)for(h=0;h<w.length;h++)O(w[h],w[++h],w[++h]);}function C(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?C(i,l,u):$(u,i,i,t,i.__e,l));return l}function $(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function A(n){var l,u,i;if(null==n.type||"string"==typeof n.type)return n.__e;if(n.__k)for(l=n.__k.length-1;l>=0;l--)if((u=n.__k[l])&&(i=A(u)))return i;return null}function H(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||T$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||T$1(n,o,l[o],u[o],i);}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a$1.test(l)?u:u+"px";}function T$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||I(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||I(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?z$1:j$1,o):n.removeEventListener(l,o?z$1:j$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u));}}function j$1(n){return this.l[n.type+!1](l$1.event?l$1.event(n):n)}function z$1(n){return this.l[n.type+!0](l$1.event?l$1.event(n):n)}function L(n,u,i,t,o,r,f,e,c){var s,a,p,y,d,_,g,m,w,x,C,S,$,A,H,I=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l$1.__b)&&s(u);try{n:if("function"==typeof I){if(m=u.props,w=(s=I.contextType)&&t[s.__c],x=s?w?w.props.value:s.__:t,i.__c?g=(a=u.__c=i.__c).__=a.__E:("prototype"in I&&I.prototype.render?u.__c=a=new I(m,x):(u.__c=a=new b$1(m,x),a.constructor=I,a.render=B$1),w&&w.sub(a),a.props=m,a.state||(a.state={}),a.context=x,a.__n=t,p=a.__d=!0,a.__h=[],a._sb=[]),null==a.__s&&(a.__s=a.state),null!=I.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=h$1({},a.__s)),h$1(a.__s,I.getDerivedStateFromProps(m,a.__s))),y=a.props,d=a.state,a.__v=u,p)null==I.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else {if(null==I.getDerivedStateFromProps&&m!==y&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(m,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(m,a.__s,x)||u.__v===i.__v){for(u.__v!==i.__v&&(a.props=m,a.state=a.__s,a.__d=!1),a.__e=!1,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),C=0;C<a._sb.length;C++)a.__h.push(a._sb[C]);a._sb=[],a.__h.length&&f.push(a);break n}null!=a.componentWillUpdate&&a.componentWillUpdate(m,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(y,d,_);});}if(a.context=x,a.props=m,a.__P=n,S=l$1.__r,$=0,"prototype"in I&&I.prototype.render){for(a.state=a.__s,a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),A=0;A<a._sb.length;A++)a.__h.push(a._sb[A]);a._sb=[];}else do{a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),a.state=a.__s;}while(a.__d&&++$<25);a.state=a.__s,null!=a.getChildContext&&(t=h$1(h$1({},t),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(_=a.getSnapshotBeforeUpdate(y,d)),P(n,v$1(H=null!=s&&s.type===k$1&&null==s.key?s.props.children:s)?H:[H],u,i,t,o,r,f,e,c),a.base=u.__e,u.__h=null,a.__h.length&&f.push(a),g&&(a.__E=a.__=null),a.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=N(i.__e,u,i,t,o,r,f,c);(s=l$1.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function M(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function N(l,u,i,t,o,r,f,e){var s,a,h,y=i.props,d=u.props,_=u.type,k=0;if("svg"===_&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!_&&(_?s.localName===_:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===_)return document.createTextNode(d);l=o?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),r=null,e=!1;}if(null===_)y===d||e&&l.data===d||(l.data=d);else {if(r=r&&n.call(l.childNodes),a=(y=i.props||c$1).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!e){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(h||a)&&(h&&(a&&h.__html==a.__html||h.__html===l.innerHTML)||(l.innerHTML=h&&h.__html||""));}if(H(l,d,y,o,e),h)u.__k=[];else if(P(l,v$1(k=u.props.children)?k:[k],u,i,t,o&&"foreignObject"!==_,r,f,r?r[0]:i.__k&&g$1(i,0),e),null!=r)for(k=r.length;k--;)null!=r[k]&&p$1(r[k]);e||("value"in d&&void 0!==(k=d.value)&&(k!==l.value||"progress"===_&&!k||"option"===_&&k!==y.value)&&T$1(l,"value",k,y.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==l.checked&&T$1(l,"checked",k,y.checked,!1));}return l}function O(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function q(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||O(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&q(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||p$1(n.__e),n.__=n.__e=n.__d=void 0;}function B$1(n,l,u){return this.constructor(n,u)}function D(u,i,t){var o,r,f;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],L(i,u=(!o&&t||i).__k=y(k$1,null,[u]),r||c$1,c$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),M(f,u);}n=s$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,b$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h$1({},this.state),"function"==typeof n&&(n=n(h$1({},u),this.props)),n&&h$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w$1(this));},b$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w$1(this));},b$1.prototype.render=k$1,t$1=[],r$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$1=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0;
52
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
53
+ var e = new Error(message);
54
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
55
+ };
609
56
 
610
- var r,u,i,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r=null,e&&e(n);},l$1.__r=function(n){a&&a(n);var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],0)),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w(n){var t=r;n.__c=n.__(),r=t;}
57
+ var HTMLTooltip = /** @class */ (function (_super) {
58
+ __extends(HTMLTooltip, _super);
59
+ function HTMLTooltip() {
60
+ var _this = _super.call(this) || this;
61
+ _this._tooltipHTMLCallback = function (data) { return "<b>_tooltipHTMLCallback is undefined</b>"; };
62
+ _this._logger = util.scopedLogger("html/HTMLTooltip");
63
+ _this._closing = false;
64
+ _this.visible(false);
65
+ return _this;
66
+ }
67
+ HTMLTooltip.prototype.tooltipHTML = function (_) {
68
+ this._tooltipHTMLCallback = _;
69
+ return this;
70
+ };
71
+ HTMLTooltip.prototype.tooltipContent = function (_) {
72
+ if (!arguments.length)
73
+ return this._contentNode;
74
+ this._contentNode = _;
75
+ return this;
76
+ };
77
+ HTMLTooltip.prototype.triggerElement = function (_) {
78
+ this._triggerElement = _;
79
+ return this;
80
+ };
81
+ HTMLTooltip.prototype.enter = function (domNode, element) {
82
+ _super.prototype.enter.call(this, domNode, element);
83
+ var body = common.select("body");
84
+ this._tooltipElement = body.append("div")
85
+ .attr("class", "tooltip-div")
86
+ .style("z-index", "2147483638")
87
+ .style("position", "fixed");
88
+ this._arrowElement = body.append("div")
89
+ .attr("class", "arrow-div")
90
+ .style("z-index", "2147483638")
91
+ .style("position", "fixed");
92
+ };
93
+ HTMLTooltip.prototype.update = function (domNode, element) {
94
+ var _this = this;
95
+ _super.prototype.update.call(this, domNode, element);
96
+ if (this._contentNode !== this._prevContentNode) {
97
+ var node = this._tooltipElement.node();
98
+ __spreadArray([], node.querySelectorAll("*"), true).map(function (n) { return n.__data__; })
99
+ .filter(function (n) { return n; })
100
+ .forEach(function (w) {
101
+ if (typeof w.target === "function") {
102
+ w.target(null);
103
+ }
104
+ if (typeof w.exit === "function") {
105
+ w.exit();
106
+ }
107
+ });
108
+ node.innerHTML = "";
109
+ node.appendChild(this._contentNode);
110
+ this._prevContentNode = this._contentNode;
111
+ }
112
+ if (this._contentNode) {
113
+ this.onShowContent(this._contentNode);
114
+ }
115
+ else {
116
+ this._tooltipElement
117
+ .html(function () {
118
+ return _this._tooltipHTMLCallback(_this.data());
119
+ });
120
+ }
121
+ if (this.fitContent()) {
122
+ this._tooltipElement
123
+ .style("width", "auto")
124
+ .style("height", "auto")
125
+ .style("padding", "0px")
126
+ .style("box-sizing", "content-box");
127
+ var rect = this._tooltipElement.node().getBoundingClientRect();
128
+ this.tooltipWidth_default(rect.width);
129
+ this.tooltipHeight_default(rect.height);
130
+ }
131
+ this._closing = false;
132
+ this._tooltipElement
133
+ .style("background-color", this.tooltipColor())
134
+ .style("color", this.fontColor())
135
+ .style("width", this.tooltipWidth() + "px")
136
+ .style("height", this.tooltipHeight() + "px")
137
+ .style("opacity", 1)
138
+ .style("padding", this.padding() + "px")
139
+ .style("pointer-events", this.enablePointerEvents() ? "all" : "none")
140
+ .style("box-sizing", "content-box");
141
+ this._arrowElement
142
+ .style("opacity", 1)
143
+ .style("pointer-events", "none");
144
+ this.updateTooltipPosition();
145
+ };
146
+ HTMLTooltip.prototype.onShowContent = function (node) {
147
+ };
148
+ HTMLTooltip.prototype.updateTooltipPosition = function () {
149
+ var bbox = this.calcReferenceBBox();
150
+ var direction = this.calcTooltipDirection(bbox);
151
+ var box = bbox[direction];
152
+ this._tooltipElement
153
+ .style("top", box.y + "px")
154
+ .style("left", box.x + "px");
155
+ this.setArrowPosition(box, direction);
156
+ return box;
157
+ };
158
+ HTMLTooltip.prototype.calcTooltipDirection = function (bbox) {
159
+ var directions = Object.keys(bbox);
160
+ var defaultDirection = this.direction();
161
+ directions.sort(function (a, b) { return a === defaultDirection ? -1 : 1; });
162
+ var windowRect = {
163
+ top: 0,
164
+ left: 0,
165
+ width: window.innerWidth,
166
+ height: window.innerHeight
167
+ };
168
+ for (var i = 0; i < directions.length; i++) {
169
+ var tooltipRect = {
170
+ top: bbox[directions[i]].y,
171
+ left: bbox[directions[i]].x,
172
+ width: this.tooltipWidth(),
173
+ height: this.tooltipHeight()
174
+ };
175
+ if (this.rectFits(tooltipRect, windowRect)) {
176
+ return directions[i];
177
+ }
178
+ }
179
+ this._logger.warning("Tooltip doesn't fit in the window for any of the directions. Defaulting to '".concat(defaultDirection, "'"));
180
+ this._logger.debug(windowRect);
181
+ this._logger.debug({
182
+ top: bbox[defaultDirection].y,
183
+ left: bbox[defaultDirection].x,
184
+ width: this.tooltipWidth(),
185
+ height: this.tooltipHeight()
186
+ });
187
+ return defaultDirection;
188
+ };
189
+ HTMLTooltip.prototype.rectFits = function (innerRect, outerRect) {
190
+ return (innerRect.top >= outerRect.top &&
191
+ innerRect.left >= outerRect.left &&
192
+ innerRect.width + innerRect.left <= outerRect.width + outerRect.left &&
193
+ innerRect.height + innerRect.top <= outerRect.height + outerRect.top);
194
+ };
195
+ HTMLTooltip.prototype.setArrowPosition = function (point, direction) {
196
+ var top;
197
+ var left;
198
+ var visibleBorderStyle = "border-top-color";
199
+ this._arrowElement
200
+ .style("border", "".concat(this.arrowHeight(), "px solid ").concat(this.tooltipColor()))
201
+ .style("border-top-color", "transparent")
202
+ .style("border-right-color", "transparent")
203
+ .style("border-bottom-color", "transparent")
204
+ .style("border-left-color", "transparent");
205
+ switch (direction) {
206
+ case "n":
207
+ top = point.y + this.tooltipHeight() + (this.padding() * 2);
208
+ left = point.x + (this.tooltipWidth() / 2) - (this.arrowWidth() / 2) + this.padding();
209
+ visibleBorderStyle = "border-top-color";
210
+ this._arrowElement
211
+ .style("border-top-width", "".concat(this.arrowHeight(), "px"))
212
+ .style("border-bottom-width", "0px")
213
+ .style("border-left-width", "".concat(this.arrowWidth() / 2, "px"))
214
+ .style("border-right-width", "".concat(this.arrowWidth() / 2, "px"));
215
+ break;
216
+ case "s":
217
+ top = point.y - this.arrowHeight();
218
+ left = point.x + this.padding() + (this.tooltipWidth() / 2) - (this.arrowWidth() / 2);
219
+ visibleBorderStyle = "border-bottom-color";
220
+ this._arrowElement
221
+ .style("border-top-width", "0px")
222
+ .style("border-bottom-width", "".concat(this.arrowHeight(), "px"))
223
+ .style("border-left-width", "".concat(this.arrowWidth() / 2, "px"))
224
+ .style("border-right-width", "".concat(this.arrowWidth() / 2, "px"));
225
+ break;
226
+ case "e":
227
+ top = point.y + (this.tooltipHeight() / 2) + this.padding() - (this.arrowWidth() / 2);
228
+ left = point.x - this.arrowHeight();
229
+ visibleBorderStyle = "border-right-color";
230
+ this._arrowElement
231
+ .style("border-top-width", "".concat(this.arrowWidth() / 2, "px"))
232
+ .style("border-bottom-width", "".concat(this.arrowWidth() / 2, "px"))
233
+ .style("border-left-width", "0px")
234
+ .style("border-right-width", "".concat(this.arrowHeight(), "px"));
235
+ break;
236
+ case "w":
237
+ top = point.y + (this.tooltipHeight() / 2) - (this.arrowWidth() / 2) + this.padding();
238
+ left = point.x + this.tooltipWidth() + (this.padding() * 2);
239
+ visibleBorderStyle = "border-left-color";
240
+ this._arrowElement
241
+ .style("border-top-width", "".concat(this.arrowWidth() / 2, "px"))
242
+ .style("border-bottom-width", "".concat(this.arrowWidth() / 2, "px"))
243
+ .style("border-left-width", "".concat(this.arrowHeight(), "px"))
244
+ .style("border-right-width", "0px");
245
+ break;
246
+ }
247
+ if (typeof top !== "undefined" && typeof left !== "undefined") {
248
+ this._arrowElement
249
+ .style("top", top + "px")
250
+ .style("left", left + "px")
251
+ .style(visibleBorderStyle, this.tooltipColor())
252
+ .style("opacity", 1);
253
+ }
254
+ else {
255
+ this._arrowElement
256
+ .style("opacity", 0);
257
+ }
258
+ return point;
259
+ };
260
+ HTMLTooltip.prototype.getReferenceNode = function () {
261
+ if (!this._triggerElement) {
262
+ return this.element().node().parentNode.parentNode;
263
+ }
264
+ return this._triggerElement.node();
265
+ };
266
+ HTMLTooltip.prototype.calcReferenceBBox = function () {
267
+ var node = this.getReferenceNode();
268
+ var _a = node.getBoundingClientRect(), top = _a.top, left = _a.left, width = _a.width, height = _a.height;
269
+ var wholeW = this.tooltipWidth();
270
+ var wholeH = this.tooltipHeight();
271
+ var halfW = wholeW / 2;
272
+ var halfH = wholeH / 2;
273
+ var arrowH = this.arrowHeight();
274
+ var p = this.padding();
275
+ var p2 = p * 2;
276
+ if (this.followCursor() && this._cursorLoc) {
277
+ left = this._cursorLoc[0];
278
+ top = this._cursorLoc[1];
279
+ width = 1;
280
+ height = 1;
281
+ }
282
+ var bbox = {
283
+ n: {
284
+ x: left + (width / 2) - halfW - p,
285
+ y: top - wholeH - arrowH - p2
286
+ },
287
+ e: {
288
+ x: left + width + arrowH,
289
+ y: top + (height / 2) - halfH - p
290
+ },
291
+ s: {
292
+ x: left + (width / 2) - halfW - p,
293
+ y: top + height + arrowH
294
+ },
295
+ w: {
296
+ x: left - wholeW - arrowH - p2,
297
+ y: top + (height / 2) - halfH - p
298
+ },
299
+ nw: {
300
+ x: left - wholeW - p2,
301
+ y: top - wholeH - p2
302
+ },
303
+ ne: {
304
+ x: left + width,
305
+ y: top - wholeH - p2
306
+ },
307
+ se: {
308
+ x: left + width,
309
+ y: top + height
310
+ },
311
+ sw: {
312
+ x: left - wholeW - p2,
313
+ y: top + height
314
+ }
315
+ };
316
+ return bbox;
317
+ };
318
+ HTMLTooltip.prototype.mouseout = function () {
319
+ var _this = this;
320
+ this._closing = true;
321
+ this._tooltipElement.on("mouseover", function () {
322
+ _this._closing = false;
323
+ });
324
+ this._tooltipElement.on("mouseout", function () {
325
+ _this.mouseout();
326
+ });
327
+ setTimeout(function () {
328
+ if (_this._closing) {
329
+ _this.visible(false);
330
+ }
331
+ }, this.closeDelay());
332
+ };
333
+ HTMLTooltip.prototype.visible = function (_) {
334
+ if (!arguments.length)
335
+ return _super.prototype.visible.call(this);
336
+ if (this._arrowElement) {
337
+ this._arrowElement.style("visibility", _ ? "visible" : "hidden");
338
+ this._tooltipElement.style("visibility", _ ? "visible" : "hidden");
339
+ }
340
+ _super.prototype.visible.call(this, _);
341
+ return this;
342
+ };
343
+ HTMLTooltip.prototype.exit = function (domNode, element) {
344
+ if (this._arrowElement) {
345
+ this._arrowElement.remove();
346
+ this._tooltipElement.remove();
347
+ }
348
+ _super.prototype.exit.call(this, domNode, element);
349
+ };
350
+ return HTMLTooltip;
351
+ }(common.HTMLWidget));
352
+ HTMLTooltip.prototype._class += " html_HTMLTooltip";
353
+ HTMLTooltip.prototype.publish("fitContent", false, "boolean", "If true, tooltip will grow to fit its html content");
354
+ HTMLTooltip.prototype.publish("followCursor", false, "boolean", "If true, tooltip will display relative to cursor location");
355
+ HTMLTooltip.prototype.publish("closeDelay", 400, "number", "Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)");
356
+ HTMLTooltip.prototype.publish("direction", "n", "set", "Direction in which to display the tooltip", ["n", "s", "e", "w", "ne", "nw", "se", "sw"]);
357
+ HTMLTooltip.prototype.publish("padding", 8, "number", "Padding (pixels)");
358
+ HTMLTooltip.prototype.publish("arrowWidth", 16, "number", "Width (or height depending on direction) of the tooltip arrow (pixels)");
359
+ HTMLTooltip.prototype.publish("arrowHeight", 8, "number", "Height (or width depending on direction) of the tooltip arrow (pixels)");
360
+ HTMLTooltip.prototype.publish("fontColor", "#FFF", "html-color", "The default font color for text in the tooltip");
361
+ HTMLTooltip.prototype.publish("tooltipColor", "#000000EE", "html-color", "Background color of the tooltip");
362
+ HTMLTooltip.prototype.publish("tooltipWidth", 200, "number", "Width of the tooltip (not including arrow) (pixels)");
363
+ HTMLTooltip.prototype.publish("tooltipHeight", 200, "number", "Height of the tooltip (not including arrow) (pixels)");
364
+ HTMLTooltip.prototype.publish("enablePointerEvents", false, "boolean", "If true, the 'pointer-events: all' style will be used");
611
365
 
612
- var JSXWidget = /** @class */ (function (_super) {
613
- __extends(JSXWidget, _super);
614
- function JSXWidget() {
615
- return _super !== null && _super.apply(this, arguments) || this;
616
- }
617
- JSXWidget.prototype.jsxRender = function (jsx, domNode) {
618
- this.rootNode = D(jsx, domNode, this.rootNode);
619
- };
620
- JSXWidget.Component = b$1;
621
- JSXWidget.createElement = y;
622
- return JSXWidget;
623
- }(common.HTMLWidget));
624
- JSXWidget.prototype._class += " html_JSXWidget";
366
+ var SimpleTable = /** @class */ (function (_super) {
367
+ __extends(SimpleTable, _super);
368
+ function SimpleTable() {
369
+ return _super.call(this) || this;
370
+ }
371
+ SimpleTable.prototype.transformData = function () {
372
+ return this.data();
373
+ };
374
+ SimpleTable.prototype.enter = function (domNode, element) {
375
+ _super.prototype.enter.call(this, domNode, element);
376
+ this._table = element.append("table");
377
+ this._thead = this._table.append("thead");
378
+ this._theadRow = this._thead.append("tr");
379
+ this._tbody = this._table.append("tbody");
380
+ };
381
+ SimpleTable.prototype.update = function (domNode, element) {
382
+ _super.prototype.update.call(this, domNode, element);
383
+ this._table
384
+ .style("width", this.autoWidth() ? "auto" : "100%");
385
+ var theadTrSelection = this._theadRow.selectAll("th").data(this.columns());
386
+ theadTrSelection.enter()
387
+ .append("th")
388
+ .attr("class", function (n, i) { return "th-".concat(i); })
389
+ .merge(theadTrSelection)
390
+ .text(function (_d) { return (_d).toString(); });
391
+ theadTrSelection.exit().remove();
392
+ var trSelection = this._tbody.selectAll("tr").data(this.transformData());
393
+ trSelection.enter()
394
+ .append("tr")
395
+ .merge(trSelection)
396
+ .each(function (d) {
397
+ var tr = common.select(this);
398
+ var tdSelection = tr.selectAll("td").data(d);
399
+ tdSelection.enter()
400
+ .append("td")
401
+ .attr("class", function (n, i) { return "col-".concat(i); })
402
+ .merge(tdSelection)
403
+ .text(function (_d) { return (_d).toString(); });
404
+ tdSelection.exit().remove();
405
+ });
406
+ trSelection.exit().remove();
407
+ };
408
+ return SimpleTable;
409
+ }(common.HTMLWidget));
410
+ SimpleTable.prototype._class += " html_SimpleTable";
411
+ SimpleTable.prototype.publish("autoWidth", false, "boolean", "If true, table width will be set to 'auto'. If false, the width is set to '100%'");
625
412
 
626
- var VNode = /** @class */ (function () {
627
- function VNode(attrs, children) {
628
- this._attrs = attrs;
629
- this._children = children;
630
- }
631
- VNode.prototype.type = function () {
632
- return "div";
633
- };
634
- VNode.prototype.attrs = function () {
635
- return this._attrs;
636
- };
637
- VNode.prototype.attr = function (key) {
638
- return this._attrs[key];
639
- };
640
- VNode.prototype.children = function () {
641
- return this._children;
642
- };
643
- VNode.prototype.update = function (targetElement) {
644
- for (var key in this._attrs) {
645
- targetElement.attr(key, this._attrs[key]);
646
- }
647
- };
648
- VNode.prototype.render = function (targetElement) {
649
- var thisElement = targetElement.selectAll("".concat(targetElement.node().tagName, " > *")).data([this]);
650
- thisElement.exit()
651
- .remove();
652
- return thisElement.enter().append(this.type())
653
- .attr("reactd3", 0)
654
- .merge(thisElement)
655
- .each(function (d) {
656
- var element = common.select(this);
657
- d.update(element);
658
- d.renderChildren(element);
659
- });
660
- };
661
- VNode.prototype.renderChildren = function (targetElement) {
662
- var thisElement = targetElement.selectAll("".concat(targetElement.node().tagName, " > *")).data(this._children);
663
- thisElement.exit()
664
- .remove();
665
- return thisElement.enter().append(function (d) { return document.createElement(d.type()); })
666
- .attr("reactd3", function (_d, i) { return i; })
667
- .merge(thisElement)
668
- .each(function (d) {
669
- var element = common.select(this);
670
- d.update(element);
671
- d.renderChildren(element);
672
- });
673
- };
674
- return VNode;
675
- }());
676
- var ConstVNode = /** @class */ (function (_super) {
677
- __extends(ConstVNode, _super);
678
- function ConstVNode(type, attrs, children) {
679
- var _this = _super.call(this, attrs, children) || this;
680
- _this._type = type;
681
- return _this;
682
- }
683
- ConstVNode.prototype.type = function () {
684
- return this._type;
685
- };
686
- return ConstVNode;
687
- }(VNode));
688
- var TextVNode = /** @class */ (function (_super) {
689
- __extends(TextVNode, _super);
690
- function TextVNode(text) {
691
- var _this = _super.call(this, {}, []) || this;
692
- _this._text = text;
693
- return _this;
694
- }
695
- TextVNode.prototype.type = function () {
696
- return "span";
697
- };
698
- TextVNode.prototype.update = function (targetElement) {
699
- _super.prototype.update.call(this, targetElement);
700
- targetElement.text(this._text);
701
- };
702
- return TextVNode;
703
- }(VNode));
704
- function isReactFn(_) {
705
- return typeof _ === "function";
706
- }
707
- function isIVNode(_) {
708
- return _.prototype && _.prototype instanceof VNode;
709
- }
710
- var ReactD3 = /** @class */ (function () {
711
- function ReactD3() {
712
- }
713
- // static createElementXXX(type: string | ReactFn | IVNode, attrs: { [key: string]: string }, ...children: Array<string | VNode>): VNode {
714
- ReactD3.createElement = function (type, attrs) {
715
- var children = [];
716
- for (var _i = 2; _i < arguments.length; _i++) {
717
- children[_i - 2] = arguments[_i];
718
- }
719
- if (isIVNode(type)) {
720
- return new type(attrs);
721
- }
722
- else if (isReactFn(type)) {
723
- return type(attrs);
724
- }
725
- return new ConstVNode(type, attrs, children.map(function (child) {
726
- if (typeof child === "string") {
727
- return new TextVNode(child);
728
- }
729
- return child;
730
- }));
731
- };
732
- ReactD3.render = function (vdom, targetElement) {
733
- vdom.render(targetElement);
734
- };
735
- return ReactD3;
736
- }());
413
+ var StyledTable = /** @class */ (function (_super) {
414
+ __extends(StyledTable, _super);
415
+ function StyledTable() {
416
+ return _super.call(this) || this;
417
+ }
418
+ StyledTable.prototype.applyStyleObject = function (selection, styleObject) {
419
+ Object.keys(styleObject).forEach(function (styleName) {
420
+ selection.style(styleName, styleObject[styleName]);
421
+ });
422
+ };
423
+ StyledTable.prototype.update = function (domNode, element) {
424
+ var _this = this;
425
+ _super.prototype.update.call(this, domNode, element);
426
+ element.selectAll("tr,th,td")
427
+ .attr("style", "")
428
+ .style("font-family", this.fontFamily())
429
+ .style("color", this.fontColor());
430
+ this.theadColumnStyles().forEach(function (styleObj, i) {
431
+ _this.applyStyleObject(element.select(".th-".concat(i)), styleObj);
432
+ });
433
+ this.tbodyColumnStyles().forEach(function (styleObj, i) {
434
+ _this.applyStyleObject(element.selectAll(".col-".concat(i)), styleObj);
435
+ });
436
+ var evenRowStylesExist = Object.keys(this.evenRowStyles()).length > 0;
437
+ var lastRowStylesExist = Object.keys(this.lastRowStyles()).length > 0;
438
+ var tbodyRows = element.selectAll("tbody > tr");
439
+ if (evenRowStylesExist) {
440
+ var tbodyEvenRows = tbodyRows.select(function (d, i) { return i % 2 ? this : null; });
441
+ this.applyStyleObject(tbodyEvenRows, this.evenRowStyles());
442
+ }
443
+ if (lastRowStylesExist) {
444
+ var tbodyLastRow = tbodyRows.select(function (d, i, arr) { return i === arr.length - 1 ? this : null; });
445
+ this.applyStyleObject(tbodyLastRow, this.lastRowStyles());
446
+ }
447
+ };
448
+ return StyledTable;
449
+ }(SimpleTable));
450
+ StyledTable.prototype._class += " html_StyledTable";
451
+ StyledTable.prototype.publish("fontFamily", "Verdana", "string", "Base font-family used within the table");
452
+ StyledTable.prototype.publish("fontColor", "#333", "string", "Base font color used within the table");
453
+ StyledTable.prototype.publish("theadColumnStyles", [], "array", 'Array of objects containing styles for the thead columns (ex: [{"color":"red"},{"color":"blue"}])');
454
+ StyledTable.prototype.publish("tbodyColumnStyles", [], "array", 'Array of objects containing styles for the tbody columns (ex: [{"color":"red"},{"color":"blue"}])');
455
+ StyledTable.prototype.publish("lastRowStyles", {}, "object", 'Object containing styles for the last row (ex: {"color":"red"})');
456
+ StyledTable.prototype.publish("evenRowStyles", {}, "object", 'Object containing styles for even rows (ex: {"background-color":"#AAA"})');
737
457
 
738
- var VizComponent = /** @class */ (function (_super) {
739
- __extends(VizComponent, _super);
740
- function VizComponent() {
741
- return _super !== null && _super.apply(this, arguments) || this;
742
- }
743
- VizComponent.prototype.refreshProps = function () {
744
- for (var key in this.props) {
745
- if (this.widget[key] && typeof this.widget[key] === "function") {
746
- this.widget[key](this.props[key]);
747
- }
748
- }
749
- };
750
- VizComponent.prototype.componentDidMount = function () {
751
- this.widget = new this.props.type()
752
- .target(this.base);
753
- this.refreshProps();
754
- this.widget
755
- .render();
756
- };
757
- VizComponent.prototype.componentWillUnmount = function () {
758
- this.widget
759
- .target(null)
760
- .render();
761
- };
762
- VizComponent.prototype.render = function () {
763
- return y("div", { style: this.props.style });
764
- };
765
- VizComponent.prototype.componentDidUpdate = function () {
766
- this.refreshProps();
767
- this.widget.render();
768
- };
769
- return VizComponent;
770
- }(JSXWidget.Component));
458
+ var BreakdownTable = /** @class */ (function (_super) {
459
+ __extends(BreakdownTable, _super);
460
+ function BreakdownTable() {
461
+ return _super.call(this) || this;
462
+ }
463
+ BreakdownTable.prototype.transformData = function () {
464
+ var rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
465
+ return this.breakdownData(rowCount);
466
+ };
467
+ BreakdownTable.prototype.breakdownData = function (limit) {
468
+ var len = this.data().length;
469
+ var sum = this.data().reduce(function (acc, row) { return acc + row[1]; }, 0);
470
+ var data = [];
471
+ var percSum = 0;
472
+ this.data().sort(function (a, b) { return a[1] > b[1] ? -1 : 1; });
473
+ var hiddenRowCount = len - limit;
474
+ var showOther = hiddenRowCount > 0;
475
+ this.data()
476
+ .filter(function (_, i) { return showOther ? i < limit - 1 : true; })
477
+ .forEach(function (row) {
478
+ var perc = Math.round((row[1] / sum) * 100);
479
+ percSum += perc;
480
+ data.push([row[0], perc + "%"]);
481
+ });
482
+ if (showOther) {
483
+ var otherLabel = "".concat(this.otherLabel(), " (").concat(len - limit + 1, ")");
484
+ var otherPercentage = "~" + (100 - percSum) + "%";
485
+ data.push([otherLabel, otherPercentage]);
486
+ }
487
+ return data;
488
+ };
489
+ BreakdownTable.prototype.calculateRowCount = function () {
490
+ var theadRowHeight = this.columns().length > 0 ? this.thFontSize() + 5 : 0;
491
+ var tbodyRowHeight = this.fontSize() + 5;
492
+ var tbodyAvailableHeight = this.height() - theadRowHeight;
493
+ var rowCount = Math.floor(tbodyAvailableHeight / tbodyRowHeight);
494
+ return rowCount;
495
+ };
496
+ BreakdownTable.prototype.enter = function (domNode, element) {
497
+ var _this = this;
498
+ _super.prototype.enter.call(this, domNode, element);
499
+ this._tooltip = new HTMLTooltip()
500
+ .target(domNode);
501
+ this._tooltip
502
+ .tooltipHTML(function (data) {
503
+ var _a;
504
+ var rowCount = _this.useCalculatedRowCount() ? _this.calculateRowCount() : _this.rowCount();
505
+ var rowHeight = (_a = Math.max.apply(Math, data.map(function (row) { return _this.textSize(row[0], _this.fontFamily(), _this.fontSize()).height; }))) !== null && _a !== void 0 ? _a : _this.fontSize();
506
+ var widestLabel = Math.max.apply(Math, data.map(function (row) { return _this.textSize(row[0], _this.fontFamily(), _this.fontSize()).width; }));
507
+ var widestPerc = 30;
508
+ var colCount = 2;
509
+ var w = colCount * (widestLabel + widestPerc) + (_this._tooltip.padding() * 2);
510
+ var h = rowHeight * Math.ceil((data.length - rowCount) / colCount) + (_this._tooltip.padding() * 2);
511
+ _this._tooltip.tooltipWidth(w);
512
+ _this._tooltip.tooltipHeight(h);
513
+ var otherData = _this.breakdownData(_this.data().length).slice(rowCount - 1);
514
+ return "<div style=\"\n width: 100%;\n height: 100%;\n font-size: ".concat(_this.fontSize(), "px;\n \">").concat(otherData.map(function (row) {
515
+ return "<div style=\"\n float:left;\n width:".concat(Math.floor(99 / colCount), "%;\n \">").concat(row[0], ": ").concat(row[1], "</div>");
516
+ }).join(""), "</div>");
517
+ });
518
+ };
519
+ BreakdownTable.prototype.update = function (domNode, element) {
520
+ this.theadColumnStyles_default([
521
+ {
522
+ "color": this.thFirstColor(),
523
+ "font-size": this.thFontSize() + "px",
524
+ "font-weight": this.thFontWeight(),
525
+ "text-align": this.labelAlignment(),
526
+ "width": "auto",
527
+ "padding": "0px"
528
+ },
529
+ {
530
+ "width": "1%",
531
+ "font-size": this.thFontSize() + "px",
532
+ "font-weight": this.thFontWeight(),
533
+ "text-align": this.percentageAlignment(),
534
+ "padding": "0px"
535
+ }
536
+ ]);
537
+ this.tbodyColumnStyles_default([
538
+ {
539
+ "color": this.topLabelColor(),
540
+ "font-size": this.fontSize() + "px",
541
+ "font-weight": "normal",
542
+ "text-align": this.labelAlignment(),
543
+ "width": "auto",
544
+ "padding": "0px"
545
+ },
546
+ {
547
+ "color": this.topPercentageColor(),
548
+ "font-size": this.fontSize() + "px",
549
+ "font-weight": "normal",
550
+ "text-align": this.percentageAlignment(),
551
+ "width": "1%",
552
+ "padding": "0px"
553
+ }
554
+ ]);
555
+ this.lastRowStyles_default([
556
+ {
557
+ "color": this.otherLabelColor(),
558
+ "font-size": this.fontSize() + "px",
559
+ "font-weight": this.otherLabelBold() ? "bold" : "normal",
560
+ "text-align": this.labelAlignment(),
561
+ "width": "auto",
562
+ "padding": "0px"
563
+ },
564
+ {
565
+ "color": this.otherLabelColor(),
566
+ "font-size": this.fontSize() + "px",
567
+ "font-weight": this.otherPercentageBold() ? "bold" : "normal",
568
+ "text-align": this.percentageAlignment(),
569
+ "width": "1%",
570
+ "padding": "0px"
571
+ }
572
+ ]);
573
+ _super.prototype.update.call(this, domNode, element);
574
+ var rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
575
+ if (rowCount < this.data().length) {
576
+ var lastRow_1 = element.select("tbody > tr:last-child");
577
+ var context_1 = this;
578
+ lastRow_1
579
+ .on("mouseout.tooltip", function (d) {
580
+ context_1._tooltip._triggerElement = lastRow_1;
581
+ context_1._tooltip
582
+ .visible(false)
583
+ .render();
584
+ })
585
+ .on("mouseenter.tooltip", function (d) {
586
+ context_1._tooltip._triggerElement = lastRow_1;
587
+ context_1._tooltip
588
+ .direction("n")
589
+ .data(context_1.data())
590
+ .visible(true)
591
+ .render();
592
+ });
593
+ }
594
+ };
595
+ return BreakdownTable;
596
+ }(StyledTable));
597
+ BreakdownTable.prototype._class += " html_BreakdownTable";
598
+ BreakdownTable.prototype.publish("useCalculatedRowCount", true, "boolean", "If true, rowCount will be calculated and its default will be overwritten");
599
+ BreakdownTable.prototype.publish("rowCount", 5, "number", "Number of total rows to display (including the 'other' row)", undefined, { disable: function (w) { return w.useCalculatedRowCount(); } });
600
+ BreakdownTable.prototype.publish("fontSize", 14, "number", "Font size (pixels)");
601
+ BreakdownTable.prototype.publish("labelAlignment", "left", "set", "Alignment of the label column text", ["left", "center", "right"]);
602
+ BreakdownTable.prototype.publish("percentageAlignment", "center", "set", "Alignment of the percentage column text", ["left", "center", "right"]);
603
+ BreakdownTable.prototype.publish("topLabelColor", "#333", "html-color", "Color of displayed 'top' labels");
604
+ BreakdownTable.prototype.publish("topPercentageColor", "#1A99D5", "html-color", "Color of displayed 'top' percentages");
605
+ BreakdownTable.prototype.publish("topPercentageBold", true, "html-color", "If true, the 'top' percentages will be bold");
606
+ BreakdownTable.prototype.publish("otherLabel", "Other", "string", "Label text for the 'other' row");
607
+ BreakdownTable.prototype.publish("otherLabelColor", "#AAA", "html-color", "Color of the 'other' label");
608
+ BreakdownTable.prototype.publish("otherLabelBold", false, "html-color", "If true, the 'other' label will be bold");
609
+ BreakdownTable.prototype.publish("otherPercentageColor", "#AAA", "html-color", "Color of the 'other' percentage");
610
+ BreakdownTable.prototype.publish("otherPercentageBold", false, "html-color", "If true, the 'other' percentage will be bold");
611
+ BreakdownTable.prototype.publish("thFontWeight", "bold", "string", "Font weight for th elements");
612
+ BreakdownTable.prototype.publish("thFontSize", 26, "number", "Font size for th elements");
613
+ BreakdownTable.prototype.publish("thFirstColor", "#333", "html-color", "Text color of the first th element");
614
+ BreakdownTable.prototype.publish("thLastColor", "#333", "html-color", "Text color of the last th element");
771
615
 
772
- var VizInstance = /** @class */ (function (_super) {
773
- __extends(VizInstance, _super);
774
- function VizInstance() {
775
- return _super !== null && _super.apply(this, arguments) || this;
776
- }
777
- VizInstance.prototype.refreshProps = function () {
778
- for (var key in this.props) {
779
- if (this.widget[key] && typeof this.widget[key] === "function") {
780
- this.widget[key](this.props[key]);
781
- }
782
- }
783
- };
784
- VizInstance.prototype.componentDidMount = function () {
785
- this.widget = this.props.instance
786
- .target(this.base);
787
- this.refreshProps();
788
- this.widget
789
- .render();
790
- };
791
- VizInstance.prototype.componentWillUnmount = function () {
792
- this.widget
793
- .target(null)
794
- .render();
795
- };
796
- VizInstance.prototype.render = function () {
797
- return y("div", { style: this.props.style });
798
- };
799
- VizInstance.prototype.componentDidUpdate = function () {
800
- this.refreshProps();
801
- this.widget.render();
802
- };
803
- return VizInstance;
804
- }(JSXWidget.Component));
616
+ var n,l$1,u$1,i$1,o$1,r$1,f$1,c$1={},s$1=[],a$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v$1=Array.isArray;function h$1(n,l){for(var u in l)n[u]=l[u];return n}function p$1(n){var l=n.parentNode;l&&l.removeChild(n);}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d$1(l,f,i,o,null)}function d$1(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function k$1(n){return n.children}function b$1(n,l){this.props=n,this.context=l;}function g$1(n,l){if(null==l)return n.__?g$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__d||u.__e;return "function"==typeof n.type?g$1(n):null}function m$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return m$1(n)}}function w$1(n){(!n.__d&&(n.__d=!0)&&i$1.push(n)&&!x.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||r$1)(x);}function x(){var n,l,u,t,o,r,e,c,s;for(i$1.sort(f$1);n=i$1.shift();)n.__d&&(l=i$1.length,t=void 0,o=void 0,r=void 0,c=(e=(u=n).__v).__e,(s=u.__P)&&(t=[],o=[],(r=h$1({},e)).__v=e.__v+1,z$1(s,e,r,u.__n,void 0!==s.ownerSVGElement,null!=e.__h?[c]:null,t,null==c?g$1(e):c,e.__h,o),L(t,e,o),e.__e!=c&&m$1(e)),i$1.length>l&&i$1.sort(f$1));x.__r=0;}function P(n,l,u,t,i,o,r,f,e,a,h){var p,y,_,b,m,w,x,P,C,D=0,H=t&&t.__k||s$1,I=H.length,T=I,j=l.length;for(u.__k=[],p=0;p<j;p++)null!=(b=u.__k[p]=null==(b=l[p])||"boolean"==typeof b||"function"==typeof b?null:"string"==typeof b||"number"==typeof b||"bigint"==typeof b?d$1(null,b,null,null,b):v$1(b)?d$1(k$1,{children:b},null,null,null):b.__b>0?d$1(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)?(b.__=u,b.__b=u.__b+1,-1===(P=A(b,H,x=p+D,T))?_=c$1:(_=H[P]||c$1,H[P]=void 0,T--),z$1(n,b,_,i,o,r,f,e,a,h),m=b.__e,(y=b.ref)&&_.ref!=y&&(_.ref&&N(_.ref,null,b),h.push(y,b.__c||m,b)),null!=m&&(null==w&&(w=m),(C=_===c$1||null===_.__v)?-1==P&&D--:P!==x&&(P===x+1?D++:P>x?T>j-x?D+=P-x:D--:D=P<x&&P==x-1?P-x:0),x=p+D,"function"!=typeof b.type||P===x&&_.__k!==b.__k?"function"==typeof b.type||P===x&&!C?void 0!==b.__d?(e=b.__d,b.__d=void 0):e=m.nextSibling:e=S(n,m,e):e=$(b,e,n),"function"==typeof u.type&&(u.__d=e))):(_=H[p])&&null==_.key&&_.__e&&(_.__e==e&&(_.__=t,e=g$1(_)),O(_,_,!1),H[p]=null);for(u.__e=w,p=I;p--;)null!=H[p]&&("function"==typeof u.type&&null!=H[p].__e&&H[p].__e==u.__d&&(u.__d=H[p].__e.nextSibling),O(H[p],H[p]));}function $(n,l,u){for(var t,i=n.__k,o=0;i&&o<i.length;o++)(t=i[o])&&(t.__=n,l="function"==typeof t.type?$(t,l,u):S(u,t.__e,l));return l}function S(n,l,u){return null==u||u.parentNode!==n?n.insertBefore(l,null):l==u&&null!=l.parentNode||n.insertBefore(l,u),l.nextSibling}function A(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&i==e.key&&o===e.type)return r;r--;}if(f<l.length){if((e=l[f])&&i==e.key&&o===e.type)return f;f++;}}return -1}function D(n,l,u,t,i){var o;for(o in u)"children"===o||"key"===o||o in l||I(n,o,null,u[o],t);for(o in l)i&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||I(n,o,l[o],u[o],t);}function H(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a$1.test(l)?u:u+"px";}function I(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||H(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||H(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?j$1:T$1,o)):n.removeEventListener(l,o?j$1:T$1,o);else if("dangerouslySetInnerHTML"!==l){if(i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&"role"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u));}}function T$1(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l$1.event?l$1.event(n):n)}function j$1(n){return this.l[n.type+!0](l$1.event?l$1.event(n):n)}function z$1(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,g,m,w,x,$,C,S,A,D,H,I=u.type;if(void 0!==u.constructor)return null;null!=t.__h&&(c=t.__h,e=u.__e=t.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);n:if("function"==typeof I)try{if(w=u.props,x=(a=I.contextType)&&i[a.__c],$=a?x?x.props.value:a.__:i,t.__c?m=(p=u.__c=t.__c).__=p.__E:("prototype"in I&&I.prototype.render?u.__c=p=new I(w,$):(u.__c=p=new b$1(w,$),p.constructor=I,p.render=q),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=$,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=I.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=h$1({},p.__s)),h$1(p.__s,I.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==I.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else {if(null==I.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,$),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,$)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u);}),C=0;C<p._sb.length;C++)p.__h.push(p._sb[C]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,$),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,g);});}if(p.context=$,p.props=w,p.__P=n,p.__e=!1,S=l$1.__r,A=0,"prototype"in I&&I.prototype.render){for(p.state=p.__s,p.__d=!1,S&&S(u),a=p.render(p.props,p.state,p.context),D=0;D<p._sb.length;D++)p.__h.push(p._sb[D]);p._sb=[];}else do{p.__d=!1,S&&S(u),a=p.render(p.props,p.state,p.context),p.state=p.__s;}while(p.__d&&++A<25);p.state=p.__s,null!=p.getChildContext&&(i=h$1(h$1({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(g=p.getSnapshotBeforeUpdate(d,_)),P(n,v$1(H=null!=a&&a.type===k$1&&null==a.key?a.props.children:a)?H:[H],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__h=null,p.__h.length&&f.push(p),m&&(p.__E=p.__=null);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,t);}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=M(t.__e,u,t,i,o,r,f,c,s);(a=l$1.diffed)&&a(u);}function L(n,u,t){for(var i=0;i<t.length;i++)N(t[i],t[++i],t[++i]);l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function M(l,u,t,i,o,r,f,e,s){var a,h,y,d=t.props,_=u.props,k=u.type,b=0;if("svg"===k&&(o=!0),null!=r)for(;b<r.length;b++)if((a=r[b])&&"setAttribute"in a==!!k&&(k?a.localName===k:3===a.nodeType)){l=a,r[b]=null;break}if(null==l){if(null===k)return document.createTextNode(_);l=o?document.createElementNS("http://www.w3.org/2000/svg",k):document.createElement(k,_.is&&_),r=null,e=!1;}if(null===k)d===_||e&&l.data===_||(l.data=_);else {if(r=r&&n.call(l.childNodes),h=(d=t.props||c$1).dangerouslySetInnerHTML,y=_.dangerouslySetInnerHTML,!e){if(null!=r)for(d={},b=0;b<l.attributes.length;b++)d[l.attributes[b].name]=l.attributes[b].value;(y||h)&&(y&&(h&&y.__html==h.__html||y.__html===l.innerHTML)||(l.innerHTML=y&&y.__html||""));}if(D(l,_,d,o,e),y)u.__k=[];else if(P(l,v$1(b=u.props.children)?b:[b],u,t,i,o&&"foreignObject"!==k,r,f,r?r[0]:t.__k&&g$1(t,0),e,s),null!=r)for(b=r.length;b--;)null!=r[b]&&p$1(r[b]);e||("value"in _&&void 0!==(b=_.value)&&(b!==l.value||"progress"===k&&!b||"option"===k&&b!==d.value)&&I(l,"value",b,d.value,!1),"checked"in _&&void 0!==(b=_.checked)&&b!==l.checked&&I(l,"checked",b,d.checked,!1));}return l}function N(n,u,t){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,t);}}function O(n,u,t){var i,o;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||N(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,u);}i.base=i.__P=null,n.__c=void 0;}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&O(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p$1(n.__e),n.__=n.__e=n.__d=void 0;}function q(n,l,u){return this.constructor(n,u)}function B$1(u,t,i){var o,r,f,e;l$1.__&&l$1.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],z$1(t,u=(!o&&i||t).__k=y(k$1,null,[u]),r||c$1,c$1,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),L(f,u,e);}n=s$1.slice,l$1={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l;}throw n}},u$1=0,b$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h$1({},this.state),"function"==typeof n&&(n=n(h$1({},u),this.props)),n&&h$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w$1(this));},b$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w$1(this));},b$1.prototype.render=k$1,i$1=[],r$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$1=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0;
805
617
 
806
- var StatsTable = /** @class */ (function (_super) {
807
- __extends(StatsTable, _super);
808
- function StatsTable() {
809
- return _super !== null && _super.apply(this, arguments) || this;
810
- }
811
- StatsTable.prototype.transformData = function () {
812
- var _this = this;
813
- var totalRow = [["Total", 0, 0]];
814
- var data = this.data();
815
- data.forEach(function (row) {
816
- totalRow[0][1] += row[1];
817
- totalRow[0][2] += row[2];
818
- });
819
- return data
820
- .concat(totalRow)
821
- .map(function (row) {
822
- return [
823
- row[0],
824
- _this.secondColumnFormat_exists() ? common.format(_this.secondColumnFormat())(row[1]) : row[1],
825
- _this.thirdColumnFormat_exists() ? common.format(_this.thirdColumnFormat())(row[2]) : row[2]
826
- ];
827
- });
828
- };
829
- StatsTable.prototype.update = function (domNode, element) {
830
- this.tbodyColumnStyles_default([
831
- {
832
- "font-weight": "bold",
833
- "width": this.firstColumnWidth(),
834
- "text-align": "left"
835
- },
836
- {
837
- "width": this.secondColumnWidth(),
838
- "text-align": "right"
839
- },
840
- {
841
- "width": this.thirdColumnWidth(),
842
- "text-align": "right"
843
- }
844
- ]);
845
- this.evenRowStyles_default([
846
- {
847
- "font-weight": "bold",
848
- "width": this.firstColumnWidth(),
849
- "text-align": "left",
850
- "font-color": this.evenRowFontColor(),
851
- "background-color": this.evenRowBackgroundColor()
852
- },
853
- {
854
- "width": this.secondColumnWidth(),
855
- "text-align": "right",
856
- "font-color": this.evenRowFontColor(),
857
- "background-color": this.evenRowBackgroundColor()
858
- },
859
- {
860
- "width": this.thirdColumnWidth(),
861
- "text-align": "right",
862
- "font-color": this.evenRowFontColor(),
863
- "background-color": this.evenRowBackgroundColor()
864
- }
865
- ]);
866
- this.lastRowStyles_default({
867
- "font-weight": "bold"
868
- });
869
- _super.prototype.update.call(this, domNode, element);
870
- };
871
- return StatsTable;
872
- }(StyledTable));
873
- StatsTable.prototype._class += " html_StatsTable";
874
- StatsTable.prototype.publish("labelColor", "#333", "html-color", "Color of the text in the first column");
875
- StatsTable.prototype.publish("primaryValueColor", "#333", "html-color", "Color of the text in the second column");
876
- StatsTable.prototype.publish("secondaryValueColor", "#333", "html-color", "Color of the text in the third column");
877
- StatsTable.prototype.publish("evenRowBackgroundColor", "#333", "html-color", "Background color of the even rows");
878
- StatsTable.prototype.publish("evenRowFontColor", "#333", "html-color", "Font color of the even rows");
879
- StatsTable.prototype.publish("firstColumnWidth", "auto", "string", "CSS style applied as the 'width' for the first column (ex: 40px)");
880
- StatsTable.prototype.publish("secondColumnWidth", "1%", "string", "CSS style applied as the 'width' for the second column (ex: 40px)");
881
- StatsTable.prototype.publish("thirdColumnWidth", "1%", "string", "CSS style applied as the 'width' for the third column (ex: 40px)");
882
- StatsTable.prototype.publish("secondColumnFormat", "$,.0f", "string", "d3-format specifier applied to the second column's values", undefined, { optional: true });
883
- StatsTable.prototype.publish("thirdColumnFormat", null, "string", "d3-format specifier applied to the third column's values", undefined, { optional: true });
618
+ var r,u,i,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r=null,e&&e(n);},l$1.__r=function(n){a&&a(n);var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],0)),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w(n){var t=r;n.__c=n.__(),r=t;}
884
619
 
885
- function styleInject(css, ref) {
886
- if ( ref === void 0 ) ref = {};
887
- var insertAt = ref.insertAt;
620
+ var JSXWidget = /** @class */ (function (_super) {
621
+ __extends(JSXWidget, _super);
622
+ function JSXWidget() {
623
+ return _super !== null && _super.apply(this, arguments) || this;
624
+ }
625
+ JSXWidget.prototype.jsxRender = function (jsx, domNode) {
626
+ this.rootNode = B$1(jsx, domNode, this.rootNode);
627
+ };
628
+ JSXWidget.Component = b$1;
629
+ JSXWidget.createElement = y;
630
+ return JSXWidget;
631
+ }(common.HTMLWidget));
632
+ JSXWidget.prototype._class += " html_JSXWidget";
888
633
 
889
- if (!css || typeof document === 'undefined') { return; }
634
+ var VNode = /** @class */ (function () {
635
+ function VNode(attrs, children) {
636
+ this._attrs = attrs;
637
+ this._children = children;
638
+ }
639
+ VNode.prototype.type = function () {
640
+ return "div";
641
+ };
642
+ VNode.prototype.attrs = function () {
643
+ return this._attrs;
644
+ };
645
+ VNode.prototype.attr = function (key) {
646
+ return this._attrs[key];
647
+ };
648
+ VNode.prototype.children = function () {
649
+ return this._children;
650
+ };
651
+ VNode.prototype.update = function (targetElement) {
652
+ for (var key in this._attrs) {
653
+ targetElement.attr(key, this._attrs[key]);
654
+ }
655
+ };
656
+ VNode.prototype.render = function (targetElement) {
657
+ var thisElement = targetElement.selectAll("".concat(targetElement.node().tagName, " > *")).data([this]);
658
+ thisElement.exit()
659
+ .remove();
660
+ return thisElement.enter().append(this.type())
661
+ .attr("reactd3", 0)
662
+ .merge(thisElement)
663
+ .each(function (d) {
664
+ var element = common.select(this);
665
+ d.update(element);
666
+ d.renderChildren(element);
667
+ });
668
+ };
669
+ VNode.prototype.renderChildren = function (targetElement) {
670
+ var thisElement = targetElement.selectAll("".concat(targetElement.node().tagName, " > *")).data(this._children);
671
+ thisElement.exit()
672
+ .remove();
673
+ return thisElement.enter().append(function (d) { return document.createElement(d.type()); })
674
+ .attr("reactd3", function (_d, i) { return i; })
675
+ .merge(thisElement)
676
+ .each(function (d) {
677
+ var element = common.select(this);
678
+ d.update(element);
679
+ d.renderChildren(element);
680
+ });
681
+ };
682
+ return VNode;
683
+ }());
684
+ var ConstVNode = /** @class */ (function (_super) {
685
+ __extends(ConstVNode, _super);
686
+ function ConstVNode(type, attrs, children) {
687
+ var _this = _super.call(this, attrs, children) || this;
688
+ _this._type = type;
689
+ return _this;
690
+ }
691
+ ConstVNode.prototype.type = function () {
692
+ return this._type;
693
+ };
694
+ return ConstVNode;
695
+ }(VNode));
696
+ var TextVNode = /** @class */ (function (_super) {
697
+ __extends(TextVNode, _super);
698
+ function TextVNode(text) {
699
+ var _this = _super.call(this, {}, []) || this;
700
+ _this._text = text;
701
+ return _this;
702
+ }
703
+ TextVNode.prototype.type = function () {
704
+ return "span";
705
+ };
706
+ TextVNode.prototype.update = function (targetElement) {
707
+ _super.prototype.update.call(this, targetElement);
708
+ targetElement.text(this._text);
709
+ };
710
+ return TextVNode;
711
+ }(VNode));
712
+ function isReactFn(_) {
713
+ return typeof _ === "function";
714
+ }
715
+ function isIVNode(_) {
716
+ return _.prototype && _.prototype instanceof VNode;
717
+ }
718
+ var ReactD3 = /** @class */ (function () {
719
+ function ReactD3() {
720
+ }
721
+ // static createElementXXX(type: string | ReactFn | IVNode, attrs: { [key: string]: string }, ...children: Array<string | VNode>): VNode {
722
+ ReactD3.createElement = function (type, attrs) {
723
+ var children = [];
724
+ for (var _i = 2; _i < arguments.length; _i++) {
725
+ children[_i - 2] = arguments[_i];
726
+ }
727
+ if (isIVNode(type)) {
728
+ return new type(attrs);
729
+ }
730
+ else if (isReactFn(type)) {
731
+ return type(attrs);
732
+ }
733
+ return new ConstVNode(type, attrs, children.map(function (child) {
734
+ if (typeof child === "string") {
735
+ return new TextVNode(child);
736
+ }
737
+ return child;
738
+ }));
739
+ };
740
+ ReactD3.render = function (vdom, targetElement) {
741
+ vdom.render(targetElement);
742
+ };
743
+ return ReactD3;
744
+ }());
890
745
 
891
- var head = document.head || document.getElementsByTagName('head')[0];
892
- var style = document.createElement('style');
893
- style.type = 'text/css';
746
+ var VizComponent = /** @class */ (function (_super) {
747
+ __extends(VizComponent, _super);
748
+ function VizComponent() {
749
+ return _super !== null && _super.apply(this, arguments) || this;
750
+ }
751
+ VizComponent.prototype.refreshProps = function () {
752
+ for (var key in this.props) {
753
+ if (this.widget[key] && typeof this.widget[key] === "function") {
754
+ this.widget[key](this.props[key]);
755
+ }
756
+ }
757
+ };
758
+ VizComponent.prototype.componentDidMount = function () {
759
+ this.widget = new this.props.type()
760
+ .target(this.base);
761
+ this.refreshProps();
762
+ this.widget
763
+ .render();
764
+ };
765
+ VizComponent.prototype.componentWillUnmount = function () {
766
+ this.widget
767
+ .target(null)
768
+ .render();
769
+ };
770
+ VizComponent.prototype.render = function () {
771
+ return y("div", { style: this.props.style });
772
+ };
773
+ VizComponent.prototype.componentDidUpdate = function () {
774
+ this.refreshProps();
775
+ this.widget.render();
776
+ };
777
+ return VizComponent;
778
+ }(JSXWidget.Component));
894
779
 
895
- if (insertAt === 'top') {
896
- if (head.firstChild) {
897
- head.insertBefore(style, head.firstChild);
898
- } else {
899
- head.appendChild(style);
900
- }
901
- } else {
902
- head.appendChild(style);
780
+ var VizInstance = /** @class */ (function (_super) {
781
+ __extends(VizInstance, _super);
782
+ function VizInstance() {
783
+ return _super !== null && _super.apply(this, arguments) || this;
784
+ }
785
+ VizInstance.prototype.refreshProps = function () {
786
+ for (var key in this.props) {
787
+ if (this.widget[key] && typeof this.widget[key] === "function") {
788
+ this.widget[key](this.props[key]);
789
+ }
790
+ }
791
+ };
792
+ VizInstance.prototype.componentDidMount = function () {
793
+ this.widget = this.props.instance
794
+ .target(this.base);
795
+ this.refreshProps();
796
+ this.widget
797
+ .render();
798
+ };
799
+ VizInstance.prototype.componentWillUnmount = function () {
800
+ this.widget
801
+ .target(null)
802
+ .render();
803
+ };
804
+ VizInstance.prototype.render = function () {
805
+ return y("div", { style: this.props.style });
806
+ };
807
+ VizInstance.prototype.componentDidUpdate = function () {
808
+ this.refreshProps();
809
+ this.widget.render();
810
+ };
811
+ return VizInstance;
812
+ }(JSXWidget.Component));
813
+
814
+ var StatsTable = /** @class */ (function (_super) {
815
+ __extends(StatsTable, _super);
816
+ function StatsTable() {
817
+ return _super !== null && _super.apply(this, arguments) || this;
903
818
  }
819
+ StatsTable.prototype.transformData = function () {
820
+ var _this = this;
821
+ var totalRow = [["Total", 0, 0]];
822
+ var data = this.data();
823
+ data.forEach(function (row) {
824
+ totalRow[0][1] += row[1];
825
+ totalRow[0][2] += row[2];
826
+ });
827
+ return data
828
+ .concat(totalRow)
829
+ .map(function (row) {
830
+ return [
831
+ row[0],
832
+ _this.secondColumnFormat_exists() ? common.format(_this.secondColumnFormat())(row[1]) : row[1],
833
+ _this.thirdColumnFormat_exists() ? common.format(_this.thirdColumnFormat())(row[2]) : row[2]
834
+ ];
835
+ });
836
+ };
837
+ StatsTable.prototype.update = function (domNode, element) {
838
+ this.tbodyColumnStyles_default([
839
+ {
840
+ "font-weight": "bold",
841
+ "width": this.firstColumnWidth(),
842
+ "text-align": "left"
843
+ },
844
+ {
845
+ "width": this.secondColumnWidth(),
846
+ "text-align": "right"
847
+ },
848
+ {
849
+ "width": this.thirdColumnWidth(),
850
+ "text-align": "right"
851
+ }
852
+ ]);
853
+ this.evenRowStyles_default([
854
+ {
855
+ "font-weight": "bold",
856
+ "width": this.firstColumnWidth(),
857
+ "text-align": "left",
858
+ "font-color": this.evenRowFontColor(),
859
+ "background-color": this.evenRowBackgroundColor()
860
+ },
861
+ {
862
+ "width": this.secondColumnWidth(),
863
+ "text-align": "right",
864
+ "font-color": this.evenRowFontColor(),
865
+ "background-color": this.evenRowBackgroundColor()
866
+ },
867
+ {
868
+ "width": this.thirdColumnWidth(),
869
+ "text-align": "right",
870
+ "font-color": this.evenRowFontColor(),
871
+ "background-color": this.evenRowBackgroundColor()
872
+ }
873
+ ]);
874
+ this.lastRowStyles_default({
875
+ "font-weight": "bold"
876
+ });
877
+ _super.prototype.update.call(this, domNode, element);
878
+ };
879
+ return StatsTable;
880
+ }(StyledTable));
881
+ StatsTable.prototype._class += " html_StatsTable";
882
+ StatsTable.prototype.publish("labelColor", "#333", "html-color", "Color of the text in the first column");
883
+ StatsTable.prototype.publish("primaryValueColor", "#333", "html-color", "Color of the text in the second column");
884
+ StatsTable.prototype.publish("secondaryValueColor", "#333", "html-color", "Color of the text in the third column");
885
+ StatsTable.prototype.publish("evenRowBackgroundColor", "#333", "html-color", "Background color of the even rows");
886
+ StatsTable.prototype.publish("evenRowFontColor", "#333", "html-color", "Font color of the even rows");
887
+ StatsTable.prototype.publish("firstColumnWidth", "auto", "string", "CSS style applied as the 'width' for the first column (ex: 40px)");
888
+ StatsTable.prototype.publish("secondColumnWidth", "1%", "string", "CSS style applied as the 'width' for the second column (ex: 40px)");
889
+ StatsTable.prototype.publish("thirdColumnWidth", "1%", "string", "CSS style applied as the 'width' for the third column (ex: 40px)");
890
+ StatsTable.prototype.publish("secondColumnFormat", "$,.0f", "string", "d3-format specifier applied to the second column's values", undefined, { optional: true });
891
+ StatsTable.prototype.publish("thirdColumnFormat", null, "string", "d3-format specifier applied to the third column's values", undefined, { optional: true });
892
+
893
+ function styleInject(css, ref) {
894
+ if ( ref === void 0 ) ref = {};
895
+ var insertAt = ref.insertAt;
896
+
897
+ if (!css || typeof document === 'undefined') { return; }
904
898
 
905
- if (style.styleSheet) {
906
- style.styleSheet.cssText = css;
899
+ var head = document.head || document.getElementsByTagName('head')[0];
900
+ var style = document.createElement('style');
901
+ style.type = 'text/css';
902
+
903
+ if (insertAt === 'top') {
904
+ if (head.firstChild) {
905
+ head.insertBefore(style, head.firstChild);
907
906
  } else {
908
- style.appendChild(document.createTextNode(css));
907
+ head.appendChild(style);
909
908
  }
909
+ } else {
910
+ head.appendChild(style);
910
911
  }
911
912
 
912
- var css_248z = "#wrap{width:100%}#left,#right{padding:5px}#left{background-color:red;display:block;overflow:hidden;text-align:left;text-overflow:ellipsis}#left,#right{white-space:nowrap}#right{background-color:orange;float:right;text-align:right}.html_TitleBar>.main{display:block;width:100%}.html_TitleBar .title{display:block;font-size:20px;font-weight:700;overflow:hidden;padding:4px;text-align:left;text-overflow:ellipsis;white-space:nowrap}.html_TitleBar .icon-bar{float:right;line-height:28px;padding:4px;text-align:right;white-space:nowrap}.html_TitleBar .icon-bar-item,.html_TitleBar .icon-bar-item>div{display:inline}.html_TitleBar .icon-bar a{color:#a9a9a9;padding-bottom:4px;padding-top:4px;text-align:center;transition:all .3s ease}.html_TitleBar .icon-bar a:hover{background-color:#f5f5f5}.html_TitleBar .icon-bar a.selected{background-color:#efe5e5}.html_TitleBar .icon-bar a.spacer{color:none;padding-bottom:0;padding-left:8px;padding-top:2px;text-align:center}.html_TitleBar .icon-bar a.spacer:hover{background-color:transparent}.html_TitleBar .icon-bar .active{background-color:#4caf50}";
913
- styleInject(css_248z);
913
+ if (style.styleSheet) {
914
+ style.styleSheet.cssText = css;
915
+ } else {
916
+ style.appendChild(document.createTextNode(css));
917
+ }
918
+ }
914
919
 
915
- var Item = /** @class */ (function (_super) {
916
- __extends(Item, _super);
917
- function Item(owner) {
918
- var _this = _super.call(this) || this;
919
- _this._owner = owner;
920
- _this._tag = "a";
921
- return _this;
922
- }
923
- return Item;
924
- }(common.HTMLWidget));
925
- var Button = /** @class */ (function (_super) {
926
- __extends(Button, _super);
927
- function Button(owner, icon) {
928
- var _this = _super.call(this, owner) || this;
929
- _this._icon = icon;
930
- return _this;
931
- }
932
- Button.prototype.icon = function () {
933
- return this._icon;
934
- };
935
- Button.prototype.enter = function (domNode, element) {
936
- var _this = this;
937
- _super.prototype.enter.call(this, domNode, element);
938
- element
939
- .attr("href", "#")
940
- .on("click", function (d, idx, groups) { return _this._owner.titleBarClick(_this, d, idx, groups); })
941
- .append("i")
942
- .attr("class", "fa ".concat(this._icon, " fa-lg fa-fw"));
943
- };
944
- return Button;
945
- }(Item));
946
- var ToggleButton = /** @class */ (function (_super) {
947
- __extends(ToggleButton, _super);
948
- function ToggleButton() {
949
- return _super !== null && _super.apply(this, arguments) || this;
950
- }
951
- ToggleButton.prototype.enter = function (domNode, element) {
952
- var _this = this;
953
- element.on("click.sel", function (d, idx, groups) {
954
- _this.selected(!_this.selected());
955
- _this.render();
956
- });
957
- _super.prototype.enter.call(this, domNode, element);
958
- };
959
- ToggleButton.prototype.update = function (domNode, element) {
960
- _super.prototype.update.call(this, domNode, element);
961
- this._element.classed("selected", this.selected());
962
- };
963
- return ToggleButton;
964
- }(Button));
965
- ToggleButton.prototype.publish("selected", false, "boolean");
966
- var Spacer = /** @class */ (function (_super) {
967
- __extends(Spacer, _super);
968
- function Spacer() {
969
- return _super !== null && _super.apply(this, arguments) || this;
970
- }
971
- Spacer.prototype.enter = function (domNode, element) {
972
- _super.prototype.enter.call(this, domNode, element);
973
- element
974
- .attr("class", "spacer")
975
- .attr("href", "#")
976
- .append("i");
977
- };
978
- return Spacer;
979
- }(Item));
980
- var TitleBar = /** @class */ (function (_super) {
981
- __extends(TitleBar, _super);
982
- function TitleBar() {
983
- return _super.call(this) || this;
984
- }
985
- TitleBar.prototype.enter = function (domNode, element) {
986
- _super.prototype.enter.call(this, domNode, element);
987
- this._divMain = element.append("div")
988
- .attr("class", "main");
989
- this._divIconBar = this._divMain.append("div")
990
- .attr("class", "icon-bar");
991
- this._divTitle = this._divMain.append("div")
992
- .attr("class", "title");
993
- };
994
- TitleBar.prototype.update = function (domNode, element) {
995
- _super.prototype.update.call(this, domNode, element);
996
- this._divTitle.text(this.title());
997
- var icons = this._divIconBar.selectAll(".icon-bar-item").data(this.buttons());
998
- icons.enter().append("div")
999
- .attr("class", "icon-bar-item")
1000
- .each(function (d) {
1001
- d.target(this);
1002
- })
1003
- .merge(icons)
1004
- .each(function (d) {
1005
- d.render();
1006
- });
1007
- icons.exit()
1008
- .each(function (d) {
1009
- d.target(null);
1010
- })
1011
- .remove();
1012
- icons.order();
1013
- };
1014
- return TitleBar;
1015
- }(JSXWidget));
1016
- TitleBar.prototype._class += " html_TitleBar";
1017
- TitleBar.prototype.publish("title", "", "string");
1018
- TitleBar.prototype.publish("buttons", [], "widgetArray");
920
+ var css_248z = "#wrap{width:100%}#left,#right{padding:5px}#left{background-color:red;display:block;overflow:hidden;text-align:left;text-overflow:ellipsis}#left,#right{white-space:nowrap}#right{background-color:orange;float:right;text-align:right}.html_TitleBar>.main{display:block;width:100%}.html_TitleBar .title{display:block;font-size:20px;font-weight:700;overflow:hidden;padding:4px;text-align:left;text-overflow:ellipsis;white-space:nowrap}.html_TitleBar .icon-bar{float:right;line-height:28px;padding:4px;text-align:right;white-space:nowrap}.html_TitleBar .icon-bar-item,.html_TitleBar .icon-bar-item>div{display:inline}.html_TitleBar .icon-bar a{color:#a9a9a9;padding-bottom:4px;padding-top:4px;text-align:center;transition:all .3s ease}.html_TitleBar .icon-bar a:hover{background-color:#f5f5f5}.html_TitleBar .icon-bar a.selected{background-color:#efe5e5}.html_TitleBar .icon-bar a.spacer{color:none;padding-bottom:0;padding-left:8px;padding-top:2px;text-align:center}.html_TitleBar .icon-bar a.spacer:hover{background-color:transparent}.html_TitleBar .icon-bar .active{background-color:#4caf50}";
921
+ styleInject(css_248z);
922
+
923
+ var Item = /** @class */ (function (_super) {
924
+ __extends(Item, _super);
925
+ function Item(owner) {
926
+ var _this = _super.call(this) || this;
927
+ _this._owner = owner;
928
+ _this._tag = "a";
929
+ return _this;
930
+ }
931
+ return Item;
932
+ }(common.HTMLWidget));
933
+ var Button = /** @class */ (function (_super) {
934
+ __extends(Button, _super);
935
+ function Button(owner, icon) {
936
+ var _this = _super.call(this, owner) || this;
937
+ _this._icon = icon;
938
+ return _this;
939
+ }
940
+ Button.prototype.icon = function () {
941
+ return this._icon;
942
+ };
943
+ Button.prototype.enter = function (domNode, element) {
944
+ var _this = this;
945
+ _super.prototype.enter.call(this, domNode, element);
946
+ element
947
+ .attr("href", "#")
948
+ .on("click", function (d, idx, groups) { return _this._owner.titleBarClick(_this, d, idx, groups); })
949
+ .append("i")
950
+ .attr("class", "fa ".concat(this._icon, " fa-lg fa-fw"));
951
+ };
952
+ return Button;
953
+ }(Item));
954
+ var ToggleButton = /** @class */ (function (_super) {
955
+ __extends(ToggleButton, _super);
956
+ function ToggleButton() {
957
+ return _super !== null && _super.apply(this, arguments) || this;
958
+ }
959
+ ToggleButton.prototype.enter = function (domNode, element) {
960
+ var _this = this;
961
+ element.on("click.sel", function (d, idx, groups) {
962
+ _this.selected(!_this.selected());
963
+ _this.render();
964
+ });
965
+ _super.prototype.enter.call(this, domNode, element);
966
+ };
967
+ ToggleButton.prototype.update = function (domNode, element) {
968
+ _super.prototype.update.call(this, domNode, element);
969
+ this._element.classed("selected", this.selected());
970
+ };
971
+ return ToggleButton;
972
+ }(Button));
973
+ ToggleButton.prototype.publish("selected", false, "boolean");
974
+ var Spacer = /** @class */ (function (_super) {
975
+ __extends(Spacer, _super);
976
+ function Spacer() {
977
+ return _super !== null && _super.apply(this, arguments) || this;
978
+ }
979
+ Spacer.prototype.enter = function (domNode, element) {
980
+ _super.prototype.enter.call(this, domNode, element);
981
+ element
982
+ .attr("class", "spacer")
983
+ .attr("href", "#")
984
+ .append("i");
985
+ };
986
+ return Spacer;
987
+ }(Item));
988
+ var TitleBar = /** @class */ (function (_super) {
989
+ __extends(TitleBar, _super);
990
+ function TitleBar() {
991
+ return _super.call(this) || this;
992
+ }
993
+ TitleBar.prototype.enter = function (domNode, element) {
994
+ _super.prototype.enter.call(this, domNode, element);
995
+ this._divMain = element.append("div")
996
+ .attr("class", "main");
997
+ this._divIconBar = this._divMain.append("div")
998
+ .attr("class", "icon-bar");
999
+ this._divTitle = this._divMain.append("div")
1000
+ .attr("class", "title");
1001
+ };
1002
+ TitleBar.prototype.update = function (domNode, element) {
1003
+ _super.prototype.update.call(this, domNode, element);
1004
+ this._divTitle.text(this.title());
1005
+ var icons = this._divIconBar.selectAll(".icon-bar-item").data(this.buttons());
1006
+ icons.enter().append("div")
1007
+ .attr("class", "icon-bar-item")
1008
+ .each(function (d) {
1009
+ d.target(this);
1010
+ })
1011
+ .merge(icons)
1012
+ .each(function (d) {
1013
+ d.render();
1014
+ });
1015
+ icons.exit()
1016
+ .each(function (d) {
1017
+ d.target(null);
1018
+ })
1019
+ .remove();
1020
+ icons.order();
1021
+ };
1022
+ return TitleBar;
1023
+ }(JSXWidget));
1024
+ TitleBar.prototype._class += " html_TitleBar";
1025
+ TitleBar.prototype.publish("title", "", "string");
1026
+ TitleBar.prototype.publish("buttons", [], "widgetArray");
1019
1027
 
1020
- exports.BUILD_VERSION = BUILD_VERSION;
1021
- exports.BreakdownTable = BreakdownTable;
1022
- exports.Button = Button;
1023
- exports.HTMLTooltip = HTMLTooltip;
1024
- exports.Item = Item;
1025
- exports.JSXWidget = JSXWidget;
1026
- exports.PKG_NAME = PKG_NAME;
1027
- exports.PKG_VERSION = PKG_VERSION;
1028
- exports.ReactD3 = ReactD3;
1029
- exports.SimpleTable = SimpleTable;
1030
- exports.Spacer = Spacer;
1031
- exports.StatsTable = StatsTable;
1032
- exports.StyledTable = StyledTable;
1033
- exports.TitleBar = TitleBar;
1034
- exports.ToggleButton = ToggleButton;
1035
- exports.VNode = VNode;
1036
- exports.VizComponent = VizComponent;
1037
- exports.VizInstance = VizInstance;
1028
+ exports.BUILD_VERSION = BUILD_VERSION;
1029
+ exports.BreakdownTable = BreakdownTable;
1030
+ exports.Button = Button;
1031
+ exports.HTMLTooltip = HTMLTooltip;
1032
+ exports.Item = Item;
1033
+ exports.JSXWidget = JSXWidget;
1034
+ exports.PKG_NAME = PKG_NAME;
1035
+ exports.PKG_VERSION = PKG_VERSION;
1036
+ exports.ReactD3 = ReactD3;
1037
+ exports.SimpleTable = SimpleTable;
1038
+ exports.Spacer = Spacer;
1039
+ exports.StatsTable = StatsTable;
1040
+ exports.StyledTable = StyledTable;
1041
+ exports.TitleBar = TitleBar;
1042
+ exports.ToggleButton = ToggleButton;
1043
+ exports.VNode = VNode;
1044
+ exports.VizComponent = VizComponent;
1045
+ exports.VizInstance = VizInstance;
1038
1046
 
1039
- Object.defineProperty(exports, '__esModule', { value: true });
1047
+ Object.defineProperty(exports, '__esModule', { value: true });
1040
1048
 
1041
1049
  }));
1042
1050
  //# sourceMappingURL=index.js.map