@hpcc-js/other 2.17.0 → 2.17.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { HTMLWidget, Utility, Palette, timeParse, format, select, map, extent, range, CanvasWidget, SVGWidget, Entity, d3Event, Widget, Platform, selectAll, PropertyExt, local } from '@hpcc-js/common';
1
+ import { HTMLWidget, Utility, timeParse, format, select, map, extent, range, Palette, CanvasWidget, SVGWidget, Entity, d3Event, Widget, Platform, selectAll, PropertyExt, local } from '@hpcc-js/common';
2
2
  import { HorizontalList, VerticalList, Grid } from '@hpcc-js/layout';
3
3
 
4
4
  function _mergeNamespaces(n, m) {
@@ -17,8 +17,8 @@ function _mergeNamespaces(n, m) {
17
17
  }
18
18
 
19
19
  var PKG_NAME = "@hpcc-js/other";
20
- var PKG_VERSION = "2.17.0";
21
- var BUILD_VERSION = "2.107.0";
20
+ var PKG_VERSION = "2.17.1";
21
+ var BUILD_VERSION = "2.108.2";
22
22
 
23
23
  /******************************************************************************
24
24
  Copyright (c) Microsoft Corporation.
@@ -250,247 +250,254 @@ var autoComplete$1 = {exports: {}};
250
250
  License: http://www.opensource.org/licenses/mit-license.php
251
251
  */
252
252
 
253
- (function (module) {
254
- var autoComplete = (function(){
255
- // "use strict";
256
- function autoComplete(options){
257
- if (!document.querySelector) return;
258
-
259
- // helpers
260
- function hasClass(el, className){ return el.classList ? el.classList.contains(className) : new RegExp('\\b'+ className+'\\b').test(el.className); }
261
-
262
- function addEvent(el, type, handler){
263
- if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
264
- }
265
- function removeEvent(el, type, handler){
266
- // if (el.removeEventListener) not working in IE11
267
- if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
268
- }
269
- function live(elClass, event, cb, context){
270
- addEvent(context || document, event, function(e){
271
- var found, el = e.target || e.srcElement;
272
- while (el && !(found = hasClass(el, elClass))) el = el.parentElement;
273
- if (found) cb.call(el, e);
274
- });
275
- }
276
-
277
- var o = {
278
- selector: 0,
279
- source: 0,
280
- minChars: 3,
281
- delay: 150,
282
- offsetLeft: 0,
283
- offsetTop: 1,
284
- cache: 1,
285
- menuClass: '',
286
- renderItem: function (item, search){
287
- // escape special characters
288
- search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
289
- var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
290
- return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
291
- },
292
- onSelect: function(e, term, item){}
293
- };
294
- for (var k in options) { if (options.hasOwnProperty(k)) o[k] = options[k]; }
295
-
296
- // init
297
- var elems = typeof o.selector == 'object' ? [o.selector] : document.querySelectorAll(o.selector);
298
- for (var i=0; i<elems.length; i++) {
299
- var that = elems[i];
300
-
301
- // create suggestions container "sc"
302
- that.sc = document.createElement('div');
303
- that.sc.className = 'autocomplete-suggestions '+o.menuClass;
304
-
305
- that.autocompleteAttr = that.getAttribute('autocomplete');
306
- that.setAttribute('autocomplete', 'off');
307
- that.cache = {};
308
- that.last_val = '';
309
-
310
- that.updateSC = function(resize, next){
311
- var rect = that.getBoundingClientRect();
312
- that.sc.style.left = Math.round(rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft) + 'px';
313
- that.sc.style.top = Math.round(rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + o.offsetTop) + 'px';
314
- that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
315
- if (!resize) {
316
- that.sc.style.display = 'block';
317
- that.sc.classList.remove('hide');
318
- if (!that.sc.maxHeight) { that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight); }
319
- if (!that.sc.suggestionHeight) that.sc.suggestionHeight = that.sc.querySelector('.autocomplete-suggestion').offsetHeight;
320
- if (that.sc.suggestionHeight)
321
- if (!next) that.sc.scrollTop = 0;
322
- else {
323
- var scrTop = that.sc.scrollTop, selTop = next.getBoundingClientRect().top - that.sc.getBoundingClientRect().top;
324
- if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0)
325
- that.sc.scrollTop = selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight;
326
- else if (selTop < 0)
327
- that.sc.scrollTop = selTop + scrTop;
328
- }
329
- }
330
- };
331
- addEvent(window, 'resize', that.updateSC);
332
- document.body.appendChild(that.sc);
333
-
334
- live('autocomplete-suggestion', 'mouseleave', function(e){
335
- var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
336
- if (sel) setTimeout(function(){ sel.className = sel.className.replace('selected', ''); }, 20);
337
- }, that.sc);
338
-
339
- live('autocomplete-suggestion', 'mouseover', function(e){
340
- var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
341
- if (sel) sel.className = sel.className.replace('selected', '');
342
- this.className += ' selected';
343
- }, that.sc);
344
-
345
- live('autocomplete-suggestion', 'mousedown', function(e){
346
- if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
347
- var v = this.getAttribute('data-val');
348
- that.value = v;
349
- o.onSelect(e, v, this);
350
- that.sc.style.display = 'none';
351
- that.sc.classList.add("hide");
352
-
353
- }
354
- }, that.sc);
355
-
356
- that.blurHandler = function(){
357
- try { var over_sb = document.querySelector('.autocomplete-suggestions:hover'); } catch(e){ var over_sb = 0; }
358
- if (!over_sb) {
359
- that.last_val = that.value;
360
- that.sc.style.display = 'none';
361
- that.sc.classList.add("hide");
362
- setTimeout(function(){
363
- that.sc.style.display = 'none';
364
- that.sc.classList.add("hide");
365
- }, 350); // hide suggestions on fast input
366
- } else if (that !== document.activeElement) setTimeout(function(){ that.focus(); }, 20);
367
- };
368
- addEvent(that, 'blur', that.blurHandler);
369
-
370
- var suggest = function(data, val){
371
- if (!val) {
372
- var val = that.value;
373
- }
374
- that.cache[val] = data;
375
- if (data.length && val.length >= o.minChars) {
376
- var s = '';
377
- for (var i=0;i<data.length;i++) s += o.renderItem(data[i], val);
378
- that.sc.innerHTML = s;
379
- that.updateSC(0);
380
- }
381
- else {
382
- that.sc.style.display = 'none';
383
- that.sc.classList.add("hide");
384
- }
385
- };
386
-
387
- that.keydownHandler = function(e){
388
- var key = window.event ? e.keyCode : e.which;
389
- // down (40), up (38)
390
- if ((key == 40 || key == 38) && that.sc.innerHTML) {
391
- var next, sel = that.sc.querySelector('.autocomplete-suggestion.selected');
392
- if (!sel) {
393
- next = (key == 40) ? that.sc.querySelector('.autocomplete-suggestion') : that.sc.childNodes[that.sc.childNodes.length - 1]; // first : last
394
- next.className += ' selected';
395
- that.value = next.getAttribute('data-val');
396
- } else {
397
- next = (key == 40) ? sel.nextSibling : sel.previousSibling;
398
- if (next) {
399
- sel.className = sel.className.replace('selected', '');
400
- next.className += ' selected';
401
- that.value = next.getAttribute('data-val');
402
- }
403
- else { sel.className = sel.className.replace('selected', ''); that.value = that.last_val; next = 0; }
404
- }
405
- that.updateSC(0, next);
406
- return false;
407
- }
408
- // esc
409
- else if (key == 27) {
410
- that.value = that.last_val;
411
- that.sc.style.display = 'none';
412
- that.sc.classList.add("hide");
413
- }
414
- // enter
415
- else if (key == 13 || key == 9) {
416
- if (that.sc.style.display !== 'none') {
417
- e.preventDefault();
418
- }
419
- var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
420
- if (sel && that.sc.style.display != 'none') {
421
- o.onSelect(e, sel.getAttribute('data-val'), sel);
422
- setTimeout(function(){
423
- that.sc.style.display = 'none';
424
- that.sc.classList.add("hide");
425
- }, 20); }
426
- }
427
- };
428
- addEvent(that, 'keydown', that.keydownHandler);
429
-
430
- that.keyupHandler = function(e){
431
- var key = window.event ? e.keyCode : e.which;
432
- if (!key || (key < 35 || key > 40) && key != 13 && key != 27) {
433
- var val = that.value;
434
- if (val.length >= o.minChars) {
435
- if (val != that.last_val) {
436
- that.last_val = val;
437
- clearTimeout(that.timer);
438
- if (o.cache) {
439
- if (val in that.cache) { suggest(that.cache[val]); return; }
440
- // no requests if previous suggestions were empty
441
- for (var i=1; i<val.length-o.minChars; i++) {
442
- var part = val.slice(0, val.length-i);
443
- if (part in that.cache && !that.cache[part].length) { suggest([]); return; }
444
- }
445
- }
446
- that.timer = setTimeout(function(){ o.source(val, suggest); }, o.delay);
447
- }
448
- } else {
449
- that.last_val = val;
450
- that.sc.style.display = 'none';
451
- that.sc.classList.add("hide");
452
- }
453
- }
454
- };
455
- addEvent(that, 'keyup', that.keyupHandler);
456
-
457
- that.focusHandler = function(e){
458
- that.last_val = '\n';
459
- that.keyupHandler(e);
460
- };
461
- if (!o.minChars) addEvent(that, 'focus', that.focusHandler);
462
- }
463
-
464
- // public destroy method
465
- this.destroy = function(){
466
- for (var i=0; i<elems.length; i++) {
467
- var that = elems[i];
468
- removeEvent(window, 'resize', that.updateSC);
469
- removeEvent(that, 'blur', that.blurHandler);
470
- removeEvent(that, 'focus', that.focusHandler);
471
- removeEvent(that, 'keydown', that.keydownHandler);
472
- removeEvent(that, 'keyup', that.keyupHandler);
473
- if (that.autocompleteAttr)
474
- that.setAttribute('autocomplete', that.autocompleteAttr);
475
- else
476
- that.removeAttribute('autocomplete');
477
- document.body.removeChild(that.sc);
478
- that = null;
479
- }
480
- };
481
- }
482
- return autoComplete;
483
- })();
484
-
485
- (function(){
486
- if (module.exports)
487
- module.exports = autoComplete;
488
- else
489
- window.autoComplete = autoComplete;
490
- })();
491
- } (autoComplete$1));
492
-
493
- var autoCompleteExports = autoComplete$1.exports;
253
+ var hasRequiredAutoComplete;
254
+
255
+ function requireAutoComplete () {
256
+ if (hasRequiredAutoComplete) return autoComplete$1.exports;
257
+ hasRequiredAutoComplete = 1;
258
+ (function (module) {
259
+ var autoComplete = (function(){
260
+ // "use strict";
261
+ function autoComplete(options){
262
+ if (!document.querySelector) return;
263
+
264
+ // helpers
265
+ function hasClass(el, className){ return el.classList ? el.classList.contains(className) : new RegExp('\\b'+ className+'\\b').test(el.className); }
266
+
267
+ function addEvent(el, type, handler){
268
+ if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
269
+ }
270
+ function removeEvent(el, type, handler){
271
+ // if (el.removeEventListener) not working in IE11
272
+ if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
273
+ }
274
+ function live(elClass, event, cb, context){
275
+ addEvent(context || document, event, function(e){
276
+ var found, el = e.target || e.srcElement;
277
+ while (el && !(found = hasClass(el, elClass))) el = el.parentElement;
278
+ if (found) cb.call(el, e);
279
+ });
280
+ }
281
+
282
+ var o = {
283
+ selector: 0,
284
+ source: 0,
285
+ minChars: 3,
286
+ delay: 150,
287
+ offsetLeft: 0,
288
+ offsetTop: 1,
289
+ cache: 1,
290
+ menuClass: '',
291
+ renderItem: function (item, search){
292
+ // escape special characters
293
+ search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
294
+ var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
295
+ return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
296
+ },
297
+ onSelect: function(e, term, item){}
298
+ };
299
+ for (var k in options) { if (options.hasOwnProperty(k)) o[k] = options[k]; }
300
+
301
+ // init
302
+ var elems = typeof o.selector == 'object' ? [o.selector] : document.querySelectorAll(o.selector);
303
+ for (var i=0; i<elems.length; i++) {
304
+ var that = elems[i];
305
+
306
+ // create suggestions container "sc"
307
+ that.sc = document.createElement('div');
308
+ that.sc.className = 'autocomplete-suggestions '+o.menuClass;
309
+
310
+ that.autocompleteAttr = that.getAttribute('autocomplete');
311
+ that.setAttribute('autocomplete', 'off');
312
+ that.cache = {};
313
+ that.last_val = '';
314
+
315
+ that.updateSC = function(resize, next){
316
+ var rect = that.getBoundingClientRect();
317
+ that.sc.style.left = Math.round(rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft) + 'px';
318
+ that.sc.style.top = Math.round(rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + o.offsetTop) + 'px';
319
+ that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
320
+ if (!resize) {
321
+ that.sc.style.display = 'block';
322
+ that.sc.classList.remove('hide');
323
+ if (!that.sc.maxHeight) { that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight); }
324
+ if (!that.sc.suggestionHeight) that.sc.suggestionHeight = that.sc.querySelector('.autocomplete-suggestion').offsetHeight;
325
+ if (that.sc.suggestionHeight)
326
+ if (!next) that.sc.scrollTop = 0;
327
+ else {
328
+ var scrTop = that.sc.scrollTop, selTop = next.getBoundingClientRect().top - that.sc.getBoundingClientRect().top;
329
+ if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0)
330
+ that.sc.scrollTop = selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight;
331
+ else if (selTop < 0)
332
+ that.sc.scrollTop = selTop + scrTop;
333
+ }
334
+ }
335
+ };
336
+ addEvent(window, 'resize', that.updateSC);
337
+ document.body.appendChild(that.sc);
338
+
339
+ live('autocomplete-suggestion', 'mouseleave', function(e){
340
+ var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
341
+ if (sel) setTimeout(function(){ sel.className = sel.className.replace('selected', ''); }, 20);
342
+ }, that.sc);
343
+
344
+ live('autocomplete-suggestion', 'mouseover', function(e){
345
+ var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
346
+ if (sel) sel.className = sel.className.replace('selected', '');
347
+ this.className += ' selected';
348
+ }, that.sc);
349
+
350
+ live('autocomplete-suggestion', 'mousedown', function(e){
351
+ if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
352
+ var v = this.getAttribute('data-val');
353
+ that.value = v;
354
+ o.onSelect(e, v, this);
355
+ that.sc.style.display = 'none';
356
+ that.sc.classList.add("hide");
357
+
358
+ }
359
+ }, that.sc);
360
+
361
+ that.blurHandler = function(){
362
+ try { var over_sb = document.querySelector('.autocomplete-suggestions:hover'); } catch(e){ var over_sb = 0; }
363
+ if (!over_sb) {
364
+ that.last_val = that.value;
365
+ that.sc.style.display = 'none';
366
+ that.sc.classList.add("hide");
367
+ setTimeout(function(){
368
+ that.sc.style.display = 'none';
369
+ that.sc.classList.add("hide");
370
+ }, 350); // hide suggestions on fast input
371
+ } else if (that !== document.activeElement) setTimeout(function(){ that.focus(); }, 20);
372
+ };
373
+ addEvent(that, 'blur', that.blurHandler);
374
+
375
+ var suggest = function(data, val){
376
+ if (!val) {
377
+ var val = that.value;
378
+ }
379
+ that.cache[val] = data;
380
+ if (data.length && val.length >= o.minChars) {
381
+ var s = '';
382
+ for (var i=0;i<data.length;i++) s += o.renderItem(data[i], val);
383
+ that.sc.innerHTML = s;
384
+ that.updateSC(0);
385
+ }
386
+ else {
387
+ that.sc.style.display = 'none';
388
+ that.sc.classList.add("hide");
389
+ }
390
+ };
391
+
392
+ that.keydownHandler = function(e){
393
+ var key = window.event ? e.keyCode : e.which;
394
+ // down (40), up (38)
395
+ if ((key == 40 || key == 38) && that.sc.innerHTML) {
396
+ var next, sel = that.sc.querySelector('.autocomplete-suggestion.selected');
397
+ if (!sel) {
398
+ next = (key == 40) ? that.sc.querySelector('.autocomplete-suggestion') : that.sc.childNodes[that.sc.childNodes.length - 1]; // first : last
399
+ next.className += ' selected';
400
+ that.value = next.getAttribute('data-val');
401
+ } else {
402
+ next = (key == 40) ? sel.nextSibling : sel.previousSibling;
403
+ if (next) {
404
+ sel.className = sel.className.replace('selected', '');
405
+ next.className += ' selected';
406
+ that.value = next.getAttribute('data-val');
407
+ }
408
+ else { sel.className = sel.className.replace('selected', ''); that.value = that.last_val; next = 0; }
409
+ }
410
+ that.updateSC(0, next);
411
+ return false;
412
+ }
413
+ // esc
414
+ else if (key == 27) {
415
+ that.value = that.last_val;
416
+ that.sc.style.display = 'none';
417
+ that.sc.classList.add("hide");
418
+ }
419
+ // enter
420
+ else if (key == 13 || key == 9) {
421
+ if (that.sc.style.display !== 'none') {
422
+ e.preventDefault();
423
+ }
424
+ var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
425
+ if (sel && that.sc.style.display != 'none') {
426
+ o.onSelect(e, sel.getAttribute('data-val'), sel);
427
+ setTimeout(function(){
428
+ that.sc.style.display = 'none';
429
+ that.sc.classList.add("hide");
430
+ }, 20); }
431
+ }
432
+ };
433
+ addEvent(that, 'keydown', that.keydownHandler);
434
+
435
+ that.keyupHandler = function(e){
436
+ var key = window.event ? e.keyCode : e.which;
437
+ if (!key || (key < 35 || key > 40) && key != 13 && key != 27) {
438
+ var val = that.value;
439
+ if (val.length >= o.minChars) {
440
+ if (val != that.last_val) {
441
+ that.last_val = val;
442
+ clearTimeout(that.timer);
443
+ if (o.cache) {
444
+ if (val in that.cache) { suggest(that.cache[val]); return; }
445
+ // no requests if previous suggestions were empty
446
+ for (var i=1; i<val.length-o.minChars; i++) {
447
+ var part = val.slice(0, val.length-i);
448
+ if (part in that.cache && !that.cache[part].length) { suggest([]); return; }
449
+ }
450
+ }
451
+ that.timer = setTimeout(function(){ o.source(val, suggest); }, o.delay);
452
+ }
453
+ } else {
454
+ that.last_val = val;
455
+ that.sc.style.display = 'none';
456
+ that.sc.classList.add("hide");
457
+ }
458
+ }
459
+ };
460
+ addEvent(that, 'keyup', that.keyupHandler);
461
+
462
+ that.focusHandler = function(e){
463
+ that.last_val = '\n';
464
+ that.keyupHandler(e);
465
+ };
466
+ if (!o.minChars) addEvent(that, 'focus', that.focusHandler);
467
+ }
468
+
469
+ // public destroy method
470
+ this.destroy = function(){
471
+ for (var i=0; i<elems.length; i++) {
472
+ var that = elems[i];
473
+ removeEvent(window, 'resize', that.updateSC);
474
+ removeEvent(that, 'blur', that.blurHandler);
475
+ removeEvent(that, 'focus', that.focusHandler);
476
+ removeEvent(that, 'keydown', that.keydownHandler);
477
+ removeEvent(that, 'keyup', that.keyupHandler);
478
+ if (that.autocompleteAttr)
479
+ that.setAttribute('autocomplete', that.autocompleteAttr);
480
+ else
481
+ that.removeAttribute('autocomplete');
482
+ document.body.removeChild(that.sc);
483
+ that = null;
484
+ }
485
+ };
486
+ }
487
+ return autoComplete;
488
+ })();
489
+
490
+ (function(){
491
+ if (module.exports)
492
+ module.exports = autoComplete;
493
+ else
494
+ window.autoComplete = autoComplete;
495
+ })();
496
+ } (autoComplete$1));
497
+ return autoComplete$1.exports;
498
+ }
499
+
500
+ var autoCompleteExports = requireAutoComplete();
494
501
  var autoComplete = /*@__PURE__*/getDefaultExportFromCjs(autoCompleteExports);
495
502
 
496
503
  var AutoComplete = /*#__PURE__*/_mergeNamespaces({
@@ -667,7 +674,7 @@ function newInterval(floori, offseti, count, field) {
667
674
  if (step < 0) while (++step <= 0) {
668
675
  while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
669
676
  } else while (--step >= 0) {
670
- while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
677
+ while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty
671
678
  }
672
679
  }
673
680
  });
@@ -2387,151 +2394,158 @@ function flattenResult(result, mappings) {
2387
2394
 
2388
2395
  var simpleheat$2 = {exports: {}};
2389
2396
 
2390
- (function (module) {
2391
-
2392
- module.exports = simpleheat;
2393
-
2394
- function simpleheat(canvas) {
2395
- if (!(this instanceof simpleheat)) return new simpleheat(canvas);
2396
-
2397
- this._canvas = canvas = typeof canvas === 'string' ? document.getElementById(canvas) : canvas;
2398
-
2399
- this._ctx = canvas.getContext('2d');
2400
- this._width = canvas.width;
2401
- this._height = canvas.height;
2402
-
2403
- this._max = 1;
2404
- this._data = [];
2405
- }
2406
-
2407
- simpleheat.prototype = {
2397
+ var hasRequiredSimpleheat;
2408
2398
 
2409
- defaultRadius: 25,
2399
+ function requireSimpleheat () {
2400
+ if (hasRequiredSimpleheat) return simpleheat$2.exports;
2401
+ hasRequiredSimpleheat = 1;
2402
+ (function (module) {
2410
2403
 
2411
- defaultGradient: {
2412
- 0.4: 'blue',
2413
- 0.6: 'cyan',
2414
- 0.7: 'lime',
2415
- 0.8: 'yellow',
2416
- 1.0: 'red'
2417
- },
2404
+ module.exports = simpleheat;
2418
2405
 
2419
- data: function (data) {
2420
- this._data = data;
2421
- return this;
2422
- },
2406
+ function simpleheat(canvas) {
2407
+ if (!(this instanceof simpleheat)) return new simpleheat(canvas);
2423
2408
 
2424
- max: function (max) {
2425
- this._max = max;
2426
- return this;
2427
- },
2409
+ this._canvas = canvas = typeof canvas === 'string' ? document.getElementById(canvas) : canvas;
2428
2410
 
2429
- add: function (point) {
2430
- this._data.push(point);
2431
- return this;
2432
- },
2411
+ this._ctx = canvas.getContext('2d');
2412
+ this._width = canvas.width;
2413
+ this._height = canvas.height;
2433
2414
 
2434
- clear: function () {
2435
- this._data = [];
2436
- return this;
2437
- },
2415
+ this._max = 1;
2416
+ this._data = [];
2417
+ }
2438
2418
 
2439
- radius: function (r, blur) {
2440
- blur = blur === undefined ? 15 : blur;
2419
+ simpleheat.prototype = {
2441
2420
 
2442
- // create a grayscale blurred circle image that we'll use for drawing points
2443
- var circle = this._circle = this._createCanvas(),
2444
- ctx = circle.getContext('2d'),
2445
- r2 = this._r = r + blur;
2421
+ defaultRadius: 25,
2446
2422
 
2447
- circle.width = circle.height = r2 * 2;
2423
+ defaultGradient: {
2424
+ 0.4: 'blue',
2425
+ 0.6: 'cyan',
2426
+ 0.7: 'lime',
2427
+ 0.8: 'yellow',
2428
+ 1.0: 'red'
2429
+ },
2448
2430
 
2449
- ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
2450
- ctx.shadowBlur = blur;
2451
- ctx.shadowColor = 'black';
2431
+ data: function (data) {
2432
+ this._data = data;
2433
+ return this;
2434
+ },
2452
2435
 
2453
- ctx.beginPath();
2454
- ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
2455
- ctx.closePath();
2456
- ctx.fill();
2436
+ max: function (max) {
2437
+ this._max = max;
2438
+ return this;
2439
+ },
2457
2440
 
2458
- return this;
2459
- },
2460
-
2461
- resize: function () {
2462
- this._width = this._canvas.width;
2463
- this._height = this._canvas.height;
2464
- },
2465
-
2466
- gradient: function (grad) {
2467
- // create a 256x1 gradient that we'll use to turn a grayscale heatmap into a colored one
2468
- var canvas = this._createCanvas(),
2469
- ctx = canvas.getContext('2d'),
2470
- gradient = ctx.createLinearGradient(0, 0, 0, 256);
2471
-
2472
- canvas.width = 1;
2473
- canvas.height = 256;
2474
-
2475
- for (var i in grad) {
2476
- gradient.addColorStop(+i, grad[i]);
2477
- }
2478
-
2479
- ctx.fillStyle = gradient;
2480
- ctx.fillRect(0, 0, 1, 256);
2481
-
2482
- this._grad = ctx.getImageData(0, 0, 1, 256).data;
2483
-
2484
- return this;
2485
- },
2441
+ add: function (point) {
2442
+ this._data.push(point);
2443
+ return this;
2444
+ },
2445
+
2446
+ clear: function () {
2447
+ this._data = [];
2448
+ return this;
2449
+ },
2450
+
2451
+ radius: function (r, blur) {
2452
+ blur = blur === undefined ? 15 : blur;
2453
+
2454
+ // create a grayscale blurred circle image that we'll use for drawing points
2455
+ var circle = this._circle = this._createCanvas(),
2456
+ ctx = circle.getContext('2d'),
2457
+ r2 = this._r = r + blur;
2458
+
2459
+ circle.width = circle.height = r2 * 2;
2460
+
2461
+ ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
2462
+ ctx.shadowBlur = blur;
2463
+ ctx.shadowColor = 'black';
2464
+
2465
+ ctx.beginPath();
2466
+ ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
2467
+ ctx.closePath();
2468
+ ctx.fill();
2469
+
2470
+ return this;
2471
+ },
2472
+
2473
+ resize: function () {
2474
+ this._width = this._canvas.width;
2475
+ this._height = this._canvas.height;
2476
+ },
2477
+
2478
+ gradient: function (grad) {
2479
+ // create a 256x1 gradient that we'll use to turn a grayscale heatmap into a colored one
2480
+ var canvas = this._createCanvas(),
2481
+ ctx = canvas.getContext('2d'),
2482
+ gradient = ctx.createLinearGradient(0, 0, 0, 256);
2483
+
2484
+ canvas.width = 1;
2485
+ canvas.height = 256;
2486
+
2487
+ for (var i in grad) {
2488
+ gradient.addColorStop(+i, grad[i]);
2489
+ }
2490
+
2491
+ ctx.fillStyle = gradient;
2492
+ ctx.fillRect(0, 0, 1, 256);
2493
+
2494
+ this._grad = ctx.getImageData(0, 0, 1, 256).data;
2495
+
2496
+ return this;
2497
+ },
2498
+
2499
+ draw: function (minOpacity) {
2500
+ if (!this._circle) this.radius(this.defaultRadius);
2501
+ if (!this._grad) this.gradient(this.defaultGradient);
2502
+
2503
+ var ctx = this._ctx;
2504
+
2505
+ ctx.clearRect(0, 0, this._width, this._height);
2506
+
2507
+ // draw a grayscale heatmap by putting a blurred circle at each data point
2508
+ for (var i = 0, len = this._data.length, p; i < len; i++) {
2509
+ p = this._data[i];
2510
+ ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
2511
+ ctx.drawImage(this._circle, p[0] - this._r, p[1] - this._r);
2512
+ }
2513
+
2514
+ // colorize the heatmap, using opacity value of each pixel to get the right color from our gradient
2515
+ var colored = ctx.getImageData(0, 0, this._width, this._height);
2516
+ this._colorize(colored.data, this._grad);
2517
+ ctx.putImageData(colored, 0, 0);
2518
+
2519
+ return this;
2520
+ },
2521
+
2522
+ _colorize: function (pixels, gradient) {
2523
+ for (var i = 0, len = pixels.length, j; i < len; i += 4) {
2524
+ j = pixels[i + 3] * 4; // get gradient color from opacity value
2525
+
2526
+ if (j) {
2527
+ pixels[i] = gradient[j];
2528
+ pixels[i + 1] = gradient[j + 1];
2529
+ pixels[i + 2] = gradient[j + 2];
2530
+ }
2531
+ }
2532
+ },
2533
+
2534
+ _createCanvas: function () {
2535
+ if (typeof document !== 'undefined') {
2536
+ return document.createElement('canvas');
2537
+ } else {
2538
+ // create a new canvas instance in node.js
2539
+ // the canvas class needs to have a default constructor without any parameter
2540
+ return new this._canvas.constructor();
2541
+ }
2542
+ }
2543
+ };
2544
+ } (simpleheat$2));
2545
+ return simpleheat$2.exports;
2546
+ }
2486
2547
 
2487
- draw: function (minOpacity) {
2488
- if (!this._circle) this.radius(this.defaultRadius);
2489
- if (!this._grad) this.gradient(this.defaultGradient);
2490
-
2491
- var ctx = this._ctx;
2492
-
2493
- ctx.clearRect(0, 0, this._width, this._height);
2494
-
2495
- // draw a grayscale heatmap by putting a blurred circle at each data point
2496
- for (var i = 0, len = this._data.length, p; i < len; i++) {
2497
- p = this._data[i];
2498
- ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
2499
- ctx.drawImage(this._circle, p[0] - this._r, p[1] - this._r);
2500
- }
2501
-
2502
- // colorize the heatmap, using opacity value of each pixel to get the right color from our gradient
2503
- var colored = ctx.getImageData(0, 0, this._width, this._height);
2504
- this._colorize(colored.data, this._grad);
2505
- ctx.putImageData(colored, 0, 0);
2506
-
2507
- return this;
2508
- },
2509
-
2510
- _colorize: function (pixels, gradient) {
2511
- for (var i = 0, len = pixels.length, j; i < len; i += 4) {
2512
- j = pixels[i + 3] * 4; // get gradient color from opacity value
2513
-
2514
- if (j) {
2515
- pixels[i] = gradient[j];
2516
- pixels[i + 1] = gradient[j + 1];
2517
- pixels[i + 2] = gradient[j + 2];
2518
- }
2519
- }
2520
- },
2521
-
2522
- _createCanvas: function () {
2523
- if (typeof document !== 'undefined') {
2524
- return document.createElement('canvas');
2525
- } else {
2526
- // create a new canvas instance in node.js
2527
- // the canvas class needs to have a default constructor without any parameter
2528
- return new this._canvas.constructor();
2529
- }
2530
- }
2531
- };
2532
- } (simpleheat$2));
2533
-
2534
- var simpleheatExports = simpleheat$2.exports;
2548
+ var simpleheatExports = requireSimpleheat();
2535
2549
  var simpleheat$1 = /*@__PURE__*/getDefaultExportFromCjs(simpleheatExports);
2536
2550
 
2537
2551
  var _simpleheat = /*#__PURE__*/_mergeNamespaces({
@@ -4078,7 +4092,7 @@ var MorphText = /** @class */ (function (_super) {
4078
4092
  .attr("class", "enter")
4079
4093
  .attr("font-size", this.fontSize())
4080
4094
  .attr("dy", ".35em")
4081
- .attr("y", (this.reverse() ? +1 : -1) * this._fontWidth * 2)
4095
+ .attr("y", (this.reverse() ? 1 : -1) * this._fontWidth * 2)
4082
4096
  .attr("x", function (d, i) { return (-context.data().length / 2 + i) * context._fontWidth + context._fontWidth / 2; })
4083
4097
  .style("fill-opacity", 1e-6)
4084
4098
  .style("text-anchor", this.anchor())
@@ -4089,7 +4103,7 @@ var MorphText = /** @class */ (function (_super) {
4089
4103
  text.exit()
4090
4104
  .attr("class", "exit");
4091
4105
  this.transition.apply(text.exit())
4092
- .attr("y", (this.reverse() ? -1 : +1) * this._fontWidth * 2)
4106
+ .attr("y", (this.reverse() ? -1 : 1) * this._fontWidth * 2)
4093
4107
  .style("fill-opacity", 1e-6)
4094
4108
  .remove();
4095
4109
  };
@@ -4413,7 +4427,7 @@ var Opportunity = /** @class */ (function (_super) {
4413
4427
  })
4414
4428
  .attr("y1", nodeRectHeight / 2)
4415
4429
  .attr("x2", function (d2) {
4416
- return (d2.delta > 0) ? (nodeRectWidth + nodeRectWidthPadding - 4) + ((Math.abs(d2.delta) - 1)) * (w / context.groupCount) : ((-nodeRectWidthPadding - ((Math.abs(d2.delta) - 1)) * (w / context.groupCount)) + 4);
4430
+ return (d2.delta > 0) ? (nodeRectWidth + nodeRectWidthPadding - 4) + ((Math.abs(d2.delta) - 1)) * (w / context.groupCount) : ((-30 - ((Math.abs(d2.delta) - 1)) * (w / context.groupCount)) + 4);
4417
4431
  })
4418
4432
  .attr("y2", nodeRectHeight / 2)
4419
4433
  .style("stroke-dasharray", ("3, 3"))