@websy/websy-designs 1.10.7 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1882,6 +1882,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1882
1882
  var headerPos = WebsyUtils.getElementPos(headerEl);
1883
1883
  var contentPos = WebsyUtils.getElementPos(contentEl);
1884
1884
  if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1885
+ contentEl.style.left = 'unset';
1885
1886
  contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
1886
1887
  contentEl.style.width = "".concat(Math.max(this.options.minWidth, headerEl.clientWidth), "px");
1887
1888
  if (headerPos.bottom + contentPos.height > window.innerHeight) {
@@ -1892,6 +1893,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1892
1893
  }
1893
1894
  } else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
1894
1895
  var targetPos = WebsyUtils.getElementPos(event.target);
1896
+ contentEl.style.left = 'unset';
1895
1897
  contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
1896
1898
  contentEl.style.width = "".concat(Math.max(this.options.minWidth, targetPos.width), "px");
1897
1899
  }
@@ -1987,8 +1989,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
1987
1989
  get: function get() {
1988
1990
  var _this11 = this;
1989
1991
  if (this.selectedItems && this.selectedItems.length > 0) {
1992
+ // return this.selectedItems.map((d, i) => this.options.items[+d])
1990
1993
  return this.selectedItems.map(function (d, i) {
1991
- return _this11.options.items[+d];
1994
+ return _this11._originalData[+d];
1992
1995
  });
1993
1996
  }
1994
1997
  return [];
@@ -2516,11 +2519,11 @@ var WebsyForm = /*#__PURE__*/function () {
2516
2519
  f.owningElement = _this18.elementId;
2517
2520
  if (f.component) {
2518
2521
  componentsToProcess.push(f);
2519
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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 ");
2522
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', " ").concat(f.component === 'MediaUpload' ? 'media-upload' : '', "'>\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 ");
2520
2523
  } else if (f.type === 'longtext') {
2521
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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 ");
2524
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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 >").concat(f.value || '', "</textarea>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2522
2525
  } else {
2523
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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 ");
2526
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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.type === 'date' ? '' : 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 ");
2524
2527
  }
2525
2528
  });
2526
2529
  if (this.options.useRecaptcha === true) {
@@ -2553,6 +2556,9 @@ var WebsyForm = /*#__PURE__*/function () {
2553
2556
  if (this.fieldMap[field].type === 'checkbox') {
2554
2557
  el.checked = value;
2555
2558
  }
2559
+ if (this.fieldMap[field].type === 'date') {
2560
+ el.valueAsDate = value;
2561
+ }
2556
2562
  } else {
2557
2563
  console.error("Input for ".concat(field, " does not exist in form."));
2558
2564
  }
@@ -2702,10 +2708,12 @@ var MultiForm = /*#__PURE__*/function () {
2702
2708
  _classCallCheck(this, MultiForm);
2703
2709
  this.elementId = elementId;
2704
2710
  var DEFAULTS = {
2705
- addButton: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"256\" y1=\"112\" x2=\"256\" y2=\"400\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"400\" y1=\"256\" x2=\"112\" y2=\"256\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
2706
- deleteButton: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
2711
+ addIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"256\" y1=\"112\" x2=\"256\" y2=\"400\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"400\" y1=\"256\" x2=\"112\" y2=\"256\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
2712
+ deleteIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
2707
2713
  allowAdd: true,
2708
- allowDelete: true
2714
+ allowDelete: true,
2715
+ addLabel: '',
2716
+ deleteLabel: ''
2709
2717
  };
2710
2718
  this.options = _extends({}, DEFAULTS, options);
2711
2719
  this.formData = [];
@@ -2714,7 +2722,7 @@ var MultiForm = /*#__PURE__*/function () {
2714
2722
  var el = document.getElementById(elementId);
2715
2723
  if (el) {
2716
2724
  el.addEventListener('click', this.handleClick.bind(this));
2717
- el.innerHTML = "<div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>");
2725
+ el.innerHTML = "\n <div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>\n <button id='").concat(this.elementId, "_addButton' class='websy-multi-form-add'>\n ").concat(this.options.addIcon).concat(this.options.addLabel, "\n </button> \n ");
2718
2726
  }
2719
2727
  this.render();
2720
2728
  }
@@ -2727,19 +2735,26 @@ var MultiForm = /*#__PURE__*/function () {
2727
2735
  }, {
2728
2736
  key: "addEntry",
2729
2737
  value: function addEntry() {
2730
- var el = document.getElementById("".concat(this.elementId, "_container"));
2731
- var newId = WebsyDesigns.Utils.createIdentity();
2732
- var newFormEl = document.createElement('div');
2733
- newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
2734
- newFormEl.classList.add('websy-multi-form-form-container');
2735
- newFormEl.innerHTML = "\n <div id='".concat(this.elementId, "_").concat(newId, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(newId, "_deleteButton' data-formid='").concat(newId, "' class='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(newId, "_addButton' data-formid='").concat(newId, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n ");
2736
- el.appendChild(newFormEl);
2737
- var formOptions = _extends({}, this.options, {
2738
- fields: _toConsumableArray(this.options.fields.map(function (f) {
2739
- return _extends({}, f);
2740
- }))
2741
- });
2742
- this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2738
+ var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
2739
+ if (typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows) {
2740
+ var el = document.getElementById("".concat(this.elementId, "_container"));
2741
+ var newId = WebsyDesigns.Utils.createIdentity();
2742
+ var newFormEl = document.createElement('div');
2743
+ newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
2744
+ newFormEl.classList.add('websy-multi-form-form-container');
2745
+ var html = "\n <div id='".concat(this.elementId, "_").concat(newId, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(newId, "_deleteButton' data-formid='").concat(newId, "' class='websy-multi-form-delete'>\n ").concat(this.options.deleteIcon).concat(this.options.deleteLabel, "\n </button>\n ");
2746
+ newFormEl.innerHTML = html;
2747
+ el.appendChild(newFormEl);
2748
+ var formOptions = _extends({}, this.options, {
2749
+ fields: _toConsumableArray(this.options.fields.map(function (f) {
2750
+ return _extends({}, f);
2751
+ }))
2752
+ });
2753
+ this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2754
+ if (addEl) {
2755
+ addEl.style.display = this.forms.length < this.options.maxRows ? 'flex' : 'none';
2756
+ }
2757
+ }
2743
2758
  }
2744
2759
  }, {
2745
2760
  key: "clear",
@@ -2758,11 +2773,6 @@ var MultiForm = /*#__PURE__*/function () {
2758
2773
  var d = this.forms.map(function (f) {
2759
2774
  return f.data;
2760
2775
  });
2761
- console.log('forms data', d);
2762
- if (this.options.allowAdd !== false) {
2763
- // we don't return the last form
2764
- d.pop();
2765
- }
2766
2776
  return d;
2767
2777
  },
2768
2778
  set: function set(d) {
@@ -2781,16 +2791,6 @@ var MultiForm = /*#__PURE__*/function () {
2781
2791
  key: "handleClick",
2782
2792
  value: function handleClick(event) {
2783
2793
  if (event.target.classList.contains('websy-multi-form-add')) {
2784
- var id = event.target.getAttribute('data-formid');
2785
- // hide add button and show delete button
2786
- var addButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_addButton"));
2787
- if (addButtonEl) {
2788
- addButtonEl.classList.add('hidden');
2789
- }
2790
- var deleteButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_deleteButton"));
2791
- if (deleteButtonEl) {
2792
- deleteButtonEl.classList.remove('hidden');
2793
- }
2794
2794
  // add new form
2795
2795
  if (this.options.allowAdd === true) {
2796
2796
  this.addEntry();
@@ -2798,12 +2798,12 @@ var MultiForm = /*#__PURE__*/function () {
2798
2798
  }
2799
2799
  if (event.target.classList.contains('websy-multi-form-delete')) {
2800
2800
  // delete form based on index
2801
- var _id = event.target.getAttribute('data-formid');
2801
+ var id = event.target.getAttribute('data-formid');
2802
2802
  var rowId = event.target.getAttribute('data-rowid');
2803
2803
  this.recordsToDelete.push(rowId);
2804
2804
  var indexToDelete = -1;
2805
2805
  for (var i = 0; i < this.forms.length; i++) {
2806
- if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(_id, "_form")) {
2806
+ if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(id, "_form")) {
2807
2807
  indexToDelete = i;
2808
2808
  break;
2809
2809
  }
@@ -2811,10 +2811,14 @@ var MultiForm = /*#__PURE__*/function () {
2811
2811
  if (indexToDelete !== -1) {
2812
2812
  this.forms.splice(indexToDelete, 1);
2813
2813
  }
2814
- var el = document.getElementById("".concat(this.elementId, "_").concat(_id, "_formContainer"));
2814
+ var el = document.getElementById("".concat(this.elementId, "_").concat(id, "_formContainer"));
2815
2815
  if (el) {
2816
2816
  el.remove();
2817
2817
  }
2818
+ var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
2819
+ if (addEl) {
2820
+ addEl.style.display = typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows ? 'flex' : 'none';
2821
+ }
2818
2822
  // delete form element based on id
2819
2823
  }
2820
2824
  }
@@ -2831,14 +2835,11 @@ var MultiForm = /*#__PURE__*/function () {
2831
2835
  d.formId = WebsyDesigns.Utils.createIdentity();
2832
2836
  html += "\n <div id='".concat(_this21.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this21.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
2833
2837
  if (_this21.options.allowDelete === true) {
2834
- html += "\n <button id='".concat(_this21.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this21.options.deleteButton, "\n </button>\n ");
2838
+ html += "\n <button id='".concat(_this21.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this21.options.deleteIcon).concat(_this21.options.deleteLabel, "\n </button>\n ");
2835
2839
  }
2836
2840
  html += "\n </div>\n ";
2837
2841
  });
2838
2842
  var id = WebsyDesigns.Utils.createIdentity();
2839
- if (this.options.allowAdd === true) {
2840
- html += "\n <div id='".concat(this.elementId, "_").concat(id, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(this.elementId, "_").concat(id, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(id, "_deleteButton' data-formid='").concat(id, "' class='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(id, "_addButton' data-formid='").concat(id, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n </div>\n ");
2841
- }
2842
2843
  el.innerHTML = html;
2843
2844
  this.forms = new Array(this.formData.length);
2844
2845
  this.formData.forEach(function (d, i) {
@@ -2851,14 +2852,13 @@ var MultiForm = /*#__PURE__*/function () {
2851
2852
  formObject.data = d;
2852
2853
  _this21.forms[i] = formObject;
2853
2854
  });
2854
- if (this.options.allowAdd === true) {
2855
- var formOptions = _extends({}, this.options, {
2856
- fields: _toConsumableArray(this.options.fields.map(function (f) {
2857
- return _extends({}, f);
2858
- }))
2859
- });
2860
- var formObject = new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions);
2861
- this.forms.push(formObject);
2855
+ var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
2856
+ if (addEl) {
2857
+ if (this.options.allowAdd === true) {
2858
+ addEl.style.display = typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows ? 'flex' : 'none';
2859
+ } else {
2860
+ addEl.style.display = 'none';
2861
+ }
2862
2862
  }
2863
2863
  }
2864
2864
  }
@@ -3477,7 +3477,7 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3477
3477
  } else {
3478
3478
  fileName = _this25.options.fileName || 'Export';
3479
3479
  }
3480
- msg += "download='".concat(fileName, ".pdf'");
3480
+ msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
3481
3481
  }
3482
3482
  msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this25.options.buttonText, "</button>\n </a>\n </div>\n ");
3483
3483
  _this25.popup.show({
@@ -4157,7 +4157,11 @@ var WebsyResultList = /*#__PURE__*/function () {
4157
4157
  }]);
4158
4158
  return WebsyResultList;
4159
4159
  }();
4160
- /* global history */
4160
+ /*
4161
+ global
4162
+ history
4163
+ WebsyDesigns
4164
+ */
4161
4165
  var WebsyRouter = /*#__PURE__*/function () {
4162
4166
  function WebsyRouter(options) {
4163
4167
  _classCallCheck(this, WebsyRouter);
@@ -4178,6 +4182,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4178
4182
  persistentParameters: false,
4179
4183
  fieldValueSeparator: ':'
4180
4184
  };
4185
+ this.apiService = new WebsyDesigns.APIService('');
4181
4186
  this.triggerIdList = [];
4182
4187
  this.viewIdList = [];
4183
4188
  this.previousPath = '';
@@ -4213,7 +4218,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4213
4218
  value: function addGroup(group) {
4214
4219
  var _this30 = this;
4215
4220
  if (!this.groups[group]) {
4216
- var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4221
+ var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
4217
4222
  if (els) {
4218
4223
  this.getClosestParent(els[0], function (parent) {
4219
4224
  _this30.groups[group] = {
@@ -4346,9 +4351,9 @@ var WebsyRouter = /*#__PURE__*/function () {
4346
4351
  if (!this.groups) {
4347
4352
  this.groups = {};
4348
4353
  }
4349
- var parentEl = document.querySelector(".websy-view[data-view=\"".concat(parent, "\"]"));
4354
+ var parentEl = document.querySelector(".".concat(this.options.viewClass, "[data-view=\"").concat(parent, "\"]"));
4350
4355
  if (parentEl) {
4351
- var els = parentEl.querySelectorAll(".websy-view[data-group]");
4356
+ var els = parentEl.querySelectorAll(".".concat(this.options.viewClass, "[data-group]"));
4352
4357
  for (var i = 0; i < els.length; i++) {
4353
4358
  var g = els[i].getAttribute('data-group');
4354
4359
  var v = els[i].getAttribute('data-view');
@@ -4631,28 +4636,90 @@ var WebsyRouter = /*#__PURE__*/function () {
4631
4636
  });
4632
4637
  }
4633
4638
  }
4639
+ }, {
4640
+ key: "preloadView",
4641
+ value: function preloadView(view, callbackFn) {
4642
+ if (this.options.views[view].load) {
4643
+ this.options.views[view].load(callbackFn);
4644
+ }
4645
+ }
4646
+ }, {
4647
+ key: "initView",
4648
+ value: function initView(view) {
4649
+ var _this33 = this;
4650
+ return new Promise(function (resolve, reject) {
4651
+ if (!_this33.options.views[view]) {
4652
+ _this33.options.views[view] = {
4653
+ components: []
4654
+ };
4655
+ }
4656
+ if (_this33.options.views[view].ready === true) {
4657
+ resolve();
4658
+ } else if (_this33.options.views[view].template) {
4659
+ _this33.preloadView(view, function () {
4660
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4661
+ var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this33.options.viewClass));
4662
+ if (viewEl) {
4663
+ _this33.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
4664
+ template: _this33.options.views[view].template,
4665
+ data: data,
4666
+ readyCallbackFn: function readyCallbackFn() {
4667
+ _this33.options.views[view].ready = true;
4668
+ resolve();
4669
+ }
4670
+ });
4671
+ } else {
4672
+ console.log("No view element found for '".concat(view, "' to render template"));
4673
+ _this33.options.views[view].ready = true;
4674
+ resolve();
4675
+ }
4676
+ });
4677
+ } else if (_this33.options.views[view].ready !== true && _this33.options.views[view].load) {
4678
+ _this33.preloadView(view, function () {
4679
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4680
+ _this33.options.views[view].ready = true;
4681
+ resolve();
4682
+ });
4683
+ } else {
4684
+ _this33.options.views[view].ready = true;
4685
+ resolve();
4686
+ }
4687
+ });
4688
+ }
4634
4689
  }, {
4635
4690
  key: "showView",
4636
4691
  value: function showView(view, params, group) {
4692
+ var _this34 = this;
4637
4693
  if (view === '/' || view === '') {
4638
4694
  view = this.options.defaultView || '';
4639
4695
  }
4640
- this.activateItem(view, this.options.triggerClass);
4641
- this.activateItem(view, this.options.viewClass);
4642
- var children = this.getActiveViewsFromParent(view);
4643
- for (var c = 0; c < children.length; c++) {
4644
- this.activateItem(children[c].view, this.options.triggerClass);
4645
- this.activateItem(children[c].view, this.options.viewClass);
4646
- this.showComponents(children[c].view);
4647
- this.publish('show', [children[c].view, null, group]);
4648
- }
4649
- if (this.previousView !== this.currentView || group !== 'main') {
4650
- this.showComponents(view);
4651
- this.publish('show', [view, params, group]);
4652
- } else if (this.previousView === this.currentView && this.previousParams.path !== this.currentParams.path) {
4653
- this.showComponents(view);
4654
- this.publish('show', [view, params, group]);
4655
- }
4696
+ this.initView(view).then(function () {
4697
+ _this34.activateItem(view, _this34.options.triggerClass);
4698
+ _this34.activateItem(view, _this34.options.viewClass);
4699
+ var children = _this34.getActiveViewsFromParent(view);
4700
+ for (var c = 0; c < children.length; c++) {
4701
+ _this34.activateItem(children[c].view, _this34.options.triggerClass);
4702
+ _this34.activateItem(children[c].view, _this34.options.viewClass);
4703
+ _this34.showComponents(children[c].view);
4704
+ if (children[c].show) {
4705
+ children[c].show.call(children[c]);
4706
+ }
4707
+ _this34.publish('show', [children[c].view, null, group]);
4708
+ }
4709
+ if (_this34.previousView !== _this34.currentView || group !== 'main') {
4710
+ _this34.showComponents(view);
4711
+ if (_this34.options.views[view].show) {
4712
+ _this34.options.views[view].show.call(_this34.options.views[view]);
4713
+ }
4714
+ _this34.publish('show', [view, params, group]);
4715
+ } else if (_this34.previousView === _this34.currentView && _this34.previousParams.path !== _this34.currentParams.path) {
4716
+ _this34.showComponents(view);
4717
+ if (_this34.options.views[view].show) {
4718
+ _this34.options.views[view].show.call(_this34.options.views[view]);
4719
+ }
4720
+ _this34.publish('show', [view, params, group]);
4721
+ }
4722
+ });
4656
4723
  }
4657
4724
  }, {
4658
4725
  key: "reloadCurrentView",
@@ -4967,7 +5034,7 @@ var Switch = /*#__PURE__*/function () {
4967
5034
  /* global WebsyDesigns */
4968
5035
  var WebsyTemplate = /*#__PURE__*/function () {
4969
5036
  function WebsyTemplate(elementId, options) {
4970
- var _this33 = this;
5037
+ var _this35 = this;
4971
5038
  _classCallCheck(this, WebsyTemplate);
4972
5039
  var DEFAULTS = {
4973
5040
  listeners: {
@@ -4975,7 +5042,16 @@ var WebsyTemplate = /*#__PURE__*/function () {
4975
5042
  }
4976
5043
  };
4977
5044
  this.options = _extends({}, DEFAULTS, options);
4978
- this.elementId = elementId;
5045
+ if (_typeof(elementId) === 'object') {
5046
+ if (elementId.id) {
5047
+ this.elementId = elementId.id;
5048
+ } else {
5049
+ elementId.id = WebsyDesigns.Utils.createIdentity();
5050
+ this.elementId = elementId.id;
5051
+ }
5052
+ } else {
5053
+ this.elementId = elementId;
5054
+ }
4979
5055
  this.templateService = new WebsyDesigns.APIService('');
4980
5056
  if (!elementId) {
4981
5057
  console.log('No element Id provided for Websy Template');
@@ -4987,8 +5063,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
4987
5063
  }
4988
5064
  if (_typeof(options.template) === 'object' && options.template.url) {
4989
5065
  this.templateService.get(options.template.url).then(function (templateString) {
4990
- _this33.options.template = templateString;
4991
- _this33.render();
5066
+ _this35.options.template = templateString;
5067
+ _this35.render();
4992
5068
  });
4993
5069
  } else {
4994
5070
  this.render();
@@ -4997,7 +5073,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
4997
5073
  _createClass(WebsyTemplate, [{
4998
5074
  key: "buildHTML",
4999
5075
  value: function buildHTML() {
5000
- var _this34 = this;
5076
+ var _this36 = this;
5001
5077
  var html = "";
5002
5078
  if (this.options.template) {
5003
5079
  var template = this.options.template;
@@ -5046,14 +5122,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5046
5122
  }
5047
5123
  }
5048
5124
  if (polarity === true) {
5049
- if (typeof _this34.options.data[parts[0]] !== 'undefined' && _this34.options.data[parts[0]] === parts[1]) {
5125
+ if (typeof _this36.options.data[parts[0]] !== 'undefined' && _this36.options.data[parts[0]] === parts[1]) {
5050
5126
  // remove the <if> tags
5051
5127
  removeAll = false;
5052
5128
  } else if (parts[0] === parts[1]) {
5053
5129
  removeAll = false;
5054
5130
  }
5055
5131
  } else if (polarity === false) {
5056
- if (typeof _this34.options.data[parts[0]] !== 'undefined' && _this34.options.data[parts[0]] !== parts[1]) {
5132
+ if (typeof _this36.options.data[parts[0]] !== 'undefined' && _this36.options.data[parts[0]] !== parts[1]) {
5057
5133
  // remove the <if> tags
5058
5134
  removeAll = false;
5059
5135
  }
@@ -5087,6 +5163,12 @@ var WebsyTemplate = /*#__PURE__*/function () {
5087
5163
  }
5088
5164
  return html;
5089
5165
  }
5166
+ }, {
5167
+ key: "data",
5168
+ set: function set(d) {
5169
+ this.options.data = d;
5170
+ this.render();
5171
+ }
5090
5172
  }, {
5091
5173
  key: "handleClick",
5092
5174
  value: function handleClick(event) {
@@ -5366,7 +5448,7 @@ var WebsyUtils = {
5366
5448
  /* global WebsyDesigns */
5367
5449
  var WebsyTable = /*#__PURE__*/function () {
5368
5450
  function WebsyTable(elementId, options) {
5369
- var _this35 = this;
5451
+ var _this37 = this;
5370
5452
  _classCallCheck(this, WebsyTable);
5371
5453
  var DEFAULTS = {
5372
5454
  pageSize: 20,
@@ -5399,8 +5481,8 @@ var WebsyTable = /*#__PURE__*/function () {
5399
5481
  allowClear: false,
5400
5482
  disableSearch: true,
5401
5483
  onItemSelected: function onItemSelected(selectedItem) {
5402
- if (_this35.options.onChangePageSize) {
5403
- _this35.options.onChangePageSize(selectedItem.value);
5484
+ if (_this37.options.onChangePageSize) {
5485
+ _this37.options.onChangePageSize(selectedItem.value);
5404
5486
  }
5405
5487
  }
5406
5488
  });
@@ -5424,20 +5506,20 @@ var WebsyTable = /*#__PURE__*/function () {
5424
5506
  }, {
5425
5507
  key: "appendRows",
5426
5508
  value: function appendRows(data) {
5427
- var _this36 = this;
5509
+ var _this38 = this;
5428
5510
  this._isRendered = false;
5429
5511
  this.hideError();
5430
5512
  var bodyHTML = '';
5431
5513
  if (data) {
5432
5514
  bodyHTML += data.map(function (r, rowIndex) {
5433
5515
  return '<tr>' + r.map(function (c, i) {
5434
- if (_this36.options.columns[i].show !== false) {
5516
+ if (_this38.options.columns[i].show !== false) {
5435
5517
  var style = '';
5436
5518
  if (c.style) {
5437
5519
  style += c.style;
5438
5520
  }
5439
- if (_this36.options.columns[i].width) {
5440
- style += "width: ".concat(_this36.options.columns[i].width, "; ");
5521
+ if (_this38.options.columns[i].width) {
5522
+ style += "width: ".concat(_this38.options.columns[i].width, "; ");
5441
5523
  }
5442
5524
  if (c.backgroundColor) {
5443
5525
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5448,16 +5530,16 @@ var WebsyTable = /*#__PURE__*/function () {
5448
5530
  if (c.color) {
5449
5531
  style += "color: ".concat(c.color, "; ");
5450
5532
  }
5451
- if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5452
- 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 ");
5453
- } else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5454
- 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 ");
5533
+ if (_this38.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5534
+ 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 ");
5535
+ } else if ((_this38.options.columns[i].showAsNavigatorLink === true || _this38.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5536
+ 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 ");
5455
5537
  } else {
5456
5538
  var info = c.value;
5457
- if (_this36.options.columns[i].showAsImage === true) {
5539
+ if (_this38.options.columns[i].showAsImage === true) {
5458
5540
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5459
5541
  }
5460
- 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 ");
5542
+ 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 ");
5461
5543
  }
5462
5544
  }
5463
5545
  }).join('') + '</tr>';
@@ -5617,7 +5699,7 @@ var WebsyTable = /*#__PURE__*/function () {
5617
5699
  }, {
5618
5700
  key: "render",
5619
5701
  value: function render(data) {
5620
- var _this37 = this;
5702
+ var _this39 = this;
5621
5703
  this._isRendered = false;
5622
5704
  if (!this.options.columns) {
5623
5705
  return;
@@ -5645,7 +5727,7 @@ var WebsyTable = /*#__PURE__*/function () {
5645
5727
  if (c.width) {
5646
5728
  style += "width: ".concat(c.width || 'auto', ";");
5647
5729
  }
5648
- 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 ");
5730
+ 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 ? _this39.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5649
5731
  }
5650
5732
  }).join('') + '</tr>';
5651
5733
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5663,7 +5745,7 @@ var WebsyTable = /*#__PURE__*/function () {
5663
5745
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
5664
5746
  if (pagingEl) {
5665
5747
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5666
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5748
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this39.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5667
5749
  });
5668
5750
  var startIndex = 0;
5669
5751
  if (this.options.pageCount > 8) {
@@ -5719,7 +5801,7 @@ var WebsyTable = /*#__PURE__*/function () {
5719
5801
  /* global WebsyDesigns */
5720
5802
  var WebsyTable2 = /*#__PURE__*/function () {
5721
5803
  function WebsyTable2(elementId, options) {
5722
- var _this38 = this;
5804
+ var _this40 = this;
5723
5805
  _classCallCheck(this, WebsyTable2);
5724
5806
  var DEFAULTS = {
5725
5807
  pageSize: 20,
@@ -5754,8 +5836,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5754
5836
  allowClear: false,
5755
5837
  disableSearch: true,
5756
5838
  onItemSelected: function onItemSelected(selectedItem) {
5757
- if (_this38.options.onChangePageSize) {
5758
- _this38.options.onChangePageSize(selectedItem.value);
5839
+ if (_this40.options.onChangePageSize) {
5840
+ _this40.options.onChangePageSize(selectedItem.value);
5759
5841
  }
5760
5842
  }
5761
5843
  });
@@ -5777,20 +5859,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
5777
5859
  _createClass(WebsyTable2, [{
5778
5860
  key: "appendRows",
5779
5861
  value: function appendRows(data) {
5780
- var _this39 = this;
5862
+ var _this41 = this;
5781
5863
  this.hideError();
5782
5864
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5783
5865
  var bodyHTML = '';
5784
5866
  if (data) {
5785
5867
  bodyHTML += data.map(function (r, rowIndex) {
5786
5868
  return '<tr>' + r.map(function (c, i) {
5787
- if (_this39.options.columns[i].show !== false) {
5788
- var style = "height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px;");
5869
+ if (_this41.options.columns[i].show !== false) {
5870
+ var style = "height: ".concat(_this41.options.cellSize, "px; line-height: ").concat(_this41.options.cellSize, "px;");
5789
5871
  if (c.style) {
5790
5872
  style += c.style;
5791
5873
  }
5792
- if (_this39.options.columns[i].width) {
5793
- style += "width: ".concat(_this39.options.columns[i].width, "; ");
5874
+ if (_this41.options.columns[i].width) {
5875
+ style += "width: ".concat(_this41.options.columns[i].width, "; ");
5794
5876
  }
5795
5877
  if (c.backgroundColor) {
5796
5878
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5801,16 +5883,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
5801
5883
  if (c.color) {
5802
5884
  style += "color: ".concat(c.color, "; ");
5803
5885
  }
5804
- if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5805
- 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 ");
5806
- } else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5807
- 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 ");
5886
+ if (_this41.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5887
+ return "\n <td \n data-row-index='".concat(_this41.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this41.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(_this41.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this41.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5888
+ } else if ((_this41.options.columns[i].showAsNavigatorLink === true || _this41.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5889
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this41.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this41.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this41.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this41.options.columns[i].linkText || c.value, "</td>\n ");
5808
5890
  } else {
5809
5891
  var info = c.value;
5810
- if (_this39.options.columns[i].showAsImage === true) {
5892
+ if (_this41.options.columns[i].showAsImage === true) {
5811
5893
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5812
5894
  }
5813
- 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 ");
5895
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this41.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this41.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 ");
5814
5896
  }
5815
5897
  }
5816
5898
  }).join('') + '</tr>';
@@ -6044,7 +6126,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6044
6126
  }, {
6045
6127
  key: "render",
6046
6128
  value: function render(data) {
6047
- var _this40 = this;
6129
+ var _this42 = this;
6048
6130
  if (!this.options.columns) {
6049
6131
  return;
6050
6132
  }
@@ -6072,7 +6154,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6072
6154
  if (c.width) {
6073
6155
  style += "width: ".concat(c.width || 'auto', "; ");
6074
6156
  }
6075
- 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 ");
6157
+ 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 ? _this42.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6076
6158
  }
6077
6159
  }).join('') + '</tr>';
6078
6160
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6082,7 +6164,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6082
6164
  var dropdownHTML = "";
6083
6165
  this.options.columns.forEach(function (c, i) {
6084
6166
  if (c.searchable && c.searchField) {
6085
- dropdownHTML += "\n <div id=\"".concat(_this40.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6167
+ dropdownHTML += "\n <div id=\"".concat(_this42.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6086
6168
  }
6087
6169
  });
6088
6170
  dropdownEl.innerHTML = dropdownHTML;
@@ -6102,7 +6184,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6102
6184
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
6103
6185
  if (pagingEl) {
6104
6186
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6105
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6187
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this42.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6106
6188
  });
6107
6189
  var startIndex = 0;
6108
6190
  if (this.options.pageCount > 8) {
@@ -6179,17 +6261,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
6179
6261
  }, {
6180
6262
  key: "getColumnParameters",
6181
6263
  value: function getColumnParameters(values) {
6182
- var _this41 = this;
6264
+ var _this43 = this;
6183
6265
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6184
6266
  tableEl.style.tableLayout = 'auto';
6185
6267
  tableEl.style.width = 'auto';
6186
6268
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6187
6269
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6188
6270
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6189
- 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 ");
6271
+ 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 ? _this43.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6190
6272
  }).join('') + '</tr>';
6191
6273
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6192
- 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 ");
6274
+ return "\n <td \n style='height: ".concat(_this43.options.cellSize, "px; line-height: ").concat(_this43.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6193
6275
  }).join('') + '</tr>';
6194
6276
  // get height of the first data cell
6195
6277
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6353,7 +6435,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6353
6435
  }, {
6354
6436
  key: "buildBodyHtml",
6355
6437
  value: function buildBodyHtml() {
6356
- var _this42 = this;
6438
+ var _this44 = this;
6357
6439
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6358
6440
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6359
6441
  if (!this.options.columns) {
@@ -6378,7 +6460,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6378
6460
  row.forEach(function (cell, cellIndex) {
6379
6461
  var sizeIndex = cell.level || cellIndex;
6380
6462
  var colIndex = cell.index || cellIndex;
6381
- if (typeof sizingColumns[sizeIndex] === 'undefined' || _this42.options.columns[_this42.options.columns.length - 1][colIndex].show === false) {
6463
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || _this44.options.columns[_this44.options.columns.length - 1][colIndex].show === false) {
6382
6464
  return; // need to revisit this logic
6383
6465
  }
6384
6466
 
@@ -6405,7 +6487,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6405
6487
  style += "color: ".concat(cell.color, "; ");
6406
6488
  }
6407
6489
  // console.log('rowspan', cell.rowspan)
6408
- 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.replace ? cell.value.replace(/'/g, '`') : 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(colIndex, "'\n ");
6490
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this44.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : 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(colIndex, "'\n ");
6409
6491
  // if (useWidths === true) {
6410
6492
  // bodyHtml += `
6411
6493
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6414,10 +6496,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6414
6496
  // }
6415
6497
  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(colIndex, "'\n >");
6416
6498
  if (cell.expandable === true) {
6417
- 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>");
6499
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this44.options.plusIcon, "</i>");
6418
6500
  }
6419
6501
  if (cell.collapsable === true) {
6420
- 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>");
6502
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this44.options.minusIcon, "</i>");
6421
6503
  }
6422
6504
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6423
6505
  cell.value = "\n <a href=\"".concat(encodeURI(cell.value), "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
@@ -6438,7 +6520,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6438
6520
  }, {
6439
6521
  key: "buildHeaderHtml",
6440
6522
  value: function buildHeaderHtml() {
6441
- var _this43 = this;
6523
+ var _this45 = this;
6442
6524
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6443
6525
  if (!this.options.columns) {
6444
6526
  return '';
@@ -6459,7 +6541,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6459
6541
  // // if we're calculating the size we only want to render the last row of column headers
6460
6542
  // return
6461
6543
  // }
6462
- headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this43.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
6544
+ headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this45.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
6463
6545
  row.filter(function (c) {
6464
6546
  return c.show !== false;
6465
6547
  }).forEach(function (col, colIndex) {
@@ -6479,24 +6561,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6479
6561
  if (col.style) {
6480
6562
  style += col.style;
6481
6563
  }
6482
- 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 ");
6564
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this45.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6483
6565
  // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6484
6566
  // headerHtml += `
6485
6567
  // style='width: ${col.width || col.actualWidth}px'
6486
6568
  // width='${col.width || col.actualWidth}'
6487
6569
  // `
6488
6570
  // }
6489
- 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>");
6571
+ 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 ? _this45.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this45.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6490
6572
  });
6491
6573
  headerHtml += "</tr>";
6492
6574
  });
6493
6575
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6494
6576
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6495
6577
  if (c.searchable && c.isExternalSearch === true) {
6496
- var testEl = document.getElementById("".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i));
6578
+ var testEl = document.getElementById("".concat(_this45.elementId, "_columnSearch_").concat(c.dimId || i));
6497
6579
  if (!testEl) {
6498
6580
  var newE = document.createElement('div');
6499
- newE.id = "".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i);
6581
+ newE.id = "".concat(_this45.elementId, "_columnSearch_").concat(c.dimId || i);
6500
6582
  newE.className = 'websy-modal-dropdown';
6501
6583
  dropdownEl.appendChild(newE);
6502
6584
  }
@@ -6519,7 +6601,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6519
6601
  }, {
6520
6602
  key: "buildTotalHtml",
6521
6603
  value: function buildTotalHtml() {
6522
- var _this44 = this;
6604
+ var _this46 = this;
6523
6605
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6524
6606
  if (!this.options.totals) {
6525
6607
  return '';
@@ -6535,7 +6617,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6535
6617
 
6536
6618
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6537
6619
  if (useWidths === true) {
6538
- 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 ");
6620
+ totalHtml += "\n style='width: ".concat(_this46.options.columns[_this46.options.columns.length - 1][colIndex].width || _this46.options.columns[_this46.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6539
6621
  }
6540
6622
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
6541
6623
  });
@@ -6545,7 +6627,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6545
6627
  }, {
6546
6628
  key: "calculateSizes",
6547
6629
  value: function calculateSizes() {
6548
- var _this45 = this;
6630
+ var _this47 = this;
6549
6631
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6550
6632
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
6551
6633
  var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
@@ -6589,7 +6671,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6589
6671
  rows.forEach(function (row, rowIndex) {
6590
6672
  Array.from(row.children).forEach(function (col, colIndex) {
6591
6673
  var colSize = col.getBoundingClientRect();
6592
- _this45.sizes.cellHeight = colSize.height;
6674
+ _this47.sizes.cellHeight = colSize.height;
6593
6675
  if (columnsForSizing[colIndex]) {
6594
6676
  if (!columnsForSizing[colIndex].actualWidth) {
6595
6677
  columnsForSizing[colIndex].potentialWidth = 0;
@@ -6601,7 +6683,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6601
6683
  // columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
6602
6684
  // }
6603
6685
  columnsForSizing[colIndex].cellHeight = colSize.height;
6604
- if (colIndex >= _this45.pinnedColumns) {
6686
+ if (colIndex >= _this47.pinnedColumns) {
6605
6687
  firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
6606
6688
  }
6607
6689
  }
@@ -6616,7 +6698,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6616
6698
  return a + (b.width || b.actualWidth);
6617
6699
  }, 0);
6618
6700
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
6619
- return i >= _this45.pinnedColumns;
6701
+ return i >= _this47.pinnedColumns;
6620
6702
  }).reduce(function (a, b) {
6621
6703
  return a + (b.width || b.actualWidth);
6622
6704
  }, 0);
@@ -6627,7 +6709,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6627
6709
  var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
6628
6710
  columnsForSizing.forEach(function (c) {
6629
6711
  c.shouldGrow = true;
6630
- if (_this45.options.autoFitColumns === false) {
6712
+ if (_this47.options.autoFitColumns === false) {
6631
6713
  c.shouldGrow = false;
6632
6714
  if (c.potentialWidth > c.actualWidth) {
6633
6715
  c.shouldGrow = true;
@@ -6646,7 +6728,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6646
6728
  // if (!c.width) {
6647
6729
  // if (c.actualWidth < equalWidth) {
6648
6730
  // adjust the width
6649
- if (_this45.options.autoFitColumns === true) {
6731
+ if (_this47.options.autoFitColumns === true) {
6650
6732
  if (c.width) {
6651
6733
  c.width += equalWidth;
6652
6734
  }
@@ -6670,9 +6752,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6670
6752
  }
6671
6753
  // }
6672
6754
  // }
6673
- _this45.sizes.totalWidth += c.width || c.actualWidth;
6674
- if (i > _this45.pinnedColumns) {
6675
- _this45.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6755
+ _this47.sizes.totalWidth += c.width || c.actualWidth;
6756
+ if (i > _this47.pinnedColumns) {
6757
+ _this47.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6676
6758
  }
6677
6759
  // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6678
6760
  });
@@ -6731,7 +6813,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6731
6813
  }, {
6732
6814
  key: "createSample",
6733
6815
  value: function createSample(data) {
6734
- var _this46 = this;
6816
+ var _this48 = this;
6735
6817
  var output = [];
6736
6818
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
6737
6819
  if (col.maxLength) {
@@ -6741,7 +6823,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6741
6823
  } else if (data) {
6742
6824
  var longest = '';
6743
6825
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
6744
- if (data[i].length === _this46.options.columns[_this46.options.columns.length - 1].length) {
6826
+ if (data[i].length === _this48.options.columns[_this48.options.columns.length - 1].length) {
6745
6827
  if (longest.length < data[i][colIndex].value.length) {
6746
6828
  longest = data[i][colIndex].value;
6747
6829
  }
@@ -7013,7 +7095,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7013
7095
  }, {
7014
7096
  key: "perpetualScroll",
7015
7097
  value: function perpetualScroll() {
7016
- var _this47 = this;
7098
+ var _this49 = this;
7017
7099
  // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
7018
7100
  if (this.touchEndTime - this.currentTouchtime > 300) {
7019
7101
  return;
@@ -7032,17 +7114,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
7032
7114
  var direction = touchDistance > 0 ? -1 : 1;
7033
7115
  var _loop2 = function _loop2(i) {
7034
7116
  setTimeout(function () {
7035
- var delta = _this47.mouseYStart - _this47.currentClientY + _this47.sizes.cellHeight * (i + 1) * direction;
7117
+ var delta = _this49.mouseYStart - _this49.currentClientY + _this49.sizes.cellHeight * (i + 1) * direction;
7036
7118
  delta = Math.min(10, delta);
7037
7119
  delta = Math.max(-10, delta);
7038
7120
  // only run this if isPerpetual === true
7039
7121
  // this value is reset to false on touchStart
7040
- if (_this47.isPerpetual === true) {
7122
+ if (_this49.isPerpetual === true) {
7041
7123
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7042
7124
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
7043
- _this47.scrollY(Math.max(-5, Math.min(5, delta)));
7044
- if (_this47.scrollTimeout) {
7045
- clearTimeout(_this47.scrollTimeout);
7125
+ _this49.scrollY(Math.max(-5, Math.min(5, delta)));
7126
+ if (_this49.scrollTimeout) {
7127
+ clearTimeout(_this49.scrollTimeout);
7046
7128
  }
7047
7129
  }
7048
7130
  }, 1000 / fps * i);
@@ -7310,7 +7392,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7310
7392
  /* global d3 include WebsyDesigns */
7311
7393
  var WebsyChart = /*#__PURE__*/function () {
7312
7394
  function WebsyChart(elementId, options) {
7313
- var _this48 = this;
7395
+ var _this50 = this;
7314
7396
  _classCallCheck(this, WebsyChart);
7315
7397
  var DEFAULTS = {
7316
7398
  margin: {
@@ -7369,7 +7451,7 @@ var WebsyChart = /*#__PURE__*/function () {
7369
7451
  this.invertOverride = function (input, input2) {
7370
7452
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7371
7453
  var xAxis = 'bottom';
7372
- if (_this48.options.orientation === 'horizontal') {
7454
+ if (_this50.options.orientation === 'horizontal') {
7373
7455
  xAxis = 'left';
7374
7456
  }
7375
7457
  if (forBrush === true) {
@@ -7377,12 +7459,12 @@ var WebsyChart = /*#__PURE__*/function () {
7377
7459
  }
7378
7460
  xAxis += 'Axis';
7379
7461
  var output;
7380
- var width = _this48.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7462
+ var width = _this50.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7381
7463
  // if (this.customBottomRange) {
7382
- for (var index = 0; index < _this48.customBottomRange.length; index++) {
7383
- if (input > _this48.customBottomRange[index]) {
7384
- if (_this48.customBottomRange[index + 1]) {
7385
- if (input < _this48.customBottomRange[index + 1]) {
7464
+ for (var index = 0; index < _this50.customBottomRange.length; index++) {
7465
+ if (input > _this50.customBottomRange[index]) {
7466
+ if (_this50.customBottomRange[index + 1]) {
7467
+ if (input < _this50.customBottomRange[index + 1]) {
7386
7468
  output = index;
7387
7469
  break;
7388
7470
  }
@@ -7547,9 +7629,9 @@ var WebsyChart = /*#__PURE__*/function () {
7547
7629
  }, {
7548
7630
  key: "handleEventMouseMove",
7549
7631
  value: function handleEventMouseMove(event, d) {
7550
- var _this49 = this;
7632
+ var _this51 = this;
7551
7633
  var bisectDate = d3.bisector(function (d) {
7552
- return _this49.parseX(d.x.value);
7634
+ return _this51.parseX(d.x.value);
7553
7635
  }).left;
7554
7636
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
7555
7637
  var xAxis = 'bottomAxis';
@@ -7582,9 +7664,9 @@ var WebsyChart = /*#__PURE__*/function () {
7582
7664
  xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
7583
7665
  }
7584
7666
  this.options.data.series.forEach(function (s) {
7585
- if (_this49.options.data[xData].scale !== 'Time') {
7667
+ if (_this51.options.data[xData].scale !== 'Time') {
7586
7668
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7587
- xPoint = _this49.customBottomRange[x0] + (_this49.customBottomRange[x0 + 1] - _this49.customBottomRange[x0]) / 2;
7669
+ xPoint = _this51.customBottomRange[x0] + (_this51.customBottomRange[x0 + 1] - _this51.customBottomRange[x0]) / 2;
7588
7670
  // }
7589
7671
  // else {
7590
7672
  // xPoint = this[xAxis](this.parseX(xLabel))
@@ -7604,41 +7686,41 @@ var WebsyChart = /*#__PURE__*/function () {
7604
7686
  var index = bisectDate(s.data, x0, 1);
7605
7687
  var pointA = s.data[index - 1];
7606
7688
  var pointB = s.data[index];
7607
- if (_this49.options.orientation === 'horizontal') {
7689
+ if (_this51.options.orientation === 'horizontal') {
7608
7690
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7609
7691
  pointB = _toConsumableArray(s.data).reverse()[index];
7610
7692
  }
7611
7693
  if (pointA && !pointB) {
7612
- xPoint = _this49[xAxis](_this49.parseX(pointA.x.value));
7694
+ xPoint = _this51[xAxis](_this51.parseX(pointA.x.value));
7613
7695
  tooltipTitle = pointA.x.value;
7614
7696
  if (!pointA.y.color) {
7615
7697
  pointA.y.color = s.color;
7616
7698
  }
7617
7699
  tooltipData.push(pointA);
7618
7700
  if (typeof pointA.x.value.getTime !== 'undefined') {
7619
- tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointA.x.value);
7701
+ tooltipTitle = d3.timeFormat(_this51.options.dateFormat || _this51.options.calculatedTimeFormatPattern)(pointA.x.value);
7620
7702
  }
7621
7703
  }
7622
7704
  if (pointB && !pointA) {
7623
- xPoint = _this49[xAxis](_this49.parseX(pointB.x.value));
7705
+ xPoint = _this51[xAxis](_this51.parseX(pointB.x.value));
7624
7706
  tooltipTitle = pointB.x.value;
7625
7707
  if (!pointB.y.color) {
7626
7708
  pointB.y.color = s.color;
7627
7709
  }
7628
7710
  tooltipData.push(pointB);
7629
7711
  if (typeof pointB.x.value.getTime !== 'undefined') {
7630
- tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7712
+ tooltipTitle = d3.timeFormat(_this51.options.dateFormat || _this51.options.calculatedTimeFormatPattern)(pointB.x.value);
7631
7713
  }
7632
7714
  }
7633
7715
  if (pointA && pointB) {
7634
- var d0 = _this49[xAxis](_this49.parseX(pointA.x.value));
7635
- var d1 = _this49[xAxis](_this49.parseX(pointB.x.value));
7716
+ var d0 = _this51[xAxis](_this51.parseX(pointA.x.value));
7717
+ var d1 = _this51[xAxis](_this51.parseX(pointB.x.value));
7636
7718
  var mid = Math.abs(d0 - d1) / 2;
7637
7719
  if (d3.pointer(event)[0] - d0 >= mid) {
7638
7720
  xPoint = d1;
7639
7721
  tooltipTitle = pointB.x.value;
7640
7722
  if (typeof pointB.x.value.getTime !== 'undefined') {
7641
- tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7723
+ tooltipTitle = d3.timeFormat(_this51.options.dateFormat || _this51.options.calculatedTimeFormatPattern)(pointB.x.value);
7642
7724
  }
7643
7725
  if (!pointB.y.color) {
7644
7726
  pointB.y.color = s.color;
@@ -7648,7 +7730,7 @@ var WebsyChart = /*#__PURE__*/function () {
7648
7730
  xPoint = d0;
7649
7731
  tooltipTitle = pointA.x.value;
7650
7732
  if (typeof pointB.x.value.getTime !== 'undefined') {
7651
- tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7733
+ tooltipTitle = d3.timeFormat(_this51.options.dateFormat || _this51.options.calculatedTimeFormatPattern)(pointB.x.value);
7652
7734
  }
7653
7735
  if (!pointA.y.color) {
7654
7736
  pointA.y.color = s.color;
@@ -7774,7 +7856,7 @@ var WebsyChart = /*#__PURE__*/function () {
7774
7856
  }, {
7775
7857
  key: "render",
7776
7858
  value: function render(options) {
7777
- var _this50 = this;
7859
+ var _this52 = this;
7778
7860
  /* global d3 options WebsyUtils */
7779
7861
  this._isRendered = false;
7780
7862
  if (typeof options !== 'undefined') {
@@ -7843,7 +7925,7 @@ var WebsyChart = /*#__PURE__*/function () {
7843
7925
  this.options.data.series.map(function (s, i) {
7844
7926
  return {
7845
7927
  value: s.label || s.key,
7846
- color: s.color || _this50.options.colors[i % _this50.options.colors.length]
7928
+ color: s.color || _this52.options.colors[i % _this52.options.colors.length]
7847
7929
  };
7848
7930
  });
7849
7931
  }
@@ -8200,25 +8282,25 @@ var WebsyChart = /*#__PURE__*/function () {
8200
8282
  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') {
8201
8283
  var acc = 0;
8202
8284
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8203
- var adjustment = _this50.bandPadding * index + _this50.bandPadding;
8285
+ var adjustment = _this52.bandPadding * index + _this52.bandPadding;
8204
8286
  // if (this.options.data.bottom.padding) {
8205
8287
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8206
8288
  // }
8207
- var start = _this50.widthForCalc / noOfPoints * acc;
8289
+ var start = _this52.widthForCalc / noOfPoints * acc;
8208
8290
  for (var i = 0; i < (d.valueCount || 1); i++) {
8209
8291
  var pos = i * proposedBandWidth;
8210
- _this50["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8292
+ _this52["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8211
8293
  }
8212
- acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8213
- var end = _this50.widthForCalc / noOfPoints * acc;
8294
+ acc += _this52.options.grouping !== 'stacked' && _this52.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8295
+ var end = _this52.widthForCalc / noOfPoints * acc;
8214
8296
  // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8215
8297
  return end + adjustment;
8216
8298
  })));
8217
8299
  acc = 0;
8218
8300
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8219
- var adjustment = _this50.brushBandPadding * index + _this50.brushBandPadding;
8220
- acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8221
- return (_this50.options.orientation === 'vertical' ? _this50.plotWidth : _this50.plotHeight) / noOfPoints * acc;
8301
+ var adjustment = _this52.brushBandPadding * index + _this52.brushBandPadding;
8302
+ acc += _this52.options.grouping !== 'stacked' && _this52.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8303
+ return (_this52.options.orientation === 'vertical' ? _this52.plotWidth : _this52.plotHeight) / noOfPoints * acc;
8222
8304
  })));
8223
8305
  }
8224
8306
  // }
@@ -8391,7 +8473,7 @@ var WebsyChart = /*#__PURE__*/function () {
8391
8473
  this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
8392
8474
  if (this.options.data.bottom.formatter) {
8393
8475
  this.bAxisFunc.tickFormat(function (d) {
8394
- return _this50.options.data.bottom.formatter(d);
8476
+ return _this52.options.data.bottom.formatter(d);
8395
8477
  });
8396
8478
  }
8397
8479
  this.bottomAxisLayer.call(this.bAxisFunc);
@@ -8401,7 +8483,7 @@ var WebsyChart = /*#__PURE__*/function () {
8401
8483
  }
8402
8484
  if (this.customBottomRange.length > 0) {
8403
8485
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8404
- return "translate(".concat(_this50.customBottomRange[i] + (_this50.customBottomRange[i + 1] - _this50.customBottomRange[i]) / 2, ", 0)");
8486
+ return "translate(".concat(_this52.customBottomRange[i] + (_this52.customBottomRange[i + 1] - _this52.customBottomRange[i]) / 2, ", 0)");
8405
8487
  });
8406
8488
  }
8407
8489
  }
@@ -8420,14 +8502,14 @@ var WebsyChart = /*#__PURE__*/function () {
8420
8502
  }
8421
8503
  if (this.options.margin.axisLeft > 0) {
8422
8504
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8423
- if (_this50.options.data.left.formatter) {
8424
- d = _this50.options.data.left.formatter(d);
8505
+ if (_this52.options.data.left.formatter) {
8506
+ d = _this52.options.data.left.formatter(d);
8425
8507
  }
8426
8508
  return d;
8427
8509
  }));
8428
8510
  if (this.customLeftRange.length > 0) {
8429
8511
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8430
- return "translate(0, ".concat(_this50.customLeftRange[i] + (_this50.customLeftRange[i + 1] - _this50.customLeftRange[i]) / 2, ")");
8512
+ return "translate(0, ".concat(_this52.customLeftRange[i] + (_this52.customLeftRange[i + 1] - _this52.customLeftRange[i]) / 2, ")");
8431
8513
  });
8432
8514
  }
8433
8515
  }
@@ -8455,8 +8537,8 @@ var WebsyChart = /*#__PURE__*/function () {
8455
8537
  }
8456
8538
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8457
8539
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8458
- if (_this50.options.data.right.formatter) {
8459
- d = _this50.options.data.right.formatter(d);
8540
+ if (_this52.options.data.right.formatter) {
8541
+ d = _this52.options.data.right.formatter(d);
8460
8542
  }
8461
8543
  return d;
8462
8544
  }));
@@ -8496,25 +8578,25 @@ var WebsyChart = /*#__PURE__*/function () {
8496
8578
  }, {
8497
8579
  key: "renderComponents",
8498
8580
  value: function renderComponents() {
8499
- var _this51 = this;
8581
+ var _this53 = this;
8500
8582
  // Draw the series data
8501
8583
  this.renderedKeys = {};
8502
8584
  this.options.data.series.forEach(function (series, index) {
8503
8585
  if (!series.key) {
8504
- series.key = _this51.createIdentity();
8586
+ series.key = _this53.createIdentity();
8505
8587
  }
8506
8588
  if (!series.color) {
8507
- series.color = _this51.options.colors[index % _this51.options.colors.length];
8589
+ series.color = _this53.options.colors[index % _this53.options.colors.length];
8508
8590
  }
8509
- _this51["render".concat(series.type || 'bar')](series, index);
8510
- _this51.renderLabels(series, index);
8511
- _this51.renderedKeys[series.key] = series.type;
8591
+ _this53["render".concat(series.type || 'bar')](series, index);
8592
+ _this53.renderLabels(series, index);
8593
+ _this53.renderedKeys[series.key] = series.type;
8512
8594
  });
8513
8595
  this.refLineLayer.selectAll('.reference-line').remove();
8514
8596
  this.refLineLayer.selectAll('.reference-line-label').remove();
8515
8597
  if (this.options.refLines && this.options.refLines.length > 0) {
8516
8598
  this.options.refLines.forEach(function (l) {
8517
- return _this51.renderRefLine(l);
8599
+ return _this53.renderRefLine(l);
8518
8600
  });
8519
8601
  }
8520
8602
  this._isRendered = true;
@@ -8522,25 +8604,25 @@ var WebsyChart = /*#__PURE__*/function () {
8522
8604
  }, {
8523
8605
  key: "renderarea",
8524
8606
  value: function renderarea(series, index) {
8525
- var _this52 = this;
8607
+ var _this54 = this;
8526
8608
  /* global d3 series index */
8527
8609
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8528
8610
  return d3.area().x(function (d) {
8529
- if (_this52.options.data[xAxis].scale === 'Time') {
8530
- return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
8611
+ if (_this54.options.data[xAxis].scale === 'Time') {
8612
+ return _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
8531
8613
  } else {
8532
- var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
8533
- var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8534
- if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8535
- xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8614
+ var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8615
+ var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8616
+ if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8617
+ xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8536
8618
  }
8537
8619
  return xPos;
8538
8620
  }
8539
8621
  }).y0(function (d) {
8540
- return _this52["".concat(yAxis, "Axis")](0);
8622
+ return _this54["".concat(yAxis, "Axis")](0);
8541
8623
  }).y1(function (d) {
8542
- return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8543
- }).curve(d3[curveStyle || _this52.options.curveStyle]);
8624
+ return _this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8625
+ }).curve(d3[curveStyle || _this54.options.curveStyle]);
8544
8626
  };
8545
8627
  var xAxis = 'bottom';
8546
8628
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8580,7 +8662,7 @@ var WebsyChart = /*#__PURE__*/function () {
8580
8662
  }, {
8581
8663
  key: "renderbar",
8582
8664
  value: function renderbar(series, index) {
8583
- var _this53 = this;
8665
+ var _this55 = this;
8584
8666
  /* global series index d3 */
8585
8667
  var xAxis = 'bottom';
8586
8668
  var yAxis = 'left';
@@ -8747,26 +8829,26 @@ var WebsyChart = /*#__PURE__*/function () {
8747
8829
  }
8748
8830
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8749
8831
  bars.attr('width', function (d, i) {
8750
- return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
8832
+ return Math.abs(getBarWidth.call(_this55, d, i, yAxis, xAxis));
8751
8833
  }).attr('height', function (d, i) {
8752
- return getBarHeight.call(_this53, d, i, yAxis, xAxis);
8834
+ return getBarHeight.call(_this55, d, i, yAxis, xAxis);
8753
8835
  }).attr('x', function (d, i) {
8754
- return getBarX.call(_this53, d, i, yAxis, xAxis);
8836
+ return getBarX.call(_this55, d, i, yAxis, xAxis);
8755
8837
  }).attr('y', function (d, i) {
8756
- return getBarY.call(_this53, d, i, yAxis, xAxis);
8838
+ return getBarY.call(_this55, d, i, yAxis, xAxis);
8757
8839
  })
8758
8840
  // .transition(this.transition)
8759
8841
  .attr('fill', function (d) {
8760
8842
  return d.y.color || d.color || series.color;
8761
8843
  });
8762
8844
  bars.enter().append('rect').attr('width', function (d, i) {
8763
- return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
8845
+ return Math.abs(getBarWidth.call(_this55, d, i, yAxis, xAxis));
8764
8846
  }).attr('height', function (d, i) {
8765
- return getBarHeight.call(_this53, d, i, yAxis, xAxis);
8847
+ return getBarHeight.call(_this55, d, i, yAxis, xAxis);
8766
8848
  }).attr('x', function (d, i) {
8767
- return getBarX.call(_this53, d, i, yAxis, xAxis);
8849
+ return getBarX.call(_this55, d, i, yAxis, xAxis);
8768
8850
  }).attr('y', function (d, i) {
8769
- return getBarY.call(_this53, d, i, yAxis, xAxis);
8851
+ return getBarY.call(_this55, d, i, yAxis, xAxis);
8770
8852
  })
8771
8853
  // .transition(this.transition)
8772
8854
  .attr('fill', function (d) {
@@ -8778,26 +8860,26 @@ var WebsyChart = /*#__PURE__*/function () {
8778
8860
  this.brushBarsInitialized[series.key] = true;
8779
8861
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8780
8862
  brushBars.attr('width', function (d, i) {
8781
- return Math.abs(getBarWidth.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8863
+ return Math.abs(getBarWidth.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8782
8864
  }).attr('height', function (d, i) {
8783
- return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8865
+ return getBarHeight.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8784
8866
  }).attr('x', function (d, i) {
8785
- return getBarX.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8867
+ return getBarX.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8786
8868
  }).attr('y', function (d, i) {
8787
- return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8869
+ return getBarY.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8788
8870
  })
8789
8871
  // .transition(this.transition)
8790
8872
  .attr('fill', function (d) {
8791
8873
  return d.y.color || d.color || series.color;
8792
8874
  });
8793
8875
  brushBars.enter().append('rect').attr('width', function (d, i) {
8794
- return Math.abs(getBarWidth.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8876
+ return Math.abs(getBarWidth.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8795
8877
  }).attr('height', function (d, i) {
8796
- return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8878
+ return getBarHeight.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8797
8879
  }).attr('x', function (d, i) {
8798
- return getBarX.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8880
+ return getBarX.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8799
8881
  }).attr('y', function (d, i) {
8800
- return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8882
+ return getBarY.call(_this55, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8801
8883
  })
8802
8884
  // .transition(this.transition)
8803
8885
  .attr('fill', function (d) {
@@ -8818,7 +8900,7 @@ var WebsyChart = /*#__PURE__*/function () {
8818
8900
  }, {
8819
8901
  key: "renderLabels",
8820
8902
  value: function renderLabels(series, index) {
8821
- var _this54 = this;
8903
+ var _this56 = this;
8822
8904
  /* global series index d3 WebsyDesigns */
8823
8905
  var xAxis = 'bottom';
8824
8906
  var yAxis = 'left';
@@ -8834,14 +8916,14 @@ var WebsyChart = /*#__PURE__*/function () {
8834
8916
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
8835
8917
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
8836
8918
  labels.attr('x', function (d) {
8837
- return getLabelX.call(_this54, d, series.labelPosition);
8919
+ return getLabelX.call(_this56, d, series.labelPosition);
8838
8920
  }).attr('y', function (d) {
8839
- return getLabelY.call(_this54, d, series.labelPosition);
8921
+ return getLabelY.call(_this56, d, series.labelPosition);
8840
8922
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
8841
- if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
8923
+ if (_this56.options.grouping === 'stacked' && d.y.value === 0) {
8842
8924
  return 'transparent';
8843
8925
  }
8844
- return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8926
+ return _this56.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8845
8927
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
8846
8928
  return d.y.label || d.y.value;
8847
8929
  }).each(function (d, i) {
@@ -8875,14 +8957,14 @@ var WebsyChart = /*#__PURE__*/function () {
8875
8957
  }
8876
8958
  });
8877
8959
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
8878
- return getLabelX.call(_this54, d, series.labelPosition);
8960
+ return getLabelX.call(_this56, d, series.labelPosition);
8879
8961
  }).attr('y', function (d) {
8880
- return getLabelY.call(_this54, d, series.labelPosition);
8962
+ return getLabelY.call(_this56, d, series.labelPosition);
8881
8963
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
8882
- if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
8964
+ if (_this56.options.grouping === 'stacked' && d.y.value === 0) {
8883
8965
  return 'transparent';
8884
8966
  }
8885
- return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8967
+ return _this56.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8886
8968
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
8887
8969
  return d.y.label || d.y.value;
8888
8970
  }).each(function (d, i) {
@@ -8960,32 +9042,32 @@ var WebsyChart = /*#__PURE__*/function () {
8960
9042
  }, {
8961
9043
  key: "renderline",
8962
9044
  value: function renderline(series, index) {
8963
- var _this55 = this;
9045
+ var _this57 = this;
8964
9046
  /* global series index d3 */
8965
9047
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
8966
9048
  return d3.line().x(function (d) {
8967
- if (_this55.options.orientation === 'horizontal') {
8968
- return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9049
+ if (_this57.options.orientation === 'horizontal') {
9050
+ return _this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8969
9051
  } else {
8970
- if (_this55.options.data[xAxis].scale === 'Time') {
8971
- return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
9052
+ if (_this57.options.data[xAxis].scale === 'Time') {
9053
+ return _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
8972
9054
  } else {
8973
- var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
8974
- var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8975
- if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8976
- xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9055
+ var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
9056
+ var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9057
+ if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9058
+ xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8977
9059
  }
8978
9060
  return xPos;
8979
9061
  }
8980
9062
  }
8981
9063
  }).y(function (d) {
8982
- if (_this55.options.orientation === 'horizontal') {
8983
- var adjustment = _this55.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this55.options.data[xAxis].bandWidth / 2;
8984
- return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value)) + adjustment;
9064
+ if (_this57.options.orientation === 'horizontal') {
9065
+ var adjustment = _this57.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this57.options.data[xAxis].bandWidth / 2;
9066
+ return _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value)) + adjustment;
8985
9067
  } else {
8986
- return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9068
+ return _this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8987
9069
  }
8988
- }).curve(d3[curveStyle || _this55.options.curveStyle]);
9070
+ }).curve(d3[curveStyle || _this57.options.curveStyle]);
8989
9071
  };
8990
9072
  var xAxis = 'bottom';
8991
9073
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9094,14 +9176,14 @@ var WebsyChart = /*#__PURE__*/function () {
9094
9176
  }, {
9095
9177
  key: "rendersymbol",
9096
9178
  value: function rendersymbol(series, index) {
9097
- var _this56 = this;
9179
+ var _this58 = this;
9098
9180
  /* global d3 series index series.key */
9099
9181
  var drawSymbol = function drawSymbol(size) {
9100
9182
  return d3.symbol()
9101
9183
  // .type(d => {
9102
9184
  // return d3.symbols[0]
9103
9185
  // })
9104
- .size(size || _this56.options.symbolSize);
9186
+ .size(size || _this58.options.symbolSize);
9105
9187
  };
9106
9188
  var xAxis = 'bottom';
9107
9189
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9127,27 +9209,27 @@ var WebsyChart = /*#__PURE__*/function () {
9127
9209
  // else {
9128
9210
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9129
9211
  // }
9130
- var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9131
- var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9132
- if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9133
- xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9134
- }
9135
- var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
9136
- if (_this56.options.orientation === 'horizontal') {
9137
- return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9212
+ var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
9213
+ var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9214
+ if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9215
+ xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9216
+ }
9217
+ var adjustment = _this58.options.data[xAxis].scale === 'Time' || _this58.options.data[xAxis].scale === 'Linear' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
9218
+ if (_this58.options.orientation === 'horizontal') {
9219
+ return "translate(".concat(_this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9138
9220
  } else {
9139
- if (_this56.options.data[xAxis].scale === 'Time') {
9140
- xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
9221
+ if (_this58.options.data[xAxis].scale === 'Time') {
9222
+ xPos = _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
9141
9223
  } else {
9142
- var _xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9143
- var _xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9144
- if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9145
- _xPos = _xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9224
+ var _xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
9225
+ var _xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9226
+ if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9227
+ _xPos = _xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9146
9228
  }
9147
9229
  // return xPos
9148
9230
  }
9149
9231
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9150
- return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9232
+ return "translate(".concat(xPos, ", ").concat(_this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9151
9233
  }
9152
9234
  });
9153
9235
  // Enter
@@ -9162,27 +9244,27 @@ var WebsyChart = /*#__PURE__*/function () {
9162
9244
  }).attr('class', function (d) {
9163
9245
  return "symbol symbol_".concat(series.key);
9164
9246
  }).attr('transform', function (d) {
9165
- var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9166
- var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9167
- if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9168
- xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9169
- }
9170
- var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
9171
- if (_this56.options.orientation === 'horizontal') {
9172
- return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9247
+ var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
9248
+ var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9249
+ if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9250
+ xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9251
+ }
9252
+ var adjustment = _this58.options.data[xAxis].scale === 'Time' || _this58.options.data[xAxis].scale === 'Linear' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
9253
+ if (_this58.options.orientation === 'horizontal') {
9254
+ return "translate(".concat(_this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9173
9255
  } else {
9174
- if (_this56.options.data[xAxis].scale === 'Time') {
9175
- xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
9256
+ if (_this58.options.data[xAxis].scale === 'Time') {
9257
+ xPos = _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
9176
9258
  } else {
9177
- var _xIndex2 = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9178
- var _xPos2 = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9179
- if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9180
- _xPos2 = _xPos2 + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9259
+ var _xIndex2 = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
9260
+ var _xPos2 = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9261
+ if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9262
+ _xPos2 = _xPos2 + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9181
9263
  }
9182
9264
  // return xPos
9183
9265
  }
9184
9266
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9185
- return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9267
+ return "translate(".concat(xPos, ", ").concat(_this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9186
9268
  }
9187
9269
  });
9188
9270
  }
@@ -9378,7 +9460,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9378
9460
  }, {
9379
9461
  key: "resize",
9380
9462
  value: function resize() {
9381
- var _this57 = this;
9463
+ var _this59 = this;
9382
9464
  var el = document.getElementById(this.elementId);
9383
9465
  if (el) {
9384
9466
  // if (this.options.width) {
@@ -9389,7 +9471,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9389
9471
  // }
9390
9472
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9391
9473
  html += this._data.map(function (d, i) {
9392
- return _this57.getLegendItemHTML(d);
9474
+ return _this59.getLegendItemHTML(d);
9393
9475
  }).join('');
9394
9476
  html += "\n <div>\n ";
9395
9477
  el.innerHTML = html;
@@ -9470,7 +9552,7 @@ var WebsyKPI = /*#__PURE__*/function () {
9470
9552
  if (this.options.icon) {
9471
9553
  html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
9472
9554
  }
9473
- html += " \n <div class=\"websy-kpi-info\">\n <div class=\"websy-kpi-label ".concat(this.options.label.classes.join(' ') || '', "\">\n ").concat((this.options.label || {}).value || '', "\n ");
9555
+ html += " \n <div class=\"websy-kpi-info\">\n <div class=\"websy-kpi-label-container\">\n <div class=\"websy-kpi-label ".concat(this.options.label.classes.join(' ') || '', "\">\n ").concat((this.options.label || {}).value || '', "\n </div>\n ");
9474
9556
  if (this.options.tooltip && this.options.tooltip.value) {
9475
9557
  html += "\n <div class=\"websy-info ".concat(this.options.tooltip.classes.join(' ') || '', "\" data-info=\"").concat(this.options.tooltip.value, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-e</title><path d=\"M256,56C145.72,56,56,145.72,56,256s89.72,200,200,200,200-89.72,200-200S366.28,56,256,56Zm0,82a26,26,0,1,1-26,26A26,26,0,0,1,256,138Zm48,226H216a16,16,0,0,1,0-32h28V244H228a16,16,0,0,1,0-32h32a16,16,0,0,1,16,16V332h28a16,16,0,0,1,0,32Z\"/></svg>\n </div> \n ");
9476
9558
  }
@@ -9547,7 +9629,7 @@ var WebsyMap = /*#__PURE__*/function () {
9547
9629
  }, {
9548
9630
  key: "render",
9549
9631
  value: function render() {
9550
- var _this58 = this;
9632
+ var _this60 = this;
9551
9633
  this._isRendered = false;
9552
9634
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
9553
9635
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -9555,7 +9637,7 @@ var WebsyMap = /*#__PURE__*/function () {
9555
9637
  var legendData = this.options.data.polygons.map(function (s, i) {
9556
9638
  return {
9557
9639
  value: s.label || s.key,
9558
- color: s.color || _this58.options.colors[i % _this58.options.colors.length]
9640
+ color: s.color || _this60.options.colors[i % _this60.options.colors.length]
9559
9641
  };
9560
9642
  });
9561
9643
  var longestValue = legendData.map(function (s) {
@@ -9609,7 +9691,7 @@ var WebsyMap = /*#__PURE__*/function () {
9609
9691
  }
9610
9692
  if (this.polygons) {
9611
9693
  this.polygons.forEach(function (p) {
9612
- return _this58.map.removeLayer(p);
9694
+ return _this60.map.removeLayer(p);
9613
9695
  });
9614
9696
  }
9615
9697
  this.polygons = [];
@@ -9663,15 +9745,15 @@ var WebsyMap = /*#__PURE__*/function () {
9663
9745
  p.options = {};
9664
9746
  }
9665
9747
  if (!p.options.color) {
9666
- p.options.color = _this58.options.colors[i % _this58.options.colors.length];
9748
+ p.options.color = _this60.options.colors[i % _this60.options.colors.length];
9667
9749
  }
9668
9750
  var pol = L.polygon(p.data.map(function (c) {
9669
9751
  return c.map(function (d) {
9670
9752
  return [d.Latitude, d.Longitude];
9671
9753
  });
9672
- }), p.options).addTo(_this58.map);
9673
- _this58.polygons.push(pol);
9674
- _this58.map.fitBounds(pol.getBounds());
9754
+ }), p.options).addTo(_this60.map);
9755
+ _this60.polygons.push(pol);
9756
+ _this60.map.fitBounds(pol.getBounds());
9675
9757
  });
9676
9758
  }
9677
9759
  // if (this.data.markers.length > 0) {