@websy/websy-designs 1.9.13 → 1.10.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.
@@ -84,6 +84,12 @@ var APIService = /*#__PURE__*/function () {
84
84
  var url = this.buildUrl(entity, id);
85
85
  return this.run('DELETE', url);
86
86
  }
87
+ }, {
88
+ key: "deleteMany",
89
+ value: function deleteMany(entity, query) {
90
+ var url = this.buildUrl(entity, null, query);
91
+ return this.run('DELETE', url);
92
+ }
87
93
  }, {
88
94
  key: "get",
89
95
  value: function get(entity, id, query, offset, limit) {
@@ -95,11 +101,11 @@ var APIService = /*#__PURE__*/function () {
95
101
  url += "?offset=".concat(offset);
96
102
  }
97
103
  }
98
- if (limit) {
104
+ if (limit || this.options.rowLimit) {
99
105
  if (url.indexOf('?') !== -1) {
100
- url += "&limit=".concat(limit);
106
+ url += "&limit=".concat(limit || this.options.rowLimit);
101
107
  } else {
102
- url += "?limit=".concat(limit);
108
+ url += "?limit=".concat(limit || this.options.rowLimit);
103
109
  }
104
110
  }
105
111
  return this.run('GET', url);
@@ -232,16 +238,52 @@ var ButtonGroup = /*#__PURE__*/function () {
232
238
  }
233
239
  }
234
240
  _createClass(ButtonGroup, [{
241
+ key: "value",
242
+ get: function get() {
243
+ if (this.options.activeItem > -1) {
244
+ return [this.options.items[this.options.activeItem]];
245
+ } else if (this.options.multiSelect === true) {
246
+ return this.options.items.filter(function (d) {
247
+ return d.selected;
248
+ });
249
+ }
250
+ return [];
251
+ },
252
+ set: function set(value) {
253
+ var activeIndex = -1;
254
+ if (this.options.multiSelect === true) {
255
+ if (Array.isArray(value)) {
256
+ this.options.items.forEach(function (d) {
257
+ if (value.indexOf(d.value) !== -1) {
258
+ d.selected = true;
259
+ } else {
260
+ d.selected = false;
261
+ }
262
+ });
263
+ }
264
+ } else {
265
+ for (var i = 0; i < this.options.items.length; i++) {
266
+ if ((this.options.items[i].value || this.options.items[i].label) === value) {
267
+ activeIndex = i;
268
+ }
269
+ }
270
+ this.options.activeItem = activeIndex;
271
+ }
272
+ this.render();
273
+ }
274
+ }, {
235
275
  key: "handleClick",
236
276
  value: function handleClick(event) {
237
277
  if (event.target.classList.contains('websy-button-group-item')) {
238
278
  var index = +event.target.getAttribute('data-index');
239
279
  if (this.options.multiSelect === true) {
240
280
  if (event.target.classList.contains('active')) {
281
+ this.options.items[index].selected = false;
241
282
  this.options.onDeactivate(this.options.items[index], index, event);
242
283
  event.target.classList.remove('active');
243
284
  event.target.classList.add('inactive');
244
285
  } else {
286
+ this.options.items[index].selected = true;
245
287
  this.options.onActivate(this.options.items[index], index, event);
246
288
  event.target.classList.add('active');
247
289
  event.target.classList.remove('inactive');
@@ -297,6 +339,8 @@ var ButtonGroup = /*#__PURE__*/function () {
297
339
  var activeClass = '';
298
340
  if (_this.options.activeItem !== -1) {
299
341
  activeClass = i === _this.options.activeItem ? 'active' : 'inactive';
342
+ } else if (_this.options.multiSelect === true) {
343
+ activeClass = t.selected === true ? 'active' : 'inactive';
300
344
  }
301
345
  return "\n <".concat(_this.options.tag, " ").concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(activeClass, "\">").concat(t.label, "</").concat(_this.options.tag, ">\n ");
302
346
  }).join('');
@@ -315,7 +359,8 @@ var WebsyCarousel = /*#__PURE__*/function () {
315
359
  showFrameSelector: true,
316
360
  showPrevNext: true,
317
361
  autoPlay: true,
318
- frames: []
362
+ frames: [],
363
+ frameSelectorIcon: "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 512 512\">\n <circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n "
319
364
  };
320
365
  this.playTimeoutFn = null;
321
366
  this.options = _extends({}, DEFAULTS, options);
@@ -427,7 +472,7 @@ var WebsyCarousel = /*#__PURE__*/function () {
427
472
  if (this.options.showFrameSelector === true && this.options.frames.length > 1) {
428
473
  html += "<div class=\"websy-btn-parent\">";
429
474
  this.options.frames.forEach(function (frame, frameIndex) {
430
- html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 512 512\" data-index=\"".concat(frameIndex, "\" id=\"").concat(_this3.elementId, "_selector_").concat(frameIndex, "\" \n class=\"websy-progress-btn ").concat(_this3.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : '', "\">\n <title>Ellipse</title><circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n ");
475
+ html += "\n <div data-index=\"".concat(frameIndex, "\" id=\"").concat(_this3.elementId, "_selector_").concat(frameIndex, "\" \n class=\"websy-progress-btn ").concat(_this3.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : '', "\">\n ").concat(_this3.options.frameSelectorIcon, "\n </div>\n ");
431
476
  });
432
477
  html += "</div>";
433
478
  }
@@ -1560,6 +1605,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
1560
1605
  var contentEl = document.getElementById("".concat(this.elementId, "_content"));
1561
1606
  var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
1562
1607
  var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
1608
+ var headerEl = document.getElementById("".concat(this.elementId, "_header"));
1609
+ var headerPos = WebsyUtils.getElementPos(headerEl);
1610
+ var contentPos = WebsyUtils.getElementPos(contentEl);
1611
+ if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1612
+ contentEl.style.right = 'unset';
1613
+ if (headerPos.bottom + contentPos.height > window.innerHeight) {
1614
+ // contentEl.classList.add('on-top')
1615
+ contentEl.style.bottom = 'unset';
1616
+ } else {
1617
+ contentEl.style.top = 'unset';
1618
+ }
1619
+ }
1563
1620
  if (actionEl) {
1564
1621
  actionEl.classList.remove('active');
1565
1622
  }
@@ -1585,7 +1642,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1585
1642
  return;
1586
1643
  }
1587
1644
  if (event.target.classList.contains('websy-dropdown-header')) {
1588
- this.open();
1645
+ this.open(event);
1589
1646
  } else if (event.target.classList.contains('websy-dropdown-mask')) {
1590
1647
  this.close();
1591
1648
  } else if (event.target.classList.contains('websy-dropdown-item')) {
@@ -1699,18 +1756,28 @@ var WebsyDropdown = /*#__PURE__*/function () {
1699
1756
  }
1700
1757
  }, {
1701
1758
  key: "open",
1702
- value: function open(options) {
1759
+ value: function open(event) {
1703
1760
  var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1704
1761
  var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
1705
1762
  var contentEl = document.getElementById("".concat(this.elementId, "_content"));
1706
- var el = document.getElementById(this.elementId);
1707
- if (el) {
1708
- el.style.zIndex = 999;
1709
- }
1763
+ var headerEl = document.getElementById("".concat(this.elementId, "_header"));
1710
1764
  maskEl.classList.add('active');
1711
1765
  contentEl.classList.add('active');
1712
- if (WebsyUtils.getElementPos(contentEl).bottom > window.innerHeight) {
1713
- contentEl.classList.add('on-top');
1766
+ var headerPos = WebsyUtils.getElementPos(headerEl);
1767
+ var contentPos = WebsyUtils.getElementPos(contentEl);
1768
+ if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1769
+ contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
1770
+ contentEl.style.width = "".concat(headerEl.clientWidth, "px");
1771
+ if (headerPos.bottom + contentPos.height > window.innerHeight) {
1772
+ // contentEl.classList.add('on-top')
1773
+ contentEl.style.bottom = "calc(100vh - ".concat(headerPos.top, "px)");
1774
+ } else {
1775
+ contentEl.style.top = headerPos.bottom + 'px';
1776
+ }
1777
+ } else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
1778
+ var targetPos = WebsyUtils.getElementPos(event.target);
1779
+ contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
1780
+ contentEl.style.width = "".concat(targetPos.width, "px");
1714
1781
  }
1715
1782
  if (this.options.disableSearch !== true) {
1716
1783
  var searchEl = document.getElementById("".concat(this.elementId, "_search"));
@@ -1722,6 +1789,21 @@ var WebsyDropdown = /*#__PURE__*/function () {
1722
1789
  this.options.onOpen(this.elementId);
1723
1790
  }
1724
1791
  }
1792
+ }, {
1793
+ key: "items",
1794
+ set: function set(items) {
1795
+ this.options.items = _toConsumableArray(items);
1796
+ if (this.options.items.length > 0) {
1797
+ this.options.items = this.options.items.map(function (d, i) {
1798
+ if (typeof d.index === 'undefined') {
1799
+ d.index = i;
1800
+ }
1801
+ return d;
1802
+ });
1803
+ }
1804
+ this._originalData = _toConsumableArray(this.options.items);
1805
+ this.render();
1806
+ }
1725
1807
  }, {
1726
1808
  key: "render",
1727
1809
  value: function render() {
@@ -2224,9 +2306,7 @@ var WebsyForm = /*#__PURE__*/function () {
2224
2306
  };
2225
2307
  GlobalPubSub.subscribe('recaptchaready', this.recaptchaReady.bind(this));
2226
2308
  this.recaptchaResult = null;
2227
- this.options = _extends(defaults, {}, {
2228
- // defaults go here
2229
- }, options);
2309
+ this.options = _extends({}, defaults, options);
2230
2310
  if (!elementId) {
2231
2311
  console.log('No element Id provided');
2232
2312
  return;
@@ -2300,23 +2380,41 @@ var WebsyForm = /*#__PURE__*/function () {
2300
2380
  }, {
2301
2381
  key: "data",
2302
2382
  get: function get() {
2383
+ var _this16 = this;
2303
2384
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2304
2385
  var data = {};
2305
2386
  var temp = new FormData(formEl);
2306
2387
  temp.forEach(function (value, key) {
2307
- data[key] = value;
2388
+ if (_this16.fieldMap[key] && _this16.fieldMap[key].type === 'checkbox') {
2389
+ data[key] = true;
2390
+ }
2391
+ if (_this16.fieldMap[key] && _this16.fieldMap[key].instance && _this16.fieldMap[key].instance.value) {
2392
+ data[key] = _this16.fieldMap[key].instance.value;
2393
+ } else {
2394
+ data[key] = value;
2395
+ }
2308
2396
  });
2397
+ var keys = Object.keys(data);
2398
+ for (var key in this.fieldMap) {
2399
+ if (keys.indexOf(key) === -1) {
2400
+ if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
2401
+ data[key] = false;
2402
+ } else if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
2403
+ data[key] = this.fieldMap[key].instance.value;
2404
+ }
2405
+ }
2406
+ }
2309
2407
  return data;
2310
2408
  },
2311
2409
  set: function set(d) {
2312
- var _this16 = this;
2410
+ var _this17 = this;
2313
2411
  if (!this.options.fields) {
2314
2412
  this.options.fields = [];
2315
2413
  }
2316
2414
  var _loop = function _loop(key) {
2317
- _this16.options.fields.forEach(function (f) {
2415
+ _this17.options.fields.forEach(function (f) {
2318
2416
  if (f.field === key) {
2319
- _this16.setValue(key, d[key]);
2417
+ _this17.setValue(key, d[key]);
2320
2418
  // f.value = d[key]
2321
2419
  // const el = document.getElementById(`${this.elementId}_input_${f.field}`)
2322
2420
  // if (el) {
@@ -2375,6 +2473,7 @@ var WebsyForm = /*#__PURE__*/function () {
2375
2473
  value: function handleClick(event) {
2376
2474
  if (event.target.classList.contains('submit')) {
2377
2475
  event.preventDefault();
2476
+ event.stopPropagation();
2378
2477
  this.submitForm();
2379
2478
  } else if (event.target.classList.contains('cancel')) {
2380
2479
  event.preventDefault();
@@ -2516,7 +2615,7 @@ var WebsyForm = /*#__PURE__*/function () {
2516
2615
  }, {
2517
2616
  key: "processComponents",
2518
2617
  value: function processComponents(components, callbackFn) {
2519
- var _this17 = this;
2618
+ var _this18 = this;
2520
2619
  if (components.length === 0) {
2521
2620
  callbackFn();
2522
2621
  } else {
@@ -2525,11 +2624,11 @@ var WebsyForm = /*#__PURE__*/function () {
2525
2624
  if (!c.options.onChange) {
2526
2625
  c.options.onChange = function () {
2527
2626
  if (c.required || c.validate) {
2528
- _this17.validateField(c, c.instance.value);
2627
+ _this18.validateField(c, c.instance.value);
2529
2628
  }
2530
2629
  };
2531
2630
  }
2532
- c.instance = new WebsyDesigns[c.component]("".concat(_this17.elementId, "_input_").concat(c.field, "_component"), c.options);
2631
+ c.instance = new WebsyDesigns[c.component]("".concat(_this18.elementId, "_input_").concat(c.field, "_component"), c.options);
2533
2632
  } else {
2534
2633
  // some user feedback here
2535
2634
  }
@@ -2539,13 +2638,13 @@ var WebsyForm = /*#__PURE__*/function () {
2539
2638
  }, {
2540
2639
  key: "recaptchaReady",
2541
2640
  value: function recaptchaReady() {
2542
- var _this18 = this;
2641
+ var _this19 = this;
2543
2642
  var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
2544
2643
  if (el) {
2545
2644
  grecaptcha.ready(function () {
2546
- grecaptcha.render("".concat(_this18.elementId, "_recaptcha"), {
2645
+ grecaptcha.render("".concat(_this19.elementId, "_recaptcha"), {
2547
2646
  sitekey: ENVIRONMENT.RECAPTCHA_KEY,
2548
- callback: _this18.validateRecaptcha.bind(_this18)
2647
+ callback: _this19.validateRecaptcha.bind(_this19)
2549
2648
  });
2550
2649
  });
2551
2650
  }
@@ -2553,20 +2652,21 @@ var WebsyForm = /*#__PURE__*/function () {
2553
2652
  }, {
2554
2653
  key: "render",
2555
2654
  value: function render(update, data) {
2556
- var _this19 = this;
2655
+ var _this20 = this;
2557
2656
  var el = document.getElementById(this.elementId);
2558
2657
  var componentsToProcess = [];
2559
2658
  if (el) {
2560
2659
  var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
2561
2660
  this.options.fields.forEach(function (f, i) {
2562
- _this19.fieldMap[f.field] = f;
2661
+ _this20.fieldMap[f.field] = f;
2662
+ f.owningElement = _this20.elementId;
2563
2663
  if (f.component) {
2564
2664
  componentsToProcess.push(f);
2565
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.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(_this19.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2665
+ 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 ");
2566
2666
  } else if (f.type === 'longtext') {
2567
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.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(_this19.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(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2667
+ 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 ");
2568
2668
  } else {
2569
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.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(_this19.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(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2669
+ 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 ");
2570
2670
  }
2571
2671
  });
2572
2672
  if (this.options.useRecaptcha === true) {
@@ -2579,8 +2679,8 @@ var WebsyForm = /*#__PURE__*/function () {
2579
2679
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
2580
2680
  el.innerHTML = html;
2581
2681
  this.processComponents(componentsToProcess, function () {
2582
- if (_this19.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2583
- _this19.recaptchaReady();
2682
+ if (_this20.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2683
+ _this20.recaptchaReady();
2584
2684
  }
2585
2685
  });
2586
2686
  }
@@ -2595,6 +2695,10 @@ var WebsyForm = /*#__PURE__*/function () {
2595
2695
  var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
2596
2696
  if (el) {
2597
2697
  el.value = value;
2698
+ el.setAttribute('value', value);
2699
+ if (this.fieldMap[field].type === 'checkbox') {
2700
+ el.checked = value;
2701
+ }
2598
2702
  } else {
2599
2703
  console.error("Input for ".concat(field, " does not exist in form."));
2600
2704
  }
@@ -2606,7 +2710,7 @@ var WebsyForm = /*#__PURE__*/function () {
2606
2710
  }, {
2607
2711
  key: "submitForm",
2608
2712
  value: function submitForm() {
2609
- var _this20 = this;
2713
+ var _this21 = this;
2610
2714
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2611
2715
  var buttonEl = formEl.querySelector('button.websy-btn.submit');
2612
2716
  var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
@@ -2631,27 +2735,27 @@ var WebsyForm = /*#__PURE__*/function () {
2631
2735
  temp.forEach(function (value, key) {
2632
2736
  data[key] = value;
2633
2737
  });
2634
- if (_this20.options.url) {
2635
- var _this20$apiService;
2636
- var params = [_this20.options.url];
2637
- if (_this20.options.mode === 'update') {
2638
- params.push(_this20.options.id);
2738
+ if (_this21.options.url) {
2739
+ var _this21$apiService;
2740
+ var params = [_this21.options.url];
2741
+ if (_this21.options.mode === 'update') {
2742
+ params.push(_this21.options.id);
2639
2743
  }
2640
2744
  params.push(data);
2641
- (_this20$apiService = _this20.apiService)[_this20.options.mode].apply(_this20$apiService, params).then(function (result) {
2642
- if (_this20.options.clearAfterSave === true) {
2745
+ (_this21$apiService = _this21.apiService)[_this21.options.mode].apply(_this21$apiService, params).then(function (result) {
2746
+ if (_this21.options.clearAfterSave === true) {
2643
2747
  // this.render()
2644
2748
  formEl.reset();
2645
2749
  }
2646
2750
  buttonEl.removeAttribute('disabled');
2647
- _this20.options.onSuccess.call(_this20, result);
2751
+ _this21.options.onSuccess.call(_this21, result);
2648
2752
  }, function (err) {
2649
2753
  console.log('Error submitting form data:', err);
2650
- _this20.options.onError.call(_this20, err);
2754
+ _this21.options.onError.call(_this21, err);
2651
2755
  });
2652
- } else if (_this20.options.submitFn) {
2653
- _this20.options.submitFn(data, function () {
2654
- if (_this20.options.clearAfterSave === true) {
2756
+ } else if (_this21.options.submitFn) {
2757
+ _this21.options.submitFn(data, function () {
2758
+ if (_this21.options.clearAfterSave === true) {
2655
2759
  // this.render()
2656
2760
  formEl.reset();
2657
2761
  }
@@ -2758,6 +2862,12 @@ var MultiForm = /*#__PURE__*/function () {
2758
2862
  this.render();
2759
2863
  }
2760
2864
  _createClass(MultiForm, [{
2865
+ key: "addData",
2866
+ value: function addData(data) {
2867
+ this.formData = this.formData.concat(data);
2868
+ this.render();
2869
+ }
2870
+ }, {
2761
2871
  key: "addEntry",
2762
2872
  value: function addEntry() {
2763
2873
  var el = document.getElementById("".concat(this.elementId, "_container"));
@@ -2767,7 +2877,11 @@ var MultiForm = /*#__PURE__*/function () {
2767
2877
  newFormEl.classList.add('websy-multi-form-form-container');
2768
2878
  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 ");
2769
2879
  el.appendChild(newFormEl);
2770
- var formOptions = _extends({}, this.options);
2880
+ var formOptions = _extends({}, this.options, {
2881
+ fields: _toConsumableArray(this.options.fields.map(function (f) {
2882
+ return _extends({}, f);
2883
+ }))
2884
+ });
2771
2885
  this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2772
2886
  }
2773
2887
  }, {
@@ -2787,14 +2901,25 @@ var MultiForm = /*#__PURE__*/function () {
2787
2901
  var d = this.forms.map(function (f) {
2788
2902
  return f.data;
2789
2903
  });
2790
- // we don't return the last form
2791
- d.pop();
2904
+ console.log('forms data', d);
2905
+ if (this.options.allowAdd !== false) {
2906
+ // we don't return the last form
2907
+ d.pop();
2908
+ }
2792
2909
  return d;
2793
2910
  },
2794
2911
  set: function set(d) {
2795
2912
  this.formData = d;
2796
2913
  this.render();
2797
2914
  }
2915
+ }, {
2916
+ key: "deleted",
2917
+ get: function get() {
2918
+ var _this22 = this;
2919
+ return this.formData.filter(function (d) {
2920
+ return _this22.recordsToDelete.includes("".concat(d.id));
2921
+ });
2922
+ }
2798
2923
  }, {
2799
2924
  key: "handleClick",
2800
2925
  value: function handleClick(event) {
@@ -2839,7 +2964,7 @@ var MultiForm = /*#__PURE__*/function () {
2839
2964
  }, {
2840
2965
  key: "render",
2841
2966
  value: function render() {
2842
- var _this21 = this;
2967
+ var _this23 = this;
2843
2968
  this.forms = [];
2844
2969
  this.recordsToDelete = [];
2845
2970
  var el = document.getElementById("".concat(this.elementId, "_container"));
@@ -2847,9 +2972,9 @@ var MultiForm = /*#__PURE__*/function () {
2847
2972
  var html = '';
2848
2973
  this.formData.forEach(function (d) {
2849
2974
  d.formId = WebsyDesigns.Utils.createIdentity();
2850
- html += "\n <div id='".concat(_this21.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this21.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
2851
- if (_this21.options.allowDelete === true) {
2852
- html += "\n <button id='".concat(_this21.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this21.options.deleteButton, "\n </button>\n ");
2975
+ 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 ");
2976
+ if (_this23.options.allowDelete === true) {
2977
+ 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 ");
2853
2978
  }
2854
2979
  html += "\n </div>\n ";
2855
2980
  });
@@ -2858,15 +2983,25 @@ var MultiForm = /*#__PURE__*/function () {
2858
2983
  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 ");
2859
2984
  }
2860
2985
  el.innerHTML = html;
2861
- this.formData.forEach(function (d) {
2862
- var formOptions = _extends({}, _this21.options);
2863
- var formObject = new WebsyDesigns.Form("".concat(_this21.elementId, "_").concat(d.formId, "_form"), formOptions);
2986
+ this.forms = new Array(this.formData.length);
2987
+ this.formData.forEach(function (d, i) {
2988
+ var formOptions = _extends({}, _this23.options, {
2989
+ fields: _toConsumableArray(_this23.options.fields.map(function (f) {
2990
+ return _extends({}, f);
2991
+ }))
2992
+ });
2993
+ var formObject = new WebsyDesigns.Form("".concat(_this23.elementId, "_").concat(d.formId, "_form"), formOptions);
2864
2994
  formObject.data = d;
2865
- _this21.forms.push(formObject);
2995
+ _this23.forms[i] = formObject;
2866
2996
  });
2867
2997
  if (this.options.allowAdd === true) {
2868
- var formOptions = _extends({}, this.options);
2869
- this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions));
2998
+ var formOptions = _extends({}, this.options, {
2999
+ fields: _toConsumableArray(this.options.fields.map(function (f) {
3000
+ return _extends({}, f);
3001
+ }))
3002
+ });
3003
+ var formObject = new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions);
3004
+ this.forms.push(formObject);
2870
3005
  }
2871
3006
  }
2872
3007
  }
@@ -3154,7 +3289,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3154
3289
  }, {
3155
3290
  key: "handleSearch",
3156
3291
  value: function handleSearch(searchText) {
3157
- var _this22 = this;
3292
+ var _this24 = this;
3158
3293
  var el = document.getElementById(this.elementId);
3159
3294
  // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
3160
3295
  var lowestItems = this.flatItems.filter(function (d) {
@@ -3165,7 +3300,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3165
3300
  if (searchText && searchText.length > 1) {
3166
3301
  defaultMethod = 'add';
3167
3302
  visibleItems = lowestItems.filter(function (d) {
3168
- return d[_this22.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3303
+ return d[_this24.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3169
3304
  });
3170
3305
  }
3171
3306
  // hide everything
@@ -3347,7 +3482,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3347
3482
  /* global WebsyDesigns */
3348
3483
  var Pager = /*#__PURE__*/function () {
3349
3484
  function Pager(elementId, options) {
3350
- var _this23 = this;
3485
+ var _this25 = this;
3351
3486
  _classCallCheck(this, Pager);
3352
3487
  this.elementId = elementId;
3353
3488
  var DEFAULTS = {
@@ -3394,8 +3529,8 @@ var Pager = /*#__PURE__*/function () {
3394
3529
  allowClear: false,
3395
3530
  disableSearch: true,
3396
3531
  onItemSelected: function onItemSelected(selectedItem) {
3397
- if (_this23.options.onChangePageSize) {
3398
- _this23.options.onChangePageSize(selectedItem.value);
3532
+ if (_this25.options.onChangePageSize) {
3533
+ _this25.options.onChangePageSize(selectedItem.value);
3399
3534
  }
3400
3535
  }
3401
3536
  });
@@ -3416,11 +3551,11 @@ var Pager = /*#__PURE__*/function () {
3416
3551
  }, {
3417
3552
  key: "render",
3418
3553
  value: function render() {
3419
- var _this24 = this;
3554
+ var _this26 = this;
3420
3555
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3421
3556
  if (el) {
3422
3557
  var pages = this.options.pages.map(function (item, index) {
3423
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this24.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3558
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this26.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3424
3559
  });
3425
3560
  var startIndex = 0;
3426
3561
  if (this.options.pages.length > 8) {
@@ -3478,48 +3613,48 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3478
3613
  _createClass(WebsyPDFButton, [{
3479
3614
  key: "handleClick",
3480
3615
  value: function handleClick(event) {
3481
- var _this25 = this;
3616
+ var _this27 = this;
3482
3617
  if (event.target.classList.contains('websy-pdf-button')) {
3483
3618
  this.loader.show();
3484
3619
  setTimeout(function () {
3485
- if (_this25.options.targetId) {
3486
- var el = document.getElementById(_this25.options.targetId);
3620
+ if (_this27.options.targetId) {
3621
+ var el = document.getElementById(_this27.options.targetId);
3487
3622
  if (el) {
3488
3623
  var pdfData = {
3489
3624
  options: {}
3490
3625
  };
3491
- if (_this25.options.pdfOptions) {
3492
- pdfData.options = _extends({}, _this25.options.pdfOptions);
3626
+ if (_this27.options.pdfOptions) {
3627
+ pdfData.options = _extends({}, _this27.options.pdfOptions);
3493
3628
  }
3494
- if (_this25.options.header) {
3495
- if (_this25.options.header.elementId) {
3496
- var headerEl = document.getElementById(_this25.options.header.elementId);
3629
+ if (_this27.options.header) {
3630
+ if (_this27.options.header.elementId) {
3631
+ var headerEl = document.getElementById(_this27.options.header.elementId);
3497
3632
  if (headerEl) {
3498
3633
  pdfData.header = headerEl.outerHTML;
3499
- if (_this25.options.header.css) {
3500
- pdfData.options.headerCSS = _this25.options.header.css;
3634
+ if (_this27.options.header.css) {
3635
+ pdfData.options.headerCSS = _this27.options.header.css;
3501
3636
  }
3502
3637
  }
3503
- } else if (_this25.options.header.html) {
3504
- pdfData.header = _this25.options.header.html;
3505
- if (_this25.options.header.css) {
3506
- pdfData.options.headerCSS = _this25.options.header.css;
3638
+ } else if (_this27.options.header.html) {
3639
+ pdfData.header = _this27.options.header.html;
3640
+ if (_this27.options.header.css) {
3641
+ pdfData.options.headerCSS = _this27.options.header.css;
3507
3642
  }
3508
3643
  } else {
3509
- pdfData.header = _this25.options.header;
3644
+ pdfData.header = _this27.options.header;
3510
3645
  }
3511
3646
  }
3512
- if (_this25.options.footer) {
3513
- if (_this25.options.footer.elementId) {
3514
- var footerEl = document.getElementById(_this25.options.footer.elementId);
3647
+ if (_this27.options.footer) {
3648
+ if (_this27.options.footer.elementId) {
3649
+ var footerEl = document.getElementById(_this27.options.footer.elementId);
3515
3650
  if (footerEl) {
3516
3651
  pdfData.footer = footerEl.outerHTML;
3517
- if (_this25.options.footer.css) {
3518
- pdfData.options.footerCSS = _this25.options.footer.css;
3652
+ if (_this27.options.footer.css) {
3653
+ pdfData.options.footerCSS = _this27.options.footer.css;
3519
3654
  }
3520
3655
  }
3521
3656
  } else {
3522
- pdfData.footer = _this25.options.footer;
3657
+ pdfData.footer = _this27.options.footer;
3523
3658
  }
3524
3659
  }
3525
3660
  pdfData.html = el.outerHTML;
@@ -3527,25 +3662,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3527
3662
  // document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
3528
3663
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3529
3664
  // document.getElementById(`${this.elementId}_form`).submit()
3530
- _this25.service.add('', pdfData, {
3665
+ _this27.service.add('', pdfData, {
3531
3666
  responseType: 'blob'
3532
3667
  }).then(function (response) {
3533
- _this25.loader.hide();
3668
+ _this27.loader.hide();
3534
3669
  var blob = new Blob([response], {
3535
3670
  type: 'application/pdf'
3536
3671
  });
3537
3672
  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 ");
3538
- if (_this25.options.directDownload === true) {
3673
+ if (_this27.options.directDownload === true) {
3539
3674
  var fileName;
3540
- if (typeof _this25.options.fileName === 'function') {
3541
- fileName = _this25.options.fileName() || 'Export';
3675
+ if (typeof _this27.options.fileName === 'function') {
3676
+ fileName = _this27.options.fileName() || 'Export';
3542
3677
  } else {
3543
- fileName = _this25.options.fileName || 'Export';
3678
+ fileName = _this27.options.fileName || 'Export';
3544
3679
  }
3545
3680
  msg += "download='".concat(fileName, ".pdf'");
3546
3681
  }
3547
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this25.options.buttonText, "</button>\n </a>\n </div>\n ");
3548
- _this25.popup.show({
3682
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this27.options.buttonText, "</button>\n </a>\n </div>\n ");
3683
+ _this27.popup.show({
3549
3684
  message: msg,
3550
3685
  mask: true
3551
3686
  });
@@ -3694,6 +3829,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
3694
3829
  }, {
3695
3830
  key: "subscribe",
3696
3831
  value: function subscribe(id, method, fn) {
3832
+ if (!this.subscriptions) {
3833
+ this.subscriptions = {};
3834
+ }
3697
3835
  if (arguments.length === 3) {
3698
3836
  if (!this.subscriptions[id]) {
3699
3837
  this.subscriptions[id] = {};
@@ -3713,7 +3851,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3713
3851
  }();
3714
3852
  var ResponsiveText = /*#__PURE__*/function () {
3715
3853
  function ResponsiveText(elementId, options) {
3716
- var _this26 = this;
3854
+ var _this28 = this;
3717
3855
  _classCallCheck(this, ResponsiveText);
3718
3856
  var DEFAULTS = {
3719
3857
  textAlign: 'center',
@@ -3724,7 +3862,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3724
3862
  this.elementId = elementId;
3725
3863
  this.canvas = document.createElement('canvas');
3726
3864
  window.addEventListener('resize', function () {
3727
- return _this26.render();
3865
+ return _this28.render();
3728
3866
  });
3729
3867
  var el = document.getElementById(this.elementId);
3730
3868
  if (el) {
@@ -3914,7 +4052,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3914
4052
  /* global WebsyDesigns */
3915
4053
  var WebsyResultList = /*#__PURE__*/function () {
3916
4054
  function WebsyResultList(elementId, options) {
3917
- var _this27 = this;
4055
+ var _this29 = this;
3918
4056
  _classCallCheck(this, WebsyResultList);
3919
4057
  var DEFAULTS = {
3920
4058
  listeners: {
@@ -3940,8 +4078,8 @@ var WebsyResultList = /*#__PURE__*/function () {
3940
4078
  }
3941
4079
  if (_typeof(options.template) === 'object' && options.template.url) {
3942
4080
  this.templateService.get(options.template.url).then(function (templateString) {
3943
- _this27.options.template = templateString;
3944
- _this27.render();
4081
+ _this29.options.template = templateString;
4082
+ _this29.render();
3945
4083
  });
3946
4084
  } else {
3947
4085
  this.render();
@@ -3960,7 +4098,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3960
4098
  }, {
3961
4099
  key: "buildHTML",
3962
4100
  value: function buildHTML(d) {
3963
- var _this28 = this;
4101
+ var _this30 = this;
3964
4102
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3965
4103
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
3966
4104
  var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
@@ -3968,7 +4106,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3968
4106
  if (this.options.template) {
3969
4107
  if (d.length > 0) {
3970
4108
  d.forEach(function (row, ix) {
3971
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this28.options.template).concat(ix < d.length - 1 ? '<!--' : '');
4109
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this30.options.template).concat(ix < d.length - 1 ? '<!--' : '');
3972
4110
  // find conditional elements
3973
4111
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3974
4112
  ifMatches.forEach(function (m) {
@@ -4056,7 +4194,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4056
4194
  parts.forEach(function (p) {
4057
4195
  items = items[p];
4058
4196
  });
4059
- template = template.replace(m[0], _this28.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4197
+ template = template.replace(m[0], _this30.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4060
4198
  }
4061
4199
  });
4062
4200
  var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
@@ -4065,7 +4203,7 @@ var WebsyResultList = /*#__PURE__*/function () {
4065
4203
  template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
4066
4204
  }
4067
4205
  });
4068
- var flatRow = _this28.flattenObject(row);
4206
+ var flatRow = _this30.flattenObject(row);
4069
4207
  for (var key in flatRow) {
4070
4208
  var rg = new RegExp("{".concat(key, "}"), 'gm');
4071
4209
  template = template.replace(rg, flatRow[key] || '');
@@ -4190,15 +4328,15 @@ var WebsyResultList = /*#__PURE__*/function () {
4190
4328
  }, {
4191
4329
  key: "render",
4192
4330
  value: function render() {
4193
- var _this29 = this;
4331
+ var _this31 = this;
4194
4332
  if (this.options.entity) {
4195
4333
  var url = this.options.entity;
4196
4334
  if (this.options.sortField) {
4197
4335
  url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
4198
4336
  }
4199
4337
  this.apiService.get(url).then(function (results) {
4200
- _this29.rows = results.rows;
4201
- _this29.resize();
4338
+ _this31.rows = results.rows;
4339
+ _this31.resize();
4202
4340
  });
4203
4341
  } else {
4204
4342
  this.resize();
@@ -4268,12 +4406,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4268
4406
  _createClass(WebsyRouter, [{
4269
4407
  key: "addGroup",
4270
4408
  value: function addGroup(group) {
4271
- var _this30 = this;
4409
+ var _this32 = this;
4272
4410
  if (!this.groups[group]) {
4273
4411
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4274
4412
  if (els) {
4275
4413
  this.getClosestParent(els[0], function (parent) {
4276
- _this30.groups[group] = {
4414
+ _this32.groups[group] = {
4277
4415
  activeView: '',
4278
4416
  views: [],
4279
4417
  parent: parent.getAttribute('data-view')
@@ -4337,7 +4475,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4337
4475
  }, {
4338
4476
  key: "removeUrlParams",
4339
4477
  value: function removeUrlParams() {
4340
- var _this31 = this;
4478
+ var _this33 = this;
4341
4479
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4342
4480
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4343
4481
  var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -4345,7 +4483,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4345
4483
  var path = '';
4346
4484
  if (this.currentParams && this.currentParams.items) {
4347
4485
  params.forEach(function (p) {
4348
- delete _this31.currentParams.items[p];
4486
+ delete _this33.currentParams.items[p];
4349
4487
  });
4350
4488
  path = this.buildUrlPath(this.currentParams.items);
4351
4489
  }
@@ -4676,11 +4814,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4676
4814
  }, {
4677
4815
  key: "showComponents",
4678
4816
  value: function showComponents(view) {
4679
- var _this32 = this;
4817
+ var _this34 = this;
4680
4818
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4681
4819
  this.options.views[view].components.forEach(function (c) {
4682
4820
  if (typeof c.instance === 'undefined') {
4683
- _this32.prepComponent(c.elementId, c.options);
4821
+ _this34.prepComponent(c.elementId, c.options);
4684
4822
  c.instance = new c.Component(c.elementId, c.options);
4685
4823
  } else if (c.instance.render) {
4686
4824
  c.instance.render();
@@ -5000,7 +5138,7 @@ var WebsySearch = /*#__PURE__*/function () {
5000
5138
  }, {
5001
5139
  key: "handleKeyUp",
5002
5140
  value: function handleKeyUp(event) {
5003
- var _this33 = this;
5141
+ var _this35 = this;
5004
5142
  if (event.target.classList.contains('websy-search-input')) {
5005
5143
  if (this.searchTimeoutFn) {
5006
5144
  clearTimeout(this.searchTimeoutFn);
@@ -5018,8 +5156,8 @@ var WebsySearch = /*#__PURE__*/function () {
5018
5156
  }
5019
5157
  if (event.target.value.length >= this.options.minLength) {
5020
5158
  this.searchTimeoutFn = setTimeout(function () {
5021
- if (_this33.options.onSearch) {
5022
- _this33.options.onSearch(event.target.value, event);
5159
+ if (_this35.options.onSearch) {
5160
+ _this35.options.onSearch(event.target.value, event);
5023
5161
  }
5024
5162
  }, this.options.searchTimeout);
5025
5163
  } else {
@@ -5177,7 +5315,7 @@ var Switch = /*#__PURE__*/function () {
5177
5315
  /* global WebsyDesigns */
5178
5316
  var WebsyTemplate = /*#__PURE__*/function () {
5179
5317
  function WebsyTemplate(elementId, options) {
5180
- var _this34 = this;
5318
+ var _this36 = this;
5181
5319
  _classCallCheck(this, WebsyTemplate);
5182
5320
  var DEFAULTS = {
5183
5321
  listeners: {
@@ -5197,8 +5335,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
5197
5335
  }
5198
5336
  if (_typeof(options.template) === 'object' && options.template.url) {
5199
5337
  this.templateService.get(options.template.url).then(function (templateString) {
5200
- _this34.options.template = templateString;
5201
- _this34.render();
5338
+ _this36.options.template = templateString;
5339
+ _this36.render();
5202
5340
  });
5203
5341
  } else {
5204
5342
  this.render();
@@ -5207,7 +5345,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5207
5345
  _createClass(WebsyTemplate, [{
5208
5346
  key: "buildHTML",
5209
5347
  value: function buildHTML() {
5210
- var _this35 = this;
5348
+ var _this37 = this;
5211
5349
  var html = "";
5212
5350
  if (this.options.template) {
5213
5351
  var template = this.options.template;
@@ -5256,14 +5394,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5256
5394
  }
5257
5395
  }
5258
5396
  if (polarity === true) {
5259
- if (typeof _this35.options.data[parts[0]] !== 'undefined' && _this35.options.data[parts[0]] === parts[1]) {
5397
+ if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] === parts[1]) {
5260
5398
  // remove the <if> tags
5261
5399
  removeAll = false;
5262
5400
  } else if (parts[0] === parts[1]) {
5263
5401
  removeAll = false;
5264
5402
  }
5265
5403
  } else if (polarity === false) {
5266
- if (typeof _this35.options.data[parts[0]] !== 'undefined' && _this35.options.data[parts[0]] !== parts[1]) {
5404
+ if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] !== parts[1]) {
5267
5405
  // remove the <if> tags
5268
5406
  removeAll = false;
5269
5407
  }
@@ -5300,7 +5438,55 @@ var WebsyTemplate = /*#__PURE__*/function () {
5300
5438
  }, {
5301
5439
  key: "handleClick",
5302
5440
  value: function handleClick(event) {
5303
- //
5441
+ if (event.target.classList.contains('clickable')) {
5442
+ this.handleEvent(event, 'clickable', 'click');
5443
+ }
5444
+ }
5445
+ }, {
5446
+ key: "handleEvent",
5447
+ value: function handleEvent(event, eventType, action) {
5448
+ var l = event.target.getAttribute('data-event');
5449
+ if (l) {
5450
+ l = l.split('(');
5451
+ var params = [];
5452
+ var id = event.target.getAttribute('data-id');
5453
+ // const locator = event.target.getAttribute('data-locator')
5454
+ // if (l[1]) {
5455
+ // l[1] = l[1].replace(')', '')
5456
+ // params = l[1].split(',')
5457
+ // }
5458
+ // l = l[0]
5459
+ var data = this.options.data;
5460
+ // if (locator !== '') {
5461
+ // let locatorItems = locator.split(';')
5462
+ // locatorItems.forEach(loc => {
5463
+ // let locatorParts = loc.split(':')
5464
+ // if (data[locatorParts[0]]) {
5465
+ // data = data[locatorParts[0]]
5466
+ // let parts = locatorParts[1].split('.')
5467
+ // parts.forEach(p => {
5468
+ // data = data[p]
5469
+ // })
5470
+ // }
5471
+ // })
5472
+ // }
5473
+ // params = params.map(p => {
5474
+ // if (typeof p !== 'string' && typeof p !== 'number') {
5475
+ // if (data[+id]) {
5476
+ // p = data[+id][p]
5477
+ // }
5478
+ // }
5479
+ // else if (typeof p === 'string') {
5480
+ // p = p.replace(/"/g, '').replace(/'/g, '')
5481
+ // }
5482
+ // return p
5483
+ // })
5484
+ if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
5485
+ var _this$options$listene2;
5486
+ event.stopPropagation();
5487
+ (_this$options$listene2 = this.options.listeners[action][l]).call.apply(_this$options$listene2, [this, event, data[+id]].concat(params));
5488
+ }
5489
+ }
5304
5490
  }
5305
5491
  }, {
5306
5492
  key: "render",
@@ -5338,7 +5524,9 @@ var WebsyUtils = {
5338
5524
  top: rect.top + scrollTop,
5339
5525
  left: rect.left + scrollLeft,
5340
5526
  bottom: rect.top + scrollTop + el.clientHeight,
5341
- right: rect.left + scrollLeft + el.clientWidth
5527
+ right: rect.left + scrollLeft + el.clientWidth,
5528
+ width: rect.width,
5529
+ height: rect.height
5342
5530
  };
5343
5531
  },
5344
5532
  getLightDark: function getLightDark(backgroundColor) {
@@ -5522,7 +5710,7 @@ var WebsyUtils = {
5522
5710
  /* global WebsyDesigns */
5523
5711
  var WebsyTable = /*#__PURE__*/function () {
5524
5712
  function WebsyTable(elementId, options) {
5525
- var _this36 = this;
5713
+ var _this38 = this;
5526
5714
  _classCallCheck(this, WebsyTable);
5527
5715
  var DEFAULTS = {
5528
5716
  pageSize: 20,
@@ -5554,8 +5742,8 @@ var WebsyTable = /*#__PURE__*/function () {
5554
5742
  allowClear: false,
5555
5743
  disableSearch: true,
5556
5744
  onItemSelected: function onItemSelected(selectedItem) {
5557
- if (_this36.options.onChangePageSize) {
5558
- _this36.options.onChangePageSize(selectedItem.value);
5745
+ if (_this38.options.onChangePageSize) {
5746
+ _this38.options.onChangePageSize(selectedItem.value);
5559
5747
  }
5560
5748
  }
5561
5749
  });
@@ -5574,19 +5762,19 @@ var WebsyTable = /*#__PURE__*/function () {
5574
5762
  _createClass(WebsyTable, [{
5575
5763
  key: "appendRows",
5576
5764
  value: function appendRows(data) {
5577
- var _this37 = this;
5765
+ var _this39 = this;
5578
5766
  this.hideError();
5579
5767
  var bodyHTML = '';
5580
5768
  if (data) {
5581
5769
  bodyHTML += data.map(function (r, rowIndex) {
5582
5770
  return '<tr>' + r.map(function (c, i) {
5583
- if (_this37.options.columns[i].show !== false) {
5771
+ if (_this39.options.columns[i].show !== false) {
5584
5772
  var style = '';
5585
5773
  if (c.style) {
5586
5774
  style += c.style;
5587
5775
  }
5588
- if (_this37.options.columns[i].width) {
5589
- style += "width: ".concat(_this37.options.columns[i].width, "; ");
5776
+ if (_this39.options.columns[i].width) {
5777
+ style += "width: ".concat(_this39.options.columns[i].width, "; ");
5590
5778
  }
5591
5779
  if (c.backgroundColor) {
5592
5780
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5597,16 +5785,16 @@ var WebsyTable = /*#__PURE__*/function () {
5597
5785
  if (c.color) {
5598
5786
  style += "color: ".concat(c.color, "; ");
5599
5787
  }
5600
- if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5601
- return "\n <td \n data-row-index='".concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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(_this37.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5602
- } else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5603
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this37.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</td>\n ");
5788
+ if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5789
+ return "\n <td \n data-row-index='".concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this39.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5790
+ } else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5791
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this39.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</td>\n ");
5604
5792
  } else {
5605
5793
  var info = c.value;
5606
- if (_this37.options.columns[i].showAsImage === true) {
5794
+ if (_this39.options.columns[i].showAsImage === true) {
5607
5795
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5608
5796
  }
5609
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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 ");
5797
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5610
5798
  }
5611
5799
  }
5612
5800
  }).join('') + '</tr>';
@@ -5765,7 +5953,7 @@ var WebsyTable = /*#__PURE__*/function () {
5765
5953
  }, {
5766
5954
  key: "render",
5767
5955
  value: function render(data) {
5768
- var _this38 = this;
5956
+ var _this40 = this;
5769
5957
  if (!this.options.columns) {
5770
5958
  return;
5771
5959
  }
@@ -5792,7 +5980,7 @@ var WebsyTable = /*#__PURE__*/function () {
5792
5980
  if (c.width) {
5793
5981
  style += "width: ".concat(c.width || 'auto', ";");
5794
5982
  }
5795
- 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 ? _this38.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5983
+ 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 ? _this40.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5796
5984
  }
5797
5985
  }).join('') + '</tr>';
5798
5986
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5810,7 +5998,7 @@ var WebsyTable = /*#__PURE__*/function () {
5810
5998
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
5811
5999
  if (pagingEl) {
5812
6000
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5813
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6001
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5814
6002
  });
5815
6003
  var startIndex = 0;
5816
6004
  if (this.options.pageCount > 8) {
@@ -5865,7 +6053,7 @@ var WebsyTable = /*#__PURE__*/function () {
5865
6053
  /* global WebsyDesigns */
5866
6054
  var WebsyTable2 = /*#__PURE__*/function () {
5867
6055
  function WebsyTable2(elementId, options) {
5868
- var _this39 = this;
6056
+ var _this41 = this;
5869
6057
  _classCallCheck(this, WebsyTable2);
5870
6058
  var DEFAULTS = {
5871
6059
  pageSize: 20,
@@ -5900,8 +6088,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5900
6088
  allowClear: false,
5901
6089
  disableSearch: true,
5902
6090
  onItemSelected: function onItemSelected(selectedItem) {
5903
- if (_this39.options.onChangePageSize) {
5904
- _this39.options.onChangePageSize(selectedItem.value);
6091
+ if (_this41.options.onChangePageSize) {
6092
+ _this41.options.onChangePageSize(selectedItem.value);
5905
6093
  }
5906
6094
  }
5907
6095
  });
@@ -5923,20 +6111,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
5923
6111
  _createClass(WebsyTable2, [{
5924
6112
  key: "appendRows",
5925
6113
  value: function appendRows(data) {
5926
- var _this40 = this;
6114
+ var _this42 = this;
5927
6115
  this.hideError();
5928
6116
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5929
6117
  var bodyHTML = '';
5930
6118
  if (data) {
5931
6119
  bodyHTML += data.map(function (r, rowIndex) {
5932
6120
  return '<tr>' + r.map(function (c, i) {
5933
- if (_this40.options.columns[i].show !== false) {
5934
- var style = "height: ".concat(_this40.options.cellSize, "px; line-height: ").concat(_this40.options.cellSize, "px;");
6121
+ if (_this42.options.columns[i].show !== false) {
6122
+ var style = "height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px;");
5935
6123
  if (c.style) {
5936
6124
  style += c.style;
5937
6125
  }
5938
- if (_this40.options.columns[i].width) {
5939
- style += "width: ".concat(_this40.options.columns[i].width, "; ");
6126
+ if (_this42.options.columns[i].width) {
6127
+ style += "width: ".concat(_this42.options.columns[i].width, "; ");
5940
6128
  }
5941
6129
  if (c.backgroundColor) {
5942
6130
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5947,16 +6135,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
5947
6135
  if (c.color) {
5948
6136
  style += "color: ".concat(c.color, "; ");
5949
6137
  }
5950
- if (_this40.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5951
- return "\n <td \n data-row-index='".concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this40.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(_this40.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this40.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5952
- } else if ((_this40.options.columns[i].showAsNavigatorLink === true || _this40.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5953
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this40.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this40.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this40.options.columns[i].linkText || c.value, "</td>\n ");
6138
+ if (_this42.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6139
+ return "\n <td \n data-row-index='".concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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(_this42.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6140
+ } else if ((_this42.options.columns[i].showAsNavigatorLink === true || _this42.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6141
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this42.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this42.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</td>\n ");
5954
6142
  } else {
5955
6143
  var info = c.value;
5956
- if (_this40.options.columns[i].showAsImage === true) {
6144
+ if (_this42.options.columns[i].showAsImage === true) {
5957
6145
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5958
6146
  }
5959
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this40.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 ");
6147
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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 ");
5960
6148
  }
5961
6149
  }
5962
6150
  }).join('') + '</tr>';
@@ -6190,7 +6378,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6190
6378
  }, {
6191
6379
  key: "render",
6192
6380
  value: function render(data) {
6193
- var _this41 = this;
6381
+ var _this43 = this;
6194
6382
  if (!this.options.columns) {
6195
6383
  return;
6196
6384
  }
@@ -6218,7 +6406,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6218
6406
  if (c.width) {
6219
6407
  style += "width: ".concat(c.width || 'auto', "; ");
6220
6408
  }
6221
- 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 ? _this41.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6409
+ 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 ? _this43.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6222
6410
  }
6223
6411
  }).join('') + '</tr>';
6224
6412
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6228,7 +6416,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6228
6416
  var dropdownHTML = "";
6229
6417
  this.options.columns.forEach(function (c, i) {
6230
6418
  if (c.searchable && c.searchField) {
6231
- dropdownHTML += "\n <div id=\"".concat(_this41.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6419
+ dropdownHTML += "\n <div id=\"".concat(_this43.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6232
6420
  }
6233
6421
  });
6234
6422
  dropdownEl.innerHTML = dropdownHTML;
@@ -6248,7 +6436,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6248
6436
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
6249
6437
  if (pagingEl) {
6250
6438
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6251
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this41.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6439
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this43.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6252
6440
  });
6253
6441
  var startIndex = 0;
6254
6442
  if (this.options.pageCount > 8) {
@@ -6325,17 +6513,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
6325
6513
  }, {
6326
6514
  key: "getColumnParameters",
6327
6515
  value: function getColumnParameters(values) {
6328
- var _this42 = this;
6516
+ var _this44 = this;
6329
6517
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6330
6518
  tableEl.style.tableLayout = 'auto';
6331
6519
  tableEl.style.width = 'auto';
6332
6520
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6333
6521
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6334
6522
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6335
- 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 ? _this42.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6523
+ 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 ? _this44.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6336
6524
  }).join('') + '</tr>';
6337
6525
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6338
- return "\n <td \n style='height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6526
+ return "\n <td \n style='height: ".concat(_this44.options.cellSize, "px; line-height: ").concat(_this44.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6339
6527
  }).join('') + '</tr>';
6340
6528
  // get height of the first data cell
6341
6529
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6491,7 +6679,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6491
6679
  }, {
6492
6680
  key: "buildBodyHtml",
6493
6681
  value: function buildBodyHtml() {
6494
- var _this43 = this;
6682
+ var _this45 = this;
6495
6683
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6496
6684
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6497
6685
  if (!this.options.columns) {
@@ -6516,7 +6704,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6516
6704
  row.forEach(function (cell, cellIndex) {
6517
6705
  var sizeIndex = cell.level || cellIndex;
6518
6706
  var colIndex = cell.index || cellIndex;
6519
- if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6707
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || _this45.options.columns[_this45.options.columns.length - 1][colIndex].show === false) {
6520
6708
  return; // need to revisit this logic
6521
6709
  }
6522
6710
 
@@ -6543,7 +6731,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6543
6731
  style += "color: ".concat(cell.color, "; ");
6544
6732
  }
6545
6733
  // console.log('rowspan', cell.rowspan)
6546
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this43.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 ");
6734
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this45.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 ");
6547
6735
  // if (useWidths === true) {
6548
6736
  // bodyHtml += `
6549
6737
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6552,10 +6740,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6552
6740
  // }
6553
6741
  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 >");
6554
6742
  if (cell.expandable === true) {
6555
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this43.options.plusIcon, "</i>");
6743
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this45.options.plusIcon, "</i>");
6556
6744
  }
6557
6745
  if (cell.collapsable === true) {
6558
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this43.options.minusIcon, "</i>");
6746
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this45.options.minusIcon, "</i>");
6559
6747
  }
6560
6748
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6561
6749
  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 ");
@@ -6576,7 +6764,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6576
6764
  }, {
6577
6765
  key: "buildHeaderHtml",
6578
6766
  value: function buildHeaderHtml() {
6579
- var _this44 = this;
6767
+ var _this46 = this;
6580
6768
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6581
6769
  if (!this.options.columns) {
6582
6770
  return '';
@@ -6593,7 +6781,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6593
6781
  headerHtml += '</colgroup>';
6594
6782
  }
6595
6783
  this.options.columns.forEach(function (row, rowIndex) {
6596
- if (useWidths === false && rowIndex !== _this44.options.columns.length - 1) {
6784
+ if (useWidths === false && rowIndex !== _this46.options.columns.length - 1) {
6597
6785
  // if we're calculating the size we only want to render the last row of column headers
6598
6786
  return;
6599
6787
  }
@@ -6617,24 +6805,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6617
6805
  if (col.style) {
6618
6806
  style += col.style;
6619
6807
  }
6620
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this44.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6808
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this46.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6621
6809
  // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6622
6810
  // headerHtml += `
6623
6811
  // style='width: ${col.width || col.actualWidth}px'
6624
6812
  // width='${col.width || col.actualWidth}'
6625
6813
  // `
6626
6814
  // }
6627
- 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 ? _this44.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this44.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6815
+ 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 ? _this46.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this46.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6628
6816
  });
6629
6817
  headerHtml += "</tr>";
6630
6818
  });
6631
6819
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6632
6820
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6633
6821
  if (c.searchable && c.isExternalSearch === true) {
6634
- var testEl = document.getElementById("".concat(_this44.elementId, "_columnSearch_").concat(c.dimId || i));
6822
+ var testEl = document.getElementById("".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i));
6635
6823
  if (!testEl) {
6636
6824
  var newE = document.createElement('div');
6637
- newE.id = "".concat(_this44.elementId, "_columnSearch_").concat(c.dimId || i);
6825
+ newE.id = "".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i);
6638
6826
  newE.className = 'websy-modal-dropdown';
6639
6827
  dropdownEl.appendChild(newE);
6640
6828
  }
@@ -6657,7 +6845,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6657
6845
  }, {
6658
6846
  key: "buildTotalHtml",
6659
6847
  value: function buildTotalHtml() {
6660
- var _this45 = this;
6848
+ var _this47 = this;
6661
6849
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6662
6850
  if (!this.options.totals) {
6663
6851
  return '';
@@ -6673,7 +6861,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6673
6861
 
6674
6862
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6675
6863
  if (useWidths === true) {
6676
- totalHtml += "\n style='width: ".concat(_this45.options.columns[_this45.options.columns.length - 1][colIndex].width || _this45.options.columns[_this45.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6864
+ totalHtml += "\n style='width: ".concat(_this47.options.columns[_this47.options.columns.length - 1][colIndex].width || _this47.options.columns[_this47.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6677
6865
  }
6678
6866
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
6679
6867
  });
@@ -6683,7 +6871,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6683
6871
  }, {
6684
6872
  key: "calculateSizes",
6685
6873
  value: function calculateSizes() {
6686
- var _this46 = this;
6874
+ var _this48 = this;
6687
6875
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6688
6876
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
6689
6877
  var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
@@ -6727,7 +6915,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6727
6915
  rows.forEach(function (row, rowIndex) {
6728
6916
  Array.from(row.children).forEach(function (col, colIndex) {
6729
6917
  var colSize = col.getBoundingClientRect();
6730
- _this46.sizes.cellHeight = colSize.height;
6918
+ _this48.sizes.cellHeight = colSize.height;
6731
6919
  if (columnsForSizing[colIndex]) {
6732
6920
  if (!columnsForSizing[colIndex].actualWidth) {
6733
6921
  columnsForSizing[colIndex].potentialWidth = 0;
@@ -6739,7 +6927,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6739
6927
  // columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
6740
6928
  // }
6741
6929
  columnsForSizing[colIndex].cellHeight = colSize.height;
6742
- if (colIndex >= _this46.pinnedColumns) {
6930
+ if (colIndex >= _this48.pinnedColumns) {
6743
6931
  firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
6744
6932
  }
6745
6933
  }
@@ -6754,7 +6942,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6754
6942
  return a + (b.width || b.actualWidth);
6755
6943
  }, 0);
6756
6944
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
6757
- return i >= _this46.pinnedColumns;
6945
+ return i >= _this48.pinnedColumns;
6758
6946
  }).reduce(function (a, b) {
6759
6947
  return a + (b.width || b.actualWidth);
6760
6948
  }, 0);
@@ -6765,7 +6953,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6765
6953
  var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
6766
6954
  columnsForSizing.forEach(function (c) {
6767
6955
  c.shouldGrow = true;
6768
- if (_this46.options.autoFitColumns === false) {
6956
+ if (_this48.options.autoFitColumns === false) {
6769
6957
  c.shouldGrow = false;
6770
6958
  if (c.potentialWidth > c.actualWidth) {
6771
6959
  c.shouldGrow = true;
@@ -6784,7 +6972,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6784
6972
  // if (!c.width) {
6785
6973
  // if (c.actualWidth < equalWidth) {
6786
6974
  // adjust the width
6787
- if (_this46.options.autoFitColumns === true) {
6975
+ if (_this48.options.autoFitColumns === true) {
6788
6976
  if (c.width) {
6789
6977
  c.width += equalWidth;
6790
6978
  }
@@ -6808,9 +6996,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6808
6996
  }
6809
6997
  // }
6810
6998
  // }
6811
- _this46.sizes.totalWidth += c.width || c.actualWidth;
6812
- if (i > _this46.pinnedColumns) {
6813
- _this46.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6999
+ _this48.sizes.totalWidth += c.width || c.actualWidth;
7000
+ if (i > _this48.pinnedColumns) {
7001
+ _this48.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6814
7002
  }
6815
7003
  // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6816
7004
  });
@@ -6869,7 +7057,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6869
7057
  }, {
6870
7058
  key: "createSample",
6871
7059
  value: function createSample(data) {
6872
- var _this47 = this;
7060
+ var _this49 = this;
6873
7061
  var output = [];
6874
7062
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
6875
7063
  if (col.maxLength) {
@@ -6879,7 +7067,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6879
7067
  } else if (data) {
6880
7068
  var longest = '';
6881
7069
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
6882
- if (data[i].length === _this47.options.columns[_this47.options.columns.length - 1].length) {
7070
+ if (data[i].length === _this49.options.columns[_this49.options.columns.length - 1].length) {
6883
7071
  if (longest.length < data[i][colIndex].value.length) {
6884
7072
  longest = data[i][colIndex].value;
6885
7073
  }
@@ -7151,7 +7339,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7151
7339
  }, {
7152
7340
  key: "perpetualScroll",
7153
7341
  value: function perpetualScroll() {
7154
- var _this48 = this;
7342
+ var _this50 = this;
7155
7343
  // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
7156
7344
  if (this.touchEndTime - this.currentTouchtime > 300) {
7157
7345
  return;
@@ -7170,17 +7358,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
7170
7358
  var direction = touchDistance > 0 ? -1 : 1;
7171
7359
  var _loop2 = function _loop2(i) {
7172
7360
  setTimeout(function () {
7173
- var delta = _this48.mouseYStart - _this48.currentClientY + _this48.sizes.cellHeight * (i + 1) * direction;
7361
+ var delta = _this50.mouseYStart - _this50.currentClientY + _this50.sizes.cellHeight * (i + 1) * direction;
7174
7362
  delta = Math.min(10, delta);
7175
7363
  delta = Math.max(-10, delta);
7176
7364
  // only run this if isPerpetual === true
7177
7365
  // this value is reset to false on touchStart
7178
- if (_this48.isPerpetual === true) {
7366
+ if (_this50.isPerpetual === true) {
7179
7367
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7180
7368
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
7181
- _this48.scrollY(Math.max(-5, Math.min(5, delta)));
7182
- if (_this48.scrollTimeout) {
7183
- clearTimeout(_this48.scrollTimeout);
7369
+ _this50.scrollY(Math.max(-5, Math.min(5, delta)));
7370
+ if (_this50.scrollTimeout) {
7371
+ clearTimeout(_this50.scrollTimeout);
7184
7372
  }
7185
7373
  }
7186
7374
  }, 1000 / fps * i);
@@ -7448,7 +7636,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7448
7636
  /* global d3 include WebsyDesigns */
7449
7637
  var WebsyChart = /*#__PURE__*/function () {
7450
7638
  function WebsyChart(elementId, options) {
7451
- var _this49 = this;
7639
+ var _this51 = this;
7452
7640
  _classCallCheck(this, WebsyChart);
7453
7641
  var DEFAULTS = {
7454
7642
  margin: {
@@ -7505,7 +7693,7 @@ var WebsyChart = /*#__PURE__*/function () {
7505
7693
  this.invertOverride = function (input, input2) {
7506
7694
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7507
7695
  var xAxis = 'bottom';
7508
- if (_this49.options.orientation === 'horizontal') {
7696
+ if (_this51.options.orientation === 'horizontal') {
7509
7697
  xAxis = 'left';
7510
7698
  }
7511
7699
  if (forBrush === true) {
@@ -7513,12 +7701,12 @@ var WebsyChart = /*#__PURE__*/function () {
7513
7701
  }
7514
7702
  xAxis += 'Axis';
7515
7703
  var output;
7516
- var width = _this49.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7704
+ var width = _this51.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7517
7705
  // if (this.customBottomRange) {
7518
- for (var index = 0; index < _this49.customBottomRange.length; index++) {
7519
- if (input > _this49.customBottomRange[index]) {
7520
- if (_this49.customBottomRange[index + 1]) {
7521
- if (input < _this49.customBottomRange[index + 1]) {
7706
+ for (var index = 0; index < _this51.customBottomRange.length; index++) {
7707
+ if (input > _this51.customBottomRange[index]) {
7708
+ if (_this51.customBottomRange[index + 1]) {
7709
+ if (input < _this51.customBottomRange[index + 1]) {
7522
7710
  output = index;
7523
7711
  break;
7524
7712
  }
@@ -7693,9 +7881,9 @@ var WebsyChart = /*#__PURE__*/function () {
7693
7881
  }, {
7694
7882
  key: "handleEventMouseMove",
7695
7883
  value: function handleEventMouseMove(event, d) {
7696
- var _this50 = this;
7884
+ var _this52 = this;
7697
7885
  var bisectDate = d3.bisector(function (d) {
7698
- return _this50.parseX(d.x.value);
7886
+ return _this52.parseX(d.x.value);
7699
7887
  }).left;
7700
7888
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
7701
7889
  var xAxis = 'bottomAxis';
@@ -7728,9 +7916,9 @@ var WebsyChart = /*#__PURE__*/function () {
7728
7916
  xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
7729
7917
  }
7730
7918
  this.options.data.series.forEach(function (s) {
7731
- if (_this50.options.data[xData].scale !== 'Time') {
7919
+ if (_this52.options.data[xData].scale !== 'Time') {
7732
7920
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7733
- xPoint = _this50.customBottomRange[x0] + (_this50.customBottomRange[x0 + 1] - _this50.customBottomRange[x0]) / 2;
7921
+ xPoint = _this52.customBottomRange[x0] + (_this52.customBottomRange[x0 + 1] - _this52.customBottomRange[x0]) / 2;
7734
7922
  // }
7735
7923
  // else {
7736
7924
  // xPoint = this[xAxis](this.parseX(xLabel))
@@ -7750,41 +7938,41 @@ var WebsyChart = /*#__PURE__*/function () {
7750
7938
  var index = bisectDate(s.data, x0, 1);
7751
7939
  var pointA = s.data[index - 1];
7752
7940
  var pointB = s.data[index];
7753
- if (_this50.options.orientation === 'horizontal') {
7941
+ if (_this52.options.orientation === 'horizontal') {
7754
7942
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7755
7943
  pointB = _toConsumableArray(s.data).reverse()[index];
7756
7944
  }
7757
7945
  if (pointA && !pointB) {
7758
- xPoint = _this50[xAxis](_this50.parseX(pointA.x.value));
7946
+ xPoint = _this52[xAxis](_this52.parseX(pointA.x.value));
7759
7947
  tooltipTitle = pointA.x.value;
7760
7948
  if (!pointA.y.color) {
7761
7949
  pointA.y.color = s.color;
7762
7950
  }
7763
7951
  tooltipData.push(pointA);
7764
7952
  if (typeof pointA.x.value.getTime !== 'undefined') {
7765
- tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointA.x.value);
7953
+ tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointA.x.value);
7766
7954
  }
7767
7955
  }
7768
7956
  if (pointB && !pointA) {
7769
- xPoint = _this50[xAxis](_this50.parseX(pointB.x.value));
7957
+ xPoint = _this52[xAxis](_this52.parseX(pointB.x.value));
7770
7958
  tooltipTitle = pointB.x.value;
7771
7959
  if (!pointB.y.color) {
7772
7960
  pointB.y.color = s.color;
7773
7961
  }
7774
7962
  tooltipData.push(pointB);
7775
7963
  if (typeof pointB.x.value.getTime !== 'undefined') {
7776
- tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointB.x.value);
7964
+ tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
7777
7965
  }
7778
7966
  }
7779
7967
  if (pointA && pointB) {
7780
- var d0 = _this50[xAxis](_this50.parseX(pointA.x.value));
7781
- var d1 = _this50[xAxis](_this50.parseX(pointB.x.value));
7968
+ var d0 = _this52[xAxis](_this52.parseX(pointA.x.value));
7969
+ var d1 = _this52[xAxis](_this52.parseX(pointB.x.value));
7782
7970
  var mid = Math.abs(d0 - d1) / 2;
7783
7971
  if (d3.pointer(event)[0] - d0 >= mid) {
7784
7972
  xPoint = d1;
7785
7973
  tooltipTitle = pointB.x.value;
7786
7974
  if (typeof pointB.x.value.getTime !== 'undefined') {
7787
- tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointB.x.value);
7975
+ tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
7788
7976
  }
7789
7977
  if (!pointB.y.color) {
7790
7978
  pointB.y.color = s.color;
@@ -7794,7 +7982,7 @@ var WebsyChart = /*#__PURE__*/function () {
7794
7982
  xPoint = d0;
7795
7983
  tooltipTitle = pointA.x.value;
7796
7984
  if (typeof pointB.x.value.getTime !== 'undefined') {
7797
- tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointB.x.value);
7985
+ tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
7798
7986
  }
7799
7987
  if (!pointA.y.color) {
7800
7988
  pointA.y.color = s.color;
@@ -7920,7 +8108,7 @@ var WebsyChart = /*#__PURE__*/function () {
7920
8108
  }, {
7921
8109
  key: "render",
7922
8110
  value: function render(options) {
7923
- var _this51 = this;
8111
+ var _this53 = this;
7924
8112
  /* global d3 options WebsyUtils */
7925
8113
  if (typeof options !== 'undefined') {
7926
8114
  this.options = _extends({}, this.options, options);
@@ -7988,7 +8176,7 @@ var WebsyChart = /*#__PURE__*/function () {
7988
8176
  this.options.data.series.map(function (s, i) {
7989
8177
  return {
7990
8178
  value: s.label || s.key,
7991
- color: s.color || _this51.options.colors[i % _this51.options.colors.length]
8179
+ color: s.color || _this53.options.colors[i % _this53.options.colors.length]
7992
8180
  };
7993
8181
  });
7994
8182
  }
@@ -8345,25 +8533,25 @@ var WebsyChart = /*#__PURE__*/function () {
8345
8533
  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') {
8346
8534
  var acc = 0;
8347
8535
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8348
- var adjustment = _this51.bandPadding * index + _this51.bandPadding;
8536
+ var adjustment = _this53.bandPadding * index + _this53.bandPadding;
8349
8537
  // if (this.options.data.bottom.padding) {
8350
8538
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8351
8539
  // }
8352
- var start = _this51.widthForCalc / noOfPoints * acc;
8540
+ var start = _this53.widthForCalc / noOfPoints * acc;
8353
8541
  for (var i = 0; i < (d.valueCount || 1); i++) {
8354
8542
  var pos = i * proposedBandWidth;
8355
- _this51["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8543
+ _this53["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8356
8544
  }
8357
- acc += _this51.options.grouping !== 'stacked' && _this51.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8358
- var end = _this51.widthForCalc / noOfPoints * acc;
8545
+ acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8546
+ var end = _this53.widthForCalc / noOfPoints * acc;
8359
8547
  // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8360
8548
  return end + adjustment;
8361
8549
  })));
8362
8550
  acc = 0;
8363
8551
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8364
- var adjustment = _this51.brushBandPadding * index + _this51.brushBandPadding;
8365
- acc += _this51.options.grouping !== 'stacked' && _this51.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8366
- return (_this51.options.orientation === 'vertical' ? _this51.plotWidth : _this51.plotHeight) / noOfPoints * acc;
8552
+ var adjustment = _this53.brushBandPadding * index + _this53.brushBandPadding;
8553
+ acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8554
+ return (_this53.options.orientation === 'vertical' ? _this53.plotWidth : _this53.plotHeight) / noOfPoints * acc;
8367
8555
  })));
8368
8556
  }
8369
8557
  // }
@@ -8536,7 +8724,7 @@ var WebsyChart = /*#__PURE__*/function () {
8536
8724
  this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
8537
8725
  if (this.options.data.bottom.formatter) {
8538
8726
  this.bAxisFunc.tickFormat(function (d) {
8539
- return _this51.options.data.bottom.formatter(d);
8727
+ return _this53.options.data.bottom.formatter(d);
8540
8728
  });
8541
8729
  }
8542
8730
  this.bottomAxisLayer.call(this.bAxisFunc);
@@ -8546,7 +8734,7 @@ var WebsyChart = /*#__PURE__*/function () {
8546
8734
  }
8547
8735
  if (this.customBottomRange.length > 0) {
8548
8736
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8549
- return "translate(".concat(_this51.customBottomRange[i] + (_this51.customBottomRange[i + 1] - _this51.customBottomRange[i]) / 2, ", 0)");
8737
+ return "translate(".concat(_this53.customBottomRange[i] + (_this53.customBottomRange[i + 1] - _this53.customBottomRange[i]) / 2, ", 0)");
8550
8738
  });
8551
8739
  }
8552
8740
  }
@@ -8565,14 +8753,14 @@ var WebsyChart = /*#__PURE__*/function () {
8565
8753
  }
8566
8754
  if (this.options.margin.axisLeft > 0) {
8567
8755
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8568
- if (_this51.options.data.left.formatter) {
8569
- d = _this51.options.data.left.formatter(d);
8756
+ if (_this53.options.data.left.formatter) {
8757
+ d = _this53.options.data.left.formatter(d);
8570
8758
  }
8571
8759
  return d;
8572
8760
  }));
8573
8761
  if (this.customLeftRange.length > 0) {
8574
8762
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8575
- return "translate(0, ".concat(_this51.customLeftRange[i] + (_this51.customLeftRange[i + 1] - _this51.customLeftRange[i]) / 2, ")");
8763
+ return "translate(0, ".concat(_this53.customLeftRange[i] + (_this53.customLeftRange[i + 1] - _this53.customLeftRange[i]) / 2, ")");
8576
8764
  });
8577
8765
  }
8578
8766
  }
@@ -8600,8 +8788,8 @@ var WebsyChart = /*#__PURE__*/function () {
8600
8788
  }
8601
8789
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8602
8790
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8603
- if (_this51.options.data.right.formatter) {
8604
- d = _this51.options.data.right.formatter(d);
8791
+ if (_this53.options.data.right.formatter) {
8792
+ d = _this53.options.data.right.formatter(d);
8605
8793
  }
8606
8794
  return d;
8607
8795
  }));
@@ -8641,50 +8829,50 @@ var WebsyChart = /*#__PURE__*/function () {
8641
8829
  }, {
8642
8830
  key: "renderComponents",
8643
8831
  value: function renderComponents() {
8644
- var _this52 = this;
8832
+ var _this54 = this;
8645
8833
  // Draw the series data
8646
8834
  this.renderedKeys = {};
8647
8835
  this.options.data.series.forEach(function (series, index) {
8648
8836
  if (!series.key) {
8649
- series.key = _this52.createIdentity();
8837
+ series.key = _this54.createIdentity();
8650
8838
  }
8651
8839
  if (!series.color) {
8652
- series.color = _this52.options.colors[index % _this52.options.colors.length];
8840
+ series.color = _this54.options.colors[index % _this54.options.colors.length];
8653
8841
  }
8654
- _this52["render".concat(series.type || 'bar')](series, index);
8655
- _this52.renderLabels(series, index);
8656
- _this52.renderedKeys[series.key] = series.type;
8842
+ _this54["render".concat(series.type || 'bar')](series, index);
8843
+ _this54.renderLabels(series, index);
8844
+ _this54.renderedKeys[series.key] = series.type;
8657
8845
  });
8658
8846
  this.refLineLayer.selectAll('.reference-line').remove();
8659
8847
  this.refLineLayer.selectAll('.reference-line-label').remove();
8660
8848
  if (this.options.refLines && this.options.refLines.length > 0) {
8661
8849
  this.options.refLines.forEach(function (l) {
8662
- return _this52.renderRefLine(l);
8850
+ return _this54.renderRefLine(l);
8663
8851
  });
8664
8852
  }
8665
8853
  }
8666
8854
  }, {
8667
8855
  key: "renderarea",
8668
8856
  value: function renderarea(series, index) {
8669
- var _this53 = this;
8857
+ var _this55 = this;
8670
8858
  /* global d3 series index */
8671
8859
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8672
8860
  return d3.area().x(function (d) {
8673
- if (_this53.options.data[xAxis].scale === 'Time') {
8674
- return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
8861
+ if (_this55.options.data[xAxis].scale === 'Time') {
8862
+ return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
8675
8863
  } else {
8676
- var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
8677
- var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8678
- if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8679
- xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8864
+ var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
8865
+ var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8866
+ if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8867
+ xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8680
8868
  }
8681
8869
  return xPos;
8682
8870
  }
8683
8871
  }).y0(function (d) {
8684
- return _this53["".concat(yAxis, "Axis")](0);
8872
+ return _this55["".concat(yAxis, "Axis")](0);
8685
8873
  }).y1(function (d) {
8686
- return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8687
- }).curve(d3[curveStyle || _this53.options.curveStyle]);
8874
+ return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8875
+ }).curve(d3[curveStyle || _this55.options.curveStyle]);
8688
8876
  };
8689
8877
  var xAxis = 'bottom';
8690
8878
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8724,7 +8912,7 @@ var WebsyChart = /*#__PURE__*/function () {
8724
8912
  }, {
8725
8913
  key: "renderbar",
8726
8914
  value: function renderbar(series, index) {
8727
- var _this54 = this;
8915
+ var _this56 = this;
8728
8916
  /* global series index d3 */
8729
8917
  var xAxis = 'bottom';
8730
8918
  var yAxis = 'left';
@@ -8891,26 +9079,26 @@ var WebsyChart = /*#__PURE__*/function () {
8891
9079
  }
8892
9080
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8893
9081
  bars.attr('width', function (d, i) {
8894
- return Math.abs(getBarWidth.call(_this54, d, i, yAxis, xAxis));
9082
+ return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
8895
9083
  }).attr('height', function (d, i) {
8896
- return getBarHeight.call(_this54, d, i, yAxis, xAxis);
9084
+ return getBarHeight.call(_this56, d, i, yAxis, xAxis);
8897
9085
  }).attr('x', function (d, i) {
8898
- return getBarX.call(_this54, d, i, yAxis, xAxis);
9086
+ return getBarX.call(_this56, d, i, yAxis, xAxis);
8899
9087
  }).attr('y', function (d, i) {
8900
- return getBarY.call(_this54, d, i, yAxis, xAxis);
9088
+ return getBarY.call(_this56, d, i, yAxis, xAxis);
8901
9089
  })
8902
9090
  // .transition(this.transition)
8903
9091
  .attr('fill', function (d) {
8904
9092
  return d.y.color || d.color || series.color;
8905
9093
  });
8906
9094
  bars.enter().append('rect').attr('width', function (d, i) {
8907
- return Math.abs(getBarWidth.call(_this54, d, i, yAxis, xAxis));
9095
+ return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
8908
9096
  }).attr('height', function (d, i) {
8909
- return getBarHeight.call(_this54, d, i, yAxis, xAxis);
9097
+ return getBarHeight.call(_this56, d, i, yAxis, xAxis);
8910
9098
  }).attr('x', function (d, i) {
8911
- return getBarX.call(_this54, d, i, yAxis, xAxis);
9099
+ return getBarX.call(_this56, d, i, yAxis, xAxis);
8912
9100
  }).attr('y', function (d, i) {
8913
- return getBarY.call(_this54, d, i, yAxis, xAxis);
9101
+ return getBarY.call(_this56, d, i, yAxis, xAxis);
8914
9102
  })
8915
9103
  // .transition(this.transition)
8916
9104
  .attr('fill', function (d) {
@@ -8922,26 +9110,26 @@ var WebsyChart = /*#__PURE__*/function () {
8922
9110
  this.brushBarsInitialized[series.key] = true;
8923
9111
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8924
9112
  brushBars.attr('width', function (d, i) {
8925
- return Math.abs(getBarWidth.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9113
+ return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8926
9114
  }).attr('height', function (d, i) {
8927
- return getBarHeight.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9115
+ return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8928
9116
  }).attr('x', function (d, i) {
8929
- return getBarX.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9117
+ return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8930
9118
  }).attr('y', function (d, i) {
8931
- return getBarY.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9119
+ return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8932
9120
  })
8933
9121
  // .transition(this.transition)
8934
9122
  .attr('fill', function (d) {
8935
9123
  return d.y.color || d.color || series.color;
8936
9124
  });
8937
9125
  brushBars.enter().append('rect').attr('width', function (d, i) {
8938
- return Math.abs(getBarWidth.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9126
+ return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8939
9127
  }).attr('height', function (d, i) {
8940
- return getBarHeight.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9128
+ return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8941
9129
  }).attr('x', function (d, i) {
8942
- return getBarX.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9130
+ return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8943
9131
  }).attr('y', function (d, i) {
8944
- return getBarY.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9132
+ return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8945
9133
  })
8946
9134
  // .transition(this.transition)
8947
9135
  .attr('fill', function (d) {
@@ -8962,7 +9150,7 @@ var WebsyChart = /*#__PURE__*/function () {
8962
9150
  }, {
8963
9151
  key: "renderLabels",
8964
9152
  value: function renderLabels(series, index) {
8965
- var _this55 = this;
9153
+ var _this57 = this;
8966
9154
  /* global series index d3 WebsyDesigns */
8967
9155
  var xAxis = 'bottom';
8968
9156
  var yAxis = 'left';
@@ -8978,14 +9166,14 @@ var WebsyChart = /*#__PURE__*/function () {
8978
9166
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
8979
9167
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
8980
9168
  labels.attr('x', function (d) {
8981
- return getLabelX.call(_this55, d, series.labelPosition);
9169
+ return getLabelX.call(_this57, d, series.labelPosition);
8982
9170
  }).attr('y', function (d) {
8983
- return getLabelY.call(_this55, d, series.labelPosition);
9171
+ return getLabelY.call(_this57, d, series.labelPosition);
8984
9172
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
8985
- if (_this55.options.grouping === 'stacked' && d.y.value === 0) {
9173
+ if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
8986
9174
  return 'transparent';
8987
9175
  }
8988
- return _this55.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9176
+ return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8989
9177
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
8990
9178
  return d.y.label || d.y.value;
8991
9179
  }).each(function (d, i) {
@@ -9019,14 +9207,14 @@ var WebsyChart = /*#__PURE__*/function () {
9019
9207
  }
9020
9208
  });
9021
9209
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9022
- return getLabelX.call(_this55, d, series.labelPosition);
9210
+ return getLabelX.call(_this57, d, series.labelPosition);
9023
9211
  }).attr('y', function (d) {
9024
- return getLabelY.call(_this55, d, series.labelPosition);
9212
+ return getLabelY.call(_this57, d, series.labelPosition);
9025
9213
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9026
- if (_this55.options.grouping === 'stacked' && d.y.value === 0) {
9214
+ if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
9027
9215
  return 'transparent';
9028
9216
  }
9029
- return _this55.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9217
+ return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9030
9218
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9031
9219
  return d.y.label || d.y.value;
9032
9220
  }).each(function (d, i) {
@@ -9104,32 +9292,32 @@ var WebsyChart = /*#__PURE__*/function () {
9104
9292
  }, {
9105
9293
  key: "renderline",
9106
9294
  value: function renderline(series, index) {
9107
- var _this56 = this;
9295
+ var _this58 = this;
9108
9296
  /* global series index d3 */
9109
9297
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9110
9298
  return d3.line().x(function (d) {
9111
- if (_this56.options.orientation === 'horizontal') {
9112
- return _this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9299
+ if (_this58.options.orientation === 'horizontal') {
9300
+ return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9113
9301
  } else {
9114
- if (_this56.options.data[xAxis].scale === 'Time') {
9115
- return _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
9302
+ if (_this58.options.data[xAxis].scale === 'Time') {
9303
+ return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
9116
9304
  } else {
9117
- var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9118
- var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9119
- if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9120
- xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9305
+ var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
9306
+ var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9307
+ if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9308
+ xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9121
9309
  }
9122
9310
  return xPos;
9123
9311
  }
9124
9312
  }
9125
9313
  }).y(function (d) {
9126
- if (_this56.options.orientation === 'horizontal') {
9127
- var adjustment = _this56.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
9128
- return _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value)) + adjustment;
9314
+ if (_this58.options.orientation === 'horizontal') {
9315
+ var adjustment = _this58.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
9316
+ return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value)) + adjustment;
9129
9317
  } else {
9130
- return _this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9318
+ return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9131
9319
  }
9132
- }).curve(d3[curveStyle || _this56.options.curveStyle]);
9320
+ }).curve(d3[curveStyle || _this58.options.curveStyle]);
9133
9321
  };
9134
9322
  var xAxis = 'bottom';
9135
9323
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9238,14 +9426,14 @@ var WebsyChart = /*#__PURE__*/function () {
9238
9426
  }, {
9239
9427
  key: "rendersymbol",
9240
9428
  value: function rendersymbol(series, index) {
9241
- var _this57 = this;
9429
+ var _this59 = this;
9242
9430
  /* global d3 series index series.key */
9243
9431
  var drawSymbol = function drawSymbol(size) {
9244
9432
  return d3.symbol()
9245
9433
  // .type(d => {
9246
9434
  // return d3.symbols[0]
9247
9435
  // })
9248
- .size(size || _this57.options.symbolSize);
9436
+ .size(size || _this59.options.symbolSize);
9249
9437
  };
9250
9438
  var xAxis = 'bottom';
9251
9439
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9271,20 +9459,27 @@ var WebsyChart = /*#__PURE__*/function () {
9271
9459
  // else {
9272
9460
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9273
9461
  // }
9274
- var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
9275
- var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9276
- if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9277
- xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9278
- }
9279
- var adjustment = _this57.options.data[xAxis].scale === 'Time' || _this57.options.data[xAxis].scale === 'Linear' ? 0 : _this57.options.data[xAxis].bandWidth / 2;
9280
- if (_this57.options.orientation === 'horizontal') {
9281
- return "translate(".concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9462
+ var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9463
+ var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9464
+ if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9465
+ xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9466
+ }
9467
+ var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
9468
+ if (_this59.options.orientation === 'horizontal') {
9469
+ return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9282
9470
  } else {
9283
- if (_this57.options.data[xAxis].scale === 'Time') {
9284
- xPos = _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
9471
+ if (_this59.options.data[xAxis].scale === 'Time') {
9472
+ xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
9473
+ } else {
9474
+ var _xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9475
+ var _xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9476
+ if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9477
+ _xPos = _xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9478
+ }
9479
+ // return xPos
9285
9480
  }
9286
9481
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9287
- return "translate(".concat(xPos, ", ").concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9482
+ return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9288
9483
  }
9289
9484
  });
9290
9485
  // Enter
@@ -9299,20 +9494,27 @@ var WebsyChart = /*#__PURE__*/function () {
9299
9494
  }).attr('class', function (d) {
9300
9495
  return "symbol symbol_".concat(series.key);
9301
9496
  }).attr('transform', function (d) {
9302
- var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
9303
- var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9304
- if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9305
- xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9306
- }
9307
- var adjustment = _this57.options.data[xAxis].scale === 'Time' || _this57.options.data[xAxis].scale === 'Linear' ? 0 : _this57.options.data[xAxis].bandWidth / 2;
9308
- if (_this57.options.orientation === 'horizontal') {
9309
- return "translate(".concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9497
+ var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9498
+ var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9499
+ if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9500
+ xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9501
+ }
9502
+ var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
9503
+ if (_this59.options.orientation === 'horizontal') {
9504
+ return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9310
9505
  } else {
9311
- if (_this57.options.data[xAxis].scale === 'Time') {
9312
- xPos = _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
9506
+ if (_this59.options.data[xAxis].scale === 'Time') {
9507
+ xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
9508
+ } else {
9509
+ var _xIndex2 = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9510
+ var _xPos2 = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9511
+ if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9512
+ _xPos2 = _xPos2 + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9513
+ }
9514
+ // return xPos
9313
9515
  }
9314
9516
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9315
- return "translate(".concat(xPos, ", ").concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9517
+ return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9316
9518
  }
9317
9519
  });
9318
9520
  }
@@ -9935,7 +10137,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9935
10137
  }, {
9936
10138
  key: "resize",
9937
10139
  value: function resize() {
9938
- var _this58 = this;
10140
+ var _this60 = this;
9939
10141
  var el = document.getElementById(this.elementId);
9940
10142
  if (el) {
9941
10143
  // if (this.options.width) {
@@ -9946,7 +10148,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9946
10148
  // }
9947
10149
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9948
10150
  html += this._data.map(function (d, i) {
9949
- return _this58.getLegendItemHTML(d);
10151
+ return _this60.getLegendItemHTML(d);
9950
10152
  }).join('');
9951
10153
  html += "\n <div>\n ";
9952
10154
  el.innerHTML = html;
@@ -9982,8 +10184,12 @@ var WebsyKPI = /*#__PURE__*/function () {
9982
10184
  _classCallCheck(this, WebsyKPI);
9983
10185
  var DEFAULTS = {
9984
10186
  tooltip: {},
9985
- label: {},
9986
- value: {}
10187
+ label: {
10188
+ value: ''
10189
+ },
10190
+ value: {
10191
+ value: ''
10192
+ }
9987
10193
  };
9988
10194
  this.elementId = elementId;
9989
10195
  this.options = _extends({}, DEFAULTS, options);
@@ -10016,7 +10222,7 @@ var WebsyKPI = /*#__PURE__*/function () {
10016
10222
  if (this.options.icon) {
10017
10223
  html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
10018
10224
  }
10019
- 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 ");
10225
+ 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 ");
10020
10226
  if (this.options.tooltip && this.options.tooltip.value) {
10021
10227
  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 ");
10022
10228
  }
@@ -10086,14 +10292,14 @@ var WebsyMap = /*#__PURE__*/function () {
10086
10292
  }, {
10087
10293
  key: "render",
10088
10294
  value: function render() {
10089
- var _this59 = this;
10295
+ var _this61 = this;
10090
10296
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
10091
10297
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
10092
10298
  if (this.options.showLegend === true && this.options.data.polygons) {
10093
10299
  var legendData = this.options.data.polygons.map(function (s, i) {
10094
10300
  return {
10095
10301
  value: s.label || s.key,
10096
- color: s.color || _this59.options.colors[i % _this59.options.colors.length]
10302
+ color: s.color || _this61.options.colors[i % _this61.options.colors.length]
10097
10303
  };
10098
10304
  });
10099
10305
  var longestValue = legendData.map(function (s) {
@@ -10147,7 +10353,7 @@ var WebsyMap = /*#__PURE__*/function () {
10147
10353
  }
10148
10354
  if (this.polygons) {
10149
10355
  this.polygons.forEach(function (p) {
10150
- return _this59.map.removeLayer(p);
10356
+ return _this61.map.removeLayer(p);
10151
10357
  });
10152
10358
  }
10153
10359
  this.polygons = [];
@@ -10201,15 +10407,15 @@ var WebsyMap = /*#__PURE__*/function () {
10201
10407
  p.options = {};
10202
10408
  }
10203
10409
  if (!p.options.color) {
10204
- p.options.color = _this59.options.colors[i % _this59.options.colors.length];
10410
+ p.options.color = _this61.options.colors[i % _this61.options.colors.length];
10205
10411
  }
10206
10412
  var pol = L.polygon(p.data.map(function (c) {
10207
10413
  return c.map(function (d) {
10208
10414
  return [d.Latitude, d.Longitude];
10209
10415
  });
10210
- }), p.options).addTo(_this59.map);
10211
- _this59.polygons.push(pol);
10212
- _this59.map.fitBounds(pol.getBounds());
10416
+ }), p.options).addTo(_this61.map);
10417
+ _this61.polygons.push(pol);
10418
+ _this61.map.fitBounds(pol.getBounds());
10213
10419
  });
10214
10420
  }
10215
10421
  // if (this.data.markers.length > 0) {