@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('');
@@ -1667,6 +1711,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
1667
1711
  var contentEl = document.getElementById("".concat(this.elementId, "_content"));
1668
1712
  var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
1669
1713
  var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
1714
+ var headerEl = document.getElementById("".concat(this.elementId, "_header"));
1715
+ var headerPos = WebsyUtils.getElementPos(headerEl);
1716
+ var contentPos = WebsyUtils.getElementPos(contentEl);
1717
+ if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1718
+ contentEl.style.right = 'unset';
1719
+ if (headerPos.bottom + contentPos.height > window.innerHeight) {
1720
+ // contentEl.classList.add('on-top')
1721
+ contentEl.style.bottom = 'unset';
1722
+ } else {
1723
+ contentEl.style.top = 'unset';
1724
+ }
1725
+ }
1670
1726
  if (actionEl) {
1671
1727
  actionEl.classList.remove('active');
1672
1728
  }
@@ -1692,7 +1748,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1692
1748
  return;
1693
1749
  }
1694
1750
  if (event.target.classList.contains('websy-dropdown-header')) {
1695
- this.open();
1751
+ this.open(event);
1696
1752
  } else if (event.target.classList.contains('websy-dropdown-mask')) {
1697
1753
  this.close();
1698
1754
  } else if (event.target.classList.contains('websy-dropdown-item')) {
@@ -1806,18 +1862,28 @@ var WebsyDropdown = /*#__PURE__*/function () {
1806
1862
  }
1807
1863
  }, {
1808
1864
  key: "open",
1809
- value: function open(options) {
1865
+ value: function open(event) {
1810
1866
  var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1811
1867
  var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
1812
1868
  var contentEl = document.getElementById("".concat(this.elementId, "_content"));
1813
- var el = document.getElementById(this.elementId);
1814
- if (el) {
1815
- el.style.zIndex = 999;
1816
- }
1869
+ var headerEl = document.getElementById("".concat(this.elementId, "_header"));
1817
1870
  maskEl.classList.add('active');
1818
1871
  contentEl.classList.add('active');
1819
- if (WebsyUtils.getElementPos(contentEl).bottom > window.innerHeight) {
1820
- contentEl.classList.add('on-top');
1872
+ var headerPos = WebsyUtils.getElementPos(headerEl);
1873
+ var contentPos = WebsyUtils.getElementPos(contentEl);
1874
+ if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1875
+ contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
1876
+ contentEl.style.width = "".concat(headerEl.clientWidth, "px");
1877
+ if (headerPos.bottom + contentPos.height > window.innerHeight) {
1878
+ // contentEl.classList.add('on-top')
1879
+ contentEl.style.bottom = "calc(100vh - ".concat(headerPos.top, "px)");
1880
+ } else {
1881
+ contentEl.style.top = headerPos.bottom + 'px';
1882
+ }
1883
+ } else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
1884
+ var targetPos = WebsyUtils.getElementPos(event.target);
1885
+ contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
1886
+ contentEl.style.width = "".concat(targetPos.width, "px");
1821
1887
  }
1822
1888
  if (this.options.disableSearch !== true) {
1823
1889
  var searchEl = document.getElementById("".concat(this.elementId, "_search"));
@@ -1829,6 +1895,21 @@ var WebsyDropdown = /*#__PURE__*/function () {
1829
1895
  this.options.onOpen(this.elementId);
1830
1896
  }
1831
1897
  }
1898
+ }, {
1899
+ key: "items",
1900
+ set: function set(items) {
1901
+ this.options.items = _toConsumableArray(items);
1902
+ if (this.options.items.length > 0) {
1903
+ this.options.items = this.options.items.map(function (d, i) {
1904
+ if (typeof d.index === 'undefined') {
1905
+ d.index = i;
1906
+ }
1907
+ return d;
1908
+ });
1909
+ }
1910
+ this._originalData = _toConsumableArray(this.options.items);
1911
+ this.render();
1912
+ }
1832
1913
  }, {
1833
1914
  key: "render",
1834
1915
  value: function render() {
@@ -2047,9 +2128,7 @@ var WebsyForm = /*#__PURE__*/function () {
2047
2128
  };
2048
2129
  GlobalPubSub.subscribe('recaptchaready', this.recaptchaReady.bind(this));
2049
2130
  this.recaptchaResult = null;
2050
- this.options = _extends(defaults, {}, {
2051
- // defaults go here
2052
- }, options);
2131
+ this.options = _extends({}, defaults, options);
2053
2132
  if (!elementId) {
2054
2133
  console.log('No element Id provided');
2055
2134
  return;
@@ -2123,23 +2202,41 @@ var WebsyForm = /*#__PURE__*/function () {
2123
2202
  }, {
2124
2203
  key: "data",
2125
2204
  get: function get() {
2205
+ var _this14 = this;
2126
2206
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2127
2207
  var data = {};
2128
2208
  var temp = new FormData(formEl);
2129
2209
  temp.forEach(function (value, key) {
2130
- data[key] = value;
2210
+ if (_this14.fieldMap[key] && _this14.fieldMap[key].type === 'checkbox') {
2211
+ data[key] = true;
2212
+ }
2213
+ if (_this14.fieldMap[key] && _this14.fieldMap[key].instance && _this14.fieldMap[key].instance.value) {
2214
+ data[key] = _this14.fieldMap[key].instance.value;
2215
+ } else {
2216
+ data[key] = value;
2217
+ }
2131
2218
  });
2219
+ var keys = Object.keys(data);
2220
+ for (var key in this.fieldMap) {
2221
+ if (keys.indexOf(key) === -1) {
2222
+ if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
2223
+ data[key] = false;
2224
+ } else if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
2225
+ data[key] = this.fieldMap[key].instance.value;
2226
+ }
2227
+ }
2228
+ }
2132
2229
  return data;
2133
2230
  },
2134
2231
  set: function set(d) {
2135
- var _this14 = this;
2232
+ var _this15 = this;
2136
2233
  if (!this.options.fields) {
2137
2234
  this.options.fields = [];
2138
2235
  }
2139
2236
  var _loop = function _loop(key) {
2140
- _this14.options.fields.forEach(function (f) {
2237
+ _this15.options.fields.forEach(function (f) {
2141
2238
  if (f.field === key) {
2142
- _this14.setValue(key, d[key]);
2239
+ _this15.setValue(key, d[key]);
2143
2240
  // f.value = d[key]
2144
2241
  // const el = document.getElementById(`${this.elementId}_input_${f.field}`)
2145
2242
  // if (el) {
@@ -2198,6 +2295,7 @@ var WebsyForm = /*#__PURE__*/function () {
2198
2295
  value: function handleClick(event) {
2199
2296
  if (event.target.classList.contains('submit')) {
2200
2297
  event.preventDefault();
2298
+ event.stopPropagation();
2201
2299
  this.submitForm();
2202
2300
  } else if (event.target.classList.contains('cancel')) {
2203
2301
  event.preventDefault();
@@ -2339,7 +2437,7 @@ var WebsyForm = /*#__PURE__*/function () {
2339
2437
  }, {
2340
2438
  key: "processComponents",
2341
2439
  value: function processComponents(components, callbackFn) {
2342
- var _this15 = this;
2440
+ var _this16 = this;
2343
2441
  if (components.length === 0) {
2344
2442
  callbackFn();
2345
2443
  } else {
@@ -2348,11 +2446,11 @@ var WebsyForm = /*#__PURE__*/function () {
2348
2446
  if (!c.options.onChange) {
2349
2447
  c.options.onChange = function () {
2350
2448
  if (c.required || c.validate) {
2351
- _this15.validateField(c, c.instance.value);
2449
+ _this16.validateField(c, c.instance.value);
2352
2450
  }
2353
2451
  };
2354
2452
  }
2355
- c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
2453
+ c.instance = new WebsyDesigns[c.component]("".concat(_this16.elementId, "_input_").concat(c.field, "_component"), c.options);
2356
2454
  } else {
2357
2455
  // some user feedback here
2358
2456
  }
@@ -2362,13 +2460,13 @@ var WebsyForm = /*#__PURE__*/function () {
2362
2460
  }, {
2363
2461
  key: "recaptchaReady",
2364
2462
  value: function recaptchaReady() {
2365
- var _this16 = this;
2463
+ var _this17 = this;
2366
2464
  var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
2367
2465
  if (el) {
2368
2466
  grecaptcha.ready(function () {
2369
- grecaptcha.render("".concat(_this16.elementId, "_recaptcha"), {
2467
+ grecaptcha.render("".concat(_this17.elementId, "_recaptcha"), {
2370
2468
  sitekey: ENVIRONMENT.RECAPTCHA_KEY,
2371
- callback: _this16.validateRecaptcha.bind(_this16)
2469
+ callback: _this17.validateRecaptcha.bind(_this17)
2372
2470
  });
2373
2471
  });
2374
2472
  }
@@ -2376,20 +2474,21 @@ var WebsyForm = /*#__PURE__*/function () {
2376
2474
  }, {
2377
2475
  key: "render",
2378
2476
  value: function render(update, data) {
2379
- var _this17 = this;
2477
+ var _this18 = this;
2380
2478
  var el = document.getElementById(this.elementId);
2381
2479
  var componentsToProcess = [];
2382
2480
  if (el) {
2383
2481
  var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
2384
2482
  this.options.fields.forEach(function (f, i) {
2385
- _this17.fieldMap[f.field] = f;
2483
+ _this18.fieldMap[f.field] = f;
2484
+ f.owningElement = _this18.elementId;
2386
2485
  if (f.component) {
2387
2486
  componentsToProcess.push(f);
2388
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2487
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this18.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2389
2488
  } else if (f.type === 'longtext') {
2390
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.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(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2489
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2391
2490
  } else {
2392
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.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(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2491
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2393
2492
  }
2394
2493
  });
2395
2494
  if (this.options.useRecaptcha === true) {
@@ -2402,8 +2501,8 @@ var WebsyForm = /*#__PURE__*/function () {
2402
2501
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
2403
2502
  el.innerHTML = html;
2404
2503
  this.processComponents(componentsToProcess, function () {
2405
- if (_this17.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2406
- _this17.recaptchaReady();
2504
+ if (_this18.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2505
+ _this18.recaptchaReady();
2407
2506
  }
2408
2507
  });
2409
2508
  }
@@ -2418,6 +2517,10 @@ var WebsyForm = /*#__PURE__*/function () {
2418
2517
  var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
2419
2518
  if (el) {
2420
2519
  el.value = value;
2520
+ el.setAttribute('value', value);
2521
+ if (this.fieldMap[field].type === 'checkbox') {
2522
+ el.checked = value;
2523
+ }
2421
2524
  } else {
2422
2525
  console.error("Input for ".concat(field, " does not exist in form."));
2423
2526
  }
@@ -2429,7 +2532,7 @@ var WebsyForm = /*#__PURE__*/function () {
2429
2532
  }, {
2430
2533
  key: "submitForm",
2431
2534
  value: function submitForm() {
2432
- var _this18 = this;
2535
+ var _this19 = this;
2433
2536
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2434
2537
  var buttonEl = formEl.querySelector('button.websy-btn.submit');
2435
2538
  var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
@@ -2454,27 +2557,27 @@ var WebsyForm = /*#__PURE__*/function () {
2454
2557
  temp.forEach(function (value, key) {
2455
2558
  data[key] = value;
2456
2559
  });
2457
- if (_this18.options.url) {
2458
- var _this18$apiService;
2459
- var params = [_this18.options.url];
2460
- if (_this18.options.mode === 'update') {
2461
- params.push(_this18.options.id);
2560
+ if (_this19.options.url) {
2561
+ var _this19$apiService;
2562
+ var params = [_this19.options.url];
2563
+ if (_this19.options.mode === 'update') {
2564
+ params.push(_this19.options.id);
2462
2565
  }
2463
2566
  params.push(data);
2464
- (_this18$apiService = _this18.apiService)[_this18.options.mode].apply(_this18$apiService, params).then(function (result) {
2465
- if (_this18.options.clearAfterSave === true) {
2567
+ (_this19$apiService = _this19.apiService)[_this19.options.mode].apply(_this19$apiService, params).then(function (result) {
2568
+ if (_this19.options.clearAfterSave === true) {
2466
2569
  // this.render()
2467
2570
  formEl.reset();
2468
2571
  }
2469
2572
  buttonEl.removeAttribute('disabled');
2470
- _this18.options.onSuccess.call(_this18, result);
2573
+ _this19.options.onSuccess.call(_this19, result);
2471
2574
  }, function (err) {
2472
2575
  console.log('Error submitting form data:', err);
2473
- _this18.options.onError.call(_this18, err);
2576
+ _this19.options.onError.call(_this19, err);
2474
2577
  });
2475
- } else if (_this18.options.submitFn) {
2476
- _this18.options.submitFn(data, function () {
2477
- if (_this18.options.clearAfterSave === true) {
2578
+ } else if (_this19.options.submitFn) {
2579
+ _this19.options.submitFn(data, function () {
2580
+ if (_this19.options.clearAfterSave === true) {
2478
2581
  // this.render()
2479
2582
  formEl.reset();
2480
2583
  }
@@ -2581,6 +2684,12 @@ var MultiForm = /*#__PURE__*/function () {
2581
2684
  this.render();
2582
2685
  }
2583
2686
  _createClass(MultiForm, [{
2687
+ key: "addData",
2688
+ value: function addData(data) {
2689
+ this.formData = this.formData.concat(data);
2690
+ this.render();
2691
+ }
2692
+ }, {
2584
2693
  key: "addEntry",
2585
2694
  value: function addEntry() {
2586
2695
  var el = document.getElementById("".concat(this.elementId, "_container"));
@@ -2590,7 +2699,11 @@ var MultiForm = /*#__PURE__*/function () {
2590
2699
  newFormEl.classList.add('websy-multi-form-form-container');
2591
2700
  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 ");
2592
2701
  el.appendChild(newFormEl);
2593
- var formOptions = _extends({}, this.options);
2702
+ var formOptions = _extends({}, this.options, {
2703
+ fields: _toConsumableArray(this.options.fields.map(function (f) {
2704
+ return _extends({}, f);
2705
+ }))
2706
+ });
2594
2707
  this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2595
2708
  }
2596
2709
  }, {
@@ -2610,14 +2723,25 @@ var MultiForm = /*#__PURE__*/function () {
2610
2723
  var d = this.forms.map(function (f) {
2611
2724
  return f.data;
2612
2725
  });
2613
- // we don't return the last form
2614
- d.pop();
2726
+ console.log('forms data', d);
2727
+ if (this.options.allowAdd !== false) {
2728
+ // we don't return the last form
2729
+ d.pop();
2730
+ }
2615
2731
  return d;
2616
2732
  },
2617
2733
  set: function set(d) {
2618
2734
  this.formData = d;
2619
2735
  this.render();
2620
2736
  }
2737
+ }, {
2738
+ key: "deleted",
2739
+ get: function get() {
2740
+ var _this20 = this;
2741
+ return this.formData.filter(function (d) {
2742
+ return _this20.recordsToDelete.includes("".concat(d.id));
2743
+ });
2744
+ }
2621
2745
  }, {
2622
2746
  key: "handleClick",
2623
2747
  value: function handleClick(event) {
@@ -2662,7 +2786,7 @@ var MultiForm = /*#__PURE__*/function () {
2662
2786
  }, {
2663
2787
  key: "render",
2664
2788
  value: function render() {
2665
- var _this19 = this;
2789
+ var _this21 = this;
2666
2790
  this.forms = [];
2667
2791
  this.recordsToDelete = [];
2668
2792
  var el = document.getElementById("".concat(this.elementId, "_container"));
@@ -2670,9 +2794,9 @@ var MultiForm = /*#__PURE__*/function () {
2670
2794
  var html = '';
2671
2795
  this.formData.forEach(function (d) {
2672
2796
  d.formId = WebsyDesigns.Utils.createIdentity();
2673
- html += "\n <div id='".concat(_this19.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this19.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
2674
- if (_this19.options.allowDelete === true) {
2675
- html += "\n <button id='".concat(_this19.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this19.options.deleteButton, "\n </button>\n ");
2797
+ 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 ");
2798
+ if (_this21.options.allowDelete === true) {
2799
+ 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 ");
2676
2800
  }
2677
2801
  html += "\n </div>\n ";
2678
2802
  });
@@ -2681,15 +2805,25 @@ var MultiForm = /*#__PURE__*/function () {
2681
2805
  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 ");
2682
2806
  }
2683
2807
  el.innerHTML = html;
2684
- this.formData.forEach(function (d) {
2685
- var formOptions = _extends({}, _this19.options);
2686
- var formObject = new WebsyDesigns.Form("".concat(_this19.elementId, "_").concat(d.formId, "_form"), formOptions);
2808
+ this.forms = new Array(this.formData.length);
2809
+ this.formData.forEach(function (d, i) {
2810
+ var formOptions = _extends({}, _this21.options, {
2811
+ fields: _toConsumableArray(_this21.options.fields.map(function (f) {
2812
+ return _extends({}, f);
2813
+ }))
2814
+ });
2815
+ var formObject = new WebsyDesigns.Form("".concat(_this21.elementId, "_").concat(d.formId, "_form"), formOptions);
2687
2816
  formObject.data = d;
2688
- _this19.forms.push(formObject);
2817
+ _this21.forms[i] = formObject;
2689
2818
  });
2690
2819
  if (this.options.allowAdd === true) {
2691
- var formOptions = _extends({}, this.options);
2692
- this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions));
2820
+ var formOptions = _extends({}, this.options, {
2821
+ fields: _toConsumableArray(this.options.fields.map(function (f) {
2822
+ return _extends({}, f);
2823
+ }))
2824
+ });
2825
+ var formObject = new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions);
2826
+ this.forms.push(formObject);
2693
2827
  }
2694
2828
  }
2695
2829
  }
@@ -2914,7 +3048,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2914
3048
  }, {
2915
3049
  key: "handleSearch",
2916
3050
  value: function handleSearch(searchText) {
2917
- var _this20 = this;
3051
+ var _this22 = this;
2918
3052
  var el = document.getElementById(this.elementId);
2919
3053
  // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
2920
3054
  var lowestItems = this.flatItems.filter(function (d) {
@@ -2925,7 +3059,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2925
3059
  if (searchText && searchText.length > 1) {
2926
3060
  defaultMethod = 'add';
2927
3061
  visibleItems = lowestItems.filter(function (d) {
2928
- return d[_this20.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3062
+ return d[_this22.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
2929
3063
  });
2930
3064
  }
2931
3065
  // hide everything
@@ -3107,7 +3241,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3107
3241
  /* global WebsyDesigns */
3108
3242
  var Pager = /*#__PURE__*/function () {
3109
3243
  function Pager(elementId, options) {
3110
- var _this21 = this;
3244
+ var _this23 = this;
3111
3245
  _classCallCheck(this, Pager);
3112
3246
  this.elementId = elementId;
3113
3247
  var DEFAULTS = {
@@ -3154,8 +3288,8 @@ var Pager = /*#__PURE__*/function () {
3154
3288
  allowClear: false,
3155
3289
  disableSearch: true,
3156
3290
  onItemSelected: function onItemSelected(selectedItem) {
3157
- if (_this21.options.onChangePageSize) {
3158
- _this21.options.onChangePageSize(selectedItem.value);
3291
+ if (_this23.options.onChangePageSize) {
3292
+ _this23.options.onChangePageSize(selectedItem.value);
3159
3293
  }
3160
3294
  }
3161
3295
  });
@@ -3176,11 +3310,11 @@ var Pager = /*#__PURE__*/function () {
3176
3310
  }, {
3177
3311
  key: "render",
3178
3312
  value: function render() {
3179
- var _this22 = this;
3313
+ var _this24 = this;
3180
3314
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3181
3315
  if (el) {
3182
3316
  var pages = this.options.pages.map(function (item, index) {
3183
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3317
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this24.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3184
3318
  });
3185
3319
  var startIndex = 0;
3186
3320
  if (this.options.pages.length > 8) {
@@ -3238,48 +3372,48 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3238
3372
  _createClass(WebsyPDFButton, [{
3239
3373
  key: "handleClick",
3240
3374
  value: function handleClick(event) {
3241
- var _this23 = this;
3375
+ var _this25 = this;
3242
3376
  if (event.target.classList.contains('websy-pdf-button')) {
3243
3377
  this.loader.show();
3244
3378
  setTimeout(function () {
3245
- if (_this23.options.targetId) {
3246
- var el = document.getElementById(_this23.options.targetId);
3379
+ if (_this25.options.targetId) {
3380
+ var el = document.getElementById(_this25.options.targetId);
3247
3381
  if (el) {
3248
3382
  var pdfData = {
3249
3383
  options: {}
3250
3384
  };
3251
- if (_this23.options.pdfOptions) {
3252
- pdfData.options = _extends({}, _this23.options.pdfOptions);
3385
+ if (_this25.options.pdfOptions) {
3386
+ pdfData.options = _extends({}, _this25.options.pdfOptions);
3253
3387
  }
3254
- if (_this23.options.header) {
3255
- if (_this23.options.header.elementId) {
3256
- var headerEl = document.getElementById(_this23.options.header.elementId);
3388
+ if (_this25.options.header) {
3389
+ if (_this25.options.header.elementId) {
3390
+ var headerEl = document.getElementById(_this25.options.header.elementId);
3257
3391
  if (headerEl) {
3258
3392
  pdfData.header = headerEl.outerHTML;
3259
- if (_this23.options.header.css) {
3260
- pdfData.options.headerCSS = _this23.options.header.css;
3393
+ if (_this25.options.header.css) {
3394
+ pdfData.options.headerCSS = _this25.options.header.css;
3261
3395
  }
3262
3396
  }
3263
- } else if (_this23.options.header.html) {
3264
- pdfData.header = _this23.options.header.html;
3265
- if (_this23.options.header.css) {
3266
- pdfData.options.headerCSS = _this23.options.header.css;
3397
+ } else if (_this25.options.header.html) {
3398
+ pdfData.header = _this25.options.header.html;
3399
+ if (_this25.options.header.css) {
3400
+ pdfData.options.headerCSS = _this25.options.header.css;
3267
3401
  }
3268
3402
  } else {
3269
- pdfData.header = _this23.options.header;
3403
+ pdfData.header = _this25.options.header;
3270
3404
  }
3271
3405
  }
3272
- if (_this23.options.footer) {
3273
- if (_this23.options.footer.elementId) {
3274
- var footerEl = document.getElementById(_this23.options.footer.elementId);
3406
+ if (_this25.options.footer) {
3407
+ if (_this25.options.footer.elementId) {
3408
+ var footerEl = document.getElementById(_this25.options.footer.elementId);
3275
3409
  if (footerEl) {
3276
3410
  pdfData.footer = footerEl.outerHTML;
3277
- if (_this23.options.footer.css) {
3278
- pdfData.options.footerCSS = _this23.options.footer.css;
3411
+ if (_this25.options.footer.css) {
3412
+ pdfData.options.footerCSS = _this25.options.footer.css;
3279
3413
  }
3280
3414
  }
3281
3415
  } else {
3282
- pdfData.footer = _this23.options.footer;
3416
+ pdfData.footer = _this25.options.footer;
3283
3417
  }
3284
3418
  }
3285
3419
  pdfData.html = el.outerHTML;
@@ -3287,25 +3421,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3287
3421
  // document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
3288
3422
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3289
3423
  // document.getElementById(`${this.elementId}_form`).submit()
3290
- _this23.service.add('', pdfData, {
3424
+ _this25.service.add('', pdfData, {
3291
3425
  responseType: 'blob'
3292
3426
  }).then(function (response) {
3293
- _this23.loader.hide();
3427
+ _this25.loader.hide();
3294
3428
  var blob = new Blob([response], {
3295
3429
  type: 'application/pdf'
3296
3430
  });
3297
3431
  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 ");
3298
- if (_this23.options.directDownload === true) {
3432
+ if (_this25.options.directDownload === true) {
3299
3433
  var fileName;
3300
- if (typeof _this23.options.fileName === 'function') {
3301
- fileName = _this23.options.fileName() || 'Export';
3434
+ if (typeof _this25.options.fileName === 'function') {
3435
+ fileName = _this25.options.fileName() || 'Export';
3302
3436
  } else {
3303
- fileName = _this23.options.fileName || 'Export';
3437
+ fileName = _this25.options.fileName || 'Export';
3304
3438
  }
3305
3439
  msg += "download='".concat(fileName, ".pdf'");
3306
3440
  }
3307
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this23.options.buttonText, "</button>\n </a>\n </div>\n ");
3308
- _this23.popup.show({
3441
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this25.options.buttonText, "</button>\n </a>\n </div>\n ");
3442
+ _this25.popup.show({
3309
3443
  message: msg,
3310
3444
  mask: true
3311
3445
  });
@@ -3454,6 +3588,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
3454
3588
  }, {
3455
3589
  key: "subscribe",
3456
3590
  value: function subscribe(id, method, fn) {
3591
+ if (!this.subscriptions) {
3592
+ this.subscriptions = {};
3593
+ }
3457
3594
  if (arguments.length === 3) {
3458
3595
  if (!this.subscriptions[id]) {
3459
3596
  this.subscriptions[id] = {};
@@ -3473,7 +3610,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3473
3610
  }();
3474
3611
  var ResponsiveText = /*#__PURE__*/function () {
3475
3612
  function ResponsiveText(elementId, options) {
3476
- var _this24 = this;
3613
+ var _this26 = this;
3477
3614
  _classCallCheck(this, ResponsiveText);
3478
3615
  var DEFAULTS = {
3479
3616
  textAlign: 'center',
@@ -3484,7 +3621,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3484
3621
  this.elementId = elementId;
3485
3622
  this.canvas = document.createElement('canvas');
3486
3623
  window.addEventListener('resize', function () {
3487
- return _this24.render();
3624
+ return _this26.render();
3488
3625
  });
3489
3626
  var el = document.getElementById(this.elementId);
3490
3627
  if (el) {
@@ -3674,7 +3811,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3674
3811
  /* global WebsyDesigns */
3675
3812
  var WebsyResultList = /*#__PURE__*/function () {
3676
3813
  function WebsyResultList(elementId, options) {
3677
- var _this25 = this;
3814
+ var _this27 = this;
3678
3815
  _classCallCheck(this, WebsyResultList);
3679
3816
  var DEFAULTS = {
3680
3817
  listeners: {
@@ -3700,8 +3837,8 @@ var WebsyResultList = /*#__PURE__*/function () {
3700
3837
  }
3701
3838
  if (_typeof(options.template) === 'object' && options.template.url) {
3702
3839
  this.templateService.get(options.template.url).then(function (templateString) {
3703
- _this25.options.template = templateString;
3704
- _this25.render();
3840
+ _this27.options.template = templateString;
3841
+ _this27.render();
3705
3842
  });
3706
3843
  } else {
3707
3844
  this.render();
@@ -3720,7 +3857,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3720
3857
  }, {
3721
3858
  key: "buildHTML",
3722
3859
  value: function buildHTML(d) {
3723
- var _this26 = this;
3860
+ var _this28 = this;
3724
3861
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3725
3862
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
3726
3863
  var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
@@ -3728,7 +3865,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3728
3865
  if (this.options.template) {
3729
3866
  if (d.length > 0) {
3730
3867
  d.forEach(function (row, ix) {
3731
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this26.options.template).concat(ix < d.length - 1 ? '<!--' : '');
3868
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this28.options.template).concat(ix < d.length - 1 ? '<!--' : '');
3732
3869
  // find conditional elements
3733
3870
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3734
3871
  ifMatches.forEach(function (m) {
@@ -3816,7 +3953,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3816
3953
  parts.forEach(function (p) {
3817
3954
  items = items[p];
3818
3955
  });
3819
- template = template.replace(m[0], _this26.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
3956
+ template = template.replace(m[0], _this28.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
3820
3957
  }
3821
3958
  });
3822
3959
  var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
@@ -3825,7 +3962,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3825
3962
  template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
3826
3963
  }
3827
3964
  });
3828
- var flatRow = _this26.flattenObject(row);
3965
+ var flatRow = _this28.flattenObject(row);
3829
3966
  for (var key in flatRow) {
3830
3967
  var rg = new RegExp("{".concat(key, "}"), 'gm');
3831
3968
  template = template.replace(rg, flatRow[key] || '');
@@ -3950,15 +4087,15 @@ var WebsyResultList = /*#__PURE__*/function () {
3950
4087
  }, {
3951
4088
  key: "render",
3952
4089
  value: function render() {
3953
- var _this27 = this;
4090
+ var _this29 = this;
3954
4091
  if (this.options.entity) {
3955
4092
  var url = this.options.entity;
3956
4093
  if (this.options.sortField) {
3957
4094
  url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
3958
4095
  }
3959
4096
  this.apiService.get(url).then(function (results) {
3960
- _this27.rows = results.rows;
3961
- _this27.resize();
4097
+ _this29.rows = results.rows;
4098
+ _this29.resize();
3962
4099
  });
3963
4100
  } else {
3964
4101
  this.resize();
@@ -4028,12 +4165,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4028
4165
  _createClass(WebsyRouter, [{
4029
4166
  key: "addGroup",
4030
4167
  value: function addGroup(group) {
4031
- var _this28 = this;
4168
+ var _this30 = this;
4032
4169
  if (!this.groups[group]) {
4033
4170
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4034
4171
  if (els) {
4035
4172
  this.getClosestParent(els[0], function (parent) {
4036
- _this28.groups[group] = {
4173
+ _this30.groups[group] = {
4037
4174
  activeView: '',
4038
4175
  views: [],
4039
4176
  parent: parent.getAttribute('data-view')
@@ -4097,7 +4234,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4097
4234
  }, {
4098
4235
  key: "removeUrlParams",
4099
4236
  value: function removeUrlParams() {
4100
- var _this29 = this;
4237
+ var _this31 = this;
4101
4238
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4102
4239
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4103
4240
  var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -4105,7 +4242,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4105
4242
  var path = '';
4106
4243
  if (this.currentParams && this.currentParams.items) {
4107
4244
  params.forEach(function (p) {
4108
- delete _this29.currentParams.items[p];
4245
+ delete _this31.currentParams.items[p];
4109
4246
  });
4110
4247
  path = this.buildUrlPath(this.currentParams.items);
4111
4248
  }
@@ -4436,11 +4573,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4436
4573
  }, {
4437
4574
  key: "showComponents",
4438
4575
  value: function showComponents(view) {
4439
- var _this30 = this;
4576
+ var _this32 = this;
4440
4577
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4441
4578
  this.options.views[view].components.forEach(function (c) {
4442
4579
  if (typeof c.instance === 'undefined') {
4443
- _this30.prepComponent(c.elementId, c.options);
4580
+ _this32.prepComponent(c.elementId, c.options);
4444
4581
  c.instance = new c.Component(c.elementId, c.options);
4445
4582
  } else if (c.instance.render) {
4446
4583
  c.instance.render();
@@ -4784,7 +4921,7 @@ var Switch = /*#__PURE__*/function () {
4784
4921
  /* global WebsyDesigns */
4785
4922
  var WebsyTemplate = /*#__PURE__*/function () {
4786
4923
  function WebsyTemplate(elementId, options) {
4787
- var _this31 = this;
4924
+ var _this33 = this;
4788
4925
  _classCallCheck(this, WebsyTemplate);
4789
4926
  var DEFAULTS = {
4790
4927
  listeners: {
@@ -4804,8 +4941,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
4804
4941
  }
4805
4942
  if (_typeof(options.template) === 'object' && options.template.url) {
4806
4943
  this.templateService.get(options.template.url).then(function (templateString) {
4807
- _this31.options.template = templateString;
4808
- _this31.render();
4944
+ _this33.options.template = templateString;
4945
+ _this33.render();
4809
4946
  });
4810
4947
  } else {
4811
4948
  this.render();
@@ -4814,7 +4951,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
4814
4951
  _createClass(WebsyTemplate, [{
4815
4952
  key: "buildHTML",
4816
4953
  value: function buildHTML() {
4817
- var _this32 = this;
4954
+ var _this34 = this;
4818
4955
  var html = "";
4819
4956
  if (this.options.template) {
4820
4957
  var template = this.options.template;
@@ -4863,14 +5000,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
4863
5000
  }
4864
5001
  }
4865
5002
  if (polarity === true) {
4866
- if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] === parts[1]) {
5003
+ if (typeof _this34.options.data[parts[0]] !== 'undefined' && _this34.options.data[parts[0]] === parts[1]) {
4867
5004
  // remove the <if> tags
4868
5005
  removeAll = false;
4869
5006
  } else if (parts[0] === parts[1]) {
4870
5007
  removeAll = false;
4871
5008
  }
4872
5009
  } else if (polarity === false) {
4873
- if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] !== parts[1]) {
5010
+ if (typeof _this34.options.data[parts[0]] !== 'undefined' && _this34.options.data[parts[0]] !== parts[1]) {
4874
5011
  // remove the <if> tags
4875
5012
  removeAll = false;
4876
5013
  }
@@ -4907,7 +5044,55 @@ var WebsyTemplate = /*#__PURE__*/function () {
4907
5044
  }, {
4908
5045
  key: "handleClick",
4909
5046
  value: function handleClick(event) {
4910
- //
5047
+ if (event.target.classList.contains('clickable')) {
5048
+ this.handleEvent(event, 'clickable', 'click');
5049
+ }
5050
+ }
5051
+ }, {
5052
+ key: "handleEvent",
5053
+ value: function handleEvent(event, eventType, action) {
5054
+ var l = event.target.getAttribute('data-event');
5055
+ if (l) {
5056
+ l = l.split('(');
5057
+ var params = [];
5058
+ var id = event.target.getAttribute('data-id');
5059
+ // const locator = event.target.getAttribute('data-locator')
5060
+ // if (l[1]) {
5061
+ // l[1] = l[1].replace(')', '')
5062
+ // params = l[1].split(',')
5063
+ // }
5064
+ // l = l[0]
5065
+ var data = this.options.data;
5066
+ // if (locator !== '') {
5067
+ // let locatorItems = locator.split(';')
5068
+ // locatorItems.forEach(loc => {
5069
+ // let locatorParts = loc.split(':')
5070
+ // if (data[locatorParts[0]]) {
5071
+ // data = data[locatorParts[0]]
5072
+ // let parts = locatorParts[1].split('.')
5073
+ // parts.forEach(p => {
5074
+ // data = data[p]
5075
+ // })
5076
+ // }
5077
+ // })
5078
+ // }
5079
+ // params = params.map(p => {
5080
+ // if (typeof p !== 'string' && typeof p !== 'number') {
5081
+ // if (data[+id]) {
5082
+ // p = data[+id][p]
5083
+ // }
5084
+ // }
5085
+ // else if (typeof p === 'string') {
5086
+ // p = p.replace(/"/g, '').replace(/'/g, '')
5087
+ // }
5088
+ // return p
5089
+ // })
5090
+ if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
5091
+ var _this$options$listene2;
5092
+ event.stopPropagation();
5093
+ (_this$options$listene2 = this.options.listeners[action][l]).call.apply(_this$options$listene2, [this, event, data[+id]].concat(params));
5094
+ }
5095
+ }
4911
5096
  }
4912
5097
  }, {
4913
5098
  key: "render",
@@ -4945,7 +5130,9 @@ var WebsyUtils = {
4945
5130
  top: rect.top + scrollTop,
4946
5131
  left: rect.left + scrollLeft,
4947
5132
  bottom: rect.top + scrollTop + el.clientHeight,
4948
- right: rect.left + scrollLeft + el.clientWidth
5133
+ right: rect.left + scrollLeft + el.clientWidth,
5134
+ width: rect.width,
5135
+ height: rect.height
4949
5136
  };
4950
5137
  },
4951
5138
  getLightDark: function getLightDark(backgroundColor) {
@@ -5129,7 +5316,7 @@ var WebsyUtils = {
5129
5316
  /* global WebsyDesigns */
5130
5317
  var WebsyTable = /*#__PURE__*/function () {
5131
5318
  function WebsyTable(elementId, options) {
5132
- var _this33 = this;
5319
+ var _this35 = this;
5133
5320
  _classCallCheck(this, WebsyTable);
5134
5321
  var DEFAULTS = {
5135
5322
  pageSize: 20,
@@ -5161,8 +5348,8 @@ var WebsyTable = /*#__PURE__*/function () {
5161
5348
  allowClear: false,
5162
5349
  disableSearch: true,
5163
5350
  onItemSelected: function onItemSelected(selectedItem) {
5164
- if (_this33.options.onChangePageSize) {
5165
- _this33.options.onChangePageSize(selectedItem.value);
5351
+ if (_this35.options.onChangePageSize) {
5352
+ _this35.options.onChangePageSize(selectedItem.value);
5166
5353
  }
5167
5354
  }
5168
5355
  });
@@ -5181,19 +5368,19 @@ var WebsyTable = /*#__PURE__*/function () {
5181
5368
  _createClass(WebsyTable, [{
5182
5369
  key: "appendRows",
5183
5370
  value: function appendRows(data) {
5184
- var _this34 = this;
5371
+ var _this36 = this;
5185
5372
  this.hideError();
5186
5373
  var bodyHTML = '';
5187
5374
  if (data) {
5188
5375
  bodyHTML += data.map(function (r, rowIndex) {
5189
5376
  return '<tr>' + r.map(function (c, i) {
5190
- if (_this34.options.columns[i].show !== false) {
5377
+ if (_this36.options.columns[i].show !== false) {
5191
5378
  var style = '';
5192
5379
  if (c.style) {
5193
5380
  style += c.style;
5194
5381
  }
5195
- if (_this34.options.columns[i].width) {
5196
- style += "width: ".concat(_this34.options.columns[i].width, "; ");
5382
+ if (_this36.options.columns[i].width) {
5383
+ style += "width: ".concat(_this36.options.columns[i].width, "; ");
5197
5384
  }
5198
5385
  if (c.backgroundColor) {
5199
5386
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5204,16 +5391,16 @@ var WebsyTable = /*#__PURE__*/function () {
5204
5391
  if (c.color) {
5205
5392
  style += "color: ".concat(c.color, "; ");
5206
5393
  }
5207
- if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5208
- return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5209
- } else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5210
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
5394
+ if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5395
+ return "\n <td \n data-row-index='".concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this36.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5396
+ } else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5397
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this36.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this36.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</td>\n ");
5211
5398
  } else {
5212
5399
  var info = c.value;
5213
- if (_this34.options.columns[i].showAsImage === true) {
5400
+ if (_this36.options.columns[i].showAsImage === true) {
5214
5401
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5215
5402
  }
5216
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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 ");
5403
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5217
5404
  }
5218
5405
  }
5219
5406
  }).join('') + '</tr>';
@@ -5372,7 +5559,7 @@ var WebsyTable = /*#__PURE__*/function () {
5372
5559
  }, {
5373
5560
  key: "render",
5374
5561
  value: function render(data) {
5375
- var _this35 = this;
5562
+ var _this37 = this;
5376
5563
  if (!this.options.columns) {
5377
5564
  return;
5378
5565
  }
@@ -5399,7 +5586,7 @@ var WebsyTable = /*#__PURE__*/function () {
5399
5586
  if (c.width) {
5400
5587
  style += "width: ".concat(c.width || 'auto', ";");
5401
5588
  }
5402
- 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 ? _this35.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5589
+ return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this37.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5403
5590
  }
5404
5591
  }).join('') + '</tr>';
5405
5592
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5417,7 +5604,7 @@ var WebsyTable = /*#__PURE__*/function () {
5417
5604
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
5418
5605
  if (pagingEl) {
5419
5606
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5420
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5607
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5421
5608
  });
5422
5609
  var startIndex = 0;
5423
5610
  if (this.options.pageCount > 8) {
@@ -5472,7 +5659,7 @@ var WebsyTable = /*#__PURE__*/function () {
5472
5659
  /* global WebsyDesigns */
5473
5660
  var WebsyTable2 = /*#__PURE__*/function () {
5474
5661
  function WebsyTable2(elementId, options) {
5475
- var _this36 = this;
5662
+ var _this38 = this;
5476
5663
  _classCallCheck(this, WebsyTable2);
5477
5664
  var DEFAULTS = {
5478
5665
  pageSize: 20,
@@ -5507,8 +5694,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5507
5694
  allowClear: false,
5508
5695
  disableSearch: true,
5509
5696
  onItemSelected: function onItemSelected(selectedItem) {
5510
- if (_this36.options.onChangePageSize) {
5511
- _this36.options.onChangePageSize(selectedItem.value);
5697
+ if (_this38.options.onChangePageSize) {
5698
+ _this38.options.onChangePageSize(selectedItem.value);
5512
5699
  }
5513
5700
  }
5514
5701
  });
@@ -5530,20 +5717,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
5530
5717
  _createClass(WebsyTable2, [{
5531
5718
  key: "appendRows",
5532
5719
  value: function appendRows(data) {
5533
- var _this37 = this;
5720
+ var _this39 = this;
5534
5721
  this.hideError();
5535
5722
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5536
5723
  var bodyHTML = '';
5537
5724
  if (data) {
5538
5725
  bodyHTML += data.map(function (r, rowIndex) {
5539
5726
  return '<tr>' + r.map(function (c, i) {
5540
- if (_this37.options.columns[i].show !== false) {
5541
- var style = "height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px;");
5727
+ if (_this39.options.columns[i].show !== false) {
5728
+ var style = "height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px;");
5542
5729
  if (c.style) {
5543
5730
  style += c.style;
5544
5731
  }
5545
- if (_this37.options.columns[i].width) {
5546
- style += "width: ".concat(_this37.options.columns[i].width, "; ");
5732
+ if (_this39.options.columns[i].width) {
5733
+ style += "width: ".concat(_this39.options.columns[i].width, "; ");
5547
5734
  }
5548
5735
  if (c.backgroundColor) {
5549
5736
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5554,16 +5741,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
5554
5741
  if (c.color) {
5555
5742
  style += "color: ".concat(c.color, "; ");
5556
5743
  }
5557
- if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5558
- 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 ");
5559
- } else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5560
- 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 ");
5744
+ if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5745
+ 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 ");
5746
+ } else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5747
+ 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 ");
5561
5748
  } else {
5562
5749
  var info = c.value;
5563
- if (_this37.options.columns[i].showAsImage === true) {
5750
+ if (_this39.options.columns[i].showAsImage === true) {
5564
5751
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5565
5752
  }
5566
- 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 ");
5753
+ 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 ");
5567
5754
  }
5568
5755
  }
5569
5756
  }).join('') + '</tr>';
@@ -5797,7 +5984,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5797
5984
  }, {
5798
5985
  key: "render",
5799
5986
  value: function render(data) {
5800
- var _this38 = this;
5987
+ var _this40 = this;
5801
5988
  if (!this.options.columns) {
5802
5989
  return;
5803
5990
  }
@@ -5825,7 +6012,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5825
6012
  if (c.width) {
5826
6013
  style += "width: ".concat(c.width || 'auto', "; ");
5827
6014
  }
5828
- 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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6015
+ return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this40.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5829
6016
  }
5830
6017
  }).join('') + '</tr>';
5831
6018
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5835,7 +6022,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5835
6022
  var dropdownHTML = "";
5836
6023
  this.options.columns.forEach(function (c, i) {
5837
6024
  if (c.searchable && c.searchField) {
5838
- dropdownHTML += "\n <div id=\"".concat(_this38.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6025
+ dropdownHTML += "\n <div id=\"".concat(_this40.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
5839
6026
  }
5840
6027
  });
5841
6028
  dropdownEl.innerHTML = dropdownHTML;
@@ -5855,7 +6042,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5855
6042
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
5856
6043
  if (pagingEl) {
5857
6044
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5858
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6045
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5859
6046
  });
5860
6047
  var startIndex = 0;
5861
6048
  if (this.options.pageCount > 8) {
@@ -5932,17 +6119,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
5932
6119
  }, {
5933
6120
  key: "getColumnParameters",
5934
6121
  value: function getColumnParameters(values) {
5935
- var _this39 = this;
6122
+ var _this41 = this;
5936
6123
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
5937
6124
  tableEl.style.tableLayout = 'auto';
5938
6125
  tableEl.style.width = 'auto';
5939
6126
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
5940
6127
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5941
6128
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
5942
- 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 ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6129
+ return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this41.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5943
6130
  }).join('') + '</tr>';
5944
6131
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
5945
- return "\n <td \n style='height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6132
+ return "\n <td \n style='height: ".concat(_this41.options.cellSize, "px; line-height: ").concat(_this41.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
5946
6133
  }).join('') + '</tr>';
5947
6134
  // get height of the first data cell
5948
6135
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6098,7 +6285,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6098
6285
  }, {
6099
6286
  key: "buildBodyHtml",
6100
6287
  value: function buildBodyHtml() {
6101
- var _this40 = this;
6288
+ var _this42 = this;
6102
6289
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6103
6290
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6104
6291
  if (!this.options.columns) {
@@ -6123,7 +6310,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6123
6310
  row.forEach(function (cell, cellIndex) {
6124
6311
  var sizeIndex = cell.level || cellIndex;
6125
6312
  var colIndex = cell.index || cellIndex;
6126
- if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6313
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || _this42.options.columns[_this42.options.columns.length - 1][colIndex].show === false) {
6127
6314
  return; // need to revisit this logic
6128
6315
  }
6129
6316
 
@@ -6150,7 +6337,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6150
6337
  style += "color: ".concat(cell.color, "; ");
6151
6338
  }
6152
6339
  // console.log('rowspan', cell.rowspan)
6153
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this40.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 ");
6340
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this42.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n ");
6154
6341
  // if (useWidths === true) {
6155
6342
  // bodyHtml += `
6156
6343
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6159,10 +6346,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6159
6346
  // }
6160
6347
  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 >");
6161
6348
  if (cell.expandable === true) {
6162
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this40.options.plusIcon, "</i>");
6349
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this42.options.plusIcon, "</i>");
6163
6350
  }
6164
6351
  if (cell.collapsable === true) {
6165
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this40.options.minusIcon, "</i>");
6352
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this42.options.minusIcon, "</i>");
6166
6353
  }
6167
6354
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6168
6355
  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 ");
@@ -6183,7 +6370,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6183
6370
  }, {
6184
6371
  key: "buildHeaderHtml",
6185
6372
  value: function buildHeaderHtml() {
6186
- var _this41 = this;
6373
+ var _this43 = this;
6187
6374
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6188
6375
  if (!this.options.columns) {
6189
6376
  return '';
@@ -6200,7 +6387,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6200
6387
  headerHtml += '</colgroup>';
6201
6388
  }
6202
6389
  this.options.columns.forEach(function (row, rowIndex) {
6203
- if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
6390
+ if (useWidths === false && rowIndex !== _this43.options.columns.length - 1) {
6204
6391
  // if we're calculating the size we only want to render the last row of column headers
6205
6392
  return;
6206
6393
  }
@@ -6224,24 +6411,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6224
6411
  if (col.style) {
6225
6412
  style += col.style;
6226
6413
  }
6227
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6414
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this43.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6228
6415
  // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6229
6416
  // headerHtml += `
6230
6417
  // style='width: ${col.width || col.actualWidth}px'
6231
6418
  // width='${col.width || col.actualWidth}'
6232
6419
  // `
6233
6420
  // }
6234
- 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 ? _this41.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this41.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6421
+ headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this43.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this43.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6235
6422
  });
6236
6423
  headerHtml += "</tr>";
6237
6424
  });
6238
6425
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6239
6426
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6240
6427
  if (c.searchable && c.isExternalSearch === true) {
6241
- var testEl = document.getElementById("".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i));
6428
+ var testEl = document.getElementById("".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i));
6242
6429
  if (!testEl) {
6243
6430
  var newE = document.createElement('div');
6244
- newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
6431
+ newE.id = "".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i);
6245
6432
  newE.className = 'websy-modal-dropdown';
6246
6433
  dropdownEl.appendChild(newE);
6247
6434
  }
@@ -6264,7 +6451,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6264
6451
  }, {
6265
6452
  key: "buildTotalHtml",
6266
6453
  value: function buildTotalHtml() {
6267
- var _this42 = this;
6454
+ var _this44 = this;
6268
6455
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6269
6456
  if (!this.options.totals) {
6270
6457
  return '';
@@ -6280,7 +6467,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6280
6467
 
6281
6468
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6282
6469
  if (useWidths === true) {
6283
- totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6470
+ totalHtml += "\n style='width: ".concat(_this44.options.columns[_this44.options.columns.length - 1][colIndex].width || _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6284
6471
  }
6285
6472
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
6286
6473
  });
@@ -6290,7 +6477,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6290
6477
  }, {
6291
6478
  key: "calculateSizes",
6292
6479
  value: function calculateSizes() {
6293
- var _this43 = this;
6480
+ var _this45 = this;
6294
6481
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6295
6482
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
6296
6483
  var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
@@ -6334,7 +6521,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6334
6521
  rows.forEach(function (row, rowIndex) {
6335
6522
  Array.from(row.children).forEach(function (col, colIndex) {
6336
6523
  var colSize = col.getBoundingClientRect();
6337
- _this43.sizes.cellHeight = colSize.height;
6524
+ _this45.sizes.cellHeight = colSize.height;
6338
6525
  if (columnsForSizing[colIndex]) {
6339
6526
  if (!columnsForSizing[colIndex].actualWidth) {
6340
6527
  columnsForSizing[colIndex].potentialWidth = 0;
@@ -6346,7 +6533,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6346
6533
  // columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
6347
6534
  // }
6348
6535
  columnsForSizing[colIndex].cellHeight = colSize.height;
6349
- if (colIndex >= _this43.pinnedColumns) {
6536
+ if (colIndex >= _this45.pinnedColumns) {
6350
6537
  firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
6351
6538
  }
6352
6539
  }
@@ -6361,7 +6548,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6361
6548
  return a + (b.width || b.actualWidth);
6362
6549
  }, 0);
6363
6550
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
6364
- return i >= _this43.pinnedColumns;
6551
+ return i >= _this45.pinnedColumns;
6365
6552
  }).reduce(function (a, b) {
6366
6553
  return a + (b.width || b.actualWidth);
6367
6554
  }, 0);
@@ -6372,7 +6559,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6372
6559
  var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
6373
6560
  columnsForSizing.forEach(function (c) {
6374
6561
  c.shouldGrow = true;
6375
- if (_this43.options.autoFitColumns === false) {
6562
+ if (_this45.options.autoFitColumns === false) {
6376
6563
  c.shouldGrow = false;
6377
6564
  if (c.potentialWidth > c.actualWidth) {
6378
6565
  c.shouldGrow = true;
@@ -6391,7 +6578,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6391
6578
  // if (!c.width) {
6392
6579
  // if (c.actualWidth < equalWidth) {
6393
6580
  // adjust the width
6394
- if (_this43.options.autoFitColumns === true) {
6581
+ if (_this45.options.autoFitColumns === true) {
6395
6582
  if (c.width) {
6396
6583
  c.width += equalWidth;
6397
6584
  }
@@ -6415,9 +6602,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6415
6602
  }
6416
6603
  // }
6417
6604
  // }
6418
- _this43.sizes.totalWidth += c.width || c.actualWidth;
6419
- if (i > _this43.pinnedColumns) {
6420
- _this43.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6605
+ _this45.sizes.totalWidth += c.width || c.actualWidth;
6606
+ if (i > _this45.pinnedColumns) {
6607
+ _this45.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6421
6608
  }
6422
6609
  // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6423
6610
  });
@@ -6476,7 +6663,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6476
6663
  }, {
6477
6664
  key: "createSample",
6478
6665
  value: function createSample(data) {
6479
- var _this44 = this;
6666
+ var _this46 = this;
6480
6667
  var output = [];
6481
6668
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
6482
6669
  if (col.maxLength) {
@@ -6486,7 +6673,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6486
6673
  } else if (data) {
6487
6674
  var longest = '';
6488
6675
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
6489
- if (data[i].length === _this44.options.columns[_this44.options.columns.length - 1].length) {
6676
+ if (data[i].length === _this46.options.columns[_this46.options.columns.length - 1].length) {
6490
6677
  if (longest.length < data[i][colIndex].value.length) {
6491
6678
  longest = data[i][colIndex].value;
6492
6679
  }
@@ -6758,7 +6945,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6758
6945
  }, {
6759
6946
  key: "perpetualScroll",
6760
6947
  value: function perpetualScroll() {
6761
- var _this45 = this;
6948
+ var _this47 = this;
6762
6949
  // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
6763
6950
  if (this.touchEndTime - this.currentTouchtime > 300) {
6764
6951
  return;
@@ -6777,17 +6964,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
6777
6964
  var direction = touchDistance > 0 ? -1 : 1;
6778
6965
  var _loop2 = function _loop2(i) {
6779
6966
  setTimeout(function () {
6780
- var delta = _this45.mouseYStart - _this45.currentClientY + _this45.sizes.cellHeight * (i + 1) * direction;
6967
+ var delta = _this47.mouseYStart - _this47.currentClientY + _this47.sizes.cellHeight * (i + 1) * direction;
6781
6968
  delta = Math.min(10, delta);
6782
6969
  delta = Math.max(-10, delta);
6783
6970
  // only run this if isPerpetual === true
6784
6971
  // this value is reset to false on touchStart
6785
- if (_this45.isPerpetual === true) {
6972
+ if (_this47.isPerpetual === true) {
6786
6973
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6787
6974
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
6788
- _this45.scrollY(Math.max(-5, Math.min(5, delta)));
6789
- if (_this45.scrollTimeout) {
6790
- clearTimeout(_this45.scrollTimeout);
6975
+ _this47.scrollY(Math.max(-5, Math.min(5, delta)));
6976
+ if (_this47.scrollTimeout) {
6977
+ clearTimeout(_this47.scrollTimeout);
6791
6978
  }
6792
6979
  }
6793
6980
  }, 1000 / fps * i);
@@ -7055,7 +7242,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7055
7242
  /* global d3 include WebsyDesigns */
7056
7243
  var WebsyChart = /*#__PURE__*/function () {
7057
7244
  function WebsyChart(elementId, options) {
7058
- var _this46 = this;
7245
+ var _this48 = this;
7059
7246
  _classCallCheck(this, WebsyChart);
7060
7247
  var DEFAULTS = {
7061
7248
  margin: {
@@ -7112,7 +7299,7 @@ var WebsyChart = /*#__PURE__*/function () {
7112
7299
  this.invertOverride = function (input, input2) {
7113
7300
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7114
7301
  var xAxis = 'bottom';
7115
- if (_this46.options.orientation === 'horizontal') {
7302
+ if (_this48.options.orientation === 'horizontal') {
7116
7303
  xAxis = 'left';
7117
7304
  }
7118
7305
  if (forBrush === true) {
@@ -7120,12 +7307,12 @@ var WebsyChart = /*#__PURE__*/function () {
7120
7307
  }
7121
7308
  xAxis += 'Axis';
7122
7309
  var output;
7123
- var width = _this46.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7310
+ var width = _this48.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7124
7311
  // if (this.customBottomRange) {
7125
- for (var index = 0; index < _this46.customBottomRange.length; index++) {
7126
- if (input > _this46.customBottomRange[index]) {
7127
- if (_this46.customBottomRange[index + 1]) {
7128
- if (input < _this46.customBottomRange[index + 1]) {
7312
+ for (var index = 0; index < _this48.customBottomRange.length; index++) {
7313
+ if (input > _this48.customBottomRange[index]) {
7314
+ if (_this48.customBottomRange[index + 1]) {
7315
+ if (input < _this48.customBottomRange[index + 1]) {
7129
7316
  output = index;
7130
7317
  break;
7131
7318
  }
@@ -7300,9 +7487,9 @@ var WebsyChart = /*#__PURE__*/function () {
7300
7487
  }, {
7301
7488
  key: "handleEventMouseMove",
7302
7489
  value: function handleEventMouseMove(event, d) {
7303
- var _this47 = this;
7490
+ var _this49 = this;
7304
7491
  var bisectDate = d3.bisector(function (d) {
7305
- return _this47.parseX(d.x.value);
7492
+ return _this49.parseX(d.x.value);
7306
7493
  }).left;
7307
7494
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
7308
7495
  var xAxis = 'bottomAxis';
@@ -7335,9 +7522,9 @@ var WebsyChart = /*#__PURE__*/function () {
7335
7522
  xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
7336
7523
  }
7337
7524
  this.options.data.series.forEach(function (s) {
7338
- if (_this47.options.data[xData].scale !== 'Time') {
7525
+ if (_this49.options.data[xData].scale !== 'Time') {
7339
7526
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7340
- xPoint = _this47.customBottomRange[x0] + (_this47.customBottomRange[x0 + 1] - _this47.customBottomRange[x0]) / 2;
7527
+ xPoint = _this49.customBottomRange[x0] + (_this49.customBottomRange[x0 + 1] - _this49.customBottomRange[x0]) / 2;
7341
7528
  // }
7342
7529
  // else {
7343
7530
  // xPoint = this[xAxis](this.parseX(xLabel))
@@ -7357,41 +7544,41 @@ var WebsyChart = /*#__PURE__*/function () {
7357
7544
  var index = bisectDate(s.data, x0, 1);
7358
7545
  var pointA = s.data[index - 1];
7359
7546
  var pointB = s.data[index];
7360
- if (_this47.options.orientation === 'horizontal') {
7547
+ if (_this49.options.orientation === 'horizontal') {
7361
7548
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7362
7549
  pointB = _toConsumableArray(s.data).reverse()[index];
7363
7550
  }
7364
7551
  if (pointA && !pointB) {
7365
- xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
7552
+ xPoint = _this49[xAxis](_this49.parseX(pointA.x.value));
7366
7553
  tooltipTitle = pointA.x.value;
7367
7554
  if (!pointA.y.color) {
7368
7555
  pointA.y.color = s.color;
7369
7556
  }
7370
7557
  tooltipData.push(pointA);
7371
7558
  if (typeof pointA.x.value.getTime !== 'undefined') {
7372
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointA.x.value);
7559
+ tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointA.x.value);
7373
7560
  }
7374
7561
  }
7375
7562
  if (pointB && !pointA) {
7376
- xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
7563
+ xPoint = _this49[xAxis](_this49.parseX(pointB.x.value));
7377
7564
  tooltipTitle = pointB.x.value;
7378
7565
  if (!pointB.y.color) {
7379
7566
  pointB.y.color = s.color;
7380
7567
  }
7381
7568
  tooltipData.push(pointB);
7382
7569
  if (typeof pointB.x.value.getTime !== 'undefined') {
7383
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
7570
+ tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7384
7571
  }
7385
7572
  }
7386
7573
  if (pointA && pointB) {
7387
- var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
7388
- var d1 = _this47[xAxis](_this47.parseX(pointB.x.value));
7574
+ var d0 = _this49[xAxis](_this49.parseX(pointA.x.value));
7575
+ var d1 = _this49[xAxis](_this49.parseX(pointB.x.value));
7389
7576
  var mid = Math.abs(d0 - d1) / 2;
7390
7577
  if (d3.pointer(event)[0] - d0 >= mid) {
7391
7578
  xPoint = d1;
7392
7579
  tooltipTitle = pointB.x.value;
7393
7580
  if (typeof pointB.x.value.getTime !== 'undefined') {
7394
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
7581
+ tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7395
7582
  }
7396
7583
  if (!pointB.y.color) {
7397
7584
  pointB.y.color = s.color;
@@ -7401,7 +7588,7 @@ var WebsyChart = /*#__PURE__*/function () {
7401
7588
  xPoint = d0;
7402
7589
  tooltipTitle = pointA.x.value;
7403
7590
  if (typeof pointB.x.value.getTime !== 'undefined') {
7404
- tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
7591
+ tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7405
7592
  }
7406
7593
  if (!pointA.y.color) {
7407
7594
  pointA.y.color = s.color;
@@ -7527,7 +7714,7 @@ var WebsyChart = /*#__PURE__*/function () {
7527
7714
  }, {
7528
7715
  key: "render",
7529
7716
  value: function render(options) {
7530
- var _this48 = this;
7717
+ var _this50 = this;
7531
7718
  /* global d3 options WebsyUtils */
7532
7719
  if (typeof options !== 'undefined') {
7533
7720
  this.options = _extends({}, this.options, options);
@@ -7595,7 +7782,7 @@ var WebsyChart = /*#__PURE__*/function () {
7595
7782
  this.options.data.series.map(function (s, i) {
7596
7783
  return {
7597
7784
  value: s.label || s.key,
7598
- color: s.color || _this48.options.colors[i % _this48.options.colors.length]
7785
+ color: s.color || _this50.options.colors[i % _this50.options.colors.length]
7599
7786
  };
7600
7787
  });
7601
7788
  }
@@ -7952,25 +8139,25 @@ var WebsyChart = /*#__PURE__*/function () {
7952
8139
  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') {
7953
8140
  var acc = 0;
7954
8141
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
7955
- var adjustment = _this48.bandPadding * index + _this48.bandPadding;
8142
+ var adjustment = _this50.bandPadding * index + _this50.bandPadding;
7956
8143
  // if (this.options.data.bottom.padding) {
7957
8144
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
7958
8145
  // }
7959
- var start = _this48.widthForCalc / noOfPoints * acc;
8146
+ var start = _this50.widthForCalc / noOfPoints * acc;
7960
8147
  for (var i = 0; i < (d.valueCount || 1); i++) {
7961
8148
  var pos = i * proposedBandWidth;
7962
- _this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8149
+ _this50["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
7963
8150
  }
7964
- acc += _this48.options.grouping !== 'stacked' && _this48.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
7965
- var end = _this48.widthForCalc / noOfPoints * acc;
8151
+ acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8152
+ var end = _this50.widthForCalc / noOfPoints * acc;
7966
8153
  // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
7967
8154
  return end + adjustment;
7968
8155
  })));
7969
8156
  acc = 0;
7970
8157
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
7971
- var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
7972
- acc += _this48.options.grouping !== 'stacked' && _this48.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
7973
- return (_this48.options.orientation === 'vertical' ? _this48.plotWidth : _this48.plotHeight) / noOfPoints * acc;
8158
+ var adjustment = _this50.brushBandPadding * index + _this50.brushBandPadding;
8159
+ acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8160
+ return (_this50.options.orientation === 'vertical' ? _this50.plotWidth : _this50.plotHeight) / noOfPoints * acc;
7974
8161
  })));
7975
8162
  }
7976
8163
  // }
@@ -8143,7 +8330,7 @@ var WebsyChart = /*#__PURE__*/function () {
8143
8330
  this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
8144
8331
  if (this.options.data.bottom.formatter) {
8145
8332
  this.bAxisFunc.tickFormat(function (d) {
8146
- return _this48.options.data.bottom.formatter(d);
8333
+ return _this50.options.data.bottom.formatter(d);
8147
8334
  });
8148
8335
  }
8149
8336
  this.bottomAxisLayer.call(this.bAxisFunc);
@@ -8153,7 +8340,7 @@ var WebsyChart = /*#__PURE__*/function () {
8153
8340
  }
8154
8341
  if (this.customBottomRange.length > 0) {
8155
8342
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8156
- return "translate(".concat(_this48.customBottomRange[i] + (_this48.customBottomRange[i + 1] - _this48.customBottomRange[i]) / 2, ", 0)");
8343
+ return "translate(".concat(_this50.customBottomRange[i] + (_this50.customBottomRange[i + 1] - _this50.customBottomRange[i]) / 2, ", 0)");
8157
8344
  });
8158
8345
  }
8159
8346
  }
@@ -8172,14 +8359,14 @@ var WebsyChart = /*#__PURE__*/function () {
8172
8359
  }
8173
8360
  if (this.options.margin.axisLeft > 0) {
8174
8361
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8175
- if (_this48.options.data.left.formatter) {
8176
- d = _this48.options.data.left.formatter(d);
8362
+ if (_this50.options.data.left.formatter) {
8363
+ d = _this50.options.data.left.formatter(d);
8177
8364
  }
8178
8365
  return d;
8179
8366
  }));
8180
8367
  if (this.customLeftRange.length > 0) {
8181
8368
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8182
- return "translate(0, ".concat(_this48.customLeftRange[i] + (_this48.customLeftRange[i + 1] - _this48.customLeftRange[i]) / 2, ")");
8369
+ return "translate(0, ".concat(_this50.customLeftRange[i] + (_this50.customLeftRange[i + 1] - _this50.customLeftRange[i]) / 2, ")");
8183
8370
  });
8184
8371
  }
8185
8372
  }
@@ -8207,8 +8394,8 @@ var WebsyChart = /*#__PURE__*/function () {
8207
8394
  }
8208
8395
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8209
8396
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8210
- if (_this48.options.data.right.formatter) {
8211
- d = _this48.options.data.right.formatter(d);
8397
+ if (_this50.options.data.right.formatter) {
8398
+ d = _this50.options.data.right.formatter(d);
8212
8399
  }
8213
8400
  return d;
8214
8401
  }));
@@ -8248,50 +8435,50 @@ var WebsyChart = /*#__PURE__*/function () {
8248
8435
  }, {
8249
8436
  key: "renderComponents",
8250
8437
  value: function renderComponents() {
8251
- var _this49 = this;
8438
+ var _this51 = this;
8252
8439
  // Draw the series data
8253
8440
  this.renderedKeys = {};
8254
8441
  this.options.data.series.forEach(function (series, index) {
8255
8442
  if (!series.key) {
8256
- series.key = _this49.createIdentity();
8443
+ series.key = _this51.createIdentity();
8257
8444
  }
8258
8445
  if (!series.color) {
8259
- series.color = _this49.options.colors[index % _this49.options.colors.length];
8446
+ series.color = _this51.options.colors[index % _this51.options.colors.length];
8260
8447
  }
8261
- _this49["render".concat(series.type || 'bar')](series, index);
8262
- _this49.renderLabels(series, index);
8263
- _this49.renderedKeys[series.key] = series.type;
8448
+ _this51["render".concat(series.type || 'bar')](series, index);
8449
+ _this51.renderLabels(series, index);
8450
+ _this51.renderedKeys[series.key] = series.type;
8264
8451
  });
8265
8452
  this.refLineLayer.selectAll('.reference-line').remove();
8266
8453
  this.refLineLayer.selectAll('.reference-line-label').remove();
8267
8454
  if (this.options.refLines && this.options.refLines.length > 0) {
8268
8455
  this.options.refLines.forEach(function (l) {
8269
- return _this49.renderRefLine(l);
8456
+ return _this51.renderRefLine(l);
8270
8457
  });
8271
8458
  }
8272
8459
  }
8273
8460
  }, {
8274
8461
  key: "renderarea",
8275
8462
  value: function renderarea(series, index) {
8276
- var _this50 = this;
8463
+ var _this52 = this;
8277
8464
  /* global d3 series index */
8278
8465
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8279
8466
  return d3.area().x(function (d) {
8280
- if (_this50.options.data[xAxis].scale === 'Time') {
8281
- return _this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value));
8467
+ if (_this52.options.data[xAxis].scale === 'Time') {
8468
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
8282
8469
  } else {
8283
- var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
8284
- var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8285
- if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8286
- xPos = xPos + (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8470
+ var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
8471
+ var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8472
+ if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8473
+ xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8287
8474
  }
8288
8475
  return xPos;
8289
8476
  }
8290
8477
  }).y0(function (d) {
8291
- return _this50["".concat(yAxis, "Axis")](0);
8478
+ return _this52["".concat(yAxis, "Axis")](0);
8292
8479
  }).y1(function (d) {
8293
- return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8294
- }).curve(d3[curveStyle || _this50.options.curveStyle]);
8480
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8481
+ }).curve(d3[curveStyle || _this52.options.curveStyle]);
8295
8482
  };
8296
8483
  var xAxis = 'bottom';
8297
8484
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8331,7 +8518,7 @@ var WebsyChart = /*#__PURE__*/function () {
8331
8518
  }, {
8332
8519
  key: "renderbar",
8333
8520
  value: function renderbar(series, index) {
8334
- var _this51 = this;
8521
+ var _this53 = this;
8335
8522
  /* global series index d3 */
8336
8523
  var xAxis = 'bottom';
8337
8524
  var yAxis = 'left';
@@ -8498,26 +8685,26 @@ var WebsyChart = /*#__PURE__*/function () {
8498
8685
  }
8499
8686
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8500
8687
  bars.attr('width', function (d, i) {
8501
- return Math.abs(getBarWidth.call(_this51, d, i, yAxis, xAxis));
8688
+ return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
8502
8689
  }).attr('height', function (d, i) {
8503
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
8690
+ return getBarHeight.call(_this53, d, i, yAxis, xAxis);
8504
8691
  }).attr('x', function (d, i) {
8505
- return getBarX.call(_this51, d, i, yAxis, xAxis);
8692
+ return getBarX.call(_this53, d, i, yAxis, xAxis);
8506
8693
  }).attr('y', function (d, i) {
8507
- return getBarY.call(_this51, d, i, yAxis, xAxis);
8694
+ return getBarY.call(_this53, d, i, yAxis, xAxis);
8508
8695
  })
8509
8696
  // .transition(this.transition)
8510
8697
  .attr('fill', function (d) {
8511
8698
  return d.y.color || d.color || series.color;
8512
8699
  });
8513
8700
  bars.enter().append('rect').attr('width', function (d, i) {
8514
- return Math.abs(getBarWidth.call(_this51, d, i, yAxis, xAxis));
8701
+ return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
8515
8702
  }).attr('height', function (d, i) {
8516
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
8703
+ return getBarHeight.call(_this53, d, i, yAxis, xAxis);
8517
8704
  }).attr('x', function (d, i) {
8518
- return getBarX.call(_this51, d, i, yAxis, xAxis);
8705
+ return getBarX.call(_this53, d, i, yAxis, xAxis);
8519
8706
  }).attr('y', function (d, i) {
8520
- return getBarY.call(_this51, d, i, yAxis, xAxis);
8707
+ return getBarY.call(_this53, d, i, yAxis, xAxis);
8521
8708
  })
8522
8709
  // .transition(this.transition)
8523
8710
  .attr('fill', function (d) {
@@ -8529,26 +8716,26 @@ var WebsyChart = /*#__PURE__*/function () {
8529
8716
  this.brushBarsInitialized[series.key] = true;
8530
8717
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8531
8718
  brushBars.attr('width', function (d, i) {
8532
- return Math.abs(getBarWidth.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8719
+ return Math.abs(getBarWidth.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8533
8720
  }).attr('height', function (d, i) {
8534
- return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8721
+ return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8535
8722
  }).attr('x', function (d, i) {
8536
- return getBarX.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8723
+ return getBarX.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8537
8724
  }).attr('y', function (d, i) {
8538
- return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8725
+ return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8539
8726
  })
8540
8727
  // .transition(this.transition)
8541
8728
  .attr('fill', function (d) {
8542
8729
  return d.y.color || d.color || series.color;
8543
8730
  });
8544
8731
  brushBars.enter().append('rect').attr('width', function (d, i) {
8545
- return Math.abs(getBarWidth.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8732
+ return Math.abs(getBarWidth.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
8546
8733
  }).attr('height', function (d, i) {
8547
- return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8734
+ return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8548
8735
  }).attr('x', function (d, i) {
8549
- return getBarX.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8736
+ return getBarX.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8550
8737
  }).attr('y', function (d, i) {
8551
- return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8738
+ return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8552
8739
  })
8553
8740
  // .transition(this.transition)
8554
8741
  .attr('fill', function (d) {
@@ -8569,7 +8756,7 @@ var WebsyChart = /*#__PURE__*/function () {
8569
8756
  }, {
8570
8757
  key: "renderLabels",
8571
8758
  value: function renderLabels(series, index) {
8572
- var _this52 = this;
8759
+ var _this54 = this;
8573
8760
  /* global series index d3 WebsyDesigns */
8574
8761
  var xAxis = 'bottom';
8575
8762
  var yAxis = 'left';
@@ -8585,14 +8772,14 @@ var WebsyChart = /*#__PURE__*/function () {
8585
8772
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
8586
8773
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
8587
8774
  labels.attr('x', function (d) {
8588
- return getLabelX.call(_this52, d, series.labelPosition);
8775
+ return getLabelX.call(_this54, d, series.labelPosition);
8589
8776
  }).attr('y', function (d) {
8590
- return getLabelY.call(_this52, d, series.labelPosition);
8777
+ return getLabelY.call(_this54, d, series.labelPosition);
8591
8778
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
8592
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
8779
+ if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
8593
8780
  return 'transparent';
8594
8781
  }
8595
- return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8782
+ return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8596
8783
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
8597
8784
  return d.y.label || d.y.value;
8598
8785
  }).each(function (d, i) {
@@ -8626,14 +8813,14 @@ var WebsyChart = /*#__PURE__*/function () {
8626
8813
  }
8627
8814
  });
8628
8815
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
8629
- return getLabelX.call(_this52, d, series.labelPosition);
8816
+ return getLabelX.call(_this54, d, series.labelPosition);
8630
8817
  }).attr('y', function (d) {
8631
- return getLabelY.call(_this52, d, series.labelPosition);
8818
+ return getLabelY.call(_this54, d, series.labelPosition);
8632
8819
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
8633
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
8820
+ if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
8634
8821
  return 'transparent';
8635
8822
  }
8636
- return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8823
+ return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8637
8824
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
8638
8825
  return d.y.label || d.y.value;
8639
8826
  }).each(function (d, i) {
@@ -8711,32 +8898,32 @@ var WebsyChart = /*#__PURE__*/function () {
8711
8898
  }, {
8712
8899
  key: "renderline",
8713
8900
  value: function renderline(series, index) {
8714
- var _this53 = this;
8901
+ var _this55 = this;
8715
8902
  /* global series index d3 */
8716
8903
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
8717
8904
  return d3.line().x(function (d) {
8718
- if (_this53.options.orientation === 'horizontal') {
8719
- return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8905
+ if (_this55.options.orientation === 'horizontal') {
8906
+ return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8720
8907
  } else {
8721
- if (_this53.options.data[xAxis].scale === 'Time') {
8722
- return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
8908
+ if (_this55.options.data[xAxis].scale === 'Time') {
8909
+ return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
8723
8910
  } else {
8724
- var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
8725
- var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8726
- if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8727
- xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8911
+ var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
8912
+ var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8913
+ if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8914
+ xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8728
8915
  }
8729
8916
  return xPos;
8730
8917
  }
8731
8918
  }
8732
8919
  }).y(function (d) {
8733
- if (_this53.options.orientation === 'horizontal') {
8734
- var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
8735
- return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment;
8920
+ if (_this55.options.orientation === 'horizontal') {
8921
+ var adjustment = _this55.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this55.options.data[xAxis].bandWidth / 2;
8922
+ return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value)) + adjustment;
8736
8923
  } else {
8737
- return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8924
+ return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8738
8925
  }
8739
- }).curve(d3[curveStyle || _this53.options.curveStyle]);
8926
+ }).curve(d3[curveStyle || _this55.options.curveStyle]);
8740
8927
  };
8741
8928
  var xAxis = 'bottom';
8742
8929
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8845,14 +9032,14 @@ var WebsyChart = /*#__PURE__*/function () {
8845
9032
  }, {
8846
9033
  key: "rendersymbol",
8847
9034
  value: function rendersymbol(series, index) {
8848
- var _this54 = this;
9035
+ var _this56 = this;
8849
9036
  /* global d3 series index series.key */
8850
9037
  var drawSymbol = function drawSymbol(size) {
8851
9038
  return d3.symbol()
8852
9039
  // .type(d => {
8853
9040
  // return d3.symbols[0]
8854
9041
  // })
8855
- .size(size || _this54.options.symbolSize);
9042
+ .size(size || _this56.options.symbolSize);
8856
9043
  };
8857
9044
  var xAxis = 'bottom';
8858
9045
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8878,20 +9065,27 @@ var WebsyChart = /*#__PURE__*/function () {
8878
9065
  // else {
8879
9066
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8880
9067
  // }
8881
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8882
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8883
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8884
- xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8885
- }
8886
- var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
8887
- if (_this54.options.orientation === 'horizontal') {
8888
- return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9068
+ var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9069
+ var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9070
+ if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9071
+ xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9072
+ }
9073
+ var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
9074
+ if (_this56.options.orientation === 'horizontal') {
9075
+ return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
8889
9076
  } else {
8890
- if (_this54.options.data[xAxis].scale === 'Time') {
8891
- xPos = _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
9077
+ if (_this56.options.data[xAxis].scale === 'Time') {
9078
+ xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
9079
+ } else {
9080
+ var _xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9081
+ var _xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9082
+ if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9083
+ _xPos = _xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9084
+ }
9085
+ // return xPos
8892
9086
  }
8893
9087
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8894
- return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9088
+ return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8895
9089
  }
8896
9090
  });
8897
9091
  // Enter
@@ -8906,20 +9100,27 @@ var WebsyChart = /*#__PURE__*/function () {
8906
9100
  }).attr('class', function (d) {
8907
9101
  return "symbol symbol_".concat(series.key);
8908
9102
  }).attr('transform', function (d) {
8909
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8910
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8911
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8912
- xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8913
- }
8914
- var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
8915
- if (_this54.options.orientation === 'horizontal') {
8916
- return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9103
+ var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9104
+ var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9105
+ if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9106
+ xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9107
+ }
9108
+ var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
9109
+ if (_this56.options.orientation === 'horizontal') {
9110
+ return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
8917
9111
  } else {
8918
- if (_this54.options.data[xAxis].scale === 'Time') {
8919
- xPos = _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
9112
+ if (_this56.options.data[xAxis].scale === 'Time') {
9113
+ xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
9114
+ } else {
9115
+ var _xIndex2 = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
9116
+ var _xPos2 = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9117
+ if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9118
+ _xPos2 = _xPos2 + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9119
+ }
9120
+ // return xPos
8920
9121
  }
8921
9122
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8922
- return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9123
+ return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8923
9124
  }
8924
9125
  });
8925
9126
  }
@@ -9115,7 +9316,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9115
9316
  }, {
9116
9317
  key: "resize",
9117
9318
  value: function resize() {
9118
- var _this55 = this;
9319
+ var _this57 = this;
9119
9320
  var el = document.getElementById(this.elementId);
9120
9321
  if (el) {
9121
9322
  // if (this.options.width) {
@@ -9126,7 +9327,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9126
9327
  // }
9127
9328
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9128
9329
  html += this._data.map(function (d, i) {
9129
- return _this55.getLegendItemHTML(d);
9330
+ return _this57.getLegendItemHTML(d);
9130
9331
  }).join('');
9131
9332
  html += "\n <div>\n ";
9132
9333
  el.innerHTML = html;
@@ -9162,8 +9363,12 @@ var WebsyKPI = /*#__PURE__*/function () {
9162
9363
  _classCallCheck(this, WebsyKPI);
9163
9364
  var DEFAULTS = {
9164
9365
  tooltip: {},
9165
- label: {},
9166
- value: {}
9366
+ label: {
9367
+ value: ''
9368
+ },
9369
+ value: {
9370
+ value: ''
9371
+ }
9167
9372
  };
9168
9373
  this.elementId = elementId;
9169
9374
  this.options = _extends({}, DEFAULTS, options);
@@ -9196,7 +9401,7 @@ var WebsyKPI = /*#__PURE__*/function () {
9196
9401
  if (this.options.icon) {
9197
9402
  html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
9198
9403
  }
9199
- 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 ");
9404
+ 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 ");
9200
9405
  if (this.options.tooltip && this.options.tooltip.value) {
9201
9406
  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 ");
9202
9407
  }
@@ -9266,14 +9471,14 @@ var WebsyMap = /*#__PURE__*/function () {
9266
9471
  }, {
9267
9472
  key: "render",
9268
9473
  value: function render() {
9269
- var _this56 = this;
9474
+ var _this58 = this;
9270
9475
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
9271
9476
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
9272
9477
  if (this.options.showLegend === true && this.options.data.polygons) {
9273
9478
  var legendData = this.options.data.polygons.map(function (s, i) {
9274
9479
  return {
9275
9480
  value: s.label || s.key,
9276
- color: s.color || _this56.options.colors[i % _this56.options.colors.length]
9481
+ color: s.color || _this58.options.colors[i % _this58.options.colors.length]
9277
9482
  };
9278
9483
  });
9279
9484
  var longestValue = legendData.map(function (s) {
@@ -9327,7 +9532,7 @@ var WebsyMap = /*#__PURE__*/function () {
9327
9532
  }
9328
9533
  if (this.polygons) {
9329
9534
  this.polygons.forEach(function (p) {
9330
- return _this56.map.removeLayer(p);
9535
+ return _this58.map.removeLayer(p);
9331
9536
  });
9332
9537
  }
9333
9538
  this.polygons = [];
@@ -9381,15 +9586,15 @@ var WebsyMap = /*#__PURE__*/function () {
9381
9586
  p.options = {};
9382
9587
  }
9383
9588
  if (!p.options.color) {
9384
- p.options.color = _this56.options.colors[i % _this56.options.colors.length];
9589
+ p.options.color = _this58.options.colors[i % _this58.options.colors.length];
9385
9590
  }
9386
9591
  var pol = L.polygon(p.data.map(function (c) {
9387
9592
  return c.map(function (d) {
9388
9593
  return [d.Latitude, d.Longitude];
9389
9594
  });
9390
- }), p.options).addTo(_this56.map);
9391
- _this56.polygons.push(pol);
9392
- _this56.map.fitBounds(pol.getBounds());
9595
+ }), p.options).addTo(_this58.map);
9596
+ _this58.polygons.push(pol);
9597
+ _this58.map.fitBounds(pol.getBounds());
9393
9598
  });
9394
9599
  }
9395
9600
  // if (this.data.markers.length > 0) {