@websy/websy-designs 1.6.2 → 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) {
@@ -4892,6 +5086,10 @@ var WebsyRouter = /*#__PURE__*/function () {
4892
5086
  }, {
4893
5087
  key: "showView",
4894
5088
  value: function showView(view, params, group) {
5089
+ if (view === '/' || view === '') {
5090
+ view = this.options.defaultView || '';
5091
+ }
5092
+
4895
5093
  this.activateItem(view, this.options.triggerClass);
4896
5094
  this.activateItem(view, this.options.viewClass);
4897
5095
  var children = this.getActiveViewsFromParent(view);
@@ -5043,29 +5241,7 @@ var WebsyRouter = /*#__PURE__*/function () {
5043
5241
 
5044
5242
  if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
5045
5243
  var historyUrl = inputPath;
5046
-
5047
- if (this.options.urlPrefix) {
5048
- historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
5049
- inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
5050
- historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
5051
- inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
5052
- }
5053
-
5054
- if (this.currentParams && this.currentParams.path) {
5055
- historyUrl += "?".concat(this.currentParams.path);
5056
- } else if (this.queryParams && this.options.persistentParameters === true) {
5057
- historyUrl += "?".concat(this.queryParams);
5058
- }
5059
-
5060
- if (popped === false) {
5061
- history.pushState({
5062
- inputPath: historyUrl
5063
- }, 'unused', historyUrl);
5064
- } else {
5065
- history.replaceState({
5066
- inputPath: historyUrl
5067
- }, 'unused', historyUrl);
5068
- }
5244
+ this.updateHistory(historyUrl, popped);
5069
5245
  }
5070
5246
 
5071
5247
  if (toggle === false) {
@@ -5107,6 +5283,33 @@ var WebsyRouter = /*#__PURE__*/function () {
5107
5283
  item.apply(null, params);
5108
5284
  });
5109
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
+ }
5110
5313
  }, {
5111
5314
  key: "subscribe",
5112
5315
  value: function subscribe(event, fn) {
@@ -5238,7 +5441,7 @@ var WebsySearch = /*#__PURE__*/function () {
5238
5441
  }, {
5239
5442
  key: "handleKeyUp",
5240
5443
  value: function handleKeyUp(event) {
5241
- var _this31 = this;
5444
+ var _this32 = this;
5242
5445
 
5243
5446
  if (event.target.classList.contains('websy-search-input')) {
5244
5447
  if (this.searchTimeoutFn) {
@@ -5261,14 +5464,14 @@ var WebsySearch = /*#__PURE__*/function () {
5261
5464
 
5262
5465
  if (event.target.value.length >= this.options.minLength) {
5263
5466
  this.searchTimeoutFn = setTimeout(function () {
5264
- if (_this31.options.onSearch) {
5265
- _this31.options.onSearch(event.target.value);
5467
+ if (_this32.options.onSearch) {
5468
+ _this32.options.onSearch(event.target.value, event);
5266
5469
  }
5267
5470
  }, this.options.searchTimeout);
5268
5471
  } else {
5269
5472
  if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
5270
5473
  if (this.options.onSearch) {
5271
- this.options.onSearch('');
5474
+ this.options.onSearch('', event);
5272
5475
  }
5273
5476
  }
5274
5477
  }
@@ -5433,7 +5636,7 @@ var Switch = /*#__PURE__*/function () {
5433
5636
 
5434
5637
  var WebsyTemplate = /*#__PURE__*/function () {
5435
5638
  function WebsyTemplate(elementId, options) {
5436
- var _this32 = this;
5639
+ var _this33 = this;
5437
5640
 
5438
5641
  _classCallCheck(this, WebsyTemplate);
5439
5642
 
@@ -5459,9 +5662,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
5459
5662
 
5460
5663
  if (_typeof(options.template) === 'object' && options.template.url) {
5461
5664
  this.templateService.get(options.template.url).then(function (templateString) {
5462
- _this32.options.template = templateString;
5665
+ _this33.options.template = templateString;
5463
5666
 
5464
- _this32.render();
5667
+ _this33.render();
5465
5668
  });
5466
5669
  } else {
5467
5670
  this.render();
@@ -5471,7 +5674,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5471
5674
  _createClass(WebsyTemplate, [{
5472
5675
  key: "buildHTML",
5473
5676
  value: function buildHTML() {
5474
- var _this33 = this;
5677
+ var _this34 = this;
5475
5678
 
5476
5679
  var html = "";
5477
5680
 
@@ -5533,14 +5736,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5533
5736
  }
5534
5737
 
5535
5738
  if (polarity === true) {
5536
- 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]) {
5537
5740
  // remove the <if> tags
5538
5741
  removeAll = false;
5539
5742
  } else if (parts[0] === parts[1]) {
5540
5743
  removeAll = false;
5541
5744
  }
5542
5745
  } else if (polarity === false) {
5543
- 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]) {
5544
5747
  // remove the <if> tags
5545
5748
  removeAll = false;
5546
5749
  }
@@ -5833,7 +6036,7 @@ var WebsyUtils = {
5833
6036
 
5834
6037
  var WebsyTable = /*#__PURE__*/function () {
5835
6038
  function WebsyTable(elementId, options) {
5836
- var _this34 = this;
6039
+ var _this35 = this;
5837
6040
 
5838
6041
  _classCallCheck(this, WebsyTable);
5839
6042
 
@@ -5871,8 +6074,8 @@ var WebsyTable = /*#__PURE__*/function () {
5871
6074
  allowClear: false,
5872
6075
  disableSearch: true,
5873
6076
  onItemSelected: function onItemSelected(selectedItem) {
5874
- if (_this34.options.onChangePageSize) {
5875
- _this34.options.onChangePageSize(selectedItem.value);
6077
+ if (_this35.options.onChangePageSize) {
6078
+ _this35.options.onChangePageSize(selectedItem.value);
5876
6079
  }
5877
6080
  }
5878
6081
  });
@@ -5893,7 +6096,7 @@ var WebsyTable = /*#__PURE__*/function () {
5893
6096
  _createClass(WebsyTable, [{
5894
6097
  key: "appendRows",
5895
6098
  value: function appendRows(data) {
5896
- var _this35 = this;
6099
+ var _this36 = this;
5897
6100
 
5898
6101
  this.hideError();
5899
6102
  var bodyHTML = '';
@@ -5901,15 +6104,15 @@ var WebsyTable = /*#__PURE__*/function () {
5901
6104
  if (data) {
5902
6105
  bodyHTML += data.map(function (r, rowIndex) {
5903
6106
  return '<tr>' + r.map(function (c, i) {
5904
- if (_this35.options.columns[i].show !== false) {
6107
+ if (_this36.options.columns[i].show !== false) {
5905
6108
  var style = '';
5906
6109
 
5907
6110
  if (c.style) {
5908
6111
  style += c.style;
5909
6112
  }
5910
6113
 
5911
- if (_this35.options.columns[i].width) {
5912
- style += "width: ".concat(_this35.options.columns[i].width, "; ");
6114
+ if (_this36.options.columns[i].width) {
6115
+ style += "width: ".concat(_this36.options.columns[i].width, "; ");
5913
6116
  }
5914
6117
 
5915
6118
  if (c.backgroundColor) {
@@ -5924,18 +6127,18 @@ var WebsyTable = /*#__PURE__*/function () {
5924
6127
  style += "color: ".concat(c.color, "; ");
5925
6128
  }
5926
6129
 
5927
- if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5928
- 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 ");
5929
- } else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5930
- 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 ");
5931
6134
  } else {
5932
6135
  var info = c.value;
5933
6136
 
5934
- if (_this35.options.columns[i].showAsImage === true) {
6137
+ if (_this36.options.columns[i].showAsImage === true) {
5935
6138
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5936
6139
  }
5937
6140
 
5938
- 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 ");
5939
6142
  }
5940
6143
  }
5941
6144
  }).join('') + '</tr>';
@@ -6107,7 +6310,7 @@ var WebsyTable = /*#__PURE__*/function () {
6107
6310
  }, {
6108
6311
  key: "render",
6109
6312
  value: function render(data) {
6110
- var _this36 = this;
6313
+ var _this37 = this;
6111
6314
 
6112
6315
  if (!this.options.columns) {
6113
6316
  return;
@@ -6142,7 +6345,7 @@ var WebsyTable = /*#__PURE__*/function () {
6142
6345
  style += "width: ".concat(c.width || 'auto', ";");
6143
6346
  }
6144
6347
 
6145
- 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 ");
6146
6349
  }
6147
6350
  }).join('') + '</tr>';
6148
6351
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6161,7 +6364,7 @@ var WebsyTable = /*#__PURE__*/function () {
6161
6364
 
6162
6365
  if (pagingEl) {
6163
6366
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6164
- 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>");
6165
6368
  });
6166
6369
  var startIndex = 0;
6167
6370
 
@@ -6229,7 +6432,7 @@ var WebsyTable = /*#__PURE__*/function () {
6229
6432
 
6230
6433
  var WebsyTable2 = /*#__PURE__*/function () {
6231
6434
  function WebsyTable2(elementId, options) {
6232
- var _this37 = this;
6435
+ var _this38 = this;
6233
6436
 
6234
6437
  _classCallCheck(this, WebsyTable2);
6235
6438
 
@@ -6270,8 +6473,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
6270
6473
  allowClear: false,
6271
6474
  disableSearch: true,
6272
6475
  onItemSelected: function onItemSelected(selectedItem) {
6273
- if (_this37.options.onChangePageSize) {
6274
- _this37.options.onChangePageSize(selectedItem.value);
6476
+ if (_this38.options.onChangePageSize) {
6477
+ _this38.options.onChangePageSize(selectedItem.value);
6275
6478
  }
6276
6479
  }
6277
6480
  });
@@ -6295,7 +6498,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6295
6498
  _createClass(WebsyTable2, [{
6296
6499
  key: "appendRows",
6297
6500
  value: function appendRows(data) {
6298
- var _this38 = this;
6501
+ var _this39 = this;
6299
6502
 
6300
6503
  this.hideError();
6301
6504
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -6304,15 +6507,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
6304
6507
  if (data) {
6305
6508
  bodyHTML += data.map(function (r, rowIndex) {
6306
6509
  return '<tr>' + r.map(function (c, i) {
6307
- if (_this38.options.columns[i].show !== false) {
6308
- 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;");
6309
6512
 
6310
6513
  if (c.style) {
6311
6514
  style += c.style;
6312
6515
  }
6313
6516
 
6314
- if (_this38.options.columns[i].width) {
6315
- style += "width: ".concat(_this38.options.columns[i].width, "; ");
6517
+ if (_this39.options.columns[i].width) {
6518
+ style += "width: ".concat(_this39.options.columns[i].width, "; ");
6316
6519
  }
6317
6520
 
6318
6521
  if (c.backgroundColor) {
@@ -6327,18 +6530,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
6327
6530
  style += "color: ".concat(c.color, "; ");
6328
6531
  }
6329
6532
 
6330
- if (_this38.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6331
- 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 ");
6332
- } else if ((_this38.options.columns[i].showAsNavigatorLink === true || _this38.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6333
- 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 ");
6334
6537
  } else {
6335
6538
  var info = c.value;
6336
6539
 
6337
- if (_this38.options.columns[i].showAsImage === true) {
6540
+ if (_this39.options.columns[i].showAsImage === true) {
6338
6541
  c.value = "\n <img src='".concat(c.value, "'>\n ");
6339
6542
  }
6340
6543
 
6341
- 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 ");
6342
6545
  }
6343
6546
  }
6344
6547
  }).join('') + '</tr>';
@@ -6601,7 +6804,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6601
6804
  }, {
6602
6805
  key: "render",
6603
6806
  value: function render(data) {
6604
- var _this39 = this;
6807
+ var _this40 = this;
6605
6808
 
6606
6809
  if (!this.options.columns) {
6607
6810
  return;
@@ -6637,7 +6840,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6637
6840
  style += "width: ".concat(c.width || 'auto', "; ");
6638
6841
  }
6639
6842
 
6640
- 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 ");
6641
6844
  }
6642
6845
  }).join('') + '</tr>';
6643
6846
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6648,7 +6851,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6648
6851
  var dropdownHTML = "";
6649
6852
  this.options.columns.forEach(function (c, i) {
6650
6853
  if (c.searchable && c.searchField) {
6651
- 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 ");
6652
6855
  }
6653
6856
  });
6654
6857
  dropdownEl.innerHTML = dropdownHTML;
@@ -6670,7 +6873,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6670
6873
 
6671
6874
  if (pagingEl) {
6672
6875
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6673
- 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>");
6674
6877
  });
6675
6878
  var startIndex = 0;
6676
6879
 
@@ -6761,7 +6964,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6761
6964
  }, {
6762
6965
  key: "getColumnParameters",
6763
6966
  value: function getColumnParameters(values) {
6764
- var _this40 = this;
6967
+ var _this41 = this;
6765
6968
 
6766
6969
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6767
6970
  tableEl.style.tableLayout = 'auto';
@@ -6769,10 +6972,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
6769
6972
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6770
6973
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6771
6974
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6772
- 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 ");
6773
6976
  }).join('') + '</tr>';
6774
6977
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6775
- 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 ");
6776
6979
  }).join('') + '</tr>'; // get height of the first data cell
6777
6980
 
6778
6981
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6903,7 +7106,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6903
7106
  }, {
6904
7107
  key: "buildBodyHtml",
6905
7108
  value: function buildBodyHtml() {
6906
- var _this41 = this;
7109
+ var _this42 = this;
6907
7110
 
6908
7111
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6909
7112
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -6917,7 +7120,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6917
7120
  }
6918
7121
 
6919
7122
  var bodyHtml = "";
6920
- 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
+ });
6921
7126
 
6922
7127
  if (useWidths === true) {
6923
7128
  bodyHtml += '<colgroup>';
@@ -6932,7 +7137,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6932
7137
  row.forEach(function (cell, cellIndex) {
6933
7138
  var sizeIndex = cell.level || cellIndex;
6934
7139
 
6935
- if (typeof sizingColumns[sizeIndex] === 'undefined') {
7140
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6936
7141
  return; // need to revisit this logic
6937
7142
  }
6938
7143
 
@@ -6966,7 +7171,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6966
7171
  } // console.log('rowspan', cell.rowspan)
6967
7172
 
6968
7173
 
6969
- 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) {
6970
7175
  // bodyHtml += `
6971
7176
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6972
7177
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -6976,11 +7181,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6976
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 >");
6977
7182
 
6978
7183
  if (cell.expandable === true) {
6979
- 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>");
6980
7185
  }
6981
7186
 
6982
7187
  if (cell.collapsable === true) {
6983
- 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>");
6984
7189
  }
6985
7190
 
6986
7191
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
@@ -7005,7 +7210,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7005
7210
  }, {
7006
7211
  key: "buildHeaderHtml",
7007
7212
  value: function buildHeaderHtml() {
7008
- var _this42 = this;
7213
+ var _this43 = this;
7009
7214
 
7010
7215
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7011
7216
 
@@ -7014,7 +7219,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
7014
7219
  }
7015
7220
 
7016
7221
  var headerHtml = '';
7017
- 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
+ });
7018
7225
 
7019
7226
  if (useWidths === true) {
7020
7227
  headerHtml += '<colgroup>';
@@ -7025,13 +7232,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
7025
7232
  }
7026
7233
 
7027
7234
  this.options.columns.forEach(function (row, rowIndex) {
7028
- if (useWidths === false && rowIndex !== _this42.options.columns.length - 1) {
7235
+ if (useWidths === false && rowIndex !== _this43.options.columns.length - 1) {
7029
7236
  // if we're calculating the size we only want to render the last row of column headers
7030
7237
  return;
7031
7238
  }
7032
7239
 
7033
7240
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
7034
- 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
+
7035
7248
  var style = "width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important; ");
7036
7249
  var divStyle = style;
7037
7250
 
@@ -7044,25 +7257,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
7044
7257
  style += col.style;
7045
7258
  }
7046
7259
 
7047
- 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) {
7048
7261
  // headerHtml += `
7049
7262
  // style='width: ${col.width || col.actualWidth}px'
7050
7263
  // width='${col.width || col.actualWidth}'
7051
7264
  // `
7052
7265
  // }
7053
7266
 
7054
- 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>");
7055
7268
  });
7056
7269
  headerHtml += "</tr>";
7057
7270
  });
7058
7271
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
7059
7272
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
7060
7273
  if (c.searchable && c.isExternalSearch === true) {
7061
- 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));
7062
7275
 
7063
7276
  if (!testEl) {
7064
7277
  var newE = document.createElement('div');
7065
- newE.id = "".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i);
7278
+ newE.id = "".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i);
7066
7279
  newE.className = 'websy-modal-dropdown';
7067
7280
  dropdownEl.appendChild(newE);
7068
7281
  }
@@ -7085,7 +7298,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7085
7298
  }, {
7086
7299
  key: "buildTotalHtml",
7087
7300
  value: function buildTotalHtml() {
7088
- var _this43 = this;
7301
+ var _this44 = this;
7089
7302
 
7090
7303
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7091
7304
 
@@ -7093,12 +7306,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
7093
7306
  return '';
7094
7307
  }
7095
7308
 
7309
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
7310
+ return c.show !== false;
7311
+ });
7096
7312
  var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
7097
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
+
7098
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 ");
7099
7319
 
7100
7320
  if (useWidths === true) {
7101
- 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 ");
7102
7322
  }
7103
7323
 
7104
7324
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
@@ -7109,7 +7329,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7109
7329
  }, {
7110
7330
  key: "calculateSizes",
7111
7331
  value: function calculateSizes() {
7112
- var _this44 = this;
7332
+ var _this45 = this;
7113
7333
 
7114
7334
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7115
7335
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
@@ -7155,45 +7375,48 @@ var WebsyTable3 = /*#__PURE__*/function () {
7155
7375
  var totalWidth = 0;
7156
7376
  this.sizes.scrollableWidth = this.sizes.outer.width;
7157
7377
  var firstNonPinnedColumnWidth = 0;
7378
+ var columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(function (c) {
7379
+ return c.show !== false;
7380
+ });
7158
7381
  rows.forEach(function (row, rowIndex) {
7159
7382
  Array.from(row.children).forEach(function (col, colIndex) {
7160
7383
  var colSize = col.getBoundingClientRect();
7161
- _this44.sizes.cellHeight = colSize.height;
7384
+ _this45.sizes.cellHeight = colSize.height;
7162
7385
 
7163
- if (_this44.options.columns[_this44.options.columns.length - 1][colIndex]) {
7164
- if (!_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth) {
7165
- _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;
7166
7389
  }
7167
7390
 
7168
- _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);
7169
- _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;
7170
7393
 
7171
- if (colIndex >= _this44.pinnedColumns) {
7172
- firstNonPinnedColumnWidth = _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth;
7394
+ if (colIndex >= _this45.pinnedColumns) {
7395
+ firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
7173
7396
  }
7174
7397
  }
7175
7398
  });
7176
- });
7177
- this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
7178
- if (colIndex < _this44.pinnedColumns) {
7179
- _this44.sizes.scrollableWidth -= col.actualWidth;
7180
- }
7181
- });
7182
- 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) {
7183
7406
  return a + (b.width || b.actualWidth);
7184
7407
  }, 0);
7185
- this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
7186
- return i >= _this44.pinnedColumns;
7408
+ this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
7409
+ return i >= _this45.pinnedColumns;
7187
7410
  }).reduce(function (a, b) {
7188
7411
  return a + (b.width || b.actualWidth);
7189
7412
  }, 0);
7190
7413
  this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
7191
7414
 
7192
7415
  if (this.sizes.totalWidth < this.sizes.outer.width) {
7193
- 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;
7194
7417
  this.sizes.totalWidth = 0;
7195
7418
  this.sizes.totalNonPinnedWidth = 0;
7196
- this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
7419
+ columnsForSizing.forEach(function (c, i) {
7197
7420
  // if (!c.width) {
7198
7421
  // if (c.actualWidth < equalWidth) {
7199
7422
  // adjust the width
@@ -7204,10 +7427,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7204
7427
  c.actualWidth += equalWidth; // }
7205
7428
  // }
7206
7429
 
7207
- _this44.sizes.totalWidth += c.width || c.actualWidth;
7430
+ _this45.sizes.totalWidth += c.width || c.actualWidth;
7208
7431
 
7209
- if (i < _this44.pinnedColumns) {
7210
- _this44.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7432
+ if (i > _this45.pinnedColumns) {
7433
+ _this45.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7211
7434
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
7212
7435
 
7213
7436
  });
@@ -7216,20 +7439,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
7216
7439
 
7217
7440
  if (this.sizes.pinnedWidth > this.sizes.outer.width - firstNonPinnedColumnWidth) {
7218
7441
  this.sizes.totalWidth = 0;
7219
- 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
7220
7445
 
7221
- for (var i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
7446
+ for (var i = 0; i < columnsForSizing.length; i++) {
7222
7447
  if (i < this.pinnedColumns) {
7223
- var colDiff = this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth * diff;
7224
- 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;
7225
7451
  }
7226
7452
 
7227
- 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;
7228
7454
  }
7229
7455
  } // take the height of the last cell as the official height for data cells
7230
7456
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
7231
7457
 
7232
7458
 
7459
+ this.sizes.scrollableWidth = this.sizes.table.width - this.sizes.pinnedWidth;
7233
7460
  headEl.innerHTML = '';
7234
7461
  bodyEl.innerHTML = '';
7235
7462
  footerEl.innerHTML = '';
@@ -7270,7 +7497,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7270
7497
  }, {
7271
7498
  key: "createSample",
7272
7499
  value: function createSample(data) {
7273
- var _this45 = this;
7500
+ var _this46 = this;
7274
7501
 
7275
7502
  var output = [];
7276
7503
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
@@ -7282,7 +7509,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7282
7509
  var longest = '';
7283
7510
 
7284
7511
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
7285
- 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) {
7286
7513
  if (longest.length < data[i][colIndex].value.length) {
7287
7514
  longest = data[i][colIndex].value;
7288
7515
  }
@@ -7607,21 +7834,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
7607
7834
  this.endCol = 0;
7608
7835
 
7609
7836
  for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
7610
- 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;
7611
7839
 
7612
- if (actualLeft < cumulativeWidth) {
7613
- this.startCol = i;
7614
- break;
7840
+ if (actualLeft < cumulativeWidth) {
7841
+ this.startCol = i;
7842
+ break;
7843
+ }
7615
7844
  }
7616
7845
  }
7617
7846
 
7618
7847
  cumulativeWidth = 0;
7619
7848
 
7620
7849
  for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
7621
- 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;
7622
7852
 
7623
- if (cumulativeWidth < this.sizes.scrollableWidth) {
7624
- this.endCol = _i10;
7853
+ if (cumulativeWidth < this.sizes.scrollableWidth) {
7854
+ this.endCol = _i10;
7855
+ }
7625
7856
  }
7626
7857
  }
7627
7858
 
@@ -7710,7 +7941,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7710
7941
 
7711
7942
  var WebsyChart = /*#__PURE__*/function () {
7712
7943
  function WebsyChart(elementId, options) {
7713
- var _this46 = this;
7944
+ var _this47 = this;
7714
7945
 
7715
7946
  _classCallCheck(this, WebsyChart);
7716
7947
 
@@ -7770,7 +8001,7 @@ var WebsyChart = /*#__PURE__*/function () {
7770
8001
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7771
8002
  var xAxis = 'bottom';
7772
8003
 
7773
- if (_this46.options.orientation === 'horizontal') {
8004
+ if (_this47.options.orientation === 'horizontal') {
7774
8005
  xAxis = 'left';
7775
8006
  }
7776
8007
 
@@ -7781,13 +8012,13 @@ var WebsyChart = /*#__PURE__*/function () {
7781
8012
  xAxis += 'Axis';
7782
8013
  var output;
7783
8014
 
7784
- 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) {
7785
8016
 
7786
8017
 
7787
- for (var index = 0; index < _this46.customBottomRange.length; index++) {
7788
- if (input > _this46.customBottomRange[index]) {
7789
- if (_this46.customBottomRange[index + 1]) {
7790
- 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]) {
7791
8022
  output = index;
7792
8023
  break;
7793
8024
  }
@@ -8025,10 +8256,10 @@ var WebsyChart = /*#__PURE__*/function () {
8025
8256
  }, {
8026
8257
  key: "handleEventMouseMove",
8027
8258
  value: function handleEventMouseMove(event, d) {
8028
- var _this47 = this;
8259
+ var _this48 = this;
8029
8260
 
8030
8261
  var bisectDate = d3.bisector(function (d) {
8031
- return _this47.parseX(d.x.value);
8262
+ return _this48.parseX(d.x.value);
8032
8263
  }).left;
8033
8264
 
8034
8265
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -8067,9 +8298,9 @@ var WebsyChart = /*#__PURE__*/function () {
8067
8298
  }
8068
8299
 
8069
8300
  this.options.data.series.forEach(function (s) {
8070
- if (_this47.options.data[xData].scale !== 'Time') {
8301
+ if (_this48.options.data[xData].scale !== 'Time') {
8071
8302
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
8072
- 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; // }
8073
8304
  // else {
8074
8305
  // xPoint = this[xAxis](this.parseX(xLabel))
8075
8306
  // }
@@ -8092,13 +8323,13 @@ var WebsyChart = /*#__PURE__*/function () {
8092
8323
  var pointA = s.data[index - 1];
8093
8324
  var pointB = s.data[index];
8094
8325
 
8095
- if (_this47.options.orientation === 'horizontal') {
8326
+ if (_this48.options.orientation === 'horizontal') {
8096
8327
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
8097
8328
  pointB = _toConsumableArray(s.data).reverse()[index];
8098
8329
  }
8099
8330
 
8100
8331
  if (pointA && !pointB) {
8101
- xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
8332
+ xPoint = _this48[xAxis](_this48.parseX(pointA.x.value));
8102
8333
  tooltipTitle = pointA.x.value;
8103
8334
 
8104
8335
  if (!pointA.y.color) {
@@ -8108,12 +8339,12 @@ var WebsyChart = /*#__PURE__*/function () {
8108
8339
  tooltipData.push(pointA.y);
8109
8340
 
8110
8341
  if (typeof pointA.x.value.getTime !== 'undefined') {
8111
- 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);
8112
8343
  }
8113
8344
  }
8114
8345
 
8115
8346
  if (pointB && !pointA) {
8116
- xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
8347
+ xPoint = _this48[xAxis](_this48.parseX(pointB.x.value));
8117
8348
  tooltipTitle = pointB.x.value;
8118
8349
 
8119
8350
  if (!pointB.y.color) {
@@ -8123,14 +8354,14 @@ var WebsyChart = /*#__PURE__*/function () {
8123
8354
  tooltipData.push(pointB.y);
8124
8355
 
8125
8356
  if (typeof pointB.x.value.getTime !== 'undefined') {
8126
- 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);
8127
8358
  }
8128
8359
  }
8129
8360
 
8130
8361
  if (pointA && pointB) {
8131
- var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
8362
+ var d0 = _this48[xAxis](_this48.parseX(pointA.x.value));
8132
8363
 
8133
- var d1 = _this47[xAxis](_this47.parseX(pointB.x.value));
8364
+ var d1 = _this48[xAxis](_this48.parseX(pointB.x.value));
8134
8365
 
8135
8366
  var mid = Math.abs(d0 - d1) / 2;
8136
8367
 
@@ -8139,7 +8370,7 @@ var WebsyChart = /*#__PURE__*/function () {
8139
8370
  tooltipTitle = pointB.x.value;
8140
8371
 
8141
8372
  if (typeof pointB.x.value.getTime !== 'undefined') {
8142
- 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);
8143
8374
  }
8144
8375
 
8145
8376
  if (!pointB.y.color) {
@@ -8152,7 +8383,7 @@ var WebsyChart = /*#__PURE__*/function () {
8152
8383
  tooltipTitle = pointA.x.value;
8153
8384
 
8154
8385
  if (typeof pointB.x.value.getTime !== 'undefined') {
8155
- 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);
8156
8387
  }
8157
8388
 
8158
8389
  if (!pointA.y.color) {
@@ -8285,7 +8516,7 @@ var WebsyChart = /*#__PURE__*/function () {
8285
8516
  }, {
8286
8517
  key: "render",
8287
8518
  value: function render(options) {
8288
- var _this48 = this;
8519
+ var _this49 = this;
8289
8520
 
8290
8521
  /* global d3 options WebsyUtils */
8291
8522
  if (typeof options !== 'undefined') {
@@ -8360,7 +8591,7 @@ var WebsyChart = /*#__PURE__*/function () {
8360
8591
  this.options.data.series.map(function (s, i) {
8361
8592
  return {
8362
8593
  value: s.label || s.key,
8363
- color: s.color || _this48.options.colors[i % _this48.options.colors.length]
8594
+ color: s.color || _this49.options.colors[i % _this49.options.colors.length]
8364
8595
  };
8365
8596
  });
8366
8597
  }
@@ -8734,28 +8965,28 @@ var WebsyChart = /*#__PURE__*/function () {
8734
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') {
8735
8966
  var acc = 0;
8736
8967
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8737
- 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) {
8738
8969
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8739
8970
  // }
8740
8971
 
8741
- var start = _this48.widthForCalc / noOfPoints * acc;
8972
+ var start = _this49.widthForCalc / noOfPoints * acc;
8742
8973
 
8743
8974
  for (var i = 0; i < (d.valueCount || 1); i++) {
8744
8975
  var pos = i * proposedBandWidth;
8745
8976
 
8746
- _this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8977
+ _this49["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8747
8978
  }
8748
8979
 
8749
- acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8750
- 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))
8751
8982
 
8752
8983
  return end + adjustment;
8753
8984
  })));
8754
8985
  acc = 0;
8755
8986
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8756
- var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
8757
- acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8758
- 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;
8759
8990
  })));
8760
8991
  } // }
8761
8992
 
@@ -8933,7 +9164,7 @@ var WebsyChart = /*#__PURE__*/function () {
8933
9164
 
8934
9165
  if (this.options.data.bottom.formatter) {
8935
9166
  this.bAxisFunc.tickFormat(function (d) {
8936
- return _this48.options.data.bottom.formatter(d);
9167
+ return _this49.options.data.bottom.formatter(d);
8937
9168
  });
8938
9169
  }
8939
9170
 
@@ -8945,7 +9176,7 @@ var WebsyChart = /*#__PURE__*/function () {
8945
9176
 
8946
9177
  if (this.customBottomRange.length > 0) {
8947
9178
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8948
- 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)");
8949
9180
  });
8950
9181
  }
8951
9182
  } // Configure the left axis
@@ -8967,8 +9198,8 @@ var WebsyChart = /*#__PURE__*/function () {
8967
9198
 
8968
9199
  if (this.options.margin.axisLeft > 0) {
8969
9200
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8970
- if (_this48.options.data.left.formatter) {
8971
- d = _this48.options.data.left.formatter(d);
9201
+ if (_this49.options.data.left.formatter) {
9202
+ d = _this49.options.data.left.formatter(d);
8972
9203
  }
8973
9204
 
8974
9205
  return d;
@@ -8976,7 +9207,7 @@ var WebsyChart = /*#__PURE__*/function () {
8976
9207
 
8977
9208
  if (this.customLeftRange.length > 0) {
8978
9209
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8979
- 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, ")");
8980
9211
  });
8981
9212
  }
8982
9213
  }
@@ -9009,8 +9240,8 @@ var WebsyChart = /*#__PURE__*/function () {
9009
9240
 
9010
9241
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
9011
9242
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
9012
- if (_this48.options.data.right.formatter) {
9013
- d = _this48.options.data.right.formatter(d);
9243
+ if (_this49.options.data.right.formatter) {
9244
+ d = _this49.options.data.right.formatter(d);
9014
9245
  }
9015
9246
 
9016
9247
  return d;
@@ -9056,57 +9287,57 @@ var WebsyChart = /*#__PURE__*/function () {
9056
9287
  }, {
9057
9288
  key: "renderComponents",
9058
9289
  value: function renderComponents() {
9059
- var _this49 = this;
9290
+ var _this50 = this;
9060
9291
 
9061
9292
  // Draw the series data
9062
9293
  this.renderedKeys = {};
9063
9294
  this.options.data.series.forEach(function (series, index) {
9064
9295
  if (!series.key) {
9065
- series.key = _this49.createIdentity();
9296
+ series.key = _this50.createIdentity();
9066
9297
  }
9067
9298
 
9068
9299
  if (!series.color) {
9069
- series.color = _this49.options.colors[index % _this49.options.colors.length];
9300
+ series.color = _this50.options.colors[index % _this50.options.colors.length];
9070
9301
  }
9071
9302
 
9072
- _this49["render".concat(series.type || 'bar')](series, index);
9303
+ _this50["render".concat(series.type || 'bar')](series, index);
9073
9304
 
9074
- _this49.renderLabels(series, index);
9305
+ _this50.renderLabels(series, index);
9075
9306
 
9076
- _this49.renderedKeys[series.key] = series.type;
9307
+ _this50.renderedKeys[series.key] = series.type;
9077
9308
  });
9078
9309
  this.refLineLayer.selectAll('.reference-line').remove();
9079
9310
  this.refLineLayer.selectAll('.reference-line-label').remove();
9080
9311
 
9081
9312
  if (this.options.refLines && this.options.refLines.length > 0) {
9082
9313
  this.options.refLines.forEach(function (l) {
9083
- return _this49.renderRefLine(l);
9314
+ return _this50.renderRefLine(l);
9084
9315
  });
9085
9316
  }
9086
9317
  }
9087
9318
  }, {
9088
9319
  key: "renderarea",
9089
9320
  value: function renderarea(series, index) {
9090
- var _this50 = this;
9321
+ var _this51 = this;
9091
9322
 
9092
9323
  /* global d3 series index */
9093
9324
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
9094
9325
  return d3.area().x(function (d) {
9095
9326
  // return this[`${xAxis}Axis`](this.parseX(d.x.value))
9096
- var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
9327
+ var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
9097
9328
 
9098
- var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9329
+ var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9099
9330
 
9100
- if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9101
- 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;
9102
9333
  }
9103
9334
 
9104
9335
  return xPos;
9105
9336
  }).y0(function (d) {
9106
- return _this50["".concat(yAxis, "Axis")](0);
9337
+ return _this51["".concat(yAxis, "Axis")](0);
9107
9338
  }).y1(function (d) {
9108
- return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9109
- }).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]);
9110
9341
  };
9111
9342
 
9112
9343
  var xAxis = 'bottom';
@@ -9144,7 +9375,7 @@ var WebsyChart = /*#__PURE__*/function () {
9144
9375
  }, {
9145
9376
  key: "renderbar",
9146
9377
  value: function renderbar(series, index) {
9147
- var _this51 = this;
9378
+ var _this52 = this;
9148
9379
 
9149
9380
  /* global series index d3 */
9150
9381
  var xAxis = 'bottom';
@@ -9309,25 +9540,25 @@ var WebsyChart = /*#__PURE__*/function () {
9309
9540
 
9310
9541
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9311
9542
  bars.attr('width', function (d, i) {
9312
- return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9543
+ return Math.abs(getBarWidth.call(_this52, d, i, xAxis));
9313
9544
  }).attr('height', function (d, i) {
9314
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
9545
+ return getBarHeight.call(_this52, d, i, yAxis, xAxis);
9315
9546
  }).attr('x', function (d, i) {
9316
- return getBarX.call(_this51, d, i, xAxis);
9547
+ return getBarX.call(_this52, d, i, xAxis);
9317
9548
  }).attr('y', function (d, i) {
9318
- return getBarY.call(_this51, d, i, yAxis, xAxis);
9549
+ return getBarY.call(_this52, d, i, yAxis, xAxis);
9319
9550
  }) // .transition(this.transition)
9320
9551
  .attr('fill', function (d) {
9321
9552
  return d.y.color || d.color || series.color;
9322
9553
  });
9323
9554
  bars.enter().append('rect').attr('width', function (d, i) {
9324
- return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9555
+ return Math.abs(getBarWidth.call(_this52, d, i, xAxis));
9325
9556
  }).attr('height', function (d, i) {
9326
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
9557
+ return getBarHeight.call(_this52, d, i, yAxis, xAxis);
9327
9558
  }).attr('x', function (d, i) {
9328
- return getBarX.call(_this51, d, i, xAxis);
9559
+ return getBarX.call(_this52, d, i, xAxis);
9329
9560
  }).attr('y', function (d, i) {
9330
- return getBarY.call(_this51, d, i, yAxis, xAxis);
9561
+ return getBarY.call(_this52, d, i, yAxis, xAxis);
9331
9562
  }) // .transition(this.transition)
9332
9563
  .attr('fill', function (d) {
9333
9564
  return d.y.color || d.color || series.color;
@@ -9339,25 +9570,25 @@ var WebsyChart = /*#__PURE__*/function () {
9339
9570
  this.brushBarsInitialized[series.key] = true;
9340
9571
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9341
9572
  brushBars.attr('width', function (d, i) {
9342
- return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9573
+ return Math.abs(getBarWidth.call(_this52, d, i, "".concat(xAxis, "Brush")));
9343
9574
  }).attr('height', function (d, i) {
9344
- 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"));
9345
9576
  }).attr('x', function (d, i) {
9346
- return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9577
+ return getBarX.call(_this52, d, i, "".concat(xAxis, "Brush"));
9347
9578
  }).attr('y', function (d, i) {
9348
- 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"));
9349
9580
  }) // .transition(this.transition)
9350
9581
  .attr('fill', function (d) {
9351
9582
  return d.y.color || d.color || series.color;
9352
9583
  });
9353
9584
  brushBars.enter().append('rect').attr('width', function (d, i) {
9354
- return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9585
+ return Math.abs(getBarWidth.call(_this52, d, i, "".concat(xAxis, "Brush")));
9355
9586
  }).attr('height', function (d, i) {
9356
- 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"));
9357
9588
  }).attr('x', function (d, i) {
9358
- return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9589
+ return getBarX.call(_this52, d, i, "".concat(xAxis, "Brush"));
9359
9590
  }).attr('y', function (d, i) {
9360
- 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"));
9361
9592
  }) // .transition(this.transition)
9362
9593
  .attr('fill', function (d) {
9363
9594
  return d.y.color || d.color || series.color;
@@ -9375,7 +9606,7 @@ var WebsyChart = /*#__PURE__*/function () {
9375
9606
  }, {
9376
9607
  key: "renderLabels",
9377
9608
  value: function renderLabels(series, index) {
9378
- var _this52 = this;
9609
+ var _this53 = this;
9379
9610
 
9380
9611
  /* global series index d3 WebsyDesigns */
9381
9612
  var xAxis = 'bottom';
@@ -9394,15 +9625,15 @@ var WebsyChart = /*#__PURE__*/function () {
9394
9625
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
9395
9626
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
9396
9627
  labels.attr('x', function (d) {
9397
- return getLabelX.call(_this52, d, series.labelPosition);
9628
+ return getLabelX.call(_this53, d, series.labelPosition);
9398
9629
  }).attr('y', function (d) {
9399
- return getLabelY.call(_this52, d, series.labelPosition);
9630
+ return getLabelY.call(_this53, d, series.labelPosition);
9400
9631
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
9401
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
9632
+ if (_this53.options.grouping === 'stacked' && d.y.value === 0) {
9402
9633
  return 'transparent';
9403
9634
  }
9404
9635
 
9405
- 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);
9406
9637
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
9407
9638
  return d.y.label || d.y.value;
9408
9639
  }).each(function (d, i) {
@@ -9427,15 +9658,15 @@ var WebsyChart = /*#__PURE__*/function () {
9427
9658
  }
9428
9659
  });
9429
9660
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9430
- return getLabelX.call(_this52, d, series.labelPosition);
9661
+ return getLabelX.call(_this53, d, series.labelPosition);
9431
9662
  }).attr('y', function (d) {
9432
- return getLabelY.call(_this52, d, series.labelPosition);
9663
+ return getLabelY.call(_this53, d, series.labelPosition);
9433
9664
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9434
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
9665
+ if (_this53.options.grouping === 'stacked' && d.y.value === 0) {
9435
9666
  return 'transparent';
9436
9667
  }
9437
9668
 
9438
- 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);
9439
9670
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9440
9671
  return d.y.label || d.y.value;
9441
9672
  }).each(function (d, i) {
@@ -9513,20 +9744,20 @@ var WebsyChart = /*#__PURE__*/function () {
9513
9744
  }, {
9514
9745
  key: "renderline",
9515
9746
  value: function renderline(series, index) {
9516
- var _this53 = this;
9747
+ var _this54 = this;
9517
9748
 
9518
9749
  /* global series index d3 */
9519
9750
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9520
9751
  return d3.line().x(function (d) {
9521
- if (_this53.options.orientation === 'horizontal') {
9522
- 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);
9523
9754
  } else {
9524
- var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
9755
+ var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9525
9756
 
9526
- var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9757
+ var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9527
9758
 
9528
- if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9529
- 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;
9530
9761
  } // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
9531
9762
  // return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
9532
9763
 
@@ -9534,13 +9765,13 @@ var WebsyChart = /*#__PURE__*/function () {
9534
9765
  return xPos;
9535
9766
  }
9536
9767
  }).y(function (d) {
9537
- if (_this53.options.orientation === 'horizontal') {
9538
- var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
9539
- 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;
9540
9771
  } else {
9541
- 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);
9542
9773
  }
9543
- }).curve(d3[curveStyle || _this53.options.curveStyle]);
9774
+ }).curve(d3[curveStyle || _this54.options.curveStyle]);
9544
9775
  };
9545
9776
 
9546
9777
  var xAxis = 'bottom';
@@ -9654,14 +9885,14 @@ var WebsyChart = /*#__PURE__*/function () {
9654
9885
  }, {
9655
9886
  key: "rendersymbol",
9656
9887
  value: function rendersymbol(series, index) {
9657
- var _this54 = this;
9888
+ var _this55 = this;
9658
9889
 
9659
9890
  /* global d3 series index series.key */
9660
9891
  var drawSymbol = function drawSymbol(size) {
9661
9892
  return d3.symbol() // .type(d => {
9662
9893
  // return d3.symbols[0]
9663
9894
  // })
9664
- .size(size || _this54.options.symbolSize);
9895
+ .size(size || _this55.options.symbolSize);
9665
9896
  };
9666
9897
 
9667
9898
  var xAxis = 'bottom';
@@ -9686,21 +9917,21 @@ var WebsyChart = /*#__PURE__*/function () {
9686
9917
  // else {
9687
9918
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9688
9919
  // }
9689
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9920
+ var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
9690
9921
 
9691
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9922
+ var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9692
9923
 
9693
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9694
- 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;
9695
9926
  }
9696
9927
 
9697
- 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;
9698
9929
 
9699
- if (_this54.options.orientation === 'horizontal') {
9700
- 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, ")");
9701
9932
  } else {
9702
9933
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9703
- 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), ")");
9704
9935
  }
9705
9936
  }); // Enter
9706
9937
 
@@ -9710,21 +9941,21 @@ var WebsyChart = /*#__PURE__*/function () {
9710
9941
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
9711
9942
  return "symbol symbol_".concat(series.key);
9712
9943
  }).attr('transform', function (d) {
9713
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
9944
+ var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
9714
9945
 
9715
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9946
+ var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9716
9947
 
9717
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9718
- 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;
9719
9950
  }
9720
9951
 
9721
- 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;
9722
9953
 
9723
- if (_this54.options.orientation === 'horizontal') {
9724
- 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, ")");
9725
9956
  } else {
9726
9957
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9727
- 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), ")");
9728
9959
  }
9729
9960
  });
9730
9961
  }
@@ -9946,7 +10177,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9946
10177
  }, {
9947
10178
  key: "resize",
9948
10179
  value: function resize() {
9949
- var _this55 = this;
10180
+ var _this56 = this;
9950
10181
 
9951
10182
  var el = document.getElementById(this.elementId);
9952
10183
 
@@ -9959,7 +10190,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9959
10190
  // }
9960
10191
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9961
10192
  html += this._data.map(function (d, i) {
9962
- return _this55.getLegendItemHTML(d);
10193
+ return _this56.getLegendItemHTML(d);
9963
10194
  }).join('');
9964
10195
  html += "\n <div>\n ";
9965
10196
  el.innerHTML = html;
@@ -10131,7 +10362,7 @@ var WebsyMap = /*#__PURE__*/function () {
10131
10362
  }, {
10132
10363
  key: "render",
10133
10364
  value: function render() {
10134
- var _this56 = this;
10365
+ var _this57 = this;
10135
10366
 
10136
10367
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
10137
10368
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -10140,7 +10371,7 @@ var WebsyMap = /*#__PURE__*/function () {
10140
10371
  var legendData = this.options.data.polygons.map(function (s, i) {
10141
10372
  return {
10142
10373
  value: s.label || s.key,
10143
- color: s.color || _this56.options.colors[i % _this56.options.colors.length]
10374
+ color: s.color || _this57.options.colors[i % _this57.options.colors.length]
10144
10375
  };
10145
10376
  });
10146
10377
  var longestValue = legendData.map(function (s) {
@@ -10204,7 +10435,7 @@ var WebsyMap = /*#__PURE__*/function () {
10204
10435
 
10205
10436
  if (this.polygons) {
10206
10437
  this.polygons.forEach(function (p) {
10207
- return _this56.map.removeLayer(p);
10438
+ return _this57.map.removeLayer(p);
10208
10439
  });
10209
10440
  }
10210
10441
 
@@ -10262,18 +10493,18 @@ var WebsyMap = /*#__PURE__*/function () {
10262
10493
  }
10263
10494
 
10264
10495
  if (!p.options.color) {
10265
- p.options.color = _this56.options.colors[i % _this56.options.colors.length];
10496
+ p.options.color = _this57.options.colors[i % _this57.options.colors.length];
10266
10497
  }
10267
10498
 
10268
10499
  var pol = L.polygon(p.data.map(function (c) {
10269
10500
  return c.map(function (d) {
10270
10501
  return [d.Latitude, d.Longitude];
10271
10502
  });
10272
- }), p.options).addTo(_this56.map);
10503
+ }), p.options).addTo(_this57.map);
10273
10504
 
10274
- _this56.polygons.push(pol);
10505
+ _this57.polygons.push(pol);
10275
10506
 
10276
- _this56.map.fitBounds(pol.getBounds());
10507
+ _this57.map.fitBounds(pol.getBounds());
10277
10508
  });
10278
10509
  } // if (this.data.markers.length > 0) {
10279
10510
  // el.classList.remove('hidden')