@websy/websy-designs 1.6.3 → 1.7.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,29 +1949,6 @@ 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
- }
1975
1952
  }, {
1976
1953
  key: "updateHeader",
1977
1954
  value: function updateHeader(item) {
@@ -2084,6 +2061,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
2084
2061
  this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
2085
2062
  }
2086
2063
 
2064
+ if (this.options.onChange) {
2065
+ this.options.onChange(this);
2066
+ }
2067
+
2087
2068
  if (this.options.closeAfterSelection === true) {
2088
2069
  this.close();
2089
2070
  }
@@ -2129,6 +2110,40 @@ var WebsyDropdown = /*#__PURE__*/function () {
2129
2110
  get: function get() {
2130
2111
  return this.options.items;
2131
2112
  }
2113
+ }, {
2114
+ key: "value",
2115
+ get: function get() {
2116
+ var _this12 = this;
2117
+
2118
+ if (this.selectedItems && this.selectedItems.length > 0) {
2119
+ return this.selectedItems.map(function (d, i) {
2120
+ return _this12.options.items[+d];
2121
+ });
2122
+ }
2123
+
2124
+ return [];
2125
+ },
2126
+ set: function set(value) {
2127
+ var _this13 = this;
2128
+
2129
+ this.selectedItems = [];
2130
+
2131
+ if (Array.isArray(value)) {
2132
+ this.options.items.forEach(function (d) {
2133
+ if (value.indexOf(d.value) !== -1) {
2134
+ _this13.selectedItems.push(d.index);
2135
+ }
2136
+ });
2137
+ } else {
2138
+ this.options.items.forEach(function (d) {
2139
+ if (d.value === value) {
2140
+ _this13.selectedItems.push(d.index);
2141
+ }
2142
+ });
2143
+ }
2144
+
2145
+ this.render();
2146
+ }
2132
2147
  }]);
2133
2148
 
2134
2149
  return WebsyDropdown;
@@ -2426,7 +2441,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2426
2441
  }, {
2427
2442
  key: "render",
2428
2443
  value: function render() {
2429
- var _this13 = this;
2444
+ var _this14 = this;
2430
2445
 
2431
2446
  var el = document.getElementById("".concat(this.elementId, "_container"));
2432
2447
 
@@ -2434,7 +2449,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2434
2449
  this.measureItems();
2435
2450
  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 ");
2436
2451
  html += this.options.items.map(function (d, i) {
2437
- return _this13.createItemHtml(_this13.elementId, i, d);
2452
+ return _this14.createItemHtml(_this14.elementId, i, d);
2438
2453
  }).join('');
2439
2454
  el.innerHTML = html;
2440
2455
  this.options.items.forEach(function (item, i) {
@@ -2494,7 +2509,9 @@ var WebsyForm = /*#__PURE__*/function () {
2494
2509
  // if (this.options.classes) {
2495
2510
  // this.options.classes.forEach(c => el.classList.add(c))
2496
2511
  // }
2512
+ el.addEventListener('change', this.handleChange.bind(this));
2497
2513
  el.addEventListener('click', this.handleClick.bind(this));
2514
+ el.addEventListener('focusout', this.handleFocusOut.bind(this));
2498
2515
  el.addEventListener('keyup', this.handleKeyUp.bind(this));
2499
2516
  el.addEventListener('keydown', this.handleKeyDown.bind(this));
2500
2517
  this.render();
@@ -2514,19 +2531,19 @@ var WebsyForm = /*#__PURE__*/function () {
2514
2531
  }, {
2515
2532
  key: "checkRecaptcha",
2516
2533
  value: function checkRecaptcha() {
2517
- var _this14 = this;
2534
+ var _this15 = this;
2518
2535
 
2519
2536
  return new Promise(function (resolve, reject) {
2520
- if (_this14.options.useRecaptcha === true) {
2521
- if (_this14.recaptchaValue) {
2537
+ if (_this15.options.useRecaptcha === true) {
2538
+ if (_this15.recaptchaValue) {
2522
2539
  // grecaptcha.ready(() => {
2523
2540
  // grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
2524
- _this14.apiService.add('google/checkrecaptcha', {
2525
- grecaptcharesponse: _this14.recaptchaValue
2541
+ _this15.apiService.add('google/checkrecaptcha', {
2542
+ grecaptcharesponse: _this15.recaptchaValue
2526
2543
  }).then(function (response) {
2527
2544
  if (response.success && response.success === true) {
2528
2545
  resolve(true);
2529
- grecaptcha.reset("".concat(_this14.elementId, "_recaptcha"), {
2546
+ grecaptcha.reset("".concat(_this15.elementId, "_recaptcha"), {
2530
2547
  sitekey: ENVIRONMENT.RECAPTCHA_KEY
2531
2548
  });
2532
2549
  } else {
@@ -2563,6 +2580,24 @@ var WebsyForm = /*#__PURE__*/function () {
2563
2580
  el.innerHTML = msg;
2564
2581
  }
2565
2582
  }
2583
+ }, {
2584
+ key: "handleChange",
2585
+ value: function handleChange(event) {
2586
+ if (event.target.getAttribute('data-user-type') === 'expiry') {
2587
+ if (event.target.value.length === 7) {
2588
+ var value = event.target.value.split('/');
2589
+ event.target.value = "".concat(value[0], "/").concat(value[1].substring(2, 4));
2590
+ }
2591
+ }
2592
+
2593
+ if (event.target.classList.contains('websy-input')) {
2594
+ var index = event.target.getAttribute('data-index');
2595
+
2596
+ if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
2597
+ this.validateField(this.options.fields[index], event.target.value);
2598
+ }
2599
+ }
2600
+ }
2566
2601
  }, {
2567
2602
  key: "handleClick",
2568
2603
  value: function handleClick(event) {
@@ -2574,27 +2609,104 @@ var WebsyForm = /*#__PURE__*/function () {
2574
2609
  this.cancelForm();
2575
2610
  }
2576
2611
  }
2612
+ }, {
2613
+ key: "handleFocusOut",
2614
+ value: function handleFocusOut(event) {
2615
+ if (event.target.classList.contains('websy-input')) {
2616
+ var index = event.target.getAttribute('data-index');
2617
+
2618
+ if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
2619
+ this.validateField(this.options.fields[index], event.target.value);
2620
+ }
2621
+ }
2622
+ }
2577
2623
  }, {
2578
2624
  key: "handleKeyDown",
2579
2625
  value: function handleKeyDown(event) {
2580
2626
  if (event.key === 'enter') {
2581
2627
  this.submitForm();
2582
2628
  }
2629
+
2630
+ if (event.target.getAttribute('data-user-type') === 'expiry') {
2631
+ var isNumeric = !isNaN(event.key);
2632
+ var validKey = false;
2633
+
2634
+ if (!validKey) {
2635
+ validKey = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].indexOf(event.key) !== -1;
2636
+ }
2637
+
2638
+ if (event.target.value.length === 5 && !validKey || !validKey && !isNumeric) {
2639
+ event.preventDefault();
2640
+ return false;
2641
+ }
2642
+
2643
+ if (event.key === 'Backspace') {
2644
+ if (event.target.value.indexOf('/') === event.target.selectionStart - 1) {
2645
+ var chars = event.target.value.split('');
2646
+ chars.pop();
2647
+ event.target.value = chars.join('');
2648
+ }
2649
+ }
2650
+ }
2651
+
2652
+ if (event.target.getAttribute('data-user-type') === 'cvv') {
2653
+ var _isNumeric = !isNaN(event.key);
2654
+
2655
+ var _validKey = false;
2656
+
2657
+ if (!_validKey) {
2658
+ _validKey = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].indexOf(event.key) !== -1;
2659
+ }
2660
+
2661
+ if (event.target.value.length === 3 && !_validKey || !_validKey && !_isNumeric) {
2662
+ event.preventDefault();
2663
+ return false;
2664
+ }
2665
+ }
2583
2666
  }
2584
2667
  }, {
2585
2668
  key: "handleKeyUp",
2586
- value: function handleKeyUp(event) {}
2669
+ value: function handleKeyUp(event) {
2670
+ if (event.target.getAttribute('data-user-type') === 'expiry') {
2671
+ var chars = event.target.value.split('');
2672
+ var isNumeric = !isNaN(event.key);
2673
+
2674
+ if (event.key === 'Backspace') {
2675
+ if (chars[chars.length - 1] === '/' && chars.length !== 3) {
2676
+ chars.pop();
2677
+ event.target.value = chars.join('');
2678
+ return;
2679
+ }
2680
+ }
2681
+
2682
+ if (event.target.selectionStart === 2) {
2683
+ if (chars[2] && ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'].indexOf(event.key) === -1) {
2684
+ event.target.setSelectionRange(3, 3);
2685
+ } else if (isNumeric) {
2686
+ event.target.value += '/';
2687
+ }
2688
+ }
2689
+ }
2690
+ }
2587
2691
  }, {
2588
2692
  key: "processComponents",
2589
2693
  value: function processComponents(components, callbackFn) {
2590
- var _this15 = this;
2694
+ var _this16 = this;
2591
2695
 
2592
2696
  if (components.length === 0) {
2593
2697
  callbackFn();
2594
2698
  } else {
2595
2699
  components.forEach(function (c) {
2596
2700
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
2597
- c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
2701
+ if (!c.options.onChange) {
2702
+ c.options.onChange = function () {
2703
+ if (c.required || c.validate) {
2704
+ _this16.validateField(c, c.instance.value);
2705
+ }
2706
+ };
2707
+ }
2708
+
2709
+ c.instance = new WebsyDesigns[c.component]("".concat(_this16.elementId, "_input_").concat(c.field, "_component"), c.options);
2598
2710
  } else {// some user feedback here
2599
2711
  }
2600
2712
  });
@@ -2603,15 +2715,15 @@ var WebsyForm = /*#__PURE__*/function () {
2603
2715
  }, {
2604
2716
  key: "recaptchaReady",
2605
2717
  value: function recaptchaReady() {
2606
- var _this16 = this;
2718
+ var _this17 = this;
2607
2719
 
2608
2720
  var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
2609
2721
 
2610
2722
  if (el) {
2611
2723
  grecaptcha.ready(function () {
2612
- grecaptcha.render("".concat(_this16.elementId, "_recaptcha"), {
2724
+ grecaptcha.render("".concat(_this17.elementId, "_recaptcha"), {
2613
2725
  sitekey: ENVIRONMENT.RECAPTCHA_KEY,
2614
- callback: _this16.validateRecaptcha.bind(_this16)
2726
+ callback: _this17.validateRecaptcha.bind(_this17)
2615
2727
  });
2616
2728
  });
2617
2729
  }
@@ -2619,7 +2731,7 @@ var WebsyForm = /*#__PURE__*/function () {
2619
2731
  }, {
2620
2732
  key: "render",
2621
2733
  value: function render(update, data) {
2622
- var _this17 = this;
2734
+ var _this18 = this;
2623
2735
 
2624
2736
  var el = document.getElementById(this.elementId);
2625
2737
  var componentsToProcess = [];
@@ -2627,15 +2739,15 @@ var WebsyForm = /*#__PURE__*/function () {
2627
2739
  if (el) {
2628
2740
  var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
2629
2741
  this.options.fields.forEach(function (f, i) {
2630
- _this17.fieldMap[f.field] = f;
2742
+ _this18.fieldMap[f.field] = f;
2631
2743
 
2632
2744
  if (f.component) {
2633
2745
  componentsToProcess.push(f);
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 ");
2746
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this18.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2635
2747
  } else if (f.type === 'longtext') {
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 ");
2748
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2637
2749
  } else {
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 ");
2750
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\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 <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2639
2751
  }
2640
2752
  });
2641
2753
 
@@ -2652,8 +2764,8 @@ var WebsyForm = /*#__PURE__*/function () {
2652
2764
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
2653
2765
  el.innerHTML = html;
2654
2766
  this.processComponents(componentsToProcess, function () {
2655
- if (_this17.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2656
- _this17.recaptchaReady();
2767
+ if (_this18.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2768
+ _this18.recaptchaReady();
2657
2769
  }
2658
2770
  });
2659
2771
  }
@@ -2663,7 +2775,7 @@ var WebsyForm = /*#__PURE__*/function () {
2663
2775
  value: function setValue(field, value) {
2664
2776
  if (this.fieldMap[field]) {
2665
2777
  if (this.fieldMap[field].instance) {
2666
- this.fieldMap[field].instance.setValue(value);
2778
+ this.fieldMap[field].instance.value = value;
2667
2779
  } else {
2668
2780
  var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
2669
2781
 
@@ -2680,13 +2792,17 @@ var WebsyForm = /*#__PURE__*/function () {
2680
2792
  }, {
2681
2793
  key: "submitForm",
2682
2794
  value: function submitForm() {
2683
- var _this18 = this;
2795
+ var _this19 = this;
2684
2796
 
2685
2797
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2686
2798
  var buttonEl = formEl.querySelector('button.websy-btn.submit');
2687
2799
  var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
2688
2800
 
2689
- if (formEl.reportValidity() === true) {
2801
+ if (this.options.preSubmitFn && this.options.preSubmitFn() === false) {
2802
+ return;
2803
+ }
2804
+
2805
+ if (this.validateForm() === true) {
2690
2806
  if (buttonEl) {
2691
2807
  buttonEl.setAttribute('disabled', true);
2692
2808
  }
@@ -2708,34 +2824,34 @@ var WebsyForm = /*#__PURE__*/function () {
2708
2824
  data[key] = value;
2709
2825
  });
2710
2826
 
2711
- if (_this18.options.url) {
2712
- var _this18$apiService;
2827
+ if (_this19.options.url) {
2828
+ var _this19$apiService;
2713
2829
 
2714
- var params = [_this18.options.url];
2830
+ var params = [_this19.options.url];
2715
2831
 
2716
- if (_this18.options.mode === 'update') {
2717
- params.push(_this18.options.id);
2832
+ if (_this19.options.mode === 'update') {
2833
+ params.push(_this19.options.id);
2718
2834
  }
2719
2835
 
2720
2836
  params.push(data);
2721
2837
 
2722
- (_this18$apiService = _this18.apiService)[_this18.options.mode].apply(_this18$apiService, params).then(function (result) {
2723
- if (_this18.options.clearAfterSave === true) {
2838
+ (_this19$apiService = _this19.apiService)[_this19.options.mode].apply(_this19$apiService, params).then(function (result) {
2839
+ if (_this19.options.clearAfterSave === true) {
2724
2840
  // this.render()
2725
2841
  formEl.reset();
2726
2842
  }
2727
2843
 
2728
2844
  buttonEl.removeAttribute('disabled');
2729
2845
 
2730
- _this18.options.onSuccess.call(_this18, result);
2846
+ _this19.options.onSuccess.call(_this19, result);
2731
2847
  }, function (err) {
2732
2848
  console.log('Error submitting form data:', err);
2733
2849
 
2734
- _this18.options.onError.call(_this18, err);
2850
+ _this19.options.onError.call(_this19, err);
2735
2851
  });
2736
- } else if (_this18.options.submitFn) {
2737
- _this18.options.submitFn(data, function () {
2738
- if (_this18.options.clearAfterSave === true) {
2852
+ } else if (_this19.options.submitFn) {
2853
+ _this19.options.submitFn(data, function () {
2854
+ if (_this19.options.clearAfterSave === true) {
2739
2855
  // this.render()
2740
2856
  formEl.reset();
2741
2857
  }
@@ -2753,6 +2869,76 @@ var WebsyForm = /*#__PURE__*/function () {
2753
2869
  });
2754
2870
  }
2755
2871
  }
2872
+ }, {
2873
+ key: "validateForm",
2874
+ value: function validateForm() {
2875
+ var valid = true;
2876
+ var data = this.data;
2877
+
2878
+ for (var i = 0; i < this.options.fields.length; i++) {
2879
+ if (this.options.fields[i].required || this.options.fields[i].validate) {
2880
+ if (this.validateField(this.options.fields[i], data[this.options.fields[i].field]) === false) {
2881
+ valid = false;
2882
+ }
2883
+ }
2884
+ }
2885
+
2886
+ return valid;
2887
+ }
2888
+ }, {
2889
+ key: "validateField",
2890
+ value: function validateField(field, value) {
2891
+ var inputContainerEl = document.getElementById("".concat(this.elementId, "_").concat(field.field, "_inputContainer"));
2892
+ var errorEl = document.getElementById("".concat(this.elementId, "_").concat(field.field, "_error"));
2893
+
2894
+ if (field.required) {
2895
+ var valid = true;
2896
+
2897
+ if (field.component && field.instance && field.instance.value) {
2898
+ valid = field.instance.value.length > 0;
2899
+ } else {
2900
+ valid = !(typeof value === 'undefined' || value === '');
2901
+ }
2902
+
2903
+ if (!valid) {
2904
+ if (errorEl) {
2905
+ errorEl.innerHTML = field.invalidMessage || 'A value is required';
2906
+ }
2907
+
2908
+ if (inputContainerEl) {
2909
+ inputContainerEl.classList.add('websy-form-input-has-error');
2910
+ }
2911
+
2912
+ return false;
2913
+ }
2914
+ }
2915
+
2916
+ if (field.validate) {
2917
+ var _valid = field.validate(field, value);
2918
+
2919
+ if (!_valid) {
2920
+ if (errorEl) {
2921
+ errorEl.innerHTML = field.invalidMessage || 'A value is required';
2922
+ }
2923
+
2924
+ if (inputContainerEl) {
2925
+ inputContainerEl.classList.add('websy-form-input-has-error');
2926
+ }
2927
+
2928
+ return false;
2929
+ }
2930
+ }
2931
+
2932
+ if (errorEl) {
2933
+ errorEl.innerHTML = '';
2934
+ }
2935
+
2936
+ if (inputContainerEl) {
2937
+ inputContainerEl.classList.remove('websy-form-input-has-error');
2938
+ }
2939
+
2940
+ return true;
2941
+ }
2756
2942
  }, {
2757
2943
  key: "validateRecaptcha",
2758
2944
  value: function validateRecaptcha(token) {
@@ -2770,27 +2956,29 @@ var WebsyForm = /*#__PURE__*/function () {
2770
2956
  return data;
2771
2957
  },
2772
2958
  set: function set(d) {
2773
- var _this19 = this;
2959
+ var _this20 = this;
2774
2960
 
2775
2961
  if (!this.options.fields) {
2776
2962
  this.options.fields = [];
2777
2963
  }
2778
2964
 
2779
2965
  var _loop = function _loop(key) {
2780
- _this19.options.fields.forEach(function (f) {
2966
+ _this20.options.fields.forEach(function (f) {
2781
2967
  if (f.field === key) {
2782
- f.value = d[key];
2783
- var el = document.getElementById("".concat(_this19.elementId, "_input_").concat(f.field));
2784
- el.value = f.value;
2968
+ _this20.setValue(key, d[key]); // f.value = d[key]
2969
+ // const el = document.getElementById(`${this.elementId}_input_${f.field}`)
2970
+ // if (el) {
2971
+ // el.value = f.value
2972
+ // }
2973
+
2785
2974
  }
2786
2975
  });
2787
2976
  };
2788
2977
 
2789
2978
  for (var key in d) {
2790
2979
  _loop(key);
2791
- }
2980
+ } // this.render()
2792
2981
 
2793
- this.render();
2794
2982
  }
2795
2983
  }]);
2796
2984
 
@@ -2849,17 +3037,20 @@ var WebsyLoadingDialog = /*#__PURE__*/function () {
2849
3037
  }
2850
3038
 
2851
3039
  var el = document.getElementById(this.elementId);
2852
- var html = "\n\t\t\t<div class='websy-loading-container ".concat((this.options.classes || []).join(' '), "'>\n\t\t\t\t<div class='websy-ripple'>\n\t\t\t\t\t<div></div>\n\t\t\t\t\t<div></div>\n\t\t\t\t</div>\n\t\t\t\t<h4>").concat(this.options.title || 'Loading...', "</h4>\n\t\t");
2853
3040
 
2854
- if (this.options.messages) {
2855
- for (var i = 0; i < this.options.messages.length; i++) {
2856
- html += "<p>".concat(this.options.messages[i], "</p>");
3041
+ if (el) {
3042
+ var html = "\n <div class='websy-loading-container ".concat((this.options.classes || []).join(' '), "'>\n <div class='websy-ripple'>\n <div></div>\n <div></div>\n </div>\n <h4>").concat(this.options.title || 'Loading...', "</h4>\n ");
3043
+
3044
+ if (this.options.messages) {
3045
+ for (var i = 0; i < this.options.messages.length; i++) {
3046
+ html += "<p>".concat(this.options.messages[i], "</p>");
3047
+ }
2857
3048
  }
2858
- }
2859
3049
 
2860
- html += "\n\t\t\t</div>\t\n ";
2861
- el.classList.add('loading');
2862
- el.innerHTML = html;
3050
+ html += "\n </div>\t\n ";
3051
+ el.classList.add('loading');
3052
+ el.innerHTML = html;
3053
+ }
2863
3054
  }
2864
3055
  }, {
2865
3056
  key: "show",
@@ -3105,7 +3296,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3105
3296
  }, {
3106
3297
  key: "handleSearch",
3107
3298
  value: function handleSearch(searchText) {
3108
- var _this20 = this;
3299
+ var _this21 = this;
3109
3300
 
3110
3301
  var el = document.getElementById(this.elementId); // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
3111
3302
 
@@ -3118,7 +3309,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3118
3309
  if (searchText && searchText.length > 1) {
3119
3310
  defaultMethod = 'add';
3120
3311
  visibleItems = lowestItems.filter(function (d) {
3121
- return d[_this20.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3312
+ return d[_this21.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3122
3313
  });
3123
3314
  } // hide everything
3124
3315
 
@@ -3346,7 +3537,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3346
3537
 
3347
3538
  var Pager = /*#__PURE__*/function () {
3348
3539
  function Pager(elementId, options) {
3349
- var _this21 = this;
3540
+ var _this22 = this;
3350
3541
 
3351
3542
  _classCallCheck(this, Pager);
3352
3543
 
@@ -3399,8 +3590,8 @@ var Pager = /*#__PURE__*/function () {
3399
3590
  allowClear: false,
3400
3591
  disableSearch: true,
3401
3592
  onItemSelected: function onItemSelected(selectedItem) {
3402
- if (_this21.options.onChangePageSize) {
3403
- _this21.options.onChangePageSize(selectedItem.value);
3593
+ if (_this22.options.onChangePageSize) {
3594
+ _this22.options.onChangePageSize(selectedItem.value);
3404
3595
  }
3405
3596
  }
3406
3597
  });
@@ -3424,13 +3615,13 @@ var Pager = /*#__PURE__*/function () {
3424
3615
  }, {
3425
3616
  key: "render",
3426
3617
  value: function render() {
3427
- var _this22 = this;
3618
+ var _this23 = this;
3428
3619
 
3429
3620
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3430
3621
 
3431
3622
  if (el) {
3432
3623
  var pages = this.options.pages.map(function (item, index) {
3433
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3624
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this23.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3434
3625
  });
3435
3626
  var startIndex = 0;
3436
3627
 
@@ -3498,58 +3689,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3498
3689
  _createClass(WebsyPDFButton, [{
3499
3690
  key: "handleClick",
3500
3691
  value: function handleClick(event) {
3501
- var _this23 = this;
3692
+ var _this24 = this;
3502
3693
 
3503
3694
  if (event.target.classList.contains('websy-pdf-button')) {
3504
3695
  this.loader.show();
3505
3696
  setTimeout(function () {
3506
- if (_this23.options.targetId) {
3507
- var el = document.getElementById(_this23.options.targetId);
3697
+ if (_this24.options.targetId) {
3698
+ var el = document.getElementById(_this24.options.targetId);
3508
3699
 
3509
3700
  if (el) {
3510
3701
  var pdfData = {
3511
3702
  options: {}
3512
3703
  };
3513
3704
 
3514
- if (_this23.options.pdfOptions) {
3515
- pdfData.options = _extends({}, _this23.options.pdfOptions);
3705
+ if (_this24.options.pdfOptions) {
3706
+ pdfData.options = _extends({}, _this24.options.pdfOptions);
3516
3707
  }
3517
3708
 
3518
- if (_this23.options.header) {
3519
- if (_this23.options.header.elementId) {
3520
- var headerEl = document.getElementById(_this23.options.header.elementId);
3709
+ if (_this24.options.header) {
3710
+ if (_this24.options.header.elementId) {
3711
+ var headerEl = document.getElementById(_this24.options.header.elementId);
3521
3712
 
3522
3713
  if (headerEl) {
3523
3714
  pdfData.header = headerEl.outerHTML;
3524
3715
 
3525
- if (_this23.options.header.css) {
3526
- pdfData.options.headerCSS = _this23.options.header.css;
3716
+ if (_this24.options.header.css) {
3717
+ pdfData.options.headerCSS = _this24.options.header.css;
3527
3718
  }
3528
3719
  }
3529
- } else if (_this23.options.header.html) {
3530
- pdfData.header = _this23.options.header.html;
3720
+ } else if (_this24.options.header.html) {
3721
+ pdfData.header = _this24.options.header.html;
3531
3722
 
3532
- if (_this23.options.header.css) {
3533
- pdfData.options.headerCSS = _this23.options.header.css;
3723
+ if (_this24.options.header.css) {
3724
+ pdfData.options.headerCSS = _this24.options.header.css;
3534
3725
  }
3535
3726
  } else {
3536
- pdfData.header = _this23.options.header;
3727
+ pdfData.header = _this24.options.header;
3537
3728
  }
3538
3729
  }
3539
3730
 
3540
- if (_this23.options.footer) {
3541
- if (_this23.options.footer.elementId) {
3542
- var footerEl = document.getElementById(_this23.options.footer.elementId);
3731
+ if (_this24.options.footer) {
3732
+ if (_this24.options.footer.elementId) {
3733
+ var footerEl = document.getElementById(_this24.options.footer.elementId);
3543
3734
 
3544
3735
  if (footerEl) {
3545
3736
  pdfData.footer = footerEl.outerHTML;
3546
3737
 
3547
- if (_this23.options.footer.css) {
3548
- pdfData.options.footerCSS = _this23.options.footer.css;
3738
+ if (_this24.options.footer.css) {
3739
+ pdfData.options.footerCSS = _this24.options.footer.css;
3549
3740
  }
3550
3741
  }
3551
3742
  } else {
3552
- pdfData.footer = _this23.options.footer;
3743
+ pdfData.footer = _this24.options.footer;
3553
3744
  }
3554
3745
  }
3555
3746
 
@@ -3558,31 +3749,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3558
3749
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3559
3750
  // document.getElementById(`${this.elementId}_form`).submit()
3560
3751
 
3561
- _this23.service.add('', pdfData, {
3752
+ _this24.service.add('', pdfData, {
3562
3753
  responseType: 'blob'
3563
3754
  }).then(function (response) {
3564
- _this23.loader.hide();
3755
+ _this24.loader.hide();
3565
3756
 
3566
3757
  var blob = new Blob([response], {
3567
3758
  type: 'application/pdf'
3568
3759
  });
3569
3760
  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 ");
3570
3761
 
3571
- if (_this23.options.directDownload === true) {
3762
+ if (_this24.options.directDownload === true) {
3572
3763
  var fileName;
3573
3764
 
3574
- if (typeof _this23.options.fileName === 'function') {
3575
- fileName = _this23.options.fileName() || 'Export';
3765
+ if (typeof _this24.options.fileName === 'function') {
3766
+ fileName = _this24.options.fileName() || 'Export';
3576
3767
  } else {
3577
- fileName = _this23.options.fileName || 'Export';
3768
+ fileName = _this24.options.fileName || 'Export';
3578
3769
  }
3579
3770
 
3580
3771
  msg += "download='".concat(fileName, ".pdf'");
3581
3772
  }
3582
3773
 
3583
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this23.options.buttonText, "</button>\n </a>\n </div>\n ");
3774
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this24.options.buttonText, "</button>\n </a>\n </div>\n ");
3584
3775
 
3585
- _this23.popup.show({
3776
+ _this24.popup.show({
3586
3777
  message: msg,
3587
3778
  mask: true
3588
3779
  });
@@ -3783,7 +3974,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3783
3974
 
3784
3975
  var ResponsiveText = /*#__PURE__*/function () {
3785
3976
  function ResponsiveText(elementId, options) {
3786
- var _this24 = this;
3977
+ var _this25 = this;
3787
3978
 
3788
3979
  _classCallCheck(this, ResponsiveText);
3789
3980
 
@@ -3796,7 +3987,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3796
3987
  this.elementId = elementId;
3797
3988
  this.canvas = document.createElement('canvas');
3798
3989
  window.addEventListener('resize', function () {
3799
- return _this24.render();
3990
+ return _this25.render();
3800
3991
  });
3801
3992
  var el = document.getElementById(this.elementId);
3802
3993
 
@@ -4015,7 +4206,7 @@ var ResponsiveText = /*#__PURE__*/function () {
4015
4206
 
4016
4207
  var WebsyResultList = /*#__PURE__*/function () {
4017
4208
  function WebsyResultList(elementId, options) {
4018
- var _this25 = this;
4209
+ var _this26 = this;
4019
4210
 
4020
4211
  _classCallCheck(this, WebsyResultList);
4021
4212
 
@@ -4047,9 +4238,9 @@ var WebsyResultList = /*#__PURE__*/function () {
4047
4238
 
4048
4239
  if (_typeof(options.template) === 'object' && options.template.url) {
4049
4240
  this.templateService.get(options.template.url).then(function (templateString) {
4050
- _this25.options.template = templateString;
4241
+ _this26.options.template = templateString;
4051
4242
 
4052
- _this25.render();
4243
+ _this26.render();
4053
4244
  });
4054
4245
  } else {
4055
4246
  this.render();
@@ -4069,7 +4260,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4069
4260
  }, {
4070
4261
  key: "buildHTML",
4071
4262
  value: function buildHTML(d) {
4072
- var _this26 = this;
4263
+ var _this27 = this;
4073
4264
 
4074
4265
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4075
4266
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
@@ -4079,7 +4270,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4079
4270
  if (this.options.template) {
4080
4271
  if (d.length > 0) {
4081
4272
  d.forEach(function (row, ix) {
4082
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this26.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
4273
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this27.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
4083
4274
 
4084
4275
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
4085
4276
 
@@ -4184,7 +4375,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4184
4375
  parts.forEach(function (p) {
4185
4376
  items = items[p];
4186
4377
  });
4187
- template = template.replace(m[0], _this26.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4378
+ template = template.replace(m[0], _this27.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4188
4379
  }
4189
4380
  });
4190
4381
 
@@ -4196,7 +4387,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4196
4387
  }
4197
4388
  });
4198
4389
 
4199
- var flatRow = _this26.flattenObject(row);
4390
+ var flatRow = _this27.flattenObject(row);
4200
4391
 
4201
4392
  for (var key in flatRow) {
4202
4393
  var rg = new RegExp("{".concat(key, "}"), 'gm');
@@ -4331,13 +4522,13 @@ var WebsyResultList = /*#__PURE__*/function () {
4331
4522
  }, {
4332
4523
  key: "render",
4333
4524
  value: function render() {
4334
- var _this27 = this;
4525
+ var _this28 = this;
4335
4526
 
4336
4527
  if (this.options.entity) {
4337
4528
  this.apiService.get(this.options.entity).then(function (results) {
4338
- _this27.rows = results.rows;
4529
+ _this28.rows = results.rows;
4339
4530
 
4340
- _this27.resize();
4531
+ _this28.resize();
4341
4532
  });
4342
4533
  } else {
4343
4534
  this.resize();
@@ -4423,14 +4614,14 @@ var WebsyRouter = /*#__PURE__*/function () {
4423
4614
  _createClass(WebsyRouter, [{
4424
4615
  key: "addGroup",
4425
4616
  value: function addGroup(group) {
4426
- var _this28 = this;
4617
+ var _this29 = this;
4427
4618
 
4428
4619
  if (!this.groups[group]) {
4429
4620
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4430
4621
 
4431
4622
  if (els) {
4432
4623
  this.getClosestParent(els[0], function (parent) {
4433
- _this28.groups[group] = {
4624
+ _this29.groups[group] = {
4434
4625
  activeView: '',
4435
4626
  views: [],
4436
4627
  parent: parent.getAttribute('data-view')
@@ -4475,6 +4666,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4475
4666
  path = this.buildUrlPath(output.items);
4476
4667
  }
4477
4668
 
4669
+ output.path = path;
4478
4670
  this.currentParams = output;
4479
4671
  var inputPath = this.currentView;
4480
4672
 
@@ -4488,26 +4680,24 @@ var WebsyRouter = /*#__PURE__*/function () {
4488
4680
  if (reloadView === true) {
4489
4681
  // this.showView(this.currentView, this.currentParams, 'main')
4490
4682
  this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
4683
+ } else {
4684
+ this.updateHistory(inputPath, !noHistory, true);
4491
4685
  }
4492
4686
  }
4493
4687
  }, {
4494
4688
  key: "removeUrlParams",
4495
4689
  value: function removeUrlParams() {
4496
- var _this29 = this;
4690
+ var _this30 = this;
4497
4691
 
4498
4692
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4499
4693
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4500
4694
  var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4501
4695
  this.previousParams = _extends({}, this.currentParams);
4502
- var output = {
4503
- path: '',
4504
- items: {}
4505
- };
4506
4696
  var path = '';
4507
4697
 
4508
4698
  if (this.currentParams && this.currentParams.items) {
4509
4699
  params.forEach(function (p) {
4510
- delete _this29.currentParams.items[p];
4700
+ delete _this30.currentParams.items[p];
4511
4701
  });
4512
4702
  path = this.buildUrlPath(this.currentParams.items);
4513
4703
  }
@@ -4521,6 +4711,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4521
4711
  if (reloadView === true) {
4522
4712
  // this.showView(this.currentView, this.currentParams, 'main')
4523
4713
  this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
4714
+ } else if (noHistory === false) {
4715
+ this.currentParams = {
4716
+ items: this.currentParams.items,
4717
+ path: path
4718
+ };
4719
+ this.updateHistory(inputPath, !noHistory, true);
4524
4720
  }
4525
4721
  }
4526
4722
  }, {
@@ -4547,9 +4743,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4547
4743
  if (reloadView === true) {
4548
4744
  this.navigate("".concat(inputPath), 'main', null, noHistory);
4549
4745
  } else {
4550
- history.replaceState({
4551
- inputPath: inputPath
4552
- }, 'unused', inputPath);
4746
+ this.updateHistory(inputPath, !noHistory, true);
4553
4747
  }
4554
4748
  }
4555
4749
  }, {
@@ -4875,12 +5069,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4875
5069
  }, {
4876
5070
  key: "showComponents",
4877
5071
  value: function showComponents(view) {
4878
- var _this30 = this;
5072
+ var _this31 = this;
4879
5073
 
4880
5074
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4881
5075
  this.options.views[view].components.forEach(function (c) {
4882
5076
  if (typeof c.instance === 'undefined') {
4883
- _this30.prepComponent(c.elementId, c.options);
5077
+ _this31.prepComponent(c.elementId, c.options);
4884
5078
 
4885
5079
  c.instance = new c.Component(c.elementId, c.options);
4886
5080
  } else if (c.instance.render) {
@@ -5047,29 +5241,7 @@ var WebsyRouter = /*#__PURE__*/function () {
5047
5241
 
5048
5242
  if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
5049
5243
  var historyUrl = inputPath;
5050
-
5051
- if (this.options.urlPrefix) {
5052
- historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
5053
- inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
5054
- historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
5055
- inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
5056
- }
5057
-
5058
- if (this.currentParams && this.currentParams.path) {
5059
- historyUrl += "?".concat(this.currentParams.path);
5060
- } else if (this.queryParams && this.options.persistentParameters === true) {
5061
- historyUrl += "?".concat(this.queryParams);
5062
- }
5063
-
5064
- if (popped === false) {
5065
- history.pushState({
5066
- inputPath: historyUrl
5067
- }, 'unused', historyUrl);
5068
- } else {
5069
- history.replaceState({
5070
- inputPath: historyUrl
5071
- }, 'unused', historyUrl);
5072
- }
5244
+ this.updateHistory(historyUrl, popped);
5073
5245
  }
5074
5246
 
5075
5247
  if (toggle === false) {
@@ -5111,6 +5283,33 @@ var WebsyRouter = /*#__PURE__*/function () {
5111
5283
  item.apply(null, params);
5112
5284
  });
5113
5285
  }
5286
+ }, {
5287
+ key: "updateHistory",
5288
+ value: function updateHistory(historyUrl) {
5289
+ var replaceState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5290
+ var overridePersistent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5291
+
5292
+ if (this.options.urlPrefix) {
5293
+ historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
5294
+ historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
5295
+ }
5296
+
5297
+ if (this.currentParams && this.currentParams.path || overridePersistent === true) {
5298
+ historyUrl += "?".concat(this.currentParams.path);
5299
+ } else if (this.queryParams && this.options.persistentParameters === true) {
5300
+ historyUrl += "?".concat(this.queryParams);
5301
+ }
5302
+
5303
+ if (replaceState === false) {
5304
+ history.pushState({
5305
+ inputPath: historyUrl
5306
+ }, 'unused', historyUrl);
5307
+ } else {
5308
+ history.replaceState({
5309
+ inputPath: historyUrl
5310
+ }, 'unused', historyUrl);
5311
+ }
5312
+ }
5114
5313
  }, {
5115
5314
  key: "subscribe",
5116
5315
  value: function subscribe(event, fn) {
@@ -5242,7 +5441,7 @@ var WebsySearch = /*#__PURE__*/function () {
5242
5441
  }, {
5243
5442
  key: "handleKeyUp",
5244
5443
  value: function handleKeyUp(event) {
5245
- var _this31 = this;
5444
+ var _this32 = this;
5246
5445
 
5247
5446
  if (event.target.classList.contains('websy-search-input')) {
5248
5447
  if (this.searchTimeoutFn) {
@@ -5265,8 +5464,8 @@ var WebsySearch = /*#__PURE__*/function () {
5265
5464
 
5266
5465
  if (event.target.value.length >= this.options.minLength) {
5267
5466
  this.searchTimeoutFn = setTimeout(function () {
5268
- if (_this31.options.onSearch) {
5269
- _this31.options.onSearch(event.target.value, event);
5467
+ if (_this32.options.onSearch) {
5468
+ _this32.options.onSearch(event.target.value, event);
5270
5469
  }
5271
5470
  }, this.options.searchTimeout);
5272
5471
  } else {
@@ -5437,7 +5636,7 @@ var Switch = /*#__PURE__*/function () {
5437
5636
 
5438
5637
  var WebsyTemplate = /*#__PURE__*/function () {
5439
5638
  function WebsyTemplate(elementId, options) {
5440
- var _this32 = this;
5639
+ var _this33 = this;
5441
5640
 
5442
5641
  _classCallCheck(this, WebsyTemplate);
5443
5642
 
@@ -5463,9 +5662,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
5463
5662
 
5464
5663
  if (_typeof(options.template) === 'object' && options.template.url) {
5465
5664
  this.templateService.get(options.template.url).then(function (templateString) {
5466
- _this32.options.template = templateString;
5665
+ _this33.options.template = templateString;
5467
5666
 
5468
- _this32.render();
5667
+ _this33.render();
5469
5668
  });
5470
5669
  } else {
5471
5670
  this.render();
@@ -5475,7 +5674,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5475
5674
  _createClass(WebsyTemplate, [{
5476
5675
  key: "buildHTML",
5477
5676
  value: function buildHTML() {
5478
- var _this33 = this;
5677
+ var _this34 = this;
5479
5678
 
5480
5679
  var html = "";
5481
5680
 
@@ -5537,14 +5736,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5537
5736
  }
5538
5737
 
5539
5738
  if (polarity === true) {
5540
- if (typeof _this33.options.data[parts[0]] !== 'undefined' && _this33.options.data[parts[0]] === parts[1]) {
5739
+ if (typeof _this34.options.data[parts[0]] !== 'undefined' && _this34.options.data[parts[0]] === parts[1]) {
5541
5740
  // remove the <if> tags
5542
5741
  removeAll = false;
5543
5742
  } else if (parts[0] === parts[1]) {
5544
5743
  removeAll = false;
5545
5744
  }
5546
5745
  } else if (polarity === false) {
5547
- if (typeof _this33.options.data[parts[0]] !== 'undefined' && _this33.options.data[parts[0]] !== parts[1]) {
5746
+ if (typeof _this34.options.data[parts[0]] !== 'undefined' && _this34.options.data[parts[0]] !== parts[1]) {
5548
5747
  // remove the <if> tags
5549
5748
  removeAll = false;
5550
5749
  }
@@ -5837,7 +6036,7 @@ var WebsyUtils = {
5837
6036
 
5838
6037
  var WebsyTable = /*#__PURE__*/function () {
5839
6038
  function WebsyTable(elementId, options) {
5840
- var _this34 = this;
6039
+ var _this35 = this;
5841
6040
 
5842
6041
  _classCallCheck(this, WebsyTable);
5843
6042
 
@@ -5875,8 +6074,8 @@ var WebsyTable = /*#__PURE__*/function () {
5875
6074
  allowClear: false,
5876
6075
  disableSearch: true,
5877
6076
  onItemSelected: function onItemSelected(selectedItem) {
5878
- if (_this34.options.onChangePageSize) {
5879
- _this34.options.onChangePageSize(selectedItem.value);
6077
+ if (_this35.options.onChangePageSize) {
6078
+ _this35.options.onChangePageSize(selectedItem.value);
5880
6079
  }
5881
6080
  }
5882
6081
  });
@@ -5897,7 +6096,7 @@ var WebsyTable = /*#__PURE__*/function () {
5897
6096
  _createClass(WebsyTable, [{
5898
6097
  key: "appendRows",
5899
6098
  value: function appendRows(data) {
5900
- var _this35 = this;
6099
+ var _this36 = this;
5901
6100
 
5902
6101
  this.hideError();
5903
6102
  var bodyHTML = '';
@@ -5905,15 +6104,15 @@ var WebsyTable = /*#__PURE__*/function () {
5905
6104
  if (data) {
5906
6105
  bodyHTML += data.map(function (r, rowIndex) {
5907
6106
  return '<tr>' + r.map(function (c, i) {
5908
- if (_this35.options.columns[i].show !== false) {
6107
+ if (_this36.options.columns[i].show !== false) {
5909
6108
  var style = '';
5910
6109
 
5911
6110
  if (c.style) {
5912
6111
  style += c.style;
5913
6112
  }
5914
6113
 
5915
- if (_this35.options.columns[i].width) {
5916
- style += "width: ".concat(_this35.options.columns[i].width, "; ");
6114
+ if (_this36.options.columns[i].width) {
6115
+ style += "width: ".concat(_this36.options.columns[i].width, "; ");
5917
6116
  }
5918
6117
 
5919
6118
  if (c.backgroundColor) {
@@ -5928,18 +6127,18 @@ var WebsyTable = /*#__PURE__*/function () {
5928
6127
  style += "color: ".concat(c.color, "; ");
5929
6128
  }
5930
6129
 
5931
- if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5932
- 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 ");
5933
- } else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5934
- 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 ");
6130
+ if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6131
+ return "\n <td \n data-row-index='".concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.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(_this36.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6132
+ } else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6133
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this36.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this36.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</td>\n ");
5935
6134
  } else {
5936
6135
  var info = c.value;
5937
6136
 
5938
- if (_this35.options.columns[i].showAsImage === true) {
6137
+ if (_this36.options.columns[i].showAsImage === true) {
5939
6138
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5940
6139
  }
5941
6140
 
5942
- 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 ");
6141
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.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 ");
5943
6142
  }
5944
6143
  }
5945
6144
  }).join('') + '</tr>';
@@ -6111,7 +6310,7 @@ var WebsyTable = /*#__PURE__*/function () {
6111
6310
  }, {
6112
6311
  key: "render",
6113
6312
  value: function render(data) {
6114
- var _this36 = this;
6313
+ var _this37 = this;
6115
6314
 
6116
6315
  if (!this.options.columns) {
6117
6316
  return;
@@ -6146,7 +6345,7 @@ var WebsyTable = /*#__PURE__*/function () {
6146
6345
  style += "width: ".concat(c.width || 'auto', ";");
6147
6346
  }
6148
6347
 
6149
- 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 ");
6348
+ 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 ? _this37.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6150
6349
  }
6151
6350
  }).join('') + '</tr>';
6152
6351
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6165,7 +6364,7 @@ var WebsyTable = /*#__PURE__*/function () {
6165
6364
 
6166
6365
  if (pagingEl) {
6167
6366
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6168
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6367
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6169
6368
  });
6170
6369
  var startIndex = 0;
6171
6370
 
@@ -6233,7 +6432,7 @@ var WebsyTable = /*#__PURE__*/function () {
6233
6432
 
6234
6433
  var WebsyTable2 = /*#__PURE__*/function () {
6235
6434
  function WebsyTable2(elementId, options) {
6236
- var _this37 = this;
6435
+ var _this38 = this;
6237
6436
 
6238
6437
  _classCallCheck(this, WebsyTable2);
6239
6438
 
@@ -6274,8 +6473,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
6274
6473
  allowClear: false,
6275
6474
  disableSearch: true,
6276
6475
  onItemSelected: function onItemSelected(selectedItem) {
6277
- if (_this37.options.onChangePageSize) {
6278
- _this37.options.onChangePageSize(selectedItem.value);
6476
+ if (_this38.options.onChangePageSize) {
6477
+ _this38.options.onChangePageSize(selectedItem.value);
6279
6478
  }
6280
6479
  }
6281
6480
  });
@@ -6299,7 +6498,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6299
6498
  _createClass(WebsyTable2, [{
6300
6499
  key: "appendRows",
6301
6500
  value: function appendRows(data) {
6302
- var _this38 = this;
6501
+ var _this39 = this;
6303
6502
 
6304
6503
  this.hideError();
6305
6504
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -6308,15 +6507,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
6308
6507
  if (data) {
6309
6508
  bodyHTML += data.map(function (r, rowIndex) {
6310
6509
  return '<tr>' + r.map(function (c, i) {
6311
- if (_this38.options.columns[i].show !== false) {
6312
- var style = "height: ".concat(_this38.options.cellSize, "px; line-height: ").concat(_this38.options.cellSize, "px;");
6510
+ if (_this39.options.columns[i].show !== false) {
6511
+ var style = "height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px;");
6313
6512
 
6314
6513
  if (c.style) {
6315
6514
  style += c.style;
6316
6515
  }
6317
6516
 
6318
- if (_this38.options.columns[i].width) {
6319
- style += "width: ".concat(_this38.options.columns[i].width, "; ");
6517
+ if (_this39.options.columns[i].width) {
6518
+ style += "width: ".concat(_this39.options.columns[i].width, "; ");
6320
6519
  }
6321
6520
 
6322
6521
  if (c.backgroundColor) {
@@ -6331,18 +6530,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
6331
6530
  style += "color: ".concat(c.color, "; ");
6332
6531
  }
6333
6532
 
6334
- if (_this38.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6335
- 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 ");
6336
- } else if ((_this38.options.columns[i].showAsNavigatorLink === true || _this38.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6337
- 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 ");
6533
+ if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6534
+ return "\n <td \n data-row-index='".concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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(_this39.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6535
+ } else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6536
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this39.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</td>\n ");
6338
6537
  } else {
6339
6538
  var info = c.value;
6340
6539
 
6341
- if (_this38.options.columns[i].showAsImage === true) {
6540
+ if (_this39.options.columns[i].showAsImage === true) {
6342
6541
  c.value = "\n <img src='".concat(c.value, "'>\n ");
6343
6542
  }
6344
6543
 
6345
- 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 ");
6544
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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 ");
6346
6545
  }
6347
6546
  }
6348
6547
  }).join('') + '</tr>';
@@ -6605,7 +6804,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6605
6804
  }, {
6606
6805
  key: "render",
6607
6806
  value: function render(data) {
6608
- var _this39 = this;
6807
+ var _this40 = this;
6609
6808
 
6610
6809
  if (!this.options.columns) {
6611
6810
  return;
@@ -6641,7 +6840,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6641
6840
  style += "width: ".concat(c.width || 'auto', "; ");
6642
6841
  }
6643
6842
 
6644
- 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 ");
6843
+ 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 ? _this40.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6645
6844
  }
6646
6845
  }).join('') + '</tr>';
6647
6846
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6652,7 +6851,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6652
6851
  var dropdownHTML = "";
6653
6852
  this.options.columns.forEach(function (c, i) {
6654
6853
  if (c.searchable && c.searchField) {
6655
- dropdownHTML += "\n <div id=\"".concat(_this39.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6854
+ dropdownHTML += "\n <div id=\"".concat(_this40.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6656
6855
  }
6657
6856
  });
6658
6857
  dropdownEl.innerHTML = dropdownHTML;
@@ -6674,7 +6873,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6674
6873
 
6675
6874
  if (pagingEl) {
6676
6875
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6677
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this39.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6876
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6678
6877
  });
6679
6878
  var startIndex = 0;
6680
6879
 
@@ -6765,7 +6964,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6765
6964
  }, {
6766
6965
  key: "getColumnParameters",
6767
6966
  value: function getColumnParameters(values) {
6768
- var _this40 = this;
6967
+ var _this41 = this;
6769
6968
 
6770
6969
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6771
6970
  tableEl.style.tableLayout = 'auto';
@@ -6773,10 +6972,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
6773
6972
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6774
6973
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6775
6974
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6776
- 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 ");
6975
+ 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 ? _this41.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6777
6976
  }).join('') + '</tr>';
6778
6977
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6779
- 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 ");
6978
+ return "\n <td \n style='height: ".concat(_this41.options.cellSize, "px; line-height: ").concat(_this41.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6780
6979
  }).join('') + '</tr>'; // get height of the first data cell
6781
6980
 
6782
6981
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6907,7 +7106,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6907
7106
  }, {
6908
7107
  key: "buildBodyHtml",
6909
7108
  value: function buildBodyHtml() {
6910
- var _this41 = this;
7109
+ var _this42 = this;
6911
7110
 
6912
7111
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6913
7112
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -6921,7 +7120,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6921
7120
  }
6922
7121
 
6923
7122
  var bodyHtml = "";
6924
- var sizingColumns = this.options.columns[this.options.columns.length - 1];
7123
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
7124
+ return c.show !== false;
7125
+ });
6925
7126
 
6926
7127
  if (useWidths === true) {
6927
7128
  bodyHtml += '<colgroup>';
@@ -6936,7 +7137,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6936
7137
  row.forEach(function (cell, cellIndex) {
6937
7138
  var sizeIndex = cell.level || cellIndex;
6938
7139
 
6939
- if (typeof sizingColumns[sizeIndex] === 'undefined') {
7140
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6940
7141
  return; // need to revisit this logic
6941
7142
  }
6942
7143
 
@@ -6970,7 +7171,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6970
7171
  } // console.log('rowspan', cell.rowspan)
6971
7172
 
6972
7173
 
6973
- 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) {
7174
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this42.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) {
6974
7175
  // bodyHtml += `
6975
7176
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6976
7177
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -6980,11 +7181,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6980
7181
  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 >");
6981
7182
 
6982
7183
  if (cell.expandable === true) {
6983
- 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>");
7184
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this42.options.plusIcon, "</i>");
6984
7185
  }
6985
7186
 
6986
7187
  if (cell.collapsable === true) {
6987
- 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>");
7188
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this42.options.minusIcon, "</i>");
6988
7189
  }
6989
7190
 
6990
7191
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
@@ -7009,7 +7210,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7009
7210
  }, {
7010
7211
  key: "buildHeaderHtml",
7011
7212
  value: function buildHeaderHtml() {
7012
- var _this42 = this;
7213
+ var _this43 = this;
7013
7214
 
7014
7215
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7015
7216
 
@@ -7018,7 +7219,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
7018
7219
  }
7019
7220
 
7020
7221
  var headerHtml = '';
7021
- var sizingColumns = this.options.columns[this.options.columns.length - 1];
7222
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
7223
+ return c.show !== false;
7224
+ });
7022
7225
 
7023
7226
  if (useWidths === true) {
7024
7227
  headerHtml += '<colgroup>';
@@ -7029,13 +7232,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
7029
7232
  }
7030
7233
 
7031
7234
  this.options.columns.forEach(function (row, rowIndex) {
7032
- if (useWidths === false && rowIndex !== _this42.options.columns.length - 1) {
7235
+ if (useWidths === false && rowIndex !== _this43.options.columns.length - 1) {
7033
7236
  // if we're calculating the size we only want to render the last row of column headers
7034
7237
  return;
7035
7238
  }
7036
7239
 
7037
7240
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
7038
- row.forEach(function (col, colIndex) {
7241
+ row.filter(function (c) {
7242
+ return c.show !== false;
7243
+ }).forEach(function (col, colIndex) {
7244
+ if (typeof sizingColumns[colIndex] === 'undefined' || sizingColumns[colIndex].show === false) {
7245
+ return; // need to revisit this logic
7246
+ }
7247
+
7039
7248
  var style = "width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important; ");
7040
7249
  var divStyle = style;
7041
7250
 
@@ -7048,25 +7257,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
7048
7257
  style += col.style;
7049
7258
  }
7050
7259
 
7051
- 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) {
7260
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this43.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) {
7052
7261
  // headerHtml += `
7053
7262
  // style='width: ${col.width || col.actualWidth}px'
7054
7263
  // width='${col.width || col.actualWidth}'
7055
7264
  // `
7056
7265
  // }
7057
7266
 
7058
- 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>");
7267
+ 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 ? _this43.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this43.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
7059
7268
  });
7060
7269
  headerHtml += "</tr>";
7061
7270
  });
7062
7271
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
7063
7272
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
7064
7273
  if (c.searchable && c.isExternalSearch === true) {
7065
- var testEl = document.getElementById("".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i));
7274
+ var testEl = document.getElementById("".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i));
7066
7275
 
7067
7276
  if (!testEl) {
7068
7277
  var newE = document.createElement('div');
7069
- newE.id = "".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i);
7278
+ newE.id = "".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i);
7070
7279
  newE.className = 'websy-modal-dropdown';
7071
7280
  dropdownEl.appendChild(newE);
7072
7281
  }
@@ -7089,7 +7298,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7089
7298
  }, {
7090
7299
  key: "buildTotalHtml",
7091
7300
  value: function buildTotalHtml() {
7092
- var _this43 = this;
7301
+ var _this44 = this;
7093
7302
 
7094
7303
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7095
7304
 
@@ -7097,12 +7306,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
7097
7306
  return '';
7098
7307
  }
7099
7308
 
7309
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
7310
+ return c.show !== false;
7311
+ });
7100
7312
  var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
7101
7313
  this.options.totals.forEach(function (col, colIndex) {
7314
+ if (typeof sizingColumns[colIndex] === 'undefined' || sizingColumns[colIndex].show === false) {
7315
+ return; // need to revisit this logic
7316
+ }
7317
+
7102
7318
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7103
7319
 
7104
7320
  if (useWidths === true) {
7105
- 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 ");
7321
+ totalHtml += "\n style='width: ".concat(_this44.options.columns[_this44.options.columns.length - 1][colIndex].width || _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
7106
7322
  }
7107
7323
 
7108
7324
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
@@ -7113,7 +7329,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7113
7329
  }, {
7114
7330
  key: "calculateSizes",
7115
7331
  value: function calculateSizes() {
7116
- var _this44 = this;
7332
+ var _this45 = this;
7117
7333
 
7118
7334
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7119
7335
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
@@ -7159,45 +7375,48 @@ var WebsyTable3 = /*#__PURE__*/function () {
7159
7375
  var totalWidth = 0;
7160
7376
  this.sizes.scrollableWidth = this.sizes.outer.width;
7161
7377
  var firstNonPinnedColumnWidth = 0;
7378
+ var columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(function (c) {
7379
+ return c.show !== false;
7380
+ });
7162
7381
  rows.forEach(function (row, rowIndex) {
7163
7382
  Array.from(row.children).forEach(function (col, colIndex) {
7164
7383
  var colSize = col.getBoundingClientRect();
7165
- _this44.sizes.cellHeight = colSize.height;
7384
+ _this45.sizes.cellHeight = colSize.height;
7166
7385
 
7167
- if (_this44.options.columns[_this44.options.columns.length - 1][colIndex]) {
7168
- if (!_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth) {
7169
- _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth = 0;
7386
+ if (columnsForSizing[colIndex]) {
7387
+ if (!columnsForSizing[colIndex].actualWidth) {
7388
+ columnsForSizing[colIndex].actualWidth = 0;
7170
7389
  }
7171
7390
 
7172
- _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);
7173
- _this44.options.columns[_this44.options.columns.length - 1][colIndex].cellHeight = colSize.height;
7391
+ columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth);
7392
+ columnsForSizing[colIndex].cellHeight = colSize.height;
7174
7393
 
7175
- if (colIndex >= _this44.pinnedColumns) {
7176
- firstNonPinnedColumnWidth = _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth;
7394
+ if (colIndex >= _this45.pinnedColumns) {
7395
+ firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
7177
7396
  }
7178
7397
  }
7179
7398
  });
7180
- });
7181
- this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
7182
- if (colIndex < _this44.pinnedColumns) {
7183
- _this44.sizes.scrollableWidth -= col.actualWidth;
7184
- }
7185
- });
7186
- this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
7399
+ }); // columnsForSizing.forEach((col, colIndex) => {
7400
+ // if (colIndex < this.pinnedColumns) {
7401
+ // this.sizes.scrollableWidth -= col.actualWidth
7402
+ // }
7403
+ // })
7404
+
7405
+ this.sizes.totalWidth = columnsForSizing.reduce(function (a, b) {
7187
7406
  return a + (b.width || b.actualWidth);
7188
7407
  }, 0);
7189
- this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
7190
- return i >= _this44.pinnedColumns;
7408
+ this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
7409
+ return i >= _this45.pinnedColumns;
7191
7410
  }).reduce(function (a, b) {
7192
7411
  return a + (b.width || b.actualWidth);
7193
7412
  }, 0);
7194
7413
  this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
7195
7414
 
7196
7415
  if (this.sizes.totalWidth < this.sizes.outer.width) {
7197
- var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length;
7416
+ var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / columnsForSizing.length;
7198
7417
  this.sizes.totalWidth = 0;
7199
7418
  this.sizes.totalNonPinnedWidth = 0;
7200
- this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
7419
+ columnsForSizing.forEach(function (c, i) {
7201
7420
  // if (!c.width) {
7202
7421
  // if (c.actualWidth < equalWidth) {
7203
7422
  // adjust the width
@@ -7208,10 +7427,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7208
7427
  c.actualWidth += equalWidth; // }
7209
7428
  // }
7210
7429
 
7211
- _this44.sizes.totalWidth += c.width || c.actualWidth;
7430
+ _this45.sizes.totalWidth += c.width || c.actualWidth;
7212
7431
 
7213
- if (i < _this44.pinnedColumns) {
7214
- _this44.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7432
+ if (i > _this45.pinnedColumns) {
7433
+ _this45.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7215
7434
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
7216
7435
 
7217
7436
  });
@@ -7220,20 +7439,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
7220
7439
 
7221
7440
  if (this.sizes.pinnedWidth > this.sizes.outer.width - firstNonPinnedColumnWidth) {
7222
7441
  this.sizes.totalWidth = 0;
7223
- var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth); // let colDiff = diff / this.pinnedColumns
7442
+ var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth);
7443
+ var oldPinnedWidth = this.sizes.pinnedWidth;
7444
+ this.sizes.pinnedWidth = 0; // let colDiff = diff / this.pinnedColumns
7224
7445
 
7225
- for (var i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
7446
+ for (var i = 0; i < columnsForSizing.length; i++) {
7226
7447
  if (i < this.pinnedColumns) {
7227
- var colDiff = this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth * diff;
7228
- this.options.columns[this.options.columns.length - 1][i].actualWidth -= colDiff;
7448
+ var colDiff = columnsForSizing[i].actualWidth / oldPinnedWidth * diff;
7449
+ columnsForSizing[i].actualWidth -= colDiff;
7450
+ this.sizes.pinnedWidth += columnsForSizing[i].actualWidth;
7229
7451
  }
7230
7452
 
7231
- this.sizes.totalWidth += this.options.columns[this.options.columns.length - 1][i].width || this.options.columns[this.options.columns.length - 1][i].actualWidth;
7453
+ this.sizes.totalWidth += columnsForSizing[i].width || columnsForSizing[i].actualWidth;
7232
7454
  }
7233
7455
  } // take the height of the last cell as the official height for data cells
7234
7456
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
7235
7457
 
7236
7458
 
7459
+ this.sizes.scrollableWidth = this.sizes.table.width - this.sizes.pinnedWidth;
7237
7460
  headEl.innerHTML = '';
7238
7461
  bodyEl.innerHTML = '';
7239
7462
  footerEl.innerHTML = '';
@@ -7274,7 +7497,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7274
7497
  }, {
7275
7498
  key: "createSample",
7276
7499
  value: function createSample(data) {
7277
- var _this45 = this;
7500
+ var _this46 = this;
7278
7501
 
7279
7502
  var output = [];
7280
7503
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
@@ -7286,7 +7509,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7286
7509
  var longest = '';
7287
7510
 
7288
7511
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
7289
- if (data[i].length === _this45.options.columns[_this45.options.columns.length - 1].length) {
7512
+ if (data[i].length === _this46.options.columns[_this46.options.columns.length - 1].length) {
7290
7513
  if (longest.length < data[i][colIndex].value.length) {
7291
7514
  longest = data[i][colIndex].value;
7292
7515
  }
@@ -7611,21 +7834,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
7611
7834
  this.endCol = 0;
7612
7835
 
7613
7836
  for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
7614
- cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth; // console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
7837
+ if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
7838
+ cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
7615
7839
 
7616
- if (actualLeft < cumulativeWidth) {
7617
- this.startCol = i;
7618
- break;
7840
+ if (actualLeft < cumulativeWidth) {
7841
+ this.startCol = i;
7842
+ break;
7843
+ }
7619
7844
  }
7620
7845
  }
7621
7846
 
7622
7847
  cumulativeWidth = 0;
7623
7848
 
7624
7849
  for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
7625
- cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
7850
+ if (this.options.allColumns[this.options.allColumns.length - 1][_i10].show !== false) {
7851
+ cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
7626
7852
 
7627
- if (cumulativeWidth < this.sizes.scrollableWidth) {
7628
- this.endCol = _i10;
7853
+ if (cumulativeWidth < this.sizes.scrollableWidth) {
7854
+ this.endCol = _i10;
7855
+ }
7629
7856
  }
7630
7857
  }
7631
7858
 
@@ -7714,7 +7941,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7714
7941
 
7715
7942
  var WebsyChart = /*#__PURE__*/function () {
7716
7943
  function WebsyChart(elementId, options) {
7717
- var _this46 = this;
7944
+ var _this47 = this;
7718
7945
 
7719
7946
  _classCallCheck(this, WebsyChart);
7720
7947
 
@@ -7774,7 +8001,7 @@ var WebsyChart = /*#__PURE__*/function () {
7774
8001
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7775
8002
  var xAxis = 'bottom';
7776
8003
 
7777
- if (_this46.options.orientation === 'horizontal') {
8004
+ if (_this47.options.orientation === 'horizontal') {
7778
8005
  xAxis = 'left';
7779
8006
  }
7780
8007
 
@@ -7785,13 +8012,13 @@ var WebsyChart = /*#__PURE__*/function () {
7785
8012
  xAxis += 'Axis';
7786
8013
  var output;
7787
8014
 
7788
- var width = _this46.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
8015
+ var width = _this47.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
7789
8016
 
7790
8017
 
7791
- for (var index = 0; index < _this46.customBottomRange.length; index++) {
7792
- if (input > _this46.customBottomRange[index]) {
7793
- if (_this46.customBottomRange[index + 1]) {
7794
- if (input < _this46.customBottomRange[index + 1]) {
8018
+ for (var index = 0; index < _this47.customBottomRange.length; index++) {
8019
+ if (input > _this47.customBottomRange[index]) {
8020
+ if (_this47.customBottomRange[index + 1]) {
8021
+ if (input < _this47.customBottomRange[index + 1]) {
7795
8022
  output = index;
7796
8023
  break;
7797
8024
  }
@@ -8029,10 +8256,10 @@ var WebsyChart = /*#__PURE__*/function () {
8029
8256
  }, {
8030
8257
  key: "handleEventMouseMove",
8031
8258
  value: function handleEventMouseMove(event, d) {
8032
- var _this47 = this;
8259
+ var _this48 = this;
8033
8260
 
8034
8261
  var bisectDate = d3.bisector(function (d) {
8035
- return _this47.parseX(d.x.value);
8262
+ return _this48.parseX(d.x.value);
8036
8263
  }).left;
8037
8264
 
8038
8265
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -8071,9 +8298,9 @@ var WebsyChart = /*#__PURE__*/function () {
8071
8298
  }
8072
8299
 
8073
8300
  this.options.data.series.forEach(function (s) {
8074
- if (_this47.options.data[xData].scale !== 'Time') {
8301
+ if (_this48.options.data[xData].scale !== 'Time') {
8075
8302
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
8076
- xPoint = _this47.customBottomRange[x0] + (_this47.customBottomRange[x0 + 1] - _this47.customBottomRange[x0]) / 2; // }
8303
+ xPoint = _this48.customBottomRange[x0] + (_this48.customBottomRange[x0 + 1] - _this48.customBottomRange[x0]) / 2; // }
8077
8304
  // else {
8078
8305
  // xPoint = this[xAxis](this.parseX(xLabel))
8079
8306
  // }
@@ -8096,13 +8323,13 @@ var WebsyChart = /*#__PURE__*/function () {
8096
8323
  var pointA = s.data[index - 1];
8097
8324
  var pointB = s.data[index];
8098
8325
 
8099
- if (_this47.options.orientation === 'horizontal') {
8326
+ if (_this48.options.orientation === 'horizontal') {
8100
8327
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
8101
8328
  pointB = _toConsumableArray(s.data).reverse()[index];
8102
8329
  }
8103
8330
 
8104
8331
  if (pointA && !pointB) {
8105
- xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
8332
+ xPoint = _this48[xAxis](_this48.parseX(pointA.x.value));
8106
8333
  tooltipTitle = pointA.x.value;
8107
8334
 
8108
8335
  if (!pointA.y.color) {
@@ -8112,12 +8339,12 @@ var WebsyChart = /*#__PURE__*/function () {
8112
8339
  tooltipData.push(pointA.y);
8113
8340
 
8114
8341
  if (typeof pointA.x.value.getTime !== 'undefined') {
8115
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointA.x.value);
8342
+ tooltipTitle = d3.timeFormat(_this48.options.dateFormat || _this48.options.calculatedTimeFormatPattern)(pointA.x.value);
8116
8343
  }
8117
8344
  }
8118
8345
 
8119
8346
  if (pointB && !pointA) {
8120
- xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
8347
+ xPoint = _this48[xAxis](_this48.parseX(pointB.x.value));
8121
8348
  tooltipTitle = pointB.x.value;
8122
8349
 
8123
8350
  if (!pointB.y.color) {
@@ -8127,14 +8354,14 @@ var WebsyChart = /*#__PURE__*/function () {
8127
8354
  tooltipData.push(pointB.y);
8128
8355
 
8129
8356
  if (typeof pointB.x.value.getTime !== 'undefined') {
8130
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
8357
+ tooltipTitle = d3.timeFormat(_this48.options.dateFormat || _this48.options.calculatedTimeFormatPattern)(pointB.x.value);
8131
8358
  }
8132
8359
  }
8133
8360
 
8134
8361
  if (pointA && pointB) {
8135
- var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
8362
+ var d0 = _this48[xAxis](_this48.parseX(pointA.x.value));
8136
8363
 
8137
- var d1 = _this47[xAxis](_this47.parseX(pointB.x.value));
8364
+ var d1 = _this48[xAxis](_this48.parseX(pointB.x.value));
8138
8365
 
8139
8366
  var mid = Math.abs(d0 - d1) / 2;
8140
8367
 
@@ -8143,7 +8370,7 @@ var WebsyChart = /*#__PURE__*/function () {
8143
8370
  tooltipTitle = pointB.x.value;
8144
8371
 
8145
8372
  if (typeof pointB.x.value.getTime !== 'undefined') {
8146
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
8373
+ tooltipTitle = d3.timeFormat(_this48.options.dateFormat || _this48.options.calculatedTimeFormatPattern)(pointB.x.value);
8147
8374
  }
8148
8375
 
8149
8376
  if (!pointB.y.color) {
@@ -8156,7 +8383,7 @@ var WebsyChart = /*#__PURE__*/function () {
8156
8383
  tooltipTitle = pointA.x.value;
8157
8384
 
8158
8385
  if (typeof pointB.x.value.getTime !== 'undefined') {
8159
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
8386
+ tooltipTitle = d3.timeFormat(_this48.options.dateFormat || _this48.options.calculatedTimeFormatPattern)(pointB.x.value);
8160
8387
  }
8161
8388
 
8162
8389
  if (!pointA.y.color) {
@@ -8289,7 +8516,7 @@ var WebsyChart = /*#__PURE__*/function () {
8289
8516
  }, {
8290
8517
  key: "render",
8291
8518
  value: function render(options) {
8292
- var _this48 = this;
8519
+ var _this49 = this;
8293
8520
 
8294
8521
  /* global d3 options WebsyUtils */
8295
8522
  if (typeof options !== 'undefined') {
@@ -8364,7 +8591,7 @@ var WebsyChart = /*#__PURE__*/function () {
8364
8591
  this.options.data.series.map(function (s, i) {
8365
8592
  return {
8366
8593
  value: s.label || s.key,
8367
- color: s.color || _this48.options.colors[i % _this48.options.colors.length]
8594
+ color: s.color || _this49.options.colors[i % _this49.options.colors.length]
8368
8595
  };
8369
8596
  });
8370
8597
  }
@@ -8738,28 +8965,28 @@ var WebsyChart = /*#__PURE__*/function () {
8738
8965
  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') {
8739
8966
  var acc = 0;
8740
8967
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8741
- var adjustment = _this48.bandPadding * index + _this48.bandPadding; // if (this.options.data.bottom.padding) {
8968
+ var adjustment = _this49.bandPadding * index + _this49.bandPadding; // if (this.options.data.bottom.padding) {
8742
8969
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8743
8970
  // }
8744
8971
 
8745
- var start = _this48.widthForCalc / noOfPoints * acc;
8972
+ var start = _this49.widthForCalc / noOfPoints * acc;
8746
8973
 
8747
8974
  for (var i = 0; i < (d.valueCount || 1); i++) {
8748
8975
  var pos = i * proposedBandWidth;
8749
8976
 
8750
- _this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8977
+ _this49["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8751
8978
  }
8752
8979
 
8753
- acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8754
- var end = _this48.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8980
+ acc += _this49.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8981
+ var end = _this49.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8755
8982
 
8756
8983
  return end + adjustment;
8757
8984
  })));
8758
8985
  acc = 0;
8759
8986
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8760
- var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
8761
- acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8762
- return (_this48.options.orientation === 'vertical' ? _this48.plotWidth : _this48.plotHeight) / noOfPoints * acc;
8987
+ var adjustment = _this49.brushBandPadding * index + _this49.brushBandPadding;
8988
+ acc += _this49.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8989
+ return (_this49.options.orientation === 'vertical' ? _this49.plotWidth : _this49.plotHeight) / noOfPoints * acc;
8763
8990
  })));
8764
8991
  } // }
8765
8992
 
@@ -8937,7 +9164,7 @@ var WebsyChart = /*#__PURE__*/function () {
8937
9164
 
8938
9165
  if (this.options.data.bottom.formatter) {
8939
9166
  this.bAxisFunc.tickFormat(function (d) {
8940
- return _this48.options.data.bottom.formatter(d);
9167
+ return _this49.options.data.bottom.formatter(d);
8941
9168
  });
8942
9169
  }
8943
9170
 
@@ -8949,7 +9176,7 @@ var WebsyChart = /*#__PURE__*/function () {
8949
9176
 
8950
9177
  if (this.customBottomRange.length > 0) {
8951
9178
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8952
- return "translate(".concat(_this48.customBottomRange[i] + (_this48.customBottomRange[i + 1] - _this48.customBottomRange[i]) / 2, ", 0)");
9179
+ return "translate(".concat(_this49.customBottomRange[i] + (_this49.customBottomRange[i + 1] - _this49.customBottomRange[i]) / 2, ", 0)");
8953
9180
  });
8954
9181
  }
8955
9182
  } // Configure the left axis
@@ -8971,8 +9198,8 @@ var WebsyChart = /*#__PURE__*/function () {
8971
9198
 
8972
9199
  if (this.options.margin.axisLeft > 0) {
8973
9200
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8974
- if (_this48.options.data.left.formatter) {
8975
- d = _this48.options.data.left.formatter(d);
9201
+ if (_this49.options.data.left.formatter) {
9202
+ d = _this49.options.data.left.formatter(d);
8976
9203
  }
8977
9204
 
8978
9205
  return d;
@@ -8980,7 +9207,7 @@ var WebsyChart = /*#__PURE__*/function () {
8980
9207
 
8981
9208
  if (this.customLeftRange.length > 0) {
8982
9209
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8983
- return "translate(0, ".concat(_this48.customLeftRange[i] + (_this48.customLeftRange[i + 1] - _this48.customLeftRange[i]) / 2, ")");
9210
+ return "translate(0, ".concat(_this49.customLeftRange[i] + (_this49.customLeftRange[i + 1] - _this49.customLeftRange[i]) / 2, ")");
8984
9211
  });
8985
9212
  }
8986
9213
  }
@@ -9013,8 +9240,8 @@ var WebsyChart = /*#__PURE__*/function () {
9013
9240
 
9014
9241
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
9015
9242
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
9016
- if (_this48.options.data.right.formatter) {
9017
- d = _this48.options.data.right.formatter(d);
9243
+ if (_this49.options.data.right.formatter) {
9244
+ d = _this49.options.data.right.formatter(d);
9018
9245
  }
9019
9246
 
9020
9247
  return d;
@@ -9060,57 +9287,57 @@ var WebsyChart = /*#__PURE__*/function () {
9060
9287
  }, {
9061
9288
  key: "renderComponents",
9062
9289
  value: function renderComponents() {
9063
- var _this49 = this;
9290
+ var _this50 = this;
9064
9291
 
9065
9292
  // Draw the series data
9066
9293
  this.renderedKeys = {};
9067
9294
  this.options.data.series.forEach(function (series, index) {
9068
9295
  if (!series.key) {
9069
- series.key = _this49.createIdentity();
9296
+ series.key = _this50.createIdentity();
9070
9297
  }
9071
9298
 
9072
9299
  if (!series.color) {
9073
- series.color = _this49.options.colors[index % _this49.options.colors.length];
9300
+ series.color = _this50.options.colors[index % _this50.options.colors.length];
9074
9301
  }
9075
9302
 
9076
- _this49["render".concat(series.type || 'bar')](series, index);
9303
+ _this50["render".concat(series.type || 'bar')](series, index);
9077
9304
 
9078
- _this49.renderLabels(series, index);
9305
+ _this50.renderLabels(series, index);
9079
9306
 
9080
- _this49.renderedKeys[series.key] = series.type;
9307
+ _this50.renderedKeys[series.key] = series.type;
9081
9308
  });
9082
9309
  this.refLineLayer.selectAll('.reference-line').remove();
9083
9310
  this.refLineLayer.selectAll('.reference-line-label').remove();
9084
9311
 
9085
9312
  if (this.options.refLines && this.options.refLines.length > 0) {
9086
9313
  this.options.refLines.forEach(function (l) {
9087
- return _this49.renderRefLine(l);
9314
+ return _this50.renderRefLine(l);
9088
9315
  });
9089
9316
  }
9090
9317
  }
9091
9318
  }, {
9092
9319
  key: "renderarea",
9093
9320
  value: function renderarea(series, index) {
9094
- var _this50 = this;
9321
+ var _this51 = this;
9095
9322
 
9096
9323
  /* global d3 series index */
9097
9324
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
9098
9325
  return d3.area().x(function (d) {
9099
9326
  // return this[`${xAxis}Axis`](this.parseX(d.x.value))
9100
- var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
9327
+ var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
9101
9328
 
9102
- var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9329
+ var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9103
9330
 
9104
- if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9105
- xPos = xPos + (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9331
+ if (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9332
+ xPos = xPos + (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9106
9333
  }
9107
9334
 
9108
9335
  return xPos;
9109
9336
  }).y0(function (d) {
9110
- return _this50["".concat(yAxis, "Axis")](0);
9337
+ return _this51["".concat(yAxis, "Axis")](0);
9111
9338
  }).y1(function (d) {
9112
- return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9113
- }).curve(d3[curveStyle || _this50.options.curveStyle]);
9339
+ return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9340
+ }).curve(d3[curveStyle || _this51.options.curveStyle]);
9114
9341
  };
9115
9342
 
9116
9343
  var xAxis = 'bottom';
@@ -9148,7 +9375,7 @@ var WebsyChart = /*#__PURE__*/function () {
9148
9375
  }, {
9149
9376
  key: "renderbar",
9150
9377
  value: function renderbar(series, index) {
9151
- var _this51 = this;
9378
+ var _this52 = this;
9152
9379
 
9153
9380
  /* global series index d3 */
9154
9381
  var xAxis = 'bottom';
@@ -9313,25 +9540,25 @@ var WebsyChart = /*#__PURE__*/function () {
9313
9540
 
9314
9541
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9315
9542
  bars.attr('width', function (d, i) {
9316
- return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9543
+ return Math.abs(getBarWidth.call(_this52, d, i, xAxis));
9317
9544
  }).attr('height', function (d, i) {
9318
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
9545
+ return getBarHeight.call(_this52, d, i, yAxis, xAxis);
9319
9546
  }).attr('x', function (d, i) {
9320
- return getBarX.call(_this51, d, i, xAxis);
9547
+ return getBarX.call(_this52, d, i, xAxis);
9321
9548
  }).attr('y', function (d, i) {
9322
- return getBarY.call(_this51, d, i, yAxis, xAxis);
9549
+ return getBarY.call(_this52, d, i, yAxis, xAxis);
9323
9550
  }) // .transition(this.transition)
9324
9551
  .attr('fill', function (d) {
9325
9552
  return d.y.color || d.color || series.color;
9326
9553
  });
9327
9554
  bars.enter().append('rect').attr('width', function (d, i) {
9328
- return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9555
+ return Math.abs(getBarWidth.call(_this52, d, i, xAxis));
9329
9556
  }).attr('height', function (d, i) {
9330
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
9557
+ return getBarHeight.call(_this52, d, i, yAxis, xAxis);
9331
9558
  }).attr('x', function (d, i) {
9332
- return getBarX.call(_this51, d, i, xAxis);
9559
+ return getBarX.call(_this52, d, i, xAxis);
9333
9560
  }).attr('y', function (d, i) {
9334
- return getBarY.call(_this51, d, i, yAxis, xAxis);
9561
+ return getBarY.call(_this52, d, i, yAxis, xAxis);
9335
9562
  }) // .transition(this.transition)
9336
9563
  .attr('fill', function (d) {
9337
9564
  return d.y.color || d.color || series.color;
@@ -9343,25 +9570,25 @@ var WebsyChart = /*#__PURE__*/function () {
9343
9570
  this.brushBarsInitialized[series.key] = true;
9344
9571
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9345
9572
  brushBars.attr('width', function (d, i) {
9346
- return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9573
+ return Math.abs(getBarWidth.call(_this52, d, i, "".concat(xAxis, "Brush")));
9347
9574
  }).attr('height', function (d, i) {
9348
- return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9575
+ return getBarHeight.call(_this52, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9349
9576
  }).attr('x', function (d, i) {
9350
- return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9577
+ return getBarX.call(_this52, d, i, "".concat(xAxis, "Brush"));
9351
9578
  }).attr('y', function (d, i) {
9352
- return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9579
+ return getBarY.call(_this52, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9353
9580
  }) // .transition(this.transition)
9354
9581
  .attr('fill', function (d) {
9355
9582
  return d.y.color || d.color || series.color;
9356
9583
  });
9357
9584
  brushBars.enter().append('rect').attr('width', function (d, i) {
9358
- return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9585
+ return Math.abs(getBarWidth.call(_this52, d, i, "".concat(xAxis, "Brush")));
9359
9586
  }).attr('height', function (d, i) {
9360
- return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9587
+ return getBarHeight.call(_this52, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9361
9588
  }).attr('x', function (d, i) {
9362
- return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9589
+ return getBarX.call(_this52, d, i, "".concat(xAxis, "Brush"));
9363
9590
  }).attr('y', function (d, i) {
9364
- return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9591
+ return getBarY.call(_this52, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9365
9592
  }) // .transition(this.transition)
9366
9593
  .attr('fill', function (d) {
9367
9594
  return d.y.color || d.color || series.color;
@@ -9379,7 +9606,7 @@ var WebsyChart = /*#__PURE__*/function () {
9379
9606
  }, {
9380
9607
  key: "renderLabels",
9381
9608
  value: function renderLabels(series, index) {
9382
- var _this52 = this;
9609
+ var _this53 = this;
9383
9610
 
9384
9611
  /* global series index d3 WebsyDesigns */
9385
9612
  var xAxis = 'bottom';
@@ -9398,15 +9625,15 @@ var WebsyChart = /*#__PURE__*/function () {
9398
9625
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
9399
9626
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
9400
9627
  labels.attr('x', function (d) {
9401
- return getLabelX.call(_this52, d, series.labelPosition);
9628
+ return getLabelX.call(_this53, d, series.labelPosition);
9402
9629
  }).attr('y', function (d) {
9403
- return getLabelY.call(_this52, d, series.labelPosition);
9630
+ return getLabelY.call(_this53, d, series.labelPosition);
9404
9631
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
9405
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
9632
+ if (_this53.options.grouping === 'stacked' && d.y.value === 0) {
9406
9633
  return 'transparent';
9407
9634
  }
9408
9635
 
9409
- return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9636
+ return _this53.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9410
9637
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
9411
9638
  return d.y.label || d.y.value;
9412
9639
  }).each(function (d, i) {
@@ -9431,15 +9658,15 @@ var WebsyChart = /*#__PURE__*/function () {
9431
9658
  }
9432
9659
  });
9433
9660
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9434
- return getLabelX.call(_this52, d, series.labelPosition);
9661
+ return getLabelX.call(_this53, d, series.labelPosition);
9435
9662
  }).attr('y', function (d) {
9436
- return getLabelY.call(_this52, d, series.labelPosition);
9663
+ return getLabelY.call(_this53, d, series.labelPosition);
9437
9664
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9438
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
9665
+ if (_this53.options.grouping === 'stacked' && d.y.value === 0) {
9439
9666
  return 'transparent';
9440
9667
  }
9441
9668
 
9442
- return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9669
+ return _this53.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9443
9670
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9444
9671
  return d.y.label || d.y.value;
9445
9672
  }).each(function (d, i) {
@@ -9517,20 +9744,20 @@ var WebsyChart = /*#__PURE__*/function () {
9517
9744
  }, {
9518
9745
  key: "renderline",
9519
9746
  value: function renderline(series, index) {
9520
- var _this53 = this;
9747
+ var _this54 = this;
9521
9748
 
9522
9749
  /* global series index d3 */
9523
9750
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9524
9751
  return d3.line().x(function (d) {
9525
- if (_this53.options.orientation === 'horizontal') {
9526
- return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9752
+ if (_this54.options.orientation === 'horizontal') {
9753
+ return _this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9527
9754
  } else {
9528
- var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
9755
+ var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9529
9756
 
9530
- var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9757
+ var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9531
9758
 
9532
- if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9533
- xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9759
+ if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9760
+ xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9534
9761
  } // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
9535
9762
  // return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
9536
9763
 
@@ -9538,13 +9765,13 @@ var WebsyChart = /*#__PURE__*/function () {
9538
9765
  return xPos;
9539
9766
  }
9540
9767
  }).y(function (d) {
9541
- if (_this53.options.orientation === 'horizontal') {
9542
- var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
9543
- return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment;
9768
+ if (_this54.options.orientation === 'horizontal') {
9769
+ var adjustment = _this54.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
9770
+ return _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value)) + adjustment;
9544
9771
  } else {
9545
- return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9772
+ return _this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9546
9773
  }
9547
- }).curve(d3[curveStyle || _this53.options.curveStyle]);
9774
+ }).curve(d3[curveStyle || _this54.options.curveStyle]);
9548
9775
  };
9549
9776
 
9550
9777
  var xAxis = 'bottom';
@@ -9658,14 +9885,14 @@ var WebsyChart = /*#__PURE__*/function () {
9658
9885
  }, {
9659
9886
  key: "rendersymbol",
9660
9887
  value: function rendersymbol(series, index) {
9661
- var _this54 = this;
9888
+ var _this55 = this;
9662
9889
 
9663
9890
  /* global d3 series index series.key */
9664
9891
  var drawSymbol = function drawSymbol(size) {
9665
9892
  return d3.symbol() // .type(d => {
9666
9893
  // return d3.symbols[0]
9667
9894
  // })
9668
- .size(size || _this54.options.symbolSize);
9895
+ .size(size || _this55.options.symbolSize);
9669
9896
  };
9670
9897
 
9671
9898
  var xAxis = 'bottom';
@@ -9690,21 +9917,21 @@ var WebsyChart = /*#__PURE__*/function () {
9690
9917
  // else {
9691
9918
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9692
9919
  // }
9693
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9920
+ var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
9694
9921
 
9695
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9922
+ var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9696
9923
 
9697
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9698
- xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9924
+ if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9925
+ xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9699
9926
  }
9700
9927
 
9701
- var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
9928
+ var adjustment = _this55.options.data[xAxis].scale === 'Time' || _this55.options.data[xAxis].scale === 'Linear' ? 0 : _this55.options.data[xAxis].bandWidth / 2;
9702
9929
 
9703
- if (_this54.options.orientation === 'horizontal') {
9704
- return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9930
+ if (_this55.options.orientation === 'horizontal') {
9931
+ return "translate(".concat(_this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9705
9932
  } else {
9706
9933
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9707
- return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9934
+ return "translate(".concat(xPos, ", ").concat(_this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9708
9935
  }
9709
9936
  }); // Enter
9710
9937
 
@@ -9714,21 +9941,21 @@ var WebsyChart = /*#__PURE__*/function () {
9714
9941
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
9715
9942
  return "symbol symbol_".concat(series.key);
9716
9943
  }).attr('transform', function (d) {
9717
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9944
+ var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
9718
9945
 
9719
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9946
+ var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9720
9947
 
9721
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9722
- xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9948
+ if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9949
+ xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9723
9950
  }
9724
9951
 
9725
- var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
9952
+ var adjustment = _this55.options.data[xAxis].scale === 'Time' || _this55.options.data[xAxis].scale === 'Linear' ? 0 : _this55.options.data[xAxis].bandWidth / 2;
9726
9953
 
9727
- if (_this54.options.orientation === 'horizontal') {
9728
- return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9954
+ if (_this55.options.orientation === 'horizontal') {
9955
+ return "translate(".concat(_this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9729
9956
  } else {
9730
9957
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9731
- return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9958
+ return "translate(".concat(xPos, ", ").concat(_this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9732
9959
  }
9733
9960
  });
9734
9961
  }
@@ -9950,7 +10177,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9950
10177
  }, {
9951
10178
  key: "resize",
9952
10179
  value: function resize() {
9953
- var _this55 = this;
10180
+ var _this56 = this;
9954
10181
 
9955
10182
  var el = document.getElementById(this.elementId);
9956
10183
 
@@ -9963,7 +10190,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9963
10190
  // }
9964
10191
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9965
10192
  html += this._data.map(function (d, i) {
9966
- return _this55.getLegendItemHTML(d);
10193
+ return _this56.getLegendItemHTML(d);
9967
10194
  }).join('');
9968
10195
  html += "\n <div>\n ";
9969
10196
  el.innerHTML = html;
@@ -10135,7 +10362,7 @@ var WebsyMap = /*#__PURE__*/function () {
10135
10362
  }, {
10136
10363
  key: "render",
10137
10364
  value: function render() {
10138
- var _this56 = this;
10365
+ var _this57 = this;
10139
10366
 
10140
10367
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
10141
10368
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -10144,7 +10371,7 @@ var WebsyMap = /*#__PURE__*/function () {
10144
10371
  var legendData = this.options.data.polygons.map(function (s, i) {
10145
10372
  return {
10146
10373
  value: s.label || s.key,
10147
- color: s.color || _this56.options.colors[i % _this56.options.colors.length]
10374
+ color: s.color || _this57.options.colors[i % _this57.options.colors.length]
10148
10375
  };
10149
10376
  });
10150
10377
  var longestValue = legendData.map(function (s) {
@@ -10208,7 +10435,7 @@ var WebsyMap = /*#__PURE__*/function () {
10208
10435
 
10209
10436
  if (this.polygons) {
10210
10437
  this.polygons.forEach(function (p) {
10211
- return _this56.map.removeLayer(p);
10438
+ return _this57.map.removeLayer(p);
10212
10439
  });
10213
10440
  }
10214
10441
 
@@ -10266,18 +10493,18 @@ var WebsyMap = /*#__PURE__*/function () {
10266
10493
  }
10267
10494
 
10268
10495
  if (!p.options.color) {
10269
- p.options.color = _this56.options.colors[i % _this56.options.colors.length];
10496
+ p.options.color = _this57.options.colors[i % _this57.options.colors.length];
10270
10497
  }
10271
10498
 
10272
10499
  var pol = L.polygon(p.data.map(function (c) {
10273
10500
  return c.map(function (d) {
10274
10501
  return [d.Latitude, d.Longitude];
10275
10502
  });
10276
- }), p.options).addTo(_this56.map);
10503
+ }), p.options).addTo(_this57.map);
10277
10504
 
10278
- _this56.polygons.push(pol);
10505
+ _this57.polygons.push(pol);
10279
10506
 
10280
- _this56.map.fitBounds(pol.getBounds());
10507
+ _this57.map.fitBounds(pol.getBounds());
10281
10508
  });
10282
10509
  } // if (this.data.markers.length > 0) {
10283
10510
  // el.classList.remove('hidden')