@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.
@@ -2402,7 +2402,9 @@ var WebsyIcons = {
2402
2402
  '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 ",
2403
2403
  '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 ",
2404
2404
  '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 ",
2405
- '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 "
2405
+ '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 ",
2406
+ '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 ",
2407
+ '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 "
2406
2408
  };
2407
2409
 
2408
2410
  var WebsyLoadingDialog = /*#__PURE__*/function () {
@@ -3939,7 +3941,10 @@ var WebsyRouter = /*#__PURE__*/function () {
3939
3941
 
3940
3942
  for (var i = 0; i < parts.length; i++) {
3941
3943
  var bits = parts[i].split('=');
3942
- output.items[bits[0]] = bits[1];
3944
+
3945
+ if (bits[0] && bits[0] !== '' && bits[1] && bits[1] !== '') {
3946
+ output.items[bits[0]] = bits[1];
3947
+ }
3943
3948
  }
3944
3949
 
3945
3950
  this.currentParams = output;
@@ -4062,17 +4067,32 @@ var WebsyRouter = /*#__PURE__*/function () {
4062
4067
  }, {
4063
4068
  key: "hideView",
4064
4069
  value: function hideView(view, group) {
4070
+ if (view === '/' || view === '') {
4071
+ view = this.options.defaultView;
4072
+ }
4073
+
4065
4074
  this.hideChildren(view, group);
4066
4075
 
4067
- if (this.previousView !== this.currentView) {
4076
+ if (this.previousView !== this.currentView || group !== this.options.defaultGroup) {
4068
4077
  this.hideTriggerItems(view, group);
4069
4078
  this.hideViewItems(view, group);
4070
4079
  this.publish('hide', [view]);
4071
- } else if (group !== this.options.defaultGroup) {
4072
- this.hideTriggerItems(view, group);
4073
- this.hideViewItems(view, group);
4074
- this.publish('hide', [view]);
4075
- }
4080
+
4081
+ if (this.options.views && this.options.views[view]) {
4082
+ this.options.views[view].components.forEach(function (c) {
4083
+ if (typeof c.instance !== 'undefined') {
4084
+ if (c.instance.close) {
4085
+ c.instance.close();
4086
+ }
4087
+ }
4088
+ });
4089
+ }
4090
+ } // else if (group !== this.options.defaultGroup) {
4091
+ // this.hideTriggerItems(view, group)
4092
+ // this.hideViewItems(view, group)
4093
+ // this.publish('hide', [view])
4094
+ // }
4095
+
4076
4096
  } // registerElements (root) {
4077
4097
  // if (root.nodeName === '#document') {
4078
4098
  // this.groups = {}
@@ -6021,18 +6041,22 @@ var WebsyTable3 = /*#__PURE__*/function () {
6021
6041
  data.forEach(function (row, rowIndex) {
6022
6042
  bodyHtml += "<tr class=\"websy-table-row\">";
6023
6043
  row.forEach(function (cell, cellIndex) {
6024
- if (typeof sizingColumns[cellIndex] === 'undefined') {
6044
+ var sizeIndex = cell.level || cellIndex;
6045
+
6046
+ if (typeof sizingColumns[sizeIndex] === 'undefined') {
6025
6047
  return; // need to revisit this logic
6026
6048
  }
6027
6049
 
6028
- var style = '';
6050
+ var style = "width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important; ");
6051
+ var divStyle = style;
6029
6052
 
6030
6053
  if (cell.style) {
6031
6054
  style += cell.style;
6032
6055
  }
6033
6056
 
6034
6057
  if (useWidths === true) {
6035
- style += "max-width: ".concat(sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth, "px!important;");
6058
+ style += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
6059
+ divStyle += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
6036
6060
  }
6037
6061
 
6038
6062
  if (cell.backgroundColor) {
@@ -6045,9 +6069,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6045
6069
 
6046
6070
  if (cell.color) {
6047
6071
  style += "color: ".concat(cell.color, "; ");
6048
- }
6072
+ } // console.log('rowspan', cell.rowspan)
6073
+
6049
6074
 
6050
- console.log('rowspan', cell.rowspan);
6051
6075
  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) {
6052
6076
  // bodyHtml += `
6053
6077
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6055,17 +6079,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
6055
6079
  // `
6056
6080
  // }
6057
6081
 
6058
- bodyHtml += "\n >";
6082
+ bodyHtml += "\n ><div style='".concat(divStyle, "'>");
6059
6083
 
6060
6084
  if (cell.expandable === true) {
6061
- 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>");
6085
+ 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>");
6062
6086
  }
6063
6087
 
6064
6088
  if (cell.collapsable === true) {
6065
- 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>");
6089
+ 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>");
6066
6090
  }
6067
6091
 
6068
- bodyHtml += "\n ".concat(cell.value, "\n </td>");
6092
+ bodyHtml += "\n ".concat(cell.value, "\n </div></td>");
6069
6093
  });
6070
6094
  bodyHtml += "</tr>";
6071
6095
  }); // bodyHtml += `</div>`
@@ -6097,14 +6121,26 @@ var WebsyTable3 = /*#__PURE__*/function () {
6097
6121
 
6098
6122
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
6099
6123
  row.forEach(function (col, colIndex) {
6100
- 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) {
6124
+ var style = "width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important; ");
6125
+ var divStyle = style;
6126
+
6127
+ if (useWidths === true) {
6128
+ style += "max-width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important;");
6129
+ divStyle += "max-width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important;");
6130
+ }
6131
+
6132
+ if (col.style) {
6133
+ style += col.style;
6134
+ }
6135
+
6136
+ 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) {
6101
6137
  // headerHtml += `
6102
6138
  // style='width: ${col.width || col.actualWidth}px'
6103
6139
  // width='${col.width || col.actualWidth}'
6104
6140
  // `
6105
6141
  // }
6106
6142
 
6107
- headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this35.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6143
+ headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this35.buildSearchIcon(col, colIndex) : '', "</div></td>");
6108
6144
  });
6109
6145
  headerHtml += "</tr>";
6110
6146
  });
@@ -6126,7 +6162,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6126
6162
  }, {
6127
6163
  key: "buildSearchIcon",
6128
6164
  value: function buildSearchIcon(col, index) {
6129
- 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 ");
6165
+ 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>");
6130
6166
  }
6131
6167
  }, {
6132
6168
  key: "buildTotalHtml",
@@ -6194,6 +6230,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6194
6230
  var rows = Array.from(tableEl.querySelectorAll('.websy-table-row'));
6195
6231
  var totalWidth = 0;
6196
6232
  this.sizes.scrollableWidth = this.sizes.outer.width;
6233
+ var firstNonPinnedColumnWidth = 0;
6197
6234
  rows.forEach(function (row, rowIndex) {
6198
6235
  Array.from(row.children).forEach(function (col, colIndex) {
6199
6236
  var colSize = col.getBoundingClientRect();
@@ -6206,6 +6243,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6206
6243
 
6207
6244
  _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
6208
6245
  _this37.options.columns[_this37.options.columns.length - 1][colIndex].cellHeight = colSize.height;
6246
+
6247
+ if (colIndex >= _this37.pinnedColumns) {
6248
+ firstNonPinnedColumnWidth = _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth;
6249
+ }
6209
6250
  }
6210
6251
  });
6211
6252
  });
@@ -6221,7 +6262,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6221
6262
  return i >= _this37.pinnedColumns;
6222
6263
  }).reduce(function (a, b) {
6223
6264
  return a + (b.width || b.actualWidth);
6224
- }, 0); // const outerSize = outerEl.getBoundingClientRect()
6265
+ }, 0);
6266
+ this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
6225
6267
 
6226
6268
  if (this.sizes.totalWidth < this.sizes.outer.width) {
6227
6269
  var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length;
@@ -6245,6 +6287,21 @@ var WebsyTable3 = /*#__PURE__*/function () {
6245
6287
  } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6246
6288
 
6247
6289
  });
6290
+ } // check that we have enough from for all of the pinned columns plus 1 non pinned column
6291
+
6292
+
6293
+ if (this.sizes.pinnedWidth > this.sizes.outer.width - firstNonPinnedColumnWidth) {
6294
+ this.sizes.totalWidth = 0;
6295
+ var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth); // let colDiff = diff / this.pinnedColumns
6296
+
6297
+ for (var i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
6298
+ if (i < this.pinnedColumns) {
6299
+ var colDiff = this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth * diff;
6300
+ this.options.columns[this.options.columns.length - 1][i].actualWidth -= colDiff;
6301
+ }
6302
+
6303
+ this.sizes.totalWidth += this.options.columns[this.options.columns.length - 1][i].width || this.options.columns[this.options.columns.length - 1][i].actualWidth;
6304
+ }
6248
6305
  } // take the height of the last cell as the official height for data cells
6249
6306
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
6250
6307
 
@@ -6276,8 +6333,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6276
6333
 
6277
6334
  this.options.allColumns = this.options.columns.map(function (c) {
6278
6335
  return c;
6279
- });
6280
- console.log('sizes', this.sizes);
6336
+ }); // console.log('sizes', this.sizes)
6337
+
6281
6338
  return this.sizes;
6282
6339
  }
6283
6340
  }, {
@@ -6316,8 +6373,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6316
6373
  var rowIndex = +event.target.getAttribute('data-row-index');
6317
6374
 
6318
6375
  if (event.target.classList.contains('websy-table-search-icon')) {
6319
- console.log('clicked on search icon');
6320
-
6376
+ // console.log('clicked on search icon')
6321
6377
  if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
6322
6378
  this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex]);
6323
6379
  }
@@ -6346,9 +6402,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6346
6402
  this.scrollDirection = 'y';
6347
6403
  var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6348
6404
  this.handleYStart = scrollHandleEl.offsetTop;
6349
- this.mouseYStart = event.pageY;
6350
- console.log('mouse down', this.handleYStart, this.mouseYStart);
6351
- console.log(scrollHandleEl.offsetTop);
6405
+ this.mouseYStart = event.pageY; // console.log('mouse down', this.handleYStart, this.mouseYStart)
6406
+ // console.log(scrollHandleEl.offsetTop)
6352
6407
  } else if (event.target.classList.contains('websy-scroll-handle-x')) {
6353
6408
  this.scrollDragging = true;
6354
6409
  this.scrollDirection = 'x';
@@ -6387,8 +6442,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6387
6442
  }, {
6388
6443
  key: "handleScrollWheel",
6389
6444
  value: function handleScrollWheel(event) {
6390
- event.preventDefault();
6391
- console.log('scrollwheel', event);
6445
+ event.preventDefault(); // console.log('scrollwheel', event)
6392
6446
 
6393
6447
  if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
6394
6448
  this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
@@ -6438,9 +6492,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6438
6492
  if (calcSizes === true) {
6439
6493
  var sample = this.createSample(data);
6440
6494
  this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
6441
- }
6495
+ } // console.log(this.options.columns)
6496
+
6442
6497
 
6443
- console.log(this.options.columns);
6444
6498
  var tableInnerEl = document.getElementById("".concat(this.elementId, "_tableInner"));
6445
6499
 
6446
6500
  if (tableInnerEl) {
@@ -6573,8 +6627,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6573
6627
  handlePos = scrollHandleEl.offsetLeft + diff;
6574
6628
  }
6575
6629
 
6576
- var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width;
6577
- console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width);
6630
+ var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width; // console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
6631
+
6578
6632
  scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
6579
6633
 
6580
6634
  if (this.options.onScroll) {
@@ -6584,8 +6638,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6584
6638
  this.endCol = 0;
6585
6639
 
6586
6640
  for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
6587
- cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
6588
- console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
6641
+ 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)
6589
6642
 
6590
6643
  if (actualLeft < cumulativeWidth) {
6591
6644
  this.startCol = i;
@@ -6607,12 +6660,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
6607
6660
  this.endCol += 1;
6608
6661
  }
6609
6662
 
6610
- if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.totalWidth) {
6663
+ if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
6611
6664
  this.startCol += 1;
6612
6665
  }
6613
6666
 
6614
6667
  this.endCol = Math.max(this.startCol, this.endCol);
6615
- this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
6668
+ this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
6616
6669
  }
6617
6670
  }
6618
6671
  }, {
@@ -6643,12 +6696,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
6643
6696
  if (typeof this.handleYStart !== 'undefined' && this.handleYStart !== null) {
6644
6697
  handlePos = this.handleYStart + diff;
6645
6698
  } else {
6646
- console.log('appending not resetting');
6699
+ // console.log('appending not resetting')
6647
6700
  handlePos = scrollHandleEl.offsetTop + diff;
6648
6701
  }
6649
6702
 
6650
- var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height;
6651
- console.log('dragging y', diff, scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height);
6703
+ var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height; // console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
6704
+
6652
6705
  scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
6653
6706
 
6654
6707
  if (this.options.onScroll) {
@@ -6659,7 +6712,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6659
6712
  this.startRow += 1;
6660
6713
  }
6661
6714
 
6662
- this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
6715
+ this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
6663
6716
  }
6664
6717
  }
6665
6718
  }, {
@@ -6714,6 +6767,7 @@ var WebsyChart = /*#__PURE__*/function () {
6714
6767
  curveStyle: 'curveLinear',
6715
6768
  lineWidth: 2,
6716
6769
  forceZero: true,
6770
+ grouping: 'grouped',
6717
6771
  fontSize: 14,
6718
6772
  symbolSize: 20,
6719
6773
  showTrackingLine: true,
@@ -6728,6 +6782,7 @@ var WebsyChart = /*#__PURE__*/function () {
6728
6782
  this.rightAxis = null;
6729
6783
  this.topAxis = null;
6730
6784
  this.bottomAxis = null;
6785
+ this.renderedKeys = {};
6731
6786
 
6732
6787
  if (!elementId) {
6733
6788
  console.log('No element Id provided for Websy Chart');
@@ -6999,9 +7054,18 @@ var WebsyChart = /*#__PURE__*/function () {
6999
7054
  };
7000
7055
 
7001
7056
  if (xPoint > this.plotWidth / 2) {
7002
- posOptions.left = xPoint - this.options.tooltipWidth - 15;
7057
+ posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
7058
+
7059
+ if (this.options.data[xData].scale !== 'Time') {
7060
+ // posOptions.left -= (this[xAxis].bandwidth())
7061
+ posOptions.left += 10;
7062
+ }
7003
7063
  } else {
7004
7064
  posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
7065
+
7066
+ if (this.options.data[xData].scale !== 'Time') {
7067
+ posOptions.left += this[xAxis].bandwidth() / 2;
7068
+ }
7005
7069
  }
7006
7070
 
7007
7071
  posOptions.top = this.options.margin.top + this.options.margin.axisTop;
@@ -7154,9 +7218,11 @@ var WebsyChart = /*#__PURE__*/function () {
7154
7218
 
7155
7219
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
7156
7220
  this.legendArea.style('width', '100%');
7221
+ this.legend.options.align = 'center';
7157
7222
  }
7158
7223
 
7159
7224
  if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
7225
+ this.legend.options.align = 'left';
7160
7226
  this.legendArea.style('height', '100%');
7161
7227
  this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(function (d) {
7162
7228
  return d.value;
@@ -7195,6 +7261,7 @@ var WebsyChart = /*#__PURE__*/function () {
7195
7261
  this.longestLeft = 0;
7196
7262
  this.longestRight = 0;
7197
7263
  this.longestBottom = 0;
7264
+ var firstBottom = '';
7198
7265
 
7199
7266
  if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
7200
7267
  // this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
@@ -7208,8 +7275,17 @@ var WebsyChart = /*#__PURE__*/function () {
7208
7275
 
7209
7276
  if (this.options.data.bottom.formatter) {
7210
7277
  this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString();
7278
+ firstBottom = this.longestBottom;
7211
7279
  } else {
7212
- this.longestBottom = '01/01/2000';
7280
+ if (this.options.data.bottom.scale === 'Time') {
7281
+ this.longestBottom = '01/01/2000';
7282
+ firstBottom = '01/01/2000';
7283
+ } else {
7284
+ this.longestBottom = this.options.data.bottom.data.reduce(function (a, b) {
7285
+ return a.length > b.value.length ? a : b.value;
7286
+ }, '');
7287
+ firstBottom = this.options.data.bottom.data[0].value;
7288
+ }
7213
7289
  }
7214
7290
  }
7215
7291
 
@@ -7258,7 +7334,23 @@ var WebsyChart = /*#__PURE__*/function () {
7258
7334
  var longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
7259
7335
  var longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
7260
7336
  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);
7261
- this.options.margin.axisLeft = longestLeftBounds.width;
7337
+ var firstBottomWidth = 0;
7338
+
7339
+ if (this.options.orientation === 'vertical') {
7340
+ 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;
7341
+
7342
+ if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) !== 90) {
7343
+ firstBottomWidth = firstBottomWidth / 2;
7344
+ } else if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) === 90) {
7345
+ firstBottomWidth = 0;
7346
+ }
7347
+
7348
+ if (this.options.data.bottom.scale !== 'Time') {
7349
+ firstBottom = Math.max(0, firstBottomWidth);
7350
+ }
7351
+ }
7352
+
7353
+ this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth);
7262
7354
  this.options.margin.axisRight = longestRightBounds.width;
7263
7355
  this.options.margin.axisBottom = longestBottomBounds.height + 10;
7264
7356
  this.options.margin.axisTop = 0; // adjust axis margins based on title options
@@ -7442,7 +7534,7 @@ var WebsyChart = /*#__PURE__*/function () {
7442
7534
 
7443
7535
  if (this.options.data.left.titlePosition === 1) {
7444
7536
  // put the title vertically on the left
7445
- 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 || '');
7537
+ 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 || '');
7446
7538
 
7447
7539
  if (rightDomain.length > 0) {
7448
7540
  // we have 2 axis so we can treat the title like a legend
@@ -7488,9 +7580,22 @@ var WebsyChart = /*#__PURE__*/function () {
7488
7580
  }
7489
7581
  } else {// put the title horizontally on the top
7490
7582
  }
7583
+ } // Remove the unnecessary series
7584
+
7585
+
7586
+ var newKeys = this.options.data.series.map(function (s) {
7587
+ return s.key;
7588
+ });
7589
+
7590
+ for (var key in this.renderedKeys) {
7591
+ if (newKeys.indexOf(key) === -1) {
7592
+ // remove the components
7593
+ this["remove".concat(this.renderedKeys[key])](key);
7594
+ }
7491
7595
  } // Draw the series data
7492
7596
 
7493
7597
 
7598
+ this.renderedKeys = {};
7494
7599
  this.options.data.series.forEach(function (series, index) {
7495
7600
  if (!series.key) {
7496
7601
  series.key = _this40.createIdentity();
@@ -7503,6 +7608,8 @@ var WebsyChart = /*#__PURE__*/function () {
7503
7608
  _this40["render".concat(series.type || 'bar')](series, index);
7504
7609
 
7505
7610
  _this40.renderLabels(series, index);
7611
+
7612
+ _this40.renderedKeys[series.key] = series.type;
7506
7613
  });
7507
7614
  }
7508
7615
  }
@@ -7556,36 +7663,39 @@ var WebsyChart = /*#__PURE__*/function () {
7556
7663
  key: "renderbar",
7557
7664
  value: function renderbar(series, index) {
7558
7665
  /* global series index d3 */
7559
- var xAxis = 'bottomAxis';
7560
- var yAxis = 'leftAxis';
7666
+ var xAxis = 'bottom';
7667
+ var yAxis = 'left';
7561
7668
  var bars = this.barLayer.selectAll(".bar_".concat(series.key)).data(series.data);
7562
7669
  var acummulativeY = new Array(this.options.data.series.length).fill(0);
7563
7670
 
7564
7671
  if (this.options.orientation === 'horizontal') {
7565
- xAxis = 'leftAxis';
7566
- yAxis = 'bottomAxis';
7672
+ xAxis = 'left';
7673
+ yAxis = 'bottom';
7567
7674
  }
7568
7675
 
7569
- var barWidth = this[xAxis].bandwidth();
7570
-
7571
- if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
7572
- barWidth = barWidth / this.options.data.series.length - 4;
7573
- }
7676
+ var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
7677
+ var groupedBarWidth = (barWidth - 10) / this.options.data.series.length; // if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
7678
+ // barWidth = barWidth / this.options.data.series.length - 4
7679
+ // }
7574
7680
 
7575
7681
  function getBarHeight(d, i) {
7576
7682
  if (this.options.orientation === 'horizontal') {
7577
7683
  return barWidth;
7578
7684
  } else {
7579
- return this[yAxis](d.y.value);
7685
+ return this["".concat(yAxis, "Axis")](d.y.value);
7580
7686
  }
7581
7687
  }
7582
7688
 
7583
7689
  function getBarWidth(d, i) {
7584
7690
  if (this.options.orientation === 'horizontal') {
7585
- var width = this[yAxis](d.y.value);
7691
+ var width = this["".concat(yAxis, "Axis")](d.y.value);
7586
7692
  acummulativeY[d.y.index] += width;
7587
7693
  return width;
7588
7694
  } else {
7695
+ if (this.options.grouping === 'grouped') {
7696
+ return groupedBarWidth;
7697
+ }
7698
+
7589
7699
  return barWidth;
7590
7700
  }
7591
7701
  }
@@ -7593,15 +7703,19 @@ var WebsyChart = /*#__PURE__*/function () {
7593
7703
  function getBarX(d, i) {
7594
7704
  if (this.options.orientation === 'horizontal') {
7595
7705
  if (this.options.grouping === 'stacked') {
7596
- return this[yAxis](d.y.accumulative);
7706
+ return this["".concat(yAxis, "Axis")](d.y.accumulative);
7597
7707
  } else {
7598
7708
  return 0;
7599
7709
  }
7600
7710
  } else {
7601
- if (this.options.grouping !== 'grouped') {
7602
- return this[xAxis](this.parseX(d.x.value));
7711
+ var adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
7712
+
7713
+ if (this.options.grouping === 'grouped') {
7714
+ var barAdjustment = groupedBarWidth * index + 5; // + (index > 0 ? 4 : 0)
7715
+
7716
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
7603
7717
  } else {
7604
- return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
7718
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + i * barWidth + adjustment;
7605
7719
  }
7606
7720
  }
7607
7721
  }
@@ -7609,15 +7723,15 @@ var WebsyChart = /*#__PURE__*/function () {
7609
7723
  function getBarY(d, i) {
7610
7724
  if (this.options.orientation === 'horizontal') {
7611
7725
  if (this.options.grouping !== 'grouped') {
7612
- return this[xAxis](this.parseX(d.x.value));
7726
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
7613
7727
  } else {
7614
- return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
7728
+ return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
7615
7729
  }
7616
7730
  } else {
7617
7731
  if (this.options.grouping === 'stacked') {
7618
- return this[yAxis](d.y.accumulative);
7732
+ return this["".concat(yAxis, "Axis")](d.y.accumulative);
7619
7733
  } else {
7620
- return 0;
7734
+ return this.plotHeight - getBarHeight.call(this, d, i);
7621
7735
  }
7622
7736
  }
7623
7737
  }
@@ -7750,18 +7864,19 @@ var WebsyChart = /*#__PURE__*/function () {
7750
7864
  /* global series index d3 */
7751
7865
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
7752
7866
  return d3.line().x(function (d) {
7753
- return _this43[xAxis](_this43.parseX(d.x.value));
7867
+ var adjustment = _this43.options.data[xAxis].scale === 'Time' ? 0 : _this43["".concat(xAxis, "Axis")].bandwidth() / 2;
7868
+ return _this43["".concat(xAxis, "Axis")](_this43.parseX(d.x.value)) + adjustment;
7754
7869
  }).y(function (d) {
7755
- return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7870
+ return _this43["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
7756
7871
  }).curve(d3[curveStyle || _this43.options.curveStyle]);
7757
7872
  };
7758
7873
 
7759
- var xAxis = 'bottomAxis';
7760
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
7874
+ var xAxis = 'bottom';
7875
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
7761
7876
 
7762
7877
  if (this.options.orienation === 'horizontal') {
7763
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
7764
- yAxis = 'bottomAxis';
7878
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
7879
+ yAxis = 'bottom';
7765
7880
  }
7766
7881
 
7767
7882
  var lines = this.lineLayer.selectAll(".line_".concat(series.key)).data([series.data]); // Exit
@@ -7788,6 +7903,12 @@ var WebsyChart = /*#__PURE__*/function () {
7788
7903
  this.rendersymbol(series, index);
7789
7904
  }
7790
7905
  }
7906
+ }, {
7907
+ key: "removeline",
7908
+ value: function removeline(key) {
7909
+ /* global key d3 */
7910
+ var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
7911
+ }
7791
7912
  }, {
7792
7913
  key: "rendersymbol",
7793
7914
  value: function rendersymbol(series, index) {