@websy/websy-designs 1.2.33 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -470,7 +470,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
470
470
  value: function floorDate(d) {
471
471
  if (typeof d === 'number') {
472
472
  d = new Date(d);
473
- }
473
+ } // d.setTime(d.getTime() + d.getTimezoneOffset() * 60000)
474
+
474
475
 
475
476
  return new Date(d.setHours(0, 0, 0, 0));
476
477
  }
@@ -489,11 +490,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
489
490
  var index = event.target.getAttribute('data-index');
490
491
  this.selectRange(index);
491
492
  this.updateRange(index);
492
- } else if (event.target.classList.contains('websy-dp-date')) {// if (event.target.classList.contains('websy-disabled-date')) {
493
- // return
494
- // }
495
- // const timestamp = event.target.id.split('_')[0]
496
- // this.selectDate(+timestamp)
493
+ } else if (event.target.classList.contains('websy-dp-date')) {//
497
494
  } else if (event.target.classList.contains('websy-dp-confirm')) {
498
495
  this.close(true);
499
496
  } else if (event.target.classList.contains('websy-dp-cancel')) {
@@ -527,7 +524,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
527
524
  value: function handleMouseDown(event) {
528
525
  if (this.shiftPressed === true && this.currentselection.length > 0) {
529
526
  this.mouseDownId = this.currentselection[this.currentselection.length - 1];
530
- this.selectDate(+event.target.id.split('_')[1]);
527
+ var dateId = event.target.getAttribute('data-id');
528
+ this.selectDate(+dateId);
531
529
  } else {
532
530
  this.mouseDown = true;
533
531
  this.dragging = false;
@@ -542,7 +540,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
542
540
  this.customRangeSelected = false;
543
541
  }
544
542
 
545
- this.mouseDownId = +event.target.id.split('_')[1];
543
+ this.mouseDownId = +event.target.getAttribute('data-id');
546
544
  this.selectDate(this.mouseDownId);
547
545
  }
548
546
  }
@@ -556,9 +554,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
556
554
  return;
557
555
  }
558
556
 
559
- if (event.target.id.split('_')[1] !== this.mouseDownId) {
557
+ var dateId = +event.target.getAttribute('data-id');
558
+
559
+ if (dateId !== this.mouseDownId) {
560
560
  this.dragging = true;
561
- this.selectDate(+event.target.id.split('_')[1]);
561
+ this.selectDate(dateId);
562
562
  }
563
563
  }
564
564
  }
@@ -614,6 +614,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
614
614
 
615
615
  if (this.options.mode === 'date') {
616
616
  d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
617
+ d.setHours(0, 0, 0, 0);
617
618
  d = d.getTime();
618
619
  rangeStart = this.selectedRangeDates[0].getTime();
619
620
  rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
@@ -906,7 +907,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
906
907
  }
907
908
 
908
909
  html += months[key].map(function (d) {
909
- return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
910
+ return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_date' data-id='").concat(d.id, "' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
910
911
  }).join('');
911
912
  html += "\n </ul>\n </div>\n ";
912
913
  }
@@ -1043,7 +1044,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1043
1044
 
1044
1045
  if (this.options.ranges[this.options.mode][index]) {
1045
1046
  this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1046
- this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1047
+ this.currentselection = this.options.ranges[this.options.mode][index].range.map(function (d) {
1048
+ return d.getTime();
1049
+ });
1047
1050
  this.selectedRange = +index;
1048
1051
  var el = document.getElementById("".concat(this.elementId, "_header"));
1049
1052
 
@@ -1274,8 +1277,6 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1274
1277
  }
1275
1278
 
1276
1279
  GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this));
1277
- console.log('constructor dd');
1278
- console.trace();
1279
1280
  GlobalPubSub.subscribe(this.elementId, 'add', this.addItem.bind(this));
1280
1281
  this.render();
1281
1282
  }
@@ -1350,16 +1351,15 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1350
1351
  el: event.target.id,
1351
1352
  id: this.elementId,
1352
1353
  itemId: this.draggedId
1353
- }));
1354
- console.log('drag start', event);
1354
+ })); // console.log('drag start', event)
1355
+
1355
1356
  event.target.style.opacity = 0.5;
1356
1357
  this.dragging = true;
1357
1358
  }
1358
1359
  }, {
1359
1360
  key: "handleDragOver",
1360
1361
  value: function handleDragOver(event) {
1361
- console.log('drag over', event.target.classList);
1362
-
1362
+ // console.log('drag over', event.target.classList)
1363
1363
  if (event.preventDefault) {
1364
1364
  event.preventDefault();
1365
1365
  }
@@ -1373,8 +1373,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1373
1373
  }, {
1374
1374
  key: "handleDragLeave",
1375
1375
  value: function handleDragLeave(event) {
1376
- console.log('drag leave', event.target.classList);
1377
-
1376
+ // console.log('drag leave', event.target.classList)
1378
1377
  if (!event.target.classList.contains('droppable')) {
1379
1378
  return;
1380
1379
  }
@@ -1387,8 +1386,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1387
1386
  }, {
1388
1387
  key: "handleDrop",
1389
1388
  value: function handleDrop(event) {
1390
- console.log('drag drop');
1391
- console.log(event.dataTransfer.getData('application/wd-item'));
1389
+ // console.log('drag drop')
1390
+ // console.log(event.dataTransfer.getData('application/wd-item'))
1392
1391
  var data = JSON.parse(event.dataTransfer.getData('application/wd-item'));
1393
1392
 
1394
1393
  if (event.preventDefault) {
@@ -1410,7 +1409,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1410
1409
  }
1411
1410
 
1412
1411
  if (draggedIndex === -1) {
1413
- console.log('requestForDDItem');
1412
+ // console.log('requestForDDItem')
1414
1413
  GlobalPubSub.publish(data.id, 'requestForDDItem', {
1415
1414
  group: this.options.group,
1416
1415
  source: data.id,
@@ -1454,7 +1453,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1454
1453
  }, {
1455
1454
  key: "handleDragEnd",
1456
1455
  value: function handleDragEnd(event) {
1457
- console.log('drag end');
1456
+ // console.log('drag end')
1458
1457
  event.target.style.opacity = 1;
1459
1458
  this.draggedId = null;
1460
1459
  this.dragging = false;
@@ -1913,14 +1912,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
1913
1912
  }, {
1914
1913
  key: "updateHeader",
1915
1914
  value: function updateHeader(item) {
1916
- var _this11 = this;
1917
-
1918
1915
  var el = document.getElementById(this.elementId);
1919
1916
  var headerEl = document.getElementById("".concat(this.elementId, "_header"));
1920
1917
  var headerLabelEl = document.getElementById("".concat(this.elementId, "_headerLabel"));
1921
1918
  var labelEl = document.getElementById("".concat(this.elementId, "_selectedItems"));
1922
1919
  var inputEl = document.getElementById("".concat(this.elementId, "_input"));
1923
1920
  var itemEls = el.querySelectorAll(".websy-dropdown-item");
1921
+ var dataToUse = this._originalData;
1922
+
1923
+ if (this.options.onSearch) {
1924
+ dataToUse = this.options.items;
1925
+ }
1924
1926
 
1925
1927
  for (var i = 0; i < itemEls.length; i++) {
1926
1928
  itemEls[i].classList.remove('active');
@@ -1960,17 +1962,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
1960
1962
  } else if (this.selectedItems.length > 1) {
1961
1963
  if (this.options.showCompleteSelectedList === true) {
1962
1964
  var selectedLabels = this.selectedItems.map(function (s) {
1963
- return _this11.options.items[s].label || _this11.options.items[s].value;
1965
+ return dataToUse[s].label || dataToUse[s].value;
1964
1966
  }).join(this.options.multiValueDelimiter);
1965
1967
  var selectedValues = this.selectedItems.map(function (s) {
1966
- return _this11.options.items[s].value || _this11.options.items[s].label;
1968
+ return dataToUse[s].value || dataToUse[s].label;
1967
1969
  }).join(this.options.multiValueDelimiter);
1968
1970
  labelEl.innerHTML = selectedLabels;
1969
1971
  labelEl.setAttribute('data-info', selectedLabels);
1970
1972
  inputEl.value = selectedValues;
1971
1973
  } else {
1972
1974
  var _selectedValues = this.selectedItems.map(function (s) {
1973
- return _this11.options.items[s].value || _this11.options.items[s].label;
1975
+ return dataToUse[s].value || dataToUse[s].label;
1974
1976
  }).join(this.options.multiValueDelimiter);
1975
1977
 
1976
1978
  labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
@@ -1987,6 +1989,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
1987
1989
  }, {
1988
1990
  key: "updateSelected",
1989
1991
  value: function updateSelected(index) {
1992
+ var dataToUse = this._originalData && this._originalData.length > 0 ? this._originalData : this.options.items;
1993
+
1994
+ if (this.options.onSearch) {
1995
+ dataToUse = this.options.items;
1996
+ }
1997
+
1990
1998
  if (typeof index !== 'undefined' && index !== null) {
1991
1999
  var pos = this.selectedItems.indexOf(index);
1992
2000
 
@@ -2002,11 +2010,11 @@ var WebsyDropdown = /*#__PURE__*/function () {
2002
2010
  } // const item = this.options.items[index]
2003
2011
 
2004
2012
 
2005
- var item = this._originalData[index] || this.options.items[index];
2013
+ var item = dataToUse[index];
2006
2014
  this.updateHeader(item);
2007
2015
 
2008
2016
  if (item && this.options.onItemSelected) {
2009
- this.options.onItemSelected(item, this.selectedItems, this._originalData || this.options.items, this.options);
2017
+ this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
2010
2018
  }
2011
2019
 
2012
2020
  if (this.options.closeAfterSelection === true) {
@@ -2026,6 +2034,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
2026
2034
  d.index = i;
2027
2035
  }
2028
2036
 
2037
+ d.currentIndex = i;
2029
2038
  return d;
2030
2039
  });
2031
2040
  var headerEl = document.getElementById("".concat(this.elementId, "_header"));
@@ -2036,16 +2045,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
2036
2045
 
2037
2046
  var el = document.getElementById("".concat(this.elementId, "_items"));
2038
2047
 
2039
- if (el.childElementCount === 0) {
2040
- this.render();
2041
- } else {
2042
- if (this.options.items.length === 0) {
2043
- this.options.items = [{
2044
- label: this.options.noItemsText || 'No Items'
2045
- }];
2046
- }
2048
+ if (el) {
2049
+ if (el.childElementCount === 0) {
2050
+ this.render();
2051
+ } else {
2052
+ if (this.options.items.length === 0) {
2053
+ this.options.items = [{
2054
+ label: this.options.noItemsText || 'No Items'
2055
+ }];
2056
+ }
2047
2057
 
2048
- this.renderItems();
2058
+ this.renderItems();
2059
+ }
2049
2060
  }
2050
2061
  },
2051
2062
  get: function get() {
@@ -2114,16 +2125,16 @@ var WebsyForm = /*#__PURE__*/function () {
2114
2125
  }, {
2115
2126
  key: "checkRecaptcha",
2116
2127
  value: function checkRecaptcha() {
2117
- var _this12 = this;
2128
+ var _this11 = this;
2118
2129
 
2119
2130
  return new Promise(function (resolve, reject) {
2120
- if (_this12.options.useRecaptcha === true) {
2131
+ if (_this11.options.useRecaptcha === true) {
2121
2132
  // if (this.recaptchaValue) {
2122
2133
  grecaptcha.ready(function () {
2123
2134
  grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
2124
2135
  action: 'submit'
2125
2136
  }).then(function (token) {
2126
- _this12.apiService.add('google/checkrecaptcha', {
2137
+ _this11.apiService.add('google/checkrecaptcha', {
2127
2138
  grecaptcharesponse: token
2128
2139
  }).then(function (response) {
2129
2140
  if (response.success && response.success === true) {
@@ -2186,14 +2197,14 @@ var WebsyForm = /*#__PURE__*/function () {
2186
2197
  }, {
2187
2198
  key: "processComponents",
2188
2199
  value: function processComponents(components, callbackFn) {
2189
- var _this13 = this;
2200
+ var _this12 = this;
2190
2201
 
2191
2202
  if (components.length === 0) {
2192
2203
  callbackFn();
2193
2204
  } else {
2194
2205
  components.forEach(function (c) {
2195
2206
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
2196
- c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
2207
+ c.instance = new WebsyDesigns[c.component]("".concat(_this12.elementId, "_input_").concat(c.field, "_component"), c.options);
2197
2208
  } else {// some user feedback here
2198
2209
  }
2199
2210
  });
@@ -2214,7 +2225,7 @@ var WebsyForm = /*#__PURE__*/function () {
2214
2225
  }, {
2215
2226
  key: "render",
2216
2227
  value: function render(update, data) {
2217
- var _this14 = this;
2228
+ var _this13 = this;
2218
2229
 
2219
2230
  var el = document.getElementById(this.elementId);
2220
2231
  var componentsToProcess = [];
@@ -2224,11 +2235,11 @@ var WebsyForm = /*#__PURE__*/function () {
2224
2235
  this.options.fields.forEach(function (f, i) {
2225
2236
  if (f.component) {
2226
2237
  componentsToProcess.push(f);
2227
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this14.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2238
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this13.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2228
2239
  } else if (f.type === 'longtext') {
2229
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this14.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2240
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this13.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2230
2241
  } else {
2231
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this14.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2242
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this13.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2232
2243
  }
2233
2244
  });
2234
2245
  html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
@@ -2245,7 +2256,7 @@ var WebsyForm = /*#__PURE__*/function () {
2245
2256
 
2246
2257
  el.innerHTML = html;
2247
2258
  this.processComponents(componentsToProcess, function () {
2248
- if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
2259
+ if (_this13.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
2249
2260
  }
2250
2261
  });
2251
2262
  }
@@ -2253,7 +2264,7 @@ var WebsyForm = /*#__PURE__*/function () {
2253
2264
  }, {
2254
2265
  key: "submitForm",
2255
2266
  value: function submitForm() {
2256
- var _this15 = this;
2267
+ var _this14 = this;
2257
2268
 
2258
2269
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2259
2270
 
@@ -2267,32 +2278,32 @@ var WebsyForm = /*#__PURE__*/function () {
2267
2278
  data[key] = value;
2268
2279
  });
2269
2280
 
2270
- if (_this15.options.url) {
2271
- var _this15$apiService;
2281
+ if (_this14.options.url) {
2282
+ var _this14$apiService;
2272
2283
 
2273
- var params = [_this15.options.url];
2284
+ var params = [_this14.options.url];
2274
2285
 
2275
- if (_this15.options.mode === 'update') {
2276
- params.push(_this15.options.id);
2286
+ if (_this14.options.mode === 'update') {
2287
+ params.push(_this14.options.id);
2277
2288
  }
2278
2289
 
2279
2290
  params.push(data);
2280
2291
 
2281
- (_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
2282
- if (_this15.options.clearAfterSave === true) {
2292
+ (_this14$apiService = _this14.apiService)[_this14.options.mode].apply(_this14$apiService, params).then(function (result) {
2293
+ if (_this14.options.clearAfterSave === true) {
2283
2294
  // this.render()
2284
2295
  formEl.reset();
2285
2296
  }
2286
2297
 
2287
- _this15.options.onSuccess.call(_this15, result);
2298
+ _this14.options.onSuccess.call(_this14, result);
2288
2299
  }, function (err) {
2289
2300
  console.log('Error submitting form data:', err);
2290
2301
 
2291
- _this15.options.onError.call(_this15, err);
2302
+ _this14.options.onError.call(_this14, err);
2292
2303
  });
2293
- } else if (_this15.options.submitFn) {
2294
- _this15.options.submitFn(data, function () {
2295
- if (_this15.options.clearAfterSave === true) {
2304
+ } else if (_this14.options.submitFn) {
2305
+ _this14.options.submitFn(data, function () {
2306
+ if (_this14.options.clearAfterSave === true) {
2296
2307
  // this.render()
2297
2308
  formEl.reset();
2298
2309
  }
@@ -2312,17 +2323,17 @@ var WebsyForm = /*#__PURE__*/function () {
2312
2323
  }, {
2313
2324
  key: "data",
2314
2325
  set: function set(d) {
2315
- var _this16 = this;
2326
+ var _this15 = this;
2316
2327
 
2317
2328
  if (!this.options.fields) {
2318
2329
  this.options.fields = [];
2319
2330
  }
2320
2331
 
2321
2332
  var _loop = function _loop(key) {
2322
- _this16.options.fields.forEach(function (f) {
2333
+ _this15.options.fields.forEach(function (f) {
2323
2334
  if (f.field === key) {
2324
2335
  f.value = d[key];
2325
- var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
2336
+ var el = document.getElementById("".concat(_this15.elementId, "_input_").concat(f.field));
2326
2337
  el.value = f.value;
2327
2338
  }
2328
2339
  });
@@ -2634,7 +2645,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2634
2645
 
2635
2646
  var Pager = /*#__PURE__*/function () {
2636
2647
  function Pager(elementId, options) {
2637
- var _this17 = this;
2648
+ var _this16 = this;
2638
2649
 
2639
2650
  _classCallCheck(this, Pager);
2640
2651
 
@@ -2687,8 +2698,8 @@ var Pager = /*#__PURE__*/function () {
2687
2698
  allowClear: false,
2688
2699
  disableSearch: true,
2689
2700
  onItemSelected: function onItemSelected(selectedItem) {
2690
- if (_this17.options.onChangePageSize) {
2691
- _this17.options.onChangePageSize(selectedItem.value);
2701
+ if (_this16.options.onChangePageSize) {
2702
+ _this16.options.onChangePageSize(selectedItem.value);
2692
2703
  }
2693
2704
  }
2694
2705
  });
@@ -2712,13 +2723,13 @@ var Pager = /*#__PURE__*/function () {
2712
2723
  }, {
2713
2724
  key: "render",
2714
2725
  value: function render() {
2715
- var _this18 = this;
2726
+ var _this17 = this;
2716
2727
 
2717
2728
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
2718
2729
 
2719
2730
  if (el) {
2720
2731
  var pages = this.options.pages.map(function (item, index) {
2721
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this18.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2732
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this17.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2722
2733
  });
2723
2734
  var startIndex = 0;
2724
2735
 
@@ -2786,58 +2797,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
2786
2797
  _createClass(WebsyPDFButton, [{
2787
2798
  key: "handleClick",
2788
2799
  value: function handleClick(event) {
2789
- var _this19 = this;
2800
+ var _this18 = this;
2790
2801
 
2791
2802
  if (event.target.classList.contains('websy-pdf-button')) {
2792
2803
  this.loader.show();
2793
2804
  setTimeout(function () {
2794
- if (_this19.options.targetId) {
2795
- var el = document.getElementById(_this19.options.targetId);
2805
+ if (_this18.options.targetId) {
2806
+ var el = document.getElementById(_this18.options.targetId);
2796
2807
 
2797
2808
  if (el) {
2798
2809
  var pdfData = {
2799
2810
  options: {}
2800
2811
  };
2801
2812
 
2802
- if (_this19.options.pdfOptions) {
2803
- pdfData.options = _extends({}, _this19.options.pdfOptions);
2813
+ if (_this18.options.pdfOptions) {
2814
+ pdfData.options = _extends({}, _this18.options.pdfOptions);
2804
2815
  }
2805
2816
 
2806
- if (_this19.options.header) {
2807
- if (_this19.options.header.elementId) {
2808
- var headerEl = document.getElementById(_this19.options.header.elementId);
2817
+ if (_this18.options.header) {
2818
+ if (_this18.options.header.elementId) {
2819
+ var headerEl = document.getElementById(_this18.options.header.elementId);
2809
2820
 
2810
2821
  if (headerEl) {
2811
2822
  pdfData.header = headerEl.outerHTML;
2812
2823
 
2813
- if (_this19.options.header.css) {
2814
- pdfData.options.headerCSS = _this19.options.header.css;
2824
+ if (_this18.options.header.css) {
2825
+ pdfData.options.headerCSS = _this18.options.header.css;
2815
2826
  }
2816
2827
  }
2817
- } else if (_this19.options.header.html) {
2818
- pdfData.header = _this19.options.header.html;
2828
+ } else if (_this18.options.header.html) {
2829
+ pdfData.header = _this18.options.header.html;
2819
2830
 
2820
- if (_this19.options.header.css) {
2821
- pdfData.options.headerCSS = _this19.options.header.css;
2831
+ if (_this18.options.header.css) {
2832
+ pdfData.options.headerCSS = _this18.options.header.css;
2822
2833
  }
2823
2834
  } else {
2824
- pdfData.header = _this19.options.header;
2835
+ pdfData.header = _this18.options.header;
2825
2836
  }
2826
2837
  }
2827
2838
 
2828
- if (_this19.options.footer) {
2829
- if (_this19.options.footer.elementId) {
2830
- var footerEl = document.getElementById(_this19.options.footer.elementId);
2839
+ if (_this18.options.footer) {
2840
+ if (_this18.options.footer.elementId) {
2841
+ var footerEl = document.getElementById(_this18.options.footer.elementId);
2831
2842
 
2832
2843
  if (footerEl) {
2833
2844
  pdfData.footer = footerEl.outerHTML;
2834
2845
 
2835
- if (_this19.options.footer.css) {
2836
- pdfData.options.footerCSS = _this19.options.footer.css;
2846
+ if (_this18.options.footer.css) {
2847
+ pdfData.options.footerCSS = _this18.options.footer.css;
2837
2848
  }
2838
2849
  }
2839
2850
  } else {
2840
- pdfData.footer = _this19.options.footer;
2851
+ pdfData.footer = _this18.options.footer;
2841
2852
  }
2842
2853
  }
2843
2854
 
@@ -2846,31 +2857,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
2846
2857
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
2847
2858
  // document.getElementById(`${this.elementId}_form`).submit()
2848
2859
 
2849
- _this19.service.add('', pdfData, {
2860
+ _this18.service.add('', pdfData, {
2850
2861
  responseType: 'blob'
2851
2862
  }).then(function (response) {
2852
- _this19.loader.hide();
2863
+ _this18.loader.hide();
2853
2864
 
2854
2865
  var blob = new Blob([response], {
2855
2866
  type: 'application/pdf'
2856
2867
  });
2857
2868
  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 ");
2858
2869
 
2859
- if (_this19.options.directDownload === true) {
2870
+ if (_this18.options.directDownload === true) {
2860
2871
  var fileName;
2861
2872
 
2862
- if (typeof _this19.options.fileName === 'function') {
2863
- fileName = _this19.options.fileName() || 'Export';
2873
+ if (typeof _this18.options.fileName === 'function') {
2874
+ fileName = _this18.options.fileName() || 'Export';
2864
2875
  } else {
2865
- fileName = _this19.options.fileName || 'Export';
2876
+ fileName = _this18.options.fileName || 'Export';
2866
2877
  }
2867
2878
 
2868
2879
  msg += "download='".concat(fileName, ".pdf'");
2869
2880
  }
2870
2881
 
2871
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this19.options.buttonText, "</button>\n </a>\n </div>\n ");
2882
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this18.options.buttonText, "</button>\n </a>\n </div>\n ");
2872
2883
 
2873
- _this19.popup.show({
2884
+ _this18.popup.show({
2874
2885
  message: msg,
2875
2886
  mask: true
2876
2887
  });
@@ -3038,9 +3049,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
3038
3049
  this.subscriptions[id][method](data);
3039
3050
  }
3040
3051
  } else {
3041
- if (this.subscriptions[method]) {
3042
- this.subscriptions[method].forEach(function (fn) {
3043
- fn(data);
3052
+ if (this.subscriptions[id]) {
3053
+ this.subscriptions[id].forEach(function (fn) {
3054
+ fn(method);
3044
3055
  });
3045
3056
  }
3046
3057
  }
@@ -3057,11 +3068,11 @@ var WebsyPubSub = /*#__PURE__*/function () {
3057
3068
  this.subscriptions[id][method] = fn;
3058
3069
  }
3059
3070
  } else {
3060
- if (!this.subscriptions[method]) {
3061
- this.subscriptions[method] = [];
3071
+ if (!this.subscriptions[id]) {
3072
+ this.subscriptions[id] = [];
3062
3073
  }
3063
3074
 
3064
- this.subscriptions[method].push(fn);
3075
+ this.subscriptions[id].push(method);
3065
3076
  }
3066
3077
  }
3067
3078
  }]);
@@ -3071,7 +3082,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3071
3082
 
3072
3083
  var ResponsiveText = /*#__PURE__*/function () {
3073
3084
  function ResponsiveText(elementId, options) {
3074
- var _this20 = this;
3085
+ var _this19 = this;
3075
3086
 
3076
3087
  _classCallCheck(this, ResponsiveText);
3077
3088
 
@@ -3084,7 +3095,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3084
3095
  this.elementId = elementId;
3085
3096
  this.canvas = document.createElement('canvas');
3086
3097
  window.addEventListener('resize', function () {
3087
- return _this20.render();
3098
+ return _this19.render();
3088
3099
  });
3089
3100
  var el = document.getElementById(this.elementId);
3090
3101
 
@@ -3303,7 +3314,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3303
3314
 
3304
3315
  var WebsyResultList = /*#__PURE__*/function () {
3305
3316
  function WebsyResultList(elementId, options) {
3306
- var _this21 = this;
3317
+ var _this20 = this;
3307
3318
 
3308
3319
  _classCallCheck(this, WebsyResultList);
3309
3320
 
@@ -3331,9 +3342,9 @@ var WebsyResultList = /*#__PURE__*/function () {
3331
3342
 
3332
3343
  if (_typeof(options.template) === 'object' && options.template.url) {
3333
3344
  this.templateService.get(options.template.url).then(function (templateString) {
3334
- _this21.options.template = templateString;
3345
+ _this20.options.template = templateString;
3335
3346
 
3336
- _this21.render();
3347
+ _this20.render();
3337
3348
  });
3338
3349
  } else {
3339
3350
  this.render();
@@ -3352,7 +3363,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3352
3363
  }, {
3353
3364
  key: "buildHTML",
3354
3365
  value: function buildHTML(d) {
3355
- var _this22 = this;
3366
+ var _this21 = this;
3356
3367
 
3357
3368
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3358
3369
  var html = "";
@@ -3360,7 +3371,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3360
3371
  if (this.options.template) {
3361
3372
  if (d.length > 0) {
3362
3373
  d.forEach(function (row, ix) {
3363
- var template = "".concat(ix > 0 ? '-->' : '').concat(_this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3374
+ var template = "".concat(ix > 0 ? '-->' : '').concat(_this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3364
3375
 
3365
3376
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3366
3377
 
@@ -3480,7 +3491,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3480
3491
  }, {
3481
3492
  key: "handleClick",
3482
3493
  value: function handleClick(event) {
3483
- var _this23 = this;
3494
+ var _this22 = this;
3484
3495
 
3485
3496
  if (event.target.classList.contains('clickable')) {
3486
3497
  var l = event.target.getAttribute('data-event');
@@ -3498,8 +3509,8 @@ var WebsyResultList = /*#__PURE__*/function () {
3498
3509
  l = l[0];
3499
3510
  params = params.map(function (p) {
3500
3511
  if (typeof p !== 'string' && typeof p !== 'number') {
3501
- if (_this23.rows[+id]) {
3502
- p = _this23.rows[+id][p];
3512
+ if (_this22.rows[+id]) {
3513
+ p = _this22.rows[+id][p];
3503
3514
  }
3504
3515
  } else if (typeof p === 'string') {
3505
3516
  p = p.replace(/"/g, '').replace(/'/g, '');
@@ -3521,13 +3532,13 @@ var WebsyResultList = /*#__PURE__*/function () {
3521
3532
  }, {
3522
3533
  key: "render",
3523
3534
  value: function render() {
3524
- var _this24 = this;
3535
+ var _this23 = this;
3525
3536
 
3526
3537
  if (this.options.entity) {
3527
3538
  this.apiService.get(this.options.entity).then(function (results) {
3528
- _this24.rows = results.rows;
3539
+ _this23.rows = results.rows;
3529
3540
 
3530
- _this24.resize();
3541
+ _this23.resize();
3531
3542
  });
3532
3543
  } else {
3533
3544
  this.resize();
@@ -3606,14 +3617,14 @@ var WebsyRouter = /*#__PURE__*/function () {
3606
3617
  _createClass(WebsyRouter, [{
3607
3618
  key: "addGroup",
3608
3619
  value: function addGroup(group) {
3609
- var _this25 = this;
3620
+ var _this24 = this;
3610
3621
 
3611
3622
  if (!this.groups[group]) {
3612
3623
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
3613
3624
 
3614
3625
  if (els) {
3615
3626
  this.getClosestParent(els[0], function (parent) {
3616
- _this25.groups[group] = {
3627
+ _this24.groups[group] = {
3617
3628
  activeView: '',
3618
3629
  views: [],
3619
3630
  parent: parent.getAttribute('data-view')
@@ -3938,12 +3949,12 @@ var WebsyRouter = /*#__PURE__*/function () {
3938
3949
  }, {
3939
3950
  key: "showComponents",
3940
3951
  value: function showComponents(view) {
3941
- var _this26 = this;
3952
+ var _this25 = this;
3942
3953
 
3943
3954
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
3944
3955
  this.options.views[view].components.forEach(function (c) {
3945
3956
  if (typeof c.instance === 'undefined') {
3946
- _this26.prepComponent(c.elementId, c.options);
3957
+ _this25.prepComponent(c.elementId, c.options);
3947
3958
 
3948
3959
  c.instance = new c.Component(c.elementId, c.options);
3949
3960
  } else if (c.instance.render) {
@@ -4312,7 +4323,7 @@ var Switch = /*#__PURE__*/function () {
4312
4323
 
4313
4324
  var WebsyTemplate = /*#__PURE__*/function () {
4314
4325
  function WebsyTemplate(elementId, options) {
4315
- var _this27 = this;
4326
+ var _this26 = this;
4316
4327
 
4317
4328
  _classCallCheck(this, WebsyTemplate);
4318
4329
 
@@ -4338,9 +4349,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
4338
4349
 
4339
4350
  if (_typeof(options.template) === 'object' && options.template.url) {
4340
4351
  this.templateService.get(options.template.url).then(function (templateString) {
4341
- _this27.options.template = templateString;
4352
+ _this26.options.template = templateString;
4342
4353
 
4343
- _this27.render();
4354
+ _this26.render();
4344
4355
  });
4345
4356
  } else {
4346
4357
  this.render();
@@ -4350,7 +4361,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
4350
4361
  _createClass(WebsyTemplate, [{
4351
4362
  key: "buildHTML",
4352
4363
  value: function buildHTML() {
4353
- var _this28 = this;
4364
+ var _this27 = this;
4354
4365
 
4355
4366
  var html = "";
4356
4367
 
@@ -4412,14 +4423,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
4412
4423
  }
4413
4424
 
4414
4425
  if (polarity === true) {
4415
- if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] === parts[1]) {
4426
+ if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] === parts[1]) {
4416
4427
  // remove the <if> tags
4417
4428
  removeAll = false;
4418
4429
  } else if (parts[0] === parts[1]) {
4419
4430
  removeAll = false;
4420
4431
  }
4421
4432
  } else if (polarity === false) {
4422
- if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] !== parts[1]) {
4433
+ if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] !== parts[1]) {
4423
4434
  // remove the <if> tags
4424
4435
  removeAll = false;
4425
4436
  }
@@ -4515,6 +4526,7 @@ var WebsyUtils = {
4515
4526
  var red = 0;
4516
4527
  var green = 0;
4517
4528
  var blue = 0;
4529
+ var alpha = 1;
4518
4530
 
4519
4531
  if (backgroundColor.indexOf('#') !== -1) {
4520
4532
  // hex color
@@ -4526,14 +4538,16 @@ var WebsyUtils = {
4526
4538
  blue = parseInt(colorParts[4] + colorParts[5], 16);
4527
4539
  } else if (backgroundColor.toLowerCase().indexOf('rgb') !== -1) {
4528
4540
  // rgb color
4529
- colorParts = backgroundColor.replace(/rgb\(/gi, '').replace(/\)/gi, '');
4541
+ colorParts = backgroundColor.replace(/rgba\(/gi, '').replace(/\)/gi, '');
4542
+ colorParts = colorParts.replace(/rgb\(/gi, '');
4530
4543
  colorParts = colorParts.split(',');
4531
4544
  red = colorParts[0];
4532
4545
  green = colorParts[1];
4533
4546
  blue = colorParts[2];
4547
+ alpha = colorParts[3] || 1;
4534
4548
  }
4535
4549
 
4536
- return red * 0.299 + green * 0.587 + blue * 0.114 > 186 ? darkColor : lightColor;
4550
+ return (red * 0.299 + green * 0.587 + blue * 0.114) / alpha > 186 ? darkColor : lightColor;
4537
4551
  },
4538
4552
  measureText: function measureText(text) {
4539
4553
  var rotation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -4706,7 +4720,7 @@ var WebsyUtils = {
4706
4720
 
4707
4721
  var WebsyTable = /*#__PURE__*/function () {
4708
4722
  function WebsyTable(elementId, options) {
4709
- var _this29 = this;
4723
+ var _this28 = this;
4710
4724
 
4711
4725
  _classCallCheck(this, WebsyTable);
4712
4726
 
@@ -4744,8 +4758,8 @@ var WebsyTable = /*#__PURE__*/function () {
4744
4758
  allowClear: false,
4745
4759
  disableSearch: true,
4746
4760
  onItemSelected: function onItemSelected(selectedItem) {
4747
- if (_this29.options.onChangePageSize) {
4748
- _this29.options.onChangePageSize(selectedItem.value);
4761
+ if (_this28.options.onChangePageSize) {
4762
+ _this28.options.onChangePageSize(selectedItem.value);
4749
4763
  }
4750
4764
  }
4751
4765
  });
@@ -4766,7 +4780,7 @@ var WebsyTable = /*#__PURE__*/function () {
4766
4780
  _createClass(WebsyTable, [{
4767
4781
  key: "appendRows",
4768
4782
  value: function appendRows(data) {
4769
- var _this30 = this;
4783
+ var _this29 = this;
4770
4784
 
4771
4785
  this.hideError();
4772
4786
  var bodyHTML = '';
@@ -4774,15 +4788,15 @@ var WebsyTable = /*#__PURE__*/function () {
4774
4788
  if (data) {
4775
4789
  bodyHTML += data.map(function (r, rowIndex) {
4776
4790
  return '<tr>' + r.map(function (c, i) {
4777
- if (_this30.options.columns[i].show !== false) {
4791
+ if (_this29.options.columns[i].show !== false) {
4778
4792
  var style = '';
4779
4793
 
4780
4794
  if (c.style) {
4781
4795
  style += c.style;
4782
4796
  }
4783
4797
 
4784
- if (_this30.options.columns[i].width) {
4785
- style += "width: ".concat(_this30.options.columns[i].width, "; ");
4798
+ if (_this29.options.columns[i].width) {
4799
+ style += "width: ".concat(_this29.options.columns[i].width, "; ");
4786
4800
  }
4787
4801
 
4788
4802
  if (c.backgroundColor) {
@@ -4797,18 +4811,18 @@ var WebsyTable = /*#__PURE__*/function () {
4797
4811
  style += "color: ".concat(c.color, "; ");
4798
4812
  }
4799
4813
 
4800
- if (_this30.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4801
- return "\n <td \n data-row-index='".concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.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(_this30.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4802
- } else if ((_this30.options.columns[i].showAsNavigatorLink === true || _this30.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4803
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this30.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</td>\n ");
4814
+ if (_this29.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4815
+ return "\n <td \n data-row-index='".concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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(_this29.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4816
+ } else if ((_this29.options.columns[i].showAsNavigatorLink === true || _this29.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4817
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this29.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</td>\n ");
4804
4818
  } else {
4805
4819
  var info = c.value;
4806
4820
 
4807
- if (_this30.options.columns[i].showAsImage === true) {
4821
+ if (_this29.options.columns[i].showAsImage === true) {
4808
4822
  c.value = "\n <img src='".concat(c.value, "'>\n ");
4809
4823
  }
4810
4824
 
4811
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.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 ");
4825
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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 ");
4812
4826
  }
4813
4827
  }
4814
4828
  }).join('') + '</tr>';
@@ -4980,7 +4994,7 @@ var WebsyTable = /*#__PURE__*/function () {
4980
4994
  }, {
4981
4995
  key: "render",
4982
4996
  value: function render(data) {
4983
- var _this31 = this;
4997
+ var _this30 = this;
4984
4998
 
4985
4999
  if (!this.options.columns) {
4986
5000
  return;
@@ -5005,7 +5019,17 @@ var WebsyTable = /*#__PURE__*/function () {
5005
5019
 
5006
5020
  var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
5007
5021
  if (c.show !== false) {
5008
- return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ? _this31.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5022
+ var style = '';
5023
+
5024
+ if (c.style) {
5025
+ style += c.style;
5026
+ }
5027
+
5028
+ if (c.width) {
5029
+ style += "width: ".concat(c.width || 'auto', ";");
5030
+ }
5031
+
5032
+ 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 ? _this30.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5009
5033
  }
5010
5034
  }).join('') + '</tr>';
5011
5035
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5024,7 +5048,7 @@ var WebsyTable = /*#__PURE__*/function () {
5024
5048
 
5025
5049
  if (pagingEl) {
5026
5050
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5027
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5051
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5028
5052
  });
5029
5053
  var startIndex = 0;
5030
5054
 
@@ -5092,7 +5116,7 @@ var WebsyTable = /*#__PURE__*/function () {
5092
5116
 
5093
5117
  var WebsyTable2 = /*#__PURE__*/function () {
5094
5118
  function WebsyTable2(elementId, options) {
5095
- var _this32 = this;
5119
+ var _this31 = this;
5096
5120
 
5097
5121
  _classCallCheck(this, WebsyTable2);
5098
5122
 
@@ -5133,8 +5157,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5133
5157
  allowClear: false,
5134
5158
  disableSearch: true,
5135
5159
  onItemSelected: function onItemSelected(selectedItem) {
5136
- if (_this32.options.onChangePageSize) {
5137
- _this32.options.onChangePageSize(selectedItem.value);
5160
+ if (_this31.options.onChangePageSize) {
5161
+ _this31.options.onChangePageSize(selectedItem.value);
5138
5162
  }
5139
5163
  }
5140
5164
  });
@@ -5158,7 +5182,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5158
5182
  _createClass(WebsyTable2, [{
5159
5183
  key: "appendRows",
5160
5184
  value: function appendRows(data) {
5161
- var _this33 = this;
5185
+ var _this32 = this;
5162
5186
 
5163
5187
  this.hideError();
5164
5188
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -5167,15 +5191,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
5167
5191
  if (data) {
5168
5192
  bodyHTML += data.map(function (r, rowIndex) {
5169
5193
  return '<tr>' + r.map(function (c, i) {
5170
- if (_this33.options.columns[i].show !== false) {
5171
- var style = "height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px;");
5194
+ if (_this32.options.columns[i].show !== false) {
5195
+ var style = "height: ".concat(_this32.options.cellSize, "px; line-height: ").concat(_this32.options.cellSize, "px;");
5172
5196
 
5173
5197
  if (c.style) {
5174
5198
  style += c.style;
5175
5199
  }
5176
5200
 
5177
- if (_this33.options.columns[i].width) {
5178
- style += "width: ".concat(_this33.options.columns[i].width, "; ");
5201
+ if (_this32.options.columns[i].width) {
5202
+ style += "width: ".concat(_this32.options.columns[i].width, "; ");
5179
5203
  }
5180
5204
 
5181
5205
  if (c.backgroundColor) {
@@ -5190,18 +5214,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
5190
5214
  style += "color: ".concat(c.color, "; ");
5191
5215
  }
5192
5216
 
5193
- if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5194
- return "\n <td \n data-row-index='".concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.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(_this33.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5195
- } else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5196
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this33.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</td>\n ");
5217
+ if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5218
+ return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.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(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5219
+ } else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5220
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
5197
5221
  } else {
5198
5222
  var info = c.value;
5199
5223
 
5200
- if (_this33.options.columns[i].showAsImage === true) {
5224
+ if (_this32.options.columns[i].showAsImage === true) {
5201
5225
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5202
5226
  }
5203
5227
 
5204
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.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 ");
5228
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.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 ");
5205
5229
  }
5206
5230
  }
5207
5231
  }).join('') + '</tr>';
@@ -5464,7 +5488,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5464
5488
  }, {
5465
5489
  key: "render",
5466
5490
  value: function render(data) {
5467
- var _this34 = this;
5491
+ var _this33 = this;
5468
5492
 
5469
5493
  if (!this.options.columns) {
5470
5494
  return;
@@ -5500,7 +5524,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5500
5524
  style += "width: ".concat(c.width || 'auto', "; ");
5501
5525
  }
5502
5526
 
5503
- 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 ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5527
+ 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 ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5504
5528
  }
5505
5529
  }).join('') + '</tr>';
5506
5530
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5511,7 +5535,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5511
5535
  var dropdownHTML = "";
5512
5536
  this.options.columns.forEach(function (c, i) {
5513
5537
  if (c.searchable && c.searchField) {
5514
- dropdownHTML += "\n <div id=\"".concat(_this34.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
5538
+ dropdownHTML += "\n <div id=\"".concat(_this33.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
5515
5539
  }
5516
5540
  });
5517
5541
  dropdownEl.innerHTML = dropdownHTML;
@@ -5533,7 +5557,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5533
5557
 
5534
5558
  if (pagingEl) {
5535
5559
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5536
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5560
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5537
5561
  });
5538
5562
  var startIndex = 0;
5539
5563
 
@@ -5624,7 +5648,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5624
5648
  }, {
5625
5649
  key: "getColumnParameters",
5626
5650
  value: function getColumnParameters(values) {
5627
- var _this35 = this;
5651
+ var _this34 = this;
5628
5652
 
5629
5653
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
5630
5654
  tableEl.style.tableLayout = 'auto';
@@ -5632,10 +5656,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
5632
5656
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
5633
5657
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5634
5658
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
5635
- 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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5659
+ 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 ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5636
5660
  }).join('') + '</tr>';
5637
5661
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
5638
- return "\n <td \n style='height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
5662
+ return "\n <td \n style='height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
5639
5663
  }).join('') + '</tr>'; // get height of the first data cell
5640
5664
 
5641
5665
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -5693,7 +5717,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
5693
5717
  showTotalsAbove: true,
5694
5718
  minHandleSize: 20,
5695
5719
  maxColWidth: '50%',
5696
- allowPivoting: false
5720
+ allowPivoting: false,
5721
+ searchIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>"
5697
5722
  };
5698
5723
  this.options = _extends({}, DEFAULTS, options);
5699
5724
  this.sizes = {};
@@ -5781,7 +5806,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
5781
5806
  data.forEach(function (row) {
5782
5807
  bodyHtml += "<tr class=\"websy-table-row\">";
5783
5808
  row.forEach(function (cell, cellIndex) {
5784
- bodyHtml += "<td \n class='websy-table-cell'\n style='".concat(cell.style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n "); // if (useWidths === true) {
5809
+ var style = '';
5810
+
5811
+ if (cell.style) {
5812
+ style += cell.style;
5813
+ }
5814
+
5815
+ if (cell.backgroundColor) {
5816
+ style += "background-color: ".concat(cell.backgroundColor, "; ");
5817
+
5818
+ if (!cell.color) {
5819
+ style += "color: ".concat(WebsyDesigns.Utils.getLightDark(cell.backgroundColor), "; ");
5820
+ }
5821
+ }
5822
+
5823
+ if (cell.color) {
5824
+ style += "color: ".concat(cell.color, "; ");
5825
+ }
5826
+
5827
+ bodyHtml += "<td \n class='websy-table-cell'\n style='".concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n "); // if (useWidths === true) {
5785
5828
  // bodyHtml += `
5786
5829
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
5787
5830
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -5798,7 +5841,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
5798
5841
  }, {
5799
5842
  key: "buildHeaderHtml",
5800
5843
  value: function buildHeaderHtml() {
5801
- var _this36 = this;
5844
+ var _this35 = this;
5802
5845
 
5803
5846
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5804
5847
  var headerHtml = '';
@@ -5813,13 +5856,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
5813
5856
  }
5814
5857
 
5815
5858
  this.options.columns.forEach(function (row, rowIndex) {
5816
- if (useWidths === false && rowIndex !== _this36.options.columns.length - 1) {
5859
+ if (useWidths === false && rowIndex !== _this35.options.columns.length - 1) {
5817
5860
  // if we're calculating the size we only want to render the last row of column headers
5818
5861
  return;
5819
5862
  }
5820
5863
 
5821
5864
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
5822
- row.forEach(function (col) {
5865
+ row.forEach(function (col, colIndex) {
5823
5866
  headerHtml += "<td \n class='websy-table-cell' \n style='".concat(col.style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
5824
5867
  // headerHtml += `
5825
5868
  // style='width: ${col.width || col.actualWidth}px'
@@ -5827,16 +5870,34 @@ var WebsyTable3 = /*#__PURE__*/function () {
5827
5870
  // `
5828
5871
  // }
5829
5872
 
5830
- headerHtml += " \n >\n ".concat(col.name, "\n </td>");
5873
+ headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this35.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
5831
5874
  });
5832
5875
  headerHtml += "</tr>";
5833
5876
  });
5877
+ var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
5878
+ this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
5879
+ if (c.searchable && c.isExternalSearch === true) {
5880
+ var testEl = document.getElementById("".concat(_this35.elementId, "_columnSearch_").concat(c.dimId || i));
5881
+
5882
+ if (!testEl) {
5883
+ var newE = document.createElement('div');
5884
+ newE.id = "".concat(_this35.elementId, "_columnSearch_").concat(c.dimId || i);
5885
+ newE.className = 'websy-modal-dropdown';
5886
+ dropdownEl.appendChild(newE);
5887
+ }
5888
+ }
5889
+ });
5834
5890
  return headerHtml;
5835
5891
  }
5892
+ }, {
5893
+ key: "buildSearchIcon",
5894
+ value: function buildSearchIcon(col, index) {
5895
+ return "\n <div class=\"websy-table-search-icon\" data-col-id=\"".concat(col.dimId, "\" data-col-index=\"").concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>\n ");
5896
+ }
5836
5897
  }, {
5837
5898
  key: "buildTotalHtml",
5838
5899
  value: function buildTotalHtml() {
5839
- var _this37 = this;
5900
+ var _this36 = this;
5840
5901
 
5841
5902
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5842
5903
 
@@ -5849,7 +5910,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
5849
5910
  totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
5850
5911
 
5851
5912
  if (useWidths === true) {
5852
- totalHtml += "\n style='width: ".concat(_this37.options.columns[_this37.options.columns.length - 1][colIndex].width || _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
5913
+ totalHtml += "\n style='width: ".concat(_this36.options.columns[_this36.options.columns.length - 1][colIndex].width || _this36.options.columns[_this36.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
5853
5914
  }
5854
5915
 
5855
5916
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
@@ -5860,7 +5921,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
5860
5921
  }, {
5861
5922
  key: "calculateSizes",
5862
5923
  value: function calculateSizes() {
5863
- var _this38 = this;
5924
+ var _this37 = this;
5864
5925
 
5865
5926
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5866
5927
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
@@ -5902,21 +5963,21 @@ var WebsyTable3 = /*#__PURE__*/function () {
5902
5963
  rows.forEach(function (row, rowIndex) {
5903
5964
  Array.from(row.children).forEach(function (col, colIndex) {
5904
5965
  var colSize = col.getBoundingClientRect();
5905
- _this38.sizes.cellHeight = colSize.height;
5966
+ _this37.sizes.cellHeight = colSize.height;
5906
5967
 
5907
- if (_this38.options.columns[_this38.options.columns.length - 1][colIndex]) {
5908
- if (!_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth) {
5909
- _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth = 0;
5968
+ if (_this37.options.columns[_this37.options.columns.length - 1][colIndex]) {
5969
+ if (!_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth) {
5970
+ _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth = 0;
5910
5971
  }
5911
5972
 
5912
- _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
5913
- _this38.options.columns[_this38.options.columns.length - 1][colIndex].cellHeight = colSize.height;
5973
+ _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
5974
+ _this37.options.columns[_this37.options.columns.length - 1][colIndex].cellHeight = colSize.height;
5914
5975
  }
5915
5976
  });
5916
5977
  });
5917
5978
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
5918
- if (colIndex < _this38.pinnedColumns) {
5919
- _this38.sizes.scrollableWidth -= col.actualWidth;
5979
+ if (colIndex < _this37.pinnedColumns) {
5980
+ _this37.sizes.scrollableWidth -= col.actualWidth;
5920
5981
  }
5921
5982
  });
5922
5983
  this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
@@ -5935,8 +5996,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
5935
5996
  }
5936
5997
  }
5937
5998
 
5938
- _this38.sizes.totalWidth += c.width || c.actualWidth;
5939
- equalWidth = (outerSize.width - _this38.sizes.totalWidth) / (_this38.options.columns[_this38.options.columns.length - 1].length - (i + 1));
5999
+ _this37.sizes.totalWidth += c.width || c.actualWidth;
6000
+ equalWidth = (outerSize.width - _this37.sizes.totalWidth) / (_this37.options.columns[_this37.options.columns.length - 1].length - (i + 1));
5940
6001
  });
5941
6002
  } // take the height of the last cell as the official height for data cells
5942
6003
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
@@ -6000,7 +6061,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
6000
6061
  }
6001
6062
  }, {
6002
6063
  key: "handleClick",
6003
- value: function handleClick(event) {}
6064
+ value: function handleClick(event) {
6065
+ if (event.target.classList.contains('websy-table-search-icon')) {
6066
+ console.log('clicked on search icon');
6067
+ var colIndex = +event.target.getAttribute('data-col-index');
6068
+
6069
+ if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
6070
+ this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex]);
6071
+ }
6072
+ }
6073
+ }
6004
6074
  }, {
6005
6075
  key: "handleMouseDown",
6006
6076
  value: function handleMouseDown(event) {
@@ -6124,20 +6194,26 @@ var WebsyTable3 = /*#__PURE__*/function () {
6124
6194
 
6125
6195
  if (this.options.virtualScroll === true) {
6126
6196
  // set the scroll element positions
6197
+ var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
6198
+ var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6199
+
6127
6200
  if (this.vScrollRequired === true) {
6128
- var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
6129
- var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6130
6201
  vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
6131
6202
  vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
6132
6203
  vHandleEl.style.height = Math.max(this.options.minHandleSize, this.sizes.bodyHeight * (this.sizes.rowsToRenderPrecise / this.totalRowCount)) + 'px';
6204
+ } else {
6205
+ vHandleEl.style.height = '0px';
6133
6206
  }
6134
6207
 
6208
+ var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6209
+ var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6210
+
6135
6211
  if (this.hScrollRequired === true) {
6136
- var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6137
- var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6138
6212
  hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
6139
6213
  hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - 20, "px");
6140
6214
  hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalWidth)) + 'px';
6215
+ } else {
6216
+ hHandleEl.style.height = '0px';
6141
6217
  }
6142
6218
  }
6143
6219
  }
@@ -6227,7 +6303,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6227
6303
 
6228
6304
  for (var i = 0; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
6229
6305
  cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
6230
- console.log(actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
6306
+ console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
6231
6307
 
6232
6308
  if (actualLeft < cumulativeWidth) {
6233
6309
  this.startCol = i;
@@ -6312,7 +6388,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6312
6388
 
6313
6389
  var WebsyChart = /*#__PURE__*/function () {
6314
6390
  function WebsyChart(elementId, options) {
6315
- var _this39 = this;
6391
+ var _this38 = this;
6316
6392
 
6317
6393
  _classCallCheck(this, WebsyChart);
6318
6394
 
@@ -6361,22 +6437,22 @@ var WebsyChart = /*#__PURE__*/function () {
6361
6437
  this.invertOverride = function (input, input2) {
6362
6438
  var xAxis = 'bottomAxis';
6363
6439
 
6364
- if (_this39.options.orientation === 'horizontal') {
6440
+ if (_this38.options.orientation === 'horizontal') {
6365
6441
  xAxis = 'leftAxis';
6366
6442
  }
6367
6443
 
6368
- var width = _this39[xAxis].step();
6444
+ var width = _this38[xAxis].step();
6369
6445
 
6370
6446
  var output;
6371
6447
 
6372
- var domain = _toConsumableArray(_this39[xAxis].domain());
6448
+ var domain = _toConsumableArray(_this38[xAxis].domain());
6373
6449
 
6374
- if (_this39.options.orientation === 'horizontal') {
6450
+ if (_this38.options.orientation === 'horizontal') {
6375
6451
  domain = domain.reverse();
6376
6452
  }
6377
6453
 
6378
6454
  for (var j = 0; j < domain.length; j++) {
6379
- var breakA = _this39[xAxis](domain[j]) - width / 2;
6455
+ var breakA = _this38[xAxis](domain[j]) - width / 2;
6380
6456
  var breakB = breakA + width;
6381
6457
 
6382
6458
  if (input > breakA && input <= breakB) {
@@ -6476,10 +6552,10 @@ var WebsyChart = /*#__PURE__*/function () {
6476
6552
  }, {
6477
6553
  key: "handleEventMouseMove",
6478
6554
  value: function handleEventMouseMove(event, d) {
6479
- var _this40 = this;
6555
+ var _this39 = this;
6480
6556
 
6481
6557
  var bisectDate = d3.bisector(function (d) {
6482
- return _this40.parseX(d.x.value);
6558
+ return _this39.parseX(d.x.value);
6483
6559
  }).left;
6484
6560
 
6485
6561
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -6518,8 +6594,8 @@ var WebsyChart = /*#__PURE__*/function () {
6518
6594
  }
6519
6595
 
6520
6596
  this.options.data.series.forEach(function (s) {
6521
- if (_this40.options.data[xData].scale !== 'Time') {
6522
- xPoint = _this40[xAxis](_this40.parseX(xLabel));
6597
+ if (_this39.options.data[xData].scale !== 'Time') {
6598
+ xPoint = _this39[xAxis](_this39.parseX(xLabel));
6523
6599
  s.data.forEach(function (d) {
6524
6600
  if (d.x.value === xLabel) {
6525
6601
  if (!tooltipTitle) {
@@ -6538,13 +6614,13 @@ var WebsyChart = /*#__PURE__*/function () {
6538
6614
  var pointA = s.data[index - 1];
6539
6615
  var pointB = s.data[index];
6540
6616
 
6541
- if (_this40.options.orientation === 'horizontal') {
6617
+ if (_this39.options.orientation === 'horizontal') {
6542
6618
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
6543
6619
  pointB = _toConsumableArray(s.data).reverse()[index];
6544
6620
  }
6545
6621
 
6546
6622
  if (pointA && !pointB) {
6547
- xPoint = _this40[xAxis](_this40.parseX(pointA.x.value));
6623
+ xPoint = _this39[xAxis](_this39.parseX(pointA.x.value));
6548
6624
  tooltipTitle = pointA.x.value;
6549
6625
 
6550
6626
  if (!pointA.y.color) {
@@ -6554,12 +6630,12 @@ var WebsyChart = /*#__PURE__*/function () {
6554
6630
  tooltipData.push(pointA.y);
6555
6631
 
6556
6632
  if (typeof pointA.x.value.getTime !== 'undefined') {
6557
- tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointA.x.value);
6633
+ tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointA.x.value);
6558
6634
  }
6559
6635
  }
6560
6636
 
6561
6637
  if (pointB && !pointA) {
6562
- xPoint = _this40[xAxis](_this40.parseX(pointB.x.value));
6638
+ xPoint = _this39[xAxis](_this39.parseX(pointB.x.value));
6563
6639
  tooltipTitle = pointB.x.value;
6564
6640
 
6565
6641
  if (!pointB.y.color) {
@@ -6569,14 +6645,14 @@ var WebsyChart = /*#__PURE__*/function () {
6569
6645
  tooltipData.push(pointB.y);
6570
6646
 
6571
6647
  if (typeof pointB.x.value.getTime !== 'undefined') {
6572
- tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
6648
+ tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointB.x.value);
6573
6649
  }
6574
6650
  }
6575
6651
 
6576
6652
  if (pointA && pointB) {
6577
- var d0 = _this40[xAxis](_this40.parseX(pointA.x.value));
6653
+ var d0 = _this39[xAxis](_this39.parseX(pointA.x.value));
6578
6654
 
6579
- var d1 = _this40[xAxis](_this40.parseX(pointB.x.value));
6655
+ var d1 = _this39[xAxis](_this39.parseX(pointB.x.value));
6580
6656
 
6581
6657
  var mid = Math.abs(d0 - d1) / 2;
6582
6658
 
@@ -6585,7 +6661,7 @@ var WebsyChart = /*#__PURE__*/function () {
6585
6661
  tooltipTitle = pointB.x.value;
6586
6662
 
6587
6663
  if (typeof pointB.x.value.getTime !== 'undefined') {
6588
- tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
6664
+ tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointB.x.value);
6589
6665
  }
6590
6666
 
6591
6667
  if (!pointB.y.color) {
@@ -6598,7 +6674,7 @@ var WebsyChart = /*#__PURE__*/function () {
6598
6674
  tooltipTitle = pointA.x.value;
6599
6675
 
6600
6676
  if (typeof pointB.x.value.getTime !== 'undefined') {
6601
- tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
6677
+ tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointB.x.value);
6602
6678
  }
6603
6679
 
6604
6680
  if (!pointA.y.color) {
@@ -6703,7 +6779,7 @@ var WebsyChart = /*#__PURE__*/function () {
6703
6779
  }, {
6704
6780
  key: "render",
6705
6781
  value: function render(options) {
6706
- var _this41 = this;
6782
+ var _this40 = this;
6707
6783
 
6708
6784
  /* global d3 options WebsyUtils */
6709
6785
  if (typeof options !== 'undefined') {
@@ -6772,7 +6848,7 @@ var WebsyChart = /*#__PURE__*/function () {
6772
6848
  var legendData = this.options.data.series.map(function (s, i) {
6773
6849
  return {
6774
6850
  value: s.label || s.key,
6775
- color: s.color || _this41.options.colors[i % _this41.options.colors.length]
6851
+ color: s.color || _this40.options.colors[i % _this40.options.colors.length]
6776
6852
  };
6777
6853
  });
6778
6854
 
@@ -7024,7 +7100,7 @@ var WebsyChart = /*#__PURE__*/function () {
7024
7100
 
7025
7101
  if (this.options.data.bottom.formatter) {
7026
7102
  bAxisFunc.tickFormat(function (d) {
7027
- return _this41.options.data.bottom.formatter(d);
7103
+ return _this40.options.data.bottom.formatter(d);
7028
7104
  });
7029
7105
  }
7030
7106
 
@@ -7050,8 +7126,8 @@ var WebsyChart = /*#__PURE__*/function () {
7050
7126
 
7051
7127
  if (this.options.margin.axisLeft > 0) {
7052
7128
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
7053
- if (_this41.options.data.left.formatter) {
7054
- d = _this41.options.data.left.formatter(d);
7129
+ if (_this40.options.data.left.formatter) {
7130
+ d = _this40.options.data.left.formatter(d);
7055
7131
  }
7056
7132
 
7057
7133
  return d;
@@ -7088,8 +7164,8 @@ var WebsyChart = /*#__PURE__*/function () {
7088
7164
 
7089
7165
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
7090
7166
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
7091
- if (_this41.options.data.right.formatter) {
7092
- d = _this41.options.data.right.formatter(d);
7167
+ if (_this40.options.data.right.formatter) {
7168
+ d = _this40.options.data.right.formatter(d);
7093
7169
  }
7094
7170
 
7095
7171
  return d;
@@ -7115,16 +7191,16 @@ var WebsyChart = /*#__PURE__*/function () {
7115
7191
 
7116
7192
  this.options.data.series.forEach(function (series, index) {
7117
7193
  if (!series.key) {
7118
- series.key = _this41.createIdentity();
7194
+ series.key = _this40.createIdentity();
7119
7195
  }
7120
7196
 
7121
7197
  if (!series.color) {
7122
- series.color = _this41.options.colors[index % _this41.options.colors.length];
7198
+ series.color = _this40.options.colors[index % _this40.options.colors.length];
7123
7199
  }
7124
7200
 
7125
- _this41["render".concat(series.type || 'bar')](series, index);
7201
+ _this40["render".concat(series.type || 'bar')](series, index);
7126
7202
 
7127
- _this41.renderLabels(series, index);
7203
+ _this40.renderLabels(series, index);
7128
7204
  });
7129
7205
  }
7130
7206
  }
@@ -7132,17 +7208,17 @@ var WebsyChart = /*#__PURE__*/function () {
7132
7208
  }, {
7133
7209
  key: "renderarea",
7134
7210
  value: function renderarea(series, index) {
7135
- var _this42 = this;
7211
+ var _this41 = this;
7136
7212
 
7137
7213
  /* global d3 series index */
7138
7214
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
7139
7215
  return d3.area().x(function (d) {
7140
- return _this42[xAxis](_this42.parseX(d.x.value));
7216
+ return _this41[xAxis](_this41.parseX(d.x.value));
7141
7217
  }).y0(function (d) {
7142
- return _this42[yAxis](0);
7218
+ return _this41[yAxis](0);
7143
7219
  }).y1(function (d) {
7144
- return _this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7145
- }).curve(d3[curveStyle || _this42.options.curveStyle]);
7220
+ return _this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7221
+ }).curve(d3[curveStyle || _this41.options.curveStyle]);
7146
7222
  };
7147
7223
 
7148
7224
  var xAxis = 'bottomAxis';
@@ -7258,7 +7334,7 @@ var WebsyChart = /*#__PURE__*/function () {
7258
7334
  }, {
7259
7335
  key: "renderLabels",
7260
7336
  value: function renderLabels(series, index) {
7261
- var _this43 = this;
7337
+ var _this42 = this;
7262
7338
 
7263
7339
  /* global series index d3 WebsyDesigns */
7264
7340
  var xAxis = 'bottomAxis';
@@ -7277,12 +7353,12 @@ var WebsyChart = /*#__PURE__*/function () {
7277
7353
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
7278
7354
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
7279
7355
  labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', function (d) {
7280
- return _this43.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
7356
+ return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
7281
7357
  }).transition(this.transition).text(function (d) {
7282
7358
  return d.y.label || d.y.value;
7283
7359
  });
7284
7360
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', function (d) {
7285
- return _this43.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
7361
+ return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
7286
7362
  }).text(function (d) {
7287
7363
  return d.y.label || d.y.value;
7288
7364
  }).each(function (d, i) {
@@ -7327,15 +7403,15 @@ var WebsyChart = /*#__PURE__*/function () {
7327
7403
  }, {
7328
7404
  key: "renderline",
7329
7405
  value: function renderline(series, index) {
7330
- var _this44 = this;
7406
+ var _this43 = this;
7331
7407
 
7332
7408
  /* global series index d3 */
7333
7409
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
7334
7410
  return d3.line().x(function (d) {
7335
- return _this44[xAxis](_this44.parseX(d.x.value));
7411
+ return _this43[xAxis](_this43.parseX(d.x.value));
7336
7412
  }).y(function (d) {
7337
- return _this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7338
- }).curve(d3[curveStyle || _this44.options.curveStyle]);
7413
+ return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7414
+ }).curve(d3[curveStyle || _this43.options.curveStyle]);
7339
7415
  };
7340
7416
 
7341
7417
  var xAxis = 'bottomAxis';
@@ -7373,14 +7449,14 @@ var WebsyChart = /*#__PURE__*/function () {
7373
7449
  }, {
7374
7450
  key: "rendersymbol",
7375
7451
  value: function rendersymbol(series, index) {
7376
- var _this45 = this;
7452
+ var _this44 = this;
7377
7453
 
7378
7454
  /* global d3 series index series.key */
7379
7455
  var drawSymbol = function drawSymbol(size) {
7380
7456
  return d3.symbol() // .type(d => {
7381
7457
  // return d3.symbols[0]
7382
7458
  // })
7383
- .size(size || _this45.options.symbolSize);
7459
+ .size(size || _this44.options.symbolSize);
7384
7460
  };
7385
7461
 
7386
7462
  var xAxis = 'bottomAxis';
@@ -7398,7 +7474,7 @@ var WebsyChart = /*#__PURE__*/function () {
7398
7474
  symbols.attr('d', function (d) {
7399
7475
  return drawSymbol(d.y.size || series.symbolSize)(d);
7400
7476
  }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
7401
- return "translate(".concat(_this45[xAxis](_this45.parseX(d.x.value)), ", ").concat(_this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
7477
+ return "translate(".concat(_this44[xAxis](_this44.parseX(d.x.value)), ", ").concat(_this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
7402
7478
  }); // Enter
7403
7479
 
7404
7480
  symbols.enter().append('path').attr('d', function (d) {
@@ -7407,7 +7483,7 @@ var WebsyChart = /*#__PURE__*/function () {
7407
7483
  .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
7408
7484
  return "symbol symbol_".concat(series.key);
7409
7485
  }).attr('transform', function (d) {
7410
- return "translate(".concat(_this45[xAxis](_this45.parseX(d.x.value)), ", ").concat(_this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
7486
+ return "translate(".concat(_this44[xAxis](_this44.parseX(d.x.value)), ", ").concat(_this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
7411
7487
  });
7412
7488
  }
7413
7489
  }, {
@@ -7562,7 +7638,7 @@ var WebsyLegend = /*#__PURE__*/function () {
7562
7638
  }, {
7563
7639
  key: "resize",
7564
7640
  value: function resize() {
7565
- var _this46 = this;
7641
+ var _this45 = this;
7566
7642
 
7567
7643
  var el = document.getElementById(this.elementId);
7568
7644
 
@@ -7575,7 +7651,7 @@ var WebsyLegend = /*#__PURE__*/function () {
7575
7651
  // }
7576
7652
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
7577
7653
  html += this._data.map(function (d, i) {
7578
- return _this46.getLegendItemHTML(d);
7654
+ return _this45.getLegendItemHTML(d);
7579
7655
  }).join('');
7580
7656
  html += "\n <div>\n ";
7581
7657
  el.innerHTML = html;
@@ -7747,7 +7823,7 @@ var WebsyMap = /*#__PURE__*/function () {
7747
7823
  }, {
7748
7824
  key: "render",
7749
7825
  value: function render() {
7750
- var _this47 = this;
7826
+ var _this46 = this;
7751
7827
 
7752
7828
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
7753
7829
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -7756,7 +7832,7 @@ var WebsyMap = /*#__PURE__*/function () {
7756
7832
  var legendData = this.options.data.polygons.map(function (s, i) {
7757
7833
  return {
7758
7834
  value: s.label || s.key,
7759
- color: s.color || _this47.options.colors[i % _this47.options.colors.length]
7835
+ color: s.color || _this46.options.colors[i % _this46.options.colors.length]
7760
7836
  };
7761
7837
  });
7762
7838
  var longestValue = legendData.map(function (s) {
@@ -7820,7 +7896,7 @@ var WebsyMap = /*#__PURE__*/function () {
7820
7896
 
7821
7897
  if (this.polygons) {
7822
7898
  this.polygons.forEach(function (p) {
7823
- return _this47.map.removeLayer(p);
7899
+ return _this46.map.removeLayer(p);
7824
7900
  });
7825
7901
  }
7826
7902
 
@@ -7878,18 +7954,18 @@ var WebsyMap = /*#__PURE__*/function () {
7878
7954
  }
7879
7955
 
7880
7956
  if (!p.options.color) {
7881
- p.options.color = _this47.options.colors[i % _this47.options.colors.length];
7957
+ p.options.color = _this46.options.colors[i % _this46.options.colors.length];
7882
7958
  }
7883
7959
 
7884
7960
  var pol = L.polygon(p.data.map(function (c) {
7885
7961
  return c.map(function (d) {
7886
7962
  return [d.Latitude, d.Longitude];
7887
7963
  });
7888
- }), p.options).addTo(_this47.map);
7964
+ }), p.options).addTo(_this46.map);
7889
7965
 
7890
- _this47.polygons.push(pol);
7966
+ _this46.polygons.push(pol);
7891
7967
 
7892
- _this47.map.fitBounds(pol.getBounds());
7968
+ _this46.map.fitBounds(pol.getBounds());
7893
7969
  });
7894
7970
  } // if (this.data.markers.length > 0) {
7895
7971
  // el.classList.remove('hidden')