@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.
@@ -21,6 +21,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
21
21
  WebsyPubSub
22
22
  WebsyForm
23
23
  MultiForm
24
+ MediaUpload
24
25
  WebsyDatePicker
25
26
  WebsyDropdown
26
27
  WebsyRouter
@@ -1776,6 +1777,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1776
1777
  var headerPos = WebsyUtils.getElementPos(headerEl);
1777
1778
  var contentPos = WebsyUtils.getElementPos(contentEl);
1778
1779
  if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1780
+ contentEl.style.left = 'unset';
1779
1781
  contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
1780
1782
  contentEl.style.width = "".concat(Math.max(this.options.minWidth, headerEl.clientWidth), "px");
1781
1783
  if (headerPos.bottom + contentPos.height > window.innerHeight) {
@@ -1786,6 +1788,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1786
1788
  }
1787
1789
  } else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
1788
1790
  var targetPos = WebsyUtils.getElementPos(event.target);
1791
+ contentEl.style.left = 'unset';
1789
1792
  contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
1790
1793
  contentEl.style.width = "".concat(Math.max(this.options.minWidth, targetPos.width), "px");
1791
1794
  }
@@ -1881,8 +1884,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
1881
1884
  get: function get() {
1882
1885
  var _this12 = this;
1883
1886
  if (this.selectedItems && this.selectedItems.length > 0) {
1887
+ // return this.selectedItems.map((d, i) => this.options.items[+d])
1884
1888
  return this.selectedItems.map(function (d, i) {
1885
- return _this12.options.items[+d];
1889
+ return _this12._originalData[+d];
1886
1890
  });
1887
1891
  }
1888
1892
  return [];
@@ -2694,11 +2698,11 @@ var WebsyForm = /*#__PURE__*/function () {
2694
2698
  f.owningElement = _this20.elementId;
2695
2699
  if (f.component) {
2696
2700
  componentsToProcess.push(f);
2697
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.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(_this20.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2701
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.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(_this20.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2698
2702
  } else if (f.type === 'longtext') {
2699
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.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(_this20.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(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2703
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.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(_this20.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(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2700
2704
  } else {
2701
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.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(_this20.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(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2705
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.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(_this20.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(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2702
2706
  }
2703
2707
  });
2704
2708
  if (this.options.useRecaptcha === true) {
@@ -2731,6 +2735,9 @@ var WebsyForm = /*#__PURE__*/function () {
2731
2735
  if (this.fieldMap[field].type === 'checkbox') {
2732
2736
  el.checked = value;
2733
2737
  }
2738
+ if (this.fieldMap[field].type === 'date') {
2739
+ el.valueAsDate = value;
2740
+ }
2734
2741
  } else {
2735
2742
  console.error("Input for ".concat(field, " does not exist in form."));
2736
2743
  }
@@ -2880,10 +2887,12 @@ var MultiForm = /*#__PURE__*/function () {
2880
2887
  _classCallCheck(this, MultiForm);
2881
2888
  this.elementId = elementId;
2882
2889
  var DEFAULTS = {
2883
- 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>",
2884
- 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>",
2890
+ 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>",
2891
+ 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>",
2885
2892
  allowAdd: true,
2886
- allowDelete: true
2893
+ allowDelete: true,
2894
+ addLabel: '',
2895
+ deleteLabel: ''
2887
2896
  };
2888
2897
  this.options = _extends({}, DEFAULTS, options);
2889
2898
  this.formData = [];
@@ -2892,7 +2901,7 @@ var MultiForm = /*#__PURE__*/function () {
2892
2901
  var el = document.getElementById(elementId);
2893
2902
  if (el) {
2894
2903
  el.addEventListener('click', this.handleClick.bind(this));
2895
- el.innerHTML = "<div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>");
2904
+ 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 ");
2896
2905
  }
2897
2906
  this.render();
2898
2907
  }
@@ -2905,19 +2914,26 @@ var MultiForm = /*#__PURE__*/function () {
2905
2914
  }, {
2906
2915
  key: "addEntry",
2907
2916
  value: function addEntry() {
2908
- var el = document.getElementById("".concat(this.elementId, "_container"));
2909
- var newId = WebsyDesigns.Utils.createIdentity();
2910
- var newFormEl = document.createElement('div');
2911
- newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
2912
- newFormEl.classList.add('websy-multi-form-form-container');
2913
- 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 ");
2914
- el.appendChild(newFormEl);
2915
- var formOptions = _extends({}, this.options, {
2916
- fields: _toConsumableArray(this.options.fields.map(function (f) {
2917
- return _extends({}, f);
2918
- }))
2919
- });
2920
- this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2917
+ var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
2918
+ if (typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows) {
2919
+ var el = document.getElementById("".concat(this.elementId, "_container"));
2920
+ var newId = WebsyDesigns.Utils.createIdentity();
2921
+ var newFormEl = document.createElement('div');
2922
+ newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
2923
+ newFormEl.classList.add('websy-multi-form-form-container');
2924
+ 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 ");
2925
+ newFormEl.innerHTML = html;
2926
+ el.appendChild(newFormEl);
2927
+ var formOptions = _extends({}, this.options, {
2928
+ fields: _toConsumableArray(this.options.fields.map(function (f) {
2929
+ return _extends({}, f);
2930
+ }))
2931
+ });
2932
+ this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2933
+ if (addEl) {
2934
+ addEl.style.display = this.forms.length < this.options.maxRows ? 'flex' : 'none';
2935
+ }
2936
+ }
2921
2937
  }
2922
2938
  }, {
2923
2939
  key: "clear",
@@ -2936,11 +2952,6 @@ var MultiForm = /*#__PURE__*/function () {
2936
2952
  var d = this.forms.map(function (f) {
2937
2953
  return f.data;
2938
2954
  });
2939
- console.log('forms data', d);
2940
- if (this.options.allowAdd !== false) {
2941
- // we don't return the last form
2942
- d.pop();
2943
- }
2944
2955
  return d;
2945
2956
  },
2946
2957
  set: function set(d) {
@@ -2959,16 +2970,6 @@ var MultiForm = /*#__PURE__*/function () {
2959
2970
  key: "handleClick",
2960
2971
  value: function handleClick(event) {
2961
2972
  if (event.target.classList.contains('websy-multi-form-add')) {
2962
- var id = event.target.getAttribute('data-formid');
2963
- // hide add button and show delete button
2964
- var addButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_addButton"));
2965
- if (addButtonEl) {
2966
- addButtonEl.classList.add('hidden');
2967
- }
2968
- var deleteButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_deleteButton"));
2969
- if (deleteButtonEl) {
2970
- deleteButtonEl.classList.remove('hidden');
2971
- }
2972
2973
  // add new form
2973
2974
  if (this.options.allowAdd === true) {
2974
2975
  this.addEntry();
@@ -2976,12 +2977,12 @@ var MultiForm = /*#__PURE__*/function () {
2976
2977
  }
2977
2978
  if (event.target.classList.contains('websy-multi-form-delete')) {
2978
2979
  // delete form based on index
2979
- var _id = event.target.getAttribute('data-formid');
2980
+ var id = event.target.getAttribute('data-formid');
2980
2981
  var rowId = event.target.getAttribute('data-rowid');
2981
2982
  this.recordsToDelete.push(rowId);
2982
2983
  var indexToDelete = -1;
2983
2984
  for (var i = 0; i < this.forms.length; i++) {
2984
- if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(_id, "_form")) {
2985
+ if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(id, "_form")) {
2985
2986
  indexToDelete = i;
2986
2987
  break;
2987
2988
  }
@@ -2989,10 +2990,14 @@ var MultiForm = /*#__PURE__*/function () {
2989
2990
  if (indexToDelete !== -1) {
2990
2991
  this.forms.splice(indexToDelete, 1);
2991
2992
  }
2992
- var el = document.getElementById("".concat(this.elementId, "_").concat(_id, "_formContainer"));
2993
+ var el = document.getElementById("".concat(this.elementId, "_").concat(id, "_formContainer"));
2993
2994
  if (el) {
2994
2995
  el.remove();
2995
2996
  }
2997
+ var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
2998
+ if (addEl) {
2999
+ addEl.style.display = typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows ? 'flex' : 'none';
3000
+ }
2996
3001
  // delete form element based on id
2997
3002
  }
2998
3003
  }
@@ -3009,14 +3014,11 @@ var MultiForm = /*#__PURE__*/function () {
3009
3014
  d.formId = WebsyDesigns.Utils.createIdentity();
3010
3015
  html += "\n <div id='".concat(_this23.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this23.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
3011
3016
  if (_this23.options.allowDelete === true) {
3012
- html += "\n <button id='".concat(_this23.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this23.options.deleteButton, "\n </button>\n ");
3017
+ html += "\n <button id='".concat(_this23.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this23.options.deleteIcon).concat(_this23.options.deleteLabel, "\n </button>\n ");
3013
3018
  }
3014
3019
  html += "\n </div>\n ";
3015
3020
  });
3016
3021
  var id = WebsyDesigns.Utils.createIdentity();
3017
- if (this.options.allowAdd === true) {
3018
- 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 ");
3019
- }
3020
3022
  el.innerHTML = html;
3021
3023
  this.forms = new Array(this.formData.length);
3022
3024
  this.formData.forEach(function (d, i) {
@@ -3029,14 +3031,13 @@ var MultiForm = /*#__PURE__*/function () {
3029
3031
  formObject.data = d;
3030
3032
  _this23.forms[i] = formObject;
3031
3033
  });
3032
- if (this.options.allowAdd === true) {
3033
- var formOptions = _extends({}, this.options, {
3034
- fields: _toConsumableArray(this.options.fields.map(function (f) {
3035
- return _extends({}, f);
3036
- }))
3037
- });
3038
- var formObject = new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions);
3039
- this.forms.push(formObject);
3034
+ var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
3035
+ if (addEl) {
3036
+ if (this.options.allowAdd === true) {
3037
+ addEl.style.display = typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows ? 'flex' : 'none';
3038
+ } else {
3039
+ addEl.style.display = 'none';
3040
+ }
3040
3041
  }
3041
3042
  }
3042
3043
  }
@@ -3514,10 +3515,190 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3514
3515
  }]);
3515
3516
  return WebsyNavigationMenu;
3516
3517
  }();
3518
+ /*
3519
+ global
3520
+ FormData
3521
+ FileReader
3522
+ Image
3523
+ */
3524
+ var MediaUpload = /*#__PURE__*/function () {
3525
+ function MediaUpload(elementId, options) {
3526
+ _classCallCheck(this, MediaUpload);
3527
+ var defaults = {
3528
+ allowMultiple: false,
3529
+ createThumbnail: false,
3530
+ thumbSize: 300,
3531
+ supportedTypes: ['image/png', 'image/jpg']
3532
+ };
3533
+ this.media = [];
3534
+ this.options = _extends({}, defaults, options);
3535
+ this.elementId = elementId;
3536
+ if (!elementId) {
3537
+ console.log('No element Id provided');
3538
+ return;
3539
+ }
3540
+ var el = document.getElementById(elementId);
3541
+ if (el) {
3542
+ el.addEventListener('change', this.handleChange.bind(this));
3543
+ el.innerHTML = "\n <div class='websy-upload-form-container'>\n <span>Drag and drop a file or click to browse.</span>\n <form id=\"".concat(this.elementId, "_form\" enctype=\"multipart/form-data\"> \n <input id=\"").concat(this.elementId, "_file\" type=\"file\" name=\"").concat(this.options.name || 'media', "\" accept=\"").concat(this.options.supportedTypes.join(' '), "\" multiple>\n </form>\n </div>\n <div id='").concat(this.elementId, "_uploaded' class='websy-uploaded-media'></div> \n ");
3544
+ this.render();
3545
+ }
3546
+ }
3547
+ _createClass(MediaUpload, [{
3548
+ key: "data",
3549
+ get: function get() {
3550
+ return this.media;
3551
+ },
3552
+ set: function set() {
3553
+ var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3554
+ if (Array.isArray(d)) {
3555
+ this.media = d;
3556
+ } else {
3557
+ this.media = [d];
3558
+ }
3559
+ this.render();
3560
+ }
3561
+ }, {
3562
+ key: "createHtml",
3563
+ value: function createHtml(count) {
3564
+ var html = '';
3565
+ for (var i = 0; i < count; i++) {
3566
+ html += "\n <div>\n <img id='".concat(this.elementId, "_media_").concat(i, "'/>\n </div> \n ");
3567
+ }
3568
+ return html;
3569
+ }
3570
+ }, {
3571
+ key: "getForm",
3572
+ value: function getForm() {
3573
+ var formFound = false;
3574
+ var el = document.getElementById("".concat(this.elementId, "_file"));
3575
+ if (el) {
3576
+ while (formFound === false && el.tagName !== 'BODY') {
3577
+ el = el.parentElement;
3578
+ if (el.tagName === 'FORM') {
3579
+ formFound = true;
3580
+ return el;
3581
+ }
3582
+ }
3583
+ }
3584
+ return null;
3585
+ }
3586
+ }, {
3587
+ key: "handleChange",
3588
+ value: function handleChange(event) {
3589
+ var _this25 = this;
3590
+ this.fileList = [];
3591
+ var uploadForm = document.getElementById("".concat(this.elementId, "_form"));
3592
+ if (!uploadForm) {
3593
+ uploadForm = this.getForm();
3594
+ }
3595
+ if (!uploadForm) {
3596
+ console.error("The element ".concat(this.elementId, "_file does not belong to a form."));
3597
+ return;
3598
+ }
3599
+ var formData = new FormData(uploadForm);
3600
+ var html = this.createHtml(formData.length);
3601
+ formData.forEach(function (value, key) {
3602
+ if (key === (_this25.options.name || 'media')) {
3603
+ _this25.fileList.push({
3604
+ name: key,
3605
+ file: value
3606
+ });
3607
+ }
3608
+ });
3609
+ var resultEl = document.getElementById("".concat(this.elementId, "_uploaded"));
3610
+ resultEl.innerHTML = html;
3611
+ this.uploadItem(0, this.fileList);
3612
+ }
3613
+ }, {
3614
+ key: "render",
3615
+ value: function render() {
3616
+ var _this26 = this;
3617
+ if (this.media.length > 0) {
3618
+ var resultEl = document.getElementById("".concat(this.elementId, "_uploaded"));
3619
+ resultEl.innerHTML = this.createHtml(this.media.length);
3620
+ this.media.forEach(function (m, i) {
3621
+ var imgEl = document.getElementById("".concat(_this26.elementId, "_media_").concat(i));
3622
+ imgEl.setAttribute('src', "data:".concat(m.type, ";base64,") + m.data);
3623
+ });
3624
+ }
3625
+ }
3626
+ }, {
3627
+ key: "uploadItem",
3628
+ value: function uploadItem(index, items, callbackFn) {
3629
+ var _this27 = this;
3630
+ if (!items[index]) {
3631
+ callbackFn();
3632
+ } else {
3633
+ var r = new FileReader();
3634
+ var mediaData = {
3635
+ type: items[index].file.type,
3636
+ name: items[index].file.name,
3637
+ size: items[index].file.size
3638
+ };
3639
+ r.onloadend = function () {
3640
+ var imgCanvas = document.createElement('canvas');
3641
+ var imgContext = imgCanvas.getContext('2d');
3642
+ var thumbCanvas = document.createElement('canvas');
3643
+ var thumbContext = thumbCanvas.getContext('2d');
3644
+ var img = new Image();
3645
+ img.onload = function () {
3646
+ var width = img.width;
3647
+ var height = img.height;
3648
+ if (_this27.options.resize === true && _this27.options.imgSize) {
3649
+ var _ratio = 1;
3650
+ if (width > height) {
3651
+ _ratio = width / height;
3652
+ width = _this27.options.imgSize;
3653
+ height = _this27.options.imgSize / _ratio;
3654
+ } else if (height > width) {
3655
+ _ratio = height / width;
3656
+ width = _this27.options.imgSize / _ratio;
3657
+ height = _this27.options.imgSize;
3658
+ }
3659
+ }
3660
+ var fullResEl = document.getElementById("".concat(_this27.elementId, "_media_").concat(index, "_fullres"));
3661
+ if (fullResEl) {
3662
+ fullResEl.innerHTML = "".concat(width, " x ").concat(height);
3663
+ }
3664
+ imgCanvas.width = width;
3665
+ imgCanvas.height = height;
3666
+ imgContext.drawImage(img, 0, 0, width, height);
3667
+ var ratio = 1;
3668
+ if (width > height) {
3669
+ ratio = width / height;
3670
+ thumbCanvas.width = _this27.options.thumbSize;
3671
+ thumbCanvas.height = _this27.options.thumbSize / ratio;
3672
+ } else if (height > width) {
3673
+ ratio = height / width;
3674
+ thumbCanvas.width = _this27.options.thumbSize / ratio;
3675
+ thumbCanvas.height = _this27.options.thumbSize;
3676
+ }
3677
+ thumbContext.drawImage(img, 0, 0, thumbCanvas.width, thumbCanvas.height);
3678
+ mediaData.name = items[index].name;
3679
+ mediaData.fullWidth = imgCanvas.width;
3680
+ mediaData.fullHeight = imgCanvas.height;
3681
+ mediaData.thumbWidth = thumbCanvas.width;
3682
+ mediaData.thumbHeight = thumbCanvas.height;
3683
+ mediaData.data = imgCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
3684
+ mediaData.thumbData = thumbCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
3685
+ _this27.media.push(mediaData);
3686
+ var imgEl = document.getElementById("".concat(_this27.elementId, "_media_").concat(index));
3687
+ imgEl.setAttribute('src', imgCanvas.toDataURL(mediaData.type));
3688
+ _this27.uploadItem(++index, items, callbackFn);
3689
+ };
3690
+ img.src = r.result;
3691
+ };
3692
+ r.readAsDataURL(items[index].file);
3693
+ }
3694
+ }
3695
+ }]);
3696
+ return MediaUpload;
3697
+ }();
3517
3698
  /* global WebsyDesigns */
3518
3699
  var Pager = /*#__PURE__*/function () {
3519
3700
  function Pager(elementId, options) {
3520
- var _this25 = this;
3701
+ var _this28 = this;
3521
3702
  _classCallCheck(this, Pager);
3522
3703
  this.elementId = elementId;
3523
3704
  var DEFAULTS = {
@@ -3564,8 +3745,8 @@ var Pager = /*#__PURE__*/function () {
3564
3745
  allowClear: false,
3565
3746
  disableSearch: true,
3566
3747
  onItemSelected: function onItemSelected(selectedItem) {
3567
- if (_this25.options.onChangePageSize) {
3568
- _this25.options.onChangePageSize(selectedItem.value);
3748
+ if (_this28.options.onChangePageSize) {
3749
+ _this28.options.onChangePageSize(selectedItem.value);
3569
3750
  }
3570
3751
  }
3571
3752
  });
@@ -3586,11 +3767,11 @@ var Pager = /*#__PURE__*/function () {
3586
3767
  }, {
3587
3768
  key: "render",
3588
3769
  value: function render() {
3589
- var _this26 = this;
3770
+ var _this29 = this;
3590
3771
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3591
3772
  if (el) {
3592
3773
  var pages = this.options.pages.map(function (item, index) {
3593
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this26.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3774
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this29.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3594
3775
  });
3595
3776
  var startIndex = 0;
3596
3777
  if (this.options.pages.length > 8) {
@@ -3652,50 +3833,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3652
3833
  _createClass(WebsyPDFButton, [{
3653
3834
  key: "handleClick",
3654
3835
  value: function handleClick(event) {
3655
- var _this27 = this;
3836
+ var _this30 = this;
3656
3837
  if (event.target.classList.contains('websy-pdf-button')) {
3657
3838
  this.loader.show();
3658
3839
  this.options.preProcess(function (proceed) {
3659
3840
  if (proceed === true) {
3660
3841
  setTimeout(function () {
3661
- if (_this27.options.targetId) {
3662
- var el = document.getElementById(_this27.options.targetId);
3842
+ if (_this30.options.targetId) {
3843
+ var el = document.getElementById(_this30.options.targetId);
3663
3844
  if (el) {
3664
3845
  var pdfData = {
3665
3846
  options: {}
3666
3847
  };
3667
- if (_this27.options.pdfOptions) {
3668
- pdfData.options = _extends({}, _this27.options.pdfOptions);
3848
+ if (_this30.options.pdfOptions) {
3849
+ pdfData.options = _extends({}, _this30.options.pdfOptions);
3669
3850
  }
3670
- if (_this27.options.header) {
3671
- if (_this27.options.header.elementId) {
3672
- var headerEl = document.getElementById(_this27.options.header.elementId);
3851
+ if (_this30.options.header) {
3852
+ if (_this30.options.header.elementId) {
3853
+ var headerEl = document.getElementById(_this30.options.header.elementId);
3673
3854
  if (headerEl) {
3674
3855
  pdfData.header = headerEl.outerHTML;
3675
- if (_this27.options.header.css) {
3676
- pdfData.options.headerCSS = _this27.options.header.css;
3856
+ if (_this30.options.header.css) {
3857
+ pdfData.options.headerCSS = _this30.options.header.css;
3677
3858
  }
3678
3859
  }
3679
- } else if (_this27.options.header.html) {
3680
- pdfData.header = _this27.options.header.html;
3681
- if (_this27.options.header.css) {
3682
- pdfData.options.headerCSS = _this27.options.header.css;
3860
+ } else if (_this30.options.header.html) {
3861
+ pdfData.header = _this30.options.header.html;
3862
+ if (_this30.options.header.css) {
3863
+ pdfData.options.headerCSS = _this30.options.header.css;
3683
3864
  }
3684
3865
  } else {
3685
- pdfData.header = _this27.options.header;
3866
+ pdfData.header = _this30.options.header;
3686
3867
  }
3687
3868
  }
3688
- if (_this27.options.footer) {
3689
- if (_this27.options.footer.elementId) {
3690
- var footerEl = document.getElementById(_this27.options.footer.elementId);
3869
+ if (_this30.options.footer) {
3870
+ if (_this30.options.footer.elementId) {
3871
+ var footerEl = document.getElementById(_this30.options.footer.elementId);
3691
3872
  if (footerEl) {
3692
3873
  pdfData.footer = footerEl.outerHTML;
3693
- if (_this27.options.footer.css) {
3694
- pdfData.options.footerCSS = _this27.options.footer.css;
3874
+ if (_this30.options.footer.css) {
3875
+ pdfData.options.footerCSS = _this30.options.footer.css;
3695
3876
  }
3696
3877
  }
3697
3878
  } else {
3698
- pdfData.footer = _this27.options.footer;
3879
+ pdfData.footer = _this30.options.footer;
3699
3880
  }
3700
3881
  }
3701
3882
  pdfData.html = el.outerHTML;
@@ -3703,25 +3884,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3703
3884
  // document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
3704
3885
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3705
3886
  // document.getElementById(`${this.elementId}_form`).submit()
3706
- _this27.service.add('', pdfData, {
3887
+ _this30.service.add('', pdfData, {
3707
3888
  responseType: 'blob'
3708
3889
  }).then(function (response) {
3709
- _this27.loader.hide();
3890
+ _this30.loader.hide();
3710
3891
  var blob = new Blob([response], {
3711
3892
  type: 'application/pdf'
3712
3893
  });
3713
3894
  var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
3714
- if (_this27.options.directDownload === true) {
3895
+ if (_this30.options.directDownload === true) {
3715
3896
  var fileName;
3716
- if (typeof _this27.options.fileName === 'function') {
3717
- fileName = _this27.options.fileName() || 'Export';
3897
+ if (typeof _this30.options.fileName === 'function') {
3898
+ fileName = _this30.options.fileName() || 'Export';
3718
3899
  } else {
3719
- fileName = _this27.options.fileName || 'Export';
3900
+ fileName = _this30.options.fileName || 'Export';
3720
3901
  }
3721
- msg += "download='".concat(fileName, ".pdf'");
3902
+ msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
3722
3903
  }
3723
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this27.options.buttonText, "</button>\n </a>\n </div>\n ");
3724
- _this27.popup.show({
3904
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this30.options.buttonText, "</button>\n </a>\n </div>\n ");
3905
+ _this30.popup.show({
3725
3906
  message: msg,
3726
3907
  mask: true
3727
3908
  });
@@ -3730,10 +3911,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3730
3911
  });
3731
3912
  }
3732
3913
  }
3733
- }, _this27.options.wait);
3914
+ }, _this30.options.wait);
3734
3915
  } else {
3735
- _this27.loader.hide();
3736
- _this27.options.onError();
3916
+ _this30.loader.hide();
3917
+ _this30.options.onError();
3737
3918
  }
3738
3919
  });
3739
3920
  } else if (event.target.classList.contains('download-pdf')) {
@@ -3897,7 +4078,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3897
4078
  }();
3898
4079
  var ResponsiveText = /*#__PURE__*/function () {
3899
4080
  function ResponsiveText(elementId, options) {
3900
- var _this28 = this;
4081
+ var _this31 = this;
3901
4082
  _classCallCheck(this, ResponsiveText);
3902
4083
  var DEFAULTS = {
3903
4084
  textAlign: 'center',
@@ -3908,7 +4089,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3908
4089
  this.elementId = elementId;
3909
4090
  this.canvas = document.createElement('canvas');
3910
4091
  window.addEventListener('resize', function () {
3911
- return _this28.render();
4092
+ return _this31.render();
3912
4093
  });
3913
4094
  var el = document.getElementById(this.elementId);
3914
4095
  if (el) {
@@ -4098,7 +4279,7 @@ var ResponsiveText = /*#__PURE__*/function () {
4098
4279
  /* global WebsyDesigns */
4099
4280
  var WebsyResultList = /*#__PURE__*/function () {
4100
4281
  function WebsyResultList(elementId, options) {
4101
- var _this29 = this;
4282
+ var _this32 = this;
4102
4283
  _classCallCheck(this, WebsyResultList);
4103
4284
  var DEFAULTS = {
4104
4285
  listeners: {
@@ -4124,8 +4305,8 @@ var WebsyResultList = /*#__PURE__*/function () {
4124
4305
  }
4125
4306
  if (_typeof(options.template) === 'object' && options.template.url) {
4126
4307
  this.templateService.get(options.template.url).then(function (templateString) {
4127
- _this29.options.template = templateString;
4128
- _this29.render();
4308
+ _this32.options.template = templateString;
4309
+ _this32.render();
4129
4310
  });
4130
4311
  } else {
4131
4312
  this.render();
@@ -4144,7 +4325,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4144
4325
  }, {
4145
4326
  key: "buildHTML",
4146
4327
  value: function buildHTML(d) {
4147
- var _this30 = this;
4328
+ var _this33 = this;
4148
4329
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4149
4330
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
4150
4331
  var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
@@ -4152,7 +4333,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4152
4333
  if (this.options.template) {
4153
4334
  if (d.length > 0) {
4154
4335
  d.forEach(function (row, ix) {
4155
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this30.options.template).concat(ix < d.length - 1 ? '<!--' : '');
4336
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this33.options.template).concat(ix < d.length - 1 ? '<!--' : '');
4156
4337
  // find conditional elements
4157
4338
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
4158
4339
  ifMatches.forEach(function (m) {
@@ -4240,7 +4421,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4240
4421
  parts.forEach(function (p) {
4241
4422
  items = items[p];
4242
4423
  });
4243
- template = template.replace(m[0], _this30.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4424
+ template = template.replace(m[0], _this33.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4244
4425
  }
4245
4426
  });
4246
4427
  var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
@@ -4249,7 +4430,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4249
4430
  template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
4250
4431
  }
4251
4432
  });
4252
- var flatRow = _this30.flattenObject(row);
4433
+ var flatRow = _this33.flattenObject(row);
4253
4434
  for (var key in flatRow) {
4254
4435
  var rg = new RegExp("{".concat(key, "}"), 'gm');
4255
4436
  template = template.replace(rg, flatRow[key] || '');
@@ -4374,15 +4555,15 @@ var WebsyResultList = /*#__PURE__*/function () {
4374
4555
  }, {
4375
4556
  key: "render",
4376
4557
  value: function render() {
4377
- var _this31 = this;
4558
+ var _this34 = this;
4378
4559
  if (this.options.entity) {
4379
4560
  var url = this.options.entity;
4380
4561
  if (this.options.sortField) {
4381
4562
  url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
4382
4563
  }
4383
4564
  this.apiService.get(url).then(function (results) {
4384
- _this31.rows = results.rows;
4385
- _this31.resize();
4565
+ _this34.rows = results.rows;
4566
+ _this34.resize();
4386
4567
  });
4387
4568
  } else {
4388
4569
  this.resize();
@@ -4398,7 +4579,11 @@ var WebsyResultList = /*#__PURE__*/function () {
4398
4579
  }]);
4399
4580
  return WebsyResultList;
4400
4581
  }();
4401
- /* global history */
4582
+ /*
4583
+ global
4584
+ history
4585
+ WebsyDesigns
4586
+ */
4402
4587
  var WebsyRouter = /*#__PURE__*/function () {
4403
4588
  function WebsyRouter(options) {
4404
4589
  _classCallCheck(this, WebsyRouter);
@@ -4419,6 +4604,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4419
4604
  persistentParameters: false,
4420
4605
  fieldValueSeparator: ':'
4421
4606
  };
4607
+ this.apiService = new WebsyDesigns.APIService('');
4422
4608
  this.triggerIdList = [];
4423
4609
  this.viewIdList = [];
4424
4610
  this.previousPath = '';
@@ -4452,12 +4638,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4452
4638
  _createClass(WebsyRouter, [{
4453
4639
  key: "addGroup",
4454
4640
  value: function addGroup(group) {
4455
- var _this32 = this;
4641
+ var _this35 = this;
4456
4642
  if (!this.groups[group]) {
4457
- var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4643
+ var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
4458
4644
  if (els) {
4459
4645
  this.getClosestParent(els[0], function (parent) {
4460
- _this32.groups[group] = {
4646
+ _this35.groups[group] = {
4461
4647
  activeView: '',
4462
4648
  views: [],
4463
4649
  parent: parent.getAttribute('data-view')
@@ -4521,7 +4707,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4521
4707
  }, {
4522
4708
  key: "removeUrlParams",
4523
4709
  value: function removeUrlParams() {
4524
- var _this33 = this;
4710
+ var _this36 = this;
4525
4711
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4526
4712
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4527
4713
  var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -4529,7 +4715,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4529
4715
  var path = '';
4530
4716
  if (this.currentParams && this.currentParams.items) {
4531
4717
  params.forEach(function (p) {
4532
- delete _this33.currentParams.items[p];
4718
+ delete _this36.currentParams.items[p];
4533
4719
  });
4534
4720
  path = this.buildUrlPath(this.currentParams.items);
4535
4721
  }
@@ -4587,9 +4773,9 @@ var WebsyRouter = /*#__PURE__*/function () {
4587
4773
  if (!this.groups) {
4588
4774
  this.groups = {};
4589
4775
  }
4590
- var parentEl = document.querySelector(".websy-view[data-view=\"".concat(parent, "\"]"));
4776
+ var parentEl = document.querySelector(".".concat(this.options.viewClass, "[data-view=\"").concat(parent, "\"]"));
4591
4777
  if (parentEl) {
4592
- var els = parentEl.querySelectorAll(".websy-view[data-group]");
4778
+ var els = parentEl.querySelectorAll(".".concat(this.options.viewClass, "[data-group]"));
4593
4779
  for (var i = 0; i < els.length; i++) {
4594
4780
  var g = els[i].getAttribute('data-group');
4595
4781
  var v = els[i].getAttribute('data-view');
@@ -4860,11 +5046,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4860
5046
  }, {
4861
5047
  key: "showComponents",
4862
5048
  value: function showComponents(view) {
4863
- var _this34 = this;
5049
+ var _this37 = this;
4864
5050
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4865
5051
  this.options.views[view].components.forEach(function (c) {
4866
5052
  if (typeof c.instance === 'undefined') {
4867
- _this34.prepComponent(c.elementId, c.options);
5053
+ _this37.prepComponent(c.elementId, c.options);
4868
5054
  c.instance = new c.Component(c.elementId, c.options);
4869
5055
  } else if (c.instance.render) {
4870
5056
  c.instance.render();
@@ -4872,28 +5058,90 @@ var WebsyRouter = /*#__PURE__*/function () {
4872
5058
  });
4873
5059
  }
4874
5060
  }
5061
+ }, {
5062
+ key: "preloadView",
5063
+ value: function preloadView(view, callbackFn) {
5064
+ if (this.options.views[view].load) {
5065
+ this.options.views[view].load(callbackFn);
5066
+ }
5067
+ }
5068
+ }, {
5069
+ key: "initView",
5070
+ value: function initView(view) {
5071
+ var _this38 = this;
5072
+ return new Promise(function (resolve, reject) {
5073
+ if (!_this38.options.views[view]) {
5074
+ _this38.options.views[view] = {
5075
+ components: []
5076
+ };
5077
+ }
5078
+ if (_this38.options.views[view].ready === true) {
5079
+ resolve();
5080
+ } else if (_this38.options.views[view].template) {
5081
+ _this38.preloadView(view, function () {
5082
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5083
+ var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this38.options.viewClass));
5084
+ if (viewEl) {
5085
+ _this38.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
5086
+ template: _this38.options.views[view].template,
5087
+ data: data,
5088
+ readyCallbackFn: function readyCallbackFn() {
5089
+ _this38.options.views[view].ready = true;
5090
+ resolve();
5091
+ }
5092
+ });
5093
+ } else {
5094
+ console.log("No view element found for '".concat(view, "' to render template"));
5095
+ _this38.options.views[view].ready = true;
5096
+ resolve();
5097
+ }
5098
+ });
5099
+ } else if (_this38.options.views[view].ready !== true && _this38.options.views[view].load) {
5100
+ _this38.preloadView(view, function () {
5101
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5102
+ _this38.options.views[view].ready = true;
5103
+ resolve();
5104
+ });
5105
+ } else {
5106
+ _this38.options.views[view].ready = true;
5107
+ resolve();
5108
+ }
5109
+ });
5110
+ }
4875
5111
  }, {
4876
5112
  key: "showView",
4877
5113
  value: function showView(view, params, group) {
5114
+ var _this39 = this;
4878
5115
  if (view === '/' || view === '') {
4879
5116
  view = this.options.defaultView || '';
4880
5117
  }
4881
- this.activateItem(view, this.options.triggerClass);
4882
- this.activateItem(view, this.options.viewClass);
4883
- var children = this.getActiveViewsFromParent(view);
4884
- for (var c = 0; c < children.length; c++) {
4885
- this.activateItem(children[c].view, this.options.triggerClass);
4886
- this.activateItem(children[c].view, this.options.viewClass);
4887
- this.showComponents(children[c].view);
4888
- this.publish('show', [children[c].view, null, group]);
4889
- }
4890
- if (this.previousView !== this.currentView || group !== 'main') {
4891
- this.showComponents(view);
4892
- this.publish('show', [view, params, group]);
4893
- } else if (this.previousView === this.currentView && this.previousParams.path !== this.currentParams.path) {
4894
- this.showComponents(view);
4895
- this.publish('show', [view, params, group]);
4896
- }
5118
+ this.initView(view).then(function () {
5119
+ _this39.activateItem(view, _this39.options.triggerClass);
5120
+ _this39.activateItem(view, _this39.options.viewClass);
5121
+ var children = _this39.getActiveViewsFromParent(view);
5122
+ for (var c = 0; c < children.length; c++) {
5123
+ _this39.activateItem(children[c].view, _this39.options.triggerClass);
5124
+ _this39.activateItem(children[c].view, _this39.options.viewClass);
5125
+ _this39.showComponents(children[c].view);
5126
+ if (children[c].show) {
5127
+ children[c].show.call(children[c]);
5128
+ }
5129
+ _this39.publish('show', [children[c].view, null, group]);
5130
+ }
5131
+ if (_this39.previousView !== _this39.currentView || group !== 'main') {
5132
+ _this39.showComponents(view);
5133
+ if (_this39.options.views[view].show) {
5134
+ _this39.options.views[view].show.call(_this39.options.views[view]);
5135
+ }
5136
+ _this39.publish('show', [view, params, group]);
5137
+ } else if (_this39.previousView === _this39.currentView && _this39.previousParams.path !== _this39.currentParams.path) {
5138
+ _this39.showComponents(view);
5139
+ if (_this39.options.views[view].show) {
5140
+ _this39.options.views[view].show.call(_this39.options.views[view]);
5141
+ }
5142
+ _this39.publish('show', [view, params, group]);
5143
+ }
5144
+ });
4897
5145
  }
4898
5146
  }, {
4899
5147
  key: "reloadCurrentView",
@@ -5281,7 +5529,7 @@ var WebsySearch = /*#__PURE__*/function () {
5281
5529
  }, {
5282
5530
  key: "handleKeyUp",
5283
5531
  value: function handleKeyUp(event) {
5284
- var _this35 = this;
5532
+ var _this40 = this;
5285
5533
  if (event.target.classList.contains('websy-search-input')) {
5286
5534
  this.cursorPosition = event.target.selectionStart;
5287
5535
  this.searchText = event.target.value;
@@ -5304,8 +5552,8 @@ var WebsySearch = /*#__PURE__*/function () {
5304
5552
  }
5305
5553
  if (event.target.value.length >= this.options.minLength) {
5306
5554
  this.searchTimeoutFn = setTimeout(function () {
5307
- if (_this35.options.onSearch) {
5308
- _this35.options.onSearch(event.target.value, event);
5555
+ if (_this40.options.onSearch) {
5556
+ _this40.options.onSearch(event.target.value, event);
5309
5557
  }
5310
5558
  }, this.options.searchTimeout);
5311
5559
  } else {
@@ -5355,7 +5603,7 @@ var WebsySearch = /*#__PURE__*/function () {
5355
5603
  }, {
5356
5604
  key: "highlightActiveSuggestion",
5357
5605
  value: function highlightActiveSuggestion() {
5358
- var _this36 = this;
5606
+ var _this41 = this;
5359
5607
  // remove all previous highlights
5360
5608
  // const parent = document.getElementById(`${this.elementId}_suggestionList`)
5361
5609
  // if (parent) {
@@ -5374,7 +5622,7 @@ var WebsySearch = /*#__PURE__*/function () {
5374
5622
  Array.from(els).forEach(function (e) {
5375
5623
  e.classList.remove('active');
5376
5624
  var index = e.getAttribute('data-index');
5377
- if (+index === _this36.activeSuggestion) {
5625
+ if (+index === _this41.activeSuggestion) {
5378
5626
  e.classList.add('active');
5379
5627
  }
5380
5628
  });
@@ -5494,13 +5742,13 @@ var WebsySearch = /*#__PURE__*/function () {
5494
5742
  }, {
5495
5743
  key: "startSuggestionTimeout",
5496
5744
  value: function startSuggestionTimeout() {
5497
- var _this37 = this;
5745
+ var _this42 = this;
5498
5746
  if (this.suggestingTimeoutFn) {
5499
5747
  clearTimeout(this.suggestingTimeoutFn);
5500
5748
  }
5501
5749
  this.suggestingTimeoutFn = setTimeout(function () {
5502
5750
  // close the suggestions after inactivity for [suggestingTimeout] milliseconds
5503
- _this37.hideSuggestions(_this37);
5751
+ _this42.hideSuggestions(_this42);
5504
5752
  }, this.options.suggestingTimeout);
5505
5753
  }
5506
5754
  }, {
@@ -5664,7 +5912,7 @@ var Switch = /*#__PURE__*/function () {
5664
5912
  /* global WebsyDesigns */
5665
5913
  var WebsyTemplate = /*#__PURE__*/function () {
5666
5914
  function WebsyTemplate(elementId, options) {
5667
- var _this38 = this;
5915
+ var _this43 = this;
5668
5916
  _classCallCheck(this, WebsyTemplate);
5669
5917
  var DEFAULTS = {
5670
5918
  listeners: {
@@ -5672,7 +5920,16 @@ var WebsyTemplate = /*#__PURE__*/function () {
5672
5920
  }
5673
5921
  };
5674
5922
  this.options = _extends({}, DEFAULTS, options);
5675
- this.elementId = elementId;
5923
+ if (_typeof(elementId) === 'object') {
5924
+ if (elementId.id) {
5925
+ this.elementId = elementId.id;
5926
+ } else {
5927
+ elementId.id = WebsyDesigns.Utils.createIdentity();
5928
+ this.elementId = elementId.id;
5929
+ }
5930
+ } else {
5931
+ this.elementId = elementId;
5932
+ }
5676
5933
  this.templateService = new WebsyDesigns.APIService('');
5677
5934
  if (!elementId) {
5678
5935
  console.log('No element Id provided for Websy Template');
@@ -5684,8 +5941,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
5684
5941
  }
5685
5942
  if (_typeof(options.template) === 'object' && options.template.url) {
5686
5943
  this.templateService.get(options.template.url).then(function (templateString) {
5687
- _this38.options.template = templateString;
5688
- _this38.render();
5944
+ _this43.options.template = templateString;
5945
+ _this43.render();
5689
5946
  });
5690
5947
  } else {
5691
5948
  this.render();
@@ -5694,7 +5951,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5694
5951
  _createClass(WebsyTemplate, [{
5695
5952
  key: "buildHTML",
5696
5953
  value: function buildHTML() {
5697
- var _this39 = this;
5954
+ var _this44 = this;
5698
5955
  var html = "";
5699
5956
  if (this.options.template) {
5700
5957
  var template = this.options.template;
@@ -5743,14 +6000,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5743
6000
  }
5744
6001
  }
5745
6002
  if (polarity === true) {
5746
- if (typeof _this39.options.data[parts[0]] !== 'undefined' && _this39.options.data[parts[0]] === parts[1]) {
6003
+ if (typeof _this44.options.data[parts[0]] !== 'undefined' && _this44.options.data[parts[0]] === parts[1]) {
5747
6004
  // remove the <if> tags
5748
6005
  removeAll = false;
5749
6006
  } else if (parts[0] === parts[1]) {
5750
6007
  removeAll = false;
5751
6008
  }
5752
6009
  } else if (polarity === false) {
5753
- if (typeof _this39.options.data[parts[0]] !== 'undefined' && _this39.options.data[parts[0]] !== parts[1]) {
6010
+ if (typeof _this44.options.data[parts[0]] !== 'undefined' && _this44.options.data[parts[0]] !== parts[1]) {
5754
6011
  // remove the <if> tags
5755
6012
  removeAll = false;
5756
6013
  }
@@ -5784,6 +6041,12 @@ var WebsyTemplate = /*#__PURE__*/function () {
5784
6041
  }
5785
6042
  return html;
5786
6043
  }
6044
+ }, {
6045
+ key: "data",
6046
+ set: function set(d) {
6047
+ this.options.data = d;
6048
+ this.render();
6049
+ }
5787
6050
  }, {
5788
6051
  key: "handleClick",
5789
6052
  value: function handleClick(event) {
@@ -6063,7 +6326,7 @@ var WebsyUtils = {
6063
6326
  /* global WebsyDesigns */
6064
6327
  var WebsyTable = /*#__PURE__*/function () {
6065
6328
  function WebsyTable(elementId, options) {
6066
- var _this40 = this;
6329
+ var _this45 = this;
6067
6330
  _classCallCheck(this, WebsyTable);
6068
6331
  var DEFAULTS = {
6069
6332
  pageSize: 20,
@@ -6096,8 +6359,8 @@ var WebsyTable = /*#__PURE__*/function () {
6096
6359
  allowClear: false,
6097
6360
  disableSearch: true,
6098
6361
  onItemSelected: function onItemSelected(selectedItem) {
6099
- if (_this40.options.onChangePageSize) {
6100
- _this40.options.onChangePageSize(selectedItem.value);
6362
+ if (_this45.options.onChangePageSize) {
6363
+ _this45.options.onChangePageSize(selectedItem.value);
6101
6364
  }
6102
6365
  }
6103
6366
  });
@@ -6121,20 +6384,20 @@ var WebsyTable = /*#__PURE__*/function () {
6121
6384
  }, {
6122
6385
  key: "appendRows",
6123
6386
  value: function appendRows(data) {
6124
- var _this41 = this;
6387
+ var _this46 = this;
6125
6388
  this._isRendered = false;
6126
6389
  this.hideError();
6127
6390
  var bodyHTML = '';
6128
6391
  if (data) {
6129
6392
  bodyHTML += data.map(function (r, rowIndex) {
6130
6393
  return '<tr>' + r.map(function (c, i) {
6131
- if (_this41.options.columns[i].show !== false) {
6394
+ if (_this46.options.columns[i].show !== false) {
6132
6395
  var style = '';
6133
6396
  if (c.style) {
6134
6397
  style += c.style;
6135
6398
  }
6136
- if (_this41.options.columns[i].width) {
6137
- style += "width: ".concat(_this41.options.columns[i].width, "; ");
6399
+ if (_this46.options.columns[i].width) {
6400
+ style += "width: ".concat(_this46.options.columns[i].width, "; ");
6138
6401
  }
6139
6402
  if (c.backgroundColor) {
6140
6403
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -6145,16 +6408,16 @@ var WebsyTable = /*#__PURE__*/function () {
6145
6408
  if (c.color) {
6146
6409
  style += "color: ".concat(c.color, "; ");
6147
6410
  }
6148
- if (_this41.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6149
- 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 ");
6150
- } else if ((_this41.options.columns[i].showAsNavigatorLink === true || _this41.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6151
- 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 ");
6411
+ if (_this46.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6412
+ return "\n <td \n data-row-index='".concat(_this46.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this46.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(_this46.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this46.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6413
+ } else if ((_this46.options.columns[i].showAsNavigatorLink === true || _this46.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6414
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this46.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this46.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this46.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this46.options.columns[i].linkText || c.value, "</td>\n ");
6152
6415
  } else {
6153
6416
  var info = c.value;
6154
- if (_this41.options.columns[i].showAsImage === true) {
6417
+ if (_this46.options.columns[i].showAsImage === true) {
6155
6418
  c.value = "\n <img src='".concat(c.value, "'>\n ");
6156
6419
  }
6157
- 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 ");
6420
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this46.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this46.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 ");
6158
6421
  }
6159
6422
  }
6160
6423
  }).join('') + '</tr>';
@@ -6314,7 +6577,7 @@ var WebsyTable = /*#__PURE__*/function () {
6314
6577
  }, {
6315
6578
  key: "render",
6316
6579
  value: function render(data) {
6317
- var _this42 = this;
6580
+ var _this47 = this;
6318
6581
  this._isRendered = false;
6319
6582
  if (!this.options.columns) {
6320
6583
  return;
@@ -6342,7 +6605,7 @@ var WebsyTable = /*#__PURE__*/function () {
6342
6605
  if (c.width) {
6343
6606
  style += "width: ".concat(c.width || 'auto', ";");
6344
6607
  }
6345
- 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 ? _this42.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6608
+ 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 ? _this47.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6346
6609
  }
6347
6610
  }).join('') + '</tr>';
6348
6611
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6360,7 +6623,7 @@ var WebsyTable = /*#__PURE__*/function () {
6360
6623
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
6361
6624
  if (pagingEl) {
6362
6625
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6363
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this42.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6626
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this47.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6364
6627
  });
6365
6628
  var startIndex = 0;
6366
6629
  if (this.options.pageCount > 8) {
@@ -6416,7 +6679,7 @@ var WebsyTable = /*#__PURE__*/function () {
6416
6679
  /* global WebsyDesigns */
6417
6680
  var WebsyTable2 = /*#__PURE__*/function () {
6418
6681
  function WebsyTable2(elementId, options) {
6419
- var _this43 = this;
6682
+ var _this48 = this;
6420
6683
  _classCallCheck(this, WebsyTable2);
6421
6684
  var DEFAULTS = {
6422
6685
  pageSize: 20,
@@ -6451,8 +6714,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
6451
6714
  allowClear: false,
6452
6715
  disableSearch: true,
6453
6716
  onItemSelected: function onItemSelected(selectedItem) {
6454
- if (_this43.options.onChangePageSize) {
6455
- _this43.options.onChangePageSize(selectedItem.value);
6717
+ if (_this48.options.onChangePageSize) {
6718
+ _this48.options.onChangePageSize(selectedItem.value);
6456
6719
  }
6457
6720
  }
6458
6721
  });
@@ -6474,20 +6737,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
6474
6737
  _createClass(WebsyTable2, [{
6475
6738
  key: "appendRows",
6476
6739
  value: function appendRows(data) {
6477
- var _this44 = this;
6740
+ var _this49 = this;
6478
6741
  this.hideError();
6479
6742
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6480
6743
  var bodyHTML = '';
6481
6744
  if (data) {
6482
6745
  bodyHTML += data.map(function (r, rowIndex) {
6483
6746
  return '<tr>' + r.map(function (c, i) {
6484
- if (_this44.options.columns[i].show !== false) {
6485
- var style = "height: ".concat(_this44.options.cellSize, "px; line-height: ").concat(_this44.options.cellSize, "px;");
6747
+ if (_this49.options.columns[i].show !== false) {
6748
+ var style = "height: ".concat(_this49.options.cellSize, "px; line-height: ").concat(_this49.options.cellSize, "px;");
6486
6749
  if (c.style) {
6487
6750
  style += c.style;
6488
6751
  }
6489
- if (_this44.options.columns[i].width) {
6490
- style += "width: ".concat(_this44.options.columns[i].width, "; ");
6752
+ if (_this49.options.columns[i].width) {
6753
+ style += "width: ".concat(_this49.options.columns[i].width, "; ");
6491
6754
  }
6492
6755
  if (c.backgroundColor) {
6493
6756
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -6498,16 +6761,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
6498
6761
  if (c.color) {
6499
6762
  style += "color: ".concat(c.color, "; ");
6500
6763
  }
6501
- if (_this44.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6502
- return "\n <td \n data-row-index='".concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this44.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(_this44.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this44.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6503
- } else if ((_this44.options.columns[i].showAsNavigatorLink === true || _this44.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6504
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this44.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this44.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this44.options.columns[i].linkText || c.value, "</td>\n ");
6764
+ if (_this49.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6765
+ return "\n <td \n data-row-index='".concat(_this49.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this49.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(_this49.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this49.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6766
+ } else if ((_this49.options.columns[i].showAsNavigatorLink === true || _this49.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6767
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this49.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this49.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this49.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this49.options.columns[i].linkText || c.value, "</td>\n ");
6505
6768
  } else {
6506
6769
  var info = c.value;
6507
- if (_this44.options.columns[i].showAsImage === true) {
6770
+ if (_this49.options.columns[i].showAsImage === true) {
6508
6771
  c.value = "\n <img src='".concat(c.value, "'>\n ");
6509
6772
  }
6510
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this44.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 ");
6773
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this49.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this49.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 ");
6511
6774
  }
6512
6775
  }
6513
6776
  }).join('') + '</tr>';
@@ -6741,7 +7004,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6741
7004
  }, {
6742
7005
  key: "render",
6743
7006
  value: function render(data) {
6744
- var _this45 = this;
7007
+ var _this50 = this;
6745
7008
  if (!this.options.columns) {
6746
7009
  return;
6747
7010
  }
@@ -6769,7 +7032,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6769
7032
  if (c.width) {
6770
7033
  style += "width: ".concat(c.width || 'auto', "; ");
6771
7034
  }
6772
- 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 ? _this45.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
7035
+ 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 ? _this50.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6773
7036
  }
6774
7037
  }).join('') + '</tr>';
6775
7038
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6779,7 +7042,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6779
7042
  var dropdownHTML = "";
6780
7043
  this.options.columns.forEach(function (c, i) {
6781
7044
  if (c.searchable && c.searchField) {
6782
- dropdownHTML += "\n <div id=\"".concat(_this45.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
7045
+ dropdownHTML += "\n <div id=\"".concat(_this50.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6783
7046
  }
6784
7047
  });
6785
7048
  dropdownEl.innerHTML = dropdownHTML;
@@ -6799,7 +7062,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6799
7062
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
6800
7063
  if (pagingEl) {
6801
7064
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6802
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this45.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
7065
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this50.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6803
7066
  });
6804
7067
  var startIndex = 0;
6805
7068
  if (this.options.pageCount > 8) {
@@ -6876,17 +7139,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
6876
7139
  }, {
6877
7140
  key: "getColumnParameters",
6878
7141
  value: function getColumnParameters(values) {
6879
- var _this46 = this;
7142
+ var _this51 = this;
6880
7143
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6881
7144
  tableEl.style.tableLayout = 'auto';
6882
7145
  tableEl.style.width = 'auto';
6883
7146
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6884
7147
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6885
7148
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6886
- 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 ? _this46.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
7149
+ 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 ? _this51.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6887
7150
  }).join('') + '</tr>';
6888
7151
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6889
- return "\n <td \n style='height: ".concat(_this46.options.cellSize, "px; line-height: ").concat(_this46.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
7152
+ return "\n <td \n style='height: ".concat(_this51.options.cellSize, "px; line-height: ").concat(_this51.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6890
7153
  }).join('') + '</tr>';
6891
7154
  // get height of the first data cell
6892
7155
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -7050,7 +7313,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7050
7313
  }, {
7051
7314
  key: "buildBodyHtml",
7052
7315
  value: function buildBodyHtml() {
7053
- var _this47 = this;
7316
+ var _this52 = this;
7054
7317
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7055
7318
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7056
7319
  if (!this.options.columns) {
@@ -7075,7 +7338,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7075
7338
  row.forEach(function (cell, cellIndex) {
7076
7339
  var sizeIndex = cell.level || cellIndex;
7077
7340
  var colIndex = cell.index || cellIndex;
7078
- if (typeof sizingColumns[sizeIndex] === 'undefined' || _this47.options.columns[_this47.options.columns.length - 1][colIndex].show === false) {
7341
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || _this52.options.columns[_this52.options.columns.length - 1][colIndex].show === false) {
7079
7342
  return; // need to revisit this logic
7080
7343
  }
7081
7344
 
@@ -7102,7 +7365,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7102
7365
  style += "color: ".concat(cell.color, "; ");
7103
7366
  }
7104
7367
  // console.log('rowspan', cell.rowspan)
7105
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this47.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 ");
7368
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this52.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 ");
7106
7369
  // if (useWidths === true) {
7107
7370
  // bodyHtml += `
7108
7371
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -7111,10 +7374,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7111
7374
  // }
7112
7375
  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 >");
7113
7376
  if (cell.expandable === true) {
7114
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this47.options.plusIcon, "</i>");
7377
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this52.options.plusIcon, "</i>");
7115
7378
  }
7116
7379
  if (cell.collapsable === true) {
7117
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this47.options.minusIcon, "</i>");
7380
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this52.options.minusIcon, "</i>");
7118
7381
  }
7119
7382
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
7120
7383
  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 ");
@@ -7135,7 +7398,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7135
7398
  }, {
7136
7399
  key: "buildHeaderHtml",
7137
7400
  value: function buildHeaderHtml() {
7138
- var _this48 = this;
7401
+ var _this53 = this;
7139
7402
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7140
7403
  if (!this.options.columns) {
7141
7404
  return '';
@@ -7156,7 +7419,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7156
7419
  // // if we're calculating the size we only want to render the last row of column headers
7157
7420
  // return
7158
7421
  // }
7159
- headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this48.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
7422
+ headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this53.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
7160
7423
  row.filter(function (c) {
7161
7424
  return c.show !== false;
7162
7425
  }).forEach(function (col, colIndex) {
@@ -7176,24 +7439,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
7176
7439
  if (col.style) {
7177
7440
  style += col.style;
7178
7441
  }
7179
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this48.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7442
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this53.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7180
7443
  // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
7181
7444
  // headerHtml += `
7182
7445
  // style='width: ${col.width || col.actualWidth}px'
7183
7446
  // width='${col.width || col.actualWidth}'
7184
7447
  // `
7185
7448
  // }
7186
- 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 ? _this48.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this48.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
7449
+ 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 ? _this53.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this53.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
7187
7450
  });
7188
7451
  headerHtml += "</tr>";
7189
7452
  });
7190
7453
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
7191
7454
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
7192
7455
  if (c.searchable && c.isExternalSearch === true) {
7193
- var testEl = document.getElementById("".concat(_this48.elementId, "_columnSearch_").concat(c.dimId || i));
7456
+ var testEl = document.getElementById("".concat(_this53.elementId, "_columnSearch_").concat(c.dimId || i));
7194
7457
  if (!testEl) {
7195
7458
  var newE = document.createElement('div');
7196
- newE.id = "".concat(_this48.elementId, "_columnSearch_").concat(c.dimId || i);
7459
+ newE.id = "".concat(_this53.elementId, "_columnSearch_").concat(c.dimId || i);
7197
7460
  newE.className = 'websy-modal-dropdown';
7198
7461
  dropdownEl.appendChild(newE);
7199
7462
  }
@@ -7216,7 +7479,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7216
7479
  }, {
7217
7480
  key: "buildTotalHtml",
7218
7481
  value: function buildTotalHtml() {
7219
- var _this49 = this;
7482
+ var _this54 = this;
7220
7483
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7221
7484
  if (!this.options.totals) {
7222
7485
  return '';
@@ -7232,7 +7495,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7232
7495
 
7233
7496
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7234
7497
  if (useWidths === true) {
7235
- totalHtml += "\n style='width: ".concat(_this49.options.columns[_this49.options.columns.length - 1][colIndex].width || _this49.options.columns[_this49.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
7498
+ totalHtml += "\n style='width: ".concat(_this54.options.columns[_this54.options.columns.length - 1][colIndex].width || _this54.options.columns[_this54.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
7236
7499
  }
7237
7500
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
7238
7501
  });
@@ -7242,7 +7505,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7242
7505
  }, {
7243
7506
  key: "calculateSizes",
7244
7507
  value: function calculateSizes() {
7245
- var _this50 = this;
7508
+ var _this55 = this;
7246
7509
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7247
7510
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
7248
7511
  var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
@@ -7286,7 +7549,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7286
7549
  rows.forEach(function (row, rowIndex) {
7287
7550
  Array.from(row.children).forEach(function (col, colIndex) {
7288
7551
  var colSize = col.getBoundingClientRect();
7289
- _this50.sizes.cellHeight = colSize.height;
7552
+ _this55.sizes.cellHeight = colSize.height;
7290
7553
  if (columnsForSizing[colIndex]) {
7291
7554
  if (!columnsForSizing[colIndex].actualWidth) {
7292
7555
  columnsForSizing[colIndex].potentialWidth = 0;
@@ -7298,7 +7561,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7298
7561
  // columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
7299
7562
  // }
7300
7563
  columnsForSizing[colIndex].cellHeight = colSize.height;
7301
- if (colIndex >= _this50.pinnedColumns) {
7564
+ if (colIndex >= _this55.pinnedColumns) {
7302
7565
  firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
7303
7566
  }
7304
7567
  }
@@ -7313,7 +7576,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7313
7576
  return a + (b.width || b.actualWidth);
7314
7577
  }, 0);
7315
7578
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
7316
- return i >= _this50.pinnedColumns;
7579
+ return i >= _this55.pinnedColumns;
7317
7580
  }).reduce(function (a, b) {
7318
7581
  return a + (b.width || b.actualWidth);
7319
7582
  }, 0);
@@ -7324,7 +7587,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7324
7587
  var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
7325
7588
  columnsForSizing.forEach(function (c) {
7326
7589
  c.shouldGrow = true;
7327
- if (_this50.options.autoFitColumns === false) {
7590
+ if (_this55.options.autoFitColumns === false) {
7328
7591
  c.shouldGrow = false;
7329
7592
  if (c.potentialWidth > c.actualWidth) {
7330
7593
  c.shouldGrow = true;
@@ -7343,7 +7606,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7343
7606
  // if (!c.width) {
7344
7607
  // if (c.actualWidth < equalWidth) {
7345
7608
  // adjust the width
7346
- if (_this50.options.autoFitColumns === true) {
7609
+ if (_this55.options.autoFitColumns === true) {
7347
7610
  if (c.width) {
7348
7611
  c.width += equalWidth;
7349
7612
  }
@@ -7367,9 +7630,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
7367
7630
  }
7368
7631
  // }
7369
7632
  // }
7370
- _this50.sizes.totalWidth += c.width || c.actualWidth;
7371
- if (i > _this50.pinnedColumns) {
7372
- _this50.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7633
+ _this55.sizes.totalWidth += c.width || c.actualWidth;
7634
+ if (i > _this55.pinnedColumns) {
7635
+ _this55.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7373
7636
  }
7374
7637
  // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
7375
7638
  });
@@ -7428,7 +7691,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7428
7691
  }, {
7429
7692
  key: "createSample",
7430
7693
  value: function createSample(data) {
7431
- var _this51 = this;
7694
+ var _this56 = this;
7432
7695
  var output = [];
7433
7696
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
7434
7697
  if (col.maxLength) {
@@ -7438,7 +7701,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7438
7701
  } else if (data) {
7439
7702
  var longest = '';
7440
7703
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
7441
- if (data[i].length === _this51.options.columns[_this51.options.columns.length - 1].length) {
7704
+ if (data[i].length === _this56.options.columns[_this56.options.columns.length - 1].length) {
7442
7705
  if (longest.length < data[i][colIndex].value.length) {
7443
7706
  longest = data[i][colIndex].value;
7444
7707
  }
@@ -7710,7 +7973,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7710
7973
  }, {
7711
7974
  key: "perpetualScroll",
7712
7975
  value: function perpetualScroll() {
7713
- var _this52 = this;
7976
+ var _this57 = this;
7714
7977
  // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
7715
7978
  if (this.touchEndTime - this.currentTouchtime > 300) {
7716
7979
  return;
@@ -7729,17 +7992,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
7729
7992
  var direction = touchDistance > 0 ? -1 : 1;
7730
7993
  var _loop2 = function _loop2(i) {
7731
7994
  setTimeout(function () {
7732
- var delta = _this52.mouseYStart - _this52.currentClientY + _this52.sizes.cellHeight * (i + 1) * direction;
7995
+ var delta = _this57.mouseYStart - _this57.currentClientY + _this57.sizes.cellHeight * (i + 1) * direction;
7733
7996
  delta = Math.min(10, delta);
7734
7997
  delta = Math.max(-10, delta);
7735
7998
  // only run this if isPerpetual === true
7736
7999
  // this value is reset to false on touchStart
7737
- if (_this52.isPerpetual === true) {
8000
+ if (_this57.isPerpetual === true) {
7738
8001
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7739
8002
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
7740
- _this52.scrollY(Math.max(-5, Math.min(5, delta)));
7741
- if (_this52.scrollTimeout) {
7742
- clearTimeout(_this52.scrollTimeout);
8003
+ _this57.scrollY(Math.max(-5, Math.min(5, delta)));
8004
+ if (_this57.scrollTimeout) {
8005
+ clearTimeout(_this57.scrollTimeout);
7743
8006
  }
7744
8007
  }
7745
8008
  }, 1000 / fps * i);
@@ -8007,7 +8270,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
8007
8270
  /* global d3 include WebsyDesigns */
8008
8271
  var WebsyChart = /*#__PURE__*/function () {
8009
8272
  function WebsyChart(elementId, options) {
8010
- var _this53 = this;
8273
+ var _this58 = this;
8011
8274
  _classCallCheck(this, WebsyChart);
8012
8275
  var DEFAULTS = {
8013
8276
  margin: {
@@ -8066,7 +8329,7 @@ var WebsyChart = /*#__PURE__*/function () {
8066
8329
  this.invertOverride = function (input, input2) {
8067
8330
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8068
8331
  var xAxis = 'bottom';
8069
- if (_this53.options.orientation === 'horizontal') {
8332
+ if (_this58.options.orientation === 'horizontal') {
8070
8333
  xAxis = 'left';
8071
8334
  }
8072
8335
  if (forBrush === true) {
@@ -8074,12 +8337,12 @@ var WebsyChart = /*#__PURE__*/function () {
8074
8337
  }
8075
8338
  xAxis += 'Axis';
8076
8339
  var output;
8077
- var width = _this53.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
8340
+ var width = _this58.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
8078
8341
  // if (this.customBottomRange) {
8079
- for (var index = 0; index < _this53.customBottomRange.length; index++) {
8080
- if (input > _this53.customBottomRange[index]) {
8081
- if (_this53.customBottomRange[index + 1]) {
8082
- if (input < _this53.customBottomRange[index + 1]) {
8342
+ for (var index = 0; index < _this58.customBottomRange.length; index++) {
8343
+ if (input > _this58.customBottomRange[index]) {
8344
+ if (_this58.customBottomRange[index + 1]) {
8345
+ if (input < _this58.customBottomRange[index + 1]) {
8083
8346
  output = index;
8084
8347
  break;
8085
8348
  }
@@ -8244,9 +8507,9 @@ var WebsyChart = /*#__PURE__*/function () {
8244
8507
  }, {
8245
8508
  key: "handleEventMouseMove",
8246
8509
  value: function handleEventMouseMove(event, d) {
8247
- var _this54 = this;
8510
+ var _this59 = this;
8248
8511
  var bisectDate = d3.bisector(function (d) {
8249
- return _this54.parseX(d.x.value);
8512
+ return _this59.parseX(d.x.value);
8250
8513
  }).left;
8251
8514
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
8252
8515
  var xAxis = 'bottomAxis';
@@ -8279,9 +8542,9 @@ var WebsyChart = /*#__PURE__*/function () {
8279
8542
  xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
8280
8543
  }
8281
8544
  this.options.data.series.forEach(function (s) {
8282
- if (_this54.options.data[xData].scale !== 'Time') {
8545
+ if (_this59.options.data[xData].scale !== 'Time') {
8283
8546
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
8284
- xPoint = _this54.customBottomRange[x0] + (_this54.customBottomRange[x0 + 1] - _this54.customBottomRange[x0]) / 2;
8547
+ xPoint = _this59.customBottomRange[x0] + (_this59.customBottomRange[x0 + 1] - _this59.customBottomRange[x0]) / 2;
8285
8548
  // }
8286
8549
  // else {
8287
8550
  // xPoint = this[xAxis](this.parseX(xLabel))
@@ -8301,41 +8564,41 @@ var WebsyChart = /*#__PURE__*/function () {
8301
8564
  var index = bisectDate(s.data, x0, 1);
8302
8565
  var pointA = s.data[index - 1];
8303
8566
  var pointB = s.data[index];
8304
- if (_this54.options.orientation === 'horizontal') {
8567
+ if (_this59.options.orientation === 'horizontal') {
8305
8568
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
8306
8569
  pointB = _toConsumableArray(s.data).reverse()[index];
8307
8570
  }
8308
8571
  if (pointA && !pointB) {
8309
- xPoint = _this54[xAxis](_this54.parseX(pointA.x.value));
8572
+ xPoint = _this59[xAxis](_this59.parseX(pointA.x.value));
8310
8573
  tooltipTitle = pointA.x.value;
8311
8574
  if (!pointA.y.color) {
8312
8575
  pointA.y.color = s.color;
8313
8576
  }
8314
8577
  tooltipData.push(pointA);
8315
8578
  if (typeof pointA.x.value.getTime !== 'undefined') {
8316
- tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointA.x.value);
8579
+ tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointA.x.value);
8317
8580
  }
8318
8581
  }
8319
8582
  if (pointB && !pointA) {
8320
- xPoint = _this54[xAxis](_this54.parseX(pointB.x.value));
8583
+ xPoint = _this59[xAxis](_this59.parseX(pointB.x.value));
8321
8584
  tooltipTitle = pointB.x.value;
8322
8585
  if (!pointB.y.color) {
8323
8586
  pointB.y.color = s.color;
8324
8587
  }
8325
8588
  tooltipData.push(pointB);
8326
8589
  if (typeof pointB.x.value.getTime !== 'undefined') {
8327
- tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointB.x.value);
8590
+ tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointB.x.value);
8328
8591
  }
8329
8592
  }
8330
8593
  if (pointA && pointB) {
8331
- var d0 = _this54[xAxis](_this54.parseX(pointA.x.value));
8332
- var d1 = _this54[xAxis](_this54.parseX(pointB.x.value));
8594
+ var d0 = _this59[xAxis](_this59.parseX(pointA.x.value));
8595
+ var d1 = _this59[xAxis](_this59.parseX(pointB.x.value));
8333
8596
  var mid = Math.abs(d0 - d1) / 2;
8334
8597
  if (d3.pointer(event)[0] - d0 >= mid) {
8335
8598
  xPoint = d1;
8336
8599
  tooltipTitle = pointB.x.value;
8337
8600
  if (typeof pointB.x.value.getTime !== 'undefined') {
8338
- tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointB.x.value);
8601
+ tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointB.x.value);
8339
8602
  }
8340
8603
  if (!pointB.y.color) {
8341
8604
  pointB.y.color = s.color;
@@ -8345,7 +8608,7 @@ var WebsyChart = /*#__PURE__*/function () {
8345
8608
  xPoint = d0;
8346
8609
  tooltipTitle = pointA.x.value;
8347
8610
  if (typeof pointB.x.value.getTime !== 'undefined') {
8348
- tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointB.x.value);
8611
+ tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointB.x.value);
8349
8612
  }
8350
8613
  if (!pointA.y.color) {
8351
8614
  pointA.y.color = s.color;
@@ -8471,7 +8734,7 @@ var WebsyChart = /*#__PURE__*/function () {
8471
8734
  }, {
8472
8735
  key: "render",
8473
8736
  value: function render(options) {
8474
- var _this55 = this;
8737
+ var _this60 = this;
8475
8738
  /* global d3 options WebsyUtils */
8476
8739
  this._isRendered = false;
8477
8740
  if (typeof options !== 'undefined') {
@@ -8540,7 +8803,7 @@ var WebsyChart = /*#__PURE__*/function () {
8540
8803
  this.options.data.series.map(function (s, i) {
8541
8804
  return {
8542
8805
  value: s.label || s.key,
8543
- color: s.color || _this55.options.colors[i % _this55.options.colors.length]
8806
+ color: s.color || _this60.options.colors[i % _this60.options.colors.length]
8544
8807
  };
8545
8808
  });
8546
8809
  }
@@ -8897,25 +9160,25 @@ var WebsyChart = /*#__PURE__*/function () {
8897
9160
  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') {
8898
9161
  var acc = 0;
8899
9162
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8900
- var adjustment = _this55.bandPadding * index + _this55.bandPadding;
9163
+ var adjustment = _this60.bandPadding * index + _this60.bandPadding;
8901
9164
  // if (this.options.data.bottom.padding) {
8902
9165
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8903
9166
  // }
8904
- var start = _this55.widthForCalc / noOfPoints * acc;
9167
+ var start = _this60.widthForCalc / noOfPoints * acc;
8905
9168
  for (var i = 0; i < (d.valueCount || 1); i++) {
8906
9169
  var pos = i * proposedBandWidth;
8907
- _this55["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
9170
+ _this60["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8908
9171
  }
8909
- acc += _this55.options.grouping !== 'stacked' && _this55.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8910
- var end = _this55.widthForCalc / noOfPoints * acc;
9172
+ acc += _this60.options.grouping !== 'stacked' && _this60.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
9173
+ var end = _this60.widthForCalc / noOfPoints * acc;
8911
9174
  // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8912
9175
  return end + adjustment;
8913
9176
  })));
8914
9177
  acc = 0;
8915
9178
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8916
- var adjustment = _this55.brushBandPadding * index + _this55.brushBandPadding;
8917
- acc += _this55.options.grouping !== 'stacked' && _this55.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8918
- return (_this55.options.orientation === 'vertical' ? _this55.plotWidth : _this55.plotHeight) / noOfPoints * acc;
9179
+ var adjustment = _this60.brushBandPadding * index + _this60.brushBandPadding;
9180
+ acc += _this60.options.grouping !== 'stacked' && _this60.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
9181
+ return (_this60.options.orientation === 'vertical' ? _this60.plotWidth : _this60.plotHeight) / noOfPoints * acc;
8919
9182
  })));
8920
9183
  }
8921
9184
  // }
@@ -9088,7 +9351,7 @@ var WebsyChart = /*#__PURE__*/function () {
9088
9351
  this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
9089
9352
  if (this.options.data.bottom.formatter) {
9090
9353
  this.bAxisFunc.tickFormat(function (d) {
9091
- return _this55.options.data.bottom.formatter(d);
9354
+ return _this60.options.data.bottom.formatter(d);
9092
9355
  });
9093
9356
  }
9094
9357
  this.bottomAxisLayer.call(this.bAxisFunc);
@@ -9098,7 +9361,7 @@ var WebsyChart = /*#__PURE__*/function () {
9098
9361
  }
9099
9362
  if (this.customBottomRange.length > 0) {
9100
9363
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
9101
- return "translate(".concat(_this55.customBottomRange[i] + (_this55.customBottomRange[i + 1] - _this55.customBottomRange[i]) / 2, ", 0)");
9364
+ return "translate(".concat(_this60.customBottomRange[i] + (_this60.customBottomRange[i + 1] - _this60.customBottomRange[i]) / 2, ", 0)");
9102
9365
  });
9103
9366
  }
9104
9367
  }
@@ -9117,14 +9380,14 @@ var WebsyChart = /*#__PURE__*/function () {
9117
9380
  }
9118
9381
  if (this.options.margin.axisLeft > 0) {
9119
9382
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
9120
- if (_this55.options.data.left.formatter) {
9121
- d = _this55.options.data.left.formatter(d);
9383
+ if (_this60.options.data.left.formatter) {
9384
+ d = _this60.options.data.left.formatter(d);
9122
9385
  }
9123
9386
  return d;
9124
9387
  }));
9125
9388
  if (this.customLeftRange.length > 0) {
9126
9389
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
9127
- return "translate(0, ".concat(_this55.customLeftRange[i] + (_this55.customLeftRange[i + 1] - _this55.customLeftRange[i]) / 2, ")");
9390
+ return "translate(0, ".concat(_this60.customLeftRange[i] + (_this60.customLeftRange[i + 1] - _this60.customLeftRange[i]) / 2, ")");
9128
9391
  });
9129
9392
  }
9130
9393
  }
@@ -9152,8 +9415,8 @@ var WebsyChart = /*#__PURE__*/function () {
9152
9415
  }
9153
9416
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
9154
9417
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
9155
- if (_this55.options.data.right.formatter) {
9156
- d = _this55.options.data.right.formatter(d);
9418
+ if (_this60.options.data.right.formatter) {
9419
+ d = _this60.options.data.right.formatter(d);
9157
9420
  }
9158
9421
  return d;
9159
9422
  }));
@@ -9193,25 +9456,25 @@ var WebsyChart = /*#__PURE__*/function () {
9193
9456
  }, {
9194
9457
  key: "renderComponents",
9195
9458
  value: function renderComponents() {
9196
- var _this56 = this;
9459
+ var _this61 = this;
9197
9460
  // Draw the series data
9198
9461
  this.renderedKeys = {};
9199
9462
  this.options.data.series.forEach(function (series, index) {
9200
9463
  if (!series.key) {
9201
- series.key = _this56.createIdentity();
9464
+ series.key = _this61.createIdentity();
9202
9465
  }
9203
9466
  if (!series.color) {
9204
- series.color = _this56.options.colors[index % _this56.options.colors.length];
9467
+ series.color = _this61.options.colors[index % _this61.options.colors.length];
9205
9468
  }
9206
- _this56["render".concat(series.type || 'bar')](series, index);
9207
- _this56.renderLabels(series, index);
9208
- _this56.renderedKeys[series.key] = series.type;
9469
+ _this61["render".concat(series.type || 'bar')](series, index);
9470
+ _this61.renderLabels(series, index);
9471
+ _this61.renderedKeys[series.key] = series.type;
9209
9472
  });
9210
9473
  this.refLineLayer.selectAll('.reference-line').remove();
9211
9474
  this.refLineLayer.selectAll('.reference-line-label').remove();
9212
9475
  if (this.options.refLines && this.options.refLines.length > 0) {
9213
9476
  this.options.refLines.forEach(function (l) {
9214
- return _this56.renderRefLine(l);
9477
+ return _this61.renderRefLine(l);
9215
9478
  });
9216
9479
  }
9217
9480
  this._isRendered = true;
@@ -9219,25 +9482,25 @@ var WebsyChart = /*#__PURE__*/function () {
9219
9482
  }, {
9220
9483
  key: "renderarea",
9221
9484
  value: function renderarea(series, index) {
9222
- var _this57 = this;
9485
+ var _this62 = this;
9223
9486
  /* global d3 series index */
9224
9487
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
9225
9488
  return d3.area().x(function (d) {
9226
- if (_this57.options.data[xAxis].scale === 'Time') {
9227
- return _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
9489
+ if (_this62.options.data[xAxis].scale === 'Time') {
9490
+ return _this62["".concat(xAxis, "Axis")](_this62.parseX(d.x.value));
9228
9491
  } else {
9229
- var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
9230
- var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9231
- if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9232
- xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9492
+ var xIndex = _this62[xAxis + 'Axis'].domain().indexOf(d.x.value);
9493
+ var xPos = _this62["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9494
+ if (_this62["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9495
+ xPos = xPos + (_this62["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9233
9496
  }
9234
9497
  return xPos;
9235
9498
  }
9236
9499
  }).y0(function (d) {
9237
- return _this57["".concat(yAxis, "Axis")](0);
9500
+ return _this62["".concat(yAxis, "Axis")](0);
9238
9501
  }).y1(function (d) {
9239
- return _this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9240
- }).curve(d3[curveStyle || _this57.options.curveStyle]);
9502
+ return _this62["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9503
+ }).curve(d3[curveStyle || _this62.options.curveStyle]);
9241
9504
  };
9242
9505
  var xAxis = 'bottom';
9243
9506
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9277,7 +9540,7 @@ var WebsyChart = /*#__PURE__*/function () {
9277
9540
  }, {
9278
9541
  key: "renderbar",
9279
9542
  value: function renderbar(series, index) {
9280
- var _this58 = this;
9543
+ var _this63 = this;
9281
9544
  /* global series index d3 */
9282
9545
  var xAxis = 'bottom';
9283
9546
  var yAxis = 'left';
@@ -9444,26 +9707,26 @@ var WebsyChart = /*#__PURE__*/function () {
9444
9707
  }
9445
9708
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9446
9709
  bars.attr('width', function (d, i) {
9447
- return Math.abs(getBarWidth.call(_this58, d, i, yAxis, xAxis));
9710
+ return Math.abs(getBarWidth.call(_this63, d, i, yAxis, xAxis));
9448
9711
  }).attr('height', function (d, i) {
9449
- return getBarHeight.call(_this58, d, i, yAxis, xAxis);
9712
+ return getBarHeight.call(_this63, d, i, yAxis, xAxis);
9450
9713
  }).attr('x', function (d, i) {
9451
- return getBarX.call(_this58, d, i, yAxis, xAxis);
9714
+ return getBarX.call(_this63, d, i, yAxis, xAxis);
9452
9715
  }).attr('y', function (d, i) {
9453
- return getBarY.call(_this58, d, i, yAxis, xAxis);
9716
+ return getBarY.call(_this63, d, i, yAxis, xAxis);
9454
9717
  })
9455
9718
  // .transition(this.transition)
9456
9719
  .attr('fill', function (d) {
9457
9720
  return d.y.color || d.color || series.color;
9458
9721
  });
9459
9722
  bars.enter().append('rect').attr('width', function (d, i) {
9460
- return Math.abs(getBarWidth.call(_this58, d, i, yAxis, xAxis));
9723
+ return Math.abs(getBarWidth.call(_this63, d, i, yAxis, xAxis));
9461
9724
  }).attr('height', function (d, i) {
9462
- return getBarHeight.call(_this58, d, i, yAxis, xAxis);
9725
+ return getBarHeight.call(_this63, d, i, yAxis, xAxis);
9463
9726
  }).attr('x', function (d, i) {
9464
- return getBarX.call(_this58, d, i, yAxis, xAxis);
9727
+ return getBarX.call(_this63, d, i, yAxis, xAxis);
9465
9728
  }).attr('y', function (d, i) {
9466
- return getBarY.call(_this58, d, i, yAxis, xAxis);
9729
+ return getBarY.call(_this63, d, i, yAxis, xAxis);
9467
9730
  })
9468
9731
  // .transition(this.transition)
9469
9732
  .attr('fill', function (d) {
@@ -9475,26 +9738,26 @@ var WebsyChart = /*#__PURE__*/function () {
9475
9738
  this.brushBarsInitialized[series.key] = true;
9476
9739
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9477
9740
  brushBars.attr('width', function (d, i) {
9478
- return Math.abs(getBarWidth.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9741
+ return Math.abs(getBarWidth.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9479
9742
  }).attr('height', function (d, i) {
9480
- return getBarHeight.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9743
+ return getBarHeight.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9481
9744
  }).attr('x', function (d, i) {
9482
- return getBarX.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9745
+ return getBarX.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9483
9746
  }).attr('y', function (d, i) {
9484
- return getBarY.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9747
+ return getBarY.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9485
9748
  })
9486
9749
  // .transition(this.transition)
9487
9750
  .attr('fill', function (d) {
9488
9751
  return d.y.color || d.color || series.color;
9489
9752
  });
9490
9753
  brushBars.enter().append('rect').attr('width', function (d, i) {
9491
- return Math.abs(getBarWidth.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9754
+ return Math.abs(getBarWidth.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9492
9755
  }).attr('height', function (d, i) {
9493
- return getBarHeight.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9756
+ return getBarHeight.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9494
9757
  }).attr('x', function (d, i) {
9495
- return getBarX.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9758
+ return getBarX.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9496
9759
  }).attr('y', function (d, i) {
9497
- return getBarY.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9760
+ return getBarY.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9498
9761
  })
9499
9762
  // .transition(this.transition)
9500
9763
  .attr('fill', function (d) {
@@ -9515,7 +9778,7 @@ var WebsyChart = /*#__PURE__*/function () {
9515
9778
  }, {
9516
9779
  key: "renderLabels",
9517
9780
  value: function renderLabels(series, index) {
9518
- var _this59 = this;
9781
+ var _this64 = this;
9519
9782
  /* global series index d3 WebsyDesigns */
9520
9783
  var xAxis = 'bottom';
9521
9784
  var yAxis = 'left';
@@ -9531,14 +9794,14 @@ var WebsyChart = /*#__PURE__*/function () {
9531
9794
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
9532
9795
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
9533
9796
  labels.attr('x', function (d) {
9534
- return getLabelX.call(_this59, d, series.labelPosition);
9797
+ return getLabelX.call(_this64, d, series.labelPosition);
9535
9798
  }).attr('y', function (d) {
9536
- return getLabelY.call(_this59, d, series.labelPosition);
9799
+ return getLabelY.call(_this64, d, series.labelPosition);
9537
9800
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
9538
- if (_this59.options.grouping === 'stacked' && d.y.value === 0) {
9801
+ if (_this64.options.grouping === 'stacked' && d.y.value === 0) {
9539
9802
  return 'transparent';
9540
9803
  }
9541
- return _this59.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9804
+ return _this64.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9542
9805
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
9543
9806
  return d.y.label || d.y.value;
9544
9807
  }).each(function (d, i) {
@@ -9572,14 +9835,14 @@ var WebsyChart = /*#__PURE__*/function () {
9572
9835
  }
9573
9836
  });
9574
9837
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9575
- return getLabelX.call(_this59, d, series.labelPosition);
9838
+ return getLabelX.call(_this64, d, series.labelPosition);
9576
9839
  }).attr('y', function (d) {
9577
- return getLabelY.call(_this59, d, series.labelPosition);
9840
+ return getLabelY.call(_this64, d, series.labelPosition);
9578
9841
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9579
- if (_this59.options.grouping === 'stacked' && d.y.value === 0) {
9842
+ if (_this64.options.grouping === 'stacked' && d.y.value === 0) {
9580
9843
  return 'transparent';
9581
9844
  }
9582
- return _this59.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9845
+ return _this64.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9583
9846
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9584
9847
  return d.y.label || d.y.value;
9585
9848
  }).each(function (d, i) {
@@ -9657,32 +9920,32 @@ var WebsyChart = /*#__PURE__*/function () {
9657
9920
  }, {
9658
9921
  key: "renderline",
9659
9922
  value: function renderline(series, index) {
9660
- var _this60 = this;
9923
+ var _this65 = this;
9661
9924
  /* global series index d3 */
9662
9925
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9663
9926
  return d3.line().x(function (d) {
9664
- if (_this60.options.orientation === 'horizontal') {
9665
- return _this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9927
+ if (_this65.options.orientation === 'horizontal') {
9928
+ return _this65["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9666
9929
  } else {
9667
- if (_this60.options.data[xAxis].scale === 'Time') {
9668
- return _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value));
9930
+ if (_this65.options.data[xAxis].scale === 'Time') {
9931
+ return _this65["".concat(xAxis, "Axis")](_this65.parseX(d.x.value));
9669
9932
  } else {
9670
- var xIndex = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
9671
- var xPos = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9672
- if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9673
- xPos = xPos + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9933
+ var xIndex = _this65[xAxis + 'Axis'].domain().indexOf(d.x.value);
9934
+ var xPos = _this65["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9935
+ if (_this65["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9936
+ xPos = xPos + (_this65["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9674
9937
  }
9675
9938
  return xPos;
9676
9939
  }
9677
9940
  }
9678
9941
  }).y(function (d) {
9679
- if (_this60.options.orientation === 'horizontal') {
9680
- var adjustment = _this60.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this60.options.data[xAxis].bandWidth / 2;
9681
- return _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value)) + adjustment;
9942
+ if (_this65.options.orientation === 'horizontal') {
9943
+ var adjustment = _this65.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this65.options.data[xAxis].bandWidth / 2;
9944
+ return _this65["".concat(xAxis, "Axis")](_this65.parseX(d.x.value)) + adjustment;
9682
9945
  } else {
9683
- return _this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9946
+ return _this65["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9684
9947
  }
9685
- }).curve(d3[curveStyle || _this60.options.curveStyle]);
9948
+ }).curve(d3[curveStyle || _this65.options.curveStyle]);
9686
9949
  };
9687
9950
  var xAxis = 'bottom';
9688
9951
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9791,14 +10054,14 @@ var WebsyChart = /*#__PURE__*/function () {
9791
10054
  }, {
9792
10055
  key: "rendersymbol",
9793
10056
  value: function rendersymbol(series, index) {
9794
- var _this61 = this;
10057
+ var _this66 = this;
9795
10058
  /* global d3 series index series.key */
9796
10059
  var drawSymbol = function drawSymbol(size) {
9797
10060
  return d3.symbol()
9798
10061
  // .type(d => {
9799
10062
  // return d3.symbols[0]
9800
10063
  // })
9801
- .size(size || _this61.options.symbolSize);
10064
+ .size(size || _this66.options.symbolSize);
9802
10065
  };
9803
10066
  var xAxis = 'bottom';
9804
10067
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9824,27 +10087,27 @@ var WebsyChart = /*#__PURE__*/function () {
9824
10087
  // else {
9825
10088
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9826
10089
  // }
9827
- var xIndex = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9828
- var xPos = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9829
- if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9830
- xPos = xPos + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9831
- }
9832
- var adjustment = _this61.options.data[xAxis].scale === 'Time' || _this61.options.data[xAxis].scale === 'Linear' ? 0 : _this61.options.data[xAxis].bandWidth / 2;
9833
- if (_this61.options.orientation === 'horizontal') {
9834
- return "translate(".concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
10090
+ var xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
10091
+ var xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
10092
+ if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
10093
+ xPos = xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
10094
+ }
10095
+ var adjustment = _this66.options.data[xAxis].scale === 'Time' || _this66.options.data[xAxis].scale === 'Linear' ? 0 : _this66.options.data[xAxis].bandWidth / 2;
10096
+ if (_this66.options.orientation === 'horizontal') {
10097
+ return "translate(".concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9835
10098
  } else {
9836
- if (_this61.options.data[xAxis].scale === 'Time') {
9837
- xPos = _this61["".concat(xAxis, "Axis")](_this61.parseX(d.x.value));
10099
+ if (_this66.options.data[xAxis].scale === 'Time') {
10100
+ xPos = _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value));
9838
10101
  } else {
9839
- var _xIndex = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9840
- var _xPos = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9841
- if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9842
- _xPos = _xPos + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
10102
+ var _xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
10103
+ var _xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
10104
+ if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
10105
+ _xPos = _xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9843
10106
  }
9844
10107
  // return xPos
9845
10108
  }
9846
10109
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9847
- return "translate(".concat(xPos, ", ").concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
10110
+ return "translate(".concat(xPos, ", ").concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9848
10111
  }
9849
10112
  });
9850
10113
  // Enter
@@ -9859,27 +10122,27 @@ var WebsyChart = /*#__PURE__*/function () {
9859
10122
  }).attr('class', function (d) {
9860
10123
  return "symbol symbol_".concat(series.key);
9861
10124
  }).attr('transform', function (d) {
9862
- var xIndex = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9863
- var xPos = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9864
- if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9865
- xPos = xPos + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9866
- }
9867
- var adjustment = _this61.options.data[xAxis].scale === 'Time' || _this61.options.data[xAxis].scale === 'Linear' ? 0 : _this61.options.data[xAxis].bandWidth / 2;
9868
- if (_this61.options.orientation === 'horizontal') {
9869
- return "translate(".concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
10125
+ var xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
10126
+ var xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
10127
+ if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
10128
+ xPos = xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
10129
+ }
10130
+ var adjustment = _this66.options.data[xAxis].scale === 'Time' || _this66.options.data[xAxis].scale === 'Linear' ? 0 : _this66.options.data[xAxis].bandWidth / 2;
10131
+ if (_this66.options.orientation === 'horizontal') {
10132
+ return "translate(".concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9870
10133
  } else {
9871
- if (_this61.options.data[xAxis].scale === 'Time') {
9872
- xPos = _this61["".concat(xAxis, "Axis")](_this61.parseX(d.x.value));
10134
+ if (_this66.options.data[xAxis].scale === 'Time') {
10135
+ xPos = _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value));
9873
10136
  } else {
9874
- var _xIndex2 = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9875
- var _xPos2 = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9876
- if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9877
- _xPos2 = _xPos2 + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
10137
+ var _xIndex2 = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
10138
+ var _xPos2 = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
10139
+ if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
10140
+ _xPos2 = _xPos2 + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9878
10141
  }
9879
10142
  // return xPos
9880
10143
  }
9881
10144
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9882
- return "translate(".concat(xPos, ", ").concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
10145
+ return "translate(".concat(xPos, ", ").concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9883
10146
  }
9884
10147
  });
9885
10148
  }
@@ -10502,7 +10765,7 @@ var WebsyLegend = /*#__PURE__*/function () {
10502
10765
  }, {
10503
10766
  key: "resize",
10504
10767
  value: function resize() {
10505
- var _this62 = this;
10768
+ var _this67 = this;
10506
10769
  var el = document.getElementById(this.elementId);
10507
10770
  if (el) {
10508
10771
  // if (this.options.width) {
@@ -10513,7 +10776,7 @@ var WebsyLegend = /*#__PURE__*/function () {
10513
10776
  // }
10514
10777
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
10515
10778
  html += this._data.map(function (d, i) {
10516
- return _this62.getLegendItemHTML(d);
10779
+ return _this67.getLegendItemHTML(d);
10517
10780
  }).join('');
10518
10781
  html += "\n <div>\n ";
10519
10782
  el.innerHTML = html;
@@ -10594,7 +10857,7 @@ var WebsyKPI = /*#__PURE__*/function () {
10594
10857
  if (this.options.icon) {
10595
10858
  html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
10596
10859
  }
10597
- 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 ");
10860
+ 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 ");
10598
10861
  if (this.options.tooltip && this.options.tooltip.value) {
10599
10862
  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 ");
10600
10863
  }
@@ -10671,7 +10934,7 @@ var WebsyMap = /*#__PURE__*/function () {
10671
10934
  }, {
10672
10935
  key: "render",
10673
10936
  value: function render() {
10674
- var _this63 = this;
10937
+ var _this68 = this;
10675
10938
  this._isRendered = false;
10676
10939
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
10677
10940
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -10679,7 +10942,7 @@ var WebsyMap = /*#__PURE__*/function () {
10679
10942
  var legendData = this.options.data.polygons.map(function (s, i) {
10680
10943
  return {
10681
10944
  value: s.label || s.key,
10682
- color: s.color || _this63.options.colors[i % _this63.options.colors.length]
10945
+ color: s.color || _this68.options.colors[i % _this68.options.colors.length]
10683
10946
  };
10684
10947
  });
10685
10948
  var longestValue = legendData.map(function (s) {
@@ -10733,7 +10996,7 @@ var WebsyMap = /*#__PURE__*/function () {
10733
10996
  }
10734
10997
  if (this.polygons) {
10735
10998
  this.polygons.forEach(function (p) {
10736
- return _this63.map.removeLayer(p);
10999
+ return _this68.map.removeLayer(p);
10737
11000
  });
10738
11001
  }
10739
11002
  this.polygons = [];
@@ -10787,15 +11050,15 @@ var WebsyMap = /*#__PURE__*/function () {
10787
11050
  p.options = {};
10788
11051
  }
10789
11052
  if (!p.options.color) {
10790
- p.options.color = _this63.options.colors[i % _this63.options.colors.length];
11053
+ p.options.color = _this68.options.colors[i % _this68.options.colors.length];
10791
11054
  }
10792
11055
  var pol = L.polygon(p.data.map(function (c) {
10793
11056
  return c.map(function (d) {
10794
11057
  return [d.Latitude, d.Longitude];
10795
11058
  });
10796
- }), p.options).addTo(_this63.map);
10797
- _this63.polygons.push(pol);
10798
- _this63.map.fitBounds(pol.getBounds());
11059
+ }), p.options).addTo(_this68.map);
11060
+ _this68.polygons.push(pol);
11061
+ _this68.map.fitBounds(pol.getBounds());
10799
11062
  });
10800
11063
  }
10801
11064
  // if (this.data.markers.length > 0) {
@@ -10909,6 +11172,7 @@ var WebsyDesigns = {
10909
11172
  DatePicker: WebsyDatePicker,
10910
11173
  WebsyDropdown: WebsyDropdown,
10911
11174
  Dropdown: WebsyDropdown,
11175
+ MediaUpload: MediaUpload,
10912
11176
  WebsyResultList: WebsyResultList,
10913
11177
  ResultList: WebsyResultList,
10914
11178
  WebsyTemplate: WebsyTemplate,