@websy/websy-designs 1.6.3 → 1.7.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.
@@ -2035,29 +2035,6 @@ var WebsyDropdown = /*#__PURE__*/function () {
2035
2035
 
2036
2036
  this.updateHeader(item);
2037
2037
  }
2038
- }, {
2039
- key: "setValue",
2040
- value: function setValue(value) {
2041
- var _this11 = this;
2042
-
2043
- this.selectedItems = [];
2044
-
2045
- if (Array.isArray(value)) {
2046
- this.options.items.forEach(function (d) {
2047
- if (value.indexOf(d.value) !== -1) {
2048
- _this11.selectedItems.push(d.index);
2049
- }
2050
- });
2051
- } else {
2052
- this.options.items.forEach(function (d) {
2053
- if (d.value === value) {
2054
- _this11.selectedItems.push(d.index);
2055
- }
2056
- });
2057
- }
2058
-
2059
- this.render();
2060
- }
2061
2038
  }, {
2062
2039
  key: "updateHeader",
2063
2040
  value: function updateHeader(item) {
@@ -2170,6 +2147,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
2170
2147
  this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
2171
2148
  }
2172
2149
 
2150
+ if (this.options.onChange) {
2151
+ this.options.onChange(this);
2152
+ }
2153
+
2173
2154
  if (this.options.closeAfterSelection === true) {
2174
2155
  this.close();
2175
2156
  }
@@ -2215,6 +2196,40 @@ var WebsyDropdown = /*#__PURE__*/function () {
2215
2196
  get: function get() {
2216
2197
  return this.options.items;
2217
2198
  }
2199
+ }, {
2200
+ key: "value",
2201
+ get: function get() {
2202
+ var _this11 = this;
2203
+
2204
+ if (this.selectedItems && this.selectedItems.length > 0) {
2205
+ return this.selectedItems.map(function (d, i) {
2206
+ return _this11.options.items[+d];
2207
+ });
2208
+ }
2209
+
2210
+ return [];
2211
+ },
2212
+ set: function set(value) {
2213
+ var _this12 = this;
2214
+
2215
+ this.selectedItems = [];
2216
+
2217
+ if (Array.isArray(value)) {
2218
+ this.options.items.forEach(function (d) {
2219
+ if (value.indexOf(d.value) !== -1) {
2220
+ _this12.selectedItems.push(d.index);
2221
+ }
2222
+ });
2223
+ } else {
2224
+ this.options.items.forEach(function (d) {
2225
+ if (d.value === value) {
2226
+ _this12.selectedItems.push(d.index);
2227
+ }
2228
+ });
2229
+ }
2230
+
2231
+ this.render();
2232
+ }
2218
2233
  }]);
2219
2234
 
2220
2235
  return WebsyDropdown;
@@ -2259,7 +2274,9 @@ var WebsyForm = /*#__PURE__*/function () {
2259
2274
  // if (this.options.classes) {
2260
2275
  // this.options.classes.forEach(c => el.classList.add(c))
2261
2276
  // }
2277
+ el.addEventListener('change', this.handleChange.bind(this));
2262
2278
  el.addEventListener('click', this.handleClick.bind(this));
2279
+ el.addEventListener('focusout', this.handleFocusOut.bind(this));
2263
2280
  el.addEventListener('keyup', this.handleKeyUp.bind(this));
2264
2281
  el.addEventListener('keydown', this.handleKeyDown.bind(this));
2265
2282
  this.render();
@@ -2279,19 +2296,19 @@ var WebsyForm = /*#__PURE__*/function () {
2279
2296
  }, {
2280
2297
  key: "checkRecaptcha",
2281
2298
  value: function checkRecaptcha() {
2282
- var _this12 = this;
2299
+ var _this13 = this;
2283
2300
 
2284
2301
  return new Promise(function (resolve, reject) {
2285
- if (_this12.options.useRecaptcha === true) {
2286
- if (_this12.recaptchaValue) {
2302
+ if (_this13.options.useRecaptcha === true) {
2303
+ if (_this13.recaptchaValue) {
2287
2304
  // grecaptcha.ready(() => {
2288
2305
  // grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
2289
- _this12.apiService.add('google/checkrecaptcha', {
2290
- grecaptcharesponse: _this12.recaptchaValue
2306
+ _this13.apiService.add('google/checkrecaptcha', {
2307
+ grecaptcharesponse: _this13.recaptchaValue
2291
2308
  }).then(function (response) {
2292
2309
  if (response.success && response.success === true) {
2293
2310
  resolve(true);
2294
- grecaptcha.reset("".concat(_this12.elementId, "_recaptcha"), {
2311
+ grecaptcha.reset("".concat(_this13.elementId, "_recaptcha"), {
2295
2312
  sitekey: ENVIRONMENT.RECAPTCHA_KEY
2296
2313
  });
2297
2314
  } else {
@@ -2328,6 +2345,24 @@ var WebsyForm = /*#__PURE__*/function () {
2328
2345
  el.innerHTML = msg;
2329
2346
  }
2330
2347
  }
2348
+ }, {
2349
+ key: "handleChange",
2350
+ value: function handleChange(event) {
2351
+ if (event.target.getAttribute('data-user-type') === 'expiry') {
2352
+ if (event.target.value.length === 7) {
2353
+ var value = event.target.value.split('/');
2354
+ event.target.value = "".concat(value[0], "/").concat(value[1].substring(2, 4));
2355
+ }
2356
+ }
2357
+
2358
+ if (event.target.classList.contains('websy-input')) {
2359
+ var index = event.target.getAttribute('data-index');
2360
+
2361
+ if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
2362
+ this.validateField(this.options.fields[index], event.target.value);
2363
+ }
2364
+ }
2365
+ }
2331
2366
  }, {
2332
2367
  key: "handleClick",
2333
2368
  value: function handleClick(event) {
@@ -2339,27 +2374,104 @@ var WebsyForm = /*#__PURE__*/function () {
2339
2374
  this.cancelForm();
2340
2375
  }
2341
2376
  }
2377
+ }, {
2378
+ key: "handleFocusOut",
2379
+ value: function handleFocusOut(event) {
2380
+ if (event.target.classList.contains('websy-input')) {
2381
+ var index = event.target.getAttribute('data-index');
2382
+
2383
+ if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
2384
+ this.validateField(this.options.fields[index], event.target.value);
2385
+ }
2386
+ }
2387
+ }
2342
2388
  }, {
2343
2389
  key: "handleKeyDown",
2344
2390
  value: function handleKeyDown(event) {
2345
2391
  if (event.key === 'enter') {
2346
2392
  this.submitForm();
2347
2393
  }
2394
+
2395
+ if (event.target.getAttribute('data-user-type') === 'expiry') {
2396
+ var isNumeric = !isNaN(event.key);
2397
+ var validKey = false;
2398
+
2399
+ if (!validKey) {
2400
+ validKey = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].indexOf(event.key) !== -1;
2401
+ }
2402
+
2403
+ if (event.target.value.length === 5 && !validKey || !validKey && !isNumeric) {
2404
+ event.preventDefault();
2405
+ return false;
2406
+ }
2407
+
2408
+ if (event.key === 'Backspace') {
2409
+ if (event.target.value.indexOf('/') === event.target.selectionStart - 1) {
2410
+ var chars = event.target.value.split('');
2411
+ chars.pop();
2412
+ event.target.value = chars.join('');
2413
+ }
2414
+ }
2415
+ }
2416
+
2417
+ if (event.target.getAttribute('data-user-type') === 'cvv') {
2418
+ var _isNumeric = !isNaN(event.key);
2419
+
2420
+ var _validKey = false;
2421
+
2422
+ if (!_validKey) {
2423
+ _validKey = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].indexOf(event.key) !== -1;
2424
+ }
2425
+
2426
+ if (event.target.value.length === 3 && !_validKey || !_validKey && !_isNumeric) {
2427
+ event.preventDefault();
2428
+ return false;
2429
+ }
2430
+ }
2348
2431
  }
2349
2432
  }, {
2350
2433
  key: "handleKeyUp",
2351
- value: function handleKeyUp(event) {}
2434
+ value: function handleKeyUp(event) {
2435
+ if (event.target.getAttribute('data-user-type') === 'expiry') {
2436
+ var chars = event.target.value.split('');
2437
+ var isNumeric = !isNaN(event.key);
2438
+
2439
+ if (event.key === 'Backspace') {
2440
+ if (chars[chars.length - 1] === '/' && chars.length !== 3) {
2441
+ chars.pop();
2442
+ event.target.value = chars.join('');
2443
+ return;
2444
+ }
2445
+ }
2446
+
2447
+ if (event.target.selectionStart === 2) {
2448
+ if (chars[2] && ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'].indexOf(event.key) === -1) {
2449
+ event.target.setSelectionRange(3, 3);
2450
+ } else if (isNumeric) {
2451
+ event.target.value += '/';
2452
+ }
2453
+ }
2454
+ }
2455
+ }
2352
2456
  }, {
2353
2457
  key: "processComponents",
2354
2458
  value: function processComponents(components, callbackFn) {
2355
- var _this13 = this;
2459
+ var _this14 = this;
2356
2460
 
2357
2461
  if (components.length === 0) {
2358
2462
  callbackFn();
2359
2463
  } else {
2360
2464
  components.forEach(function (c) {
2361
2465
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
2362
- c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
2466
+ if (!c.options.onChange) {
2467
+ c.options.onChange = function () {
2468
+ if (c.required || c.validate) {
2469
+ _this14.validateField(c, c.instance.value);
2470
+ }
2471
+ };
2472
+ }
2473
+
2474
+ c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
2363
2475
  } else {// some user feedback here
2364
2476
  }
2365
2477
  });
@@ -2368,15 +2480,15 @@ var WebsyForm = /*#__PURE__*/function () {
2368
2480
  }, {
2369
2481
  key: "recaptchaReady",
2370
2482
  value: function recaptchaReady() {
2371
- var _this14 = this;
2483
+ var _this15 = this;
2372
2484
 
2373
2485
  var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
2374
2486
 
2375
2487
  if (el) {
2376
2488
  grecaptcha.ready(function () {
2377
- grecaptcha.render("".concat(_this14.elementId, "_recaptcha"), {
2489
+ grecaptcha.render("".concat(_this15.elementId, "_recaptcha"), {
2378
2490
  sitekey: ENVIRONMENT.RECAPTCHA_KEY,
2379
- callback: _this14.validateRecaptcha.bind(_this14)
2491
+ callback: _this15.validateRecaptcha.bind(_this15)
2380
2492
  });
2381
2493
  });
2382
2494
  }
@@ -2384,7 +2496,7 @@ var WebsyForm = /*#__PURE__*/function () {
2384
2496
  }, {
2385
2497
  key: "render",
2386
2498
  value: function render(update, data) {
2387
- var _this15 = this;
2499
+ var _this16 = this;
2388
2500
 
2389
2501
  var el = document.getElementById(this.elementId);
2390
2502
  var componentsToProcess = [];
@@ -2392,15 +2504,15 @@ var WebsyForm = /*#__PURE__*/function () {
2392
2504
  if (el) {
2393
2505
  var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
2394
2506
  this.options.fields.forEach(function (f, i) {
2395
- _this15.fieldMap[f.field] = f;
2507
+ _this16.fieldMap[f.field] = f;
2396
2508
 
2397
2509
  if (f.component) {
2398
2510
  componentsToProcess.push(f);
2399
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this15.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2511
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this16.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\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(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this16.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2400
2512
  } else if (f.type === 'longtext') {
2401
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this15.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2513
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this16.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\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(_this16.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(_this16.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2402
2514
  } else {
2403
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this15.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2515
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this16.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\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(_this16.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(_this16.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2404
2516
  }
2405
2517
  });
2406
2518
 
@@ -2417,8 +2529,8 @@ var WebsyForm = /*#__PURE__*/function () {
2417
2529
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
2418
2530
  el.innerHTML = html;
2419
2531
  this.processComponents(componentsToProcess, function () {
2420
- if (_this15.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2421
- _this15.recaptchaReady();
2532
+ if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
2533
+ _this16.recaptchaReady();
2422
2534
  }
2423
2535
  });
2424
2536
  }
@@ -2428,7 +2540,7 @@ var WebsyForm = /*#__PURE__*/function () {
2428
2540
  value: function setValue(field, value) {
2429
2541
  if (this.fieldMap[field]) {
2430
2542
  if (this.fieldMap[field].instance) {
2431
- this.fieldMap[field].instance.setValue(value);
2543
+ this.fieldMap[field].instance.value = value;
2432
2544
  } else {
2433
2545
  var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
2434
2546
 
@@ -2445,13 +2557,17 @@ var WebsyForm = /*#__PURE__*/function () {
2445
2557
  }, {
2446
2558
  key: "submitForm",
2447
2559
  value: function submitForm() {
2448
- var _this16 = this;
2560
+ var _this17 = this;
2449
2561
 
2450
2562
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2451
2563
  var buttonEl = formEl.querySelector('button.websy-btn.submit');
2452
2564
  var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
2453
2565
 
2454
- if (formEl.reportValidity() === true) {
2566
+ if (this.options.preSubmitFn && this.options.preSubmitFn() === false) {
2567
+ return;
2568
+ }
2569
+
2570
+ if (this.validateForm() === true) {
2455
2571
  if (buttonEl) {
2456
2572
  buttonEl.setAttribute('disabled', true);
2457
2573
  }
@@ -2473,34 +2589,34 @@ var WebsyForm = /*#__PURE__*/function () {
2473
2589
  data[key] = value;
2474
2590
  });
2475
2591
 
2476
- if (_this16.options.url) {
2477
- var _this16$apiService;
2592
+ if (_this17.options.url) {
2593
+ var _this17$apiService;
2478
2594
 
2479
- var params = [_this16.options.url];
2595
+ var params = [_this17.options.url];
2480
2596
 
2481
- if (_this16.options.mode === 'update') {
2482
- params.push(_this16.options.id);
2597
+ if (_this17.options.mode === 'update') {
2598
+ params.push(_this17.options.id);
2483
2599
  }
2484
2600
 
2485
2601
  params.push(data);
2486
2602
 
2487
- (_this16$apiService = _this16.apiService)[_this16.options.mode].apply(_this16$apiService, params).then(function (result) {
2488
- if (_this16.options.clearAfterSave === true) {
2603
+ (_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
2604
+ if (_this17.options.clearAfterSave === true) {
2489
2605
  // this.render()
2490
2606
  formEl.reset();
2491
2607
  }
2492
2608
 
2493
2609
  buttonEl.removeAttribute('disabled');
2494
2610
 
2495
- _this16.options.onSuccess.call(_this16, result);
2611
+ _this17.options.onSuccess.call(_this17, result);
2496
2612
  }, function (err) {
2497
2613
  console.log('Error submitting form data:', err);
2498
2614
 
2499
- _this16.options.onError.call(_this16, err);
2615
+ _this17.options.onError.call(_this17, err);
2500
2616
  });
2501
- } else if (_this16.options.submitFn) {
2502
- _this16.options.submitFn(data, function () {
2503
- if (_this16.options.clearAfterSave === true) {
2617
+ } else if (_this17.options.submitFn) {
2618
+ _this17.options.submitFn(data, function () {
2619
+ if (_this17.options.clearAfterSave === true) {
2504
2620
  // this.render()
2505
2621
  formEl.reset();
2506
2622
  }
@@ -2518,6 +2634,76 @@ var WebsyForm = /*#__PURE__*/function () {
2518
2634
  });
2519
2635
  }
2520
2636
  }
2637
+ }, {
2638
+ key: "validateForm",
2639
+ value: function validateForm() {
2640
+ var valid = true;
2641
+ var data = this.data;
2642
+
2643
+ for (var i = 0; i < this.options.fields.length; i++) {
2644
+ if (this.options.fields[i].required || this.options.fields[i].validate) {
2645
+ if (this.validateField(this.options.fields[i], data[this.options.fields[i].field]) === false) {
2646
+ valid = false;
2647
+ }
2648
+ }
2649
+ }
2650
+
2651
+ return valid;
2652
+ }
2653
+ }, {
2654
+ key: "validateField",
2655
+ value: function validateField(field, value) {
2656
+ var inputContainerEl = document.getElementById("".concat(this.elementId, "_").concat(field.field, "_inputContainer"));
2657
+ var errorEl = document.getElementById("".concat(this.elementId, "_").concat(field.field, "_error"));
2658
+
2659
+ if (field.required) {
2660
+ var valid = true;
2661
+
2662
+ if (field.component && field.instance && field.instance.value) {
2663
+ valid = field.instance.value.length > 0;
2664
+ } else {
2665
+ valid = !(typeof value === 'undefined' || value === '');
2666
+ }
2667
+
2668
+ if (!valid) {
2669
+ if (errorEl) {
2670
+ errorEl.innerHTML = field.invalidMessage || 'A value is required';
2671
+ }
2672
+
2673
+ if (inputContainerEl) {
2674
+ inputContainerEl.classList.add('websy-form-input-has-error');
2675
+ }
2676
+
2677
+ return false;
2678
+ }
2679
+ }
2680
+
2681
+ if (field.validate) {
2682
+ var _valid = field.validate(field, value);
2683
+
2684
+ if (!_valid) {
2685
+ if (errorEl) {
2686
+ errorEl.innerHTML = field.invalidMessage || 'A value is required';
2687
+ }
2688
+
2689
+ if (inputContainerEl) {
2690
+ inputContainerEl.classList.add('websy-form-input-has-error');
2691
+ }
2692
+
2693
+ return false;
2694
+ }
2695
+ }
2696
+
2697
+ if (errorEl) {
2698
+ errorEl.innerHTML = '';
2699
+ }
2700
+
2701
+ if (inputContainerEl) {
2702
+ inputContainerEl.classList.remove('websy-form-input-has-error');
2703
+ }
2704
+
2705
+ return true;
2706
+ }
2521
2707
  }, {
2522
2708
  key: "validateRecaptcha",
2523
2709
  value: function validateRecaptcha(token) {
@@ -2535,27 +2721,29 @@ var WebsyForm = /*#__PURE__*/function () {
2535
2721
  return data;
2536
2722
  },
2537
2723
  set: function set(d) {
2538
- var _this17 = this;
2724
+ var _this18 = this;
2539
2725
 
2540
2726
  if (!this.options.fields) {
2541
2727
  this.options.fields = [];
2542
2728
  }
2543
2729
 
2544
2730
  var _loop = function _loop(key) {
2545
- _this17.options.fields.forEach(function (f) {
2731
+ _this18.options.fields.forEach(function (f) {
2546
2732
  if (f.field === key) {
2547
- f.value = d[key];
2548
- var el = document.getElementById("".concat(_this17.elementId, "_input_").concat(f.field));
2549
- el.value = f.value;
2733
+ _this18.setValue(key, d[key]); // f.value = d[key]
2734
+ // const el = document.getElementById(`${this.elementId}_input_${f.field}`)
2735
+ // if (el) {
2736
+ // el.value = f.value
2737
+ // }
2738
+
2550
2739
  }
2551
2740
  });
2552
2741
  };
2553
2742
 
2554
2743
  for (var key in d) {
2555
2744
  _loop(key);
2556
- }
2745
+ } // this.render()
2557
2746
 
2558
- this.render();
2559
2747
  }
2560
2748
  }]);
2561
2749
 
@@ -2614,17 +2802,20 @@ var WebsyLoadingDialog = /*#__PURE__*/function () {
2614
2802
  }
2615
2803
 
2616
2804
  var el = document.getElementById(this.elementId);
2617
- var html = "\n\t\t\t<div class='websy-loading-container ".concat((this.options.classes || []).join(' '), "'>\n\t\t\t\t<div class='websy-ripple'>\n\t\t\t\t\t<div></div>\n\t\t\t\t\t<div></div>\n\t\t\t\t</div>\n\t\t\t\t<h4>").concat(this.options.title || 'Loading...', "</h4>\n\t\t");
2618
2805
 
2619
- if (this.options.messages) {
2620
- for (var i = 0; i < this.options.messages.length; i++) {
2621
- html += "<p>".concat(this.options.messages[i], "</p>");
2806
+ if (el) {
2807
+ var html = "\n <div class='websy-loading-container ".concat((this.options.classes || []).join(' '), "'>\n <div class='websy-ripple'>\n <div></div>\n <div></div>\n </div>\n <h4>").concat(this.options.title || 'Loading...', "</h4>\n ");
2808
+
2809
+ if (this.options.messages) {
2810
+ for (var i = 0; i < this.options.messages.length; i++) {
2811
+ html += "<p>".concat(this.options.messages[i], "</p>");
2812
+ }
2622
2813
  }
2623
- }
2624
2814
 
2625
- html += "\n\t\t\t</div>\t\n ";
2626
- el.classList.add('loading');
2627
- el.innerHTML = html;
2815
+ html += "\n </div>\t\n ";
2816
+ el.classList.add('loading');
2817
+ el.innerHTML = html;
2818
+ }
2628
2819
  }
2629
2820
  }, {
2630
2821
  key: "show",
@@ -2798,7 +2989,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2798
2989
  }, {
2799
2990
  key: "handleSearch",
2800
2991
  value: function handleSearch(searchText) {
2801
- var _this18 = this;
2992
+ var _this19 = this;
2802
2993
 
2803
2994
  var el = document.getElementById(this.elementId); // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
2804
2995
 
@@ -2811,7 +3002,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2811
3002
  if (searchText && searchText.length > 1) {
2812
3003
  defaultMethod = 'add';
2813
3004
  visibleItems = lowestItems.filter(function (d) {
2814
- return d[_this18.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
3005
+ return d[_this19.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
2815
3006
  });
2816
3007
  } // hide everything
2817
3008
 
@@ -3039,7 +3230,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3039
3230
 
3040
3231
  var Pager = /*#__PURE__*/function () {
3041
3232
  function Pager(elementId, options) {
3042
- var _this19 = this;
3233
+ var _this20 = this;
3043
3234
 
3044
3235
  _classCallCheck(this, Pager);
3045
3236
 
@@ -3092,8 +3283,8 @@ var Pager = /*#__PURE__*/function () {
3092
3283
  allowClear: false,
3093
3284
  disableSearch: true,
3094
3285
  onItemSelected: function onItemSelected(selectedItem) {
3095
- if (_this19.options.onChangePageSize) {
3096
- _this19.options.onChangePageSize(selectedItem.value);
3286
+ if (_this20.options.onChangePageSize) {
3287
+ _this20.options.onChangePageSize(selectedItem.value);
3097
3288
  }
3098
3289
  }
3099
3290
  });
@@ -3117,13 +3308,13 @@ var Pager = /*#__PURE__*/function () {
3117
3308
  }, {
3118
3309
  key: "render",
3119
3310
  value: function render() {
3120
- var _this20 = this;
3311
+ var _this21 = this;
3121
3312
 
3122
3313
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
3123
3314
 
3124
3315
  if (el) {
3125
3316
  var pages = this.options.pages.map(function (item, index) {
3126
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this20.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3317
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this21.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3127
3318
  });
3128
3319
  var startIndex = 0;
3129
3320
 
@@ -3191,58 +3382,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3191
3382
  _createClass(WebsyPDFButton, [{
3192
3383
  key: "handleClick",
3193
3384
  value: function handleClick(event) {
3194
- var _this21 = this;
3385
+ var _this22 = this;
3195
3386
 
3196
3387
  if (event.target.classList.contains('websy-pdf-button')) {
3197
3388
  this.loader.show();
3198
3389
  setTimeout(function () {
3199
- if (_this21.options.targetId) {
3200
- var el = document.getElementById(_this21.options.targetId);
3390
+ if (_this22.options.targetId) {
3391
+ var el = document.getElementById(_this22.options.targetId);
3201
3392
 
3202
3393
  if (el) {
3203
3394
  var pdfData = {
3204
3395
  options: {}
3205
3396
  };
3206
3397
 
3207
- if (_this21.options.pdfOptions) {
3208
- pdfData.options = _extends({}, _this21.options.pdfOptions);
3398
+ if (_this22.options.pdfOptions) {
3399
+ pdfData.options = _extends({}, _this22.options.pdfOptions);
3209
3400
  }
3210
3401
 
3211
- if (_this21.options.header) {
3212
- if (_this21.options.header.elementId) {
3213
- var headerEl = document.getElementById(_this21.options.header.elementId);
3402
+ if (_this22.options.header) {
3403
+ if (_this22.options.header.elementId) {
3404
+ var headerEl = document.getElementById(_this22.options.header.elementId);
3214
3405
 
3215
3406
  if (headerEl) {
3216
3407
  pdfData.header = headerEl.outerHTML;
3217
3408
 
3218
- if (_this21.options.header.css) {
3219
- pdfData.options.headerCSS = _this21.options.header.css;
3409
+ if (_this22.options.header.css) {
3410
+ pdfData.options.headerCSS = _this22.options.header.css;
3220
3411
  }
3221
3412
  }
3222
- } else if (_this21.options.header.html) {
3223
- pdfData.header = _this21.options.header.html;
3413
+ } else if (_this22.options.header.html) {
3414
+ pdfData.header = _this22.options.header.html;
3224
3415
 
3225
- if (_this21.options.header.css) {
3226
- pdfData.options.headerCSS = _this21.options.header.css;
3416
+ if (_this22.options.header.css) {
3417
+ pdfData.options.headerCSS = _this22.options.header.css;
3227
3418
  }
3228
3419
  } else {
3229
- pdfData.header = _this21.options.header;
3420
+ pdfData.header = _this22.options.header;
3230
3421
  }
3231
3422
  }
3232
3423
 
3233
- if (_this21.options.footer) {
3234
- if (_this21.options.footer.elementId) {
3235
- var footerEl = document.getElementById(_this21.options.footer.elementId);
3424
+ if (_this22.options.footer) {
3425
+ if (_this22.options.footer.elementId) {
3426
+ var footerEl = document.getElementById(_this22.options.footer.elementId);
3236
3427
 
3237
3428
  if (footerEl) {
3238
3429
  pdfData.footer = footerEl.outerHTML;
3239
3430
 
3240
- if (_this21.options.footer.css) {
3241
- pdfData.options.footerCSS = _this21.options.footer.css;
3431
+ if (_this22.options.footer.css) {
3432
+ pdfData.options.footerCSS = _this22.options.footer.css;
3242
3433
  }
3243
3434
  }
3244
3435
  } else {
3245
- pdfData.footer = _this21.options.footer;
3436
+ pdfData.footer = _this22.options.footer;
3246
3437
  }
3247
3438
  }
3248
3439
 
@@ -3251,31 +3442,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3251
3442
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3252
3443
  // document.getElementById(`${this.elementId}_form`).submit()
3253
3444
 
3254
- _this21.service.add('', pdfData, {
3445
+ _this22.service.add('', pdfData, {
3255
3446
  responseType: 'blob'
3256
3447
  }).then(function (response) {
3257
- _this21.loader.hide();
3448
+ _this22.loader.hide();
3258
3449
 
3259
3450
  var blob = new Blob([response], {
3260
3451
  type: 'application/pdf'
3261
3452
  });
3262
3453
  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 ");
3263
3454
 
3264
- if (_this21.options.directDownload === true) {
3455
+ if (_this22.options.directDownload === true) {
3265
3456
  var fileName;
3266
3457
 
3267
- if (typeof _this21.options.fileName === 'function') {
3268
- fileName = _this21.options.fileName() || 'Export';
3458
+ if (typeof _this22.options.fileName === 'function') {
3459
+ fileName = _this22.options.fileName() || 'Export';
3269
3460
  } else {
3270
- fileName = _this21.options.fileName || 'Export';
3461
+ fileName = _this22.options.fileName || 'Export';
3271
3462
  }
3272
3463
 
3273
3464
  msg += "download='".concat(fileName, ".pdf'");
3274
3465
  }
3275
3466
 
3276
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this21.options.buttonText, "</button>\n </a>\n </div>\n ");
3467
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this22.options.buttonText, "</button>\n </a>\n </div>\n ");
3277
3468
 
3278
- _this21.popup.show({
3469
+ _this22.popup.show({
3279
3470
  message: msg,
3280
3471
  mask: true
3281
3472
  });
@@ -3476,7 +3667,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3476
3667
 
3477
3668
  var ResponsiveText = /*#__PURE__*/function () {
3478
3669
  function ResponsiveText(elementId, options) {
3479
- var _this22 = this;
3670
+ var _this23 = this;
3480
3671
 
3481
3672
  _classCallCheck(this, ResponsiveText);
3482
3673
 
@@ -3489,7 +3680,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3489
3680
  this.elementId = elementId;
3490
3681
  this.canvas = document.createElement('canvas');
3491
3682
  window.addEventListener('resize', function () {
3492
- return _this22.render();
3683
+ return _this23.render();
3493
3684
  });
3494
3685
  var el = document.getElementById(this.elementId);
3495
3686
 
@@ -3708,7 +3899,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3708
3899
 
3709
3900
  var WebsyResultList = /*#__PURE__*/function () {
3710
3901
  function WebsyResultList(elementId, options) {
3711
- var _this23 = this;
3902
+ var _this24 = this;
3712
3903
 
3713
3904
  _classCallCheck(this, WebsyResultList);
3714
3905
 
@@ -3740,9 +3931,9 @@ var WebsyResultList = /*#__PURE__*/function () {
3740
3931
 
3741
3932
  if (_typeof(options.template) === 'object' && options.template.url) {
3742
3933
  this.templateService.get(options.template.url).then(function (templateString) {
3743
- _this23.options.template = templateString;
3934
+ _this24.options.template = templateString;
3744
3935
 
3745
- _this23.render();
3936
+ _this24.render();
3746
3937
  });
3747
3938
  } else {
3748
3939
  this.render();
@@ -3762,7 +3953,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3762
3953
  }, {
3763
3954
  key: "buildHTML",
3764
3955
  value: function buildHTML(d) {
3765
- var _this24 = this;
3956
+ var _this25 = this;
3766
3957
 
3767
3958
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3768
3959
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
@@ -3772,7 +3963,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3772
3963
  if (this.options.template) {
3773
3964
  if (d.length > 0) {
3774
3965
  d.forEach(function (row, ix) {
3775
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this24.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3966
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this25.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3776
3967
 
3777
3968
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3778
3969
 
@@ -3877,7 +4068,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3877
4068
  parts.forEach(function (p) {
3878
4069
  items = items[p];
3879
4070
  });
3880
- template = template.replace(m[0], _this24.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
4071
+ template = template.replace(m[0], _this25.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
3881
4072
  }
3882
4073
  });
3883
4074
 
@@ -3889,7 +4080,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3889
4080
  }
3890
4081
  });
3891
4082
 
3892
- var flatRow = _this24.flattenObject(row);
4083
+ var flatRow = _this25.flattenObject(row);
3893
4084
 
3894
4085
  for (var key in flatRow) {
3895
4086
  var rg = new RegExp("{".concat(key, "}"), 'gm');
@@ -4024,13 +4215,13 @@ var WebsyResultList = /*#__PURE__*/function () {
4024
4215
  }, {
4025
4216
  key: "render",
4026
4217
  value: function render() {
4027
- var _this25 = this;
4218
+ var _this26 = this;
4028
4219
 
4029
4220
  if (this.options.entity) {
4030
4221
  this.apiService.get(this.options.entity).then(function (results) {
4031
- _this25.rows = results.rows;
4222
+ _this26.rows = results.rows;
4032
4223
 
4033
- _this25.resize();
4224
+ _this26.resize();
4034
4225
  });
4035
4226
  } else {
4036
4227
  this.resize();
@@ -4116,14 +4307,14 @@ var WebsyRouter = /*#__PURE__*/function () {
4116
4307
  _createClass(WebsyRouter, [{
4117
4308
  key: "addGroup",
4118
4309
  value: function addGroup(group) {
4119
- var _this26 = this;
4310
+ var _this27 = this;
4120
4311
 
4121
4312
  if (!this.groups[group]) {
4122
4313
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
4123
4314
 
4124
4315
  if (els) {
4125
4316
  this.getClosestParent(els[0], function (parent) {
4126
- _this26.groups[group] = {
4317
+ _this27.groups[group] = {
4127
4318
  activeView: '',
4128
4319
  views: [],
4129
4320
  parent: parent.getAttribute('data-view')
@@ -4168,6 +4359,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4168
4359
  path = this.buildUrlPath(output.items);
4169
4360
  }
4170
4361
 
4362
+ output.path = path;
4171
4363
  this.currentParams = output;
4172
4364
  var inputPath = this.currentView;
4173
4365
 
@@ -4181,26 +4373,24 @@ var WebsyRouter = /*#__PURE__*/function () {
4181
4373
  if (reloadView === true) {
4182
4374
  // this.showView(this.currentView, this.currentParams, 'main')
4183
4375
  this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
4376
+ } else {
4377
+ this.updateHistory(inputPath, !noHistory, true);
4184
4378
  }
4185
4379
  }
4186
4380
  }, {
4187
4381
  key: "removeUrlParams",
4188
4382
  value: function removeUrlParams() {
4189
- var _this27 = this;
4383
+ var _this28 = this;
4190
4384
 
4191
4385
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4192
4386
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4193
4387
  var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4194
4388
  this.previousParams = _extends({}, this.currentParams);
4195
- var output = {
4196
- path: '',
4197
- items: {}
4198
- };
4199
4389
  var path = '';
4200
4390
 
4201
4391
  if (this.currentParams && this.currentParams.items) {
4202
4392
  params.forEach(function (p) {
4203
- delete _this27.currentParams.items[p];
4393
+ delete _this28.currentParams.items[p];
4204
4394
  });
4205
4395
  path = this.buildUrlPath(this.currentParams.items);
4206
4396
  }
@@ -4214,6 +4404,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4214
4404
  if (reloadView === true) {
4215
4405
  // this.showView(this.currentView, this.currentParams, 'main')
4216
4406
  this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
4407
+ } else if (noHistory === false) {
4408
+ this.currentParams = {
4409
+ items: this.currentParams.items,
4410
+ path: path
4411
+ };
4412
+ this.updateHistory(inputPath, !noHistory, true);
4217
4413
  }
4218
4414
  }
4219
4415
  }, {
@@ -4240,9 +4436,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4240
4436
  if (reloadView === true) {
4241
4437
  this.navigate("".concat(inputPath), 'main', null, noHistory);
4242
4438
  } else {
4243
- history.replaceState({
4244
- inputPath: inputPath
4245
- }, 'unused', inputPath);
4439
+ this.updateHistory(inputPath, !noHistory, true);
4246
4440
  }
4247
4441
  }
4248
4442
  }, {
@@ -4568,12 +4762,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4568
4762
  }, {
4569
4763
  key: "showComponents",
4570
4764
  value: function showComponents(view) {
4571
- var _this28 = this;
4765
+ var _this29 = this;
4572
4766
 
4573
4767
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4574
4768
  this.options.views[view].components.forEach(function (c) {
4575
4769
  if (typeof c.instance === 'undefined') {
4576
- _this28.prepComponent(c.elementId, c.options);
4770
+ _this29.prepComponent(c.elementId, c.options);
4577
4771
 
4578
4772
  c.instance = new c.Component(c.elementId, c.options);
4579
4773
  } else if (c.instance.render) {
@@ -4740,29 +4934,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4740
4934
 
4741
4935
  if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
4742
4936
  var historyUrl = inputPath;
4743
-
4744
- if (this.options.urlPrefix) {
4745
- historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
4746
- inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
4747
- historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
4748
- inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
4749
- }
4750
-
4751
- if (this.currentParams && this.currentParams.path) {
4752
- historyUrl += "?".concat(this.currentParams.path);
4753
- } else if (this.queryParams && this.options.persistentParameters === true) {
4754
- historyUrl += "?".concat(this.queryParams);
4755
- }
4756
-
4757
- if (popped === false) {
4758
- history.pushState({
4759
- inputPath: historyUrl
4760
- }, 'unused', historyUrl);
4761
- } else {
4762
- history.replaceState({
4763
- inputPath: historyUrl
4764
- }, 'unused', historyUrl);
4765
- }
4937
+ this.updateHistory(historyUrl, popped);
4766
4938
  }
4767
4939
 
4768
4940
  if (toggle === false) {
@@ -4804,6 +4976,33 @@ var WebsyRouter = /*#__PURE__*/function () {
4804
4976
  item.apply(null, params);
4805
4977
  });
4806
4978
  }
4979
+ }, {
4980
+ key: "updateHistory",
4981
+ value: function updateHistory(historyUrl) {
4982
+ var replaceState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4983
+ var overridePersistent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4984
+
4985
+ if (this.options.urlPrefix) {
4986
+ historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
4987
+ historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
4988
+ }
4989
+
4990
+ if (this.currentParams && this.currentParams.path || overridePersistent === true) {
4991
+ historyUrl += "?".concat(this.currentParams.path);
4992
+ } else if (this.queryParams && this.options.persistentParameters === true) {
4993
+ historyUrl += "?".concat(this.queryParams);
4994
+ }
4995
+
4996
+ if (replaceState === false) {
4997
+ history.pushState({
4998
+ inputPath: historyUrl
4999
+ }, 'unused', historyUrl);
5000
+ } else {
5001
+ history.replaceState({
5002
+ inputPath: historyUrl
5003
+ }, 'unused', historyUrl);
5004
+ }
5005
+ }
4807
5006
  }, {
4808
5007
  key: "subscribe",
4809
5008
  value: function subscribe(event, fn) {
@@ -4956,7 +5155,7 @@ var Switch = /*#__PURE__*/function () {
4956
5155
 
4957
5156
  var WebsyTemplate = /*#__PURE__*/function () {
4958
5157
  function WebsyTemplate(elementId, options) {
4959
- var _this29 = this;
5158
+ var _this30 = this;
4960
5159
 
4961
5160
  _classCallCheck(this, WebsyTemplate);
4962
5161
 
@@ -4982,9 +5181,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
4982
5181
 
4983
5182
  if (_typeof(options.template) === 'object' && options.template.url) {
4984
5183
  this.templateService.get(options.template.url).then(function (templateString) {
4985
- _this29.options.template = templateString;
5184
+ _this30.options.template = templateString;
4986
5185
 
4987
- _this29.render();
5186
+ _this30.render();
4988
5187
  });
4989
5188
  } else {
4990
5189
  this.render();
@@ -4994,7 +5193,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
4994
5193
  _createClass(WebsyTemplate, [{
4995
5194
  key: "buildHTML",
4996
5195
  value: function buildHTML() {
4997
- var _this30 = this;
5196
+ var _this31 = this;
4998
5197
 
4999
5198
  var html = "";
5000
5199
 
@@ -5056,14 +5255,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5056
5255
  }
5057
5256
 
5058
5257
  if (polarity === true) {
5059
- if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] === parts[1]) {
5258
+ if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] === parts[1]) {
5060
5259
  // remove the <if> tags
5061
5260
  removeAll = false;
5062
5261
  } else if (parts[0] === parts[1]) {
5063
5262
  removeAll = false;
5064
5263
  }
5065
5264
  } else if (polarity === false) {
5066
- if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] !== parts[1]) {
5265
+ if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] !== parts[1]) {
5067
5266
  // remove the <if> tags
5068
5267
  removeAll = false;
5069
5268
  }
@@ -5356,7 +5555,7 @@ var WebsyUtils = {
5356
5555
 
5357
5556
  var WebsyTable = /*#__PURE__*/function () {
5358
5557
  function WebsyTable(elementId, options) {
5359
- var _this31 = this;
5558
+ var _this32 = this;
5360
5559
 
5361
5560
  _classCallCheck(this, WebsyTable);
5362
5561
 
@@ -5394,8 +5593,8 @@ var WebsyTable = /*#__PURE__*/function () {
5394
5593
  allowClear: false,
5395
5594
  disableSearch: true,
5396
5595
  onItemSelected: function onItemSelected(selectedItem) {
5397
- if (_this31.options.onChangePageSize) {
5398
- _this31.options.onChangePageSize(selectedItem.value);
5596
+ if (_this32.options.onChangePageSize) {
5597
+ _this32.options.onChangePageSize(selectedItem.value);
5399
5598
  }
5400
5599
  }
5401
5600
  });
@@ -5416,7 +5615,7 @@ var WebsyTable = /*#__PURE__*/function () {
5416
5615
  _createClass(WebsyTable, [{
5417
5616
  key: "appendRows",
5418
5617
  value: function appendRows(data) {
5419
- var _this32 = this;
5618
+ var _this33 = this;
5420
5619
 
5421
5620
  this.hideError();
5422
5621
  var bodyHTML = '';
@@ -5424,15 +5623,15 @@ var WebsyTable = /*#__PURE__*/function () {
5424
5623
  if (data) {
5425
5624
  bodyHTML += data.map(function (r, rowIndex) {
5426
5625
  return '<tr>' + r.map(function (c, i) {
5427
- if (_this32.options.columns[i].show !== false) {
5626
+ if (_this33.options.columns[i].show !== false) {
5428
5627
  var style = '';
5429
5628
 
5430
5629
  if (c.style) {
5431
5630
  style += c.style;
5432
5631
  }
5433
5632
 
5434
- if (_this32.options.columns[i].width) {
5435
- style += "width: ".concat(_this32.options.columns[i].width, "; ");
5633
+ if (_this33.options.columns[i].width) {
5634
+ style += "width: ".concat(_this33.options.columns[i].width, "; ");
5436
5635
  }
5437
5636
 
5438
5637
  if (c.backgroundColor) {
@@ -5447,18 +5646,18 @@ var WebsyTable = /*#__PURE__*/function () {
5447
5646
  style += "color: ".concat(c.color, "; ");
5448
5647
  }
5449
5648
 
5450
- if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5451
- return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5452
- } else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5453
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
5649
+ if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5650
+ return "\n <td \n data-row-index='".concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this33.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5651
+ } else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5652
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this33.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</td>\n ");
5454
5653
  } else {
5455
5654
  var info = c.value;
5456
5655
 
5457
- if (_this32.options.columns[i].showAsImage === true) {
5656
+ if (_this33.options.columns[i].showAsImage === true) {
5458
5657
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5459
5658
  }
5460
5659
 
5461
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5660
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5462
5661
  }
5463
5662
  }
5464
5663
  }).join('') + '</tr>';
@@ -5630,7 +5829,7 @@ var WebsyTable = /*#__PURE__*/function () {
5630
5829
  }, {
5631
5830
  key: "render",
5632
5831
  value: function render(data) {
5633
- var _this33 = this;
5832
+ var _this34 = this;
5634
5833
 
5635
5834
  if (!this.options.columns) {
5636
5835
  return;
@@ -5665,7 +5864,7 @@ var WebsyTable = /*#__PURE__*/function () {
5665
5864
  style += "width: ".concat(c.width || 'auto', ";");
5666
5865
  }
5667
5866
 
5668
- 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 ? _this33.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5867
+ 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 ? _this34.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5669
5868
  }
5670
5869
  }).join('') + '</tr>';
5671
5870
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5684,7 +5883,7 @@ var WebsyTable = /*#__PURE__*/function () {
5684
5883
 
5685
5884
  if (pagingEl) {
5686
5885
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5687
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5886
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5688
5887
  });
5689
5888
  var startIndex = 0;
5690
5889
 
@@ -5752,7 +5951,7 @@ var WebsyTable = /*#__PURE__*/function () {
5752
5951
 
5753
5952
  var WebsyTable2 = /*#__PURE__*/function () {
5754
5953
  function WebsyTable2(elementId, options) {
5755
- var _this34 = this;
5954
+ var _this35 = this;
5756
5955
 
5757
5956
  _classCallCheck(this, WebsyTable2);
5758
5957
 
@@ -5793,8 +5992,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5793
5992
  allowClear: false,
5794
5993
  disableSearch: true,
5795
5994
  onItemSelected: function onItemSelected(selectedItem) {
5796
- if (_this34.options.onChangePageSize) {
5797
- _this34.options.onChangePageSize(selectedItem.value);
5995
+ if (_this35.options.onChangePageSize) {
5996
+ _this35.options.onChangePageSize(selectedItem.value);
5798
5997
  }
5799
5998
  }
5800
5999
  });
@@ -5818,7 +6017,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5818
6017
  _createClass(WebsyTable2, [{
5819
6018
  key: "appendRows",
5820
6019
  value: function appendRows(data) {
5821
- var _this35 = this;
6020
+ var _this36 = this;
5822
6021
 
5823
6022
  this.hideError();
5824
6023
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -5827,15 +6026,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
5827
6026
  if (data) {
5828
6027
  bodyHTML += data.map(function (r, rowIndex) {
5829
6028
  return '<tr>' + r.map(function (c, i) {
5830
- if (_this35.options.columns[i].show !== false) {
5831
- var style = "height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px;");
6029
+ if (_this36.options.columns[i].show !== false) {
6030
+ var style = "height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px;");
5832
6031
 
5833
6032
  if (c.style) {
5834
6033
  style += c.style;
5835
6034
  }
5836
6035
 
5837
- if (_this35.options.columns[i].width) {
5838
- style += "width: ".concat(_this35.options.columns[i].width, "; ");
6036
+ if (_this36.options.columns[i].width) {
6037
+ style += "width: ".concat(_this36.options.columns[i].width, "; ");
5839
6038
  }
5840
6039
 
5841
6040
  if (c.backgroundColor) {
@@ -5850,18 +6049,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
5850
6049
  style += "color: ".concat(c.color, "; ");
5851
6050
  }
5852
6051
 
5853
- if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5854
- return "\n <td \n data-row-index='".concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.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(_this35.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5855
- } else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5856
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this35.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</td>\n ");
6052
+ if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6053
+ 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 ");
6054
+ } else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6055
+ 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 ");
5857
6056
  } else {
5858
6057
  var info = c.value;
5859
6058
 
5860
- if (_this35.options.columns[i].showAsImage === true) {
6059
+ if (_this36.options.columns[i].showAsImage === true) {
5861
6060
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5862
6061
  }
5863
6062
 
5864
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.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 ");
6063
+ 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 ");
5865
6064
  }
5866
6065
  }
5867
6066
  }).join('') + '</tr>';
@@ -6124,7 +6323,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6124
6323
  }, {
6125
6324
  key: "render",
6126
6325
  value: function render(data) {
6127
- var _this36 = this;
6326
+ var _this37 = this;
6128
6327
 
6129
6328
  if (!this.options.columns) {
6130
6329
  return;
@@ -6160,7 +6359,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6160
6359
  style += "width: ".concat(c.width || 'auto', "; ");
6161
6360
  }
6162
6361
 
6163
- 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 ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6362
+ 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 ? _this37.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6164
6363
  }
6165
6364
  }).join('') + '</tr>';
6166
6365
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6171,7 +6370,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6171
6370
  var dropdownHTML = "";
6172
6371
  this.options.columns.forEach(function (c, i) {
6173
6372
  if (c.searchable && c.searchField) {
6174
- dropdownHTML += "\n <div id=\"".concat(_this36.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6373
+ dropdownHTML += "\n <div id=\"".concat(_this37.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6175
6374
  }
6176
6375
  });
6177
6376
  dropdownEl.innerHTML = dropdownHTML;
@@ -6193,7 +6392,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6193
6392
 
6194
6393
  if (pagingEl) {
6195
6394
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6196
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6395
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6197
6396
  });
6198
6397
  var startIndex = 0;
6199
6398
 
@@ -6284,7 +6483,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6284
6483
  }, {
6285
6484
  key: "getColumnParameters",
6286
6485
  value: function getColumnParameters(values) {
6287
- var _this37 = this;
6486
+ var _this38 = this;
6288
6487
 
6289
6488
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6290
6489
  tableEl.style.tableLayout = 'auto';
@@ -6292,10 +6491,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
6292
6491
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6293
6492
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6294
6493
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6295
- 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 ? _this37.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6494
+ 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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6296
6495
  }).join('') + '</tr>';
6297
6496
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6298
- return "\n <td \n style='height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6497
+ return "\n <td \n style='height: ".concat(_this38.options.cellSize, "px; line-height: ").concat(_this38.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6299
6498
  }).join('') + '</tr>'; // get height of the first data cell
6300
6499
 
6301
6500
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6426,7 +6625,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6426
6625
  }, {
6427
6626
  key: "buildBodyHtml",
6428
6627
  value: function buildBodyHtml() {
6429
- var _this38 = this;
6628
+ var _this39 = this;
6430
6629
 
6431
6630
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6432
6631
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -6440,7 +6639,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6440
6639
  }
6441
6640
 
6442
6641
  var bodyHtml = "";
6443
- var sizingColumns = this.options.columns[this.options.columns.length - 1];
6642
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
6643
+ return c.show !== false;
6644
+ });
6444
6645
 
6445
6646
  if (useWidths === true) {
6446
6647
  bodyHtml += '<colgroup>';
@@ -6455,7 +6656,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6455
6656
  row.forEach(function (cell, cellIndex) {
6456
6657
  var sizeIndex = cell.level || cellIndex;
6457
6658
 
6458
- if (typeof sizingColumns[sizeIndex] === 'undefined') {
6659
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6459
6660
  return; // need to revisit this logic
6460
6661
  }
6461
6662
 
@@ -6489,7 +6690,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6489
6690
  } // console.log('rowspan', cell.rowspan)
6490
6691
 
6491
6692
 
6492
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this38.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(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(sizeIndex, "'\n "); // if (useWidths === true) {
6693
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(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(sizeIndex, "'\n "); // if (useWidths === true) {
6493
6694
  // bodyHtml += `
6494
6695
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6495
6696
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -6499,11 +6700,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6499
6700
  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(sizeIndex, "'\n >");
6500
6701
 
6501
6702
  if (cell.expandable === true) {
6502
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this38.options.plusIcon, "</i>");
6703
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this39.options.plusIcon, "</i>");
6503
6704
  }
6504
6705
 
6505
6706
  if (cell.collapsable === true) {
6506
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this38.options.minusIcon, "</i>");
6707
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this39.options.minusIcon, "</i>");
6507
6708
  }
6508
6709
 
6509
6710
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
@@ -6528,7 +6729,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6528
6729
  }, {
6529
6730
  key: "buildHeaderHtml",
6530
6731
  value: function buildHeaderHtml() {
6531
- var _this39 = this;
6732
+ var _this40 = this;
6532
6733
 
6533
6734
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6534
6735
 
@@ -6537,7 +6738,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6537
6738
  }
6538
6739
 
6539
6740
  var headerHtml = '';
6540
- var sizingColumns = this.options.columns[this.options.columns.length - 1];
6741
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
6742
+ return c.show !== false;
6743
+ });
6541
6744
 
6542
6745
  if (useWidths === true) {
6543
6746
  headerHtml += '<colgroup>';
@@ -6548,13 +6751,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
6548
6751
  }
6549
6752
 
6550
6753
  this.options.columns.forEach(function (row, rowIndex) {
6551
- if (useWidths === false && rowIndex !== _this39.options.columns.length - 1) {
6754
+ if (useWidths === false && rowIndex !== _this40.options.columns.length - 1) {
6552
6755
  // if we're calculating the size we only want to render the last row of column headers
6553
6756
  return;
6554
6757
  }
6555
6758
 
6556
6759
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
6557
- row.forEach(function (col, colIndex) {
6760
+ row.filter(function (c) {
6761
+ return c.show !== false;
6762
+ }).forEach(function (col, colIndex) {
6763
+ if (typeof sizingColumns[colIndex] === 'undefined' || sizingColumns[colIndex].show === false) {
6764
+ return; // need to revisit this logic
6765
+ }
6766
+
6558
6767
  var style = "width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important; ");
6559
6768
  var divStyle = style;
6560
6769
 
@@ -6567,25 +6776,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
6567
6776
  style += col.style;
6568
6777
  }
6569
6778
 
6570
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6779
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this40.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6571
6780
  // headerHtml += `
6572
6781
  // style='width: ${col.width || col.actualWidth}px'
6573
6782
  // width='${col.width || col.actualWidth}'
6574
6783
  // `
6575
6784
  // }
6576
6785
 
6577
- 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 ? _this39.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this39.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6786
+ 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 ? _this40.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this40.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6578
6787
  });
6579
6788
  headerHtml += "</tr>";
6580
6789
  });
6581
6790
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6582
6791
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6583
6792
  if (c.searchable && c.isExternalSearch === true) {
6584
- var testEl = document.getElementById("".concat(_this39.elementId, "_columnSearch_").concat(c.dimId || i));
6793
+ var testEl = document.getElementById("".concat(_this40.elementId, "_columnSearch_").concat(c.dimId || i));
6585
6794
 
6586
6795
  if (!testEl) {
6587
6796
  var newE = document.createElement('div');
6588
- newE.id = "".concat(_this39.elementId, "_columnSearch_").concat(c.dimId || i);
6797
+ newE.id = "".concat(_this40.elementId, "_columnSearch_").concat(c.dimId || i);
6589
6798
  newE.className = 'websy-modal-dropdown';
6590
6799
  dropdownEl.appendChild(newE);
6591
6800
  }
@@ -6608,7 +6817,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6608
6817
  }, {
6609
6818
  key: "buildTotalHtml",
6610
6819
  value: function buildTotalHtml() {
6611
- var _this40 = this;
6820
+ var _this41 = this;
6612
6821
 
6613
6822
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6614
6823
 
@@ -6616,12 +6825,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
6616
6825
  return '';
6617
6826
  }
6618
6827
 
6828
+ var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
6829
+ return c.show !== false;
6830
+ });
6619
6831
  var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
6620
6832
  this.options.totals.forEach(function (col, colIndex) {
6833
+ if (typeof sizingColumns[colIndex] === 'undefined' || sizingColumns[colIndex].show === false) {
6834
+ return; // need to revisit this logic
6835
+ }
6836
+
6621
6837
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6622
6838
 
6623
6839
  if (useWidths === true) {
6624
- totalHtml += "\n style='width: ".concat(_this40.options.columns[_this40.options.columns.length - 1][colIndex].width || _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6840
+ totalHtml += "\n style='width: ".concat(_this41.options.columns[_this41.options.columns.length - 1][colIndex].width || _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6625
6841
  }
6626
6842
 
6627
6843
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
@@ -6632,7 +6848,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6632
6848
  }, {
6633
6849
  key: "calculateSizes",
6634
6850
  value: function calculateSizes() {
6635
- var _this41 = this;
6851
+ var _this42 = this;
6636
6852
 
6637
6853
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6638
6854
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
@@ -6678,45 +6894,48 @@ var WebsyTable3 = /*#__PURE__*/function () {
6678
6894
  var totalWidth = 0;
6679
6895
  this.sizes.scrollableWidth = this.sizes.outer.width;
6680
6896
  var firstNonPinnedColumnWidth = 0;
6897
+ var columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(function (c) {
6898
+ return c.show !== false;
6899
+ });
6681
6900
  rows.forEach(function (row, rowIndex) {
6682
6901
  Array.from(row.children).forEach(function (col, colIndex) {
6683
6902
  var colSize = col.getBoundingClientRect();
6684
- _this41.sizes.cellHeight = colSize.height;
6903
+ _this42.sizes.cellHeight = colSize.height;
6685
6904
 
6686
- if (_this41.options.columns[_this41.options.columns.length - 1][colIndex]) {
6687
- if (!_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth) {
6688
- _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth = 0;
6905
+ if (columnsForSizing[colIndex]) {
6906
+ if (!columnsForSizing[colIndex].actualWidth) {
6907
+ columnsForSizing[colIndex].actualWidth = 0;
6689
6908
  }
6690
6909
 
6691
- _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
6692
- _this41.options.columns[_this41.options.columns.length - 1][colIndex].cellHeight = colSize.height;
6910
+ columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth);
6911
+ columnsForSizing[colIndex].cellHeight = colSize.height;
6693
6912
 
6694
- if (colIndex >= _this41.pinnedColumns) {
6695
- firstNonPinnedColumnWidth = _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth;
6913
+ if (colIndex >= _this42.pinnedColumns) {
6914
+ firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
6696
6915
  }
6697
6916
  }
6698
6917
  });
6699
- });
6700
- this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
6701
- if (colIndex < _this41.pinnedColumns) {
6702
- _this41.sizes.scrollableWidth -= col.actualWidth;
6703
- }
6704
- });
6705
- this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
6918
+ }); // columnsForSizing.forEach((col, colIndex) => {
6919
+ // if (colIndex < this.pinnedColumns) {
6920
+ // this.sizes.scrollableWidth -= col.actualWidth
6921
+ // }
6922
+ // })
6923
+
6924
+ this.sizes.totalWidth = columnsForSizing.reduce(function (a, b) {
6706
6925
  return a + (b.width || b.actualWidth);
6707
6926
  }, 0);
6708
- this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
6709
- return i >= _this41.pinnedColumns;
6927
+ this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
6928
+ return i >= _this42.pinnedColumns;
6710
6929
  }).reduce(function (a, b) {
6711
6930
  return a + (b.width || b.actualWidth);
6712
6931
  }, 0);
6713
6932
  this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
6714
6933
 
6715
6934
  if (this.sizes.totalWidth < this.sizes.outer.width) {
6716
- var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length;
6935
+ var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / columnsForSizing.length;
6717
6936
  this.sizes.totalWidth = 0;
6718
6937
  this.sizes.totalNonPinnedWidth = 0;
6719
- this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6938
+ columnsForSizing.forEach(function (c, i) {
6720
6939
  // if (!c.width) {
6721
6940
  // if (c.actualWidth < equalWidth) {
6722
6941
  // adjust the width
@@ -6727,10 +6946,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6727
6946
  c.actualWidth += equalWidth; // }
6728
6947
  // }
6729
6948
 
6730
- _this41.sizes.totalWidth += c.width || c.actualWidth;
6949
+ _this42.sizes.totalWidth += c.width || c.actualWidth;
6731
6950
 
6732
- if (i < _this41.pinnedColumns) {
6733
- _this41.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6951
+ if (i > _this42.pinnedColumns) {
6952
+ _this42.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6734
6953
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6735
6954
 
6736
6955
  });
@@ -6739,20 +6958,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6739
6958
 
6740
6959
  if (this.sizes.pinnedWidth > this.sizes.outer.width - firstNonPinnedColumnWidth) {
6741
6960
  this.sizes.totalWidth = 0;
6742
- var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth); // let colDiff = diff / this.pinnedColumns
6961
+ var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth);
6962
+ var oldPinnedWidth = this.sizes.pinnedWidth;
6963
+ this.sizes.pinnedWidth = 0; // let colDiff = diff / this.pinnedColumns
6743
6964
 
6744
- for (var i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
6965
+ for (var i = 0; i < columnsForSizing.length; i++) {
6745
6966
  if (i < this.pinnedColumns) {
6746
- var colDiff = this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth * diff;
6747
- this.options.columns[this.options.columns.length - 1][i].actualWidth -= colDiff;
6967
+ var colDiff = columnsForSizing[i].actualWidth / oldPinnedWidth * diff;
6968
+ columnsForSizing[i].actualWidth -= colDiff;
6969
+ this.sizes.pinnedWidth += columnsForSizing[i].actualWidth;
6748
6970
  }
6749
6971
 
6750
- this.sizes.totalWidth += this.options.columns[this.options.columns.length - 1][i].width || this.options.columns[this.options.columns.length - 1][i].actualWidth;
6972
+ this.sizes.totalWidth += columnsForSizing[i].width || columnsForSizing[i].actualWidth;
6751
6973
  }
6752
6974
  } // take the height of the last cell as the official height for data cells
6753
6975
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
6754
6976
 
6755
6977
 
6978
+ this.sizes.scrollableWidth = this.sizes.table.width - this.sizes.pinnedWidth;
6756
6979
  headEl.innerHTML = '';
6757
6980
  bodyEl.innerHTML = '';
6758
6981
  footerEl.innerHTML = '';
@@ -6793,7 +7016,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6793
7016
  }, {
6794
7017
  key: "createSample",
6795
7018
  value: function createSample(data) {
6796
- var _this42 = this;
7019
+ var _this43 = this;
6797
7020
 
6798
7021
  var output = [];
6799
7022
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
@@ -6805,7 +7028,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6805
7028
  var longest = '';
6806
7029
 
6807
7030
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
6808
- if (data[i].length === _this42.options.columns[_this42.options.columns.length - 1].length) {
7031
+ if (data[i].length === _this43.options.columns[_this43.options.columns.length - 1].length) {
6809
7032
  if (longest.length < data[i][colIndex].value.length) {
6810
7033
  longest = data[i][colIndex].value;
6811
7034
  }
@@ -7130,21 +7353,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
7130
7353
  this.endCol = 0;
7131
7354
 
7132
7355
  for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
7133
- cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth; // console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
7356
+ if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
7357
+ cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
7134
7358
 
7135
- if (actualLeft < cumulativeWidth) {
7136
- this.startCol = i;
7137
- break;
7359
+ if (actualLeft < cumulativeWidth) {
7360
+ this.startCol = i;
7361
+ break;
7362
+ }
7138
7363
  }
7139
7364
  }
7140
7365
 
7141
7366
  cumulativeWidth = 0;
7142
7367
 
7143
7368
  for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
7144
- cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
7369
+ if (this.options.allColumns[this.options.allColumns.length - 1][_i10].show !== false) {
7370
+ cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
7145
7371
 
7146
- if (cumulativeWidth < this.sizes.scrollableWidth) {
7147
- this.endCol = _i10;
7372
+ if (cumulativeWidth < this.sizes.scrollableWidth) {
7373
+ this.endCol = _i10;
7374
+ }
7148
7375
  }
7149
7376
  }
7150
7377
 
@@ -7233,7 +7460,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7233
7460
 
7234
7461
  var WebsyChart = /*#__PURE__*/function () {
7235
7462
  function WebsyChart(elementId, options) {
7236
- var _this43 = this;
7463
+ var _this44 = this;
7237
7464
 
7238
7465
  _classCallCheck(this, WebsyChart);
7239
7466
 
@@ -7293,7 +7520,7 @@ var WebsyChart = /*#__PURE__*/function () {
7293
7520
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7294
7521
  var xAxis = 'bottom';
7295
7522
 
7296
- if (_this43.options.orientation === 'horizontal') {
7523
+ if (_this44.options.orientation === 'horizontal') {
7297
7524
  xAxis = 'left';
7298
7525
  }
7299
7526
 
@@ -7304,13 +7531,13 @@ var WebsyChart = /*#__PURE__*/function () {
7304
7531
  xAxis += 'Axis';
7305
7532
  var output;
7306
7533
 
7307
- var width = _this43.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
7534
+ var width = _this44.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
7308
7535
 
7309
7536
 
7310
- for (var index = 0; index < _this43.customBottomRange.length; index++) {
7311
- if (input > _this43.customBottomRange[index]) {
7312
- if (_this43.customBottomRange[index + 1]) {
7313
- if (input < _this43.customBottomRange[index + 1]) {
7537
+ for (var index = 0; index < _this44.customBottomRange.length; index++) {
7538
+ if (input > _this44.customBottomRange[index]) {
7539
+ if (_this44.customBottomRange[index + 1]) {
7540
+ if (input < _this44.customBottomRange[index + 1]) {
7314
7541
  output = index;
7315
7542
  break;
7316
7543
  }
@@ -7548,10 +7775,10 @@ var WebsyChart = /*#__PURE__*/function () {
7548
7775
  }, {
7549
7776
  key: "handleEventMouseMove",
7550
7777
  value: function handleEventMouseMove(event, d) {
7551
- var _this44 = this;
7778
+ var _this45 = this;
7552
7779
 
7553
7780
  var bisectDate = d3.bisector(function (d) {
7554
- return _this44.parseX(d.x.value);
7781
+ return _this45.parseX(d.x.value);
7555
7782
  }).left;
7556
7783
 
7557
7784
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -7590,9 +7817,9 @@ var WebsyChart = /*#__PURE__*/function () {
7590
7817
  }
7591
7818
 
7592
7819
  this.options.data.series.forEach(function (s) {
7593
- if (_this44.options.data[xData].scale !== 'Time') {
7820
+ if (_this45.options.data[xData].scale !== 'Time') {
7594
7821
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7595
- xPoint = _this44.customBottomRange[x0] + (_this44.customBottomRange[x0 + 1] - _this44.customBottomRange[x0]) / 2; // }
7822
+ xPoint = _this45.customBottomRange[x0] + (_this45.customBottomRange[x0 + 1] - _this45.customBottomRange[x0]) / 2; // }
7596
7823
  // else {
7597
7824
  // xPoint = this[xAxis](this.parseX(xLabel))
7598
7825
  // }
@@ -7615,13 +7842,13 @@ var WebsyChart = /*#__PURE__*/function () {
7615
7842
  var pointA = s.data[index - 1];
7616
7843
  var pointB = s.data[index];
7617
7844
 
7618
- if (_this44.options.orientation === 'horizontal') {
7845
+ if (_this45.options.orientation === 'horizontal') {
7619
7846
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7620
7847
  pointB = _toConsumableArray(s.data).reverse()[index];
7621
7848
  }
7622
7849
 
7623
7850
  if (pointA && !pointB) {
7624
- xPoint = _this44[xAxis](_this44.parseX(pointA.x.value));
7851
+ xPoint = _this45[xAxis](_this45.parseX(pointA.x.value));
7625
7852
  tooltipTitle = pointA.x.value;
7626
7853
 
7627
7854
  if (!pointA.y.color) {
@@ -7631,12 +7858,12 @@ var WebsyChart = /*#__PURE__*/function () {
7631
7858
  tooltipData.push(pointA.y);
7632
7859
 
7633
7860
  if (typeof pointA.x.value.getTime !== 'undefined') {
7634
- tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointA.x.value);
7861
+ tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointA.x.value);
7635
7862
  }
7636
7863
  }
7637
7864
 
7638
7865
  if (pointB && !pointA) {
7639
- xPoint = _this44[xAxis](_this44.parseX(pointB.x.value));
7866
+ xPoint = _this45[xAxis](_this45.parseX(pointB.x.value));
7640
7867
  tooltipTitle = pointB.x.value;
7641
7868
 
7642
7869
  if (!pointB.y.color) {
@@ -7646,14 +7873,14 @@ var WebsyChart = /*#__PURE__*/function () {
7646
7873
  tooltipData.push(pointB.y);
7647
7874
 
7648
7875
  if (typeof pointB.x.value.getTime !== 'undefined') {
7649
- tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
7876
+ tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
7650
7877
  }
7651
7878
  }
7652
7879
 
7653
7880
  if (pointA && pointB) {
7654
- var d0 = _this44[xAxis](_this44.parseX(pointA.x.value));
7881
+ var d0 = _this45[xAxis](_this45.parseX(pointA.x.value));
7655
7882
 
7656
- var d1 = _this44[xAxis](_this44.parseX(pointB.x.value));
7883
+ var d1 = _this45[xAxis](_this45.parseX(pointB.x.value));
7657
7884
 
7658
7885
  var mid = Math.abs(d0 - d1) / 2;
7659
7886
 
@@ -7662,7 +7889,7 @@ var WebsyChart = /*#__PURE__*/function () {
7662
7889
  tooltipTitle = pointB.x.value;
7663
7890
 
7664
7891
  if (typeof pointB.x.value.getTime !== 'undefined') {
7665
- tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
7892
+ tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
7666
7893
  }
7667
7894
 
7668
7895
  if (!pointB.y.color) {
@@ -7675,7 +7902,7 @@ var WebsyChart = /*#__PURE__*/function () {
7675
7902
  tooltipTitle = pointA.x.value;
7676
7903
 
7677
7904
  if (typeof pointB.x.value.getTime !== 'undefined') {
7678
- tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
7905
+ tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
7679
7906
  }
7680
7907
 
7681
7908
  if (!pointA.y.color) {
@@ -7808,7 +8035,7 @@ var WebsyChart = /*#__PURE__*/function () {
7808
8035
  }, {
7809
8036
  key: "render",
7810
8037
  value: function render(options) {
7811
- var _this45 = this;
8038
+ var _this46 = this;
7812
8039
 
7813
8040
  /* global d3 options WebsyUtils */
7814
8041
  if (typeof options !== 'undefined') {
@@ -7883,7 +8110,7 @@ var WebsyChart = /*#__PURE__*/function () {
7883
8110
  this.options.data.series.map(function (s, i) {
7884
8111
  return {
7885
8112
  value: s.label || s.key,
7886
- color: s.color || _this45.options.colors[i % _this45.options.colors.length]
8113
+ color: s.color || _this46.options.colors[i % _this46.options.colors.length]
7887
8114
  };
7888
8115
  });
7889
8116
  }
@@ -8257,28 +8484,28 @@ var WebsyChart = /*#__PURE__*/function () {
8257
8484
  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') {
8258
8485
  var acc = 0;
8259
8486
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8260
- var adjustment = _this45.bandPadding * index + _this45.bandPadding; // if (this.options.data.bottom.padding) {
8487
+ var adjustment = _this46.bandPadding * index + _this46.bandPadding; // if (this.options.data.bottom.padding) {
8261
8488
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8262
8489
  // }
8263
8490
 
8264
- var start = _this45.widthForCalc / noOfPoints * acc;
8491
+ var start = _this46.widthForCalc / noOfPoints * acc;
8265
8492
 
8266
8493
  for (var i = 0; i < (d.valueCount || 1); i++) {
8267
8494
  var pos = i * proposedBandWidth;
8268
8495
 
8269
- _this45["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8496
+ _this46["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8270
8497
  }
8271
8498
 
8272
- acc += _this45.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8273
- var end = _this45.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8499
+ acc += _this46.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8500
+ var end = _this46.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8274
8501
 
8275
8502
  return end + adjustment;
8276
8503
  })));
8277
8504
  acc = 0;
8278
8505
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8279
- var adjustment = _this45.brushBandPadding * index + _this45.brushBandPadding;
8280
- acc += _this45.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8281
- return (_this45.options.orientation === 'vertical' ? _this45.plotWidth : _this45.plotHeight) / noOfPoints * acc;
8506
+ var adjustment = _this46.brushBandPadding * index + _this46.brushBandPadding;
8507
+ acc += _this46.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
8508
+ return (_this46.options.orientation === 'vertical' ? _this46.plotWidth : _this46.plotHeight) / noOfPoints * acc;
8282
8509
  })));
8283
8510
  } // }
8284
8511
 
@@ -8456,7 +8683,7 @@ var WebsyChart = /*#__PURE__*/function () {
8456
8683
 
8457
8684
  if (this.options.data.bottom.formatter) {
8458
8685
  this.bAxisFunc.tickFormat(function (d) {
8459
- return _this45.options.data.bottom.formatter(d);
8686
+ return _this46.options.data.bottom.formatter(d);
8460
8687
  });
8461
8688
  }
8462
8689
 
@@ -8468,7 +8695,7 @@ var WebsyChart = /*#__PURE__*/function () {
8468
8695
 
8469
8696
  if (this.customBottomRange.length > 0) {
8470
8697
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8471
- return "translate(".concat(_this45.customBottomRange[i] + (_this45.customBottomRange[i + 1] - _this45.customBottomRange[i]) / 2, ", 0)");
8698
+ return "translate(".concat(_this46.customBottomRange[i] + (_this46.customBottomRange[i + 1] - _this46.customBottomRange[i]) / 2, ", 0)");
8472
8699
  });
8473
8700
  }
8474
8701
  } // Configure the left axis
@@ -8490,8 +8717,8 @@ var WebsyChart = /*#__PURE__*/function () {
8490
8717
 
8491
8718
  if (this.options.margin.axisLeft > 0) {
8492
8719
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8493
- if (_this45.options.data.left.formatter) {
8494
- d = _this45.options.data.left.formatter(d);
8720
+ if (_this46.options.data.left.formatter) {
8721
+ d = _this46.options.data.left.formatter(d);
8495
8722
  }
8496
8723
 
8497
8724
  return d;
@@ -8499,7 +8726,7 @@ var WebsyChart = /*#__PURE__*/function () {
8499
8726
 
8500
8727
  if (this.customLeftRange.length > 0) {
8501
8728
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8502
- return "translate(0, ".concat(_this45.customLeftRange[i] + (_this45.customLeftRange[i + 1] - _this45.customLeftRange[i]) / 2, ")");
8729
+ return "translate(0, ".concat(_this46.customLeftRange[i] + (_this46.customLeftRange[i + 1] - _this46.customLeftRange[i]) / 2, ")");
8503
8730
  });
8504
8731
  }
8505
8732
  }
@@ -8532,8 +8759,8 @@ var WebsyChart = /*#__PURE__*/function () {
8532
8759
 
8533
8760
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8534
8761
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8535
- if (_this45.options.data.right.formatter) {
8536
- d = _this45.options.data.right.formatter(d);
8762
+ if (_this46.options.data.right.formatter) {
8763
+ d = _this46.options.data.right.formatter(d);
8537
8764
  }
8538
8765
 
8539
8766
  return d;
@@ -8579,57 +8806,57 @@ var WebsyChart = /*#__PURE__*/function () {
8579
8806
  }, {
8580
8807
  key: "renderComponents",
8581
8808
  value: function renderComponents() {
8582
- var _this46 = this;
8809
+ var _this47 = this;
8583
8810
 
8584
8811
  // Draw the series data
8585
8812
  this.renderedKeys = {};
8586
8813
  this.options.data.series.forEach(function (series, index) {
8587
8814
  if (!series.key) {
8588
- series.key = _this46.createIdentity();
8815
+ series.key = _this47.createIdentity();
8589
8816
  }
8590
8817
 
8591
8818
  if (!series.color) {
8592
- series.color = _this46.options.colors[index % _this46.options.colors.length];
8819
+ series.color = _this47.options.colors[index % _this47.options.colors.length];
8593
8820
  }
8594
8821
 
8595
- _this46["render".concat(series.type || 'bar')](series, index);
8822
+ _this47["render".concat(series.type || 'bar')](series, index);
8596
8823
 
8597
- _this46.renderLabels(series, index);
8824
+ _this47.renderLabels(series, index);
8598
8825
 
8599
- _this46.renderedKeys[series.key] = series.type;
8826
+ _this47.renderedKeys[series.key] = series.type;
8600
8827
  });
8601
8828
  this.refLineLayer.selectAll('.reference-line').remove();
8602
8829
  this.refLineLayer.selectAll('.reference-line-label').remove();
8603
8830
 
8604
8831
  if (this.options.refLines && this.options.refLines.length > 0) {
8605
8832
  this.options.refLines.forEach(function (l) {
8606
- return _this46.renderRefLine(l);
8833
+ return _this47.renderRefLine(l);
8607
8834
  });
8608
8835
  }
8609
8836
  }
8610
8837
  }, {
8611
8838
  key: "renderarea",
8612
8839
  value: function renderarea(series, index) {
8613
- var _this47 = this;
8840
+ var _this48 = this;
8614
8841
 
8615
8842
  /* global d3 series index */
8616
8843
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8617
8844
  return d3.area().x(function (d) {
8618
8845
  // return this[`${xAxis}Axis`](this.parseX(d.x.value))
8619
- var xIndex = _this47[xAxis + 'Axis'].domain().indexOf(d.x.value);
8846
+ var xIndex = _this48[xAxis + 'Axis'].domain().indexOf(d.x.value);
8620
8847
 
8621
- var xPos = _this47["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8848
+ var xPos = _this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8622
8849
 
8623
- if (_this47["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8624
- xPos = xPos + (_this47["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8850
+ if (_this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8851
+ xPos = xPos + (_this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8625
8852
  }
8626
8853
 
8627
8854
  return xPos;
8628
8855
  }).y0(function (d) {
8629
- return _this47["".concat(yAxis, "Axis")](0);
8856
+ return _this48["".concat(yAxis, "Axis")](0);
8630
8857
  }).y1(function (d) {
8631
- return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8632
- }).curve(d3[curveStyle || _this47.options.curveStyle]);
8858
+ return _this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8859
+ }).curve(d3[curveStyle || _this48.options.curveStyle]);
8633
8860
  };
8634
8861
 
8635
8862
  var xAxis = 'bottom';
@@ -8667,7 +8894,7 @@ var WebsyChart = /*#__PURE__*/function () {
8667
8894
  }, {
8668
8895
  key: "renderbar",
8669
8896
  value: function renderbar(series, index) {
8670
- var _this48 = this;
8897
+ var _this49 = this;
8671
8898
 
8672
8899
  /* global series index d3 */
8673
8900
  var xAxis = 'bottom';
@@ -8832,25 +9059,25 @@ var WebsyChart = /*#__PURE__*/function () {
8832
9059
 
8833
9060
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8834
9061
  bars.attr('width', function (d, i) {
8835
- return Math.abs(getBarWidth.call(_this48, d, i, xAxis));
9062
+ return Math.abs(getBarWidth.call(_this49, d, i, xAxis));
8836
9063
  }).attr('height', function (d, i) {
8837
- return getBarHeight.call(_this48, d, i, yAxis, xAxis);
9064
+ return getBarHeight.call(_this49, d, i, yAxis, xAxis);
8838
9065
  }).attr('x', function (d, i) {
8839
- return getBarX.call(_this48, d, i, xAxis);
9066
+ return getBarX.call(_this49, d, i, xAxis);
8840
9067
  }).attr('y', function (d, i) {
8841
- return getBarY.call(_this48, d, i, yAxis, xAxis);
9068
+ return getBarY.call(_this49, d, i, yAxis, xAxis);
8842
9069
  }) // .transition(this.transition)
8843
9070
  .attr('fill', function (d) {
8844
9071
  return d.y.color || d.color || series.color;
8845
9072
  });
8846
9073
  bars.enter().append('rect').attr('width', function (d, i) {
8847
- return Math.abs(getBarWidth.call(_this48, d, i, xAxis));
9074
+ return Math.abs(getBarWidth.call(_this49, d, i, xAxis));
8848
9075
  }).attr('height', function (d, i) {
8849
- return getBarHeight.call(_this48, d, i, yAxis, xAxis);
9076
+ return getBarHeight.call(_this49, d, i, yAxis, xAxis);
8850
9077
  }).attr('x', function (d, i) {
8851
- return getBarX.call(_this48, d, i, xAxis);
9078
+ return getBarX.call(_this49, d, i, xAxis);
8852
9079
  }).attr('y', function (d, i) {
8853
- return getBarY.call(_this48, d, i, yAxis, xAxis);
9080
+ return getBarY.call(_this49, d, i, yAxis, xAxis);
8854
9081
  }) // .transition(this.transition)
8855
9082
  .attr('fill', function (d) {
8856
9083
  return d.y.color || d.color || series.color;
@@ -8862,25 +9089,25 @@ var WebsyChart = /*#__PURE__*/function () {
8862
9089
  this.brushBarsInitialized[series.key] = true;
8863
9090
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
8864
9091
  brushBars.attr('width', function (d, i) {
8865
- return Math.abs(getBarWidth.call(_this48, d, i, "".concat(xAxis, "Brush")));
9092
+ return Math.abs(getBarWidth.call(_this49, d, i, "".concat(xAxis, "Brush")));
8866
9093
  }).attr('height', function (d, i) {
8867
- return getBarHeight.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9094
+ return getBarHeight.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8868
9095
  }).attr('x', function (d, i) {
8869
- return getBarX.call(_this48, d, i, "".concat(xAxis, "Brush"));
9096
+ return getBarX.call(_this49, d, i, "".concat(xAxis, "Brush"));
8870
9097
  }).attr('y', function (d, i) {
8871
- return getBarY.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9098
+ return getBarY.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8872
9099
  }) // .transition(this.transition)
8873
9100
  .attr('fill', function (d) {
8874
9101
  return d.y.color || d.color || series.color;
8875
9102
  });
8876
9103
  brushBars.enter().append('rect').attr('width', function (d, i) {
8877
- return Math.abs(getBarWidth.call(_this48, d, i, "".concat(xAxis, "Brush")));
9104
+ return Math.abs(getBarWidth.call(_this49, d, i, "".concat(xAxis, "Brush")));
8878
9105
  }).attr('height', function (d, i) {
8879
- return getBarHeight.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9106
+ return getBarHeight.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8880
9107
  }).attr('x', function (d, i) {
8881
- return getBarX.call(_this48, d, i, "".concat(xAxis, "Brush"));
9108
+ return getBarX.call(_this49, d, i, "".concat(xAxis, "Brush"));
8882
9109
  }).attr('y', function (d, i) {
8883
- return getBarY.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9110
+ return getBarY.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8884
9111
  }) // .transition(this.transition)
8885
9112
  .attr('fill', function (d) {
8886
9113
  return d.y.color || d.color || series.color;
@@ -8898,7 +9125,7 @@ var WebsyChart = /*#__PURE__*/function () {
8898
9125
  }, {
8899
9126
  key: "renderLabels",
8900
9127
  value: function renderLabels(series, index) {
8901
- var _this49 = this;
9128
+ var _this50 = this;
8902
9129
 
8903
9130
  /* global series index d3 WebsyDesigns */
8904
9131
  var xAxis = 'bottom';
@@ -8917,15 +9144,15 @@ var WebsyChart = /*#__PURE__*/function () {
8917
9144
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
8918
9145
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
8919
9146
  labels.attr('x', function (d) {
8920
- return getLabelX.call(_this49, d, series.labelPosition);
9147
+ return getLabelX.call(_this50, d, series.labelPosition);
8921
9148
  }).attr('y', function (d) {
8922
- return getLabelY.call(_this49, d, series.labelPosition);
9149
+ return getLabelY.call(_this50, d, series.labelPosition);
8923
9150
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
8924
- if (_this49.options.grouping === 'stacked' && d.y.value === 0) {
9151
+ if (_this50.options.grouping === 'stacked' && d.y.value === 0) {
8925
9152
  return 'transparent';
8926
9153
  }
8927
9154
 
8928
- return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9155
+ return _this50.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8929
9156
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
8930
9157
  return d.y.label || d.y.value;
8931
9158
  }).each(function (d, i) {
@@ -8950,15 +9177,15 @@ var WebsyChart = /*#__PURE__*/function () {
8950
9177
  }
8951
9178
  });
8952
9179
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
8953
- return getLabelX.call(_this49, d, series.labelPosition);
9180
+ return getLabelX.call(_this50, d, series.labelPosition);
8954
9181
  }).attr('y', function (d) {
8955
- return getLabelY.call(_this49, d, series.labelPosition);
9182
+ return getLabelY.call(_this50, d, series.labelPosition);
8956
9183
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
8957
- if (_this49.options.grouping === 'stacked' && d.y.value === 0) {
9184
+ if (_this50.options.grouping === 'stacked' && d.y.value === 0) {
8958
9185
  return 'transparent';
8959
9186
  }
8960
9187
 
8961
- return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9188
+ return _this50.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8962
9189
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
8963
9190
  return d.y.label || d.y.value;
8964
9191
  }).each(function (d, i) {
@@ -9036,20 +9263,20 @@ var WebsyChart = /*#__PURE__*/function () {
9036
9263
  }, {
9037
9264
  key: "renderline",
9038
9265
  value: function renderline(series, index) {
9039
- var _this50 = this;
9266
+ var _this51 = this;
9040
9267
 
9041
9268
  /* global series index d3 */
9042
9269
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9043
9270
  return d3.line().x(function (d) {
9044
- if (_this50.options.orientation === 'horizontal') {
9045
- return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9271
+ if (_this51.options.orientation === 'horizontal') {
9272
+ return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9046
9273
  } else {
9047
- var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
9274
+ var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
9048
9275
 
9049
- var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9276
+ var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9050
9277
 
9051
- if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9052
- xPos = xPos + (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9278
+ if (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9279
+ xPos = xPos + (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9053
9280
  } // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
9054
9281
  // return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
9055
9282
 
@@ -9057,13 +9284,13 @@ var WebsyChart = /*#__PURE__*/function () {
9057
9284
  return xPos;
9058
9285
  }
9059
9286
  }).y(function (d) {
9060
- if (_this50.options.orientation === 'horizontal') {
9061
- var adjustment = _this50.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this50.options.data[xAxis].bandWidth / 2;
9062
- return _this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment;
9287
+ if (_this51.options.orientation === 'horizontal') {
9288
+ var adjustment = _this51.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this51.options.data[xAxis].bandWidth / 2;
9289
+ return _this51["".concat(xAxis, "Axis")](_this51.parseX(d.x.value)) + adjustment;
9063
9290
  } else {
9064
- return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9291
+ return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9065
9292
  }
9066
- }).curve(d3[curveStyle || _this50.options.curveStyle]);
9293
+ }).curve(d3[curveStyle || _this51.options.curveStyle]);
9067
9294
  };
9068
9295
 
9069
9296
  var xAxis = 'bottom';
@@ -9177,14 +9404,14 @@ var WebsyChart = /*#__PURE__*/function () {
9177
9404
  }, {
9178
9405
  key: "rendersymbol",
9179
9406
  value: function rendersymbol(series, index) {
9180
- var _this51 = this;
9407
+ var _this52 = this;
9181
9408
 
9182
9409
  /* global d3 series index series.key */
9183
9410
  var drawSymbol = function drawSymbol(size) {
9184
9411
  return d3.symbol() // .type(d => {
9185
9412
  // return d3.symbols[0]
9186
9413
  // })
9187
- .size(size || _this51.options.symbolSize);
9414
+ .size(size || _this52.options.symbolSize);
9188
9415
  };
9189
9416
 
9190
9417
  var xAxis = 'bottom';
@@ -9209,21 +9436,21 @@ var WebsyChart = /*#__PURE__*/function () {
9209
9436
  // else {
9210
9437
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9211
9438
  // }
9212
- var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
9439
+ var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
9213
9440
 
9214
- var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9441
+ var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9215
9442
 
9216
- if (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9217
- xPos = xPos + (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9443
+ if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9444
+ xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9218
9445
  }
9219
9446
 
9220
- var adjustment = _this51.options.data[xAxis].scale === 'Time' || _this51.options.data[xAxis].scale === 'Linear' ? 0 : _this51.options.data[xAxis].bandWidth / 2;
9447
+ var adjustment = _this52.options.data[xAxis].scale === 'Time' || _this52.options.data[xAxis].scale === 'Linear' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
9221
9448
 
9222
- if (_this51.options.orientation === 'horizontal') {
9223
- return "translate(".concat(_this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9449
+ if (_this52.options.orientation === 'horizontal') {
9450
+ return "translate(".concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9224
9451
  } else {
9225
9452
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9226
- return "translate(".concat(xPos, ", ").concat(_this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9453
+ return "translate(".concat(xPos, ", ").concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9227
9454
  }
9228
9455
  }); // Enter
9229
9456
 
@@ -9233,21 +9460,21 @@ var WebsyChart = /*#__PURE__*/function () {
9233
9460
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
9234
9461
  return "symbol symbol_".concat(series.key);
9235
9462
  }).attr('transform', function (d) {
9236
- var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
9463
+ var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
9237
9464
 
9238
- var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9465
+ var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9239
9466
 
9240
- if (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9241
- xPos = xPos + (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9467
+ if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9468
+ xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9242
9469
  }
9243
9470
 
9244
- var adjustment = _this51.options.data[xAxis].scale === 'Time' || _this51.options.data[xAxis].scale === 'Linear' ? 0 : _this51.options.data[xAxis].bandWidth / 2;
9471
+ var adjustment = _this52.options.data[xAxis].scale === 'Time' || _this52.options.data[xAxis].scale === 'Linear' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
9245
9472
 
9246
- if (_this51.options.orientation === 'horizontal') {
9247
- return "translate(".concat(_this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9473
+ if (_this52.options.orientation === 'horizontal') {
9474
+ return "translate(".concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9248
9475
  } else {
9249
9476
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9250
- return "translate(".concat(xPos, ", ").concat(_this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9477
+ return "translate(".concat(xPos, ", ").concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9251
9478
  }
9252
9479
  });
9253
9480
  }
@@ -9469,7 +9696,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9469
9696
  }, {
9470
9697
  key: "resize",
9471
9698
  value: function resize() {
9472
- var _this52 = this;
9699
+ var _this53 = this;
9473
9700
 
9474
9701
  var el = document.getElementById(this.elementId);
9475
9702
 
@@ -9482,7 +9709,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9482
9709
  // }
9483
9710
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9484
9711
  html += this._data.map(function (d, i) {
9485
- return _this52.getLegendItemHTML(d);
9712
+ return _this53.getLegendItemHTML(d);
9486
9713
  }).join('');
9487
9714
  html += "\n <div>\n ";
9488
9715
  el.innerHTML = html;
@@ -9654,7 +9881,7 @@ var WebsyMap = /*#__PURE__*/function () {
9654
9881
  }, {
9655
9882
  key: "render",
9656
9883
  value: function render() {
9657
- var _this53 = this;
9884
+ var _this54 = this;
9658
9885
 
9659
9886
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
9660
9887
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -9663,7 +9890,7 @@ var WebsyMap = /*#__PURE__*/function () {
9663
9890
  var legendData = this.options.data.polygons.map(function (s, i) {
9664
9891
  return {
9665
9892
  value: s.label || s.key,
9666
- color: s.color || _this53.options.colors[i % _this53.options.colors.length]
9893
+ color: s.color || _this54.options.colors[i % _this54.options.colors.length]
9667
9894
  };
9668
9895
  });
9669
9896
  var longestValue = legendData.map(function (s) {
@@ -9727,7 +9954,7 @@ var WebsyMap = /*#__PURE__*/function () {
9727
9954
 
9728
9955
  if (this.polygons) {
9729
9956
  this.polygons.forEach(function (p) {
9730
- return _this53.map.removeLayer(p);
9957
+ return _this54.map.removeLayer(p);
9731
9958
  });
9732
9959
  }
9733
9960
 
@@ -9785,18 +10012,18 @@ var WebsyMap = /*#__PURE__*/function () {
9785
10012
  }
9786
10013
 
9787
10014
  if (!p.options.color) {
9788
- p.options.color = _this53.options.colors[i % _this53.options.colors.length];
10015
+ p.options.color = _this54.options.colors[i % _this54.options.colors.length];
9789
10016
  }
9790
10017
 
9791
10018
  var pol = L.polygon(p.data.map(function (c) {
9792
10019
  return c.map(function (d) {
9793
10020
  return [d.Latitude, d.Longitude];
9794
10021
  });
9795
- }), p.options).addTo(_this53.map);
10022
+ }), p.options).addTo(_this54.map);
9796
10023
 
9797
- _this53.polygons.push(pol);
10024
+ _this54.polygons.push(pol);
9798
10025
 
9799
- _this53.map.fitBounds(pol.getBounds());
10026
+ _this54.map.fitBounds(pol.getBounds());
9800
10027
  });
9801
10028
  } // if (this.data.markers.length > 0) {
9802
10029
  // el.classList.remove('hidden')