@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
|
@@ -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
|
});
|
|
@@ -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);
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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,
|
|
@@ -6999,9 +7053,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6999
7053
|
};
|
|
7000
7054
|
|
|
7001
7055
|
if (xPoint > this.plotWidth / 2) {
|
|
7002
|
-
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
|
+
}
|
|
7003
7062
|
} else {
|
|
7004
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
|
+
}
|
|
7005
7068
|
}
|
|
7006
7069
|
|
|
7007
7070
|
posOptions.top = this.options.margin.top + this.options.margin.axisTop;
|
|
@@ -7154,9 +7217,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7154
7217
|
|
|
7155
7218
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
7156
7219
|
this.legendArea.style('width', '100%');
|
|
7220
|
+
this.legend.options.align = 'center';
|
|
7157
7221
|
}
|
|
7158
7222
|
|
|
7159
7223
|
if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
|
|
7224
|
+
this.legend.options.align = 'left';
|
|
7160
7225
|
this.legendArea.style('height', '100%');
|
|
7161
7226
|
this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(function (d) {
|
|
7162
7227
|
return d.value;
|
|
@@ -7195,6 +7260,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7195
7260
|
this.longestLeft = 0;
|
|
7196
7261
|
this.longestRight = 0;
|
|
7197
7262
|
this.longestBottom = 0;
|
|
7263
|
+
var firstBottom = '';
|
|
7198
7264
|
|
|
7199
7265
|
if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
|
|
7200
7266
|
// this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
@@ -7208,8 +7274,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7208
7274
|
|
|
7209
7275
|
if (this.options.data.bottom.formatter) {
|
|
7210
7276
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString();
|
|
7277
|
+
firstBottom = this.longestBottom;
|
|
7211
7278
|
} else {
|
|
7212
|
-
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
|
+
}
|
|
7213
7288
|
}
|
|
7214
7289
|
}
|
|
7215
7290
|
|
|
@@ -7258,7 +7333,23 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7258
7333
|
var longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
|
|
7259
7334
|
var longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
|
|
7260
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);
|
|
7261
|
-
|
|
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);
|
|
7262
7353
|
this.options.margin.axisRight = longestRightBounds.width;
|
|
7263
7354
|
this.options.margin.axisBottom = longestBottomBounds.height + 10;
|
|
7264
7355
|
this.options.margin.axisTop = 0; // adjust axis margins based on title options
|
|
@@ -7442,7 +7533,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7442
7533
|
|
|
7443
7534
|
if (this.options.data.left.titlePosition === 1) {
|
|
7444
7535
|
// 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',
|
|
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 || '');
|
|
7446
7537
|
|
|
7447
7538
|
if (rightDomain.length > 0) {
|
|
7448
7539
|
// we have 2 axis so we can treat the title like a legend
|
|
@@ -7556,36 +7647,39 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7556
7647
|
key: "renderbar",
|
|
7557
7648
|
value: function renderbar(series, index) {
|
|
7558
7649
|
/* global series index d3 */
|
|
7559
|
-
var xAxis = '
|
|
7560
|
-
var yAxis = '
|
|
7650
|
+
var xAxis = 'bottom';
|
|
7651
|
+
var yAxis = 'left';
|
|
7561
7652
|
var bars = this.barLayer.selectAll(".bar_".concat(series.key)).data(series.data);
|
|
7562
7653
|
var acummulativeY = new Array(this.options.data.series.length).fill(0);
|
|
7563
7654
|
|
|
7564
7655
|
if (this.options.orientation === 'horizontal') {
|
|
7565
|
-
xAxis = '
|
|
7566
|
-
yAxis = '
|
|
7656
|
+
xAxis = 'left';
|
|
7657
|
+
yAxis = 'bottom';
|
|
7567
7658
|
}
|
|
7568
7659
|
|
|
7569
|
-
var barWidth = this[xAxis].bandwidth();
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
}
|
|
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
|
+
// }
|
|
7574
7664
|
|
|
7575
7665
|
function getBarHeight(d, i) {
|
|
7576
7666
|
if (this.options.orientation === 'horizontal') {
|
|
7577
7667
|
return barWidth;
|
|
7578
7668
|
} else {
|
|
7579
|
-
return this[yAxis](d.y.value);
|
|
7669
|
+
return this["".concat(yAxis, "Axis")](d.y.value);
|
|
7580
7670
|
}
|
|
7581
7671
|
}
|
|
7582
7672
|
|
|
7583
7673
|
function getBarWidth(d, i) {
|
|
7584
7674
|
if (this.options.orientation === 'horizontal') {
|
|
7585
|
-
var width = this[yAxis](d.y.value);
|
|
7675
|
+
var width = this["".concat(yAxis, "Axis")](d.y.value);
|
|
7586
7676
|
acummulativeY[d.y.index] += width;
|
|
7587
7677
|
return width;
|
|
7588
7678
|
} else {
|
|
7679
|
+
if (this.options.grouping === 'grouped') {
|
|
7680
|
+
return groupedBarWidth;
|
|
7681
|
+
}
|
|
7682
|
+
|
|
7589
7683
|
return barWidth;
|
|
7590
7684
|
}
|
|
7591
7685
|
}
|
|
@@ -7593,15 +7687,19 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7593
7687
|
function getBarX(d, i) {
|
|
7594
7688
|
if (this.options.orientation === 'horizontal') {
|
|
7595
7689
|
if (this.options.grouping === 'stacked') {
|
|
7596
|
-
return this[yAxis](d.y.accumulative);
|
|
7690
|
+
return this["".concat(yAxis, "Axis")](d.y.accumulative);
|
|
7597
7691
|
} else {
|
|
7598
7692
|
return 0;
|
|
7599
7693
|
}
|
|
7600
7694
|
} else {
|
|
7601
|
-
|
|
7602
|
-
|
|
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;
|
|
7603
7701
|
} else {
|
|
7604
|
-
return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
|
|
7702
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + i * barWidth + adjustment;
|
|
7605
7703
|
}
|
|
7606
7704
|
}
|
|
7607
7705
|
}
|
|
@@ -7609,15 +7707,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7609
7707
|
function getBarY(d, i) {
|
|
7610
7708
|
if (this.options.orientation === 'horizontal') {
|
|
7611
7709
|
if (this.options.grouping !== 'grouped') {
|
|
7612
|
-
return this[xAxis](this.parseX(d.x.value));
|
|
7710
|
+
return this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
|
|
7613
7711
|
} else {
|
|
7614
|
-
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;
|
|
7615
7713
|
}
|
|
7616
7714
|
} else {
|
|
7617
7715
|
if (this.options.grouping === 'stacked') {
|
|
7618
|
-
return this[yAxis](d.y.accumulative);
|
|
7716
|
+
return this["".concat(yAxis, "Axis")](d.y.accumulative);
|
|
7619
7717
|
} else {
|
|
7620
|
-
return
|
|
7718
|
+
return this.plotHeight - getBarHeight.call(this, d, i);
|
|
7621
7719
|
}
|
|
7622
7720
|
}
|
|
7623
7721
|
}
|
|
@@ -7750,18 +7848,19 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7750
7848
|
/* global series index d3 */
|
|
7751
7849
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7752
7850
|
return d3.line().x(function (d) {
|
|
7753
|
-
|
|
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;
|
|
7754
7853
|
}).y(function (d) {
|
|
7755
|
-
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);
|
|
7756
7855
|
}).curve(d3[curveStyle || _this43.options.curveStyle]);
|
|
7757
7856
|
};
|
|
7758
7857
|
|
|
7759
|
-
var xAxis = '
|
|
7760
|
-
var yAxis = series.axis === 'secondary' ? '
|
|
7858
|
+
var xAxis = 'bottom';
|
|
7859
|
+
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
7761
7860
|
|
|
7762
7861
|
if (this.options.orienation === 'horizontal') {
|
|
7763
|
-
xAxis = series.axis === 'secondary' ? '
|
|
7764
|
-
yAxis = '
|
|
7862
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
7863
|
+
yAxis = 'bottom';
|
|
7765
7864
|
}
|
|
7766
7865
|
|
|
7767
7866
|
var lines = this.lineLayer.selectAll(".line_".concat(series.key)).data([series.data]); // Exit
|