@websy/websy-designs 1.3.12 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/websy-designs-es6.debug.js +178 -76
- package/dist/websy-designs-es6.js +170 -71
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +187 -76
- package/dist/websy-designs.js +181 -71
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -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
|
-
|
|
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) {
|
|
4358
|
+
if (this.previousView !== this.currentView || group !== this.options.defaultGroup) {
|
|
4350
4359
|
this.hideTriggerItems(view, group);
|
|
4351
4360
|
this.hideViewItems(view, group);
|
|
4352
4361
|
this.publish('hide', [view]);
|
|
4353
|
-
|
|
4354
|
-
this.
|
|
4355
|
-
|
|
4356
|
-
|
|
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
|
-
|
|
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[
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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 += "
|
|
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 "
|
|
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);
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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,
|
|
@@ -7411,9 +7476,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7411
7476
|
};
|
|
7412
7477
|
|
|
7413
7478
|
if (xPoint > this.plotWidth / 2) {
|
|
7414
|
-
posOptions.left = xPoint - this.options.tooltipWidth
|
|
7479
|
+
posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
|
|
7480
|
+
|
|
7481
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
7482
|
+
// posOptions.left -= (this[xAxis].bandwidth())
|
|
7483
|
+
posOptions.left += 10;
|
|
7484
|
+
}
|
|
7415
7485
|
} else {
|
|
7416
7486
|
posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
|
|
7487
|
+
|
|
7488
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
7489
|
+
posOptions.left += this[xAxis].bandwidth() / 2;
|
|
7490
|
+
}
|
|
7417
7491
|
}
|
|
7418
7492
|
|
|
7419
7493
|
posOptions.top = this.options.margin.top + this.options.margin.axisTop;
|
|
@@ -7566,9 +7640,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7566
7640
|
|
|
7567
7641
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
7568
7642
|
this.legendArea.style('width', '100%');
|
|
7643
|
+
this.legend.options.align = 'center';
|
|
7569
7644
|
}
|
|
7570
7645
|
|
|
7571
7646
|
if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
|
|
7647
|
+
this.legend.options.align = 'left';
|
|
7572
7648
|
this.legendArea.style('height', '100%');
|
|
7573
7649
|
this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(function (d) {
|
|
7574
7650
|
return d.value;
|
|
@@ -7607,6 +7683,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7607
7683
|
this.longestLeft = 0;
|
|
7608
7684
|
this.longestRight = 0;
|
|
7609
7685
|
this.longestBottom = 0;
|
|
7686
|
+
var firstBottom = '';
|
|
7610
7687
|
|
|
7611
7688
|
if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
|
|
7612
7689
|
// this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
@@ -7620,8 +7697,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7620
7697
|
|
|
7621
7698
|
if (this.options.data.bottom.formatter) {
|
|
7622
7699
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString();
|
|
7700
|
+
firstBottom = this.longestBottom;
|
|
7623
7701
|
} else {
|
|
7624
|
-
this.
|
|
7702
|
+
if (this.options.data.bottom.scale === 'Time') {
|
|
7703
|
+
this.longestBottom = '01/01/2000';
|
|
7704
|
+
firstBottom = '01/01/2000';
|
|
7705
|
+
} else {
|
|
7706
|
+
this.longestBottom = this.options.data.bottom.data.reduce(function (a, b) {
|
|
7707
|
+
return a.length > b.value.length ? a : b.value;
|
|
7708
|
+
}, '');
|
|
7709
|
+
firstBottom = this.options.data.bottom.data[0].value;
|
|
7710
|
+
}
|
|
7625
7711
|
}
|
|
7626
7712
|
}
|
|
7627
7713
|
|
|
@@ -7670,7 +7756,23 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7670
7756
|
var longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
|
|
7671
7757
|
var longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
|
|
7672
7758
|
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
|
-
|
|
7759
|
+
var firstBottomWidth = 0;
|
|
7760
|
+
|
|
7761
|
+
if (this.options.orientation === 'vertical') {
|
|
7762
|
+
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;
|
|
7763
|
+
|
|
7764
|
+
if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) !== 90) {
|
|
7765
|
+
firstBottomWidth = firstBottomWidth / 2;
|
|
7766
|
+
} else if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) === 90) {
|
|
7767
|
+
firstBottomWidth = 0;
|
|
7768
|
+
}
|
|
7769
|
+
|
|
7770
|
+
if (this.options.data.bottom.scale !== 'Time') {
|
|
7771
|
+
firstBottom = Math.max(0, firstBottomWidth);
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
7774
|
+
|
|
7775
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth);
|
|
7674
7776
|
this.options.margin.axisRight = longestRightBounds.width;
|
|
7675
7777
|
this.options.margin.axisBottom = longestBottomBounds.height + 10;
|
|
7676
7778
|
this.options.margin.axisTop = 0; // adjust axis margins based on title options
|
|
@@ -7854,7 +7956,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7854
7956
|
|
|
7855
7957
|
if (this.options.data.left.titlePosition === 1) {
|
|
7856
7958
|
// 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',
|
|
7959
|
+
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
7960
|
|
|
7859
7961
|
if (rightDomain.length > 0) {
|
|
7860
7962
|
// we have 2 axis so we can treat the title like a legend
|
|
@@ -7968,36 +8070,39 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7968
8070
|
key: "renderbar",
|
|
7969
8071
|
value: function renderbar(series, index) {
|
|
7970
8072
|
/* global series index d3 */
|
|
7971
|
-
var xAxis = '
|
|
7972
|
-
var yAxis = '
|
|
8073
|
+
var xAxis = 'bottom';
|
|
8074
|
+
var yAxis = 'left';
|
|
7973
8075
|
var bars = this.barLayer.selectAll(".bar_".concat(series.key)).data(series.data);
|
|
7974
8076
|
var acummulativeY = new Array(this.options.data.series.length).fill(0);
|
|
7975
8077
|
|
|
7976
8078
|
if (this.options.orientation === 'horizontal') {
|
|
7977
|
-
xAxis = '
|
|
7978
|
-
yAxis = '
|
|
8079
|
+
xAxis = 'left';
|
|
8080
|
+
yAxis = 'bottom';
|
|
7979
8081
|
}
|
|
7980
8082
|
|
|
7981
|
-
var barWidth = this[xAxis].bandwidth();
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
}
|
|
8083
|
+
var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
|
|
8084
|
+
var groupedBarWidth = (barWidth - 10) / this.options.data.series.length; // if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
8085
|
+
// barWidth = barWidth / this.options.data.series.length - 4
|
|
8086
|
+
// }
|
|
7986
8087
|
|
|
7987
8088
|
function getBarHeight(d, i) {
|
|
7988
8089
|
if (this.options.orientation === 'horizontal') {
|
|
7989
8090
|
return barWidth;
|
|
7990
8091
|
} else {
|
|
7991
|
-
return this[yAxis](d.y.value);
|
|
8092
|
+
return this["".concat(yAxis, "Axis")](d.y.value);
|
|
7992
8093
|
}
|
|
7993
8094
|
}
|
|
7994
8095
|
|
|
7995
8096
|
function getBarWidth(d, i) {
|
|
7996
8097
|
if (this.options.orientation === 'horizontal') {
|
|
7997
|
-
var width = this[yAxis](d.y.value);
|
|
8098
|
+
var width = this["".concat(yAxis, "Axis")](d.y.value);
|
|
7998
8099
|
acummulativeY[d.y.index] += width;
|
|
7999
8100
|
return width;
|
|
8000
8101
|
} else {
|
|
8102
|
+
if (this.options.grouping === 'grouped') {
|
|
8103
|
+
return groupedBarWidth;
|
|
8104
|
+
}
|
|
8105
|
+
|
|
8001
8106
|
return barWidth;
|
|
8002
8107
|
}
|
|
8003
8108
|
}
|
|
@@ -8005,15 +8110,19 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8005
8110
|
function getBarX(d, i) {
|
|
8006
8111
|
if (this.options.orientation === 'horizontal') {
|
|
8007
8112
|
if (this.options.grouping === 'stacked') {
|
|
8008
|
-
return this[yAxis](d.y.accumulative);
|
|
8113
|
+
return this["".concat(yAxis, "Axis")](d.y.accumulative);
|
|
8009
8114
|
} else {
|
|
8010
8115
|
return 0;
|
|
8011
8116
|
}
|
|
8012
8117
|
} else {
|
|
8013
|
-
|
|
8014
|
-
|
|
8118
|
+
var adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8119
|
+
|
|
8120
|
+
if (this.options.grouping === 'grouped') {
|
|
8121
|
+
var barAdjustment = groupedBarWidth * index + 5; // + (index > 0 ? 4 : 0)
|
|
8122
|
+
|
|
8123
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
|
|
8015
8124
|
} else {
|
|
8016
|
-
return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
|
|
8125
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + i * barWidth + adjustment;
|
|
8017
8126
|
}
|
|
8018
8127
|
}
|
|
8019
8128
|
}
|
|
@@ -8021,15 +8130,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8021
8130
|
function getBarY(d, i) {
|
|
8022
8131
|
if (this.options.orientation === 'horizontal') {
|
|
8023
8132
|
if (this.options.grouping !== 'grouped') {
|
|
8024
|
-
return this[xAxis](this.parseX(d.x.value));
|
|
8133
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
|
|
8025
8134
|
} else {
|
|
8026
|
-
return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
|
|
8135
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
|
|
8027
8136
|
}
|
|
8028
8137
|
} else {
|
|
8029
8138
|
if (this.options.grouping === 'stacked') {
|
|
8030
|
-
return this[yAxis](d.y.accumulative);
|
|
8139
|
+
return this["".concat(yAxis, "Axis")](d.y.accumulative);
|
|
8031
8140
|
} else {
|
|
8032
|
-
return
|
|
8141
|
+
return this.plotHeight - getBarHeight.call(this, d, i);
|
|
8033
8142
|
}
|
|
8034
8143
|
}
|
|
8035
8144
|
}
|
|
@@ -8162,18 +8271,19 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8162
8271
|
/* global series index d3 */
|
|
8163
8272
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8164
8273
|
return d3.line().x(function (d) {
|
|
8165
|
-
|
|
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;
|
|
8166
8276
|
}).y(function (d) {
|
|
8167
|
-
return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8277
|
+
return _this46["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8168
8278
|
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
8169
8279
|
};
|
|
8170
8280
|
|
|
8171
|
-
var xAxis = '
|
|
8172
|
-
var yAxis = series.axis === 'secondary' ? '
|
|
8281
|
+
var xAxis = 'bottom';
|
|
8282
|
+
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8173
8283
|
|
|
8174
8284
|
if (this.options.orienation === 'horizontal') {
|
|
8175
|
-
xAxis = series.axis === 'secondary' ? '
|
|
8176
|
-
yAxis = '
|
|
8285
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8286
|
+
yAxis = 'bottom';
|
|
8177
8287
|
}
|
|
8178
8288
|
|
|
8179
8289
|
var lines = this.lineLayer.selectAll(".line_".concat(series.key)).data([series.data]); // Exit
|