@websy/websy-designs 1.5.1 → 1.6.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.
@@ -1949,6 +1949,29 @@ var WebsyDropdown = /*#__PURE__*/function () {
1949
1949
 
1950
1950
  this.updateHeader(item);
1951
1951
  }
1952
+ }, {
1953
+ key: "setValue",
1954
+ value: function setValue(value) {
1955
+ var _this12 = this;
1956
+
1957
+ this.selectedItems = [];
1958
+
1959
+ if (Array.isArray(value)) {
1960
+ this.options.items.forEach(function (d) {
1961
+ if (value.indexOf(d.value) !== -1) {
1962
+ _this12.selectedItems.push(d.index);
1963
+ }
1964
+ });
1965
+ } else {
1966
+ this.options.items.forEach(function (d) {
1967
+ if (d.value === value) {
1968
+ _this12.selectedItems.push(d.index);
1969
+ }
1970
+ });
1971
+ }
1972
+
1973
+ this.render();
1974
+ }
1952
1975
  }, {
1953
1976
  key: "updateHeader",
1954
1977
  value: function updateHeader(item) {
@@ -2403,7 +2426,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2403
2426
  }, {
2404
2427
  key: "render",
2405
2428
  value: function render() {
2406
- var _this12 = this;
2429
+ var _this13 = this;
2407
2430
 
2408
2431
  var el = document.getElementById("".concat(this.elementId, "_container"));
2409
2432
 
@@ -2411,7 +2434,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2411
2434
  this.measureItems();
2412
2435
  var html = "\n <div id='".concat(this.elementId, "start_item' class='websy-dragdrop-item ").concat(this.options.items.length === 0 ? 'empty' : '', "' data-id='").concat(this.elementId, "start'>\n <div id='").concat(this.elementId, "start_dropZone' class='websy-drop-zone droppable' data-index='start' data-side='start' data-id='").concat(this.elementId, "start' data-placeholder='").concat(this.options.dropPlaceholder, "'></div>\n </div>\n ");
2413
2436
  html += this.options.items.map(function (d, i) {
2414
- return _this12.createItemHtml(_this12.elementId, i, d);
2437
+ return _this13.createItemHtml(_this13.elementId, i, d);
2415
2438
  }).join('');
2416
2439
  el.innerHTML = html;
2417
2440
  this.options.items.forEach(function (item, i) {
@@ -2463,6 +2486,7 @@ var WebsyForm = /*#__PURE__*/function () {
2463
2486
  }
2464
2487
 
2465
2488
  this.apiService = new WebsyDesigns.APIService('');
2489
+ this.fieldMap = {};
2466
2490
  this.elementId = elementId;
2467
2491
  var el = document.getElementById(elementId);
2468
2492
 
@@ -2490,19 +2514,19 @@ var WebsyForm = /*#__PURE__*/function () {
2490
2514
  }, {
2491
2515
  key: "checkRecaptcha",
2492
2516
  value: function checkRecaptcha() {
2493
- var _this13 = this;
2517
+ var _this14 = this;
2494
2518
 
2495
2519
  return new Promise(function (resolve, reject) {
2496
- if (_this13.options.useRecaptcha === true) {
2497
- if (_this13.recaptchaValue) {
2520
+ if (_this14.options.useRecaptcha === true) {
2521
+ if (_this14.recaptchaValue) {
2498
2522
  // grecaptcha.ready(() => {
2499
2523
  // grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
2500
- _this13.apiService.add('google/checkrecaptcha', {
2501
- grecaptcharesponse: _this13.recaptchaValue
2524
+ _this14.apiService.add('google/checkrecaptcha', {
2525
+ grecaptcharesponse: _this14.recaptchaValue
2502
2526
  }).then(function (response) {
2503
2527
  if (response.success && response.success === true) {
2504
2528
  resolve(true);
2505
- grecaptcha.reset("".concat(_this13.elementId, "_recaptcha"), {
2529
+ grecaptcha.reset("".concat(_this14.elementId, "_recaptcha"), {
2506
2530
  sitekey: ENVIRONMENT.RECAPTCHA_KEY
2507
2531
  });
2508
2532
  } else {
@@ -2563,14 +2587,14 @@ var WebsyForm = /*#__PURE__*/function () {
2563
2587
  }, {
2564
2588
  key: "processComponents",
2565
2589
  value: function processComponents(components, callbackFn) {
2566
- var _this14 = this;
2590
+ var _this15 = this;
2567
2591
 
2568
2592
  if (components.length === 0) {
2569
2593
  callbackFn();
2570
2594
  } else {
2571
2595
  components.forEach(function (c) {
2572
2596
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
2573
- c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
2597
+ c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
2574
2598
  } else {// some user feedback here
2575
2599
  }
2576
2600
  });
@@ -2579,15 +2603,15 @@ var WebsyForm = /*#__PURE__*/function () {
2579
2603
  }, {
2580
2604
  key: "recaptchaReady",
2581
2605
  value: function recaptchaReady() {
2582
- var _this15 = this;
2606
+ var _this16 = this;
2583
2607
 
2584
2608
  var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
2585
2609
 
2586
2610
  if (el) {
2587
2611
  grecaptcha.ready(function () {
2588
- grecaptcha.render("".concat(_this15.elementId, "_recaptcha"), {
2612
+ grecaptcha.render("".concat(_this16.elementId, "_recaptcha"), {
2589
2613
  sitekey: ENVIRONMENT.RECAPTCHA_KEY,
2590
- callback: _this15.validateRecaptcha.bind(_this15)
2614
+ callback: _this16.validateRecaptcha.bind(_this16)
2591
2615
  });
2592
2616
  });
2593
2617
  }
@@ -2595,7 +2619,7 @@ var WebsyForm = /*#__PURE__*/function () {
2595
2619
  }, {
2596
2620
  key: "render",
2597
2621
  value: function render(update, data) {
2598
- var _this16 = this;
2622
+ var _this17 = this;
2599
2623
 
2600
2624
  var el = document.getElementById(this.elementId);
2601
2625
  var componentsToProcess = [];
@@ -2603,13 +2627,15 @@ var WebsyForm = /*#__PURE__*/function () {
2603
2627
  if (el) {
2604
2628
  var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
2605
2629
  this.options.fields.forEach(function (f, i) {
2630
+ _this17.fieldMap[f.field] = f;
2631
+
2606
2632
  if (f.component) {
2607
2633
  componentsToProcess.push(f);
2608
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2634
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this17.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2609
2635
  } else if (f.type === 'longtext') {
2610
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2636
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this17.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2611
2637
  } else {
2612
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2638
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this17.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2613
2639
  }
2614
2640
  });
2615
2641
 
@@ -2626,16 +2652,35 @@ var WebsyForm = /*#__PURE__*/function () {
2626
2652
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
2627
2653
  el.innerHTML = html;
2628
2654
  this.processComponents(componentsToProcess, function () {
2629
- if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2630
- _this16.recaptchaReady();
2655
+ if (_this17.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2656
+ _this17.recaptchaReady();
2631
2657
  }
2632
2658
  });
2633
2659
  }
2634
2660
  }
2661
+ }, {
2662
+ key: "setValue",
2663
+ value: function setValue(field, value) {
2664
+ if (this.fieldMap[field]) {
2665
+ if (this.fieldMap[field].instance) {
2666
+ this.fieldMap[field].instance.setValue(value);
2667
+ } else {
2668
+ var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
2669
+
2670
+ if (el) {
2671
+ el.value = value;
2672
+ } else {
2673
+ console.error("Input for ".concat(field, " does not exist in form."));
2674
+ }
2675
+ }
2676
+ } else {
2677
+ console.error("Field ".concat(field, " does not exist in form."));
2678
+ }
2679
+ }
2635
2680
  }, {
2636
2681
  key: "submitForm",
2637
2682
  value: function submitForm() {
2638
- var _this17 = this;
2683
+ var _this18 = this;
2639
2684
 
2640
2685
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2641
2686
  var buttonEl = formEl.querySelector('button.websy-btn.submit');
@@ -2663,34 +2708,34 @@ var WebsyForm = /*#__PURE__*/function () {
2663
2708
  data[key] = value;
2664
2709
  });
2665
2710
 
2666
- if (_this17.options.url) {
2667
- var _this17$apiService;
2711
+ if (_this18.options.url) {
2712
+ var _this18$apiService;
2668
2713
 
2669
- var params = [_this17.options.url];
2714
+ var params = [_this18.options.url];
2670
2715
 
2671
- if (_this17.options.mode === 'update') {
2672
- params.push(_this17.options.id);
2716
+ if (_this18.options.mode === 'update') {
2717
+ params.push(_this18.options.id);
2673
2718
  }
2674
2719
 
2675
2720
  params.push(data);
2676
2721
 
2677
- (_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
2678
- if (_this17.options.clearAfterSave === true) {
2722
+ (_this18$apiService = _this18.apiService)[_this18.options.mode].apply(_this18$apiService, params).then(function (result) {
2723
+ if (_this18.options.clearAfterSave === true) {
2679
2724
  // this.render()
2680
2725
  formEl.reset();
2681
2726
  }
2682
2727
 
2683
2728
  buttonEl.removeAttribute('disabled');
2684
2729
 
2685
- _this17.options.onSuccess.call(_this17, result);
2730
+ _this18.options.onSuccess.call(_this18, result);
2686
2731
  }, function (err) {
2687
2732
  console.log('Error submitting form data:', err);
2688
2733
 
2689
- _this17.options.onError.call(_this17, err);
2734
+ _this18.options.onError.call(_this18, err);
2690
2735
  });
2691
- } else if (_this17.options.submitFn) {
2692
- _this17.options.submitFn(data, function () {
2693
- if (_this17.options.clearAfterSave === true) {
2736
+ } else if (_this18.options.submitFn) {
2737
+ _this18.options.submitFn(data, function () {
2738
+ if (_this18.options.clearAfterSave === true) {
2694
2739
  // this.render()
2695
2740
  formEl.reset();
2696
2741
  }
@@ -2715,18 +2760,27 @@ var WebsyForm = /*#__PURE__*/function () {
2715
2760
  }
2716
2761
  }, {
2717
2762
  key: "data",
2763
+ get: function get() {
2764
+ var formEl = document.getElementById("".concat(this.elementId, "Form"));
2765
+ var data = {};
2766
+ var temp = new FormData(formEl);
2767
+ temp.forEach(function (value, key) {
2768
+ data[key] = value;
2769
+ });
2770
+ return data;
2771
+ },
2718
2772
  set: function set(d) {
2719
- var _this18 = this;
2773
+ var _this19 = this;
2720
2774
 
2721
2775
  if (!this.options.fields) {
2722
2776
  this.options.fields = [];
2723
2777
  }
2724
2778
 
2725
2779
  var _loop = function _loop(key) {
2726
- _this18.options.fields.forEach(function (f) {
2780
+ _this19.options.fields.forEach(function (f) {
2727
2781
  if (f.field === key) {
2728
2782
  f.value = d[key];
2729
- var el = document.getElementById("".concat(_this18.elementId, "_input_").concat(f.field));
2783
+ var el = document.getElementById("".concat(_this19.elementId, "_input_").concat(f.field));
2730
2784
  el.value = f.value;
2731
2785
  }
2732
2786
  });
@@ -2867,6 +2921,11 @@ var WebsyLogin = /*#__PURE__*/function () {
2867
2921
  onSuccess: this.loginSuccess.bind(this),
2868
2922
  onError: this.loginFail.bind(this)
2869
2923
  };
2924
+
2925
+ if (this.options.fields) {
2926
+ formOptions.fields = this.options.fields.concat(formOptions.fields);
2927
+ }
2928
+
2870
2929
  this.loginForm = new WebsyDesigns.WebsyForm("".concat(this.elementId, "_container"), _extends({}, this.options, formOptions));
2871
2930
  } else {
2872
2931
  console.error("No element with ID ".concat(this.elementId, " found for WebsyLogin component."));
@@ -3046,7 +3105,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3046
3105
  }, {
3047
3106
  key: "handleSearch",
3048
3107
  value: function handleSearch(searchText) {
3049
- var _this19 = this;
3108
+ var _this20 = this;
3050
3109
 
3051
3110
  var el = document.getElementById(this.elementId); // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
3052
3111
 
@@ -3059,7 +3118,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3059
3118
  if (searchText && searchText.length > 1) {
3060
3119
  defaultMethod = 'add';
3061
3120
  visibleItems = lowestItems.filter(function (d) {
3062
- return d[_this19.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3121
+ return d[_this20.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3063
3122
  });
3064
3123
  } // hide everything
3065
3124
 
@@ -3287,7 +3346,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3287
3346
 
3288
3347
  var Pager = /*#__PURE__*/function () {
3289
3348
  function Pager(elementId, options) {
3290
- var _this20 = this;
3349
+ var _this21 = this;
3291
3350
 
3292
3351
  _classCallCheck(this, Pager);
3293
3352
 
@@ -3340,8 +3399,8 @@ var Pager = /*#__PURE__*/function () {
3340
3399
  allowClear: false,
3341
3400
  disableSearch: true,
3342
3401
  onItemSelected: function onItemSelected(selectedItem) {
3343
- if (_this20.options.onChangePageSize) {
3344
- _this20.options.onChangePageSize(selectedItem.value);
3402
+ if (_this21.options.onChangePageSize) {
3403
+ _this21.options.onChangePageSize(selectedItem.value);
3345
3404
  }
3346
3405
  }
3347
3406
  });
@@ -3365,13 +3424,13 @@ var Pager = /*#__PURE__*/function () {
3365
3424
  }, {
3366
3425
  key: "render",
3367
3426
  value: function render() {
3368
- var _this21 = this;
3427
+ var _this22 = this;
3369
3428
 
3370
3429
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3371
3430
 
3372
3431
  if (el) {
3373
3432
  var pages = this.options.pages.map(function (item, index) {
3374
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this21.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3433
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3375
3434
  });
3376
3435
  var startIndex = 0;
3377
3436
 
@@ -3439,58 +3498,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3439
3498
  _createClass(WebsyPDFButton, [{
3440
3499
  key: "handleClick",
3441
3500
  value: function handleClick(event) {
3442
- var _this22 = this;
3501
+ var _this23 = this;
3443
3502
 
3444
3503
  if (event.target.classList.contains('websy-pdf-button')) {
3445
3504
  this.loader.show();
3446
3505
  setTimeout(function () {
3447
- if (_this22.options.targetId) {
3448
- var el = document.getElementById(_this22.options.targetId);
3506
+ if (_this23.options.targetId) {
3507
+ var el = document.getElementById(_this23.options.targetId);
3449
3508
 
3450
3509
  if (el) {
3451
3510
  var pdfData = {
3452
3511
  options: {}
3453
3512
  };
3454
3513
 
3455
- if (_this22.options.pdfOptions) {
3456
- pdfData.options = _extends({}, _this22.options.pdfOptions);
3514
+ if (_this23.options.pdfOptions) {
3515
+ pdfData.options = _extends({}, _this23.options.pdfOptions);
3457
3516
  }
3458
3517
 
3459
- if (_this22.options.header) {
3460
- if (_this22.options.header.elementId) {
3461
- var headerEl = document.getElementById(_this22.options.header.elementId);
3518
+ if (_this23.options.header) {
3519
+ if (_this23.options.header.elementId) {
3520
+ var headerEl = document.getElementById(_this23.options.header.elementId);
3462
3521
 
3463
3522
  if (headerEl) {
3464
3523
  pdfData.header = headerEl.outerHTML;
3465
3524
 
3466
- if (_this22.options.header.css) {
3467
- pdfData.options.headerCSS = _this22.options.header.css;
3525
+ if (_this23.options.header.css) {
3526
+ pdfData.options.headerCSS = _this23.options.header.css;
3468
3527
  }
3469
3528
  }
3470
- } else if (_this22.options.header.html) {
3471
- pdfData.header = _this22.options.header.html;
3529
+ } else if (_this23.options.header.html) {
3530
+ pdfData.header = _this23.options.header.html;
3472
3531
 
3473
- if (_this22.options.header.css) {
3474
- pdfData.options.headerCSS = _this22.options.header.css;
3532
+ if (_this23.options.header.css) {
3533
+ pdfData.options.headerCSS = _this23.options.header.css;
3475
3534
  }
3476
3535
  } else {
3477
- pdfData.header = _this22.options.header;
3536
+ pdfData.header = _this23.options.header;
3478
3537
  }
3479
3538
  }
3480
3539
 
3481
- if (_this22.options.footer) {
3482
- if (_this22.options.footer.elementId) {
3483
- var footerEl = document.getElementById(_this22.options.footer.elementId);
3540
+ if (_this23.options.footer) {
3541
+ if (_this23.options.footer.elementId) {
3542
+ var footerEl = document.getElementById(_this23.options.footer.elementId);
3484
3543
 
3485
3544
  if (footerEl) {
3486
3545
  pdfData.footer = footerEl.outerHTML;
3487
3546
 
3488
- if (_this22.options.footer.css) {
3489
- pdfData.options.footerCSS = _this22.options.footer.css;
3547
+ if (_this23.options.footer.css) {
3548
+ pdfData.options.footerCSS = _this23.options.footer.css;
3490
3549
  }
3491
3550
  }
3492
3551
  } else {
3493
- pdfData.footer = _this22.options.footer;
3552
+ pdfData.footer = _this23.options.footer;
3494
3553
  }
3495
3554
  }
3496
3555
 
@@ -3499,31 +3558,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3499
3558
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3500
3559
  // document.getElementById(`${this.elementId}_form`).submit()
3501
3560
 
3502
- _this22.service.add('', pdfData, {
3561
+ _this23.service.add('', pdfData, {
3503
3562
  responseType: 'blob'
3504
3563
  }).then(function (response) {
3505
- _this22.loader.hide();
3564
+ _this23.loader.hide();
3506
3565
 
3507
3566
  var blob = new Blob([response], {
3508
3567
  type: 'application/pdf'
3509
3568
  });
3510
3569
  var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
3511
3570
 
3512
- if (_this22.options.directDownload === true) {
3571
+ if (_this23.options.directDownload === true) {
3513
3572
  var fileName;
3514
3573
 
3515
- if (typeof _this22.options.fileName === 'function') {
3516
- fileName = _this22.options.fileName() || 'Export';
3574
+ if (typeof _this23.options.fileName === 'function') {
3575
+ fileName = _this23.options.fileName() || 'Export';
3517
3576
  } else {
3518
- fileName = _this22.options.fileName || 'Export';
3577
+ fileName = _this23.options.fileName || 'Export';
3519
3578
  }
3520
3579
 
3521
3580
  msg += "download='".concat(fileName, ".pdf'");
3522
3581
  }
3523
3582
 
3524
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this22.options.buttonText, "</button>\n </a>\n </div>\n ");
3583
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this23.options.buttonText, "</button>\n </a>\n </div>\n ");
3525
3584
 
3526
- _this22.popup.show({
3585
+ _this23.popup.show({
3527
3586
  message: msg,
3528
3587
  mask: true
3529
3588
  });
@@ -3724,7 +3783,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3724
3783
 
3725
3784
  var ResponsiveText = /*#__PURE__*/function () {
3726
3785
  function ResponsiveText(elementId, options) {
3727
- var _this23 = this;
3786
+ var _this24 = this;
3728
3787
 
3729
3788
  _classCallCheck(this, ResponsiveText);
3730
3789
 
@@ -3737,7 +3796,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3737
3796
  this.elementId = elementId;
3738
3797
  this.canvas = document.createElement('canvas');
3739
3798
  window.addEventListener('resize', function () {
3740
- return _this23.render();
3799
+ return _this24.render();
3741
3800
  });
3742
3801
  var el = document.getElementById(this.elementId);
3743
3802
 
@@ -3956,7 +4015,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3956
4015
 
3957
4016
  var WebsyResultList = /*#__PURE__*/function () {
3958
4017
  function WebsyResultList(elementId, options) {
3959
- var _this24 = this;
4018
+ var _this25 = this;
3960
4019
 
3961
4020
  _classCallCheck(this, WebsyResultList);
3962
4021
 
@@ -3988,9 +4047,9 @@ var WebsyResultList = /*#__PURE__*/function () {
3988
4047
 
3989
4048
  if (_typeof(options.template) === 'object' && options.template.url) {
3990
4049
  this.templateService.get(options.template.url).then(function (templateString) {
3991
- _this24.options.template = templateString;
4050
+ _this25.options.template = templateString;
3992
4051
 
3993
- _this24.render();
4052
+ _this25.render();
3994
4053
  });
3995
4054
  } else {
3996
4055
  this.render();
@@ -4010,7 +4069,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4010
4069
  }, {
4011
4070
  key: "buildHTML",
4012
4071
  value: function buildHTML(d) {
4013
- var _this25 = this;
4072
+ var _this26 = this;
4014
4073
 
4015
4074
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4016
4075
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
@@ -4020,7 +4079,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4020
4079
  if (this.options.template) {
4021
4080
  if (d.length > 0) {
4022
4081
  d.forEach(function (row, ix) {
4023
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this25.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
4082
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this26.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
4024
4083
 
4025
4084
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
4026
4085
 
@@ -4125,7 +4184,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4125
4184
  parts.forEach(function (p) {
4126
4185
  items = items[p];
4127
4186
  });
4128
- template = template.replace(m[0], _this25.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4187
+ template = template.replace(m[0], _this26.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4129
4188
  }
4130
4189
  });
4131
4190
 
@@ -4137,7 +4196,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4137
4196
  }
4138
4197
  });
4139
4198
 
4140
- var flatRow = _this25.flattenObject(row);
4199
+ var flatRow = _this26.flattenObject(row);
4141
4200
 
4142
4201
  for (var key in flatRow) {
4143
4202
  var rg = new RegExp("{".concat(key, "}"), 'gm');
@@ -4272,13 +4331,13 @@ var WebsyResultList = /*#__PURE__*/function () {
4272
4331
  }, {
4273
4332
  key: "render",
4274
4333
  value: function render() {
4275
- var _this26 = this;
4334
+ var _this27 = this;
4276
4335
 
4277
4336
  if (this.options.entity) {
4278
4337
  this.apiService.get(this.options.entity).then(function (results) {
4279
- _this26.rows = results.rows;
4338
+ _this27.rows = results.rows;
4280
4339
 
4281
- _this26.resize();
4340
+ _this27.resize();
4282
4341
  });
4283
4342
  } else {
4284
4343
  this.resize();
@@ -4364,14 +4423,14 @@ var WebsyRouter = /*#__PURE__*/function () {
4364
4423
  _createClass(WebsyRouter, [{
4365
4424
  key: "addGroup",
4366
4425
  value: function addGroup(group) {
4367
- var _this27 = this;
4426
+ var _this28 = this;
4368
4427
 
4369
4428
  if (!this.groups[group]) {
4370
4429
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4371
4430
 
4372
4431
  if (els) {
4373
4432
  this.getClosestParent(els[0], function (parent) {
4374
- _this27.groups[group] = {
4433
+ _this28.groups[group] = {
4375
4434
  activeView: '',
4376
4435
  views: [],
4377
4436
  parent: parent.getAttribute('data-view')
@@ -4434,7 +4493,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4434
4493
  }, {
4435
4494
  key: "removeUrlParams",
4436
4495
  value: function removeUrlParams() {
4437
- var _this28 = this;
4496
+ var _this29 = this;
4438
4497
 
4439
4498
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4440
4499
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -4448,7 +4507,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4448
4507
 
4449
4508
  if (this.currentParams && this.currentParams.items) {
4450
4509
  params.forEach(function (p) {
4451
- delete _this28.currentParams.items[p];
4510
+ delete _this29.currentParams.items[p];
4452
4511
  });
4453
4512
  path = this.buildUrlPath(this.currentParams.items);
4454
4513
  }
@@ -4812,12 +4871,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4812
4871
  }, {
4813
4872
  key: "showComponents",
4814
4873
  value: function showComponents(view) {
4815
- var _this29 = this;
4874
+ var _this30 = this;
4816
4875
 
4817
4876
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4818
4877
  this.options.views[view].components.forEach(function (c) {
4819
4878
  if (typeof c.instance === 'undefined') {
4820
- _this29.prepComponent(c.elementId, c.options);
4879
+ _this30.prepComponent(c.elementId, c.options);
4821
4880
 
4822
4881
  c.instance = new c.Component(c.elementId, c.options);
4823
4882
  } else if (c.instance.render) {
@@ -5175,7 +5234,7 @@ var WebsySearch = /*#__PURE__*/function () {
5175
5234
  }, {
5176
5235
  key: "handleKeyUp",
5177
5236
  value: function handleKeyUp(event) {
5178
- var _this30 = this;
5237
+ var _this31 = this;
5179
5238
 
5180
5239
  if (event.target.classList.contains('websy-search-input')) {
5181
5240
  if (this.searchTimeoutFn) {
@@ -5198,8 +5257,8 @@ var WebsySearch = /*#__PURE__*/function () {
5198
5257
 
5199
5258
  if (event.target.value.length >= this.options.minLength) {
5200
5259
  this.searchTimeoutFn = setTimeout(function () {
5201
- if (_this30.options.onSearch) {
5202
- _this30.options.onSearch(event.target.value);
5260
+ if (_this31.options.onSearch) {
5261
+ _this31.options.onSearch(event.target.value);
5203
5262
  }
5204
5263
  }, this.options.searchTimeout);
5205
5264
  } else {
@@ -5247,23 +5306,6 @@ var WebsySignup = /*#__PURE__*/function () {
5247
5306
  };
5248
5307
  this.elementId = elementId;
5249
5308
  this.options = _extends({}, DEFAULTS, options);
5250
-
5251
- if (!this.options.fields) {
5252
- this.options.fields = [{
5253
- label: this.options.loginType === 'email' ? 'Email' : 'Username',
5254
- placeholder: "Enter ".concat(this.options.loginType === 'email' ? 'your email address' : 'your chosen Username'),
5255
- field: this.options.loginType,
5256
- type: this.options.loginType,
5257
- required: true
5258
- }, {
5259
- label: 'Password',
5260
- placeholder: 'Enter your password',
5261
- field: this.options.passwordField || 'password',
5262
- type: 'password',
5263
- required: true
5264
- }];
5265
- }
5266
-
5267
5309
  var el = document.getElementById(this.elementId);
5268
5310
 
5269
5311
  if (el) {
@@ -5274,8 +5316,25 @@ var WebsySignup = /*#__PURE__*/function () {
5274
5316
  classes: (this.options.buttonClasses || []).join(' ') || ''
5275
5317
  },
5276
5318
  submitFn: this.submitForm.bind(this),
5277
- fields: this.options.fields
5319
+ fields: [{
5320
+ label: this.options.loginType === 'email' ? 'Email' : 'Username',
5321
+ placeholder: "Enter ".concat(this.options.loginType === 'email' ? 'your email address' : 'your chosen Username'),
5322
+ field: this.options.loginType,
5323
+ type: this.options.loginType,
5324
+ required: true
5325
+ }, {
5326
+ label: 'Password',
5327
+ placeholder: 'Enter your password',
5328
+ field: this.options.passwordField || 'password',
5329
+ type: 'password',
5330
+ required: true
5331
+ }]
5278
5332
  };
5333
+
5334
+ if (this.options.fields) {
5335
+ formOptions.fields = this.options.fields.concat(formOptions.fields);
5336
+ }
5337
+
5279
5338
  this.signupForm = new WebsyDesigns.WebsyForm(this.elementId, _extends({}, this.options, formOptions));
5280
5339
  } else {
5281
5340
  console.error("No element with ID ".concat(this.elementId, " found for WebsyLogin component."));
@@ -5370,7 +5429,7 @@ var Switch = /*#__PURE__*/function () {
5370
5429
 
5371
5430
  var WebsyTemplate = /*#__PURE__*/function () {
5372
5431
  function WebsyTemplate(elementId, options) {
5373
- var _this31 = this;
5432
+ var _this32 = this;
5374
5433
 
5375
5434
  _classCallCheck(this, WebsyTemplate);
5376
5435
 
@@ -5396,9 +5455,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
5396
5455
 
5397
5456
  if (_typeof(options.template) === 'object' && options.template.url) {
5398
5457
  this.templateService.get(options.template.url).then(function (templateString) {
5399
- _this31.options.template = templateString;
5458
+ _this32.options.template = templateString;
5400
5459
 
5401
- _this31.render();
5460
+ _this32.render();
5402
5461
  });
5403
5462
  } else {
5404
5463
  this.render();
@@ -5408,7 +5467,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5408
5467
  _createClass(WebsyTemplate, [{
5409
5468
  key: "buildHTML",
5410
5469
  value: function buildHTML() {
5411
- var _this32 = this;
5470
+ var _this33 = this;
5412
5471
 
5413
5472
  var html = "";
5414
5473
 
@@ -5470,14 +5529,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5470
5529
  }
5471
5530
 
5472
5531
  if (polarity === true) {
5473
- if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] === parts[1]) {
5532
+ if (typeof _this33.options.data[parts[0]] !== 'undefined' && _this33.options.data[parts[0]] === parts[1]) {
5474
5533
  // remove the <if> tags
5475
5534
  removeAll = false;
5476
5535
  } else if (parts[0] === parts[1]) {
5477
5536
  removeAll = false;
5478
5537
  }
5479
5538
  } else if (polarity === false) {
5480
- if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] !== parts[1]) {
5539
+ if (typeof _this33.options.data[parts[0]] !== 'undefined' && _this33.options.data[parts[0]] !== parts[1]) {
5481
5540
  // remove the <if> tags
5482
5541
  removeAll = false;
5483
5542
  }
@@ -5770,7 +5829,7 @@ var WebsyUtils = {
5770
5829
 
5771
5830
  var WebsyTable = /*#__PURE__*/function () {
5772
5831
  function WebsyTable(elementId, options) {
5773
- var _this33 = this;
5832
+ var _this34 = this;
5774
5833
 
5775
5834
  _classCallCheck(this, WebsyTable);
5776
5835
 
@@ -5808,8 +5867,8 @@ var WebsyTable = /*#__PURE__*/function () {
5808
5867
  allowClear: false,
5809
5868
  disableSearch: true,
5810
5869
  onItemSelected: function onItemSelected(selectedItem) {
5811
- if (_this33.options.onChangePageSize) {
5812
- _this33.options.onChangePageSize(selectedItem.value);
5870
+ if (_this34.options.onChangePageSize) {
5871
+ _this34.options.onChangePageSize(selectedItem.value);
5813
5872
  }
5814
5873
  }
5815
5874
  });
@@ -5830,7 +5889,7 @@ var WebsyTable = /*#__PURE__*/function () {
5830
5889
  _createClass(WebsyTable, [{
5831
5890
  key: "appendRows",
5832
5891
  value: function appendRows(data) {
5833
- var _this34 = this;
5892
+ var _this35 = this;
5834
5893
 
5835
5894
  this.hideError();
5836
5895
  var bodyHTML = '';
@@ -5838,15 +5897,15 @@ var WebsyTable = /*#__PURE__*/function () {
5838
5897
  if (data) {
5839
5898
  bodyHTML += data.map(function (r, rowIndex) {
5840
5899
  return '<tr>' + r.map(function (c, i) {
5841
- if (_this34.options.columns[i].show !== false) {
5900
+ if (_this35.options.columns[i].show !== false) {
5842
5901
  var style = '';
5843
5902
 
5844
5903
  if (c.style) {
5845
5904
  style += c.style;
5846
5905
  }
5847
5906
 
5848
- if (_this34.options.columns[i].width) {
5849
- style += "width: ".concat(_this34.options.columns[i].width, "; ");
5907
+ if (_this35.options.columns[i].width) {
5908
+ style += "width: ".concat(_this35.options.columns[i].width, "; ");
5850
5909
  }
5851
5910
 
5852
5911
  if (c.backgroundColor) {
@@ -5861,18 +5920,18 @@ var WebsyTable = /*#__PURE__*/function () {
5861
5920
  style += "color: ".concat(c.color, "; ");
5862
5921
  }
5863
5922
 
5864
- if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5865
- return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5866
- } else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5867
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
5923
+ if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5924
+ return "\n <td \n data-row-index='".concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this35.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5925
+ } else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5926
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this35.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</td>\n ");
5868
5927
  } else {
5869
5928
  var info = c.value;
5870
5929
 
5871
- if (_this34.options.columns[i].showAsImage === true) {
5930
+ if (_this35.options.columns[i].showAsImage === true) {
5872
5931
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5873
5932
  }
5874
5933
 
5875
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5934
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5876
5935
  }
5877
5936
  }
5878
5937
  }).join('') + '</tr>';
@@ -6044,7 +6103,7 @@ var WebsyTable = /*#__PURE__*/function () {
6044
6103
  }, {
6045
6104
  key: "render",
6046
6105
  value: function render(data) {
6047
- var _this35 = this;
6106
+ var _this36 = this;
6048
6107
 
6049
6108
  if (!this.options.columns) {
6050
6109
  return;
@@ -6079,7 +6138,7 @@ var WebsyTable = /*#__PURE__*/function () {
6079
6138
  style += "width: ".concat(c.width || 'auto', ";");
6080
6139
  }
6081
6140
 
6082
- return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this35.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6141
+ return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this36.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6083
6142
  }
6084
6143
  }).join('') + '</tr>';
6085
6144
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6098,7 +6157,7 @@ var WebsyTable = /*#__PURE__*/function () {
6098
6157
 
6099
6158
  if (pagingEl) {
6100
6159
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6101
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6160
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6102
6161
  });
6103
6162
  var startIndex = 0;
6104
6163
 
@@ -6166,7 +6225,7 @@ var WebsyTable = /*#__PURE__*/function () {
6166
6225
 
6167
6226
  var WebsyTable2 = /*#__PURE__*/function () {
6168
6227
  function WebsyTable2(elementId, options) {
6169
- var _this36 = this;
6228
+ var _this37 = this;
6170
6229
 
6171
6230
  _classCallCheck(this, WebsyTable2);
6172
6231
 
@@ -6207,8 +6266,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
6207
6266
  allowClear: false,
6208
6267
  disableSearch: true,
6209
6268
  onItemSelected: function onItemSelected(selectedItem) {
6210
- if (_this36.options.onChangePageSize) {
6211
- _this36.options.onChangePageSize(selectedItem.value);
6269
+ if (_this37.options.onChangePageSize) {
6270
+ _this37.options.onChangePageSize(selectedItem.value);
6212
6271
  }
6213
6272
  }
6214
6273
  });
@@ -6232,7 +6291,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6232
6291
  _createClass(WebsyTable2, [{
6233
6292
  key: "appendRows",
6234
6293
  value: function appendRows(data) {
6235
- var _this37 = this;
6294
+ var _this38 = this;
6236
6295
 
6237
6296
  this.hideError();
6238
6297
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -6241,15 +6300,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
6241
6300
  if (data) {
6242
6301
  bodyHTML += data.map(function (r, rowIndex) {
6243
6302
  return '<tr>' + r.map(function (c, i) {
6244
- if (_this37.options.columns[i].show !== false) {
6245
- var style = "height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px;");
6303
+ if (_this38.options.columns[i].show !== false) {
6304
+ var style = "height: ".concat(_this38.options.cellSize, "px; line-height: ").concat(_this38.options.cellSize, "px;");
6246
6305
 
6247
6306
  if (c.style) {
6248
6307
  style += c.style;
6249
6308
  }
6250
6309
 
6251
- if (_this37.options.columns[i].width) {
6252
- style += "width: ".concat(_this37.options.columns[i].width, "; ");
6310
+ if (_this38.options.columns[i].width) {
6311
+ style += "width: ".concat(_this38.options.columns[i].width, "; ");
6253
6312
  }
6254
6313
 
6255
6314
  if (c.backgroundColor) {
@@ -6264,18 +6323,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
6264
6323
  style += "color: ".concat(c.color, "; ");
6265
6324
  }
6266
6325
 
6267
- if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6268
- return "\n <td \n data-row-index='".concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this37.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6269
- } else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6270
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this37.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</td>\n ");
6326
+ if (_this38.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6327
+ return "\n <td \n data-row-index='".concat(_this38.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this38.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this38.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this38.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6328
+ } else if ((_this38.options.columns[i].showAsNavigatorLink === true || _this38.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6329
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this38.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this38.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this38.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this38.options.columns[i].linkText || c.value, "</td>\n ");
6271
6330
  } else {
6272
6331
  var info = c.value;
6273
6332
 
6274
- if (_this37.options.columns[i].showAsImage === true) {
6333
+ if (_this38.options.columns[i].showAsImage === true) {
6275
6334
  c.value = "\n <img src='".concat(c.value, "'>\n ");
6276
6335
  }
6277
6336
 
6278
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
6337
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this38.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this38.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
6279
6338
  }
6280
6339
  }
6281
6340
  }).join('') + '</tr>';
@@ -6538,7 +6597,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6538
6597
  }, {
6539
6598
  key: "render",
6540
6599
  value: function render(data) {
6541
- var _this38 = this;
6600
+ var _this39 = this;
6542
6601
 
6543
6602
  if (!this.options.columns) {
6544
6603
  return;
@@ -6574,7 +6633,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6574
6633
  style += "width: ".concat(c.width || 'auto', "; ");
6575
6634
  }
6576
6635
 
6577
- return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6636
+ return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6578
6637
  }
6579
6638
  }).join('') + '</tr>';
6580
6639
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6585,7 +6644,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6585
6644
  var dropdownHTML = "";
6586
6645
  this.options.columns.forEach(function (c, i) {
6587
6646
  if (c.searchable && c.searchField) {
6588
- dropdownHTML += "\n <div id=\"".concat(_this38.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6647
+ dropdownHTML += "\n <div id=\"".concat(_this39.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6589
6648
  }
6590
6649
  });
6591
6650
  dropdownEl.innerHTML = dropdownHTML;
@@ -6607,7 +6666,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6607
6666
 
6608
6667
  if (pagingEl) {
6609
6668
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6610
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6669
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this39.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6611
6670
  });
6612
6671
  var startIndex = 0;
6613
6672
 
@@ -6698,7 +6757,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6698
6757
  }, {
6699
6758
  key: "getColumnParameters",
6700
6759
  value: function getColumnParameters(values) {
6701
- var _this39 = this;
6760
+ var _this40 = this;
6702
6761
 
6703
6762
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6704
6763
  tableEl.style.tableLayout = 'auto';
@@ -6706,10 +6765,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
6706
6765
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6707
6766
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6708
6767
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6709
- return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6768
+ return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this40.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6710
6769
  }).join('') + '</tr>';
6711
6770
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6712
- return "\n <td \n style='height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6771
+ return "\n <td \n style='height: ".concat(_this40.options.cellSize, "px; line-height: ").concat(_this40.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6713
6772
  }).join('') + '</tr>'; // get height of the first data cell
6714
6773
 
6715
6774
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6840,7 +6899,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6840
6899
  }, {
6841
6900
  key: "buildBodyHtml",
6842
6901
  value: function buildBodyHtml() {
6843
- var _this40 = this;
6902
+ var _this41 = this;
6844
6903
 
6845
6904
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6846
6905
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -6903,7 +6962,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6903
6962
  } // console.log('rowspan', cell.rowspan)
6904
6963
 
6905
6964
 
6906
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this40.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
6965
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
6907
6966
  // bodyHtml += `
6908
6967
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6909
6968
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -6913,11 +6972,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6913
6972
  bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n >");
6914
6973
 
6915
6974
  if (cell.expandable === true) {
6916
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this40.options.plusIcon, "</i>");
6975
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this41.options.plusIcon, "</i>");
6917
6976
  }
6918
6977
 
6919
6978
  if (cell.collapsable === true) {
6920
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this40.options.minusIcon, "</i>");
6979
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this41.options.minusIcon, "</i>");
6921
6980
  }
6922
6981
 
6923
6982
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
@@ -6942,7 +7001,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6942
7001
  }, {
6943
7002
  key: "buildHeaderHtml",
6944
7003
  value: function buildHeaderHtml() {
6945
- var _this41 = this;
7004
+ var _this42 = this;
6946
7005
 
6947
7006
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6948
7007
 
@@ -6962,7 +7021,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6962
7021
  }
6963
7022
 
6964
7023
  this.options.columns.forEach(function (row, rowIndex) {
6965
- if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
7024
+ if (useWidths === false && rowIndex !== _this42.options.columns.length - 1) {
6966
7025
  // if we're calculating the size we only want to render the last row of column headers
6967
7026
  return;
6968
7027
  }
@@ -6981,25 +7040,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
6981
7040
  style += col.style;
6982
7041
  }
6983
7042
 
6984
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
7043
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this42.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6985
7044
  // headerHtml += `
6986
7045
  // style='width: ${col.width || col.actualWidth}px'
6987
7046
  // width='${col.width || col.actualWidth}'
6988
7047
  // `
6989
7048
  // }
6990
7049
 
6991
- headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this41.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this41.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
7050
+ headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this42.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this42.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6992
7051
  });
6993
7052
  headerHtml += "</tr>";
6994
7053
  });
6995
7054
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6996
7055
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6997
7056
  if (c.searchable && c.isExternalSearch === true) {
6998
- var testEl = document.getElementById("".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i));
7057
+ var testEl = document.getElementById("".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i));
6999
7058
 
7000
7059
  if (!testEl) {
7001
7060
  var newE = document.createElement('div');
7002
- newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
7061
+ newE.id = "".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i);
7003
7062
  newE.className = 'websy-modal-dropdown';
7004
7063
  dropdownEl.appendChild(newE);
7005
7064
  }
@@ -7022,7 +7081,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7022
7081
  }, {
7023
7082
  key: "buildTotalHtml",
7024
7083
  value: function buildTotalHtml() {
7025
- var _this42 = this;
7084
+ var _this43 = this;
7026
7085
 
7027
7086
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7028
7087
 
@@ -7035,7 +7094,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7035
7094
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7036
7095
 
7037
7096
  if (useWidths === true) {
7038
- totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
7097
+ totalHtml += "\n style='width: ".concat(_this43.options.columns[_this43.options.columns.length - 1][colIndex].width || _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
7039
7098
  }
7040
7099
 
7041
7100
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
@@ -7046,7 +7105,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7046
7105
  }, {
7047
7106
  key: "calculateSizes",
7048
7107
  value: function calculateSizes() {
7049
- var _this43 = this;
7108
+ var _this44 = this;
7050
7109
 
7051
7110
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7052
7111
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
@@ -7095,32 +7154,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
7095
7154
  rows.forEach(function (row, rowIndex) {
7096
7155
  Array.from(row.children).forEach(function (col, colIndex) {
7097
7156
  var colSize = col.getBoundingClientRect();
7098
- _this43.sizes.cellHeight = colSize.height;
7157
+ _this44.sizes.cellHeight = colSize.height;
7099
7158
 
7100
- if (_this43.options.columns[_this43.options.columns.length - 1][colIndex]) {
7101
- if (!_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth) {
7102
- _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = 0;
7159
+ if (_this44.options.columns[_this44.options.columns.length - 1][colIndex]) {
7160
+ if (!_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth) {
7161
+ _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth = 0;
7103
7162
  }
7104
7163
 
7105
- _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
7106
- _this43.options.columns[_this43.options.columns.length - 1][colIndex].cellHeight = colSize.height;
7164
+ _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
7165
+ _this44.options.columns[_this44.options.columns.length - 1][colIndex].cellHeight = colSize.height;
7107
7166
 
7108
- if (colIndex >= _this43.pinnedColumns) {
7109
- firstNonPinnedColumnWidth = _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth;
7167
+ if (colIndex >= _this44.pinnedColumns) {
7168
+ firstNonPinnedColumnWidth = _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth;
7110
7169
  }
7111
7170
  }
7112
7171
  });
7113
7172
  });
7114
7173
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
7115
- if (colIndex < _this43.pinnedColumns) {
7116
- _this43.sizes.scrollableWidth -= col.actualWidth;
7174
+ if (colIndex < _this44.pinnedColumns) {
7175
+ _this44.sizes.scrollableWidth -= col.actualWidth;
7117
7176
  }
7118
7177
  });
7119
7178
  this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
7120
7179
  return a + (b.width || b.actualWidth);
7121
7180
  }, 0);
7122
7181
  this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
7123
- return i >= _this43.pinnedColumns;
7182
+ return i >= _this44.pinnedColumns;
7124
7183
  }).reduce(function (a, b) {
7125
7184
  return a + (b.width || b.actualWidth);
7126
7185
  }, 0);
@@ -7141,10 +7200,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7141
7200
  c.actualWidth += equalWidth; // }
7142
7201
  // }
7143
7202
 
7144
- _this43.sizes.totalWidth += c.width || c.actualWidth;
7203
+ _this44.sizes.totalWidth += c.width || c.actualWidth;
7145
7204
 
7146
- if (i < _this43.pinnedColumns) {
7147
- _this43.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7205
+ if (i < _this44.pinnedColumns) {
7206
+ _this44.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7148
7207
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
7149
7208
 
7150
7209
  });
@@ -7207,7 +7266,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7207
7266
  }, {
7208
7267
  key: "createSample",
7209
7268
  value: function createSample(data) {
7210
- var _this44 = this;
7269
+ var _this45 = this;
7211
7270
 
7212
7271
  var output = [];
7213
7272
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
@@ -7219,7 +7278,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7219
7278
  var longest = '';
7220
7279
 
7221
7280
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
7222
- if (data[i].length === _this44.options.columns[_this44.options.columns.length - 1].length) {
7281
+ if (data[i].length === _this45.options.columns[_this45.options.columns.length - 1].length) {
7223
7282
  if (longest.length < data[i][colIndex].value.length) {
7224
7283
  longest = data[i][colIndex].value;
7225
7284
  }
@@ -7647,7 +7706,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7647
7706
 
7648
7707
  var WebsyChart = /*#__PURE__*/function () {
7649
7708
  function WebsyChart(elementId, options) {
7650
- var _this45 = this;
7709
+ var _this46 = this;
7651
7710
 
7652
7711
  _classCallCheck(this, WebsyChart);
7653
7712
 
@@ -7684,6 +7743,7 @@ var WebsyChart = /*#__PURE__*/function () {
7684
7743
  tooltipWidth: 200,
7685
7744
  brushHeight: 50,
7686
7745
  minBandWidth: 30,
7746
+ maxBandWidth: 100,
7687
7747
  allowUnevenBands: true
7688
7748
  };
7689
7749
  this.elementId = elementId;
@@ -7706,7 +7766,7 @@ var WebsyChart = /*#__PURE__*/function () {
7706
7766
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7707
7767
  var xAxis = 'bottom';
7708
7768
 
7709
- if (_this45.options.orientation === 'horizontal') {
7769
+ if (_this46.options.orientation === 'horizontal') {
7710
7770
  xAxis = 'left';
7711
7771
  }
7712
7772
 
@@ -7717,39 +7777,37 @@ var WebsyChart = /*#__PURE__*/function () {
7717
7777
  xAxis += 'Axis';
7718
7778
  var output;
7719
7779
 
7720
- var width = _this45.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7780
+ var width = _this46.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
7721
7781
 
7722
- if (_this45.customBottomRange) {
7723
- for (var index = 0; index < _this45.customBottomRange.length; index++) {
7724
- if (input > _this45.customBottomRange[index]) {
7725
- if (_this45.customBottomRange[index + 1]) {
7726
- if (input < _this45.customBottomRange[index + 1]) {
7727
- output = index;
7728
- break;
7729
- }
7730
- } else {
7782
+
7783
+ for (var index = 0; index < _this46.customBottomRange.length; index++) {
7784
+ if (input > _this46.customBottomRange[index]) {
7785
+ if (_this46.customBottomRange[index + 1]) {
7786
+ if (input < _this46.customBottomRange[index + 1]) {
7731
7787
  output = index;
7732
7788
  break;
7733
7789
  }
7734
- }
7735
- }
7736
- } else {
7737
- var domain = _toConsumableArray(_this45[xAxis].domain());
7738
-
7739
- if (_this45.options.orientation === 'horizontal') {
7740
- domain = domain.reverse();
7741
- }
7742
-
7743
- for (var j = 0; j < domain.length; j++) {
7744
- var breakA = _this45[xAxis](domain[j]) - width / 2;
7745
- var breakB = breakA + width;
7746
-
7747
- if (input > breakA && input <= breakB) {
7748
- output = j;
7790
+ } else {
7791
+ output = index;
7749
7792
  break;
7750
7793
  }
7751
7794
  }
7752
- }
7795
+ } // }
7796
+ // else {
7797
+ // let domain = [...this[xAxis].domain()]
7798
+ // if (this.options.orientation === 'horizontal') {
7799
+ // domain = domain.reverse()
7800
+ // }
7801
+ // for (let j = 0; j < domain.length; j++) {
7802
+ // let breakA = this[xAxis](domain[j]) - (width / 2)
7803
+ // let breakB = breakA + width
7804
+ // if (input > breakA && input <= breakB) {
7805
+ // output = j
7806
+ // break
7807
+ // }
7808
+ // }
7809
+ // }
7810
+
7753
7811
 
7754
7812
  return output;
7755
7813
  };
@@ -7758,64 +7816,97 @@ var WebsyChart = /*#__PURE__*/function () {
7758
7816
 
7759
7817
  this.brushed = function (event) {
7760
7818
  console.log('brushing', event);
7761
- that.brushedDomain = [];
7762
- var xAxis = 'bottom';
7763
- var xAxisCaps = 'Bottom';
7819
+ var newX = that.options.margin.left + that.options.margin.axisLeft + (1 - event.selection[0] / (that.plotWidth / (that.widthForCalc + that.totalBandPadding)));
7764
7820
 
7765
- if (that.options.orientation === 'horizontal') {
7766
- xAxis = 'left';
7767
- xAxisCaps = 'Left';
7821
+ if (that.plotArea) {
7822
+ that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7768
7823
  }
7769
7824
 
7770
- if (!that["".concat(xAxis, "Axis")]) {
7771
- return;
7825
+ if (that.areaLayer) {
7826
+ that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7772
7827
  }
7773
7828
 
7774
- if (!that["".concat(xAxis, "Axis")].invert) {
7775
- that["".concat(xAxis, "Axis")].invert = that.invertOverride;
7829
+ if (that.lineLayer) {
7830
+ that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7776
7831
  }
7777
7832
 
7778
- var s = event.selection || that["".concat(xAxis, "Axis")].range();
7779
-
7780
- if (!event.selection || event.selection.length === 0) {
7781
- that.brushLayer.select('.brush').call(that.brush).call(that.brush.move, s);
7782
- return;
7833
+ if (that.barLayer) {
7834
+ that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7783
7835
  }
7784
7836
 
7785
- if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
7786
- that.brushedDomain = s.map(that["".concat(xAxis, "BrushAxis")].invert, that[["".concat(xAxis, "Axis")]]);
7787
- } else {
7788
- var startEndOrdinal = s.map(function (a, b) {
7789
- return that.bottomAxis.invert(a, b, true);
7790
- }, that.bottomBrushAxis);
7791
-
7792
- if (startEndOrdinal && startEndOrdinal.length === 2 && typeof startEndOrdinal[0] !== 'undefined' && typeof startEndOrdinal[1] !== 'undefined') {
7793
- var domain = [];
7794
-
7795
- var domainValues = _toConsumableArray(that["".concat(xAxis, "BrushAxis")].domain());
7837
+ if (that.labelLayer) {
7838
+ that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7839
+ }
7796
7840
 
7797
- for (var i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
7798
- // domain.push(that.xRange[i])
7799
- that.brushedDomain.push(domainValues[i]);
7800
- }
7801
- }
7841
+ if (that.symbolLayer) {
7842
+ that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7802
7843
  }
7803
7844
 
7804
- if (that.brushedDomain.length > 0) {
7805
- that["".concat(xAxis, "Axis")].domain(that.brushedDomain);
7806
- that["".concat(xAxis, "AxisLayer")].call(d3["axis".concat(xAxisCaps)](that["".concat(xAxis, "Axis")]));
7845
+ if (that.refLineLayer) {
7846
+ that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7807
7847
  }
7808
7848
 
7809
- if (that.leftAxis && that.bottomAxis) {
7810
- that.renderComponents();
7849
+ if (that.bottomAxisLayer) {
7850
+ that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop + that.plotHeight, ")"));
7851
+ } // that.brushedDomain = []
7852
+ // let xAxis = 'bottom'
7853
+ // let xAxisCaps = 'Bottom'
7854
+ // if (that.options.orientation === 'horizontal') {
7855
+ // xAxis = 'left'
7856
+ // xAxisCaps = 'Left'
7857
+ // }
7858
+ // if (!that[`${xAxis}Axis`]) {
7859
+ // return
7860
+ // }
7861
+ // if (!that[`${xAxis}Axis`].invert) {
7862
+ // that[`${xAxis}Axis`].invert = that.invertOverride
7863
+ // }
7864
+ // let s = event.selection || that[`${xAxis}Axis`].range()
7865
+ // if (!event.selection || event.selection.length === 0) {
7866
+ // that.brushLayer
7867
+ // .select('.brush')
7868
+ // .call(that.brush)
7869
+ // .call(that.brush.move, s)
7870
+ // return
7871
+ // }
7872
+ // if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
7873
+ // that.brushedDomain = s.map(that[`${xAxis}BrushAxis`].invert, that[[`${xAxis}Axis`]])
7874
+ // }
7875
+ // else {
7876
+ // let startEndOrdinal = s.map((a, b) => that.bottomAxis.invert(a, b, true), that.bottomBrushAxis)
7877
+ // if (
7878
+ // startEndOrdinal &&
7879
+ // startEndOrdinal.length === 2 &&
7880
+ // typeof startEndOrdinal[0] !== 'undefined' &&
7881
+ // typeof startEndOrdinal[1] !== 'undefined'
7882
+ // ) {
7883
+ // let domain = []
7884
+ // let domainValues = [...that[`${xAxis}BrushAxis`].domain()]
7885
+ // for (let i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
7886
+ // // domain.push(that.xRange[i])
7887
+ // that.brushedDomain.push(domainValues[i])
7888
+ // }
7889
+ // }
7890
+ // }
7891
+ // if (that.brushedDomain.length > 0) {
7892
+ // that[`${xAxis}Axis`].domain(that.brushedDomain)
7893
+ // that[`${xAxis}AxisLayer`].call(
7894
+ // d3[`axis${xAxisCaps}`](that[`${xAxis}Axis`])
7895
+ // )
7896
+ // }
7897
+ // if (that.leftAxis && that.bottomAxis) {
7898
+ // that.renderComponents()
7899
+ // if (that.options.orientation === 'vertical') {
7900
+ // // that.bottomAxisLayer.call(that.bAxisFunc)
7901
+ // if (that.options.data.bottom.rotate) {
7902
+ // that.bottomAxisLayer.selectAll('text')
7903
+ // .attr('transform', `rotate(${((that.options.data.bottom && that.options.data.bottom.rotate) || 0)})`)
7904
+ // .style('text-anchor', `${((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? 'middle' : 'end'}`)
7905
+ // .style('transform-origin', ((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? '0 0' : `0 ${((that.options.data.bottom && that.options.data.bottom.fontSize) || that.options.fontSize)}px`)
7906
+ // }
7907
+ // }
7908
+ // }
7811
7909
 
7812
- if (that.options.orientation === 'vertical') {
7813
- // that.bottomAxisLayer.call(that.bAxisFunc)
7814
- if (that.options.data.bottom.rotate) {
7815
- that.bottomAxisLayer.selectAll('text').attr('transform', "rotate(".concat(that.options.data.bottom && that.options.data.bottom.rotate || 0, ")")).style('text-anchor', "".concat((that.options.data.bottom && that.options.data.bottom.rotate || 0) === 0 ? 'middle' : 'end')).style('transform-origin', (that.options.data.bottom && that.options.data.bottom.rotate || 0) === 0 ? '0 0' : "0 ".concat(that.options.data.bottom && that.options.data.bottom.fontSize || that.options.fontSize, "px"));
7816
- }
7817
- }
7818
- }
7819
7910
  };
7820
7911
 
7821
7912
  var el = document.getElementById(this.elementId);
@@ -7930,10 +8021,10 @@ var WebsyChart = /*#__PURE__*/function () {
7930
8021
  }, {
7931
8022
  key: "handleEventMouseMove",
7932
8023
  value: function handleEventMouseMove(event, d) {
7933
- var _this46 = this;
8024
+ var _this47 = this;
7934
8025
 
7935
8026
  var bisectDate = d3.bisector(function (d) {
7936
- return _this46.parseX(d.x.value);
8027
+ return _this47.parseX(d.x.value);
7937
8028
  }).left;
7938
8029
 
7939
8030
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -7972,12 +8063,12 @@ var WebsyChart = /*#__PURE__*/function () {
7972
8063
  }
7973
8064
 
7974
8065
  this.options.data.series.forEach(function (s) {
7975
- if (_this46.options.data[xData].scale !== 'Time') {
7976
- if (_this46.customBottomRange && _this46.customBottomRange.length > 0) {
7977
- xPoint = _this46.customBottomRange[x0] + (_this46.customBottomRange[x0 + 1] - _this46.customBottomRange[x0]) / 2;
7978
- } else {
7979
- xPoint = _this46[xAxis](_this46.parseX(xLabel));
7980
- }
8066
+ if (_this47.options.data[xData].scale !== 'Time') {
8067
+ // if (this.customBottomRange && this.customBottomRange.length > 0) {
8068
+ xPoint = _this47.customBottomRange[x0] + (_this47.customBottomRange[x0 + 1] - _this47.customBottomRange[x0]) / 2; // }
8069
+ // else {
8070
+ // xPoint = this[xAxis](this.parseX(xLabel))
8071
+ // }
7981
8072
 
7982
8073
  s.data.forEach(function (d) {
7983
8074
  if (d.x.value === xLabel) {
@@ -7997,13 +8088,13 @@ var WebsyChart = /*#__PURE__*/function () {
7997
8088
  var pointA = s.data[index - 1];
7998
8089
  var pointB = s.data[index];
7999
8090
 
8000
- if (_this46.options.orientation === 'horizontal') {
8091
+ if (_this47.options.orientation === 'horizontal') {
8001
8092
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
8002
8093
  pointB = _toConsumableArray(s.data).reverse()[index];
8003
8094
  }
8004
8095
 
8005
8096
  if (pointA && !pointB) {
8006
- xPoint = _this46[xAxis](_this46.parseX(pointA.x.value));
8097
+ xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
8007
8098
  tooltipTitle = pointA.x.value;
8008
8099
 
8009
8100
  if (!pointA.y.color) {
@@ -8013,12 +8104,12 @@ var WebsyChart = /*#__PURE__*/function () {
8013
8104
  tooltipData.push(pointA.y);
8014
8105
 
8015
8106
  if (typeof pointA.x.value.getTime !== 'undefined') {
8016
- tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
8107
+ tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointA.x.value);
8017
8108
  }
8018
8109
  }
8019
8110
 
8020
8111
  if (pointB && !pointA) {
8021
- xPoint = _this46[xAxis](_this46.parseX(pointB.x.value));
8112
+ xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
8022
8113
  tooltipTitle = pointB.x.value;
8023
8114
 
8024
8115
  if (!pointB.y.color) {
@@ -8028,14 +8119,14 @@ var WebsyChart = /*#__PURE__*/function () {
8028
8119
  tooltipData.push(pointB.y);
8029
8120
 
8030
8121
  if (typeof pointB.x.value.getTime !== 'undefined') {
8031
- tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
8122
+ tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
8032
8123
  }
8033
8124
  }
8034
8125
 
8035
8126
  if (pointA && pointB) {
8036
- var d0 = _this46[xAxis](_this46.parseX(pointA.x.value));
8127
+ var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
8037
8128
 
8038
- var d1 = _this46[xAxis](_this46.parseX(pointB.x.value));
8129
+ var d1 = _this47[xAxis](_this47.parseX(pointB.x.value));
8039
8130
 
8040
8131
  var mid = Math.abs(d0 - d1) / 2;
8041
8132
 
@@ -8044,7 +8135,7 @@ var WebsyChart = /*#__PURE__*/function () {
8044
8135
  tooltipTitle = pointB.x.value;
8045
8136
 
8046
8137
  if (typeof pointB.x.value.getTime !== 'undefined') {
8047
- tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
8138
+ tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
8048
8139
  }
8049
8140
 
8050
8141
  if (!pointB.y.color) {
@@ -8057,7 +8148,7 @@ var WebsyChart = /*#__PURE__*/function () {
8057
8148
  tooltipTitle = pointA.x.value;
8058
8149
 
8059
8150
  if (typeof pointB.x.value.getTime !== 'undefined') {
8060
- tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
8151
+ tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
8061
8152
  }
8062
8153
 
8063
8154
  if (!pointA.y.color) {
@@ -8121,6 +8212,12 @@ var WebsyChart = /*#__PURE__*/function () {
8121
8212
  }
8122
8213
 
8123
8214
  this.tooltip.setHeight(this.plotHeight);
8215
+
8216
+ if (isNaN(posOptions.left)) {
8217
+ this.tooltip.hide();
8218
+ return;
8219
+ }
8220
+
8124
8221
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions); // }
8125
8222
  // else {
8126
8223
  // xPoint = x0
@@ -8151,20 +8248,22 @@ var WebsyChart = /*#__PURE__*/function () {
8151
8248
  /* global d3 WebsyDesigns */
8152
8249
  this.defs = this.svg.append('defs');
8153
8250
  this.clip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_clip")).append('rect');
8251
+ this.xAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_xAxisClip")).append('rect');
8154
8252
  this.brushClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_brushclip")).append('rect');
8155
8253
  this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer');
8156
8254
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer');
8157
- this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer');
8255
+ this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_xAxisClip)")).append('g');
8158
8256
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer');
8159
8257
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer');
8160
8258
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer');
8161
- this.plotArea = this.svg.append('g').attr('class', 'plot-layer');
8162
- this.areaLayer = this.svg.append('g').attr('class', 'area-layer');
8163
- this.lineLayer = this.svg.append('g').attr('class', 'line-layer');
8164
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer');
8165
- this.labelLayer = this.svg.append('g').attr('class', 'label-layer');
8166
- this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer');
8167
- this.refLineLayer = this.svg.append('g').attr('class', 'refline-layer');
8259
+ this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
8260
+ this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
8261
+ this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
8262
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g'); // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
8263
+
8264
+ this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
8265
+ this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
8266
+ this.refLineLayer = this.svg.append('g').attr('class', 'refline-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
8168
8267
  this.trackingLineLayer = this.svg.append('g').attr('class', 'tracking-line-layer');
8169
8268
  this.trackingLineLayer.append('line').attr('class', 'tracking-line');
8170
8269
  this.tooltip = new WebsyDesigns.WebsyChartTooltip(this.svg);
@@ -8182,7 +8281,7 @@ var WebsyChart = /*#__PURE__*/function () {
8182
8281
  }, {
8183
8282
  key: "render",
8184
8283
  value: function render(options) {
8185
- var _this47 = this;
8284
+ var _this48 = this;
8186
8285
 
8187
8286
  /* global d3 options WebsyUtils */
8188
8287
  if (typeof options !== 'undefined') {
@@ -8257,7 +8356,7 @@ var WebsyChart = /*#__PURE__*/function () {
8257
8356
  this.options.data.series.map(function (s, i) {
8258
8357
  return {
8259
8358
  value: s.label || s.key,
8260
- color: s.color || _this47.options.colors[i % _this47.options.colors.length]
8359
+ color: s.color || _this48.options.colors[i % _this48.options.colors.length]
8261
8360
  };
8262
8361
  });
8263
8362
  }
@@ -8456,46 +8555,123 @@ var WebsyChart = /*#__PURE__*/function () {
8456
8555
  if (this.options.axis.hideBottom === true) {
8457
8556
  this.options.margin.axisBottom = 0;
8458
8557
  }
8459
- } // Define the plot size
8558
+ } // At some point before this we need to add in logic to make space for any data point labels
8559
+ // Define the plot size
8460
8560
 
8461
8561
 
8462
8562
  this.plotWidth = this.width - this.options.margin.legendLeft - this.options.margin.legendRight - this.options.margin.left - this.options.margin.right - this.options.margin.axisLeft - this.options.margin.axisRight;
8463
8563
  this.plotHeight = this.height - this.options.margin.legendTop - this.options.margin.legendBottom - this.options.margin.top - this.options.margin.bottom - this.options.margin.axisBottom - this.options.margin.axisTop;
8464
8564
  this.brushNeeded = false;
8565
+ var proposedBandWidth; // distance between x axis data points.
8566
+
8567
+ var maxBandWidthFits = false; // Check to see if all bars at the max allowed width will fit
8568
+
8569
+ this.bandPadding = 0;
8570
+ this.totalBandPadding = 0;
8571
+ this.brushBandPadding = 0;
8572
+ this.totalBrushBandPadding = 0;
8573
+ var noOfPoints = 0;
8574
+ var noOfGroups = 0;
8575
+ var plotable = 0;
8576
+
8577
+ if (this.options.maxBandWidth) {
8578
+ if (this.options.orientation === 'horizontal') {
8579
+ this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
8580
+ if (typeof b.valueCount === 'undefined') {
8581
+ return a + 1;
8582
+ }
8465
8583
 
8466
- if (this.options.orientation === 'vertical') {
8467
- this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
8468
- if (typeof b.valueCount === 'undefined') {
8469
- return a + 1;
8584
+ return a + b.valueCount;
8585
+ }, 0);
8586
+
8587
+ if (this.options.data.left.padding) {
8588
+ this.totalBandPadding = this.plotHeight * this.options.data.left.padding;
8589
+ this.bandPadding = this.totalBandPadding / this.options.data.left.data.length;
8590
+ this.totalBrushBandPadding = this.plotHeight * this.options.data.left.padding;
8591
+ this.brushBandPadding = this.totalBandPadding / this.options.data.left.data.length;
8470
8592
  }
8471
8593
 
8472
- return a + b.valueCount;
8473
- }, 0);
8594
+ plotable = this.plotHeight - this.totalBandPadding;
8595
+ noOfPoints = this.options.grouping === 'grouped' ? this.options.data.left.totalValueCount : this.options.data.left.data.length;
8596
+ noOfGroups = this.options.data.left.data.length;
8597
+ } else {
8598
+ this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
8599
+ if (typeof b.valueCount === 'undefined') {
8600
+ return a + 1;
8601
+ }
8602
+
8603
+ return a + b.valueCount;
8604
+ }, 0);
8474
8605
 
8475
- if (this.options.maxBandWidth) {
8476
- this.plotWidth = Math.min(this.plotWidth, this.options.data.bottom.totalValueCount * this.options.maxBandWidth);
8477
- } // some if to check if brushing is needed
8606
+ if (this.options.data.bottom.padding) {
8607
+ this.totalBandPadding = this.plotWidth * this.options.data.bottom.padding;
8608
+ this.bandPadding = this.totalBandPadding / this.options.data.bottom.data.length;
8609
+ this.totalBrushBandPadding = this.plotWidth * this.options.data.bottom.padding;
8610
+ this.brushBandPadding = this.totalBandPadding / this.options.data.bottom.data.length;
8611
+ }
8478
8612
 
8613
+ plotable = this.plotWidth - this.totalBandPadding;
8614
+ noOfPoints = this.options.grouping === 'grouped' ? this.options.data.bottom.totalValueCount : this.options.data.bottom.data.length;
8615
+ noOfGroups = this.options.data.bottom.data.length;
8616
+ }
8479
8617
 
8480
- if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
8481
- this.brushNeeded = true;
8482
- this.plotHeight -= this.options.brushHeight;
8618
+ if (plotable / noOfPoints > this.options.maxBandWidth) {
8619
+ maxBandWidthFits = true;
8620
+ proposedBandWidth = this.options.maxBandWidth;
8483
8621
  }
8484
- } else {
8485
- // some if to check if brushing is needed
8486
- this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
8487
- if (typeof b.valueCount === 'undefined') {
8488
- return a + 1;
8489
- }
8490
8622
 
8491
- return a + b.valueCount;
8492
- }, 0);
8623
+ if (!maxBandWidthFits) {
8624
+ // Check to see if all bars at the min allowed width will fit
8625
+ if (plotable / noOfPoints < this.options.minBandWidth) {
8626
+ this.brushNeeded = true;
8627
+ proposedBandWidth = this.options.minBandWidth;
8493
8628
 
8494
- if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
8495
- this.brushNeeded = true;
8496
- this.plotWidth -= this.options.brushHeight;
8629
+ if (this.options.orientation === 'horizontal') {
8630
+ this.plotWidth -= this.options.brushHeight;
8631
+ } else {
8632
+ this.plotHeight -= this.options.brushHeight;
8633
+ }
8634
+ } else {
8635
+ proposedBandWidth = plotable / noOfPoints;
8636
+ }
8497
8637
  }
8498
- } // Translate the layers
8638
+ } // if (this.options.minBandWidth) {
8639
+ // this.widthForCalc = this.options.data.bottom.totalValueCount * this.options.minBandWidth
8640
+ // if (this.options.data.bottom.padding) {
8641
+ // this.widthForCalc += (this.options.minBandWidth * this.options.data.bottom.padding) * this.options.data.bottom.totalValueCount
8642
+ // this.widthForCalc += (this.options.data.bottom.data.length * this.options.groupPadding * 2)
8643
+ // }
8644
+ // }
8645
+ // if (this.options.orientation === 'vertical') {
8646
+ // this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce((a, b) => {
8647
+ // if (typeof b.valueCount === 'undefined') {
8648
+ // return a + 1
8649
+ // }
8650
+ // return a + b.valueCount
8651
+ // }, 0)
8652
+ // if (this.options.maxBandWidth) {
8653
+ // this.plotWidth = Math.min(this.plotWidth, (this.options.data.bottom.totalValueCount) * this.options.maxBandWidth)
8654
+ // }
8655
+ // // some if to check if brushing is needed
8656
+ // if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
8657
+ // this.brushNeeded = true
8658
+ // this.plotHeight -= this.options.brushHeight
8659
+ // }
8660
+ // }
8661
+ // else {
8662
+ // // some if to check if brushing is needed
8663
+ // this.options.data.left.totalValueCount = this.options.data.left.data.reduce((a, b) => {
8664
+ // if (typeof b.valueCount === 'undefined') {
8665
+ // return a + 1
8666
+ // }
8667
+ // return a + b.valueCount
8668
+ // }, 0)
8669
+ // if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
8670
+ // this.brushNeeded = true
8671
+ // this.plotWidth -= this.options.brushHeight
8672
+ // }
8673
+ // }
8674
+ // Translate the layers
8499
8675
 
8500
8676
 
8501
8677
  this.leftAxisLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
@@ -8513,50 +8689,97 @@ var WebsyChart = /*#__PURE__*/function () {
8513
8689
  this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8514
8690
  this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8515
8691
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")"));
8692
+ this.clip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.plotWidth).attr('height', this.plotHeight);
8693
+ this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft).attr('height', longestBottomBounds.height + 10);
8516
8694
  this.brushClip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")")).attr('width', this.plotWidth).attr('height', this.options.brushHeight);
8517
8695
  this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8518
8696
  var that = this;
8519
8697
  this.eventLayer.attr('x', 0).attr('y', 0).attr('width', this.plotWidth).attr('height', this.plotHeight).attr('fill-opacity', '0'); // this.tooltip.transform(this.options.margin.left + this.options.margin.axisLeft, this.options.margin.top + this.options.margin.axisTop)
8520
8698
  // Configure the bottom axis
8521
8699
 
8522
- var bottomDomain = this.createDomain('bottom');
8523
- var bottomBrushDomain = this.createDomain('bottom', true);
8700
+ var bottomDomain = this.createDomain('bottom'); // let bottomBrushDomain = this.createDomain('bottom', true)
8701
+
8702
+ var bottomBrushDomain = this.createDomain('bottom');
8524
8703
  var bottomRange = [0, this.plotWidth];
8704
+ var bottomBrushRange = [0, this.plotWidth];
8705
+ var leftRange = [this.plotHeight, 0];
8706
+ var leftBrushRange = [this.options.brushHeight, 0];
8707
+
8708
+ if (this.options.orientation === 'horizontal') {
8709
+ leftBrushRange = [this.plotHeight, 0];
8710
+ }
8711
+
8712
+ this.widthForCalc = proposedBandWidth * noOfPoints; // + totalPadding
8713
+
8525
8714
  this.customBottomRange = [];
8715
+ this.customBottomDetailRange = [];
8716
+ this.customBottomBrushRange = [];
8717
+ this.customLeftRange = [];
8718
+ this.customLeftDetailRange = [];
8719
+ this.customLeftBrushRange = []; // if (this.options.allowUnevenBands === true) {
8720
+ // always allow uneven bands
8526
8721
 
8527
- if (this.options.allowUnevenBands === true) {
8528
- if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].valueCount && this.options.data.bottom.scale === 'Ordinal') {
8529
- var acc = 0;
8530
- this.customBottomRange = [0].concat(_toConsumableArray(this.options.data.bottom.data.map(function (d) {
8531
- acc += d.valueCount;
8532
- return _this47.plotWidth / _this47.options.data.bottom.totalValueCount * acc;
8533
- })));
8534
- }
8722
+ var customRangeSide = 'Bottom';
8723
+ var customRangeSideLC = 'bottom';
8724
+
8725
+ if (this.options.orientation === 'horizontal') {
8726
+ customRangeSide = 'Left';
8727
+ customRangeSideLC = 'left';
8535
8728
  }
8536
8729
 
8537
- this.options.data.bottom.step = this.plotWidth / this.options.data.bottom.totalValueCount;
8538
- this.options.data.bottom.bandWidth = this.options.data.bottom.step;
8730
+ if (this.options.data[customRangeSideLC].data && this.options.data[customRangeSideLC].data[0] && (this.options.data[customRangeSideLC].data[0].valueCount || 1) && this.options.data[customRangeSideLC].scale === 'Ordinal') {
8731
+ var acc = 0;
8732
+ this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8733
+ var adjustment = _this48.bandPadding * index + _this48.bandPadding; // if (this.options.data.bottom.padding) {
8734
+ // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8735
+ // }
8539
8736
 
8540
- if (this.options.data.bottom.padding) {
8541
- this.totalPadding = this.plotWidth * this.options.data.bottom.padding;
8542
- var rangeLength = bottomDomain.length;
8737
+ var start = _this48.widthForCalc / noOfPoints * acc;
8543
8738
 
8544
- if (this.customBottomRange.length > 0) {
8545
- rangeLength = this.customBottomRange.length;
8546
- }
8739
+ for (var i = 0; i < (d.valueCount || 1); i++) {
8740
+ var pos = i * proposedBandWidth;
8741
+
8742
+ _this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8743
+ }
8744
+
8745
+ acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8746
+ var end = _this48.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8547
8747
 
8548
- this.bandPadding = this.totalPadding / rangeLength / 2;
8549
- this.options.data.bottom.bandWidth = (this.plotWidth - this.totalPadding) / this.options.data.bottom.totalValueCount;
8748
+ return end + adjustment;
8749
+ })));
8750
+ acc = 0;
8751
+ this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8752
+ var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
8753
+ acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8754
+ return (_this48.options.orientation === 'vertical' ? _this48.plotWidth : _this48.plotHeight) / noOfPoints * acc;
8755
+ })));
8756
+ } // }
8757
+
8758
+
8759
+ var rangeLength = bottomDomain.length;
8760
+ this.options.data.bottomBrush = {};
8761
+ this.options.data.leftBrush = {};
8762
+
8763
+ if (this.options.orientation === 'vertical') {
8764
+ this.options.data.bottom.bandWidth = proposedBandWidth;
8765
+ this.options.data.bottomBrush.bandWidth = (this.plotWidth - this.totalBandPadding) / noOfPoints;
8766
+ } else {
8767
+ this.options.data.left.bandWidth = proposedBandWidth;
8768
+ this.options.data.leftBrush.bandWidth = (this.plotHeight - this.totalBandPadding) / noOfPoints;
8550
8769
  }
8551
8770
 
8552
- if (this.options.grouping === 'grouped' && this.options.data.series.length > 1) {
8553
- this.options.data.bottom.bandWidth = this.options.data.bottom.bandWidth - this.options.groupPadding * 2;
8771
+ this.brushBandPadding = this.totalBandPadding / noOfGroups;
8772
+
8773
+ if (this.options.orientation === 'vertical') {
8774
+ bottomRange = [0, this.widthForCalc + this.totalBandPadding];
8775
+ } else {
8776
+ leftRange = [this.widthForCalc + this.totalBandPadding, 0];
8554
8777
  }
8555
8778
 
8556
- this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range(bottomRange);
8779
+ this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Ordinal')]().domain(bottomDomain).range(bottomRange);
8557
8780
 
8558
8781
  if (!this.brushInitialized) {
8559
- this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range(bottomRange);
8782
+ this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Ordinal')]().domain(bottomBrushDomain).range(bottomBrushRange);
8560
8783
  }
8561
8784
 
8562
8785
  if (this.bottomAxis.nice) {// this.bottomAxis.nice()
@@ -8577,38 +8800,78 @@ var WebsyChart = /*#__PURE__*/function () {
8577
8800
  brushLength = this.options.brushHeight;
8578
8801
  brushThickness = this.plotHeight;
8579
8802
  } else {
8580
- if (brushLength / bottomDomain.length < this.options.minBandWidth) {
8581
- brushEnd = this.plotWidth * (this.plotWidth / this.options.minBandWidth / bottomDomain.length);
8803
+ if (this.brushNeeded) {
8804
+ brushEnd = this.plotWidth * (this.plotWidth / (this.widthForCalc + this.totalBandPadding));
8582
8805
  }
8583
8806
  }
8584
8807
 
8585
- this.brush = d3[brushMethod]().extent([[0, 0], [brushLength, brushThickness]]).on('brush end', this.brushed);
8586
-
8587
- var brushResizePath = function brushResizePath(d) {
8588
- var e = +(d.type === 'e');
8589
- var x = e ? 1 : -1;
8590
- var y = _this47.options.brushHeight;
8591
- return 'M' + 0.5 * x + ',' + y + 'A6,6 0 0 ' + e + ' ' + 6.5 * x + ',' + (y + 6) + 'V' + (2 * y - 6) + 'A6,6 0 0 ' + e + ' ' + 0.5 * x + ',' + 2 * y + 'Z' + 'M' + 2.5 * x + ',' + (y + 8) + 'V' + (2 * y - 8) + 'M' + 4.5 * x + ',' + (y + 8) + 'V' + (2 * y - 8);
8592
- };
8593
-
8594
- this.brushHandle = this.brushLayer.select('.brush').selectAll('.handle--custom').remove();
8595
- this.brushHandle = this.brushLayer.select('.brush').selectAll('.handle--custom').data([{
8596
- type: 'w'
8597
- }, {
8598
- type: 'e'
8599
- }]).enter().append('path').attr('class', 'handle--custom').attr('stroke', 'transparent').attr('fill', 'transparent').attr('cursor', 'ew-resize').attr('d', brushResizePath); // BRUSH END
8600
- // this.brushArea.selectAll('*').remove()
8808
+ this.brush = d3[brushMethod]().extent([[0, 0], [brushLength, brushThickness]]).on('brush end', this.brushed); // const brushResizePath = d => {
8809
+ // let e = +(d.type === 'e')
8810
+ // let x = e ? 1 : -1
8811
+ // let y = this.options.brushHeight
8812
+ // return (
8813
+ // 'M' +
8814
+ // 0.5 * x +
8815
+ // ',' +
8816
+ // y +
8817
+ // 'A6,6 0 0 ' +
8818
+ // e +
8819
+ // ' ' +
8820
+ // 6.5 * x +
8821
+ // ',' +
8822
+ // (y + 6) +
8823
+ // 'V' +
8824
+ // (2 * y - 6) +
8825
+ // 'A6,6 0 0 ' +
8826
+ // e +
8827
+ // ' ' +
8828
+ // 0.5 * x +
8829
+ // ',' +
8830
+ // 2 * y +
8831
+ // 'Z' +
8832
+ // 'M' +
8833
+ // 2.5 * x +
8834
+ // ',' +
8835
+ // (y + 8) +
8836
+ // 'V' +
8837
+ // (2 * y - 8) +
8838
+ // 'M' +
8839
+ // 4.5 * x +
8840
+ // ',' +
8841
+ // (y + 8) +
8842
+ // 'V' +
8843
+ // (2 * y - 8)
8844
+ // )
8845
+ // }
8846
+ // this.brushHandle = this.brushLayer
8847
+ // .select('.brush')
8848
+ // .selectAll('.handle--custom')
8849
+ // .remove()
8850
+ // this.brushHandle = this.brushLayer
8851
+ // .select('.brush')
8852
+ // .selectAll('.handle--custom')
8853
+ // .data([{ type: 'w' }, { type: 'e' }])
8854
+ // .enter()
8855
+ // .append('path')
8856
+ // .attr('class', 'handle--custom')
8857
+ // .attr('stroke', 'transparent')
8858
+ // .attr('fill', 'transparent')
8859
+ // .attr('cursor', 'ew-resize')
8860
+ // .attr('d', brushResizePath)
8861
+ // BRUSH END
8862
+ // this.brushLayer.selectAll('.handle').remove()
8601
8863
 
8602
8864
  if (this.brushNeeded) {
8603
8865
  if (!this.brushInitialized) {
8604
8866
  this.brushLayer.style('visibility', 'visible');
8605
8867
  this.brushInitialized = true;
8606
8868
  this.brushLayer.select('.brush').call(this.brush).call(this.brush.move, [0, brushEnd]);
8869
+ } else {
8870
+ this.brushLayer.style('visibility', 'visible');
8607
8871
  }
8608
8872
  } else {
8609
8873
  this.brushLayer.style('visibility', 'hidden'); // this.brushLayer.selectAll().remove()
8610
-
8611
- this.brushArea.selectAll('*').remove();
8874
+ // this.brushArea.selectAll('*').remove()
8612
8875
  }
8613
8876
 
8614
8877
  if (this.options.margin.axisBottom > 0) {
@@ -8666,7 +8929,7 @@ var WebsyChart = /*#__PURE__*/function () {
8666
8929
 
8667
8930
  if (this.options.data.bottom.formatter) {
8668
8931
  this.bAxisFunc.tickFormat(function (d) {
8669
- return _this47.options.data.bottom.formatter(d);
8932
+ return _this48.options.data.bottom.formatter(d);
8670
8933
  });
8671
8934
  }
8672
8935
 
@@ -8678,7 +8941,7 @@ var WebsyChart = /*#__PURE__*/function () {
8678
8941
 
8679
8942
  if (this.customBottomRange.length > 0) {
8680
8943
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8681
- return "translate(".concat(_this47.customBottomRange[i] + (_this47.customBottomRange[i + 1] - _this47.customBottomRange[i]) / 2, ", 0)");
8944
+ return "translate(".concat(_this48.customBottomRange[i] + (_this48.customBottomRange[i + 1] - _this48.customBottomRange[i]) / 2, ", 0)");
8682
8945
  });
8683
8946
  }
8684
8947
  } // Configure the left axis
@@ -8687,8 +8950,8 @@ var WebsyChart = /*#__PURE__*/function () {
8687
8950
  var leftDomain = this.createDomain('left');
8688
8951
  var leftBrushDomain = this.createDomain('left', true);
8689
8952
  var rightDomain = this.createDomain('right');
8690
- this.leftAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftDomain).range([this.plotHeight, 0]);
8691
- this.leftBrushAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftBrushDomain).range([this.options.brushHeight, 0]);
8953
+ this.leftAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftDomain).range(leftRange);
8954
+ this.leftBrushAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftBrushDomain).range(leftBrushRange);
8692
8955
 
8693
8956
  if (this.leftAxis.padding && this.options.data.left.padding) {
8694
8957
  this.leftAxis.padding(this.options.data.left.padding || 0);
@@ -8700,8 +8963,8 @@ var WebsyChart = /*#__PURE__*/function () {
8700
8963
 
8701
8964
  if (this.options.margin.axisLeft > 0) {
8702
8965
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8703
- if (_this47.options.data.left.formatter) {
8704
- d = _this47.options.data.left.formatter(d);
8966
+ if (_this48.options.data.left.formatter) {
8967
+ d = _this48.options.data.left.formatter(d);
8705
8968
  }
8706
8969
 
8707
8970
  return d;
@@ -8736,8 +8999,8 @@ var WebsyChart = /*#__PURE__*/function () {
8736
8999
 
8737
9000
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8738
9001
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8739
- if (_this47.options.data.right.formatter) {
8740
- d = _this47.options.data.right.formatter(d);
9002
+ if (_this48.options.data.right.formatter) {
9003
+ d = _this48.options.data.right.formatter(d);
8741
9004
  }
8742
9005
 
8743
9006
  return d;
@@ -8779,48 +9042,57 @@ var WebsyChart = /*#__PURE__*/function () {
8779
9042
  }, {
8780
9043
  key: "renderComponents",
8781
9044
  value: function renderComponents() {
8782
- var _this48 = this;
9045
+ var _this49 = this;
8783
9046
 
8784
9047
  // Draw the series data
8785
9048
  this.renderedKeys = {};
8786
9049
  this.options.data.series.forEach(function (series, index) {
8787
9050
  if (!series.key) {
8788
- series.key = _this48.createIdentity();
9051
+ series.key = _this49.createIdentity();
8789
9052
  }
8790
9053
 
8791
9054
  if (!series.color) {
8792
- series.color = _this48.options.colors[index % _this48.options.colors.length];
9055
+ series.color = _this49.options.colors[index % _this49.options.colors.length];
8793
9056
  }
8794
9057
 
8795
- _this48["render".concat(series.type || 'bar')](series, index);
9058
+ _this49["render".concat(series.type || 'bar')](series, index);
8796
9059
 
8797
- _this48.renderLabels(series, index);
9060
+ _this49.renderLabels(series, index);
8798
9061
 
8799
- _this48.renderedKeys[series.key] = series.type;
9062
+ _this49.renderedKeys[series.key] = series.type;
8800
9063
  });
8801
9064
  this.refLineLayer.selectAll('.reference-line').remove();
8802
9065
  this.refLineLayer.selectAll('.reference-line-label').remove();
8803
9066
 
8804
9067
  if (this.options.refLines && this.options.refLines.length > 0) {
8805
9068
  this.options.refLines.forEach(function (l) {
8806
- return _this48.renderRefLine(l);
9069
+ return _this49.renderRefLine(l);
8807
9070
  });
8808
9071
  }
8809
9072
  }
8810
9073
  }, {
8811
9074
  key: "renderarea",
8812
9075
  value: function renderarea(series, index) {
8813
- var _this49 = this;
9076
+ var _this50 = this;
8814
9077
 
8815
9078
  /* global d3 series index */
8816
9079
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8817
9080
  return d3.area().x(function (d) {
8818
- return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value));
9081
+ // return this[`${xAxis}Axis`](this.parseX(d.x.value))
9082
+ var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
9083
+
9084
+ var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9085
+
9086
+ if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9087
+ xPos = xPos + (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9088
+ }
9089
+
9090
+ return xPos;
8819
9091
  }).y0(function (d) {
8820
- return _this49["".concat(yAxis, "Axis")](0);
9092
+ return _this50["".concat(yAxis, "Axis")](0);
8821
9093
  }).y1(function (d) {
8822
- return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8823
- }).curve(d3[curveStyle || _this49.options.curveStyle]);
9094
+ return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9095
+ }).curve(d3[curveStyle || _this50.options.curveStyle]);
8824
9096
  };
8825
9097
 
8826
9098
  var xAxis = 'bottom';
@@ -8838,23 +9110,27 @@ var WebsyChart = /*#__PURE__*/function () {
8838
9110
  areas // .style('stroke-width', series.lineWidth || this.options.lineWidth)
8839
9111
  // .attr('id', `line_${series.key}`)
8840
9112
  // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
8841
- // .attr('fill', series.colour)
8842
- // .attr('stroke', 'transparent')
9113
+ .attr('fill', function (d) {
9114
+ return d[0].y.color || series.color;
9115
+ }) // .attr('stroke', 'transparent')
8843
9116
  .transition(this.transition).attr('d', function (d) {
8844
9117
  return drawArea(xAxis, yAxis, series.curveStyle)(d);
8845
9118
  }); // Enter
8846
9119
 
8847
9120
  areas.enter().append('path').attr('d', function (d) {
8848
9121
  return drawArea(xAxis, yAxis, series.curveStyle)(d);
8849
- }).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)).attr('transform', 'translate(' + (this.options.data[xAxis].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2) + ',0)') // .style('stroke-width', series.lineWidth || this.options.lineWidth)
8850
- .attr('fill', series.color) // .style('fill-opacity', 0)
9122
+ }).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)) // .attr('transform', 'translate(' + (this.options.data[xAxis].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2) + ',0)')
9123
+ // .style('stroke-width', series.lineWidth || this.options.lineWidth)
9124
+ .attr('fill', function (d) {
9125
+ return d[0].y.color || series.color;
9126
+ }) // .style('fill-opacity', 0)
8851
9127
  .attr('stroke', 'transparent') // .transition(this.transition)
8852
- .style('fill-opacity', series.opacity || 0.5);
9128
+ .style('fill-opacity', series.opacity || 0.3);
8853
9129
  }
8854
9130
  }, {
8855
9131
  key: "renderbar",
8856
9132
  value: function renderbar(series, index) {
8857
- var _this50 = this;
9133
+ var _this51 = this;
8858
9134
 
8859
9135
  /* global series index d3 */
8860
9136
  var xAxis = 'bottom';
@@ -8866,16 +9142,13 @@ var WebsyChart = /*#__PURE__*/function () {
8866
9142
  if (this.options.orientation === 'horizontal') {
8867
9143
  xAxis = 'left';
8868
9144
  yAxis = 'bottom';
8869
- } // if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
8870
- // barWidth = barWidth / this.options.data.series.length - 4
8871
- // }
8872
-
9145
+ }
8873
9146
 
8874
9147
  function getBarHeight(d, i, heightBounds, yAxis, xAxis) {
8875
9148
  var output;
8876
9149
 
8877
9150
  if (this.options.orientation === 'horizontal') {
8878
- output = this.options.data[xAxis.replace('Brush', '')].bandWidth;
9151
+ output = this.options.data[xAxis].bandWidth;
8879
9152
  } else {
8880
9153
  var x = getBarX.call(this, d, i, xAxis);
8881
9154
 
@@ -8907,7 +9180,7 @@ var WebsyChart = /*#__PURE__*/function () {
8907
9180
  return null;
8908
9181
  }
8909
9182
 
8910
- output = Math.max(1, this.options.data[xAxis.replace('Brush', '')].bandWidth);
9183
+ output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
8911
9184
  }
8912
9185
 
8913
9186
  if (isNaN(output)) {
@@ -8918,11 +9191,6 @@ var WebsyChart = /*#__PURE__*/function () {
8918
9191
  }
8919
9192
 
8920
9193
  function getBarX(d, i, xAxis) {
8921
- // let barWidth = this.plotWidth / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8922
- // if (this.options.data[xAxis.replace('Brush', '')].padding) {
8923
- // barWidth = barWidth - (barWidth * this.options.data[xAxis.replace('Brush', '')].padding)
8924
- // }
8925
- // let groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8926
9194
  var output;
8927
9195
 
8928
9196
  if (this.options.orientation === 'horizontal') {
@@ -8942,22 +9210,26 @@ var WebsyChart = /*#__PURE__*/function () {
8942
9210
  }
8943
9211
  } else {
8944
9212
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
8945
- var _adjustment = this.customBottomRange[i] + i * this.options.data[xAxis.replace('Brush', '')].bandWidth;
8946
-
9213
+ // let adjustment = this[`custom${xAxis.toInitialCaps()}Range`][i] + (i * this.options.data[xAxis].bandWidth)
8947
9214
  if (this.options.grouping === 'grouped') {
8948
9215
  var xIndex = 0;
8949
9216
 
8950
9217
  if (this.processedX[d.x.value]) {
8951
9218
  xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel));
8952
- }
8953
-
8954
- var barAdjustment = this.options.data[xAxis.replace('Brush', '')].bandWidth * xIndex + xIndex * this.options.groupPadding * 2 + this.options.groupPadding + (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1); // let barAdjustment =
9219
+ } // let barAdjustment =
9220
+ // (this.options.data[xAxis].bandWidth * xIndex) +
9221
+ // (xIndex * this.options.groupPadding * 2) + this.options.groupPadding +
9222
+ // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
9223
+ // let barAdjustment =
8955
9224
  // (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
8956
9225
  // this.options.groupPadding
8957
9226
  // // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8958
9227
 
8959
- if (this.customBottomRange.length > 0) {
8960
- output = this.customBottomRange[this[xAxis.replace('Brush', '') + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
9228
+
9229
+ var barAdjustment = this.options.data[xAxis].bandWidth * xIndex + (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
9230
+
9231
+ if (this["custom".concat(xAxis.toInitialCaps(), "Range")].length > 0) {
9232
+ output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment; // output = this[`custom${xAxis.toInitialCaps().replace('Brush', '')}DetailRange`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)]
8961
9233
  } else {
8962
9234
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8963
9235
  }
@@ -8968,12 +9240,10 @@ var WebsyChart = /*#__PURE__*/function () {
8968
9240
 
8969
9241
  if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
8970
9242
  this.processedX[d.x.value].push(d.y.tooltipLabel);
8971
- }
9243
+ } // console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output)
8972
9244
 
8973
- console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output);
8974
9245
  } else {
8975
- // output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
8976
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)); // + (i * barWidth)
9246
+ output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)];
8977
9247
  }
8978
9248
  }
8979
9249
 
@@ -8985,8 +9255,6 @@ var WebsyChart = /*#__PURE__*/function () {
8985
9255
  }
8986
9256
 
8987
9257
  function getBarY(d, i, heightBounds, yAxis, xAxis) {
8988
- // let barWidth = this[`${xAxis}Axis`].bandwidth()
8989
- // let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
8990
9258
  var output;
8991
9259
 
8992
9260
  if (this.options.orientation === 'horizontal') {
@@ -8997,10 +9265,19 @@ var WebsyChart = /*#__PURE__*/function () {
8997
9265
  }
8998
9266
  } else {
8999
9267
  if (this.options.grouping === 'stacked') {
9000
- output = heightBounds - this["".concat(yAxis, "Axis")](d.y.accumulative);
9268
+ var accH = getBarHeight.call(this, {
9269
+ x: d.x,
9270
+ y: {
9271
+ value: d.y.accumulative
9272
+ }
9273
+ }, i, heightBounds, yAxis, xAxis);
9274
+ var h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis); // output = heightBounds - this[`${yAxis}Axis`](d.y.accumulative)
9275
+
9276
+ output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
9001
9277
  } else {
9002
- var h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis);
9003
- output = this["".concat(yAxis, "Axis")](0) - h * (d.y.value < 0 ? 0 : 1);
9278
+ var _h2 = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis);
9279
+
9280
+ output = this["".concat(yAxis, "Axis")](0) - _h2 * (d.y.value < 0 ? 0 : 1);
9004
9281
  }
9005
9282
  }
9006
9283
 
@@ -9013,25 +9290,25 @@ var WebsyChart = /*#__PURE__*/function () {
9013
9290
 
9014
9291
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9015
9292
  bars.attr('width', function (d, i) {
9016
- return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9293
+ return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9017
9294
  }).attr('height', function (d, i) {
9018
- return getBarHeight.call(_this50, d, i, _this50.plotHeight, yAxis, xAxis);
9295
+ return getBarHeight.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9019
9296
  }).attr('x', function (d, i) {
9020
- return getBarX.call(_this50, d, i, xAxis);
9297
+ return getBarX.call(_this51, d, i, xAxis);
9021
9298
  }).attr('y', function (d, i) {
9022
- return getBarY.call(_this50, d, i, _this50.plotHeight, yAxis, xAxis);
9299
+ return getBarY.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9023
9300
  }) // .transition(this.transition)
9024
9301
  .attr('fill', function (d) {
9025
9302
  return d.y.color || d.color || series.color;
9026
9303
  });
9027
9304
  bars.enter().append('rect').attr('width', function (d, i) {
9028
- return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9305
+ return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9029
9306
  }).attr('height', function (d, i) {
9030
- return getBarHeight.call(_this50, d, i, _this50.plotHeight, yAxis, xAxis);
9307
+ return getBarHeight.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9031
9308
  }).attr('x', function (d, i) {
9032
- return getBarX.call(_this50, d, i, xAxis);
9309
+ return getBarX.call(_this51, d, i, xAxis);
9033
9310
  }).attr('y', function (d, i) {
9034
- return getBarY.call(_this50, d, i, _this50.plotHeight, yAxis, xAxis);
9311
+ return getBarY.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9035
9312
  }) // .transition(this.transition)
9036
9313
  .attr('fill', function (d) {
9037
9314
  return d.y.color || d.color || series.color;
@@ -9043,25 +9320,25 @@ var WebsyChart = /*#__PURE__*/function () {
9043
9320
  this.brushBarsInitialized[series.key] = true;
9044
9321
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9045
9322
  brushBars.attr('width', function (d, i) {
9046
- return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9323
+ return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9047
9324
  }).attr('height', function (d, i) {
9048
- return getBarHeight.call(_this50, d, i, _this50.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9325
+ return getBarHeight.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9049
9326
  }).attr('x', function (d, i) {
9050
- return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9327
+ return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9051
9328
  }).attr('y', function (d, i) {
9052
- return getBarY.call(_this50, d, i, _this50.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9329
+ return getBarY.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9053
9330
  }) // .transition(this.transition)
9054
9331
  .attr('fill', function (d) {
9055
9332
  return d.y.color || d.color || series.color;
9056
9333
  });
9057
9334
  brushBars.enter().append('rect').attr('width', function (d, i) {
9058
- return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9335
+ return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9059
9336
  }).attr('height', function (d, i) {
9060
- return getBarHeight.call(_this50, d, i, _this50.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9337
+ return getBarHeight.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9061
9338
  }).attr('x', function (d, i) {
9062
- return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9339
+ return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9063
9340
  }).attr('y', function (d, i) {
9064
- return getBarY.call(_this50, d, i, _this50.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9341
+ return getBarY.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9065
9342
  }) // .transition(this.transition)
9066
9343
  .attr('fill', function (d) {
9067
9344
  return d.y.color || d.color || series.color;
@@ -9079,16 +9356,16 @@ var WebsyChart = /*#__PURE__*/function () {
9079
9356
  }, {
9080
9357
  key: "renderLabels",
9081
9358
  value: function renderLabels(series, index) {
9082
- var _this51 = this;
9359
+ var _this52 = this;
9083
9360
 
9084
9361
  /* global series index d3 WebsyDesigns */
9085
- var xAxis = 'bottomAxis';
9086
- var yAxis = 'leftAxis';
9362
+ var xAxis = 'bottom';
9363
+ var yAxis = 'left';
9087
9364
  var that = this;
9088
9365
 
9089
9366
  if (this.options.orientation === 'horizontal') {
9090
- xAxis = 'leftAxis';
9091
- yAxis = 'bottomAxis';
9367
+ xAxis = 'left';
9368
+ yAxis = 'bottom';
9092
9369
  }
9093
9370
 
9094
9371
  if (this.options.showLabels === true || series.showLabels === true) {
@@ -9098,15 +9375,15 @@ var WebsyChart = /*#__PURE__*/function () {
9098
9375
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
9099
9376
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
9100
9377
  labels.attr('x', function (d) {
9101
- return getLabelX.call(_this51, d, series.labelPosition);
9378
+ return getLabelX.call(_this52, d, series.labelPosition);
9102
9379
  }).attr('y', function (d) {
9103
- return getLabelY.call(_this51, d, series.labelPosition);
9380
+ return getLabelY.call(_this52, d, series.labelPosition);
9104
9381
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
9105
- if (_this51.options.grouping === 'stacked' && d.y.value === 0) {
9382
+ if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
9106
9383
  return 'transparent';
9107
9384
  }
9108
9385
 
9109
- return _this51.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9386
+ return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9110
9387
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
9111
9388
  return d.y.label || d.y.value;
9112
9389
  }).each(function (d, i) {
@@ -9131,15 +9408,15 @@ var WebsyChart = /*#__PURE__*/function () {
9131
9408
  }
9132
9409
  });
9133
9410
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9134
- return getLabelX.call(_this51, d, series.labelPosition);
9411
+ return getLabelX.call(_this52, d, series.labelPosition);
9135
9412
  }).attr('y', function (d) {
9136
- return getLabelY.call(_this51, d, series.labelPosition);
9413
+ return getLabelY.call(_this52, d, series.labelPosition);
9137
9414
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9138
- if (_this51.options.grouping === 'stacked' && d.y.value === 0) {
9415
+ if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
9139
9416
  return 'transparent';
9140
9417
  }
9141
9418
 
9142
- return _this51.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9419
+ return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9143
9420
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9144
9421
  return d.y.label || d.y.value;
9145
9422
  }).each(function (d, i) {
@@ -9161,6 +9438,10 @@ var WebsyChart = /*#__PURE__*/function () {
9161
9438
  if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
9162
9439
  this.setAttribute('y', +this.getAttribute('y') + 8);
9163
9440
  }
9441
+
9442
+ if (series.labelPosition !== 'outside') {
9443
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9444
+ }
9164
9445
  }
9165
9446
  });
9166
9447
  }
@@ -9175,7 +9456,15 @@ var WebsyChart = /*#__PURE__*/function () {
9175
9456
  return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
9176
9457
  }
9177
9458
  } else {
9178
- return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
9459
+ // return this[xAxis](this.parseX(d.x.value)) + (this.options.data[xAxis.replace('Axis', '')].bandWidth / 2)
9460
+ var xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value);
9461
+ var xPos = this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9462
+
9463
+ if (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9464
+ xPos = xPos + (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9465
+ }
9466
+
9467
+ return xPos;
9179
9468
  }
9180
9469
  }
9181
9470
 
@@ -9183,12 +9472,14 @@ var WebsyChart = /*#__PURE__*/function () {
9183
9472
  var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
9184
9473
 
9185
9474
  if (this.options.orientation === 'horizontal') {
9186
- return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
9475
+ return this[xAxis + 'Axis'](this.parseX(d.x.value)) + this.options.data[xAxis].bandWidth / 2;
9187
9476
  } else {
9188
9477
  if (this.options.grouping === 'stacked') {
9189
- return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
9478
+ var accH = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.accumulative));
9479
+ var h = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9480
+ return this["".concat(yAxis, "Axis")](0) - (accH + h - (labelPosition === 'inside' ? h / 2 : 0)) * (d.y.accumulative < 0 ? 0 : 1); // return (this[`${yAxis}Axis`](0)) - (this[yAxis + 'Axis'](d.y.accumulative) - (this[yAxis + 'Axis'](d.y.value))) // / (labelPosition === 'inside' ? 2 : 1)))
9190
9481
  } else {
9191
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize);
9482
+ return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize);
9192
9483
  }
9193
9484
  }
9194
9485
  }
@@ -9196,25 +9487,34 @@ var WebsyChart = /*#__PURE__*/function () {
9196
9487
  }, {
9197
9488
  key: "renderline",
9198
9489
  value: function renderline(series, index) {
9199
- var _this52 = this;
9490
+ var _this53 = this;
9200
9491
 
9201
9492
  /* global series index d3 */
9202
9493
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9203
9494
  return d3.line().x(function (d) {
9204
- if (_this52.options.orientation === 'horizontal') {
9205
- return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9495
+ if (_this53.options.orientation === 'horizontal') {
9496
+ return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9206
9497
  } else {
9207
- var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9208
- return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9498
+ var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
9499
+
9500
+ var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9501
+
9502
+ if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9503
+ xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9504
+ } // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
9505
+ // return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
9506
+
9507
+
9508
+ return xPos;
9209
9509
  }
9210
9510
  }).y(function (d) {
9211
- if (_this52.options.orientation === 'horizontal') {
9212
- var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9213
- return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9511
+ if (_this53.options.orientation === 'horizontal') {
9512
+ var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
9513
+ return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment;
9214
9514
  } else {
9215
- return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9515
+ return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9216
9516
  }
9217
- }).curve(d3[curveStyle || _this52.options.curveStyle]);
9517
+ }).curve(d3[curveStyle || _this53.options.curveStyle]);
9218
9518
  };
9219
9519
 
9220
9520
  var xAxis = 'bottom';
@@ -9240,14 +9540,18 @@ var WebsyChart = /*#__PURE__*/function () {
9240
9540
 
9241
9541
  lines.style('stroke-width', series.lineWidth || this.options.lineWidth) // .attr('id', `line_${series.key}`)
9242
9542
  // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
9243
- .attr('stroke', series.color).attr('fill', 'transparent').transition(this.transition).attr('d', function (d) {
9543
+ .attr('stroke', function (d) {
9544
+ return d[0].y.color || series.color;
9545
+ }).attr('fill', 'transparent').transition(this.transition).attr('d', function (d) {
9244
9546
  return drawLine(xAxis, yAxis, series.curveStyle)(d);
9245
9547
  }); // Enter
9246
9548
 
9247
9549
  lines.enter().append('path').attr('d', function (d) {
9248
9550
  return drawLine(xAxis, yAxis, series.curveStyle)(d);
9249
9551
  }).attr('class', "line_".concat(series.key)).attr('id', "line_".concat(series.key)) // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
9250
- .style('stroke-width', series.lineWidth || this.options.lineWidth).attr('stroke', series.color).attr('fill', 'transparent') // .transition(this.transition)
9552
+ .style('stroke-width', series.lineWidth || this.options.lineWidth).attr('stroke', function (d) {
9553
+ return d[0].y.color || series.color;
9554
+ }).attr('fill', 'transparent') // .transition(this.transition)
9251
9555
  .style('stroke-opacity', 1);
9252
9556
 
9253
9557
  if (!this.brushLinesInitialized[series.key]) {
@@ -9311,14 +9615,14 @@ var WebsyChart = /*#__PURE__*/function () {
9311
9615
  }, {
9312
9616
  key: "rendersymbol",
9313
9617
  value: function rendersymbol(series, index) {
9314
- var _this53 = this;
9618
+ var _this54 = this;
9315
9619
 
9316
9620
  /* global d3 series index series.key */
9317
9621
  var drawSymbol = function drawSymbol(size) {
9318
9622
  return d3.symbol() // .type(d => {
9319
9623
  // return d3.symbols[0]
9320
9624
  // })
9321
- .size(size || _this53.options.symbolSize);
9625
+ .size(size || _this54.options.symbolSize);
9322
9626
  };
9323
9627
 
9324
9628
  var xAxis = 'bottom';
@@ -9336,12 +9640,28 @@ var WebsyChart = /*#__PURE__*/function () {
9336
9640
  symbols.attr('d', function (d) {
9337
9641
  return drawSymbol(d.y.size || series.symbolSize)(d);
9338
9642
  }).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
9339
- var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9643
+ // let adjustment = (this.options.data[xAxis].scale === 'Time' || this.options.data[xAxis].scale === 'Linear') ? 0 : this.options.data[xAxis].bandWidth / 2
9644
+ // if (this.options.orientation === 'horizontal') {
9645
+ // return `translate(${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)}, ${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment})`
9646
+ // }
9647
+ // else {
9648
+ // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9649
+ // }
9650
+ var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9651
+
9652
+ var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9653
+
9654
+ if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9655
+ xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9656
+ }
9657
+
9658
+ var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
9340
9659
 
9341
- if (_this53.options.orientation === 'horizontal') {
9342
- return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ")");
9660
+ if (_this54.options.orientation === 'horizontal') {
9661
+ return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9343
9662
  } else {
9344
- return "translate(".concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9663
+ // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9664
+ return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9345
9665
  }
9346
9666
  }); // Enter
9347
9667
 
@@ -9351,12 +9671,21 @@ var WebsyChart = /*#__PURE__*/function () {
9351
9671
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
9352
9672
  return "symbol symbol_".concat(series.key);
9353
9673
  }).attr('transform', function (d) {
9354
- var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9674
+ var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9355
9675
 
9356
- if (_this53.options.orientation === 'horizontal') {
9357
- return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ")");
9676
+ var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9677
+
9678
+ if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9679
+ xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9680
+ }
9681
+
9682
+ var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
9683
+
9684
+ if (_this54.options.orientation === 'horizontal') {
9685
+ return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9358
9686
  } else {
9359
- return "translate(".concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9687
+ // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9688
+ return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9360
9689
  }
9361
9690
  });
9362
9691
  }
@@ -9578,7 +9907,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9578
9907
  }, {
9579
9908
  key: "resize",
9580
9909
  value: function resize() {
9581
- var _this54 = this;
9910
+ var _this55 = this;
9582
9911
 
9583
9912
  var el = document.getElementById(this.elementId);
9584
9913
 
@@ -9591,7 +9920,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9591
9920
  // }
9592
9921
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9593
9922
  html += this._data.map(function (d, i) {
9594
- return _this54.getLegendItemHTML(d);
9923
+ return _this55.getLegendItemHTML(d);
9595
9924
  }).join('');
9596
9925
  html += "\n <div>\n ";
9597
9926
  el.innerHTML = html;
@@ -9763,7 +10092,7 @@ var WebsyMap = /*#__PURE__*/function () {
9763
10092
  }, {
9764
10093
  key: "render",
9765
10094
  value: function render() {
9766
- var _this55 = this;
10095
+ var _this56 = this;
9767
10096
 
9768
10097
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
9769
10098
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -9772,7 +10101,7 @@ var WebsyMap = /*#__PURE__*/function () {
9772
10101
  var legendData = this.options.data.polygons.map(function (s, i) {
9773
10102
  return {
9774
10103
  value: s.label || s.key,
9775
- color: s.color || _this55.options.colors[i % _this55.options.colors.length]
10104
+ color: s.color || _this56.options.colors[i % _this56.options.colors.length]
9776
10105
  };
9777
10106
  });
9778
10107
  var longestValue = legendData.map(function (s) {
@@ -9836,7 +10165,7 @@ var WebsyMap = /*#__PURE__*/function () {
9836
10165
 
9837
10166
  if (this.polygons) {
9838
10167
  this.polygons.forEach(function (p) {
9839
- return _this55.map.removeLayer(p);
10168
+ return _this56.map.removeLayer(p);
9840
10169
  });
9841
10170
  }
9842
10171
 
@@ -9894,18 +10223,18 @@ var WebsyMap = /*#__PURE__*/function () {
9894
10223
  }
9895
10224
 
9896
10225
  if (!p.options.color) {
9897
- p.options.color = _this55.options.colors[i % _this55.options.colors.length];
10226
+ p.options.color = _this56.options.colors[i % _this56.options.colors.length];
9898
10227
  }
9899
10228
 
9900
10229
  var pol = L.polygon(p.data.map(function (c) {
9901
10230
  return c.map(function (d) {
9902
10231
  return [d.Latitude, d.Longitude];
9903
10232
  });
9904
- }), p.options).addTo(_this55.map);
10233
+ }), p.options).addTo(_this56.map);
9905
10234
 
9906
- _this55.polygons.push(pol);
10235
+ _this56.polygons.push(pol);
9907
10236
 
9908
- _this55.map.fitBounds(pol.getBounds());
10237
+ _this56.map.fitBounds(pol.getBounds());
9909
10238
  });
9910
10239
  } // if (this.data.markers.length > 0) {
9911
10240
  // el.classList.remove('hidden')
@@ -10093,3 +10422,9 @@ function usePayPal() {
10093
10422
  pps.src = '//www.paypal.com/sdk/js';
10094
10423
  document.getElementsByTagName('body')[0].appendChild(pps);
10095
10424
  }
10425
+
10426
+ String.prototype.toInitialCaps = function () {
10427
+ var letters = this.split('');
10428
+ var initial = letters.shift().toUpperCase();
10429
+ return initial + letters.join('');
10430
+ };