@hpcc-js/html 2.42.11 → 2.42.13
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.es6.js +48 -43
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +1015 -1010
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +7 -7
- package/src/__package__.ts +2 -2
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -1,1042 +1,1047 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var PKG_NAME = "@hpcc-js/html";
|
|
8
|
+
var PKG_VERSION = "2.42.13";
|
|
9
|
+
var BUILD_VERSION = "2.104.30";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
53
|
-
|
|
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
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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
|
-
|
|
409
|
-
|
|
410
|
-
function
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
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
|
-
|
|
459
|
-
|
|
460
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
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
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
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
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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 rowCount = _this.useCalculatedRowCount() ? _this.calculateRowCount() : _this.rowCount();
|
|
504
|
+
var rowHeight = _this.fontSize();
|
|
505
|
+
var widestLabel = Math.max.apply(Math, data.map(function (row) { return _this.textSize(row[0], "Verdana", _this.fontSize()).width; }));
|
|
506
|
+
var widestPerc = 30;
|
|
507
|
+
var colCount = 2;
|
|
508
|
+
var w = colCount * (widestLabel + widestPerc) + (_this._tooltip.padding() * 2);
|
|
509
|
+
var h = rowHeight * Math.ceil((data.length - rowCount) / colCount) + (_this._tooltip.padding() * 2);
|
|
510
|
+
_this._tooltip.tooltipWidth(w);
|
|
511
|
+
_this._tooltip.tooltipHeight(h);
|
|
512
|
+
var otherData = _this.breakdownData(_this.data().length).slice(rowCount - 1);
|
|
513
|
+
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>");
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
BreakdownTable.prototype.update = function (domNode, element) {
|
|
517
|
+
this.theadColumnStyles_default([
|
|
518
|
+
{
|
|
519
|
+
"color": this.thFirstColor(),
|
|
520
|
+
"font-size": this.thFontSize() + "px",
|
|
521
|
+
"font-weight": this.thFontWeight(),
|
|
522
|
+
"text-align": this.labelAlignment(),
|
|
523
|
+
"width": "auto",
|
|
524
|
+
"padding": "0px"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"width": "1%",
|
|
528
|
+
"font-size": this.thFontSize() + "px",
|
|
529
|
+
"font-weight": this.thFontWeight(),
|
|
530
|
+
"text-align": this.percentageAlignment(),
|
|
531
|
+
"padding": "0px"
|
|
532
|
+
}
|
|
533
|
+
]);
|
|
534
|
+
this.tbodyColumnStyles_default([
|
|
535
|
+
{
|
|
536
|
+
"color": this.topLabelColor(),
|
|
537
|
+
"font-size": this.fontSize() + "px",
|
|
538
|
+
"font-weight": "normal",
|
|
539
|
+
"text-align": this.labelAlignment(),
|
|
540
|
+
"width": "auto",
|
|
541
|
+
"padding": "0px"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"color": this.topPercentageColor(),
|
|
545
|
+
"font-size": this.fontSize() + "px",
|
|
546
|
+
"font-weight": "normal",
|
|
547
|
+
"text-align": this.percentageAlignment(),
|
|
548
|
+
"width": "1%",
|
|
549
|
+
"padding": "0px"
|
|
550
|
+
}
|
|
551
|
+
]);
|
|
552
|
+
this.lastRowStyles_default([
|
|
553
|
+
{
|
|
554
|
+
"color": this.otherLabelColor(),
|
|
555
|
+
"font-size": this.fontSize() + "px",
|
|
556
|
+
"font-weight": this.otherLabelBold() ? "bold" : "normal",
|
|
557
|
+
"text-align": this.labelAlignment(),
|
|
558
|
+
"width": "auto",
|
|
559
|
+
"padding": "0px"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"color": this.otherLabelColor(),
|
|
563
|
+
"font-size": this.fontSize() + "px",
|
|
564
|
+
"font-weight": this.otherPercentageBold() ? "bold" : "normal",
|
|
565
|
+
"text-align": this.percentageAlignment(),
|
|
566
|
+
"width": "1%",
|
|
567
|
+
"padding": "0px"
|
|
568
|
+
}
|
|
569
|
+
]);
|
|
570
|
+
_super.prototype.update.call(this, domNode, element);
|
|
571
|
+
var rowCount = this.useCalculatedRowCount() ? this.calculateRowCount() : this.rowCount();
|
|
572
|
+
if (rowCount < this.data().length) {
|
|
573
|
+
var lastRow_1 = element.select("tbody > tr:last-child");
|
|
574
|
+
var context_1 = this;
|
|
575
|
+
lastRow_1
|
|
576
|
+
.on("mouseout.tooltip", function (d) {
|
|
577
|
+
context_1._tooltip._triggerElement = lastRow_1;
|
|
578
|
+
context_1._tooltip
|
|
579
|
+
.visible(false)
|
|
580
|
+
.render();
|
|
581
|
+
})
|
|
582
|
+
.on("mouseenter.tooltip", function (d) {
|
|
583
|
+
context_1._tooltip._triggerElement = lastRow_1;
|
|
584
|
+
context_1._tooltip
|
|
585
|
+
.direction("n")
|
|
586
|
+
.data(context_1.data())
|
|
587
|
+
.visible(true)
|
|
588
|
+
.render();
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
return BreakdownTable;
|
|
593
|
+
}(StyledTable));
|
|
594
|
+
BreakdownTable.prototype._class += " html_BreakdownTable";
|
|
595
|
+
BreakdownTable.prototype.publish("useCalculatedRowCount", true, "boolean", "If true, rowCount will be calculated and its default will be overwritten");
|
|
596
|
+
BreakdownTable.prototype.publish("rowCount", 5, "number", "Number of total rows to display (including the 'other' row)", undefined, { disable: function (w) { return w.useCalculatedRowCount(); } });
|
|
597
|
+
BreakdownTable.prototype.publish("fontSize", 14, "number", "Font size (pixels)");
|
|
598
|
+
BreakdownTable.prototype.publish("labelAlignment", "left", "set", "Alignment of the label column text", ["left", "center", "right"]);
|
|
599
|
+
BreakdownTable.prototype.publish("percentageAlignment", "center", "set", "Alignment of the percentage column text", ["left", "center", "right"]);
|
|
600
|
+
BreakdownTable.prototype.publish("topLabelColor", "#333", "html-color", "Color of displayed 'top' labels");
|
|
601
|
+
BreakdownTable.prototype.publish("topPercentageColor", "#1A99D5", "html-color", "Color of displayed 'top' percentages");
|
|
602
|
+
BreakdownTable.prototype.publish("topPercentageBold", true, "html-color", "If true, the 'top' percentages will be bold");
|
|
603
|
+
BreakdownTable.prototype.publish("otherLabel", "Other", "string", "Label text for the 'other' row");
|
|
604
|
+
BreakdownTable.prototype.publish("otherLabelColor", "#AAA", "html-color", "Color of the 'other' label");
|
|
605
|
+
BreakdownTable.prototype.publish("otherLabelBold", false, "html-color", "If true, the 'other' label will be bold");
|
|
606
|
+
BreakdownTable.prototype.publish("otherPercentageColor", "#AAA", "html-color", "Color of the 'other' percentage");
|
|
607
|
+
BreakdownTable.prototype.publish("otherPercentageBold", false, "html-color", "If true, the 'other' percentage will be bold");
|
|
608
|
+
BreakdownTable.prototype.publish("thFontWeight", "bold", "string", "Font weight for th elements");
|
|
609
|
+
BreakdownTable.prototype.publish("thFontSize", 26, "number", "Font size for th elements");
|
|
610
|
+
BreakdownTable.prototype.publish("thFirstColor", "#333", "html-color", "Text color of the first th element");
|
|
611
|
+
BreakdownTable.prototype.publish("thLastColor", "#333", "html-color", "Text color of the last th element");
|
|
771
612
|
|
|
772
|
-
|
|
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));
|
|
613
|
+
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
614
|
|
|
806
|
-
|
|
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 });
|
|
615
|
+
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
616
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
617
|
+
var JSXWidget = /** @class */ (function (_super) {
|
|
618
|
+
__extends(JSXWidget, _super);
|
|
619
|
+
function JSXWidget() {
|
|
620
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
621
|
+
}
|
|
622
|
+
JSXWidget.prototype.jsxRender = function (jsx, domNode) {
|
|
623
|
+
this.rootNode = B$1(jsx, domNode, this.rootNode);
|
|
624
|
+
};
|
|
625
|
+
JSXWidget.Component = b$1;
|
|
626
|
+
JSXWidget.createElement = y;
|
|
627
|
+
return JSXWidget;
|
|
628
|
+
}(common.HTMLWidget));
|
|
629
|
+
JSXWidget.prototype._class += " html_JSXWidget";
|
|
888
630
|
|
|
889
|
-
|
|
631
|
+
var VNode = /** @class */ (function () {
|
|
632
|
+
function VNode(attrs, children) {
|
|
633
|
+
this._attrs = attrs;
|
|
634
|
+
this._children = children;
|
|
635
|
+
}
|
|
636
|
+
VNode.prototype.type = function () {
|
|
637
|
+
return "div";
|
|
638
|
+
};
|
|
639
|
+
VNode.prototype.attrs = function () {
|
|
640
|
+
return this._attrs;
|
|
641
|
+
};
|
|
642
|
+
VNode.prototype.attr = function (key) {
|
|
643
|
+
return this._attrs[key];
|
|
644
|
+
};
|
|
645
|
+
VNode.prototype.children = function () {
|
|
646
|
+
return this._children;
|
|
647
|
+
};
|
|
648
|
+
VNode.prototype.update = function (targetElement) {
|
|
649
|
+
for (var key in this._attrs) {
|
|
650
|
+
targetElement.attr(key, this._attrs[key]);
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
VNode.prototype.render = function (targetElement) {
|
|
654
|
+
var thisElement = targetElement.selectAll("".concat(targetElement.node().tagName, " > *")).data([this]);
|
|
655
|
+
thisElement.exit()
|
|
656
|
+
.remove();
|
|
657
|
+
return thisElement.enter().append(this.type())
|
|
658
|
+
.attr("reactd3", 0)
|
|
659
|
+
.merge(thisElement)
|
|
660
|
+
.each(function (d) {
|
|
661
|
+
var element = common.select(this);
|
|
662
|
+
d.update(element);
|
|
663
|
+
d.renderChildren(element);
|
|
664
|
+
});
|
|
665
|
+
};
|
|
666
|
+
VNode.prototype.renderChildren = function (targetElement) {
|
|
667
|
+
var thisElement = targetElement.selectAll("".concat(targetElement.node().tagName, " > *")).data(this._children);
|
|
668
|
+
thisElement.exit()
|
|
669
|
+
.remove();
|
|
670
|
+
return thisElement.enter().append(function (d) { return document.createElement(d.type()); })
|
|
671
|
+
.attr("reactd3", function (_d, i) { return i; })
|
|
672
|
+
.merge(thisElement)
|
|
673
|
+
.each(function (d) {
|
|
674
|
+
var element = common.select(this);
|
|
675
|
+
d.update(element);
|
|
676
|
+
d.renderChildren(element);
|
|
677
|
+
});
|
|
678
|
+
};
|
|
679
|
+
return VNode;
|
|
680
|
+
}());
|
|
681
|
+
var ConstVNode = /** @class */ (function (_super) {
|
|
682
|
+
__extends(ConstVNode, _super);
|
|
683
|
+
function ConstVNode(type, attrs, children) {
|
|
684
|
+
var _this = _super.call(this, attrs, children) || this;
|
|
685
|
+
_this._type = type;
|
|
686
|
+
return _this;
|
|
687
|
+
}
|
|
688
|
+
ConstVNode.prototype.type = function () {
|
|
689
|
+
return this._type;
|
|
690
|
+
};
|
|
691
|
+
return ConstVNode;
|
|
692
|
+
}(VNode));
|
|
693
|
+
var TextVNode = /** @class */ (function (_super) {
|
|
694
|
+
__extends(TextVNode, _super);
|
|
695
|
+
function TextVNode(text) {
|
|
696
|
+
var _this = _super.call(this, {}, []) || this;
|
|
697
|
+
_this._text = text;
|
|
698
|
+
return _this;
|
|
699
|
+
}
|
|
700
|
+
TextVNode.prototype.type = function () {
|
|
701
|
+
return "span";
|
|
702
|
+
};
|
|
703
|
+
TextVNode.prototype.update = function (targetElement) {
|
|
704
|
+
_super.prototype.update.call(this, targetElement);
|
|
705
|
+
targetElement.text(this._text);
|
|
706
|
+
};
|
|
707
|
+
return TextVNode;
|
|
708
|
+
}(VNode));
|
|
709
|
+
function isReactFn(_) {
|
|
710
|
+
return typeof _ === "function";
|
|
711
|
+
}
|
|
712
|
+
function isIVNode(_) {
|
|
713
|
+
return _.prototype && _.prototype instanceof VNode;
|
|
714
|
+
}
|
|
715
|
+
var ReactD3 = /** @class */ (function () {
|
|
716
|
+
function ReactD3() {
|
|
717
|
+
}
|
|
718
|
+
// static createElementXXX(type: string | ReactFn | IVNode, attrs: { [key: string]: string }, ...children: Array<string | VNode>): VNode {
|
|
719
|
+
ReactD3.createElement = function (type, attrs) {
|
|
720
|
+
var children = [];
|
|
721
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
722
|
+
children[_i - 2] = arguments[_i];
|
|
723
|
+
}
|
|
724
|
+
if (isIVNode(type)) {
|
|
725
|
+
return new type(attrs);
|
|
726
|
+
}
|
|
727
|
+
else if (isReactFn(type)) {
|
|
728
|
+
return type(attrs);
|
|
729
|
+
}
|
|
730
|
+
return new ConstVNode(type, attrs, children.map(function (child) {
|
|
731
|
+
if (typeof child === "string") {
|
|
732
|
+
return new TextVNode(child);
|
|
733
|
+
}
|
|
734
|
+
return child;
|
|
735
|
+
}));
|
|
736
|
+
};
|
|
737
|
+
ReactD3.render = function (vdom, targetElement) {
|
|
738
|
+
vdom.render(targetElement);
|
|
739
|
+
};
|
|
740
|
+
return ReactD3;
|
|
741
|
+
}());
|
|
890
742
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
743
|
+
var VizComponent = /** @class */ (function (_super) {
|
|
744
|
+
__extends(VizComponent, _super);
|
|
745
|
+
function VizComponent() {
|
|
746
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
747
|
+
}
|
|
748
|
+
VizComponent.prototype.refreshProps = function () {
|
|
749
|
+
for (var key in this.props) {
|
|
750
|
+
if (this.widget[key] && typeof this.widget[key] === "function") {
|
|
751
|
+
this.widget[key](this.props[key]);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
VizComponent.prototype.componentDidMount = function () {
|
|
756
|
+
this.widget = new this.props.type()
|
|
757
|
+
.target(this.base);
|
|
758
|
+
this.refreshProps();
|
|
759
|
+
this.widget
|
|
760
|
+
.render();
|
|
761
|
+
};
|
|
762
|
+
VizComponent.prototype.componentWillUnmount = function () {
|
|
763
|
+
this.widget
|
|
764
|
+
.target(null)
|
|
765
|
+
.render();
|
|
766
|
+
};
|
|
767
|
+
VizComponent.prototype.render = function () {
|
|
768
|
+
return y("div", { style: this.props.style });
|
|
769
|
+
};
|
|
770
|
+
VizComponent.prototype.componentDidUpdate = function () {
|
|
771
|
+
this.refreshProps();
|
|
772
|
+
this.widget.render();
|
|
773
|
+
};
|
|
774
|
+
return VizComponent;
|
|
775
|
+
}(JSXWidget.Component));
|
|
894
776
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
777
|
+
var VizInstance = /** @class */ (function (_super) {
|
|
778
|
+
__extends(VizInstance, _super);
|
|
779
|
+
function VizInstance() {
|
|
780
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
781
|
+
}
|
|
782
|
+
VizInstance.prototype.refreshProps = function () {
|
|
783
|
+
for (var key in this.props) {
|
|
784
|
+
if (this.widget[key] && typeof this.widget[key] === "function") {
|
|
785
|
+
this.widget[key](this.props[key]);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
VizInstance.prototype.componentDidMount = function () {
|
|
790
|
+
this.widget = this.props.instance
|
|
791
|
+
.target(this.base);
|
|
792
|
+
this.refreshProps();
|
|
793
|
+
this.widget
|
|
794
|
+
.render();
|
|
795
|
+
};
|
|
796
|
+
VizInstance.prototype.componentWillUnmount = function () {
|
|
797
|
+
this.widget
|
|
798
|
+
.target(null)
|
|
799
|
+
.render();
|
|
800
|
+
};
|
|
801
|
+
VizInstance.prototype.render = function () {
|
|
802
|
+
return y("div", { style: this.props.style });
|
|
803
|
+
};
|
|
804
|
+
VizInstance.prototype.componentDidUpdate = function () {
|
|
805
|
+
this.refreshProps();
|
|
806
|
+
this.widget.render();
|
|
807
|
+
};
|
|
808
|
+
return VizInstance;
|
|
809
|
+
}(JSXWidget.Component));
|
|
810
|
+
|
|
811
|
+
var StatsTable = /** @class */ (function (_super) {
|
|
812
|
+
__extends(StatsTable, _super);
|
|
813
|
+
function StatsTable() {
|
|
814
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
903
815
|
}
|
|
816
|
+
StatsTable.prototype.transformData = function () {
|
|
817
|
+
var _this = this;
|
|
818
|
+
var totalRow = [["Total", 0, 0]];
|
|
819
|
+
var data = this.data();
|
|
820
|
+
data.forEach(function (row) {
|
|
821
|
+
totalRow[0][1] += row[1];
|
|
822
|
+
totalRow[0][2] += row[2];
|
|
823
|
+
});
|
|
824
|
+
return data
|
|
825
|
+
.concat(totalRow)
|
|
826
|
+
.map(function (row) {
|
|
827
|
+
return [
|
|
828
|
+
row[0],
|
|
829
|
+
_this.secondColumnFormat_exists() ? common.format(_this.secondColumnFormat())(row[1]) : row[1],
|
|
830
|
+
_this.thirdColumnFormat_exists() ? common.format(_this.thirdColumnFormat())(row[2]) : row[2]
|
|
831
|
+
];
|
|
832
|
+
});
|
|
833
|
+
};
|
|
834
|
+
StatsTable.prototype.update = function (domNode, element) {
|
|
835
|
+
this.tbodyColumnStyles_default([
|
|
836
|
+
{
|
|
837
|
+
"font-weight": "bold",
|
|
838
|
+
"width": this.firstColumnWidth(),
|
|
839
|
+
"text-align": "left"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"width": this.secondColumnWidth(),
|
|
843
|
+
"text-align": "right"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
"width": this.thirdColumnWidth(),
|
|
847
|
+
"text-align": "right"
|
|
848
|
+
}
|
|
849
|
+
]);
|
|
850
|
+
this.evenRowStyles_default([
|
|
851
|
+
{
|
|
852
|
+
"font-weight": "bold",
|
|
853
|
+
"width": this.firstColumnWidth(),
|
|
854
|
+
"text-align": "left",
|
|
855
|
+
"font-color": this.evenRowFontColor(),
|
|
856
|
+
"background-color": this.evenRowBackgroundColor()
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"width": this.secondColumnWidth(),
|
|
860
|
+
"text-align": "right",
|
|
861
|
+
"font-color": this.evenRowFontColor(),
|
|
862
|
+
"background-color": this.evenRowBackgroundColor()
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"width": this.thirdColumnWidth(),
|
|
866
|
+
"text-align": "right",
|
|
867
|
+
"font-color": this.evenRowFontColor(),
|
|
868
|
+
"background-color": this.evenRowBackgroundColor()
|
|
869
|
+
}
|
|
870
|
+
]);
|
|
871
|
+
this.lastRowStyles_default({
|
|
872
|
+
"font-weight": "bold"
|
|
873
|
+
});
|
|
874
|
+
_super.prototype.update.call(this, domNode, element);
|
|
875
|
+
};
|
|
876
|
+
return StatsTable;
|
|
877
|
+
}(StyledTable));
|
|
878
|
+
StatsTable.prototype._class += " html_StatsTable";
|
|
879
|
+
StatsTable.prototype.publish("labelColor", "#333", "html-color", "Color of the text in the first column");
|
|
880
|
+
StatsTable.prototype.publish("primaryValueColor", "#333", "html-color", "Color of the text in the second column");
|
|
881
|
+
StatsTable.prototype.publish("secondaryValueColor", "#333", "html-color", "Color of the text in the third column");
|
|
882
|
+
StatsTable.prototype.publish("evenRowBackgroundColor", "#333", "html-color", "Background color of the even rows");
|
|
883
|
+
StatsTable.prototype.publish("evenRowFontColor", "#333", "html-color", "Font color of the even rows");
|
|
884
|
+
StatsTable.prototype.publish("firstColumnWidth", "auto", "string", "CSS style applied as the 'width' for the first column (ex: 40px)");
|
|
885
|
+
StatsTable.prototype.publish("secondColumnWidth", "1%", "string", "CSS style applied as the 'width' for the second column (ex: 40px)");
|
|
886
|
+
StatsTable.prototype.publish("thirdColumnWidth", "1%", "string", "CSS style applied as the 'width' for the third column (ex: 40px)");
|
|
887
|
+
StatsTable.prototype.publish("secondColumnFormat", "$,.0f", "string", "d3-format specifier applied to the second column's values", undefined, { optional: true });
|
|
888
|
+
StatsTable.prototype.publish("thirdColumnFormat", null, "string", "d3-format specifier applied to the third column's values", undefined, { optional: true });
|
|
889
|
+
|
|
890
|
+
function styleInject(css, ref) {
|
|
891
|
+
if ( ref === void 0 ) ref = {};
|
|
892
|
+
var insertAt = ref.insertAt;
|
|
893
|
+
|
|
894
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
904
895
|
|
|
905
|
-
|
|
906
|
-
|
|
896
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
897
|
+
var style = document.createElement('style');
|
|
898
|
+
style.type = 'text/css';
|
|
899
|
+
|
|
900
|
+
if (insertAt === 'top') {
|
|
901
|
+
if (head.firstChild) {
|
|
902
|
+
head.insertBefore(style, head.firstChild);
|
|
907
903
|
} else {
|
|
908
|
-
|
|
904
|
+
head.appendChild(style);
|
|
909
905
|
}
|
|
906
|
+
} else {
|
|
907
|
+
head.appendChild(style);
|
|
910
908
|
}
|
|
911
909
|
|
|
912
|
-
|
|
913
|
-
|
|
910
|
+
if (style.styleSheet) {
|
|
911
|
+
style.styleSheet.cssText = css;
|
|
912
|
+
} else {
|
|
913
|
+
style.appendChild(document.createTextNode(css));
|
|
914
|
+
}
|
|
915
|
+
}
|
|
914
916
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
917
|
+
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}";
|
|
918
|
+
styleInject(css_248z);
|
|
919
|
+
|
|
920
|
+
var Item = /** @class */ (function (_super) {
|
|
921
|
+
__extends(Item, _super);
|
|
922
|
+
function Item(owner) {
|
|
923
|
+
var _this = _super.call(this) || this;
|
|
924
|
+
_this._owner = owner;
|
|
925
|
+
_this._tag = "a";
|
|
926
|
+
return _this;
|
|
927
|
+
}
|
|
928
|
+
return Item;
|
|
929
|
+
}(common.HTMLWidget));
|
|
930
|
+
var Button = /** @class */ (function (_super) {
|
|
931
|
+
__extends(Button, _super);
|
|
932
|
+
function Button(owner, icon) {
|
|
933
|
+
var _this = _super.call(this, owner) || this;
|
|
934
|
+
_this._icon = icon;
|
|
935
|
+
return _this;
|
|
936
|
+
}
|
|
937
|
+
Button.prototype.icon = function () {
|
|
938
|
+
return this._icon;
|
|
939
|
+
};
|
|
940
|
+
Button.prototype.enter = function (domNode, element) {
|
|
941
|
+
var _this = this;
|
|
942
|
+
_super.prototype.enter.call(this, domNode, element);
|
|
943
|
+
element
|
|
944
|
+
.attr("href", "#")
|
|
945
|
+
.on("click", function (d, idx, groups) { return _this._owner.titleBarClick(_this, d, idx, groups); })
|
|
946
|
+
.append("i")
|
|
947
|
+
.attr("class", "fa ".concat(this._icon, " fa-lg fa-fw"));
|
|
948
|
+
};
|
|
949
|
+
return Button;
|
|
950
|
+
}(Item));
|
|
951
|
+
var ToggleButton = /** @class */ (function (_super) {
|
|
952
|
+
__extends(ToggleButton, _super);
|
|
953
|
+
function ToggleButton() {
|
|
954
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
955
|
+
}
|
|
956
|
+
ToggleButton.prototype.enter = function (domNode, element) {
|
|
957
|
+
var _this = this;
|
|
958
|
+
element.on("click.sel", function (d, idx, groups) {
|
|
959
|
+
_this.selected(!_this.selected());
|
|
960
|
+
_this.render();
|
|
961
|
+
});
|
|
962
|
+
_super.prototype.enter.call(this, domNode, element);
|
|
963
|
+
};
|
|
964
|
+
ToggleButton.prototype.update = function (domNode, element) {
|
|
965
|
+
_super.prototype.update.call(this, domNode, element);
|
|
966
|
+
this._element.classed("selected", this.selected());
|
|
967
|
+
};
|
|
968
|
+
return ToggleButton;
|
|
969
|
+
}(Button));
|
|
970
|
+
ToggleButton.prototype.publish("selected", false, "boolean");
|
|
971
|
+
var Spacer = /** @class */ (function (_super) {
|
|
972
|
+
__extends(Spacer, _super);
|
|
973
|
+
function Spacer() {
|
|
974
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
975
|
+
}
|
|
976
|
+
Spacer.prototype.enter = function (domNode, element) {
|
|
977
|
+
_super.prototype.enter.call(this, domNode, element);
|
|
978
|
+
element
|
|
979
|
+
.attr("class", "spacer")
|
|
980
|
+
.attr("href", "#")
|
|
981
|
+
.append("i");
|
|
982
|
+
};
|
|
983
|
+
return Spacer;
|
|
984
|
+
}(Item));
|
|
985
|
+
var TitleBar = /** @class */ (function (_super) {
|
|
986
|
+
__extends(TitleBar, _super);
|
|
987
|
+
function TitleBar() {
|
|
988
|
+
return _super.call(this) || this;
|
|
989
|
+
}
|
|
990
|
+
TitleBar.prototype.enter = function (domNode, element) {
|
|
991
|
+
_super.prototype.enter.call(this, domNode, element);
|
|
992
|
+
this._divMain = element.append("div")
|
|
993
|
+
.attr("class", "main");
|
|
994
|
+
this._divIconBar = this._divMain.append("div")
|
|
995
|
+
.attr("class", "icon-bar");
|
|
996
|
+
this._divTitle = this._divMain.append("div")
|
|
997
|
+
.attr("class", "title");
|
|
998
|
+
};
|
|
999
|
+
TitleBar.prototype.update = function (domNode, element) {
|
|
1000
|
+
_super.prototype.update.call(this, domNode, element);
|
|
1001
|
+
this._divTitle.text(this.title());
|
|
1002
|
+
var icons = this._divIconBar.selectAll(".icon-bar-item").data(this.buttons());
|
|
1003
|
+
icons.enter().append("div")
|
|
1004
|
+
.attr("class", "icon-bar-item")
|
|
1005
|
+
.each(function (d) {
|
|
1006
|
+
d.target(this);
|
|
1007
|
+
})
|
|
1008
|
+
.merge(icons)
|
|
1009
|
+
.each(function (d) {
|
|
1010
|
+
d.render();
|
|
1011
|
+
});
|
|
1012
|
+
icons.exit()
|
|
1013
|
+
.each(function (d) {
|
|
1014
|
+
d.target(null);
|
|
1015
|
+
})
|
|
1016
|
+
.remove();
|
|
1017
|
+
icons.order();
|
|
1018
|
+
};
|
|
1019
|
+
return TitleBar;
|
|
1020
|
+
}(JSXWidget));
|
|
1021
|
+
TitleBar.prototype._class += " html_TitleBar";
|
|
1022
|
+
TitleBar.prototype.publish("title", "", "string");
|
|
1023
|
+
TitleBar.prototype.publish("buttons", [], "widgetArray");
|
|
1019
1024
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1025
|
+
exports.BUILD_VERSION = BUILD_VERSION;
|
|
1026
|
+
exports.BreakdownTable = BreakdownTable;
|
|
1027
|
+
exports.Button = Button;
|
|
1028
|
+
exports.HTMLTooltip = HTMLTooltip;
|
|
1029
|
+
exports.Item = Item;
|
|
1030
|
+
exports.JSXWidget = JSXWidget;
|
|
1031
|
+
exports.PKG_NAME = PKG_NAME;
|
|
1032
|
+
exports.PKG_VERSION = PKG_VERSION;
|
|
1033
|
+
exports.ReactD3 = ReactD3;
|
|
1034
|
+
exports.SimpleTable = SimpleTable;
|
|
1035
|
+
exports.Spacer = Spacer;
|
|
1036
|
+
exports.StatsTable = StatsTable;
|
|
1037
|
+
exports.StyledTable = StyledTable;
|
|
1038
|
+
exports.TitleBar = TitleBar;
|
|
1039
|
+
exports.ToggleButton = ToggleButton;
|
|
1040
|
+
exports.VNode = VNode;
|
|
1041
|
+
exports.VizComponent = VizComponent;
|
|
1042
|
+
exports.VizInstance = VizInstance;
|
|
1038
1043
|
|
|
1039
|
-
|
|
1044
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1040
1045
|
|
|
1041
1046
|
}));
|
|
1042
1047
|
//# sourceMappingURL=index.js.map
|