@hpcc-js/api 2.14.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/index.css +2 -0
  2. package/dist/index.css.map +7 -0
  3. package/dist/index.js +37 -761
  4. package/dist/index.js.map +7 -1
  5. package/package.json +26 -31
  6. package/src/ITooltip.ts +2 -2
  7. package/src/Tooltip.ts +2 -2
  8. package/src/__package__.ts +1 -1
  9. package/src/index.ts +10 -10
  10. package/types/I1DChart.d.ts +0 -1
  11. package/types/I2DAggrChart.d.ts +0 -1
  12. package/types/I2DChart.d.ts +0 -1
  13. package/types/IGraph.d.ts +0 -1
  14. package/types/IHighlight.d.ts +0 -1
  15. package/types/IInput.d.ts +0 -1
  16. package/types/INDChart.d.ts +0 -1
  17. package/types/ITooltip.d.ts +1 -2
  18. package/types/ITree.d.ts +0 -1
  19. package/types/Tooltip.d.ts +0 -1
  20. package/types/__package__.d.ts +1 -2
  21. package/types/index.d.ts +10 -11
  22. package/dist/index.es6.js +0 -745
  23. package/dist/index.es6.js.map +0 -1
  24. package/dist/index.min.js +0 -2
  25. package/dist/index.min.js.map +0 -1
  26. package/types/I1DChart.d.ts.map +0 -1
  27. package/types/I2DAggrChart.d.ts.map +0 -1
  28. package/types/I2DChart.d.ts.map +0 -1
  29. package/types/IGraph.d.ts.map +0 -1
  30. package/types/IHighlight.d.ts.map +0 -1
  31. package/types/IInput.d.ts.map +0 -1
  32. package/types/INDChart.d.ts.map +0 -1
  33. package/types/ITooltip.d.ts.map +0 -1
  34. package/types/ITree.d.ts.map +0 -1
  35. package/types/Tooltip.d.ts.map +0 -1
  36. package/types/__package__.d.ts.map +0 -1
  37. package/types/index.d.ts.map +0 -1
  38. package/types-3.4/I1DChart.d.ts +0 -2
  39. package/types-3.4/I2DAggrChart.d.ts +0 -2
  40. package/types-3.4/I2DChart.d.ts +0 -2
  41. package/types-3.4/IGraph.d.ts +0 -2
  42. package/types-3.4/IHighlight.d.ts +0 -5
  43. package/types-3.4/IInput.d.ts +0 -27
  44. package/types-3.4/INDChart.d.ts +0 -2
  45. package/types-3.4/ITooltip.d.ts +0 -45
  46. package/types-3.4/ITree.d.ts +0 -2
  47. package/types-3.4/Tooltip.d.ts +0 -2
  48. package/types-3.4/__package__.d.ts +0 -4
  49. package/types-3.4/index.d.ts +0 -11
package/dist/index.es6.js DELETED
@@ -1,745 +0,0 @@
1
- import { Palette, hsl, Widget, selection, map, select, format } from '@hpcc-js/common';
2
-
3
- var PKG_NAME = "@hpcc-js/api";
4
- var PKG_VERSION = "2.14.0";
5
- var BUILD_VERSION = "2.107.0";
6
-
7
- function I1DChart() {
8
- }
9
- I1DChart.prototype._dataFamily = "1D";
10
- I1DChart.prototype._palette = Palette.rainbow("default");
11
- // Events ---
12
- I1DChart.prototype.click = function (row, column, selected) {
13
- };
14
- I1DChart.prototype.dblclick = function (row, column, selected) {
15
- };
16
-
17
- function I2DChart() {
18
- }
19
- I2DChart.prototype._dataFamily = "2D";
20
- I2DChart.prototype._palette = Palette.ordinal("default");
21
- I2DChart.prototype.fillColor = function (row, column, value, origRow) {
22
- return this._palette(row[0]);
23
- };
24
- I2DChart.prototype.strokeColor = function (row, column, value, origRow) {
25
- return hsl(this.fillColor(row, column, value, origRow)).darker().toString();
26
- };
27
- I2DChart.prototype.textColor = function (row, column, value, origRow) {
28
- return Palette.textColor(this.fillColor(row, column, value, origRow));
29
- };
30
- // Events ---
31
- I2DChart.prototype.click = function (row, column, selected) {
32
- };
33
- I2DChart.prototype.dblclick = function (row, column, selected) {
34
- };
35
-
36
- function I2DAggrChart() {
37
- }
38
- I2DAggrChart.prototype._palette = Palette.rainbow("default");
39
- I2DAggrChart.prototype.fillColor = function (row, column, value) {
40
- return this._palette(row.length);
41
- };
42
- I2DAggrChart.prototype.strokeColor = function (row, column, value) {
43
- return hsl(this.fillColor(row, column, value)).darker().toString();
44
- };
45
- I2DAggrChart.prototype.textColor = function (row, column, value) {
46
- return Palette.textColor(this.fillColor(row, column, value));
47
- };
48
- // Events ---
49
- I2DAggrChart.prototype.click = function (row, column, selected) {
50
- };
51
- I2DAggrChart.prototype.dblclick = function (row, column, selected) {
52
- };
53
-
54
- function IGraph() {
55
- }
56
- IGraph.prototype._dataFamily = "graph";
57
- // Events ---
58
- IGraph.prototype.vertex_click = function (_row, _col, _sel, more) {
59
- if (more && more.vertex) ;
60
- };
61
- IGraph.prototype.vertex_dblclick = function (_row, _col, _sel, more) {
62
- if (more && more.vertex) ;
63
- };
64
- IGraph.prototype.edge_click = function (_row, _col, _sel, more) {
65
- if (more && more.edge) ;
66
- };
67
- IGraph.prototype.edge_dblclick = function (_row, _col, _sel, more) {
68
- if (more && more.edge) ;
69
- };
70
-
71
- function instanceOfIHighlight(w) {
72
- return typeof w.highlightColumn === "function";
73
- }
74
-
75
- // Use old school class declaration as this is a mixin ---
76
- function IInput() {
77
- }
78
- IInput.prototype = Object.create(Widget.prototype);
79
- IInput.prototype.constructor = IInput;
80
- // abstract target(): any;
81
- // abstract target(_: any): this;
82
- // Implementation ---
83
- IInput.prototype.isValid = function () {
84
- if (this.validate()) {
85
- var re = new RegExp(this.validate());
86
- if (!re.test(this.value())) {
87
- return false;
88
- }
89
- }
90
- return true;
91
- };
92
- IInput.prototype.hasValue = function () {
93
- if (typeof this.type === "function") {
94
- switch (this.type()) {
95
- case "radio":
96
- /* falls through */
97
- case "checkbox":
98
- if (this.value() && this.value() !== "false") {
99
- return true;
100
- }
101
- break;
102
- default:
103
- if (this.value()) {
104
- return true;
105
- }
106
- break;
107
- }
108
- return false;
109
- }
110
- return this.value() !== "";
111
- };
112
- // Events ---
113
- IInput.prototype.blur = function (_w) {
114
- };
115
- IInput.prototype.keyup = function (_w) {
116
- };
117
- IInput.prototype.focus = function (_w) {
118
- };
119
- IInput.prototype.click = function (_w) {
120
- };
121
- IInput.prototype.dblclick = function (_w) {
122
- };
123
- IInput.prototype.change = function (_w, complete) {
124
- };
125
- IInput.prototype.resetValue = function (w) {
126
- w.value(w._inputElement[0].node().value);
127
- };
128
- IInput.prototype.disable = function (disable) {
129
- this._inputElement.forEach(function (e, idx) {
130
- e.attr("disabled", disable ? "disabled" : null);
131
- });
132
- };
133
- IInput.prototype.setFocus = function () {
134
- if (this._inputElement.length) {
135
- this._inputElement[0].node().focus();
136
- }
137
- };
138
- IInput.prototype.publish("name", "", "string", "HTML name for the input");
139
- IInput.prototype.publish("label", "", "string", "Descriptive label");
140
- IInput.prototype.publish("value", "", "string", "Input Current Value");
141
- IInput.prototype.publish("validate", null, "string", "Input Validation");
142
-
143
- function INDChart() {
144
- }
145
- INDChart.prototype._dataFamily = "ND";
146
- INDChart.prototype._palette = Palette.ordinal("default");
147
- INDChart.prototype.fillColor = function (row, column, value, origRow) {
148
- return this._palette(column);
149
- };
150
- INDChart.prototype.strokeColor = function (row, column, value, origRow) {
151
- return hsl(this.fillColor(row, column, value, origRow)).darker().toString();
152
- };
153
- INDChart.prototype.textColor = function (row, column, value, origRow) {
154
- return Palette.textColor(this.fillColor(row, column, value, origRow));
155
- };
156
- // Events ---
157
- INDChart.prototype.click = function (row, column, selected) {
158
- };
159
- INDChart.prototype.dblclick = function (row, column, selected) {
160
- };
161
-
162
- // Based on https://github.com/GordonSmith/d3-tip forked from https://github.com/Caged/d3-tip
163
- function tip() {
164
- var direction = d3TipDirection;
165
- var offset = d3TipOffset;
166
- var html = d3TipHTML;
167
- var rootElement = functor(document.body);
168
- var node = initNode();
169
- var svg = null;
170
- var point = null;
171
- var target = null;
172
- var tip = function (vis) {
173
- svg = getSVGNode(vis);
174
- if (!svg)
175
- return;
176
- point = svg.createSVGPoint();
177
- var re = rootElement();
178
- if (!re)
179
- return;
180
- if (!node)
181
- return;
182
- re.appendChild(node);
183
- };
184
- // Public - show the tooltip on the screen
185
- //
186
- // Returns a tip
187
- tip.show = function (d, idx, arr) {
188
- target = arr[idx];
189
- var args = Array.prototype.slice.call(arguments);
190
- var content = html.apply(this, args);
191
- if (content === null) {
192
- return tip;
193
- }
194
- var poffset = offset.apply(this, args);
195
- var nodel = getNodeEl();
196
- var i = directions.length;
197
- var coords;
198
- var root_bbox = rootElement().getBoundingClientRect();
199
- nodel.html(content)
200
- .style("opacity", 1).style("pointer-events", "all");
201
- while (i--)
202
- nodel.classed(directions[i], false);
203
- var placement_success = false;
204
- var placement_overflow = {};
205
- var least_overflow_direction = directions[0];
206
- for (var i_1 = 0; i_1 < directions.length; i_1++) {
207
- placement_success = _placement_attempt(directions[i_1]);
208
- if (placement_success)
209
- break;
210
- }
211
- if (!placement_success) {
212
- nodel.classed("notick", true);
213
- var top_offset = _vertical_adjustment(placement_overflow[least_overflow_direction]);
214
- var left_offset = _horizontal_adjustment(placement_overflow[least_overflow_direction]);
215
- _placement_attempt(least_overflow_direction, top_offset, left_offset);
216
- }
217
- else {
218
- nodel.classed("notick", false);
219
- }
220
- return tip;
221
- function _horizontal_adjustment(overflow_obj) {
222
- if (overflow_obj.left > overflow_obj.right) {
223
- return overflow_obj.left > 0 ? -overflow_obj.left : 0;
224
- }
225
- else {
226
- return overflow_obj.right > 0 ? overflow_obj.right : 0;
227
- }
228
- }
229
- function _vertical_adjustment(overflow_obj) {
230
- if (overflow_obj.top > overflow_obj.bottom) {
231
- return overflow_obj.top > 0 ? -overflow_obj.top : 0;
232
- }
233
- else {
234
- return overflow_obj.bottom;
235
- }
236
- }
237
- function _placement_attempt(_dir, _top_offset, _left_offset) {
238
- _top_offset = _top_offset ? _top_offset : 0;
239
- _left_offset = _left_offset ? _left_offset : 0;
240
- nodel.style("white-space", "nowrap");
241
- coords = directionCallbacks.get(_dir).apply(this);
242
- nodel.classed(_dir, true)
243
- .style("top", (coords.top + poffset[0] - _top_offset) + "px")
244
- .style("left", (coords.left + poffset[1] - _left_offset) + "px");
245
- var nodel_bbox = nodel.node().getBoundingClientRect();
246
- var ret = nodel_bbox.top > root_bbox.top
247
- && nodel_bbox.left > root_bbox.left
248
- && nodel_bbox.bottom < root_bbox.bottom
249
- && nodel_bbox.right < root_bbox.right;
250
- placement_overflow[_dir] = {
251
- top: root_bbox.top - nodel_bbox.top,
252
- right: nodel_bbox.right - root_bbox.right,
253
- bottom: nodel_bbox.bottom - root_bbox.bottom,
254
- left: root_bbox.left - nodel_bbox.left
255
- };
256
- nodel.style("white-space", "normal");
257
- placement_overflow[_dir].total_overflow = Object.keys(placement_overflow[_dir])
258
- .filter(function (side) { return placement_overflow[_dir][side] > 0; })
259
- .reduce(function (sum, side) {
260
- var side_overflow = placement_overflow[_dir][side];
261
- return sum + side_overflow;
262
- }, 0);
263
- if (placement_overflow[least_overflow_direction].total_overflow > placement_overflow[_dir].total_overflow) {
264
- least_overflow_direction = _dir;
265
- }
266
- if (!ret) {
267
- nodel.classed(_dir, false);
268
- }
269
- return ret;
270
- }
271
- };
272
- // Public - hide the tooltip
273
- //
274
- // Returns a tip
275
- tip.hide = function () {
276
- var nodel = getNodeEl();
277
- nodel.style("opacity", 0).style("pointer-events", "none");
278
- return tip;
279
- };
280
- // Public: Proxy attr calls to the d3 tip container.
281
- // Sets or gets attribute value.
282
- //
283
- // n - name of the attribute
284
- // v - value of the attribute
285
- //
286
- // Returns tip or attribute value
287
- // eslint-disable-next-line no-unused-vars
288
- tip.attr = function (n, v) {
289
- if (arguments.length < 2 && typeof n === "string") {
290
- return getNodeEl().attr(n);
291
- }
292
- var args = Array.prototype.slice.call(arguments);
293
- selection.prototype.attr.apply(getNodeEl(), args);
294
- return tip;
295
- };
296
- // Public: Proxy style calls to the d3 tip container.
297
- // Sets or gets a style value.
298
- //
299
- // n - name of the property
300
- // v - value of the property
301
- //
302
- // Returns tip or style property value
303
- // eslint-disable-next-line no-unused-vars
304
- tip.style = function (n, v) {
305
- if (arguments.length < 2 && typeof n === "string") {
306
- return getNodeEl().style(n);
307
- }
308
- var args = Array.prototype.slice.call(arguments);
309
- selection.prototype.style.apply(getNodeEl(), args);
310
- return tip;
311
- };
312
- // Public: Set or get the direction of the tooltip
313
- //
314
- // v - One of n(north), s(south), e(east), or w(west), nw(northwest),
315
- // sw(southwest), ne(northeast) or se(southeast)
316
- //
317
- // Returns tip or direction
318
- tip.direction = function (v) {
319
- if (!arguments.length)
320
- return direction;
321
- direction = v == null ? v : functor(v);
322
- return tip;
323
- };
324
- // Public: Sets or gets the offset of the tip
325
- //
326
- // v - Array of [x, y] offset
327
- //
328
- // Returns offset or
329
- tip.offset = function (v) {
330
- if (!arguments.length)
331
- return offset;
332
- offset = v == null ? v : functor(v);
333
- return tip;
334
- };
335
- // Public: sets or gets the html value of the tooltip
336
- //
337
- // v - String value of the tip
338
- //
339
- // Returns html value or tip
340
- tip.html = function (v) {
341
- if (!arguments.length)
342
- return html;
343
- html = v == null ? v : functor(v);
344
- return tip;
345
- };
346
- // Public: sets or gets the root element anchor of the tooltip
347
- //
348
- // v - root element of the tooltip
349
- //
350
- // Returns root node of tip
351
- tip.rootElement = function (v) {
352
- if (!arguments.length)
353
- return rootElement;
354
- rootElement = functor(v);
355
- return tip;
356
- };
357
- // Public: destroys the tooltip and removes it from the DOM
358
- //
359
- // Returns a tip
360
- tip.destroy = function () {
361
- if (node) {
362
- getNodeEl().remove();
363
- node = null;
364
- }
365
- return tip;
366
- };
367
- function d3TipDirection() { return "n"; }
368
- function d3TipOffset() { return [0, 0]; }
369
- function d3TipHTML() { return " "; }
370
- var directionCallbacks = map({
371
- n: directionNorth,
372
- s: directionSouth,
373
- e: directionEast,
374
- w: directionWest,
375
- nw: directionNorthWest,
376
- ne: directionNorthEast,
377
- sw: directionSouthWest,
378
- se: directionSouthEast
379
- });
380
- var directions = directionCallbacks.keys();
381
- function directionNorth() {
382
- var bbox = getScreenBBox(window);
383
- return {
384
- top: bbox.n.y - node.offsetHeight,
385
- left: bbox.n.x - node.offsetWidth / 2
386
- };
387
- }
388
- function directionSouth() {
389
- var bbox = getScreenBBox(window);
390
- return {
391
- top: bbox.s.y + 8,
392
- left: bbox.s.x - node.offsetWidth / 2
393
- };
394
- }
395
- function directionEast() {
396
- var bbox = getScreenBBox(window);
397
- return {
398
- top: bbox.e.y - node.offsetHeight / 2,
399
- left: bbox.e.x + 8
400
- };
401
- }
402
- function directionWest() {
403
- var bbox = getScreenBBox(window);
404
- return {
405
- top: bbox.w.y - node.offsetHeight / 2,
406
- left: bbox.w.x - node.offsetWidth - 8
407
- };
408
- }
409
- function directionNorthWest() {
410
- var bbox = getScreenBBox(window);
411
- return {
412
- top: bbox.nw.y - node.offsetHeight,
413
- left: bbox.nw.x - node.offsetWidth
414
- };
415
- }
416
- function directionNorthEast() {
417
- var bbox = getScreenBBox(window);
418
- return {
419
- top: bbox.ne.y - node.offsetHeight,
420
- left: bbox.ne.x
421
- };
422
- }
423
- function directionSouthWest() {
424
- var bbox = getScreenBBox(window);
425
- return {
426
- top: bbox.sw.y,
427
- left: bbox.sw.x - node.offsetWidth
428
- };
429
- }
430
- function directionSouthEast() {
431
- var bbox = getScreenBBox(window);
432
- return {
433
- top: bbox.se.y,
434
- left: bbox.se.x
435
- };
436
- }
437
- function initNode() {
438
- var div = select(document.createElement("div"));
439
- div
440
- .attr("class", "d3-tip")
441
- .style("position", "absolute")
442
- .style("top", "0px")
443
- .style("opacity", 0)
444
- .style("pointer-events", "none")
445
- .style("box-sizing", "border-box");
446
- return div.node();
447
- }
448
- function getSVGNode(element) {
449
- var svgNode = element.node();
450
- if (!svgNode)
451
- return null;
452
- if (svgNode.tagName.toLowerCase() === "svg")
453
- return svgNode;
454
- return svgNode.ownerSVGElement;
455
- }
456
- function getNodeEl() {
457
- if (node == null) {
458
- node = initNode();
459
- // re-add node to DOM
460
- rootElement().appendChild(node);
461
- }
462
- return select(node);
463
- }
464
- // Private - gets the screen coordinates of a shape
465
- //
466
- // Given a shape on the screen, will return an SVGPoint for the directions
467
- // n(north), s(south), e(east), w(west), ne(northeast), se(southeast),
468
- // nw(northwest), sw(southwest).
469
- //
470
- // +-+-+
471
- // | |
472
- // + +
473
- // | |
474
- // +-+-+
475
- //
476
- // Returns an Object {n, s, e, w, nw, sw, ne, se}
477
- function getScreenBBox(targetShape) {
478
- var targetel = target || targetShape;
479
- while (targetel.getCTM == null && targetel.parentNode != null) {
480
- targetel = targetel.parentNode;
481
- }
482
- var bbox = {};
483
- var matrix = targetel.getCTM();
484
- var tbbox = targetel.getBBox();
485
- var width = tbbox.width;
486
- var height = tbbox.height;
487
- var x = tbbox.x;
488
- var y = tbbox.y;
489
- point.x = x;
490
- point.y = y;
491
- bbox.nw = point.matrixTransform(matrix);
492
- point.x += width;
493
- bbox.ne = point.matrixTransform(matrix);
494
- point.y += height;
495
- bbox.se = point.matrixTransform(matrix);
496
- point.x -= width;
497
- bbox.sw = point.matrixTransform(matrix);
498
- point.y -= height / 2;
499
- bbox.w = point.matrixTransform(matrix);
500
- point.x += width;
501
- bbox.e = point.matrixTransform(matrix);
502
- point.x -= width / 2;
503
- point.y -= height / 2;
504
- bbox.n = point.matrixTransform(matrix);
505
- point.y += height;
506
- bbox.s = point.matrixTransform(matrix);
507
- return bbox;
508
- }
509
- // Private - replace D3JS 3.X d3.functor() function
510
- function functor(v) {
511
- return typeof v === "function" ? v : function () {
512
- return v;
513
- };
514
- }
515
- return tip;
516
- }
517
-
518
- function styleInject(css, ref) {
519
- if ( ref === void 0 ) ref = {};
520
- var insertAt = ref.insertAt;
521
-
522
- if (typeof document === 'undefined') { return; }
523
-
524
- var head = document.head || document.getElementsByTagName('head')[0];
525
- var style = document.createElement('style');
526
- style.type = 'text/css';
527
-
528
- if (insertAt === 'top') {
529
- if (head.firstChild) {
530
- head.insertBefore(style, head.firstChild);
531
- } else {
532
- head.appendChild(style);
533
- }
534
- } else {
535
- head.appendChild(style);
536
- }
537
-
538
- if (style.styleSheet) {
539
- style.styleSheet.cssText = css;
540
- } else {
541
- style.appendChild(document.createTextNode(css));
542
- }
543
- }
544
-
545
- var css_248z = ".d3-tip{background:rgba(0,0,0,.66);border-radius:2px;color:#fff;font-weight:700;line-height:1;padding:12px;pointer-events:none!important;z-index:10}.d3-tip.hidden{visibility:hidden}.d3-tip:after{border:4px solid rgba(0,0,0,.66);box-sizing:border-box;content:\" \";display:inline-block;height:8px;margin:0;pointer-events:none!important;position:absolute;width:8px}.d3-tip.n:after{border-bottom-color:transparent;border-left-color:transparent;border-right-color:transparent;border-top-width:8px;left:calc(50% - 4px);top:100%}.d3-tip.e:after{border-bottom-color:transparent;border-left-color:transparent;border-right-width:8px;border-top-color:transparent;left:-12px;top:calc(50% - 4px)}.d3-tip.s{margin-top:8px}.d3-tip.s:after{border-bottom-width:8px;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent;left:calc(50% - 4px);top:-12px}.d3-tip.w:after{border-bottom-color:transparent;border-left-width:8px;border-right-color:transparent;border-top-color:transparent;left:100%;top:calc(50% - 4px)}.d3-tip.notick:after{border-color:transparent!important}.common_Widget .over{stroke:rgba(0,0,0,.66);opacity:.66}.d3-tip.ITooltip-tooltipStyle-series-table{padding:0}.d3-tip .ITooltip-series-table td,.d3-tip .ITooltip-series-table th{border:1px solid #d1d1d1;padding:6px;text-align:left}.d3-tip .ITooltip-series-table .series-table-row-color{display:inline-block;height:10px;margin-right:10px;width:10px}.d3-tip .ITooltip-series-table .series-table-row-label{display:inline-block}.d3-tip .ITooltip-series-table th{background-color:#b3b3b3}.d3-tip .ITooltip-series-table td{background-color:#fff;color:#555;font-weight:400}.d3-tip .ITooltip-series-table td:first-child{border-right:0}table.ITooltip-series-table td:last-child{border-left:1px dotted #a3a3a3}";
546
- styleInject(css_248z);
547
-
548
- // Use old school class declaration as this is a mixin ---
549
- function ITooltip() {
550
- this.tooltip = tip();
551
- if (this.tooltipLabelFormat_exists()) {
552
- this._labelFormatter = format(this.tooltipLabelFormat());
553
- }
554
- if (this.tooltipValueFormat_exists()) {
555
- this._valueFormatter = format(this.tooltipValueFormat());
556
- }
557
- if (this.layerEnter) {
558
- var layerEnter_1 = this.layerEnter;
559
- this.layerEnter = function (_base, svgElement, _domElement) {
560
- if (!this._parentOverlay) {
561
- this._parentOverlay = _base._parentOverlay;
562
- }
563
- this.tooltipEnter(svgElement);
564
- layerEnter_1.apply(this, arguments);
565
- };
566
- var layerUpdate_1 = this.layerUpdate;
567
- this.layerUpdate = function (_base) {
568
- layerUpdate_1.apply(this, arguments);
569
- this.tooltipUpdate();
570
- };
571
- var layerExit_1 = this.layerExit;
572
- this.layerExit = function (_base) {
573
- this.tooltipExit();
574
- layerExit_1.apply(this, arguments);
575
- };
576
- }
577
- else {
578
- var enter_1 = this.enter;
579
- this.enter = function (_domNode, element) {
580
- this.tooltipEnter(element);
581
- enter_1.apply(this, arguments);
582
- };
583
- var update_1 = this.update;
584
- this.update = function (_domNode, _element) {
585
- update_1.apply(this, arguments);
586
- this.tooltipUpdate();
587
- };
588
- var exit_1 = this.exit;
589
- this.exit = function (_domNode, _element) {
590
- this.tooltipExit();
591
- exit_1.apply(this, arguments);
592
- };
593
- }
594
- }
595
- ITooltip.prototype = Object.create(Widget.prototype);
596
- ITooltip.prototype.constructor = ITooltip;
597
- // abstract target(): any;
598
- // abstract target(_: any): this;
599
- ITooltip.prototype.tooltipEnter = function (element) {
600
- var overlayElement = this.parentOverlay();
601
- if (!overlayElement.empty()) {
602
- this.tooltip.rootElement(overlayElement.node().parentNode);
603
- }
604
- element.call(this.tooltip);
605
- };
606
- ITooltip.prototype.tooltipUpdate = function () {
607
- var _this = this;
608
- this.tooltip.offset(function () {
609
- if (event && _this.tooltipFollowMouse()) {
610
- var d3tipElement = document.querySelector(".d3-tip"); // d3Tip offers no reference to the '.d3-tip' element...?
611
- d3tipElement.style.display = "block";
612
- d3tipElement.style.left = _this.tooltipOffset() + (event.clientX) + "px";
613
- d3tipElement.style.top = event.clientY + "px";
614
- return [];
615
- }
616
- switch (_this.tooltip.direction()()) {
617
- case "e":
618
- return [0, _this.tooltipOffset()];
619
- default:
620
- return [-_this.tooltipOffset(), 0];
621
- }
622
- });
623
- var classed = this.tooltip.attr("class");
624
- if (classed) {
625
- classed = classed.split(" notick").join("") + (this.tooltipTick() ? "" : " notick") + (this.tooltipStyle() === "none" ? " hidden" : "");
626
- classed = classed.split(" ")
627
- .filter(function (_class) {
628
- return _class.indexOf("ITooltip-tooltipStyle-") !== 0;
629
- })
630
- .join(" ");
631
- classed += " ITooltip-tooltipStyle-" + this.tooltipStyle();
632
- this.tooltip
633
- .attr("class", classed);
634
- }
635
- };
636
- ITooltip.prototype.tooltipExit = function () {
637
- if (this.tooltip) {
638
- this.tooltip.destroy();
639
- }
640
- };
641
- ITooltip.prototype._tooltipHTML = function (d) {
642
- return d;
643
- };
644
- ITooltip.prototype.tooltipHTML = function (_) {
645
- return this.tooltip.html(_);
646
- };
647
- ITooltip.prototype.tooltipFormat = function (opts) {
648
- if (opts === void 0) { opts = {}; }
649
- opts.label = opts.label === undefined ? "" : opts.label;
650
- if (this._labelFormatter) {
651
- opts.label = this._labelFormatter(opts.label) || "";
652
- }
653
- else if (this.formatData && this.parseData) {
654
- opts.label = this.formatData(this.parseData(opts.label));
655
- }
656
- opts.series = opts.series || "";
657
- if (opts.value instanceof Date) {
658
- opts.value = opts.value || "";
659
- }
660
- else if (this._valueFormatter) {
661
- opts.value = this._valueFormatter(opts.value) || "";
662
- }
663
- else if (this.formatValue && this.parseValue) {
664
- opts.value = this.formatValue(this.parseValue(opts.value));
665
- }
666
- switch (this.tooltipStyle()) {
667
- case "none":
668
- break;
669
- case "series-table":
670
- var html_1 = '<table class="ITooltip-series-table">'
671
- + "<thead>"
672
- + '<tr><th colspan="2">' + opts.label + "</th></tr>"
673
- + "</thead>"
674
- + "<tbody>";
675
- opts.arr.forEach(function (row) {
676
- html_1 += "<tr>";
677
- html_1 += "<td>";
678
- html_1 += '<div class="series-table-row-color" style="background-color:' + row.color + '"></div>';
679
- html_1 += '<div class="series-table-row-label">' + row.label + "</div>";
680
- html_1 += "</td>";
681
- html_1 += '<td><div class="series-table-row-value">' + row.value + "</div></td>";
682
- html_1 += "</tr>";
683
- });
684
- html_1 += "</tbody>";
685
- html_1 += "</table>";
686
- return html_1;
687
- default:
688
- if (opts.series) {
689
- return "<span style='color:" + this.tooltipSeriesColor() + "'>" + opts.series + "</span> / <span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
690
- }
691
- if (opts.label !== "") {
692
- return "<span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
693
- }
694
- return "<span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
695
- }
696
- };
697
- ITooltip.prototype.tooltipKeyValueFormat = function (titleKey, obj) {
698
- var body = "";
699
- for (var key in obj) {
700
- if (key !== titleKey) {
701
- var value = obj && obj[key] ? obj[key] : "";
702
- body += "<tr><td style=\"".concat(this.tooltipLabelColor_exists() ? "color:" + this.tooltipLabelColor() : "", "\">").concat(key, "</td><td style=\"font-weight:normal\">").concat(value, "</td></tr>");
703
- }
704
- }
705
- return "<table>\n <thead>\n <tr><th colspan=\"2\" style=\"font-weight:bold;font-size:16px\">".concat(obj[titleKey], "</th></tr>\n </thead>\n <tbody>\n ").concat(body, "\n </tbody>\n </table>");
706
- };
707
- ITooltip.prototype.publish("tooltipStyle", "default", "set", "Style mode", ["default", "none", "series-table"], {});
708
- ITooltip.prototype.publish("tooltipFollowMouse", false, "boolean", "If true, the tooltip will follow mouse movement", null, {});
709
- ITooltip.prototype.publish("tooltipLabelFormat", undefined, "string", "Format of tooltip label(s) (the domain axis)", null, {});
710
- ITooltip.prototype.publish("tooltipValueFormat", undefined, "string", "Number format of tooltip value(s)", null, {});
711
- ITooltip.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Color of tooltip series text", null, {});
712
- ITooltip.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Color of tooltip label text (the domain axis)", null, {});
713
- ITooltip.prototype.publish("tooltipValueColor", "white", "html-color", "Color of tooltip value(s)", null, {});
714
- ITooltip.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {});
715
- ITooltip.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {});
716
- var tooltipLabelFormat = ITooltip.prototype.tooltipLabelFormat;
717
- ITooltip.prototype.tooltipLabelFormat = function (_) {
718
- var retVal = tooltipLabelFormat.apply(this, arguments);
719
- if (arguments.length) {
720
- this._labelFormatter = format(_);
721
- }
722
- return retVal;
723
- };
724
- var tooltipValueFormat = ITooltip.prototype.tooltipValueFormat;
725
- ITooltip.prototype.tooltipValueFormat = function (_) {
726
- var retVal = tooltipValueFormat.apply(this, arguments);
727
- if (arguments.length) {
728
- this._valueFormatter = format(_);
729
- }
730
- return retVal;
731
- };
732
-
733
- // Use old school class declaration as this is a mixin ---
734
- function ITree() {
735
- }
736
- ITree.prototype.constructor = ITree;
737
- // Events ---
738
- ITree.prototype.click = function (row, column, selected) {
739
- };
740
- ITree.prototype.dblclick = function (row, column, selected) {
741
- };
742
- ITree.prototype._palette = Palette.ordinal("default");
743
-
744
- export { BUILD_VERSION, I1DChart, I2DAggrChart, I2DChart, IGraph, IInput, INDChart, ITooltip, ITree, PKG_NAME, PKG_VERSION, instanceOfIHighlight };
745
- //# sourceMappingURL=index.es6.js.map