@websy/websy-designs 1.4.0 → 1.4.2

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.
@@ -66,7 +66,9 @@ var APIService = /*#__PURE__*/function () {
66
66
  _classCallCheck(this, APIService);
67
67
 
68
68
  this.baseUrl = baseUrl;
69
- this.options = _extends({}, options);
69
+ this.options = _extends({}, {
70
+ fieldValueSeparator: ':'
71
+ }, options);
70
72
  }
71
73
 
72
74
  _createClass(APIService, [{
@@ -84,7 +86,7 @@ var APIService = /*#__PURE__*/function () {
84
86
  }
85
87
 
86
88
  if (id) {
87
- query.push("id:".concat(id));
89
+ query.push("id".concat(this.options.fieldValueSeparator).concat(id));
88
90
  }
89
91
 
90
92
  return "".concat(this.baseUrl, "/").concat(entity).concat(query.length > 0 ? "".concat(entity.indexOf('?') === -1 ? '?' : '&', "where=").concat(query.join(';')) : '');
@@ -341,6 +343,11 @@ var WebsyCarousel = /*#__PURE__*/function () {
341
343
  }
342
344
 
343
345
  _createClass(WebsyCarousel, [{
346
+ key: "close",
347
+ value: function close() {
348
+ this.pause();
349
+ }
350
+ }, {
344
351
  key: "handleClick",
345
352
  value: function handleClick(event) {
346
353
  if (event.target.classList.contains('websy-next-arrow')) {
@@ -453,7 +460,7 @@ var WebsyCarousel = /*#__PURE__*/function () {
453
460
  }
454
461
 
455
462
  if (this.options.showPrevNext === true && this.options.frames.length > 1) {
456
- html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n \n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"websy-next-arrow\">\n <title>Caret Forward</title>\n <path d=\"M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z\"/>\n </svg>\n ";
463
+ html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n \n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"websy-next-arrow\">\n <title>Caret Forward</title>\n <path d=\"M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z\"/>\n </svg>\n ";
457
464
  }
458
465
 
459
466
  html += "\n </div>\n ";
@@ -477,20 +484,35 @@ var WebsyCarousel = /*#__PURE__*/function () {
477
484
  }
478
485
 
479
486
  var prevF = document.getElementById("".concat(this.elementId, "_frame_").concat(prevFrameIndex));
480
- setTimeout(function () {
481
- prevF.style.transform = "translateX(".concat(prevTranslateX, ")");
482
- }, 100);
487
+
488
+ if (prevF) {
489
+ setTimeout(function () {
490
+ prevF.style.transform = "translateX(".concat(prevTranslateX, ")");
491
+ }, 100);
492
+ }
493
+
483
494
  var btnInactive = document.getElementById("".concat(this.elementId, "_selector_").concat(prevFrameIndex));
484
- btnInactive.classList.remove('websy-progress-btn-active');
495
+
496
+ if (btnInactive) {
497
+ btnInactive.classList.remove('websy-progress-btn-active');
498
+ }
499
+
485
500
  var newF = document.getElementById("".concat(this.elementId, "_frame_").concat(currFrameIndex));
486
- newF.classList.remove('animate');
487
- newF.style.transform = "translateX(".concat(nextTranslateX, ")");
488
- setTimeout(function () {
489
- newF.classList.add('animate');
490
- newF.style.transform = 'translateX(0%)';
491
- }, 100);
501
+
502
+ if (newF) {
503
+ newF.classList.remove('animate');
504
+ newF.style.transform = "translateX(".concat(nextTranslateX, ")");
505
+ setTimeout(function () {
506
+ newF.classList.add('animate');
507
+ newF.style.transform = 'translateX(0%)';
508
+ }, 100);
509
+ }
510
+
492
511
  var btnActive = document.getElementById("".concat(this.elementId, "_selector_").concat(currFrameIndex));
493
- btnActive.classList.add('websy-progress-btn-active');
512
+
513
+ if (btnActive) {
514
+ btnActive.classList.add('websy-progress-btn-active');
515
+ }
494
516
  } // showFrameSelector () {
495
517
  // }
496
518
 
@@ -819,75 +841,103 @@ var WebsyDatePicker = /*#__PURE__*/function () {
819
841
  }
820
842
 
821
843
  if (this.customRangeSelected === true) {
822
- var diff;
823
-
824
- if (this.options.mode === 'date') {
825
- diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay); // if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
826
- // diff += 1
827
- // }
828
- } else if (this.options.mode === 'year') {
829
- diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
830
-
831
- if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
832
- }
833
- } else if (this.options.mode === 'monthyear') {
834
- var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
835
- diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
836
- } else if (this.options.mode === 'hour') {
837
- diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
838
- }
839
-
840
- for (var _i = 0; _i < diff + 1; _i++) {
841
- var d = void 0;
842
- var rangeStart = void 0;
843
- var rangeEnd = void 0;
844
+ if (this.isContinuousRange || this.mouseDown) {
845
+ var diff;
844
846
 
845
847
  if (this.options.mode === 'date') {
846
- d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
847
-
848
- d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
849
-
850
- rangeStart = this.selectedRangeDates[0].getTime();
851
- rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
848
+ diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay); // if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
849
+ // diff += 1
850
+ // }
852
851
  } else if (this.options.mode === 'year') {
853
- d = this.selectedRangeDates[0] + _i;
854
- rangeStart = this.selectedRangeDates[0];
855
- rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
856
- } else if (this.options.mode === 'monthyear') {
857
- d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
858
- d = d.getTime();
859
- console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
860
- rangeStart = this.selectedRangeDates[0].getTime();
861
- rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
862
- } else if (this.options.mode === 'hour') {
863
- d = this.selectedRangeDates[0] + _i;
864
- rangeStart = this.selectedRangeDates[0];
865
- rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
866
- }
852
+ diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
867
853
 
868
- var dateEl = void 0;
869
-
870
- if (this.options.mode === 'date') {
871
- dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
872
- } else if (this.options.mode === 'year') {
873
- dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
854
+ if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
855
+ }
874
856
  } else if (this.options.mode === 'monthyear') {
875
- dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
857
+ var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
858
+ diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
876
859
  } else if (this.options.mode === 'hour') {
877
- dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
878
- }
860
+ diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
861
+ }
862
+
863
+ for (var _i = 0; _i < diff + 1; _i++) {
864
+ var d = void 0;
865
+ var rangeStart = void 0;
866
+ var rangeEnd = void 0;
867
+
868
+ if (this.options.mode === 'date') {
869
+ d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
870
+
871
+ d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
872
+
873
+ rangeStart = this.selectedRangeDates[0].getTime();
874
+ rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
875
+ } else if (this.options.mode === 'year') {
876
+ d = this.selectedRangeDates[0] + _i;
877
+ rangeStart = this.selectedRangeDates[0];
878
+ rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
879
+ } else if (this.options.mode === 'monthyear') {
880
+ d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
881
+ d = d.getTime();
882
+ console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
883
+ rangeStart = this.selectedRangeDates[0].getTime();
884
+ rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
885
+ } else if (this.options.mode === 'hour') {
886
+ d = this.selectedRangeDates[0] + _i;
887
+ rangeStart = this.selectedRangeDates[0];
888
+ rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
889
+ }
879
890
 
880
- if (dateEl) {
881
- dateEl.classList.add('selected');
891
+ var dateEl = void 0;
882
892
 
883
- if (d === rangeStart) {
884
- dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'last' : 'first'));
893
+ if (this.options.mode === 'date') {
894
+ dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
895
+ } else if (this.options.mode === 'year') {
896
+ dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
897
+ } else if (this.options.mode === 'monthyear') {
898
+ dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
899
+ } else if (this.options.mode === 'hour') {
900
+ dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
885
901
  }
886
902
 
887
- if (d === rangeEnd) {
888
- dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'first' : 'last'));
903
+ if (dateEl) {
904
+ dateEl.classList.add('selected');
905
+
906
+ if (d === rangeStart) {
907
+ dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'last' : 'first'));
908
+ }
909
+
910
+ if (d === rangeEnd) {
911
+ dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'first' : 'last'));
912
+ }
889
913
  }
890
914
  }
915
+ } else {
916
+ this.selectedRangeDates.forEach(function (dIn) {
917
+ var d;
918
+ var suffix = '_date';
919
+
920
+ if (_this5.options.mode === 'date') {
921
+ d = _this5.floorDate(new Date(dIn.getTime()));
922
+ d = d.getTime();
923
+ } else if (_this5.options.mode === 'year') {
924
+ d = dIn;
925
+ suffix = '_year';
926
+ } else if (_this5.options.mode === 'monthyear') {
927
+ d = _this5.floorDate(new Date(dIn.getTime()).setMonth(dIn.getMonth()));
928
+ d = d.getTime();
929
+ suffix = '_monthyear';
930
+ } else if (_this5.options.mode === 'hour') {
931
+ d = dIn;
932
+ suffix = '_hour';
933
+ }
934
+
935
+ var dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d).concat(suffix));
936
+
937
+ if (dateEl) {
938
+ dateEl.classList.add('selected', 'first', 'last');
939
+ }
940
+ });
891
941
  }
892
942
  } else {
893
943
  this.currentselection.forEach(function (d) {
@@ -1184,7 +1234,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1184
1234
  } else if (this.options.mode === 'hour') {
1185
1235
  html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
1186
1236
  html += this.options.hours.map(function (h) {
1187
- return "<li id='".concat(_this6.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
1237
+ return "<li id='".concat(_this6.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-id='").concat(+h.text.split(':')[0], "' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
1188
1238
  }).join('');
1189
1239
  html += "</ul></div>";
1190
1240
  }
@@ -1294,7 +1344,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1294
1344
  var _this8 = this;
1295
1345
 
1296
1346
  this.selectedRange = -1;
1297
- var isContinuousRange = true; // if (rangeInput.length === 1) {
1347
+ this.isContinuousRange = true; // if (rangeInput.length === 1) {
1298
1348
  // this.selectedRangeDates = [...rangeInput]
1299
1349
  // this.customRangeSelected = true
1300
1350
  // }
@@ -1309,22 +1359,22 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1309
1359
  if (i > 0) {
1310
1360
  if (_this8.options.mode === 'date' || _this8.options.mode === 'monthyear') {
1311
1361
  if (r.getTime() / _this8.oneDay - rangeInput[i - 1] / _this8.oneDay > 1) {
1312
- isContinuousRange = false;
1362
+ _this8.isContinuousRange = false;
1313
1363
  }
1314
1364
  } else if (_this8.options.mode === 'hour' || _this8.options.mode === 'year') {
1315
1365
  if (r - rangeInput[i - 1] > 1) {
1316
- isContinuousRange = false;
1366
+ _this8.isContinuousRange = false;
1317
1367
  }
1318
1368
  }
1319
1369
  }
1320
1370
  });
1321
1371
 
1322
- if (rangeInput.length > 2 && isContinuousRange === true) {
1372
+ if (rangeInput.length > 2 && this.isContinuousRange === true) {
1323
1373
  this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]];
1324
1374
  this.customRangeSelected = true;
1325
1375
  }
1326
1376
 
1327
- if (isContinuousRange === false) {
1377
+ if (this.isContinuousRange === false) {
1328
1378
  this.currentselection = [];
1329
1379
  } // check if the custom range matches a configured range
1330
1380
 
@@ -1419,7 +1469,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1419
1469
  var start = list[0];
1420
1470
  var end = '';
1421
1471
 
1422
- if (this.customRangeSelected === true) {
1472
+ if (this.customRangeSelected === true && this.isContinuousRange === true) {
1423
1473
  end = " - ".concat(list[list.length - 1]);
1424
1474
 
1425
1475
  if (this.options.mode === 'hour') {
@@ -1512,8 +1562,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
1512
1562
  });
1513
1563
  }
1514
1564
 
1565
+ this.searchText = '';
1515
1566
  this.tooltipTimeoutFn = null;
1516
- this._originalData = [];
1567
+ this._originalData = _toConsumableArray(this.options.items);
1517
1568
  this.selectedItems = this.options.selectedItems || [];
1518
1569
 
1519
1570
  if (!elementId) {
@@ -1656,6 +1707,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
1656
1707
  key: "handleKeyUp",
1657
1708
  value: function handleKeyUp(event) {
1658
1709
  if (event.target.classList.contains('websy-dropdown-search')) {
1710
+ this.searchText = event.target.value;
1711
+
1659
1712
  if (this._originalData.length === 0) {
1660
1713
  this._originalData = _toConsumableArray(this.options.items);
1661
1714
  }
@@ -1852,6 +1905,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
1852
1905
  var itemEls = el.querySelectorAll(".websy-dropdown-item");
1853
1906
  var dataToUse = this._originalData;
1854
1907
 
1908
+ if (this._originalData.length === 0 && this.searchText === '') {
1909
+ dataToUse = this.options.items;
1910
+ }
1911
+
1855
1912
  if (this.options.onSearch) {
1856
1913
  dataToUse = this.options.items;
1857
1914
  }
@@ -3744,6 +3801,9 @@ var WebsyResultList = /*#__PURE__*/function () {
3744
3801
 
3745
3802
  if (el) {
3746
3803
  el.addEventListener('click', this.handleClick.bind(this));
3804
+ el.addEventListener('change', this.handleChange.bind(this));
3805
+ el.addEventListener('keyup', this.handleKeyUp.bind(this));
3806
+ el.addEventListener('keydown', this.handleKeyDown.bind(this));
3747
3807
  }
3748
3808
 
3749
3809
  if (_typeof(options.template) === 'object' && options.template.url) {
@@ -3956,56 +4016,76 @@ var WebsyResultList = /*#__PURE__*/function () {
3956
4016
  key: "handleClick",
3957
4017
  value: function handleClick(event) {
3958
4018
  if (event.target.classList.contains('clickable')) {
3959
- var l = event.target.getAttribute('data-event');
4019
+ this.handleEvent(event, 'clickable', 'click');
4020
+ }
4021
+ }
4022
+ }, {
4023
+ key: "handleChange",
4024
+ value: function handleChange(event) {
4025
+ this.handleEvent(event, 'keyable', 'change');
4026
+ }
4027
+ }, {
4028
+ key: "handleKeyUp",
4029
+ value: function handleKeyUp(event) {
4030
+ this.handleEvent(event, 'keyable', 'keyup');
4031
+ }
4032
+ }, {
4033
+ key: "handleKeyDown",
4034
+ value: function handleKeyDown(event) {
4035
+ this.handleEvent(event, 'keyable', 'keydown');
4036
+ }
4037
+ }, {
4038
+ key: "handleEvent",
4039
+ value: function handleEvent(event, eventType, action) {
4040
+ var l = event.target.getAttribute('data-event');
3960
4041
 
3961
- if (l) {
3962
- l = l.split('(');
3963
- var params = [];
3964
- var id = event.target.getAttribute('data-id');
3965
- var locator = event.target.getAttribute('data-locator');
4042
+ if (l) {
4043
+ l = l.split('(');
4044
+ var params = [];
4045
+ var id = event.target.getAttribute('data-id');
4046
+ var locator = event.target.getAttribute('data-locator');
3966
4047
 
3967
- if (l[1]) {
3968
- l[1] = l[1].replace(')', '');
3969
- params = l[1].split(',');
3970
- }
4048
+ if (l[1]) {
4049
+ l[1] = l[1].replace(')', '');
4050
+ params = l[1].split(',');
4051
+ }
3971
4052
 
3972
- l = l[0];
3973
- var data = this.rows;
4053
+ l = l[0];
4054
+ var data = this.rows;
3974
4055
 
3975
- if (locator !== '') {
3976
- var locatorItems = locator.split(';');
3977
- locatorItems.forEach(function (loc) {
3978
- var locatorParts = loc.split(':');
4056
+ if (locator !== '') {
4057
+ var locatorItems = locator.split(';');
4058
+ locatorItems.forEach(function (loc) {
4059
+ var locatorParts = loc.split(':');
3979
4060
 
3980
- if (data[locatorParts[0]]) {
3981
- data = data[locatorParts[0]];
3982
- var parts = locatorParts[1].split('.');
3983
- parts.forEach(function (p) {
3984
- data = data[p];
3985
- });
3986
- }
3987
- });
3988
- }
4061
+ if (data[locatorParts[0]]) {
4062
+ data = data[locatorParts[0]];
4063
+ var parts = locatorParts[1].split('.');
4064
+ parts.forEach(function (p) {
4065
+ data = data[p];
4066
+ });
4067
+ }
4068
+ });
4069
+ }
3989
4070
 
3990
- params = params.map(function (p) {
3991
- if (typeof p !== 'string' && typeof p !== 'number') {
3992
- if (data[+id]) {
3993
- p = data[+id][p];
3994
- }
3995
- } else if (typeof p === 'string') {
3996
- p = p.replace(/"/g, '').replace(/'/g, '');
4071
+ params = params.map(function (p) {
4072
+ if (typeof p !== 'string' && typeof p !== 'number') {
4073
+ if (data[+id]) {
4074
+ p = data[+id][p];
3997
4075
  }
4076
+ } else if (typeof p === 'string') {
4077
+ p = p.replace(/"/g, '').replace(/'/g, '');
4078
+ }
3998
4079
 
3999
- return p;
4000
- });
4080
+ return p;
4081
+ });
4001
4082
 
4002
- if (event.target.classList.contains('clickable') && this.options.listeners.click[l]) {
4003
- var _this$options$listene;
4083
+ if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
4084
+ var _this$options$listene;
4004
4085
 
4005
- event.stopPropagation();
4086
+ event.stopPropagation();
4006
4087
 
4007
- (_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
4008
- }
4088
+ (_this$options$listene = this.options.listeners[action][l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
4009
4089
  }
4010
4090
  }
4011
4091
  }
@@ -4065,7 +4145,8 @@ var WebsyRouter = /*#__PURE__*/function () {
4065
4145
  show: [],
4066
4146
  hide: []
4067
4147
  },
4068
- persistentParameters: false
4148
+ persistentParameters: false,
4149
+ fieldValueSeparator: ':'
4069
4150
  };
4070
4151
  this.triggerIdList = [];
4071
4152
  this.viewIdList = [];
@@ -4134,6 +4215,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4134
4215
  key: "addUrlParams",
4135
4216
  value: function addUrlParams(params) {
4136
4217
  var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4218
+ var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4137
4219
 
4138
4220
  if (typeof params === 'undefined') {
4139
4221
  return;
@@ -4159,14 +4241,47 @@ var WebsyRouter = /*#__PURE__*/function () {
4159
4241
 
4160
4242
  if (this.options.urlPrefix) {
4161
4243
  inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
4244
+ } // history.pushState({
4245
+ // inputPath
4246
+ // }, 'unused', `${inputPath}?${path}`)
4247
+
4248
+
4249
+ if (reloadView === true) {
4250
+ // this.showView(this.currentView, this.currentParams, 'main')
4251
+ this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
4252
+ }
4253
+ }
4254
+ }, {
4255
+ key: "removeUrlParams",
4256
+ value: function removeUrlParams() {
4257
+ var _this27 = this;
4258
+
4259
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4260
+ var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4261
+ var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4262
+ this.previousParams = _extends({}, this.currentParams);
4263
+ var output = {
4264
+ path: '',
4265
+ items: {}
4266
+ };
4267
+ var path = '';
4268
+
4269
+ if (this.currentParams && this.currentParams.items) {
4270
+ params.forEach(function (p) {
4271
+ delete _this27.currentParams.items[p];
4272
+ });
4273
+ path = this.buildUrlPath(this.currentParams.items);
4162
4274
  }
4163
4275
 
4164
- history.pushState({
4165
- inputPath: inputPath
4166
- }, inputPath, "".concat(inputPath, "?").concat(path));
4276
+ var inputPath = this.currentView;
4277
+
4278
+ if (this.options.urlPrefix) {
4279
+ inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
4280
+ }
4167
4281
 
4168
4282
  if (reloadView === true) {
4169
- this.showView(this.currentView, this.currentParams, 'main');
4283
+ // this.showView(this.currentView, this.currentParams, 'main')
4284
+ this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
4170
4285
  }
4171
4286
  }
4172
4287
  }, {
@@ -4270,6 +4385,38 @@ var WebsyRouter = /*#__PURE__*/function () {
4270
4385
 
4271
4386
  return views;
4272
4387
  }
4388
+ }, {
4389
+ key: "getParamValues",
4390
+ value: function getParamValues(param) {
4391
+ var output = [];
4392
+
4393
+ if (this.currentParams && this.currentParams.items && this.currentParams.items[param] && this.currentParams.items[param] !== '') {
4394
+ return this.currentParams.items[param].split('|').map(function (d) {
4395
+ return decodeURI(d);
4396
+ });
4397
+ }
4398
+
4399
+ return output;
4400
+ }
4401
+ }, {
4402
+ key: "getAPIQuery",
4403
+ value: function getAPIQuery() {
4404
+ var ignoredParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4405
+
4406
+ if (this.currentParams && this.currentParams.items) {
4407
+ var query = [];
4408
+
4409
+ for (var key in this.currentParams.items) {
4410
+ if (ignoredParams.indexOf(key) === -1) {
4411
+ query.push("".concat(key).concat(this.options.fieldValueSeparator).concat(this.currentParams.items[key]));
4412
+ }
4413
+ }
4414
+
4415
+ return query;
4416
+ }
4417
+
4418
+ return [];
4419
+ }
4273
4420
  }, {
4274
4421
  key: "handleClick",
4275
4422
  value: function handleClick(event) {
@@ -4300,20 +4447,17 @@ var WebsyRouter = /*#__PURE__*/function () {
4300
4447
  url += "?".concat(params.path);
4301
4448
  }
4302
4449
 
4303
- this.currentView = view;
4304
- this.currentViewMain = view;
4305
-
4306
- if (this.currentView === '/' || this.currentView === '') {
4307
- this.currentView = this.options.defaultView;
4308
- }
4309
-
4310
- if (this.currentViewMain === '/' || this.currentViewMain === '') {
4311
- this.currentViewMain = this.options.defaultView;
4312
- }
4313
-
4314
- if (view !== '') {
4315
- this.showView(view, params, 'main');
4316
- }
4450
+ this.navigate(url); // this.currentView = view
4451
+ // this.currentViewMain = view
4452
+ // if (this.currentView === '/' || this.currentView === '') {
4453
+ // this.currentView = this.options.defaultView
4454
+ // }
4455
+ // if (this.currentViewMain === '/' || this.currentViewMain === '') {
4456
+ // this.currentViewMain = this.options.defaultView
4457
+ // }
4458
+ // if (view !== '') {
4459
+ // this.showView(view, params, 'main')
4460
+ // }
4317
4461
  }
4318
4462
  }, {
4319
4463
  key: "handleFocus",
@@ -4461,12 +4605,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4461
4605
  }, {
4462
4606
  key: "showComponents",
4463
4607
  value: function showComponents(view) {
4464
- var _this27 = this;
4608
+ var _this28 = this;
4465
4609
 
4466
4610
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4467
4611
  this.options.views[view].components.forEach(function (c) {
4468
4612
  if (typeof c.instance === 'undefined') {
4469
- _this27.prepComponent(c.elementId, c.options);
4613
+ _this28.prepComponent(c.elementId, c.options);
4470
4614
 
4471
4615
  c.instance = new c.Component(c.elementId, c.options);
4472
4616
  } else if (c.instance.render) {
@@ -4625,27 +4769,30 @@ var WebsyRouter = /*#__PURE__*/function () {
4625
4769
  inputPath = window.location.pathname.split('/').pop() + inputPath;
4626
4770
  }
4627
4771
 
4628
- if ((this.currentPath !== newPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
4629
- if (popped === false) {
4630
- var historyUrl = inputPath;
4772
+ if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
4773
+ var historyUrl = inputPath;
4631
4774
 
4632
- if (this.options.urlPrefix) {
4633
- historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
4634
- inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
4635
- historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
4636
- inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
4637
- }
4775
+ if (this.options.urlPrefix) {
4776
+ historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
4777
+ inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
4778
+ historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
4779
+ inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
4780
+ }
4638
4781
 
4639
- if (this.currentParams && this.currentParams.path) {
4640
- historyUrl += "?".concat(this.currentParams.path);
4641
- } else if (this.queryParams && this.options.persistentParameters === true) {
4642
- historyUrl += "?".concat(this.queryParams);
4643
- }
4782
+ if (this.currentParams && this.currentParams.path) {
4783
+ historyUrl += "?".concat(this.currentParams.path);
4784
+ } else if (this.queryParams && this.options.persistentParameters === true) {
4785
+ historyUrl += "?".concat(this.queryParams);
4786
+ }
4644
4787
 
4788
+ if (popped === false) {
4645
4789
  history.pushState({
4646
- inputPath: inputPath
4647
- }, inputPath, historyUrl);
4648
- } else {//
4790
+ inputPath: historyUrl
4791
+ }, 'unused', historyUrl);
4792
+ } else {
4793
+ history.replaceState({
4794
+ inputPath: historyUrl
4795
+ }, 'unused', historyUrl);
4649
4796
  }
4650
4797
  }
4651
4798
 
@@ -4812,7 +4959,7 @@ var WebsySearch = /*#__PURE__*/function () {
4812
4959
  }, {
4813
4960
  key: "handleKeyUp",
4814
4961
  value: function handleKeyUp(event) {
4815
- var _this28 = this;
4962
+ var _this29 = this;
4816
4963
 
4817
4964
  if (event.target.classList.contains('websy-search-input')) {
4818
4965
  if (this.searchTimeoutFn) {
@@ -4829,8 +4976,8 @@ var WebsySearch = /*#__PURE__*/function () {
4829
4976
 
4830
4977
  if (event.target.value.length >= this.options.minLength) {
4831
4978
  this.searchTimeoutFn = setTimeout(function () {
4832
- if (_this28.options.onSearch) {
4833
- _this28.options.onSearch(event.target.value);
4979
+ if (_this29.options.onSearch) {
4980
+ _this29.options.onSearch(event.target.value);
4834
4981
  }
4835
4982
  }, this.options.searchTimeout);
4836
4983
  } else {
@@ -4840,6 +4987,15 @@ var WebsySearch = /*#__PURE__*/function () {
4840
4987
  }
4841
4988
  }
4842
4989
  }
4990
+ }, {
4991
+ key: "text",
4992
+ set: function set(text) {
4993
+ var el = document.getElementById("".concat(this.elementId, "_search"));
4994
+
4995
+ if (el) {
4996
+ el.value = text;
4997
+ }
4998
+ }
4843
4999
  }]);
4844
5000
 
4845
5001
  return WebsySearch;
@@ -4981,7 +5137,7 @@ var Switch = /*#__PURE__*/function () {
4981
5137
 
4982
5138
  var WebsyTemplate = /*#__PURE__*/function () {
4983
5139
  function WebsyTemplate(elementId, options) {
4984
- var _this29 = this;
5140
+ var _this30 = this;
4985
5141
 
4986
5142
  _classCallCheck(this, WebsyTemplate);
4987
5143
 
@@ -5007,9 +5163,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
5007
5163
 
5008
5164
  if (_typeof(options.template) === 'object' && options.template.url) {
5009
5165
  this.templateService.get(options.template.url).then(function (templateString) {
5010
- _this29.options.template = templateString;
5166
+ _this30.options.template = templateString;
5011
5167
 
5012
- _this29.render();
5168
+ _this30.render();
5013
5169
  });
5014
5170
  } else {
5015
5171
  this.render();
@@ -5019,7 +5175,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5019
5175
  _createClass(WebsyTemplate, [{
5020
5176
  key: "buildHTML",
5021
5177
  value: function buildHTML() {
5022
- var _this30 = this;
5178
+ var _this31 = this;
5023
5179
 
5024
5180
  var html = "";
5025
5181
 
@@ -5081,14 +5237,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5081
5237
  }
5082
5238
 
5083
5239
  if (polarity === true) {
5084
- if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] === parts[1]) {
5240
+ if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] === parts[1]) {
5085
5241
  // remove the <if> tags
5086
5242
  removeAll = false;
5087
5243
  } else if (parts[0] === parts[1]) {
5088
5244
  removeAll = false;
5089
5245
  }
5090
5246
  } else if (polarity === false) {
5091
- if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] !== parts[1]) {
5247
+ if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] !== parts[1]) {
5092
5248
  // remove the <if> tags
5093
5249
  removeAll = false;
5094
5250
  }
@@ -5378,7 +5534,7 @@ var WebsyUtils = {
5378
5534
 
5379
5535
  var WebsyTable = /*#__PURE__*/function () {
5380
5536
  function WebsyTable(elementId, options) {
5381
- var _this31 = this;
5537
+ var _this32 = this;
5382
5538
 
5383
5539
  _classCallCheck(this, WebsyTable);
5384
5540
 
@@ -5416,8 +5572,8 @@ var WebsyTable = /*#__PURE__*/function () {
5416
5572
  allowClear: false,
5417
5573
  disableSearch: true,
5418
5574
  onItemSelected: function onItemSelected(selectedItem) {
5419
- if (_this31.options.onChangePageSize) {
5420
- _this31.options.onChangePageSize(selectedItem.value);
5575
+ if (_this32.options.onChangePageSize) {
5576
+ _this32.options.onChangePageSize(selectedItem.value);
5421
5577
  }
5422
5578
  }
5423
5579
  });
@@ -5438,7 +5594,7 @@ var WebsyTable = /*#__PURE__*/function () {
5438
5594
  _createClass(WebsyTable, [{
5439
5595
  key: "appendRows",
5440
5596
  value: function appendRows(data) {
5441
- var _this32 = this;
5597
+ var _this33 = this;
5442
5598
 
5443
5599
  this.hideError();
5444
5600
  var bodyHTML = '';
@@ -5446,15 +5602,15 @@ var WebsyTable = /*#__PURE__*/function () {
5446
5602
  if (data) {
5447
5603
  bodyHTML += data.map(function (r, rowIndex) {
5448
5604
  return '<tr>' + r.map(function (c, i) {
5449
- if (_this32.options.columns[i].show !== false) {
5605
+ if (_this33.options.columns[i].show !== false) {
5450
5606
  var style = '';
5451
5607
 
5452
5608
  if (c.style) {
5453
5609
  style += c.style;
5454
5610
  }
5455
5611
 
5456
- if (_this32.options.columns[i].width) {
5457
- style += "width: ".concat(_this32.options.columns[i].width, "; ");
5612
+ if (_this33.options.columns[i].width) {
5613
+ style += "width: ".concat(_this33.options.columns[i].width, "; ");
5458
5614
  }
5459
5615
 
5460
5616
  if (c.backgroundColor) {
@@ -5469,18 +5625,18 @@ var WebsyTable = /*#__PURE__*/function () {
5469
5625
  style += "color: ".concat(c.color, "; ");
5470
5626
  }
5471
5627
 
5472
- if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5473
- 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 ");
5474
- } else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5475
- 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 ");
5628
+ if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5629
+ 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 ");
5630
+ } else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5631
+ 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 ");
5476
5632
  } else {
5477
5633
  var info = c.value;
5478
5634
 
5479
- if (_this32.options.columns[i].showAsImage === true) {
5635
+ if (_this33.options.columns[i].showAsImage === true) {
5480
5636
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5481
5637
  }
5482
5638
 
5483
- 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 ");
5639
+ 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 ");
5484
5640
  }
5485
5641
  }
5486
5642
  }).join('') + '</tr>';
@@ -5652,7 +5808,7 @@ var WebsyTable = /*#__PURE__*/function () {
5652
5808
  }, {
5653
5809
  key: "render",
5654
5810
  value: function render(data) {
5655
- var _this33 = this;
5811
+ var _this34 = this;
5656
5812
 
5657
5813
  if (!this.options.columns) {
5658
5814
  return;
@@ -5687,7 +5843,7 @@ var WebsyTable = /*#__PURE__*/function () {
5687
5843
  style += "width: ".concat(c.width || 'auto', ";");
5688
5844
  }
5689
5845
 
5690
- 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 ");
5846
+ 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 ");
5691
5847
  }
5692
5848
  }).join('') + '</tr>';
5693
5849
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5706,7 +5862,7 @@ var WebsyTable = /*#__PURE__*/function () {
5706
5862
 
5707
5863
  if (pagingEl) {
5708
5864
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5709
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5865
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5710
5866
  });
5711
5867
  var startIndex = 0;
5712
5868
 
@@ -5774,7 +5930,7 @@ var WebsyTable = /*#__PURE__*/function () {
5774
5930
 
5775
5931
  var WebsyTable2 = /*#__PURE__*/function () {
5776
5932
  function WebsyTable2(elementId, options) {
5777
- var _this34 = this;
5933
+ var _this35 = this;
5778
5934
 
5779
5935
  _classCallCheck(this, WebsyTable2);
5780
5936
 
@@ -5815,8 +5971,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
5815
5971
  allowClear: false,
5816
5972
  disableSearch: true,
5817
5973
  onItemSelected: function onItemSelected(selectedItem) {
5818
- if (_this34.options.onChangePageSize) {
5819
- _this34.options.onChangePageSize(selectedItem.value);
5974
+ if (_this35.options.onChangePageSize) {
5975
+ _this35.options.onChangePageSize(selectedItem.value);
5820
5976
  }
5821
5977
  }
5822
5978
  });
@@ -5840,7 +5996,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5840
5996
  _createClass(WebsyTable2, [{
5841
5997
  key: "appendRows",
5842
5998
  value: function appendRows(data) {
5843
- var _this35 = this;
5999
+ var _this36 = this;
5844
6000
 
5845
6001
  this.hideError();
5846
6002
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -5849,15 +6005,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
5849
6005
  if (data) {
5850
6006
  bodyHTML += data.map(function (r, rowIndex) {
5851
6007
  return '<tr>' + r.map(function (c, i) {
5852
- if (_this35.options.columns[i].show !== false) {
5853
- var style = "height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px;");
6008
+ if (_this36.options.columns[i].show !== false) {
6009
+ var style = "height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px;");
5854
6010
 
5855
6011
  if (c.style) {
5856
6012
  style += c.style;
5857
6013
  }
5858
6014
 
5859
- if (_this35.options.columns[i].width) {
5860
- style += "width: ".concat(_this35.options.columns[i].width, "; ");
6015
+ if (_this36.options.columns[i].width) {
6016
+ style += "width: ".concat(_this36.options.columns[i].width, "; ");
5861
6017
  }
5862
6018
 
5863
6019
  if (c.backgroundColor) {
@@ -5872,18 +6028,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
5872
6028
  style += "color: ".concat(c.color, "; ");
5873
6029
  }
5874
6030
 
5875
- if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5876
- 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 ");
5877
- } else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5878
- 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 ");
6031
+ if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6032
+ 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 ");
6033
+ } else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6034
+ 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 ");
5879
6035
  } else {
5880
6036
  var info = c.value;
5881
6037
 
5882
- if (_this35.options.columns[i].showAsImage === true) {
6038
+ if (_this36.options.columns[i].showAsImage === true) {
5883
6039
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5884
6040
  }
5885
6041
 
5886
- 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 ");
6042
+ 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 ");
5887
6043
  }
5888
6044
  }
5889
6045
  }).join('') + '</tr>';
@@ -6146,7 +6302,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6146
6302
  }, {
6147
6303
  key: "render",
6148
6304
  value: function render(data) {
6149
- var _this36 = this;
6305
+ var _this37 = this;
6150
6306
 
6151
6307
  if (!this.options.columns) {
6152
6308
  return;
@@ -6182,7 +6338,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6182
6338
  style += "width: ".concat(c.width || 'auto', "; ");
6183
6339
  }
6184
6340
 
6185
- 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 ");
6341
+ 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 ");
6186
6342
  }
6187
6343
  }).join('') + '</tr>';
6188
6344
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6193,7 +6349,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6193
6349
  var dropdownHTML = "";
6194
6350
  this.options.columns.forEach(function (c, i) {
6195
6351
  if (c.searchable && c.searchField) {
6196
- dropdownHTML += "\n <div id=\"".concat(_this36.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6352
+ dropdownHTML += "\n <div id=\"".concat(_this37.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6197
6353
  }
6198
6354
  });
6199
6355
  dropdownEl.innerHTML = dropdownHTML;
@@ -6215,7 +6371,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6215
6371
 
6216
6372
  if (pagingEl) {
6217
6373
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6218
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6374
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6219
6375
  });
6220
6376
  var startIndex = 0;
6221
6377
 
@@ -6306,7 +6462,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6306
6462
  }, {
6307
6463
  key: "getColumnParameters",
6308
6464
  value: function getColumnParameters(values) {
6309
- var _this37 = this;
6465
+ var _this38 = this;
6310
6466
 
6311
6467
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6312
6468
  tableEl.style.tableLayout = 'auto';
@@ -6314,10 +6470,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
6314
6470
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6315
6471
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6316
6472
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6317
- 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 ");
6473
+ 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 ");
6318
6474
  }).join('') + '</tr>';
6319
6475
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6320
- 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 ");
6476
+ 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 ");
6321
6477
  }).join('') + '</tr>'; // get height of the first data cell
6322
6478
 
6323
6479
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6522,7 +6678,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6522
6678
  }, {
6523
6679
  key: "buildHeaderHtml",
6524
6680
  value: function buildHeaderHtml() {
6525
- var _this38 = this;
6681
+ var _this39 = this;
6526
6682
 
6527
6683
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6528
6684
  var headerHtml = '';
@@ -6537,7 +6693,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6537
6693
  }
6538
6694
 
6539
6695
  this.options.columns.forEach(function (row, rowIndex) {
6540
- if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
6696
+ if (useWidths === false && rowIndex !== _this39.options.columns.length - 1) {
6541
6697
  // if we're calculating the size we only want to render the last row of column headers
6542
6698
  return;
6543
6699
  }
@@ -6563,18 +6719,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
6563
6719
  // `
6564
6720
  // }
6565
6721
 
6566
- headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "</div></td>");
6722
+ headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this39.buildSearchIcon(col, colIndex) : '', "</div></td>");
6567
6723
  });
6568
6724
  headerHtml += "</tr>";
6569
6725
  });
6570
6726
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6571
6727
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6572
6728
  if (c.searchable && c.isExternalSearch === true) {
6573
- var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
6729
+ var testEl = document.getElementById("".concat(_this39.elementId, "_columnSearch_").concat(c.dimId || i));
6574
6730
 
6575
6731
  if (!testEl) {
6576
6732
  var newE = document.createElement('div');
6577
- newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
6733
+ newE.id = "".concat(_this39.elementId, "_columnSearch_").concat(c.dimId || i);
6578
6734
  newE.className = 'websy-modal-dropdown';
6579
6735
  dropdownEl.appendChild(newE);
6580
6736
  }
@@ -6590,7 +6746,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6590
6746
  }, {
6591
6747
  key: "buildTotalHtml",
6592
6748
  value: function buildTotalHtml() {
6593
- var _this39 = this;
6749
+ var _this40 = this;
6594
6750
 
6595
6751
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6596
6752
 
@@ -6603,7 +6759,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6603
6759
  totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6604
6760
 
6605
6761
  if (useWidths === true) {
6606
- totalHtml += "\n style='width: ".concat(_this39.options.columns[_this39.options.columns.length - 1][colIndex].width || _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6762
+ 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 ");
6607
6763
  }
6608
6764
 
6609
6765
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
@@ -6614,7 +6770,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6614
6770
  }, {
6615
6771
  key: "calculateSizes",
6616
6772
  value: function calculateSizes() {
6617
- var _this40 = this;
6773
+ var _this41 = this;
6618
6774
 
6619
6775
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6620
6776
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
@@ -6657,32 +6813,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
6657
6813
  rows.forEach(function (row, rowIndex) {
6658
6814
  Array.from(row.children).forEach(function (col, colIndex) {
6659
6815
  var colSize = col.getBoundingClientRect();
6660
- _this40.sizes.cellHeight = colSize.height;
6816
+ _this41.sizes.cellHeight = colSize.height;
6661
6817
 
6662
- if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
6663
- if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
6664
- _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
6818
+ if (_this41.options.columns[_this41.options.columns.length - 1][colIndex]) {
6819
+ if (!_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth) {
6820
+ _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth = 0;
6665
6821
  }
6666
6822
 
6667
- _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
6668
- _this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
6823
+ _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);
6824
+ _this41.options.columns[_this41.options.columns.length - 1][colIndex].cellHeight = colSize.height;
6669
6825
 
6670
- if (colIndex >= _this40.pinnedColumns) {
6671
- firstNonPinnedColumnWidth = _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth;
6826
+ if (colIndex >= _this41.pinnedColumns) {
6827
+ firstNonPinnedColumnWidth = _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth;
6672
6828
  }
6673
6829
  }
6674
6830
  });
6675
6831
  });
6676
6832
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
6677
- if (colIndex < _this40.pinnedColumns) {
6678
- _this40.sizes.scrollableWidth -= col.actualWidth;
6833
+ if (colIndex < _this41.pinnedColumns) {
6834
+ _this41.sizes.scrollableWidth -= col.actualWidth;
6679
6835
  }
6680
6836
  });
6681
6837
  this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
6682
6838
  return a + (b.width || b.actualWidth);
6683
6839
  }, 0);
6684
6840
  this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
6685
- return i >= _this40.pinnedColumns;
6841
+ return i >= _this41.pinnedColumns;
6686
6842
  }).reduce(function (a, b) {
6687
6843
  return a + (b.width || b.actualWidth);
6688
6844
  }, 0);
@@ -6703,10 +6859,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6703
6859
  c.actualWidth += equalWidth; // }
6704
6860
  // }
6705
6861
 
6706
- _this40.sizes.totalWidth += c.width || c.actualWidth;
6862
+ _this41.sizes.totalWidth += c.width || c.actualWidth;
6707
6863
 
6708
- if (i < _this40.pinnedColumns) {
6709
- _this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6864
+ if (i < _this41.pinnedColumns) {
6865
+ _this41.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6710
6866
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6711
6867
 
6712
6868
  });
@@ -7164,7 +7320,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7164
7320
 
7165
7321
  var WebsyChart = /*#__PURE__*/function () {
7166
7322
  function WebsyChart(elementId, options) {
7167
- var _this41 = this;
7323
+ var _this42 = this;
7168
7324
 
7169
7325
  _classCallCheck(this, WebsyChart);
7170
7326
 
@@ -7205,6 +7361,7 @@ var WebsyChart = /*#__PURE__*/function () {
7205
7361
  this.rightAxis = null;
7206
7362
  this.topAxis = null;
7207
7363
  this.bottomAxis = null;
7364
+ this.renderedKeys = {};
7208
7365
 
7209
7366
  if (!elementId) {
7210
7367
  console.log('No element Id provided for Websy Chart');
@@ -7214,22 +7371,22 @@ var WebsyChart = /*#__PURE__*/function () {
7214
7371
  this.invertOverride = function (input, input2) {
7215
7372
  var xAxis = 'bottomAxis';
7216
7373
 
7217
- if (_this41.options.orientation === 'horizontal') {
7374
+ if (_this42.options.orientation === 'horizontal') {
7218
7375
  xAxis = 'leftAxis';
7219
7376
  }
7220
7377
 
7221
- var width = _this41[xAxis].step();
7378
+ var width = _this42[xAxis].step();
7222
7379
 
7223
7380
  var output;
7224
7381
 
7225
- var domain = _toConsumableArray(_this41[xAxis].domain());
7382
+ var domain = _toConsumableArray(_this42[xAxis].domain());
7226
7383
 
7227
- if (_this41.options.orientation === 'horizontal') {
7384
+ if (_this42.options.orientation === 'horizontal') {
7228
7385
  domain = domain.reverse();
7229
7386
  }
7230
7387
 
7231
7388
  for (var j = 0; j < domain.length; j++) {
7232
- var breakA = _this41[xAxis](domain[j]) - width / 2;
7389
+ var breakA = _this42[xAxis](domain[j]) - width / 2;
7233
7390
  var breakB = breakA + width;
7234
7391
 
7235
7392
  if (input > breakA && input <= breakB) {
@@ -7329,10 +7486,10 @@ var WebsyChart = /*#__PURE__*/function () {
7329
7486
  }, {
7330
7487
  key: "handleEventMouseMove",
7331
7488
  value: function handleEventMouseMove(event, d) {
7332
- var _this42 = this;
7489
+ var _this43 = this;
7333
7490
 
7334
7491
  var bisectDate = d3.bisector(function (d) {
7335
- return _this42.parseX(d.x.value);
7492
+ return _this43.parseX(d.x.value);
7336
7493
  }).left;
7337
7494
 
7338
7495
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -7371,8 +7528,8 @@ var WebsyChart = /*#__PURE__*/function () {
7371
7528
  }
7372
7529
 
7373
7530
  this.options.data.series.forEach(function (s) {
7374
- if (_this42.options.data[xData].scale !== 'Time') {
7375
- xPoint = _this42[xAxis](_this42.parseX(xLabel));
7531
+ if (_this43.options.data[xData].scale !== 'Time') {
7532
+ xPoint = _this43[xAxis](_this43.parseX(xLabel));
7376
7533
  s.data.forEach(function (d) {
7377
7534
  if (d.x.value === xLabel) {
7378
7535
  if (!tooltipTitle) {
@@ -7391,13 +7548,13 @@ var WebsyChart = /*#__PURE__*/function () {
7391
7548
  var pointA = s.data[index - 1];
7392
7549
  var pointB = s.data[index];
7393
7550
 
7394
- if (_this42.options.orientation === 'horizontal') {
7551
+ if (_this43.options.orientation === 'horizontal') {
7395
7552
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7396
7553
  pointB = _toConsumableArray(s.data).reverse()[index];
7397
7554
  }
7398
7555
 
7399
7556
  if (pointA && !pointB) {
7400
- xPoint = _this42[xAxis](_this42.parseX(pointA.x.value));
7557
+ xPoint = _this43[xAxis](_this43.parseX(pointA.x.value));
7401
7558
  tooltipTitle = pointA.x.value;
7402
7559
 
7403
7560
  if (!pointA.y.color) {
@@ -7407,12 +7564,12 @@ var WebsyChart = /*#__PURE__*/function () {
7407
7564
  tooltipData.push(pointA.y);
7408
7565
 
7409
7566
  if (typeof pointA.x.value.getTime !== 'undefined') {
7410
- tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointA.x.value);
7567
+ tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointA.x.value);
7411
7568
  }
7412
7569
  }
7413
7570
 
7414
7571
  if (pointB && !pointA) {
7415
- xPoint = _this42[xAxis](_this42.parseX(pointB.x.value));
7572
+ xPoint = _this43[xAxis](_this43.parseX(pointB.x.value));
7416
7573
  tooltipTitle = pointB.x.value;
7417
7574
 
7418
7575
  if (!pointB.y.color) {
@@ -7422,14 +7579,14 @@ var WebsyChart = /*#__PURE__*/function () {
7422
7579
  tooltipData.push(pointB.y);
7423
7580
 
7424
7581
  if (typeof pointB.x.value.getTime !== 'undefined') {
7425
- tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
7582
+ tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
7426
7583
  }
7427
7584
  }
7428
7585
 
7429
7586
  if (pointA && pointB) {
7430
- var d0 = _this42[xAxis](_this42.parseX(pointA.x.value));
7587
+ var d0 = _this43[xAxis](_this43.parseX(pointA.x.value));
7431
7588
 
7432
- var d1 = _this42[xAxis](_this42.parseX(pointB.x.value));
7589
+ var d1 = _this43[xAxis](_this43.parseX(pointB.x.value));
7433
7590
 
7434
7591
  var mid = Math.abs(d0 - d1) / 2;
7435
7592
 
@@ -7438,7 +7595,7 @@ var WebsyChart = /*#__PURE__*/function () {
7438
7595
  tooltipTitle = pointB.x.value;
7439
7596
 
7440
7597
  if (typeof pointB.x.value.getTime !== 'undefined') {
7441
- tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
7598
+ tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
7442
7599
  }
7443
7600
 
7444
7601
  if (!pointB.y.color) {
@@ -7451,7 +7608,7 @@ var WebsyChart = /*#__PURE__*/function () {
7451
7608
  tooltipTitle = pointA.x.value;
7452
7609
 
7453
7610
  if (typeof pointB.x.value.getTime !== 'undefined') {
7454
- tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
7611
+ tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
7455
7612
  }
7456
7613
 
7457
7614
  if (!pointA.y.color) {
@@ -7565,7 +7722,7 @@ var WebsyChart = /*#__PURE__*/function () {
7565
7722
  }, {
7566
7723
  key: "render",
7567
7724
  value: function render(options) {
7568
- var _this43 = this;
7725
+ var _this44 = this;
7569
7726
 
7570
7727
  /* global d3 options WebsyUtils */
7571
7728
  if (typeof options !== 'undefined') {
@@ -7634,7 +7791,7 @@ var WebsyChart = /*#__PURE__*/function () {
7634
7791
  var legendData = this.options.data.series.map(function (s, i) {
7635
7792
  return {
7636
7793
  value: s.label || s.key,
7637
- color: s.color || _this43.options.colors[i % _this43.options.colors.length]
7794
+ color: s.color || _this44.options.colors[i % _this44.options.colors.length]
7638
7795
  };
7639
7796
  });
7640
7797
 
@@ -7916,7 +8073,7 @@ var WebsyChart = /*#__PURE__*/function () {
7916
8073
 
7917
8074
  if (this.options.data.bottom.formatter) {
7918
8075
  bAxisFunc.tickFormat(function (d) {
7919
- return _this43.options.data.bottom.formatter(d);
8076
+ return _this44.options.data.bottom.formatter(d);
7920
8077
  });
7921
8078
  }
7922
8079
 
@@ -7942,8 +8099,8 @@ var WebsyChart = /*#__PURE__*/function () {
7942
8099
 
7943
8100
  if (this.options.margin.axisLeft > 0) {
7944
8101
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
7945
- if (_this43.options.data.left.formatter) {
7946
- d = _this43.options.data.left.formatter(d);
8102
+ if (_this44.options.data.left.formatter) {
8103
+ d = _this44.options.data.left.formatter(d);
7947
8104
  }
7948
8105
 
7949
8106
  return d;
@@ -7980,8 +8137,8 @@ var WebsyChart = /*#__PURE__*/function () {
7980
8137
 
7981
8138
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
7982
8139
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
7983
- if (_this43.options.data.right.formatter) {
7984
- d = _this43.options.data.right.formatter(d);
8140
+ if (_this44.options.data.right.formatter) {
8141
+ d = _this44.options.data.right.formatter(d);
7985
8142
  }
7986
8143
 
7987
8144
  return d;
@@ -8002,21 +8159,36 @@ var WebsyChart = /*#__PURE__*/function () {
8002
8159
  }
8003
8160
  } else {// put the title horizontally on the top
8004
8161
  }
8162
+ } // Remove the unnecessary series
8163
+
8164
+
8165
+ var newKeys = this.options.data.series.map(function (s) {
8166
+ return s.key;
8167
+ });
8168
+
8169
+ for (var key in this.renderedKeys) {
8170
+ if (newKeys.indexOf(key) === -1) {
8171
+ // remove the components
8172
+ this["remove".concat(this.renderedKeys[key])](key);
8173
+ }
8005
8174
  } // Draw the series data
8006
8175
 
8007
8176
 
8177
+ this.renderedKeys = {};
8008
8178
  this.options.data.series.forEach(function (series, index) {
8009
8179
  if (!series.key) {
8010
- series.key = _this43.createIdentity();
8180
+ series.key = _this44.createIdentity();
8011
8181
  }
8012
8182
 
8013
8183
  if (!series.color) {
8014
- series.color = _this43.options.colors[index % _this43.options.colors.length];
8184
+ series.color = _this44.options.colors[index % _this44.options.colors.length];
8015
8185
  }
8016
8186
 
8017
- _this43["render".concat(series.type || 'bar')](series, index);
8187
+ _this44["render".concat(series.type || 'bar')](series, index);
8018
8188
 
8019
- _this43.renderLabels(series, index);
8189
+ _this44.renderLabels(series, index);
8190
+
8191
+ _this44.renderedKeys[series.key] = series.type;
8020
8192
  });
8021
8193
  }
8022
8194
  }
@@ -8024,17 +8196,17 @@ var WebsyChart = /*#__PURE__*/function () {
8024
8196
  }, {
8025
8197
  key: "renderarea",
8026
8198
  value: function renderarea(series, index) {
8027
- var _this44 = this;
8199
+ var _this45 = this;
8028
8200
 
8029
8201
  /* global d3 series index */
8030
8202
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8031
8203
  return d3.area().x(function (d) {
8032
- return _this44[xAxis](_this44.parseX(d.x.value));
8204
+ return _this45[xAxis](_this45.parseX(d.x.value));
8033
8205
  }).y0(function (d) {
8034
- return _this44[yAxis](0);
8206
+ return _this45[yAxis](0);
8035
8207
  }).y1(function (d) {
8036
- return _this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
8037
- }).curve(d3[curveStyle || _this44.options.curveStyle]);
8208
+ return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
8209
+ }).curve(d3[curveStyle || _this45.options.curveStyle]);
8038
8210
  };
8039
8211
 
8040
8212
  var xAxis = 'bottomAxis';
@@ -8157,7 +8329,7 @@ var WebsyChart = /*#__PURE__*/function () {
8157
8329
  }, {
8158
8330
  key: "renderLabels",
8159
8331
  value: function renderLabels(series, index) {
8160
- var _this45 = this;
8332
+ var _this46 = this;
8161
8333
 
8162
8334
  /* global series index d3 WebsyDesigns */
8163
8335
  var xAxis = 'bottomAxis';
@@ -8176,11 +8348,11 @@ var WebsyChart = /*#__PURE__*/function () {
8176
8348
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
8177
8349
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
8178
8350
  labels.attr('x', function (d) {
8179
- return getLabelX.call(_this45, d, series.labelPosition);
8351
+ return getLabelX.call(_this46, d, series.labelPosition);
8180
8352
  }).attr('y', function (d) {
8181
- return getLabelY.call(_this45, d, series.labelPosition);
8353
+ return getLabelY.call(_this46, d, series.labelPosition);
8182
8354
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
8183
- return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8355
+ return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8184
8356
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
8185
8357
  return d.y.label || d.y.value;
8186
8358
  }).each(function (d, i) {
@@ -8205,11 +8377,11 @@ var WebsyChart = /*#__PURE__*/function () {
8205
8377
  }
8206
8378
  });
8207
8379
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
8208
- return getLabelX.call(_this45, d, series.labelPosition);
8380
+ return getLabelX.call(_this46, d, series.labelPosition);
8209
8381
  }).attr('y', function (d) {
8210
- return getLabelY.call(_this45, d, series.labelPosition);
8382
+ return getLabelY.call(_this46, d, series.labelPosition);
8211
8383
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
8212
- return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8384
+ return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
8213
8385
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
8214
8386
  return d.y.label || d.y.value;
8215
8387
  }).each(function (d, i) {
@@ -8266,16 +8438,16 @@ var WebsyChart = /*#__PURE__*/function () {
8266
8438
  }, {
8267
8439
  key: "renderline",
8268
8440
  value: function renderline(series, index) {
8269
- var _this46 = this;
8441
+ var _this47 = this;
8270
8442
 
8271
8443
  /* global series index d3 */
8272
8444
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
8273
8445
  return d3.line().x(function (d) {
8274
- var adjustment = _this46.options.data[xAxis].scale === 'Time' ? 0 : _this46["".concat(xAxis, "Axis")].bandwidth() / 2;
8275
- return _this46["".concat(xAxis, "Axis")](_this46.parseX(d.x.value)) + adjustment;
8446
+ var adjustment = _this47.options.data[xAxis].scale === 'Time' ? 0 : _this47["".concat(xAxis, "Axis")].bandwidth() / 2;
8447
+ return _this47["".concat(xAxis, "Axis")](_this47.parseX(d.x.value)) + adjustment;
8276
8448
  }).y(function (d) {
8277
- return _this46["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8278
- }).curve(d3[curveStyle || _this46.options.curveStyle]);
8449
+ return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8450
+ }).curve(d3[curveStyle || _this47.options.curveStyle]);
8279
8451
  };
8280
8452
 
8281
8453
  var xAxis = 'bottom';
@@ -8310,17 +8482,23 @@ var WebsyChart = /*#__PURE__*/function () {
8310
8482
  this.rendersymbol(series, index);
8311
8483
  }
8312
8484
  }
8485
+ }, {
8486
+ key: "removeline",
8487
+ value: function removeline(key) {
8488
+ /* global key d3 */
8489
+ var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
8490
+ }
8313
8491
  }, {
8314
8492
  key: "rendersymbol",
8315
8493
  value: function rendersymbol(series, index) {
8316
- var _this47 = this;
8494
+ var _this48 = this;
8317
8495
 
8318
8496
  /* global d3 series index series.key */
8319
8497
  var drawSymbol = function drawSymbol(size) {
8320
8498
  return d3.symbol() // .type(d => {
8321
8499
  // return d3.symbols[0]
8322
8500
  // })
8323
- .size(size || _this47.options.symbolSize);
8501
+ .size(size || _this48.options.symbolSize);
8324
8502
  };
8325
8503
 
8326
8504
  var xAxis = 'bottomAxis';
@@ -8338,7 +8516,7 @@ var WebsyChart = /*#__PURE__*/function () {
8338
8516
  symbols.attr('d', function (d) {
8339
8517
  return drawSymbol(d.y.size || series.symbolSize)(d);
8340
8518
  }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
8341
- return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8519
+ return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8342
8520
  }); // Enter
8343
8521
 
8344
8522
  symbols.enter().append('path').attr('d', function (d) {
@@ -8347,7 +8525,7 @@ var WebsyChart = /*#__PURE__*/function () {
8347
8525
  .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
8348
8526
  return "symbol symbol_".concat(series.key);
8349
8527
  }).attr('transform', function (d) {
8350
- return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8528
+ return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8351
8529
  });
8352
8530
  }
8353
8531
  }, {
@@ -8502,7 +8680,7 @@ var WebsyLegend = /*#__PURE__*/function () {
8502
8680
  }, {
8503
8681
  key: "resize",
8504
8682
  value: function resize() {
8505
- var _this48 = this;
8683
+ var _this49 = this;
8506
8684
 
8507
8685
  var el = document.getElementById(this.elementId);
8508
8686
 
@@ -8515,7 +8693,7 @@ var WebsyLegend = /*#__PURE__*/function () {
8515
8693
  // }
8516
8694
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
8517
8695
  html += this._data.map(function (d, i) {
8518
- return _this48.getLegendItemHTML(d);
8696
+ return _this49.getLegendItemHTML(d);
8519
8697
  }).join('');
8520
8698
  html += "\n <div>\n ";
8521
8699
  el.innerHTML = html;
@@ -8687,7 +8865,7 @@ var WebsyMap = /*#__PURE__*/function () {
8687
8865
  }, {
8688
8866
  key: "render",
8689
8867
  value: function render() {
8690
- var _this49 = this;
8868
+ var _this50 = this;
8691
8869
 
8692
8870
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
8693
8871
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -8696,7 +8874,7 @@ var WebsyMap = /*#__PURE__*/function () {
8696
8874
  var legendData = this.options.data.polygons.map(function (s, i) {
8697
8875
  return {
8698
8876
  value: s.label || s.key,
8699
- color: s.color || _this49.options.colors[i % _this49.options.colors.length]
8877
+ color: s.color || _this50.options.colors[i % _this50.options.colors.length]
8700
8878
  };
8701
8879
  });
8702
8880
  var longestValue = legendData.map(function (s) {
@@ -8760,7 +8938,7 @@ var WebsyMap = /*#__PURE__*/function () {
8760
8938
 
8761
8939
  if (this.polygons) {
8762
8940
  this.polygons.forEach(function (p) {
8763
- return _this49.map.removeLayer(p);
8941
+ return _this50.map.removeLayer(p);
8764
8942
  });
8765
8943
  }
8766
8944
 
@@ -8818,18 +8996,18 @@ var WebsyMap = /*#__PURE__*/function () {
8818
8996
  }
8819
8997
 
8820
8998
  if (!p.options.color) {
8821
- p.options.color = _this49.options.colors[i % _this49.options.colors.length];
8999
+ p.options.color = _this50.options.colors[i % _this50.options.colors.length];
8822
9000
  }
8823
9001
 
8824
9002
  var pol = L.polygon(p.data.map(function (c) {
8825
9003
  return c.map(function (d) {
8826
9004
  return [d.Latitude, d.Longitude];
8827
9005
  });
8828
- }), p.options).addTo(_this49.map);
9006
+ }), p.options).addTo(_this50.map);
8829
9007
 
8830
- _this49.polygons.push(pol);
9008
+ _this50.polygons.push(pol);
8831
9009
 
8832
- _this49.map.fitBounds(pol.getBounds());
9010
+ _this50.map.fitBounds(pol.getBounds());
8833
9011
  });
8834
9012
  } // if (this.data.markers.length > 0) {
8835
9013
  // el.classList.remove('hidden')