@websy/websy-designs 1.3.11 → 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 +181 -79
- package/dist/websy-designs-es6.js +171 -73
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +190 -79
- package/dist/websy-designs.js +182 -73
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
4072
|
-
this.
|
|
4073
|
-
|
|
4074
|
-
|
|
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
|
-
|
|
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[
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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 += "
|
|
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 "
|
|
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
|
});
|
|
@@ -6222,10 +6263,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6222
6263
|
}).reduce(function (a, b) {
|
|
6223
6264
|
return a + (b.width || b.actualWidth);
|
|
6224
6265
|
}, 0);
|
|
6225
|
-
|
|
6266
|
+
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
|
|
6226
6267
|
|
|
6227
|
-
if (this.sizes.totalWidth <
|
|
6228
|
-
var equalWidth = (
|
|
6268
|
+
if (this.sizes.totalWidth < this.sizes.outer.width) {
|
|
6269
|
+
var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length;
|
|
6229
6270
|
this.sizes.totalWidth = 0;
|
|
6230
6271
|
this.sizes.totalNonPinnedWidth = 0;
|
|
6231
6272
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
@@ -6246,6 +6287,21 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6246
6287
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6247
6288
|
|
|
6248
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
|
+
}
|
|
6249
6305
|
} // take the height of the last cell as the official height for data cells
|
|
6250
6306
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
6251
6307
|
|
|
@@ -6277,8 +6333,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6277
6333
|
|
|
6278
6334
|
this.options.allColumns = this.options.columns.map(function (c) {
|
|
6279
6335
|
return c;
|
|
6280
|
-
});
|
|
6281
|
-
|
|
6336
|
+
}); // console.log('sizes', this.sizes)
|
|
6337
|
+
|
|
6282
6338
|
return this.sizes;
|
|
6283
6339
|
}
|
|
6284
6340
|
}, {
|
|
@@ -6317,8 +6373,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6317
6373
|
var rowIndex = +event.target.getAttribute('data-row-index');
|
|
6318
6374
|
|
|
6319
6375
|
if (event.target.classList.contains('websy-table-search-icon')) {
|
|
6320
|
-
console.log('clicked on search icon')
|
|
6321
|
-
|
|
6376
|
+
// console.log('clicked on search icon')
|
|
6322
6377
|
if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
|
|
6323
6378
|
this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex]);
|
|
6324
6379
|
}
|
|
@@ -6347,9 +6402,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6347
6402
|
this.scrollDirection = 'y';
|
|
6348
6403
|
var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6349
6404
|
this.handleYStart = scrollHandleEl.offsetTop;
|
|
6350
|
-
this.mouseYStart = event.pageY;
|
|
6351
|
-
console.log(
|
|
6352
|
-
console.log(scrollHandleEl.offsetTop);
|
|
6405
|
+
this.mouseYStart = event.pageY; // console.log('mouse down', this.handleYStart, this.mouseYStart)
|
|
6406
|
+
// console.log(scrollHandleEl.offsetTop)
|
|
6353
6407
|
} else if (event.target.classList.contains('websy-scroll-handle-x')) {
|
|
6354
6408
|
this.scrollDragging = true;
|
|
6355
6409
|
this.scrollDirection = 'x';
|
|
@@ -6388,8 +6442,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6388
6442
|
}, {
|
|
6389
6443
|
key: "handleScrollWheel",
|
|
6390
6444
|
value: function handleScrollWheel(event) {
|
|
6391
|
-
event.preventDefault();
|
|
6392
|
-
console.log('scrollwheel', event);
|
|
6445
|
+
event.preventDefault(); // console.log('scrollwheel', event)
|
|
6393
6446
|
|
|
6394
6447
|
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
6395
6448
|
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
@@ -6439,9 +6492,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6439
6492
|
if (calcSizes === true) {
|
|
6440
6493
|
var sample = this.createSample(data);
|
|
6441
6494
|
this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
|
|
6442
|
-
}
|
|
6495
|
+
} // console.log(this.options.columns)
|
|
6496
|
+
|
|
6443
6497
|
|
|
6444
|
-
console.log(this.options.columns);
|
|
6445
6498
|
var tableInnerEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6446
6499
|
|
|
6447
6500
|
if (tableInnerEl) {
|
|
@@ -6574,8 +6627,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6574
6627
|
handlePos = scrollHandleEl.offsetLeft + diff;
|
|
6575
6628
|
}
|
|
6576
6629
|
|
|
6577
|
-
var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width;
|
|
6578
|
-
|
|
6630
|
+
var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width; // console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
|
|
6631
|
+
|
|
6579
6632
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6580
6633
|
|
|
6581
6634
|
if (this.options.onScroll) {
|
|
@@ -6585,8 +6638,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6585
6638
|
this.endCol = 0;
|
|
6586
6639
|
|
|
6587
6640
|
for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6588
|
-
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
|
|
6589
|
-
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)
|
|
6590
6642
|
|
|
6591
6643
|
if (actualLeft < cumulativeWidth) {
|
|
6592
6644
|
this.startCol = i;
|
|
@@ -6608,12 +6660,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6608
6660
|
this.endCol += 1;
|
|
6609
6661
|
}
|
|
6610
6662
|
|
|
6611
|
-
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.
|
|
6663
|
+
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
6612
6664
|
this.startCol += 1;
|
|
6613
6665
|
}
|
|
6614
6666
|
|
|
6615
6667
|
this.endCol = Math.max(this.startCol, this.endCol);
|
|
6616
|
-
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);
|
|
6617
6669
|
}
|
|
6618
6670
|
}
|
|
6619
6671
|
}, {
|
|
@@ -6644,12 +6696,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6644
6696
|
if (typeof this.handleYStart !== 'undefined' && this.handleYStart !== null) {
|
|
6645
6697
|
handlePos = this.handleYStart + diff;
|
|
6646
6698
|
} else {
|
|
6647
|
-
console.log('appending not resetting')
|
|
6699
|
+
// console.log('appending not resetting')
|
|
6648
6700
|
handlePos = scrollHandleEl.offsetTop + diff;
|
|
6649
6701
|
}
|
|
6650
6702
|
|
|
6651
|
-
var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height;
|
|
6652
|
-
|
|
6703
|
+
var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height; // console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
|
|
6704
|
+
|
|
6653
6705
|
scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
|
|
6654
6706
|
|
|
6655
6707
|
if (this.options.onScroll) {
|
|
@@ -6660,7 +6712,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6660
6712
|
this.startRow += 1;
|
|
6661
6713
|
}
|
|
6662
6714
|
|
|
6663
|
-
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);
|
|
6664
6716
|
}
|
|
6665
6717
|
}
|
|
6666
6718
|
}, {
|
|
@@ -6715,6 +6767,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6715
6767
|
curveStyle: 'curveLinear',
|
|
6716
6768
|
lineWidth: 2,
|
|
6717
6769
|
forceZero: true,
|
|
6770
|
+
grouping: 'grouped',
|
|
6718
6771
|
fontSize: 14,
|
|
6719
6772
|
symbolSize: 20,
|
|
6720
6773
|
showTrackingLine: true,
|
|
@@ -7000,9 +7053,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7000
7053
|
};
|
|
7001
7054
|
|
|
7002
7055
|
if (xPoint > this.plotWidth / 2) {
|
|
7003
|
-
posOptions.left = xPoint - this.options.tooltipWidth
|
|
7056
|
+
posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
|
|
7057
|
+
|
|
7058
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
7059
|
+
// posOptions.left -= (this[xAxis].bandwidth())
|
|
7060
|
+
posOptions.left += 10;
|
|
7061
|
+
}
|
|
7004
7062
|
} else {
|
|
7005
7063
|
posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
|
|
7064
|
+
|
|
7065
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
7066
|
+
posOptions.left += this[xAxis].bandwidth() / 2;
|
|
7067
|
+
}
|
|
7006
7068
|
}
|
|
7007
7069
|
|
|
7008
7070
|
posOptions.top = this.options.margin.top + this.options.margin.axisTop;
|
|
@@ -7155,9 +7217,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7155
7217
|
|
|
7156
7218
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
7157
7219
|
this.legendArea.style('width', '100%');
|
|
7220
|
+
this.legend.options.align = 'center';
|
|
7158
7221
|
}
|
|
7159
7222
|
|
|
7160
7223
|
if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
|
|
7224
|
+
this.legend.options.align = 'left';
|
|
7161
7225
|
this.legendArea.style('height', '100%');
|
|
7162
7226
|
this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(function (d) {
|
|
7163
7227
|
return d.value;
|
|
@@ -7196,6 +7260,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7196
7260
|
this.longestLeft = 0;
|
|
7197
7261
|
this.longestRight = 0;
|
|
7198
7262
|
this.longestBottom = 0;
|
|
7263
|
+
var firstBottom = '';
|
|
7199
7264
|
|
|
7200
7265
|
if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
|
|
7201
7266
|
// this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
@@ -7209,8 +7274,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7209
7274
|
|
|
7210
7275
|
if (this.options.data.bottom.formatter) {
|
|
7211
7276
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString();
|
|
7277
|
+
firstBottom = this.longestBottom;
|
|
7212
7278
|
} else {
|
|
7213
|
-
this.
|
|
7279
|
+
if (this.options.data.bottom.scale === 'Time') {
|
|
7280
|
+
this.longestBottom = '01/01/2000';
|
|
7281
|
+
firstBottom = '01/01/2000';
|
|
7282
|
+
} else {
|
|
7283
|
+
this.longestBottom = this.options.data.bottom.data.reduce(function (a, b) {
|
|
7284
|
+
return a.length > b.value.length ? a : b.value;
|
|
7285
|
+
}, '');
|
|
7286
|
+
firstBottom = this.options.data.bottom.data[0].value;
|
|
7287
|
+
}
|
|
7214
7288
|
}
|
|
7215
7289
|
}
|
|
7216
7290
|
|
|
@@ -7259,7 +7333,23 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7259
7333
|
var longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
|
|
7260
7334
|
var longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
|
|
7261
7335
|
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);
|
|
7262
|
-
|
|
7336
|
+
var firstBottomWidth = 0;
|
|
7337
|
+
|
|
7338
|
+
if (this.options.orientation === 'vertical') {
|
|
7339
|
+
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;
|
|
7340
|
+
|
|
7341
|
+
if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) !== 90) {
|
|
7342
|
+
firstBottomWidth = firstBottomWidth / 2;
|
|
7343
|
+
} else if (Math.abs(this.options.data.bottom && this.options.data.bottom.rotate || 0) === 90) {
|
|
7344
|
+
firstBottomWidth = 0;
|
|
7345
|
+
}
|
|
7346
|
+
|
|
7347
|
+
if (this.options.data.bottom.scale !== 'Time') {
|
|
7348
|
+
firstBottom = Math.max(0, firstBottomWidth);
|
|
7349
|
+
}
|
|
7350
|
+
}
|
|
7351
|
+
|
|
7352
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth);
|
|
7263
7353
|
this.options.margin.axisRight = longestRightBounds.width;
|
|
7264
7354
|
this.options.margin.axisBottom = longestBottomBounds.height + 10;
|
|
7265
7355
|
this.options.margin.axisTop = 0; // adjust axis margins based on title options
|
|
@@ -7443,7 +7533,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7443
7533
|
|
|
7444
7534
|
if (this.options.data.left.titlePosition === 1) {
|
|
7445
7535
|
// put the title vertically on the left
|
|
7446
|
-
var t = this.leftAxisLabel.append('text').attr('class', 'title').attr('x', 1 - this.plotHeight / 2).attr('y',
|
|
7536
|
+
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 || '');
|
|
7447
7537
|
|
|
7448
7538
|
if (rightDomain.length > 0) {
|
|
7449
7539
|
// we have 2 axis so we can treat the title like a legend
|
|
@@ -7557,36 +7647,39 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7557
7647
|
key: "renderbar",
|
|
7558
7648
|
value: function renderbar(series, index) {
|
|
7559
7649
|
/* global series index d3 */
|
|
7560
|
-
var xAxis = '
|
|
7561
|
-
var yAxis = '
|
|
7650
|
+
var xAxis = 'bottom';
|
|
7651
|
+
var yAxis = 'left';
|
|
7562
7652
|
var bars = this.barLayer.selectAll(".bar_".concat(series.key)).data(series.data);
|
|
7563
7653
|
var acummulativeY = new Array(this.options.data.series.length).fill(0);
|
|
7564
7654
|
|
|
7565
7655
|
if (this.options.orientation === 'horizontal') {
|
|
7566
|
-
xAxis = '
|
|
7567
|
-
yAxis = '
|
|
7656
|
+
xAxis = 'left';
|
|
7657
|
+
yAxis = 'bottom';
|
|
7568
7658
|
}
|
|
7569
7659
|
|
|
7570
|
-
var barWidth = this[xAxis].bandwidth();
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
}
|
|
7660
|
+
var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
|
|
7661
|
+
var groupedBarWidth = (barWidth - 10) / this.options.data.series.length; // if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
7662
|
+
// barWidth = barWidth / this.options.data.series.length - 4
|
|
7663
|
+
// }
|
|
7575
7664
|
|
|
7576
7665
|
function getBarHeight(d, i) {
|
|
7577
7666
|
if (this.options.orientation === 'horizontal') {
|
|
7578
7667
|
return barWidth;
|
|
7579
7668
|
} else {
|
|
7580
|
-
return this[yAxis](d.y.value);
|
|
7669
|
+
return this["".concat(yAxis, "Axis")](d.y.value);
|
|
7581
7670
|
}
|
|
7582
7671
|
}
|
|
7583
7672
|
|
|
7584
7673
|
function getBarWidth(d, i) {
|
|
7585
7674
|
if (this.options.orientation === 'horizontal') {
|
|
7586
|
-
var width = this[yAxis](d.y.value);
|
|
7675
|
+
var width = this["".concat(yAxis, "Axis")](d.y.value);
|
|
7587
7676
|
acummulativeY[d.y.index] += width;
|
|
7588
7677
|
return width;
|
|
7589
7678
|
} else {
|
|
7679
|
+
if (this.options.grouping === 'grouped') {
|
|
7680
|
+
return groupedBarWidth;
|
|
7681
|
+
}
|
|
7682
|
+
|
|
7590
7683
|
return barWidth;
|
|
7591
7684
|
}
|
|
7592
7685
|
}
|
|
@@ -7594,15 +7687,19 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7594
7687
|
function getBarX(d, i) {
|
|
7595
7688
|
if (this.options.orientation === 'horizontal') {
|
|
7596
7689
|
if (this.options.grouping === 'stacked') {
|
|
7597
|
-
return this[yAxis](d.y.accumulative);
|
|
7690
|
+
return this["".concat(yAxis, "Axis")](d.y.accumulative);
|
|
7598
7691
|
} else {
|
|
7599
7692
|
return 0;
|
|
7600
7693
|
}
|
|
7601
7694
|
} else {
|
|
7602
|
-
|
|
7603
|
-
|
|
7695
|
+
var adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
7696
|
+
|
|
7697
|
+
if (this.options.grouping === 'grouped') {
|
|
7698
|
+
var barAdjustment = groupedBarWidth * index + 5; // + (index > 0 ? 4 : 0)
|
|
7699
|
+
|
|
7700
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
|
|
7604
7701
|
} else {
|
|
7605
|
-
return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
|
|
7702
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + i * barWidth + adjustment;
|
|
7606
7703
|
}
|
|
7607
7704
|
}
|
|
7608
7705
|
}
|
|
@@ -7610,15 +7707,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7610
7707
|
function getBarY(d, i) {
|
|
7611
7708
|
if (this.options.orientation === 'horizontal') {
|
|
7612
7709
|
if (this.options.grouping !== 'grouped') {
|
|
7613
|
-
return this[xAxis](this.parseX(d.x.value));
|
|
7710
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
|
|
7614
7711
|
} else {
|
|
7615
|
-
return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
|
|
7712
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
|
|
7616
7713
|
}
|
|
7617
7714
|
} else {
|
|
7618
7715
|
if (this.options.grouping === 'stacked') {
|
|
7619
|
-
return this[yAxis](d.y.accumulative);
|
|
7716
|
+
return this["".concat(yAxis, "Axis")](d.y.accumulative);
|
|
7620
7717
|
} else {
|
|
7621
|
-
return
|
|
7718
|
+
return this.plotHeight - getBarHeight.call(this, d, i);
|
|
7622
7719
|
}
|
|
7623
7720
|
}
|
|
7624
7721
|
}
|
|
@@ -7751,18 +7848,19 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7751
7848
|
/* global series index d3 */
|
|
7752
7849
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7753
7850
|
return d3.line().x(function (d) {
|
|
7754
|
-
|
|
7851
|
+
var adjustment = _this43.options.data[xAxis].scale === 'Time' ? 0 : _this43["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
7852
|
+
return _this43["".concat(xAxis, "Axis")](_this43.parseX(d.x.value)) + adjustment;
|
|
7755
7853
|
}).y(function (d) {
|
|
7756
|
-
return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7854
|
+
return _this43["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7757
7855
|
}).curve(d3[curveStyle || _this43.options.curveStyle]);
|
|
7758
7856
|
};
|
|
7759
7857
|
|
|
7760
|
-
var xAxis = '
|
|
7761
|
-
var yAxis = series.axis === 'secondary' ? '
|
|
7858
|
+
var xAxis = 'bottom';
|
|
7859
|
+
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
7762
7860
|
|
|
7763
7861
|
if (this.options.orienation === 'horizontal') {
|
|
7764
|
-
xAxis = series.axis === 'secondary' ? '
|
|
7765
|
-
yAxis = '
|
|
7862
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
7863
|
+
yAxis = 'bottom';
|
|
7766
7864
|
}
|
|
7767
7865
|
|
|
7768
7866
|
var lines = this.lineLayer.selectAll(".line_".concat(series.key)).data([series.data]); // Exit
|