@websy/websy-designs 1.9.14 → 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('');
@@ -1829,6 +1873,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1829
1873
  var contentPos = WebsyUtils.getElementPos(contentEl);
1830
1874
  if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
1831
1875
  contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
1876
+ contentEl.style.width = "".concat(headerEl.clientWidth, "px");
1832
1877
  if (headerPos.bottom + contentPos.height > window.innerHeight) {
1833
1878
  // contentEl.classList.add('on-top')
1834
1879
  contentEl.style.bottom = "calc(100vh - ".concat(headerPos.top, "px)");
@@ -1838,6 +1883,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1838
1883
  } else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
1839
1884
  var targetPos = WebsyUtils.getElementPos(event.target);
1840
1885
  contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
1886
+ contentEl.style.width = "".concat(targetPos.width, "px");
1841
1887
  }
1842
1888
  if (this.options.disableSearch !== true) {
1843
1889
  var searchEl = document.getElementById("".concat(this.elementId, "_search"));
@@ -1849,6 +1895,21 @@ var WebsyDropdown = /*#__PURE__*/function () {
1849
1895
  this.options.onOpen(this.elementId);
1850
1896
  }
1851
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
+ }
1852
1913
  }, {
1853
1914
  key: "render",
1854
1915
  value: function render() {
@@ -2067,9 +2128,7 @@ var WebsyForm = /*#__PURE__*/function () {
2067
2128
  };
2068
2129
  GlobalPubSub.subscribe('recaptchaready', this.recaptchaReady.bind(this));
2069
2130
  this.recaptchaResult = null;
2070
- this.options = _extends(defaults, {}, {
2071
- // defaults go here
2072
- }, options);
2131
+ this.options = _extends({}, defaults, options);
2073
2132
  if (!elementId) {
2074
2133
  console.log('No element Id provided');
2075
2134
  return;
@@ -2143,23 +2202,41 @@ var WebsyForm = /*#__PURE__*/function () {
2143
2202
  }, {
2144
2203
  key: "data",
2145
2204
  get: function get() {
2205
+ var _this14 = this;
2146
2206
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2147
2207
  var data = {};
2148
2208
  var temp = new FormData(formEl);
2149
2209
  temp.forEach(function (value, key) {
2150
- 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
+ }
2151
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
+ }
2152
2229
  return data;
2153
2230
  },
2154
2231
  set: function set(d) {
2155
- var _this14 = this;
2232
+ var _this15 = this;
2156
2233
  if (!this.options.fields) {
2157
2234
  this.options.fields = [];
2158
2235
  }
2159
2236
  var _loop = function _loop(key) {
2160
- _this14.options.fields.forEach(function (f) {
2237
+ _this15.options.fields.forEach(function (f) {
2161
2238
  if (f.field === key) {
2162
- _this14.setValue(key, d[key]);
2239
+ _this15.setValue(key, d[key]);
2163
2240
  // f.value = d[key]
2164
2241
  // const el = document.getElementById(`${this.elementId}_input_${f.field}`)
2165
2242
  // if (el) {
@@ -2218,6 +2295,7 @@ var WebsyForm = /*#__PURE__*/function () {
2218
2295
  value: function handleClick(event) {
2219
2296
  if (event.target.classList.contains('submit')) {
2220
2297
  event.preventDefault();
2298
+ event.stopPropagation();
2221
2299
  this.submitForm();
2222
2300
  } else if (event.target.classList.contains('cancel')) {
2223
2301
  event.preventDefault();
@@ -2359,7 +2437,7 @@ var WebsyForm = /*#__PURE__*/function () {
2359
2437
  }, {
2360
2438
  key: "processComponents",
2361
2439
  value: function processComponents(components, callbackFn) {
2362
- var _this15 = this;
2440
+ var _this16 = this;
2363
2441
  if (components.length === 0) {
2364
2442
  callbackFn();
2365
2443
  } else {
@@ -2368,11 +2446,11 @@ var WebsyForm = /*#__PURE__*/function () {
2368
2446
  if (!c.options.onChange) {
2369
2447
  c.options.onChange = function () {
2370
2448
  if (c.required || c.validate) {
2371
- _this15.validateField(c, c.instance.value);
2449
+ _this16.validateField(c, c.instance.value);
2372
2450
  }
2373
2451
  };
2374
2452
  }
2375
- 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);
2376
2454
  } else {
2377
2455
  // some user feedback here
2378
2456
  }
@@ -2382,13 +2460,13 @@ var WebsyForm = /*#__PURE__*/function () {
2382
2460
  }, {
2383
2461
  key: "recaptchaReady",
2384
2462
  value: function recaptchaReady() {
2385
- var _this16 = this;
2463
+ var _this17 = this;
2386
2464
  var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
2387
2465
  if (el) {
2388
2466
  grecaptcha.ready(function () {
2389
- grecaptcha.render("".concat(_this16.elementId, "_recaptcha"), {
2467
+ grecaptcha.render("".concat(_this17.elementId, "_recaptcha"), {
2390
2468
  sitekey: ENVIRONMENT.RECAPTCHA_KEY,
2391
- callback: _this16.validateRecaptcha.bind(_this16)
2469
+ callback: _this17.validateRecaptcha.bind(_this17)
2392
2470
  });
2393
2471
  });
2394
2472
  }
@@ -2396,20 +2474,21 @@ var WebsyForm = /*#__PURE__*/function () {
2396
2474
  }, {
2397
2475
  key: "render",
2398
2476
  value: function render(update, data) {
2399
- var _this17 = this;
2477
+ var _this18 = this;
2400
2478
  var el = document.getElementById(this.elementId);
2401
2479
  var componentsToProcess = [];
2402
2480
  if (el) {
2403
2481
  var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
2404
2482
  this.options.fields.forEach(function (f, i) {
2405
- _this17.fieldMap[f.field] = f;
2483
+ _this18.fieldMap[f.field] = f;
2484
+ f.owningElement = _this18.elementId;
2406
2485
  if (f.component) {
2407
2486
  componentsToProcess.push(f);
2408
- 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 ");
2409
2488
  } else if (f.type === 'longtext') {
2410
- 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 ");
2411
2490
  } else {
2412
- 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 ");
2413
2492
  }
2414
2493
  });
2415
2494
  if (this.options.useRecaptcha === true) {
@@ -2422,8 +2501,8 @@ var WebsyForm = /*#__PURE__*/function () {
2422
2501
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
2423
2502
  el.innerHTML = html;
2424
2503
  this.processComponents(componentsToProcess, function () {
2425
- if (_this17.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2426
- _this17.recaptchaReady();
2504
+ if (_this18.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2505
+ _this18.recaptchaReady();
2427
2506
  }
2428
2507
  });
2429
2508
  }
@@ -2438,6 +2517,10 @@ var WebsyForm = /*#__PURE__*/function () {
2438
2517
  var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
2439
2518
  if (el) {
2440
2519
  el.value = value;
2520
+ el.setAttribute('value', value);
2521
+ if (this.fieldMap[field].type === 'checkbox') {
2522
+ el.checked = value;
2523
+ }
2441
2524
  } else {
2442
2525
  console.error("Input for ".concat(field, " does not exist in form."));
2443
2526
  }
@@ -2449,7 +2532,7 @@ var WebsyForm = /*#__PURE__*/function () {
2449
2532
  }, {
2450
2533
  key: "submitForm",
2451
2534
  value: function submitForm() {
2452
- var _this18 = this;
2535
+ var _this19 = this;
2453
2536
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2454
2537
  var buttonEl = formEl.querySelector('button.websy-btn.submit');
2455
2538
  var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
@@ -2474,27 +2557,27 @@ var WebsyForm = /*#__PURE__*/function () {
2474
2557
  temp.forEach(function (value, key) {
2475
2558
  data[key] = value;
2476
2559
  });
2477
- if (_this18.options.url) {
2478
- var _this18$apiService;
2479
- var params = [_this18.options.url];
2480
- if (_this18.options.mode === 'update') {
2481
- 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);
2482
2565
  }
2483
2566
  params.push(data);
2484
- (_this18$apiService = _this18.apiService)[_this18.options.mode].apply(_this18$apiService, params).then(function (result) {
2485
- 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) {
2486
2569
  // this.render()
2487
2570
  formEl.reset();
2488
2571
  }
2489
2572
  buttonEl.removeAttribute('disabled');
2490
- _this18.options.onSuccess.call(_this18, result);
2573
+ _this19.options.onSuccess.call(_this19, result);
2491
2574
  }, function (err) {
2492
2575
  console.log('Error submitting form data:', err);
2493
- _this18.options.onError.call(_this18, err);
2576
+ _this19.options.onError.call(_this19, err);
2494
2577
  });
2495
- } else if (_this18.options.submitFn) {
2496
- _this18.options.submitFn(data, function () {
2497
- if (_this18.options.clearAfterSave === true) {
2578
+ } else if (_this19.options.submitFn) {
2579
+ _this19.options.submitFn(data, function () {
2580
+ if (_this19.options.clearAfterSave === true) {
2498
2581
  // this.render()
2499
2582
  formEl.reset();
2500
2583
  }
@@ -2601,6 +2684,12 @@ var MultiForm = /*#__PURE__*/function () {
2601
2684
  this.render();
2602
2685
  }
2603
2686
  _createClass(MultiForm, [{
2687
+ key: "addData",
2688
+ value: function addData(data) {
2689
+ this.formData = this.formData.concat(data);
2690
+ this.render();
2691
+ }
2692
+ }, {
2604
2693
  key: "addEntry",
2605
2694
  value: function addEntry() {
2606
2695
  var el = document.getElementById("".concat(this.elementId, "_container"));
@@ -2610,7 +2699,11 @@ var MultiForm = /*#__PURE__*/function () {
2610
2699
  newFormEl.classList.add('websy-multi-form-form-container');
2611
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 ");
2612
2701
  el.appendChild(newFormEl);
2613
- 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
+ });
2614
2707
  this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
2615
2708
  }
2616
2709
  }, {
@@ -2630,14 +2723,25 @@ var MultiForm = /*#__PURE__*/function () {
2630
2723
  var d = this.forms.map(function (f) {
2631
2724
  return f.data;
2632
2725
  });
2633
- // we don't return the last form
2634
- 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
+ }
2635
2731
  return d;
2636
2732
  },
2637
2733
  set: function set(d) {
2638
2734
  this.formData = d;
2639
2735
  this.render();
2640
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
+ }
2641
2745
  }, {
2642
2746
  key: "handleClick",
2643
2747
  value: function handleClick(event) {
@@ -2682,7 +2786,7 @@ var MultiForm = /*#__PURE__*/function () {
2682
2786
  }, {
2683
2787
  key: "render",
2684
2788
  value: function render() {
2685
- var _this19 = this;
2789
+ var _this21 = this;
2686
2790
  this.forms = [];
2687
2791
  this.recordsToDelete = [];
2688
2792
  var el = document.getElementById("".concat(this.elementId, "_container"));
@@ -2690,9 +2794,9 @@ var MultiForm = /*#__PURE__*/function () {
2690
2794
  var html = '';
2691
2795
  this.formData.forEach(function (d) {
2692
2796
  d.formId = WebsyDesigns.Utils.createIdentity();
2693
- 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 ");
2694
- if (_this19.options.allowDelete === true) {
2695
- 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 ");
2696
2800
  }
2697
2801
  html += "\n </div>\n ";
2698
2802
  });
@@ -2701,15 +2805,25 @@ var MultiForm = /*#__PURE__*/function () {
2701
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 ");
2702
2806
  }
2703
2807
  el.innerHTML = html;
2704
- this.formData.forEach(function (d) {
2705
- var formOptions = _extends({}, _this19.options);
2706
- 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);
2707
2816
  formObject.data = d;
2708
- _this19.forms.push(formObject);
2817
+ _this21.forms[i] = formObject;
2709
2818
  });
2710
2819
  if (this.options.allowAdd === true) {
2711
- var formOptions = _extends({}, this.options);
2712
- 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);
2713
2827
  }
2714
2828
  }
2715
2829
  }
@@ -2934,7 +3048,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2934
3048
  }, {
2935
3049
  key: "handleSearch",
2936
3050
  value: function handleSearch(searchText) {
2937
- var _this20 = this;
3051
+ var _this22 = this;
2938
3052
  var el = document.getElementById(this.elementId);
2939
3053
  // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
2940
3054
  var lowestItems = this.flatItems.filter(function (d) {
@@ -2945,7 +3059,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2945
3059
  if (searchText && searchText.length > 1) {
2946
3060
  defaultMethod = 'add';
2947
3061
  visibleItems = lowestItems.filter(function (d) {
2948
- return d[_this20.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3062
+ return d[_this22.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
2949
3063
  });
2950
3064
  }
2951
3065
  // hide everything
@@ -3127,7 +3241,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3127
3241
  /* global WebsyDesigns */
3128
3242
  var Pager = /*#__PURE__*/function () {
3129
3243
  function Pager(elementId, options) {
3130
- var _this21 = this;
3244
+ var _this23 = this;
3131
3245
  _classCallCheck(this, Pager);
3132
3246
  this.elementId = elementId;
3133
3247
  var DEFAULTS = {
@@ -3174,8 +3288,8 @@ var Pager = /*#__PURE__*/function () {
3174
3288
  allowClear: false,
3175
3289
  disableSearch: true,
3176
3290
  onItemSelected: function onItemSelected(selectedItem) {
3177
- if (_this21.options.onChangePageSize) {
3178
- _this21.options.onChangePageSize(selectedItem.value);
3291
+ if (_this23.options.onChangePageSize) {
3292
+ _this23.options.onChangePageSize(selectedItem.value);
3179
3293
  }
3180
3294
  }
3181
3295
  });
@@ -3196,11 +3310,11 @@ var Pager = /*#__PURE__*/function () {
3196
3310
  }, {
3197
3311
  key: "render",
3198
3312
  value: function render() {
3199
- var _this22 = this;
3313
+ var _this24 = this;
3200
3314
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3201
3315
  if (el) {
3202
3316
  var pages = this.options.pages.map(function (item, index) {
3203
- 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>");
3204
3318
  });
3205
3319
  var startIndex = 0;
3206
3320
  if (this.options.pages.length > 8) {
@@ -3258,48 +3372,48 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3258
3372
  _createClass(WebsyPDFButton, [{
3259
3373
  key: "handleClick",
3260
3374
  value: function handleClick(event) {
3261
- var _this23 = this;
3375
+ var _this25 = this;
3262
3376
  if (event.target.classList.contains('websy-pdf-button')) {
3263
3377
  this.loader.show();
3264
3378
  setTimeout(function () {
3265
- if (_this23.options.targetId) {
3266
- var el = document.getElementById(_this23.options.targetId);
3379
+ if (_this25.options.targetId) {
3380
+ var el = document.getElementById(_this25.options.targetId);
3267
3381
  if (el) {
3268
3382
  var pdfData = {
3269
3383
  options: {}
3270
3384
  };
3271
- if (_this23.options.pdfOptions) {
3272
- pdfData.options = _extends({}, _this23.options.pdfOptions);
3385
+ if (_this25.options.pdfOptions) {
3386
+ pdfData.options = _extends({}, _this25.options.pdfOptions);
3273
3387
  }
3274
- if (_this23.options.header) {
3275
- if (_this23.options.header.elementId) {
3276
- 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);
3277
3391
  if (headerEl) {
3278
3392
  pdfData.header = headerEl.outerHTML;
3279
- if (_this23.options.header.css) {
3280
- pdfData.options.headerCSS = _this23.options.header.css;
3393
+ if (_this25.options.header.css) {
3394
+ pdfData.options.headerCSS = _this25.options.header.css;
3281
3395
  }
3282
3396
  }
3283
- } else if (_this23.options.header.html) {
3284
- pdfData.header = _this23.options.header.html;
3285
- if (_this23.options.header.css) {
3286
- 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;
3287
3401
  }
3288
3402
  } else {
3289
- pdfData.header = _this23.options.header;
3403
+ pdfData.header = _this25.options.header;
3290
3404
  }
3291
3405
  }
3292
- if (_this23.options.footer) {
3293
- if (_this23.options.footer.elementId) {
3294
- 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);
3295
3409
  if (footerEl) {
3296
3410
  pdfData.footer = footerEl.outerHTML;
3297
- if (_this23.options.footer.css) {
3298
- pdfData.options.footerCSS = _this23.options.footer.css;
3411
+ if (_this25.options.footer.css) {
3412
+ pdfData.options.footerCSS = _this25.options.footer.css;
3299
3413
  }
3300
3414
  }
3301
3415
  } else {
3302
- pdfData.footer = _this23.options.footer;
3416
+ pdfData.footer = _this25.options.footer;
3303
3417
  }
3304
3418
  }
3305
3419
  pdfData.html = el.outerHTML;
@@ -3307,25 +3421,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3307
3421
  // document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
3308
3422
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3309
3423
  // document.getElementById(`${this.elementId}_form`).submit()
3310
- _this23.service.add('', pdfData, {
3424
+ _this25.service.add('', pdfData, {
3311
3425
  responseType: 'blob'
3312
3426
  }).then(function (response) {
3313
- _this23.loader.hide();
3427
+ _this25.loader.hide();
3314
3428
  var blob = new Blob([response], {
3315
3429
  type: 'application/pdf'
3316
3430
  });
3317
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 ");
3318
- if (_this23.options.directDownload === true) {
3432
+ if (_this25.options.directDownload === true) {
3319
3433
  var fileName;
3320
- if (typeof _this23.options.fileName === 'function') {
3321
- fileName = _this23.options.fileName() || 'Export';
3434
+ if (typeof _this25.options.fileName === 'function') {
3435
+ fileName = _this25.options.fileName() || 'Export';
3322
3436
  } else {
3323
- fileName = _this23.options.fileName || 'Export';
3437
+ fileName = _this25.options.fileName || 'Export';
3324
3438
  }
3325
3439
  msg += "download='".concat(fileName, ".pdf'");
3326
3440
  }
3327
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this23.options.buttonText, "</button>\n </a>\n </div>\n ");
3328
- _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({
3329
3443
  message: msg,
3330
3444
  mask: true
3331
3445
  });
@@ -3474,6 +3588,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
3474
3588
  }, {
3475
3589
  key: "subscribe",
3476
3590
  value: function subscribe(id, method, fn) {
3591
+ if (!this.subscriptions) {
3592
+ this.subscriptions = {};
3593
+ }
3477
3594
  if (arguments.length === 3) {
3478
3595
  if (!this.subscriptions[id]) {
3479
3596
  this.subscriptions[id] = {};
@@ -3493,7 +3610,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3493
3610
  }();
3494
3611
  var ResponsiveText = /*#__PURE__*/function () {
3495
3612
  function ResponsiveText(elementId, options) {
3496
- var _this24 = this;
3613
+ var _this26 = this;
3497
3614
  _classCallCheck(this, ResponsiveText);
3498
3615
  var DEFAULTS = {
3499
3616
  textAlign: 'center',
@@ -3504,7 +3621,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3504
3621
  this.elementId = elementId;
3505
3622
  this.canvas = document.createElement('canvas');
3506
3623
  window.addEventListener('resize', function () {
3507
- return _this24.render();
3624
+ return _this26.render();
3508
3625
  });
3509
3626
  var el = document.getElementById(this.elementId);
3510
3627
  if (el) {
@@ -3694,7 +3811,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3694
3811
  /* global WebsyDesigns */
3695
3812
  var WebsyResultList = /*#__PURE__*/function () {
3696
3813
  function WebsyResultList(elementId, options) {
3697
- var _this25 = this;
3814
+ var _this27 = this;
3698
3815
  _classCallCheck(this, WebsyResultList);
3699
3816
  var DEFAULTS = {
3700
3817
  listeners: {
@@ -3720,8 +3837,8 @@ var WebsyResultList = /*#__PURE__*/function () {
3720
3837
  }
3721
3838
  if (_typeof(options.template) === 'object' && options.template.url) {
3722
3839
  this.templateService.get(options.template.url).then(function (templateString) {
3723
- _this25.options.template = templateString;
3724
- _this25.render();
3840
+ _this27.options.template = templateString;
3841
+ _this27.render();
3725
3842
  });
3726
3843
  } else {
3727
3844
  this.render();
@@ -3740,7 +3857,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3740
3857
  }, {
3741
3858
  key: "buildHTML",
3742
3859
  value: function buildHTML(d) {
3743
- var _this26 = this;
3860
+ var _this28 = this;
3744
3861
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3745
3862
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
3746
3863
  var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
@@ -3748,7 +3865,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3748
3865
  if (this.options.template) {
3749
3866
  if (d.length > 0) {
3750
3867
  d.forEach(function (row, ix) {
3751
- 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 ? '<!--' : '');
3752
3869
  // find conditional elements
3753
3870
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3754
3871
  ifMatches.forEach(function (m) {
@@ -3836,7 +3953,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3836
3953
  parts.forEach(function (p) {
3837
3954
  items = items[p];
3838
3955
  });
3839
- 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)])));
3840
3957
  }
3841
3958
  });
3842
3959
  var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
@@ -3845,7 +3962,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3845
3962
  template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
3846
3963
  }
3847
3964
  });
3848
- var flatRow = _this26.flattenObject(row);
3965
+ var flatRow = _this28.flattenObject(row);
3849
3966
  for (var key in flatRow) {
3850
3967
  var rg = new RegExp("{".concat(key, "}"), 'gm');
3851
3968
  template = template.replace(rg, flatRow[key] || '');
@@ -3970,15 +4087,15 @@ var WebsyResultList = /*#__PURE__*/function () {
3970
4087
  }, {
3971
4088
  key: "render",
3972
4089
  value: function render() {
3973
- var _this27 = this;
4090
+ var _this29 = this;
3974
4091
  if (this.options.entity) {
3975
4092
  var url = this.options.entity;
3976
4093
  if (this.options.sortField) {
3977
4094
  url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
3978
4095
  }
3979
4096
  this.apiService.get(url).then(function (results) {
3980
- _this27.rows = results.rows;
3981
- _this27.resize();
4097
+ _this29.rows = results.rows;
4098
+ _this29.resize();
3982
4099
  });
3983
4100
  } else {
3984
4101
  this.resize();
@@ -4048,12 +4165,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4048
4165
  _createClass(WebsyRouter, [{
4049
4166
  key: "addGroup",
4050
4167
  value: function addGroup(group) {
4051
- var _this28 = this;
4168
+ var _this30 = this;
4052
4169
  if (!this.groups[group]) {
4053
4170
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4054
4171
  if (els) {
4055
4172
  this.getClosestParent(els[0], function (parent) {
4056
- _this28.groups[group] = {
4173
+ _this30.groups[group] = {
4057
4174
  activeView: '',
4058
4175
  views: [],
4059
4176
  parent: parent.getAttribute('data-view')
@@ -4117,7 +4234,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4117
4234
  }, {
4118
4235
  key: "removeUrlParams",
4119
4236
  value: function removeUrlParams() {
4120
- var _this29 = this;
4237
+ var _this31 = this;
4121
4238
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4122
4239
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4123
4240
  var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -4125,7 +4242,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4125
4242
  var path = '';
4126
4243
  if (this.currentParams && this.currentParams.items) {
4127
4244
  params.forEach(function (p) {
4128
- delete _this29.currentParams.items[p];
4245
+ delete _this31.currentParams.items[p];
4129
4246
  });
4130
4247
  path = this.buildUrlPath(this.currentParams.items);
4131
4248
  }
@@ -4456,11 +4573,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4456
4573
  }, {
4457
4574
  key: "showComponents",
4458
4575
  value: function showComponents(view) {
4459
- var _this30 = this;
4576
+ var _this32 = this;
4460
4577
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4461
4578
  this.options.views[view].components.forEach(function (c) {
4462
4579
  if (typeof c.instance === 'undefined') {
4463
- _this30.prepComponent(c.elementId, c.options);
4580
+ _this32.prepComponent(c.elementId, c.options);
4464
4581
  c.instance = new c.Component(c.elementId, c.options);
4465
4582
  } else if (c.instance.render) {
4466
4583
  c.instance.render();
@@ -4804,7 +4921,7 @@ var Switch = /*#__PURE__*/function () {
4804
4921
  /* global WebsyDesigns */
4805
4922
  var WebsyTemplate = /*#__PURE__*/function () {
4806
4923
  function WebsyTemplate(elementId, options) {
4807
- var _this31 = this;
4924
+ var _this33 = this;
4808
4925
  _classCallCheck(this, WebsyTemplate);
4809
4926
  var DEFAULTS = {
4810
4927
  listeners: {
@@ -4824,8 +4941,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
4824
4941
  }
4825
4942
  if (_typeof(options.template) === 'object' && options.template.url) {
4826
4943
  this.templateService.get(options.template.url).then(function (templateString) {
4827
- _this31.options.template = templateString;
4828
- _this31.render();
4944
+ _this33.options.template = templateString;
4945
+ _this33.render();
4829
4946
  });
4830
4947
  } else {
4831
4948
  this.render();
@@ -4834,7 +4951,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
4834
4951
  _createClass(WebsyTemplate, [{
4835
4952
  key: "buildHTML",
4836
4953
  value: function buildHTML() {
4837
- var _this32 = this;
4954
+ var _this34 = this;
4838
4955
  var html = "";
4839
4956
  if (this.options.template) {
4840
4957
  var template = this.options.template;
@@ -4883,14 +5000,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
4883
5000
  }
4884
5001
  }
4885
5002
  if (polarity === true) {
4886
- 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]) {
4887
5004
  // remove the <if> tags
4888
5005
  removeAll = false;
4889
5006
  } else if (parts[0] === parts[1]) {
4890
5007
  removeAll = false;
4891
5008
  }
4892
5009
  } else if (polarity === false) {
4893
- 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]) {
4894
5011
  // remove the <if> tags
4895
5012
  removeAll = false;
4896
5013
  }
@@ -4927,7 +5044,55 @@ var WebsyTemplate = /*#__PURE__*/function () {
4927
5044
  }, {
4928
5045
  key: "handleClick",
4929
5046
  value: function handleClick(event) {
4930
- //
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
+ }
4931
5096
  }
4932
5097
  }, {
4933
5098
  key: "render",
@@ -5151,7 +5316,7 @@ var WebsyUtils = {
5151
5316
  /* global WebsyDesigns */
5152
5317
  var WebsyTable = /*#__PURE__*/function () {
5153
5318
  function WebsyTable(elementId, options) {
5154
- var _this33 = this;
5319
+ var _this35 = this;
5155
5320
  _classCallCheck(this, WebsyTable);
5156
5321
  var DEFAULTS = {
5157
5322
  pageSize: 20,
@@ -5183,8 +5348,8 @@ var WebsyTable = /*#__PURE__*/function () {
5183
5348
  allowClear: false,
5184
5349
  disableSearch: true,
5185
5350
  onItemSelected: function onItemSelected(selectedItem) {
5186
- if (_this33.options.onChangePageSize) {
5187
- _this33.options.onChangePageSize(selectedItem.value);
5351
+ if (_this35.options.onChangePageSize) {
5352
+ _this35.options.onChangePageSize(selectedItem.value);
5188
5353
  }
5189
5354
  }
5190
5355
  });
@@ -5203,19 +5368,19 @@ var WebsyTable = /*#__PURE__*/function () {
5203
5368
  _createClass(WebsyTable, [{
5204
5369
  key: "appendRows",
5205
5370
  value: function appendRows(data) {
5206
- var _this34 = this;
5371
+ var _this36 = this;
5207
5372
  this.hideError();
5208
5373
  var bodyHTML = '';
5209
5374
  if (data) {
5210
5375
  bodyHTML += data.map(function (r, rowIndex) {
5211
5376
  return '<tr>' + r.map(function (c, i) {
5212
- if (_this34.options.columns[i].show !== false) {
5377
+ if (_this36.options.columns[i].show !== false) {
5213
5378
  var style = '';
5214
5379
  if (c.style) {
5215
5380
  style += c.style;
5216
5381
  }
5217
- if (_this34.options.columns[i].width) {
5218
- style += "width: ".concat(_this34.options.columns[i].width, "; ");
5382
+ if (_this36.options.columns[i].width) {
5383
+ style += "width: ".concat(_this36.options.columns[i].width, "; ");
5219
5384
  }
5220
5385
  if (c.backgroundColor) {
5221
5386
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5226,16 +5391,16 @@ var WebsyTable = /*#__PURE__*/function () {
5226
5391
  if (c.color) {
5227
5392
  style += "color: ".concat(c.color, "; ");
5228
5393
  }
5229
- if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5230
- 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 ");
5231
- } else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5232
- 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 ");
5233
5398
  } else {
5234
5399
  var info = c.value;
5235
- if (_this34.options.columns[i].showAsImage === true) {
5400
+ if (_this36.options.columns[i].showAsImage === true) {
5236
5401
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5237
5402
  }
5238
- 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 ");
5239
5404
  }
5240
5405
  }
5241
5406
  }).join('') + '</tr>';
@@ -5394,7 +5559,7 @@ var WebsyTable = /*#__PURE__*/function () {
5394
5559
  }, {
5395
5560
  key: "render",
5396
5561
  value: function render(data) {
5397
- var _this35 = this;
5562
+ var _this37 = this;
5398
5563
  if (!this.options.columns) {
5399
5564
  return;
5400
5565
  }
@@ -5421,7 +5586,7 @@ var WebsyTable = /*#__PURE__*/function () {
5421
5586
  if (c.width) {
5422
5587
  style += "width: ".concat(c.width || 'auto', ";");
5423
5588
  }
5424
- 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 ");
5425
5590
  }
5426
5591
  }).join('') + '</tr>';
5427
5592
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5439,7 +5604,7 @@ var WebsyTable = /*#__PURE__*/function () {
5439
5604
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
5440
5605
  if (pagingEl) {
5441
5606
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5442
- 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>");
5443
5608
  });
5444
5609
  var startIndex = 0;
5445
5610
  if (this.options.pageCount > 8) {
@@ -5494,7 +5659,7 @@ var WebsyTable = /*#__PURE__*/function () {
5494
5659
  /* global WebsyDesigns */
5495
5660
  var WebsyTable2 = /*#__PURE__*/function () {
5496
5661
  function WebsyTable2(elementId, options) {
5497
- var _this36 = this;
5662
+ var _this38 = this;
5498
5663
  _classCallCheck(this, WebsyTable2);
5499
5664
  var DEFAULTS = {
5500
5665
  pageSize: 20,
@@ -5529,8 +5694,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5529
5694
  allowClear: false,
5530
5695
  disableSearch: true,
5531
5696
  onItemSelected: function onItemSelected(selectedItem) {
5532
- if (_this36.options.onChangePageSize) {
5533
- _this36.options.onChangePageSize(selectedItem.value);
5697
+ if (_this38.options.onChangePageSize) {
5698
+ _this38.options.onChangePageSize(selectedItem.value);
5534
5699
  }
5535
5700
  }
5536
5701
  });
@@ -5552,20 +5717,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
5552
5717
  _createClass(WebsyTable2, [{
5553
5718
  key: "appendRows",
5554
5719
  value: function appendRows(data) {
5555
- var _this37 = this;
5720
+ var _this39 = this;
5556
5721
  this.hideError();
5557
5722
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5558
5723
  var bodyHTML = '';
5559
5724
  if (data) {
5560
5725
  bodyHTML += data.map(function (r, rowIndex) {
5561
5726
  return '<tr>' + r.map(function (c, i) {
5562
- if (_this37.options.columns[i].show !== false) {
5563
- 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;");
5564
5729
  if (c.style) {
5565
5730
  style += c.style;
5566
5731
  }
5567
- if (_this37.options.columns[i].width) {
5568
- style += "width: ".concat(_this37.options.columns[i].width, "; ");
5732
+ if (_this39.options.columns[i].width) {
5733
+ style += "width: ".concat(_this39.options.columns[i].width, "; ");
5569
5734
  }
5570
5735
  if (c.backgroundColor) {
5571
5736
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5576,16 +5741,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
5576
5741
  if (c.color) {
5577
5742
  style += "color: ".concat(c.color, "; ");
5578
5743
  }
5579
- if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5580
- 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 ");
5581
- } else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5582
- 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 ");
5583
5748
  } else {
5584
5749
  var info = c.value;
5585
- if (_this37.options.columns[i].showAsImage === true) {
5750
+ if (_this39.options.columns[i].showAsImage === true) {
5586
5751
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5587
5752
  }
5588
- 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 ");
5589
5754
  }
5590
5755
  }
5591
5756
  }).join('') + '</tr>';
@@ -5819,7 +5984,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5819
5984
  }, {
5820
5985
  key: "render",
5821
5986
  value: function render(data) {
5822
- var _this38 = this;
5987
+ var _this40 = this;
5823
5988
  if (!this.options.columns) {
5824
5989
  return;
5825
5990
  }
@@ -5847,7 +6012,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5847
6012
  if (c.width) {
5848
6013
  style += "width: ".concat(c.width || 'auto', "; ");
5849
6014
  }
5850
- 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 ");
5851
6016
  }
5852
6017
  }).join('') + '</tr>';
5853
6018
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5857,7 +6022,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5857
6022
  var dropdownHTML = "";
5858
6023
  this.options.columns.forEach(function (c, i) {
5859
6024
  if (c.searchable && c.searchField) {
5860
- 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 ");
5861
6026
  }
5862
6027
  });
5863
6028
  dropdownEl.innerHTML = dropdownHTML;
@@ -5877,7 +6042,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5877
6042
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
5878
6043
  if (pagingEl) {
5879
6044
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5880
- 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>");
5881
6046
  });
5882
6047
  var startIndex = 0;
5883
6048
  if (this.options.pageCount > 8) {
@@ -5954,17 +6119,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
5954
6119
  }, {
5955
6120
  key: "getColumnParameters",
5956
6121
  value: function getColumnParameters(values) {
5957
- var _this39 = this;
6122
+ var _this41 = this;
5958
6123
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
5959
6124
  tableEl.style.tableLayout = 'auto';
5960
6125
  tableEl.style.width = 'auto';
5961
6126
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
5962
6127
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5963
6128
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
5964
- 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 ");
5965
6130
  }).join('') + '</tr>';
5966
6131
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
5967
- 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 ");
5968
6133
  }).join('') + '</tr>';
5969
6134
  // get height of the first data cell
5970
6135
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6120,7 +6285,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6120
6285
  }, {
6121
6286
  key: "buildBodyHtml",
6122
6287
  value: function buildBodyHtml() {
6123
- var _this40 = this;
6288
+ var _this42 = this;
6124
6289
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6125
6290
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6126
6291
  if (!this.options.columns) {
@@ -6145,7 +6310,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6145
6310
  row.forEach(function (cell, cellIndex) {
6146
6311
  var sizeIndex = cell.level || cellIndex;
6147
6312
  var colIndex = cell.index || cellIndex;
6148
- if (typeof sizingColumns[sizeIndex] === 'undefined' || _this40.options.columns[_this40.options.columns.length - 1][colIndex].show === false) {
6313
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || _this42.options.columns[_this42.options.columns.length - 1][colIndex].show === false) {
6149
6314
  return; // need to revisit this logic
6150
6315
  }
6151
6316
 
@@ -6172,7 +6337,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6172
6337
  style += "color: ".concat(cell.color, "; ");
6173
6338
  }
6174
6339
  // console.log('rowspan', cell.rowspan)
6175
- 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 ");
6176
6341
  // if (useWidths === true) {
6177
6342
  // bodyHtml += `
6178
6343
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6181,10 +6346,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6181
6346
  // }
6182
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 >");
6183
6348
  if (cell.expandable === true) {
6184
- 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>");
6185
6350
  }
6186
6351
  if (cell.collapsable === true) {
6187
- 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>");
6188
6353
  }
6189
6354
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6190
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 ");
@@ -6205,7 +6370,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6205
6370
  }, {
6206
6371
  key: "buildHeaderHtml",
6207
6372
  value: function buildHeaderHtml() {
6208
- var _this41 = this;
6373
+ var _this43 = this;
6209
6374
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6210
6375
  if (!this.options.columns) {
6211
6376
  return '';
@@ -6222,7 +6387,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6222
6387
  headerHtml += '</colgroup>';
6223
6388
  }
6224
6389
  this.options.columns.forEach(function (row, rowIndex) {
6225
- if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
6390
+ if (useWidths === false && rowIndex !== _this43.options.columns.length - 1) {
6226
6391
  // if we're calculating the size we only want to render the last row of column headers
6227
6392
  return;
6228
6393
  }
@@ -6246,24 +6411,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6246
6411
  if (col.style) {
6247
6412
  style += col.style;
6248
6413
  }
6249
- 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 ");
6250
6415
  // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6251
6416
  // headerHtml += `
6252
6417
  // style='width: ${col.width || col.actualWidth}px'
6253
6418
  // width='${col.width || col.actualWidth}'
6254
6419
  // `
6255
6420
  // }
6256
- 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>");
6257
6422
  });
6258
6423
  headerHtml += "</tr>";
6259
6424
  });
6260
6425
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6261
6426
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6262
6427
  if (c.searchable && c.isExternalSearch === true) {
6263
- 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));
6264
6429
  if (!testEl) {
6265
6430
  var newE = document.createElement('div');
6266
- newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
6431
+ newE.id = "".concat(_this43.elementId, "_columnSearch_").concat(c.dimId || i);
6267
6432
  newE.className = 'websy-modal-dropdown';
6268
6433
  dropdownEl.appendChild(newE);
6269
6434
  }
@@ -6286,7 +6451,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6286
6451
  }, {
6287
6452
  key: "buildTotalHtml",
6288
6453
  value: function buildTotalHtml() {
6289
- var _this42 = this;
6454
+ var _this44 = this;
6290
6455
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6291
6456
  if (!this.options.totals) {
6292
6457
  return '';
@@ -6302,7 +6467,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6302
6467
 
6303
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 ");
6304
6469
  if (useWidths === true) {
6305
- 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 ");
6306
6471
  }
6307
6472
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
6308
6473
  });
@@ -6312,7 +6477,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6312
6477
  }, {
6313
6478
  key: "calculateSizes",
6314
6479
  value: function calculateSizes() {
6315
- var _this43 = this;
6480
+ var _this45 = this;
6316
6481
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6317
6482
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
6318
6483
  var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
@@ -6356,7 +6521,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6356
6521
  rows.forEach(function (row, rowIndex) {
6357
6522
  Array.from(row.children).forEach(function (col, colIndex) {
6358
6523
  var colSize = col.getBoundingClientRect();
6359
- _this43.sizes.cellHeight = colSize.height;
6524
+ _this45.sizes.cellHeight = colSize.height;
6360
6525
  if (columnsForSizing[colIndex]) {
6361
6526
  if (!columnsForSizing[colIndex].actualWidth) {
6362
6527
  columnsForSizing[colIndex].potentialWidth = 0;
@@ -6368,7 +6533,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6368
6533
  // columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
6369
6534
  // }
6370
6535
  columnsForSizing[colIndex].cellHeight = colSize.height;
6371
- if (colIndex >= _this43.pinnedColumns) {
6536
+ if (colIndex >= _this45.pinnedColumns) {
6372
6537
  firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
6373
6538
  }
6374
6539
  }
@@ -6383,7 +6548,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6383
6548
  return a + (b.width || b.actualWidth);
6384
6549
  }, 0);
6385
6550
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
6386
- return i >= _this43.pinnedColumns;
6551
+ return i >= _this45.pinnedColumns;
6387
6552
  }).reduce(function (a, b) {
6388
6553
  return a + (b.width || b.actualWidth);
6389
6554
  }, 0);
@@ -6394,7 +6559,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6394
6559
  var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
6395
6560
  columnsForSizing.forEach(function (c) {
6396
6561
  c.shouldGrow = true;
6397
- if (_this43.options.autoFitColumns === false) {
6562
+ if (_this45.options.autoFitColumns === false) {
6398
6563
  c.shouldGrow = false;
6399
6564
  if (c.potentialWidth > c.actualWidth) {
6400
6565
  c.shouldGrow = true;
@@ -6413,7 +6578,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6413
6578
  // if (!c.width) {
6414
6579
  // if (c.actualWidth < equalWidth) {
6415
6580
  // adjust the width
6416
- if (_this43.options.autoFitColumns === true) {
6581
+ if (_this45.options.autoFitColumns === true) {
6417
6582
  if (c.width) {
6418
6583
  c.width += equalWidth;
6419
6584
  }
@@ -6437,9 +6602,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6437
6602
  }
6438
6603
  // }
6439
6604
  // }
6440
- _this43.sizes.totalWidth += c.width || c.actualWidth;
6441
- if (i > _this43.pinnedColumns) {
6442
- _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;
6443
6608
  }
6444
6609
  // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6445
6610
  });
@@ -6498,7 +6663,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6498
6663
  }, {
6499
6664
  key: "createSample",
6500
6665
  value: function createSample(data) {
6501
- var _this44 = this;
6666
+ var _this46 = this;
6502
6667
  var output = [];
6503
6668
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
6504
6669
  if (col.maxLength) {
@@ -6508,7 +6673,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6508
6673
  } else if (data) {
6509
6674
  var longest = '';
6510
6675
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
6511
- 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) {
6512
6677
  if (longest.length < data[i][colIndex].value.length) {
6513
6678
  longest = data[i][colIndex].value;
6514
6679
  }
@@ -6780,7 +6945,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6780
6945
  }, {
6781
6946
  key: "perpetualScroll",
6782
6947
  value: function perpetualScroll() {
6783
- var _this45 = this;
6948
+ var _this47 = this;
6784
6949
  // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
6785
6950
  if (this.touchEndTime - this.currentTouchtime > 300) {
6786
6951
  return;
@@ -6799,17 +6964,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
6799
6964
  var direction = touchDistance > 0 ? -1 : 1;
6800
6965
  var _loop2 = function _loop2(i) {
6801
6966
  setTimeout(function () {
6802
- 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;
6803
6968
  delta = Math.min(10, delta);
6804
6969
  delta = Math.max(-10, delta);
6805
6970
  // only run this if isPerpetual === true
6806
6971
  // this value is reset to false on touchStart
6807
- if (_this45.isPerpetual === true) {
6972
+ if (_this47.isPerpetual === true) {
6808
6973
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6809
6974
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
6810
- _this45.scrollY(Math.max(-5, Math.min(5, delta)));
6811
- if (_this45.scrollTimeout) {
6812
- clearTimeout(_this45.scrollTimeout);
6975
+ _this47.scrollY(Math.max(-5, Math.min(5, delta)));
6976
+ if (_this47.scrollTimeout) {
6977
+ clearTimeout(_this47.scrollTimeout);
6813
6978
  }
6814
6979
  }
6815
6980
  }, 1000 / fps * i);
@@ -7077,7 +7242,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7077
7242
  /* global d3 include WebsyDesigns */
7078
7243
  var WebsyChart = /*#__PURE__*/function () {
7079
7244
  function WebsyChart(elementId, options) {
7080
- var _this46 = this;
7245
+ var _this48 = this;
7081
7246
  _classCallCheck(this, WebsyChart);
7082
7247
  var DEFAULTS = {
7083
7248
  margin: {
@@ -7134,7 +7299,7 @@ var WebsyChart = /*#__PURE__*/function () {
7134
7299
  this.invertOverride = function (input, input2) {
7135
7300
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7136
7301
  var xAxis = 'bottom';
7137
- if (_this46.options.orientation === 'horizontal') {
7302
+ if (_this48.options.orientation === 'horizontal') {
7138
7303
  xAxis = 'left';
7139
7304
  }
7140
7305
  if (forBrush === true) {
@@ -7142,12 +7307,12 @@ var WebsyChart = /*#__PURE__*/function () {
7142
7307
  }
7143
7308
  xAxis += 'Axis';
7144
7309
  var output;
7145
- var width = _this46.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7310
+ var width = _this48.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7146
7311
  // if (this.customBottomRange) {
7147
- for (var index = 0; index < _this46.customBottomRange.length; index++) {
7148
- if (input > _this46.customBottomRange[index]) {
7149
- if (_this46.customBottomRange[index + 1]) {
7150
- 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]) {
7151
7316
  output = index;
7152
7317
  break;
7153
7318
  }
@@ -7322,9 +7487,9 @@ var WebsyChart = /*#__PURE__*/function () {
7322
7487
  }, {
7323
7488
  key: "handleEventMouseMove",
7324
7489
  value: function handleEventMouseMove(event, d) {
7325
- var _this47 = this;
7490
+ var _this49 = this;
7326
7491
  var bisectDate = d3.bisector(function (d) {
7327
- return _this47.parseX(d.x.value);
7492
+ return _this49.parseX(d.x.value);
7328
7493
  }).left;
7329
7494
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
7330
7495
  var xAxis = 'bottomAxis';
@@ -7357,9 +7522,9 @@ var WebsyChart = /*#__PURE__*/function () {
7357
7522
  xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
7358
7523
  }
7359
7524
  this.options.data.series.forEach(function (s) {
7360
- if (_this47.options.data[xData].scale !== 'Time') {
7525
+ if (_this49.options.data[xData].scale !== 'Time') {
7361
7526
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7362
- 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;
7363
7528
  // }
7364
7529
  // else {
7365
7530
  // xPoint = this[xAxis](this.parseX(xLabel))
@@ -7379,41 +7544,41 @@ var WebsyChart = /*#__PURE__*/function () {
7379
7544
  var index = bisectDate(s.data, x0, 1);
7380
7545
  var pointA = s.data[index - 1];
7381
7546
  var pointB = s.data[index];
7382
- if (_this47.options.orientation === 'horizontal') {
7547
+ if (_this49.options.orientation === 'horizontal') {
7383
7548
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7384
7549
  pointB = _toConsumableArray(s.data).reverse()[index];
7385
7550
  }
7386
7551
  if (pointA && !pointB) {
7387
- xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
7552
+ xPoint = _this49[xAxis](_this49.parseX(pointA.x.value));
7388
7553
  tooltipTitle = pointA.x.value;
7389
7554
  if (!pointA.y.color) {
7390
7555
  pointA.y.color = s.color;
7391
7556
  }
7392
7557
  tooltipData.push(pointA);
7393
7558
  if (typeof pointA.x.value.getTime !== 'undefined') {
7394
- 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);
7395
7560
  }
7396
7561
  }
7397
7562
  if (pointB && !pointA) {
7398
- xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
7563
+ xPoint = _this49[xAxis](_this49.parseX(pointB.x.value));
7399
7564
  tooltipTitle = pointB.x.value;
7400
7565
  if (!pointB.y.color) {
7401
7566
  pointB.y.color = s.color;
7402
7567
  }
7403
7568
  tooltipData.push(pointB);
7404
7569
  if (typeof pointB.x.value.getTime !== 'undefined') {
7405
- 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);
7406
7571
  }
7407
7572
  }
7408
7573
  if (pointA && pointB) {
7409
- var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
7410
- 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));
7411
7576
  var mid = Math.abs(d0 - d1) / 2;
7412
7577
  if (d3.pointer(event)[0] - d0 >= mid) {
7413
7578
  xPoint = d1;
7414
7579
  tooltipTitle = pointB.x.value;
7415
7580
  if (typeof pointB.x.value.getTime !== 'undefined') {
7416
- 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);
7417
7582
  }
7418
7583
  if (!pointB.y.color) {
7419
7584
  pointB.y.color = s.color;
@@ -7423,7 +7588,7 @@ var WebsyChart = /*#__PURE__*/function () {
7423
7588
  xPoint = d0;
7424
7589
  tooltipTitle = pointA.x.value;
7425
7590
  if (typeof pointB.x.value.getTime !== 'undefined') {
7426
- 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);
7427
7592
  }
7428
7593
  if (!pointA.y.color) {
7429
7594
  pointA.y.color = s.color;
@@ -7549,7 +7714,7 @@ var WebsyChart = /*#__PURE__*/function () {
7549
7714
  }, {
7550
7715
  key: "render",
7551
7716
  value: function render(options) {
7552
- var _this48 = this;
7717
+ var _this50 = this;
7553
7718
  /* global d3 options WebsyUtils */
7554
7719
  if (typeof options !== 'undefined') {
7555
7720
  this.options = _extends({}, this.options, options);
@@ -7617,7 +7782,7 @@ var WebsyChart = /*#__PURE__*/function () {
7617
7782
  this.options.data.series.map(function (s, i) {
7618
7783
  return {
7619
7784
  value: s.label || s.key,
7620
- color: s.color || _this48.options.colors[i % _this48.options.colors.length]
7785
+ color: s.color || _this50.options.colors[i % _this50.options.colors.length]
7621
7786
  };
7622
7787
  });
7623
7788
  }
@@ -7974,25 +8139,25 @@ var WebsyChart = /*#__PURE__*/function () {
7974
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') {
7975
8140
  var acc = 0;
7976
8141
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
7977
- var adjustment = _this48.bandPadding * index + _this48.bandPadding;
8142
+ var adjustment = _this50.bandPadding * index + _this50.bandPadding;
7978
8143
  // if (this.options.data.bottom.padding) {
7979
8144
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
7980
8145
  // }
7981
- var start = _this48.widthForCalc / noOfPoints * acc;
8146
+ var start = _this50.widthForCalc / noOfPoints * acc;
7982
8147
  for (var i = 0; i < (d.valueCount || 1); i++) {
7983
8148
  var pos = i * proposedBandWidth;
7984
- _this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8149
+ _this50["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
7985
8150
  }
7986
- acc += _this48.options.grouping !== 'stacked' && _this48.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
7987
- 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;
7988
8153
  // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
7989
8154
  return end + adjustment;
7990
8155
  })));
7991
8156
  acc = 0;
7992
8157
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
7993
- var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
7994
- acc += _this48.options.grouping !== 'stacked' && _this48.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
7995
- 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;
7996
8161
  })));
7997
8162
  }
7998
8163
  // }
@@ -8165,7 +8330,7 @@ var WebsyChart = /*#__PURE__*/function () {
8165
8330
  this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
8166
8331
  if (this.options.data.bottom.formatter) {
8167
8332
  this.bAxisFunc.tickFormat(function (d) {
8168
- return _this48.options.data.bottom.formatter(d);
8333
+ return _this50.options.data.bottom.formatter(d);
8169
8334
  });
8170
8335
  }
8171
8336
  this.bottomAxisLayer.call(this.bAxisFunc);
@@ -8175,7 +8340,7 @@ var WebsyChart = /*#__PURE__*/function () {
8175
8340
  }
8176
8341
  if (this.customBottomRange.length > 0) {
8177
8342
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8178
- 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)");
8179
8344
  });
8180
8345
  }
8181
8346
  }
@@ -8194,14 +8359,14 @@ var WebsyChart = /*#__PURE__*/function () {
8194
8359
  }
8195
8360
  if (this.options.margin.axisLeft > 0) {
8196
8361
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8197
- if (_this48.options.data.left.formatter) {
8198
- d = _this48.options.data.left.formatter(d);
8362
+ if (_this50.options.data.left.formatter) {
8363
+ d = _this50.options.data.left.formatter(d);
8199
8364
  }
8200
8365
  return d;
8201
8366
  }));
8202
8367
  if (this.customLeftRange.length > 0) {
8203
8368
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8204
- 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, ")");
8205
8370
  });
8206
8371
  }
8207
8372
  }
@@ -8229,8 +8394,8 @@ var WebsyChart = /*#__PURE__*/function () {
8229
8394
  }
8230
8395
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8231
8396
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8232
- if (_this48.options.data.right.formatter) {
8233
- d = _this48.options.data.right.formatter(d);
8397
+ if (_this50.options.data.right.formatter) {
8398
+ d = _this50.options.data.right.formatter(d);
8234
8399
  }
8235
8400
  return d;
8236
8401
  }));
@@ -8270,50 +8435,50 @@ var WebsyChart = /*#__PURE__*/function () {
8270
8435
  }, {
8271
8436
  key: "renderComponents",
8272
8437
  value: function renderComponents() {
8273
- var _this49 = this;
8438
+ var _this51 = this;
8274
8439
  // Draw the series data
8275
8440
  this.renderedKeys = {};
8276
8441
  this.options.data.series.forEach(function (series, index) {
8277
8442
  if (!series.key) {
8278
- series.key = _this49.createIdentity();
8443
+ series.key = _this51.createIdentity();
8279
8444
  }
8280
8445
  if (!series.color) {
8281
- series.color = _this49.options.colors[index % _this49.options.colors.length];
8446
+ series.color = _this51.options.colors[index % _this51.options.colors.length];
8282
8447
  }
8283
- _this49["render".concat(series.type || 'bar')](series, index);
8284
- _this49.renderLabels(series, index);
8285
- _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;
8286
8451
  });
8287
8452
  this.refLineLayer.selectAll('.reference-line').remove();
8288
8453
  this.refLineLayer.selectAll('.reference-line-label').remove();
8289
8454
  if (this.options.refLines && this.options.refLines.length > 0) {
8290
8455
  this.options.refLines.forEach(function (l) {
8291
- return _this49.renderRefLine(l);
8456
+ return _this51.renderRefLine(l);
8292
8457
  });
8293
8458
  }
8294
8459
  }
8295
8460
  }, {
8296
8461
  key: "renderarea",
8297
8462
  value: function renderarea(series, index) {
8298
- var _this50 = this;
8463
+ var _this52 = this;
8299
8464
  /* global d3 series index */
8300
8465
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8301
8466
  return d3.area().x(function (d) {
8302
- if (_this50.options.data[xAxis].scale === 'Time') {
8303
- 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));
8304
8469
  } else {
8305
- var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
8306
- var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8307
- if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8308
- 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;
8309
8474
  }
8310
8475
  return xPos;
8311
8476
  }
8312
8477
  }).y0(function (d) {
8313
- return _this50["".concat(yAxis, "Axis")](0);
8478
+ return _this52["".concat(yAxis, "Axis")](0);
8314
8479
  }).y1(function (d) {
8315
- return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8316
- }).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]);
8317
8482
  };
8318
8483
  var xAxis = 'bottom';
8319
8484
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8353,7 +8518,7 @@ var WebsyChart = /*#__PURE__*/function () {
8353
8518
  }, {
8354
8519
  key: "renderbar",
8355
8520
  value: function renderbar(series, index) {
8356
- var _this51 = this;
8521
+ var _this53 = this;
8357
8522
  /* global series index d3 */
8358
8523
  var xAxis = 'bottom';
8359
8524
  var yAxis = 'left';
@@ -8520,26 +8685,26 @@ var WebsyChart = /*#__PURE__*/function () {
8520
8685
  }
8521
8686
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8522
8687
  bars.attr('width', function (d, i) {
8523
- return Math.abs(getBarWidth.call(_this51, d, i, yAxis, xAxis));
8688
+ return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
8524
8689
  }).attr('height', function (d, i) {
8525
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
8690
+ return getBarHeight.call(_this53, d, i, yAxis, xAxis);
8526
8691
  }).attr('x', function (d, i) {
8527
- return getBarX.call(_this51, d, i, yAxis, xAxis);
8692
+ return getBarX.call(_this53, d, i, yAxis, xAxis);
8528
8693
  }).attr('y', function (d, i) {
8529
- return getBarY.call(_this51, d, i, yAxis, xAxis);
8694
+ return getBarY.call(_this53, d, i, yAxis, xAxis);
8530
8695
  })
8531
8696
  // .transition(this.transition)
8532
8697
  .attr('fill', function (d) {
8533
8698
  return d.y.color || d.color || series.color;
8534
8699
  });
8535
8700
  bars.enter().append('rect').attr('width', function (d, i) {
8536
- return Math.abs(getBarWidth.call(_this51, d, i, yAxis, xAxis));
8701
+ return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
8537
8702
  }).attr('height', function (d, i) {
8538
- return getBarHeight.call(_this51, d, i, yAxis, xAxis);
8703
+ return getBarHeight.call(_this53, d, i, yAxis, xAxis);
8539
8704
  }).attr('x', function (d, i) {
8540
- return getBarX.call(_this51, d, i, yAxis, xAxis);
8705
+ return getBarX.call(_this53, d, i, yAxis, xAxis);
8541
8706
  }).attr('y', function (d, i) {
8542
- return getBarY.call(_this51, d, i, yAxis, xAxis);
8707
+ return getBarY.call(_this53, d, i, yAxis, xAxis);
8543
8708
  })
8544
8709
  // .transition(this.transition)
8545
8710
  .attr('fill', function (d) {
@@ -8551,26 +8716,26 @@ var WebsyChart = /*#__PURE__*/function () {
8551
8716
  this.brushBarsInitialized[series.key] = true;
8552
8717
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8553
8718
  brushBars.attr('width', function (d, i) {
8554
- 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")));
8555
8720
  }).attr('height', function (d, i) {
8556
- 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"));
8557
8722
  }).attr('x', function (d, i) {
8558
- 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"));
8559
8724
  }).attr('y', function (d, i) {
8560
- 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"));
8561
8726
  })
8562
8727
  // .transition(this.transition)
8563
8728
  .attr('fill', function (d) {
8564
8729
  return d.y.color || d.color || series.color;
8565
8730
  });
8566
8731
  brushBars.enter().append('rect').attr('width', function (d, i) {
8567
- 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")));
8568
8733
  }).attr('height', function (d, i) {
8569
- 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"));
8570
8735
  }).attr('x', function (d, i) {
8571
- 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"));
8572
8737
  }).attr('y', function (d, i) {
8573
- 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"));
8574
8739
  })
8575
8740
  // .transition(this.transition)
8576
8741
  .attr('fill', function (d) {
@@ -8591,7 +8756,7 @@ var WebsyChart = /*#__PURE__*/function () {
8591
8756
  }, {
8592
8757
  key: "renderLabels",
8593
8758
  value: function renderLabels(series, index) {
8594
- var _this52 = this;
8759
+ var _this54 = this;
8595
8760
  /* global series index d3 WebsyDesigns */
8596
8761
  var xAxis = 'bottom';
8597
8762
  var yAxis = 'left';
@@ -8607,14 +8772,14 @@ var WebsyChart = /*#__PURE__*/function () {
8607
8772
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
8608
8773
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
8609
8774
  labels.attr('x', function (d) {
8610
- return getLabelX.call(_this52, d, series.labelPosition);
8775
+ return getLabelX.call(_this54, d, series.labelPosition);
8611
8776
  }).attr('y', function (d) {
8612
- return getLabelY.call(_this52, d, series.labelPosition);
8777
+ return getLabelY.call(_this54, d, series.labelPosition);
8613
8778
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
8614
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
8779
+ if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
8615
8780
  return 'transparent';
8616
8781
  }
8617
- 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);
8618
8783
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
8619
8784
  return d.y.label || d.y.value;
8620
8785
  }).each(function (d, i) {
@@ -8648,14 +8813,14 @@ var WebsyChart = /*#__PURE__*/function () {
8648
8813
  }
8649
8814
  });
8650
8815
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
8651
- return getLabelX.call(_this52, d, series.labelPosition);
8816
+ return getLabelX.call(_this54, d, series.labelPosition);
8652
8817
  }).attr('y', function (d) {
8653
- return getLabelY.call(_this52, d, series.labelPosition);
8818
+ return getLabelY.call(_this54, d, series.labelPosition);
8654
8819
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
8655
- if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
8820
+ if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
8656
8821
  return 'transparent';
8657
8822
  }
8658
- 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);
8659
8824
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
8660
8825
  return d.y.label || d.y.value;
8661
8826
  }).each(function (d, i) {
@@ -8733,32 +8898,32 @@ var WebsyChart = /*#__PURE__*/function () {
8733
8898
  }, {
8734
8899
  key: "renderline",
8735
8900
  value: function renderline(series, index) {
8736
- var _this53 = this;
8901
+ var _this55 = this;
8737
8902
  /* global series index d3 */
8738
8903
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
8739
8904
  return d3.line().x(function (d) {
8740
- if (_this53.options.orientation === 'horizontal') {
8741
- 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);
8742
8907
  } else {
8743
- if (_this53.options.data[xAxis].scale === 'Time') {
8744
- 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));
8745
8910
  } else {
8746
- var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
8747
- var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8748
- if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8749
- 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;
8750
8915
  }
8751
8916
  return xPos;
8752
8917
  }
8753
8918
  }
8754
8919
  }).y(function (d) {
8755
- if (_this53.options.orientation === 'horizontal') {
8756
- var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
8757
- 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;
8758
8923
  } else {
8759
- 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);
8760
8925
  }
8761
- }).curve(d3[curveStyle || _this53.options.curveStyle]);
8926
+ }).curve(d3[curveStyle || _this55.options.curveStyle]);
8762
8927
  };
8763
8928
  var xAxis = 'bottom';
8764
8929
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8867,14 +9032,14 @@ var WebsyChart = /*#__PURE__*/function () {
8867
9032
  }, {
8868
9033
  key: "rendersymbol",
8869
9034
  value: function rendersymbol(series, index) {
8870
- var _this54 = this;
9035
+ var _this56 = this;
8871
9036
  /* global d3 series index series.key */
8872
9037
  var drawSymbol = function drawSymbol(size) {
8873
9038
  return d3.symbol()
8874
9039
  // .type(d => {
8875
9040
  // return d3.symbols[0]
8876
9041
  // })
8877
- .size(size || _this54.options.symbolSize);
9042
+ .size(size || _this56.options.symbolSize);
8878
9043
  };
8879
9044
  var xAxis = 'bottom';
8880
9045
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8900,27 +9065,27 @@ var WebsyChart = /*#__PURE__*/function () {
8900
9065
  // else {
8901
9066
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8902
9067
  // }
8903
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8904
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8905
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8906
- xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8907
- }
8908
- var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
8909
- if (_this54.options.orientation === 'horizontal') {
8910
- 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, ")");
8911
9076
  } else {
8912
- if (_this54.options.data[xAxis].scale === 'Time') {
8913
- 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));
8914
9079
  } else {
8915
- var _xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8916
- var _xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
8917
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
8918
- _xPos = _xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
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;
8919
9084
  }
8920
9085
  // return xPos
8921
9086
  }
8922
9087
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8923
- 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), ")");
8924
9089
  }
8925
9090
  });
8926
9091
  // Enter
@@ -8935,27 +9100,27 @@ var WebsyChart = /*#__PURE__*/function () {
8935
9100
  }).attr('class', function (d) {
8936
9101
  return "symbol symbol_".concat(series.key);
8937
9102
  }).attr('transform', function (d) {
8938
- var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8939
- var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8940
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8941
- xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8942
- }
8943
- var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
8944
- if (_this54.options.orientation === 'horizontal') {
8945
- 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, ")");
8946
9111
  } else {
8947
- if (_this54.options.data[xAxis].scale === 'Time') {
8948
- 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));
8949
9114
  } else {
8950
- var _xIndex2 = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
8951
- var _xPos2 = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
8952
- if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
8953
- _xPos2 = _xPos2 + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
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;
8954
9119
  }
8955
9120
  // return xPos
8956
9121
  }
8957
9122
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8958
- 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), ")");
8959
9124
  }
8960
9125
  });
8961
9126
  }
@@ -9151,7 +9316,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9151
9316
  }, {
9152
9317
  key: "resize",
9153
9318
  value: function resize() {
9154
- var _this55 = this;
9319
+ var _this57 = this;
9155
9320
  var el = document.getElementById(this.elementId);
9156
9321
  if (el) {
9157
9322
  // if (this.options.width) {
@@ -9162,7 +9327,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9162
9327
  // }
9163
9328
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9164
9329
  html += this._data.map(function (d, i) {
9165
- return _this55.getLegendItemHTML(d);
9330
+ return _this57.getLegendItemHTML(d);
9166
9331
  }).join('');
9167
9332
  html += "\n <div>\n ";
9168
9333
  el.innerHTML = html;
@@ -9306,14 +9471,14 @@ var WebsyMap = /*#__PURE__*/function () {
9306
9471
  }, {
9307
9472
  key: "render",
9308
9473
  value: function render() {
9309
- var _this56 = this;
9474
+ var _this58 = this;
9310
9475
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
9311
9476
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
9312
9477
  if (this.options.showLegend === true && this.options.data.polygons) {
9313
9478
  var legendData = this.options.data.polygons.map(function (s, i) {
9314
9479
  return {
9315
9480
  value: s.label || s.key,
9316
- color: s.color || _this56.options.colors[i % _this56.options.colors.length]
9481
+ color: s.color || _this58.options.colors[i % _this58.options.colors.length]
9317
9482
  };
9318
9483
  });
9319
9484
  var longestValue = legendData.map(function (s) {
@@ -9367,7 +9532,7 @@ var WebsyMap = /*#__PURE__*/function () {
9367
9532
  }
9368
9533
  if (this.polygons) {
9369
9534
  this.polygons.forEach(function (p) {
9370
- return _this56.map.removeLayer(p);
9535
+ return _this58.map.removeLayer(p);
9371
9536
  });
9372
9537
  }
9373
9538
  this.polygons = [];
@@ -9421,15 +9586,15 @@ var WebsyMap = /*#__PURE__*/function () {
9421
9586
  p.options = {};
9422
9587
  }
9423
9588
  if (!p.options.color) {
9424
- p.options.color = _this56.options.colors[i % _this56.options.colors.length];
9589
+ p.options.color = _this58.options.colors[i % _this58.options.colors.length];
9425
9590
  }
9426
9591
  var pol = L.polygon(p.data.map(function (c) {
9427
9592
  return c.map(function (d) {
9428
9593
  return [d.Latitude, d.Longitude];
9429
9594
  });
9430
- }), p.options).addTo(_this56.map);
9431
- _this56.polygons.push(pol);
9432
- _this56.map.fitBounds(pol.getBounds());
9595
+ }), p.options).addTo(_this58.map);
9596
+ _this58.polygons.push(pol);
9597
+ _this58.map.fitBounds(pol.getBounds());
9433
9598
  });
9434
9599
  }
9435
9600
  // if (this.data.markers.length > 0) {