@websy/websy-designs 1.3.12 → 1.4.1

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.
@@ -2617,7 +2617,9 @@ var WebsyIcons = {
2617
2617
  'Pin': "\n <svg xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n\t<g>\n\t\t<path d=\"M368,312.1H132l-0.6-9.4c-0.1-2.4-0.2-4.8-0.2-7.1c0-40.3,20.7-78.1,54.4-99.9V73.2h-9c-13,0-23.6-10.6-23.6-23.6\n\t\t\tS163.5,26,176.6,26h146.9c13,0,23.6,10.6,23.6,23.6s-10.6,23.6-23.6,23.6h-9v122.5c33.7,21.8,54.4,59.5,54.4,99.9\n\t\t\tc0,2.3-0.1,4.7-0.2,7.1L368,312.1z M151.2,292.1h197.5c-1.2-33.8-19.9-65.1-49.4-82.1l-5-2.9V53.2h29c2,0,3.6-1.6,3.6-3.6\n\t\t\tc0-2-1.6-3.6-3.6-3.6H176.6c-2,0-3.6,1.6-3.6,3.6c0,2,1.6,3.6,3.6,3.6h29v153.9l-5,2.9C171.1,227,152.4,258.3,151.2,292.1z\"/>\n\t</g>\n\t<path d=\"M260.9,403.8V299.9h-21.8v108.8h0c0.1,36.1,4.9,65.3,10.9,65.3c6,0,10.9-29.7,10.9-66.4\n\t\tC260.9,406.4,260.9,405.1,260.9,403.8z\"/>\n</svg>\n\n ",
2618
2618
  'WindowPopout': "\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:none;stroke:#000000;stroke-width:20;stroke-miterlimit:10;}\n</style>\n<path class=\"st0\" d=\"M420.1,359.6h-285c-24.7,0-45-20.2-45-45V124.9c0-24.7,20.2-45,45-45h285c24.7,0,45,20.2,45,45v189.7\n\tC465.1,339.3,444.9,359.6,420.1,359.6z\"/>\n<path class=\"st0\" d=\"M407.3,389.8c-6.3,17.3-22.9,29.7-42.3,29.7H80c-24.7,0-45-20.2-45-45V184.9c0-18.2,10.9-33.9,26.5-41\"/>\n</svg>\n\n ",
2619
2619
  'Plus': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 500 500\">\n<path d=\"M254.7,486h-10.3c-5.5,0-10-4.5-10-10V26c0-5.5,4.5-10,10-10h10.3c5.5,0,10,4.5,10,10v450C264.6,481.5,260.2,486,254.7,486z\"/>\n<path d=\"M15,255.1v-10.3c0-5.5,4.5-10,10-10h450c5.5,0,10,4.5,10,10v10.3c0,5.5-4.5,10-10,10H25C19.5,265.1,15,260.7,15,255.1z\"/>\n</svg>\n\n ",
2620
- 'Minus': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 500 500\">\n<path d=\"M15,255.1v-10.3c0-5.5,4.5-10,10-10h450c5.5,0,10,4.5,10,10v10.3c0,5.5-4.5,10-10,10H25C19.5,265.1,15,260.7,15,255.1z\"/>\n</svg>\n "
2620
+ 'Minus': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 500 500\">\n<path d=\"M15,255.1v-10.3c0-5.5,4.5-10,10-10h450c5.5,0,10,4.5,10,10v10.3c0,5.5-4.5,10-10,10H25C19.5,265.1,15,260.7,15,255.1z\"/>\n</svg>\n ",
2621
+ 'PlusFilled': "\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#FFFFFF;}\n</style>\n<circle cx=\"249.6\" cy=\"251\" r=\"235\"/>\n<path class=\"st0\" d=\"M422.3,234.8H264.7V78.7c0-4.2-4.5-7.7-10-7.7h-10.3c-5.5,0-10,3.4-10,7.7v156.1H77.7c-4.2,0-7.7,4.5-7.7,10\n\tv10.3c0,5.6,3.4,10,7.7,10h156.7v158.2c0,4.2,4.5,7.7,10,7.7h10.3c5.5,0,9.9-3.4,10-7.7V265.1h157.6c4.2,0,7.7-4.5,7.7-10v-10.3\n\tC430,239.3,426.6,234.8,422.3,234.8z\"/>\n</svg>\n\n ",
2622
+ 'MinusFilled': "\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#FFFFFF;}\n</style>\n<circle cx=\"250.1\" cy=\"255.4\" r=\"235\"/>\n<path class=\"st0\" d=\"M70,255.1v-10.3c0-5.5,3.4-10,7.7-10h344.7c4.2,0,7.7,4.5,7.7,10v10.3c0,5.5-3.4,10-7.7,10H77.7\n\tC73.4,265.1,70,260.7,70,255.1z\"/>\n</svg>\n\n "
2621
2623
  };
2622
2624
 
2623
2625
  var WebsyLoadingDialog = /*#__PURE__*/function () {
@@ -4221,7 +4223,10 @@ var WebsyRouter = /*#__PURE__*/function () {
4221
4223
 
4222
4224
  for (var i = 0; i < parts.length; i++) {
4223
4225
  var bits = parts[i].split('=');
4224
- output.items[bits[0]] = bits[1];
4226
+
4227
+ if (bits[0] && bits[0] !== '' && bits[1] && bits[1] !== '') {
4228
+ output.items[bits[0]] = bits[1];
4229
+ }
4225
4230
  }
4226
4231
 
4227
4232
  this.currentParams = output;
@@ -4344,17 +4349,32 @@ var WebsyRouter = /*#__PURE__*/function () {
4344
4349
  }, {
4345
4350
  key: "hideView",
4346
4351
  value: function hideView(view, group) {
4352
+ if (view === '/' || view === '') {
4353
+ view = this.options.defaultView;
4354
+ }
4355
+
4347
4356
  this.hideChildren(view, group);
4348
4357
 
4349
- if (this.previousView !== this.currentView) {
4350
- this.hideTriggerItems(view, group);
4351
- this.hideViewItems(view, group);
4352
- this.publish('hide', [view]);
4353
- } else if (group !== this.options.defaultGroup) {
4358
+ if (this.previousView !== this.currentView || group !== this.options.defaultGroup) {
4354
4359
  this.hideTriggerItems(view, group);
4355
4360
  this.hideViewItems(view, group);
4356
4361
  this.publish('hide', [view]);
4357
- }
4362
+
4363
+ if (this.options.views && this.options.views[view]) {
4364
+ this.options.views[view].components.forEach(function (c) {
4365
+ if (typeof c.instance !== 'undefined') {
4366
+ if (c.instance.close) {
4367
+ c.instance.close();
4368
+ }
4369
+ }
4370
+ });
4371
+ }
4372
+ } // else if (group !== this.options.defaultGroup) {
4373
+ // this.hideTriggerItems(view, group)
4374
+ // this.hideViewItems(view, group)
4375
+ // this.publish('hide', [view])
4376
+ // }
4377
+
4358
4378
  } // registerElements (root) {
4359
4379
  // if (root.nodeName === '#document') {
4360
4380
  // this.groups = {}
@@ -4763,6 +4783,7 @@ var WebsySearch = /*#__PURE__*/function () {
4763
4783
  // el.addEventListener('click', this.handleClick.bind(this))
4764
4784
  el.addEventListener('click', this.handleClick.bind(this));
4765
4785
  el.addEventListener('keyup', this.handleKeyUp.bind(this));
4786
+ el.addEventListener('keyup', this.handleKeyDown.bind(this));
4766
4787
  el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "'>\n <div class='clear websy-hidden' id='").concat(this.elementId, "_clear'>\n ").concat(this.options.clearIcon, "\n </div>\n </div>\n ");
4767
4788
  } else {
4768
4789
  console.log('No element found with Id', elementId);
@@ -4778,6 +4799,16 @@ var WebsySearch = /*#__PURE__*/function () {
4778
4799
  this.options.onSearch('');
4779
4800
  }
4780
4801
  }
4802
+ }, {
4803
+ key: "handleKeyDown",
4804
+ value: function handleKeyDown(event) {
4805
+ if (event.key === 'Enter') {
4806
+ if (this.options.onSubmit) {
4807
+ this.options.onSubmit(event.target.value);
4808
+ return false;
4809
+ }
4810
+ }
4811
+ }
4781
4812
  }, {
4782
4813
  key: "handleKeyUp",
4783
4814
  value: function handleKeyUp(event) {
@@ -6433,18 +6464,22 @@ var WebsyTable3 = /*#__PURE__*/function () {
6433
6464
  data.forEach(function (row, rowIndex) {
6434
6465
  bodyHtml += "<tr class=\"websy-table-row\">";
6435
6466
  row.forEach(function (cell, cellIndex) {
6436
- if (typeof sizingColumns[cellIndex] === 'undefined') {
6467
+ var sizeIndex = cell.level || cellIndex;
6468
+
6469
+ if (typeof sizingColumns[sizeIndex] === 'undefined') {
6437
6470
  return; // need to revisit this logic
6438
6471
  }
6439
6472
 
6440
- var style = '';
6473
+ var style = "width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important; ");
6474
+ var divStyle = style;
6441
6475
 
6442
6476
  if (cell.style) {
6443
6477
  style += cell.style;
6444
6478
  }
6445
6479
 
6446
6480
  if (useWidths === true) {
6447
- style += "max-width: ".concat(sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth, "px!important;");
6481
+ style += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
6482
+ divStyle += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
6448
6483
  }
6449
6484
 
6450
6485
  if (cell.backgroundColor) {
@@ -6457,9 +6492,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6457
6492
 
6458
6493
  if (cell.color) {
6459
6494
  style += "color: ".concat(cell.color, "; ");
6460
- }
6495
+ } // console.log('rowspan', cell.rowspan)
6496
+
6461
6497
 
6462
- console.log('rowspan', cell.rowspan);
6463
6498
  bodyHtml += "<td \n class='websy-table-cell ".concat((cell.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-col-index='").concat(cellIndex, "'\n "); // if (useWidths === true) {
6464
6499
  // bodyHtml += `
6465
6500
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6467,17 +6502,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
6467
6502
  // `
6468
6503
  // }
6469
6504
 
6470
- bodyHtml += "\n >";
6505
+ bodyHtml += "\n ><div style='".concat(divStyle, "'>");
6471
6506
 
6472
6507
  if (cell.expandable === true) {
6473
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(WebsyDesigns.Icons.Plus, "</i>");
6508
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(WebsyDesigns.Icons.PlusFilled, "</i>");
6474
6509
  }
6475
6510
 
6476
6511
  if (cell.collapsable === true) {
6477
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(WebsyDesigns.Icons.Minus, "</i>");
6512
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(WebsyDesigns.Icons.MinusFilled, "</i>");
6478
6513
  }
6479
6514
 
6480
- bodyHtml += "\n ".concat(cell.value, "\n </td>");
6515
+ bodyHtml += "\n ".concat(cell.value, "\n </div></td>");
6481
6516
  });
6482
6517
  bodyHtml += "</tr>";
6483
6518
  }); // bodyHtml += `</div>`
@@ -6509,14 +6544,26 @@ var WebsyTable3 = /*#__PURE__*/function () {
6509
6544
 
6510
6545
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
6511
6546
  row.forEach(function (col, colIndex) {
6512
- headerHtml += "<td \n class='websy-table-cell' \n style='".concat(col.style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6547
+ var style = "width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important; ");
6548
+ var divStyle = style;
6549
+
6550
+ if (useWidths === true) {
6551
+ style += "max-width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important;");
6552
+ divStyle += "max-width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important;");
6553
+ }
6554
+
6555
+ if (col.style) {
6556
+ style += col.style;
6557
+ }
6558
+
6559
+ headerHtml += "<td \n class='websy-table-cell' \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) {
6513
6560
  // headerHtml += `
6514
6561
  // style='width: ${col.width || col.actualWidth}px'
6515
6562
  // width='${col.width || col.actualWidth}'
6516
6563
  // `
6517
6564
  // }
6518
6565
 
6519
- headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6566
+ headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "</div></td>");
6520
6567
  });
6521
6568
  headerHtml += "</tr>";
6522
6569
  });
@@ -6538,7 +6585,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6538
6585
  }, {
6539
6586
  key: "buildSearchIcon",
6540
6587
  value: function buildSearchIcon(col, index) {
6541
- return "\n <div class=\"websy-table-search-icon\" data-col-id=\"".concat(col.dimId, "\" data-col-index=\"").concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>\n ");
6588
+ return "<div class=\"websy-table-search-icon\" data-col-id=\"".concat(col.dimId, "\" data-col-index=\"").concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>");
6542
6589
  }
6543
6590
  }, {
6544
6591
  key: "buildTotalHtml",
@@ -6606,6 +6653,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6606
6653
  var rows = Array.from(tableEl.querySelectorAll('.websy-table-row'));
6607
6654
  var totalWidth = 0;
6608
6655
  this.sizes.scrollableWidth = this.sizes.outer.width;
6656
+ var firstNonPinnedColumnWidth = 0;
6609
6657
  rows.forEach(function (row, rowIndex) {
6610
6658
  Array.from(row.children).forEach(function (col, colIndex) {
6611
6659
  var colSize = col.getBoundingClientRect();
@@ -6618,6 +6666,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6618
6666
 
6619
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);
6620
6668
  _this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
6669
+
6670
+ if (colIndex >= _this40.pinnedColumns) {
6671
+ firstNonPinnedColumnWidth = _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth;
6672
+ }
6621
6673
  }
6622
6674
  });
6623
6675
  });
@@ -6633,7 +6685,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6633
6685
  return i >= _this40.pinnedColumns;
6634
6686
  }).reduce(function (a, b) {
6635
6687
  return a + (b.width || b.actualWidth);
6636
- }, 0); // const outerSize = outerEl.getBoundingClientRect()
6688
+ }, 0);
6689
+ this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
6637
6690
 
6638
6691
  if (this.sizes.totalWidth < this.sizes.outer.width) {
6639
6692
  var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length;
@@ -6657,6 +6710,21 @@ var WebsyTable3 = /*#__PURE__*/function () {
6657
6710
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6658
6711
 
6659
6712
  });
6713
+ } // check that we have enough from for all of the pinned columns plus 1 non pinned column
6714
+
6715
+
6716
+ if (this.sizes.pinnedWidth > this.sizes.outer.width - firstNonPinnedColumnWidth) {
6717
+ this.sizes.totalWidth = 0;
6718
+ var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth); // let colDiff = diff / this.pinnedColumns
6719
+
6720
+ for (var i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
6721
+ if (i < this.pinnedColumns) {
6722
+ var colDiff = this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth * diff;
6723
+ this.options.columns[this.options.columns.length - 1][i].actualWidth -= colDiff;
6724
+ }
6725
+
6726
+ this.sizes.totalWidth += this.options.columns[this.options.columns.length - 1][i].width || this.options.columns[this.options.columns.length - 1][i].actualWidth;
6727
+ }
6660
6728
  } // take the height of the last cell as the official height for data cells
6661
6729
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
6662
6730
 
@@ -6688,8 +6756,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6688
6756
 
6689
6757
  this.options.allColumns = this.options.columns.map(function (c) {
6690
6758
  return c;
6691
- });
6692
- console.log('sizes', this.sizes);
6759
+ }); // console.log('sizes', this.sizes)
6760
+
6693
6761
  return this.sizes;
6694
6762
  }
6695
6763
  }, {
@@ -6728,8 +6796,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6728
6796
  var rowIndex = +event.target.getAttribute('data-row-index');
6729
6797
 
6730
6798
  if (event.target.classList.contains('websy-table-search-icon')) {
6731
- console.log('clicked on search icon');
6732
-
6799
+ // console.log('clicked on search icon')
6733
6800
  if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
6734
6801
  this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex]);
6735
6802
  }
@@ -6758,9 +6825,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6758
6825
  this.scrollDirection = 'y';
6759
6826
  var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6760
6827
  this.handleYStart = scrollHandleEl.offsetTop;
6761
- this.mouseYStart = event.pageY;
6762
- console.log('mouse down', this.handleYStart, this.mouseYStart);
6763
- console.log(scrollHandleEl.offsetTop);
6828
+ this.mouseYStart = event.pageY; // console.log('mouse down', this.handleYStart, this.mouseYStart)
6829
+ // console.log(scrollHandleEl.offsetTop)
6764
6830
  } else if (event.target.classList.contains('websy-scroll-handle-x')) {
6765
6831
  this.scrollDragging = true;
6766
6832
  this.scrollDirection = 'x';
@@ -6799,8 +6865,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6799
6865
  }, {
6800
6866
  key: "handleScrollWheel",
6801
6867
  value: function handleScrollWheel(event) {
6802
- event.preventDefault();
6803
- console.log('scrollwheel', event);
6868
+ event.preventDefault(); // console.log('scrollwheel', event)
6804
6869
 
6805
6870
  if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
6806
6871
  this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
@@ -6850,9 +6915,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6850
6915
  if (calcSizes === true) {
6851
6916
  var sample = this.createSample(data);
6852
6917
  this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
6853
- }
6918
+ } // console.log(this.options.columns)
6919
+
6854
6920
 
6855
- console.log(this.options.columns);
6856
6921
  var tableInnerEl = document.getElementById("".concat(this.elementId, "_tableInner"));
6857
6922
 
6858
6923
  if (tableInnerEl) {
@@ -6985,8 +7050,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6985
7050
  handlePos = scrollHandleEl.offsetLeft + diff;
6986
7051
  }
6987
7052
 
6988
- var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width;
6989
- console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width);
7053
+ var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width; // console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
7054
+
6990
7055
  scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
6991
7056
 
6992
7057
  if (this.options.onScroll) {
@@ -6996,8 +7061,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6996
7061
  this.endCol = 0;
6997
7062
 
6998
7063
  for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
6999
- cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
7000
- console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
7064
+ 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)
7001
7065
 
7002
7066
  if (actualLeft < cumulativeWidth) {
7003
7067
  this.startCol = i;
@@ -7019,12 +7083,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
7019
7083
  this.endCol += 1;
7020
7084
  }
7021
7085
 
7022
- if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.totalWidth) {
7086
+ if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
7023
7087
  this.startCol += 1;
7024
7088
  }
7025
7089
 
7026
7090
  this.endCol = Math.max(this.startCol, this.endCol);
7027
- this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
7091
+ this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
7028
7092
  }
7029
7093
  }
7030
7094
  }, {
@@ -7055,12 +7119,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
7055
7119
  if (typeof this.handleYStart !== 'undefined' && this.handleYStart !== null) {
7056
7120
  handlePos = this.handleYStart + diff;
7057
7121
  } else {
7058
- console.log('appending not resetting');
7122
+ // console.log('appending not resetting')
7059
7123
  handlePos = scrollHandleEl.offsetTop + diff;
7060
7124
  }
7061
7125
 
7062
- var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height;
7063
- console.log('dragging y', diff, scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height);
7126
+ var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height; // console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
7127
+
7064
7128
  scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
7065
7129
 
7066
7130
  if (this.options.onScroll) {
@@ -7071,7 +7135,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7071
7135
  this.startRow += 1;
7072
7136
  }
7073
7137
 
7074
- this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
7138
+ this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
7075
7139
  }
7076
7140
  }
7077
7141
  }, {
@@ -7126,6 +7190,7 @@ var WebsyChart = /*#__PURE__*/function () {
7126
7190
  curveStyle: 'curveLinear',
7127
7191
  lineWidth: 2,
7128
7192
  forceZero: true,
7193
+ grouping: 'grouped',
7129
7194
  fontSize: 14,
7130
7195
  symbolSize: 20,
7131
7196
  showTrackingLine: true,
@@ -7140,6 +7205,7 @@ var WebsyChart = /*#__PURE__*/function () {
7140
7205
  this.rightAxis = null;
7141
7206
  this.topAxis = null;
7142
7207
  this.bottomAxis = null;
7208
+ this.renderedKeys = {};
7143
7209
 
7144
7210
  if (!elementId) {
7145
7211
  console.log('No element Id provided for Websy Chart');
@@ -7411,9 +7477,18 @@ var WebsyChart = /*#__PURE__*/function () {
7411
7477
  };
7412
7478
 
7413
7479
  if (xPoint > this.plotWidth / 2) {
7414
- posOptions.left = xPoint - this.options.tooltipWidth - 15;
7480
+ posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
7481
+
7482
+ if (this.options.data[xData].scale !== 'Time') {
7483
+ // posOptions.left -= (this[xAxis].bandwidth())
7484
+ posOptions.left += 10;
7485
+ }
7415
7486
  } else {
7416
7487
  posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
7488
+
7489
+ if (this.options.data[xData].scale !== 'Time') {
7490
+ posOptions.left += this[xAxis].bandwidth() / 2;
7491
+ }
7417
7492
  }
7418
7493
 
7419
7494
  posOptions.top = this.options.margin.top + this.options.margin.axisTop;
@@ -7566,9 +7641,11 @@ var WebsyChart = /*#__PURE__*/function () {
7566
7641
 
7567
7642
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
7568
7643
  this.legendArea.style('width', '100%');
7644
+ this.legend.options.align = 'center';
7569
7645
  }
7570
7646
 
7571
7647
  if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
7648
+ this.legend.options.align = 'left';
7572
7649
  this.legendArea.style('height', '100%');
7573
7650
  this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(function (d) {
7574
7651
  return d.value;
@@ -7607,6 +7684,7 @@ var WebsyChart = /*#__PURE__*/function () {
7607
7684
  this.longestLeft = 0;
7608
7685
  this.longestRight = 0;
7609
7686
  this.longestBottom = 0;
7687
+ var firstBottom = '';
7610
7688
 
7611
7689
  if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
7612
7690
  // this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
@@ -7620,8 +7698,17 @@ var WebsyChart = /*#__PURE__*/function () {
7620
7698
 
7621
7699
  if (this.options.data.bottom.formatter) {
7622
7700
  this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString();
7701
+ firstBottom = this.longestBottom;
7623
7702
  } else {
7624
- this.longestBottom = '01/01/2000';
7703
+ if (this.options.data.bottom.scale === 'Time') {
7704
+ this.longestBottom = '01/01/2000';
7705
+ firstBottom = '01/01/2000';
7706
+ } else {
7707
+ this.longestBottom = this.options.data.bottom.data.reduce(function (a, b) {
7708
+ return a.length > b.value.length ? a : b.value;
7709
+ }, '');
7710
+ firstBottom = this.options.data.bottom.data[0].value;
7711
+ }
7625
7712
  }
7626
7713
  }
7627
7714
 
@@ -7670,7 +7757,23 @@ var WebsyChart = /*#__PURE__*/function () {
7670
7757
  var longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
7671
7758
  var longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
7672
7759
  var longestBottomBounds = WebsyUtils.measureText(this.longestBottom, this.options.data.bottom && this.options.data.bottom.rotate || 0, this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize);
7673
- this.options.margin.axisLeft = longestLeftBounds.width;
7760
+ var firstBottomWidth = 0;
7761
+
7762
+ if (this.options.orientation === 'vertical') {
7763
+ firstBottomWidth = WebsyUtils.measureText(firstBottom, this.options.data.bottom && this.options.data.bottom.rotate || 0, this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize).width;
7764
+
7765
+ if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) !== 90) {
7766
+ firstBottomWidth = firstBottomWidth / 2;
7767
+ } else if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) === 90) {
7768
+ firstBottomWidth = 0;
7769
+ }
7770
+
7771
+ if (this.options.data.bottom.scale !== 'Time') {
7772
+ firstBottom = Math.max(0, firstBottomWidth);
7773
+ }
7774
+ }
7775
+
7776
+ this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth);
7674
7777
  this.options.margin.axisRight = longestRightBounds.width;
7675
7778
  this.options.margin.axisBottom = longestBottomBounds.height + 10;
7676
7779
  this.options.margin.axisTop = 0; // adjust axis margins based on title options
@@ -7854,7 +7957,7 @@ var WebsyChart = /*#__PURE__*/function () {
7854
7957
 
7855
7958
  if (this.options.data.left.titlePosition === 1) {
7856
7959
  // put the title vertically on the left
7857
- var t = this.leftAxisLabel.append('text').attr('class', 'title').attr('x', 1 - this.plotHeight / 2).attr('y', 5).attr('font-size', this.options.data.left.titleFontSize || 10).attr('fill', this.options.data.left.titleColor || '#888888').attr('text-anchor', 'middle').style('transform', 'rotate(-90deg)').text(this.options.data.left.title || '');
7960
+ var t = this.leftAxisLabel.append('text').attr('class', 'title').attr('x', 1 - this.plotHeight / 2).attr('y', (this.options.data.left.titleFontSize || 10) / 2 + 2).attr('font-size', this.options.data.left.titleFontSize || 10).attr('fill', this.options.data.left.titleColor || '#888888').attr('text-anchor', 'middle').style('transform', 'rotate(-90deg)').text(this.options.data.left.title || '');
7858
7961
 
7859
7962
  if (rightDomain.length > 0) {
7860
7963
  // we have 2 axis so we can treat the title like a legend
@@ -7900,9 +8003,22 @@ var WebsyChart = /*#__PURE__*/function () {
7900
8003
  }
7901
8004
  } else {// put the title horizontally on the top
7902
8005
  }
8006
+ } // Remove the unnecessary series
8007
+
8008
+
8009
+ var newKeys = this.options.data.series.map(function (s) {
8010
+ return s.key;
8011
+ });
8012
+
8013
+ for (var key in this.renderedKeys) {
8014
+ if (newKeys.indexOf(key) === -1) {
8015
+ // remove the components
8016
+ this["remove".concat(this.renderedKeys[key])](key);
8017
+ }
7903
8018
  } // Draw the series data
7904
8019
 
7905
8020
 
8021
+ this.renderedKeys = {};
7906
8022
  this.options.data.series.forEach(function (series, index) {
7907
8023
  if (!series.key) {
7908
8024
  series.key = _this43.createIdentity();
@@ -7915,6 +8031,8 @@ var WebsyChart = /*#__PURE__*/function () {
7915
8031
  _this43["render".concat(series.type || 'bar')](series, index);
7916
8032
 
7917
8033
  _this43.renderLabels(series, index);
8034
+
8035
+ _this43.renderedKeys[series.key] = series.type;
7918
8036
  });
7919
8037
  }
7920
8038
  }
@@ -7968,36 +8086,39 @@ var WebsyChart = /*#__PURE__*/function () {
7968
8086
  key: "renderbar",
7969
8087
  value: function renderbar(series, index) {
7970
8088
  /* global series index d3 */
7971
- var xAxis = 'bottomAxis';
7972
- var yAxis = 'leftAxis';
8089
+ var xAxis = 'bottom';
8090
+ var yAxis = 'left';
7973
8091
  var bars = this.barLayer.selectAll(".bar_".concat(series.key)).data(series.data);
7974
8092
  var acummulativeY = new Array(this.options.data.series.length).fill(0);
7975
8093
 
7976
8094
  if (this.options.orientation === 'horizontal') {
7977
- xAxis = 'leftAxis';
7978
- yAxis = 'bottomAxis';
8095
+ xAxis = 'left';
8096
+ yAxis = 'bottom';
7979
8097
  }
7980
8098
 
7981
- var barWidth = this[xAxis].bandwidth();
7982
-
7983
- if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
7984
- barWidth = barWidth / this.options.data.series.length - 4;
7985
- }
8099
+ var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8100
+ var groupedBarWidth = (barWidth - 10) / this.options.data.series.length; // if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
8101
+ // barWidth = barWidth / this.options.data.series.length - 4
8102
+ // }
7986
8103
 
7987
8104
  function getBarHeight(d, i) {
7988
8105
  if (this.options.orientation === 'horizontal') {
7989
8106
  return barWidth;
7990
8107
  } else {
7991
- return this[yAxis](d.y.value);
8108
+ return this["".concat(yAxis, "Axis")](d.y.value);
7992
8109
  }
7993
8110
  }
7994
8111
 
7995
8112
  function getBarWidth(d, i) {
7996
8113
  if (this.options.orientation === 'horizontal') {
7997
- var width = this[yAxis](d.y.value);
8114
+ var width = this["".concat(yAxis, "Axis")](d.y.value);
7998
8115
  acummulativeY[d.y.index] += width;
7999
8116
  return width;
8000
8117
  } else {
8118
+ if (this.options.grouping === 'grouped') {
8119
+ return groupedBarWidth;
8120
+ }
8121
+
8001
8122
  return barWidth;
8002
8123
  }
8003
8124
  }
@@ -8005,15 +8126,19 @@ var WebsyChart = /*#__PURE__*/function () {
8005
8126
  function getBarX(d, i) {
8006
8127
  if (this.options.orientation === 'horizontal') {
8007
8128
  if (this.options.grouping === 'stacked') {
8008
- return this[yAxis](d.y.accumulative);
8129
+ return this["".concat(yAxis, "Axis")](d.y.accumulative);
8009
8130
  } else {
8010
8131
  return 0;
8011
8132
  }
8012
8133
  } else {
8013
- if (this.options.grouping !== 'grouped') {
8014
- return this[xAxis](this.parseX(d.x.value));
8134
+ var adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
8135
+
8136
+ if (this.options.grouping === 'grouped') {
8137
+ var barAdjustment = groupedBarWidth * index + 5; // + (index > 0 ? 4 : 0)
8138
+
8139
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8015
8140
  } else {
8016
- return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
8141
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + i * barWidth + adjustment;
8017
8142
  }
8018
8143
  }
8019
8144
  }
@@ -8021,15 +8146,15 @@ var WebsyChart = /*#__PURE__*/function () {
8021
8146
  function getBarY(d, i) {
8022
8147
  if (this.options.orientation === 'horizontal') {
8023
8148
  if (this.options.grouping !== 'grouped') {
8024
- return this[xAxis](this.parseX(d.x.value));
8149
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
8025
8150
  } else {
8026
- return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
8151
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
8027
8152
  }
8028
8153
  } else {
8029
8154
  if (this.options.grouping === 'stacked') {
8030
- return this[yAxis](d.y.accumulative);
8155
+ return this["".concat(yAxis, "Axis")](d.y.accumulative);
8031
8156
  } else {
8032
- return 0;
8157
+ return this.plotHeight - getBarHeight.call(this, d, i);
8033
8158
  }
8034
8159
  }
8035
8160
  }
@@ -8162,18 +8287,19 @@ var WebsyChart = /*#__PURE__*/function () {
8162
8287
  /* global series index d3 */
8163
8288
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
8164
8289
  return d3.line().x(function (d) {
8165
- return _this46[xAxis](_this46.parseX(d.x.value));
8290
+ var adjustment = _this46.options.data[xAxis].scale === 'Time' ? 0 : _this46["".concat(xAxis, "Axis")].bandwidth() / 2;
8291
+ return _this46["".concat(xAxis, "Axis")](_this46.parseX(d.x.value)) + adjustment;
8166
8292
  }).y(function (d) {
8167
- return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
8293
+ return _this46["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8168
8294
  }).curve(d3[curveStyle || _this46.options.curveStyle]);
8169
8295
  };
8170
8296
 
8171
- var xAxis = 'bottomAxis';
8172
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8297
+ var xAxis = 'bottom';
8298
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8173
8299
 
8174
8300
  if (this.options.orienation === 'horizontal') {
8175
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8176
- yAxis = 'bottomAxis';
8301
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
8302
+ yAxis = 'bottom';
8177
8303
  }
8178
8304
 
8179
8305
  var lines = this.lineLayer.selectAll(".line_".concat(series.key)).data([series.data]); // Exit
@@ -8200,6 +8326,12 @@ var WebsyChart = /*#__PURE__*/function () {
8200
8326
  this.rendersymbol(series, index);
8201
8327
  }
8202
8328
  }
8329
+ }, {
8330
+ key: "removeline",
8331
+ value: function removeline(key) {
8332
+ /* global key d3 */
8333
+ var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
8334
+ }
8203
8335
  }, {
8204
8336
  key: "rendersymbol",
8205
8337
  value: function rendersymbol(series, index) {