@websy/websy-designs 1.4.8 → 1.4.10
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 +21 -16
- package/dist/websy-designs-es6.js +108 -99
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +21 -16
- package/dist/websy-designs.js +108 -99
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -456,7 +456,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
456
456
|
var _this2 = this;
|
|
457
457
|
|
|
458
458
|
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
459
|
-
console.trace();
|
|
460
459
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
461
460
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
462
461
|
var el = document.getElementById(this.elementId);
|
|
@@ -619,12 +618,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
619
618
|
var _this3 = this;
|
|
620
619
|
|
|
621
620
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
622
|
-
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
623
621
|
|
|
624
|
-
|
|
625
|
-
dateEls
|
|
626
|
-
|
|
627
|
-
dateEls
|
|
622
|
+
if (el) {
|
|
623
|
+
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
624
|
+
|
|
625
|
+
for (var i = 0; i < dateEls.length; i++) {
|
|
626
|
+
dateEls[i].classList.remove('selected');
|
|
627
|
+
dateEls[i].classList.remove('first');
|
|
628
|
+
dateEls[i].classList.remove('last');
|
|
629
|
+
}
|
|
628
630
|
}
|
|
629
631
|
|
|
630
632
|
if (this.selectedRange === 0) {
|
|
@@ -1292,13 +1294,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1292
1294
|
|
|
1293
1295
|
var el = document.getElementById(this.elementId);
|
|
1294
1296
|
var labelEl = document.getElementById("".concat(this.elementId, "_selectedRange"));
|
|
1295
|
-
var rangeEls = el.querySelectorAll(".websy-date-picker-range");
|
|
1296
1297
|
|
|
1297
|
-
|
|
1298
|
-
rangeEls
|
|
1298
|
+
if (el) {
|
|
1299
|
+
var rangeEls = el.querySelectorAll(".websy-date-picker-range");
|
|
1300
|
+
|
|
1301
|
+
for (var i = 0; i < rangeEls.length; i++) {
|
|
1302
|
+
rangeEls[i].classList.remove('active');
|
|
1299
1303
|
|
|
1300
|
-
|
|
1301
|
-
|
|
1304
|
+
if (i === this.selectedRange) {
|
|
1305
|
+
rangeEls[i].classList.add('active');
|
|
1306
|
+
}
|
|
1302
1307
|
}
|
|
1303
1308
|
}
|
|
1304
1309
|
|
|
@@ -6142,7 +6147,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6142
6147
|
minHandleSize: 20,
|
|
6143
6148
|
maxColWidth: '50%',
|
|
6144
6149
|
allowPivoting: false,
|
|
6145
|
-
searchIcon: "<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>"
|
|
6150
|
+
searchIcon: "<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>",
|
|
6151
|
+
plusIcon: WebsyDesigns.Icons.PlusFilled,
|
|
6152
|
+
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
6146
6153
|
};
|
|
6147
6154
|
this.options = _extends({}, DEFAULTS, options);
|
|
6148
6155
|
this.sizes = {};
|
|
@@ -6209,6 +6216,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6209
6216
|
}, {
|
|
6210
6217
|
key: "buildBodyHtml",
|
|
6211
6218
|
value: function buildBodyHtml() {
|
|
6219
|
+
var _this37 = this;
|
|
6220
|
+
|
|
6212
6221
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6213
6222
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6214
6223
|
|
|
@@ -6276,11 +6285,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6276
6285
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6277
6286
|
|
|
6278
6287
|
if (cell.expandable === true) {
|
|
6279
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6288
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this37.options.plusIcon, "</i>");
|
|
6280
6289
|
}
|
|
6281
6290
|
|
|
6282
6291
|
if (cell.collapsable === true) {
|
|
6283
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6292
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this37.options.minusIcon, "</i>");
|
|
6284
6293
|
}
|
|
6285
6294
|
|
|
6286
6295
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6305,7 +6314,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6305
6314
|
}, {
|
|
6306
6315
|
key: "buildHeaderHtml",
|
|
6307
6316
|
value: function buildHeaderHtml() {
|
|
6308
|
-
var
|
|
6317
|
+
var _this38 = this;
|
|
6309
6318
|
|
|
6310
6319
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6311
6320
|
var headerHtml = '';
|
|
@@ -6320,7 +6329,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6320
6329
|
}
|
|
6321
6330
|
|
|
6322
6331
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6323
|
-
if (useWidths === false && rowIndex !==
|
|
6332
|
+
if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
|
|
6324
6333
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6325
6334
|
return;
|
|
6326
6335
|
}
|
|
@@ -6346,18 +6355,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6346
6355
|
// `
|
|
6347
6356
|
// }
|
|
6348
6357
|
|
|
6349
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6358
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6350
6359
|
});
|
|
6351
6360
|
headerHtml += "</tr>";
|
|
6352
6361
|
});
|
|
6353
6362
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6354
6363
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6355
6364
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6356
|
-
var testEl = document.getElementById("".concat(
|
|
6365
|
+
var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6357
6366
|
|
|
6358
6367
|
if (!testEl) {
|
|
6359
6368
|
var newE = document.createElement('div');
|
|
6360
|
-
newE.id = "".concat(
|
|
6369
|
+
newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6361
6370
|
newE.className = 'websy-modal-dropdown';
|
|
6362
6371
|
dropdownEl.appendChild(newE);
|
|
6363
6372
|
}
|
|
@@ -6373,7 +6382,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6373
6382
|
}, {
|
|
6374
6383
|
key: "buildTotalHtml",
|
|
6375
6384
|
value: function buildTotalHtml() {
|
|
6376
|
-
var
|
|
6385
|
+
var _this39 = this;
|
|
6377
6386
|
|
|
6378
6387
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6379
6388
|
|
|
@@ -6386,7 +6395,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6386
6395
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6387
6396
|
|
|
6388
6397
|
if (useWidths === true) {
|
|
6389
|
-
totalHtml += "\n style='width: ".concat(
|
|
6398
|
+
totalHtml += "\n style='width: ".concat(_this39.options.columns[_this39.options.columns.length - 1][colIndex].width || _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6390
6399
|
}
|
|
6391
6400
|
|
|
6392
6401
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6397,7 +6406,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6397
6406
|
}, {
|
|
6398
6407
|
key: "calculateSizes",
|
|
6399
6408
|
value: function calculateSizes() {
|
|
6400
|
-
var
|
|
6409
|
+
var _this40 = this;
|
|
6401
6410
|
|
|
6402
6411
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6403
6412
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6440,32 +6449,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6440
6449
|
rows.forEach(function (row, rowIndex) {
|
|
6441
6450
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6442
6451
|
var colSize = col.getBoundingClientRect();
|
|
6443
|
-
|
|
6452
|
+
_this40.sizes.cellHeight = colSize.height;
|
|
6444
6453
|
|
|
6445
|
-
if (
|
|
6446
|
-
if (!
|
|
6447
|
-
|
|
6454
|
+
if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
|
|
6455
|
+
if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
|
|
6456
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6448
6457
|
}
|
|
6449
6458
|
|
|
6450
|
-
|
|
6451
|
-
|
|
6459
|
+
_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);
|
|
6460
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6452
6461
|
|
|
6453
|
-
if (colIndex >=
|
|
6454
|
-
firstNonPinnedColumnWidth =
|
|
6462
|
+
if (colIndex >= _this40.pinnedColumns) {
|
|
6463
|
+
firstNonPinnedColumnWidth = _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth;
|
|
6455
6464
|
}
|
|
6456
6465
|
}
|
|
6457
6466
|
});
|
|
6458
6467
|
});
|
|
6459
6468
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6460
|
-
if (colIndex <
|
|
6461
|
-
|
|
6469
|
+
if (colIndex < _this40.pinnedColumns) {
|
|
6470
|
+
_this40.sizes.scrollableWidth -= col.actualWidth;
|
|
6462
6471
|
}
|
|
6463
6472
|
});
|
|
6464
6473
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6465
6474
|
return a + (b.width || b.actualWidth);
|
|
6466
6475
|
}, 0);
|
|
6467
6476
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6468
|
-
return i >=
|
|
6477
|
+
return i >= _this40.pinnedColumns;
|
|
6469
6478
|
}).reduce(function (a, b) {
|
|
6470
6479
|
return a + (b.width || b.actualWidth);
|
|
6471
6480
|
}, 0);
|
|
@@ -6486,10 +6495,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6486
6495
|
c.actualWidth += equalWidth; // }
|
|
6487
6496
|
// }
|
|
6488
6497
|
|
|
6489
|
-
|
|
6498
|
+
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6490
6499
|
|
|
6491
|
-
if (i <
|
|
6492
|
-
|
|
6500
|
+
if (i < _this40.pinnedColumns) {
|
|
6501
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6493
6502
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6494
6503
|
|
|
6495
6504
|
});
|
|
@@ -6546,7 +6555,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6546
6555
|
}, {
|
|
6547
6556
|
key: "createSample",
|
|
6548
6557
|
value: function createSample(data) {
|
|
6549
|
-
var
|
|
6558
|
+
var _this41 = this;
|
|
6550
6559
|
|
|
6551
6560
|
var output = [];
|
|
6552
6561
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6558,7 +6567,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6558
6567
|
var longest = '';
|
|
6559
6568
|
|
|
6560
6569
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6561
|
-
if (data[i].length ===
|
|
6570
|
+
if (data[i].length === _this41.options.columns[_this41.options.columns.length - 1].length) {
|
|
6562
6571
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6563
6572
|
longest = data[i][colIndex].value;
|
|
6564
6573
|
}
|
|
@@ -6953,7 +6962,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6953
6962
|
|
|
6954
6963
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6955
6964
|
function WebsyChart(elementId, options) {
|
|
6956
|
-
var
|
|
6965
|
+
var _this42 = this;
|
|
6957
6966
|
|
|
6958
6967
|
_classCallCheck(this, WebsyChart);
|
|
6959
6968
|
|
|
@@ -7004,22 +7013,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7004
7013
|
this.invertOverride = function (input, input2) {
|
|
7005
7014
|
var xAxis = 'bottomAxis';
|
|
7006
7015
|
|
|
7007
|
-
if (
|
|
7016
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7008
7017
|
xAxis = 'leftAxis';
|
|
7009
7018
|
}
|
|
7010
7019
|
|
|
7011
|
-
var width =
|
|
7020
|
+
var width = _this42[xAxis].step();
|
|
7012
7021
|
|
|
7013
7022
|
var output;
|
|
7014
7023
|
|
|
7015
|
-
var domain = _toConsumableArray(
|
|
7024
|
+
var domain = _toConsumableArray(_this42[xAxis].domain());
|
|
7016
7025
|
|
|
7017
|
-
if (
|
|
7026
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7018
7027
|
domain = domain.reverse();
|
|
7019
7028
|
}
|
|
7020
7029
|
|
|
7021
7030
|
for (var j = 0; j < domain.length; j++) {
|
|
7022
|
-
var breakA =
|
|
7031
|
+
var breakA = _this42[xAxis](domain[j]) - width / 2;
|
|
7023
7032
|
var breakB = breakA + width;
|
|
7024
7033
|
|
|
7025
7034
|
if (input > breakA && input <= breakB) {
|
|
@@ -7119,10 +7128,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7119
7128
|
}, {
|
|
7120
7129
|
key: "handleEventMouseMove",
|
|
7121
7130
|
value: function handleEventMouseMove(event, d) {
|
|
7122
|
-
var
|
|
7131
|
+
var _this43 = this;
|
|
7123
7132
|
|
|
7124
7133
|
var bisectDate = d3.bisector(function (d) {
|
|
7125
|
-
return
|
|
7134
|
+
return _this43.parseX(d.x.value);
|
|
7126
7135
|
}).left;
|
|
7127
7136
|
|
|
7128
7137
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7161,8 +7170,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7161
7170
|
}
|
|
7162
7171
|
|
|
7163
7172
|
this.options.data.series.forEach(function (s) {
|
|
7164
|
-
if (
|
|
7165
|
-
xPoint =
|
|
7173
|
+
if (_this43.options.data[xData].scale !== 'Time') {
|
|
7174
|
+
xPoint = _this43[xAxis](_this43.parseX(xLabel));
|
|
7166
7175
|
s.data.forEach(function (d) {
|
|
7167
7176
|
if (d.x.value === xLabel) {
|
|
7168
7177
|
if (!tooltipTitle) {
|
|
@@ -7181,13 +7190,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7181
7190
|
var pointA = s.data[index - 1];
|
|
7182
7191
|
var pointB = s.data[index];
|
|
7183
7192
|
|
|
7184
|
-
if (
|
|
7193
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7185
7194
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7186
7195
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7187
7196
|
}
|
|
7188
7197
|
|
|
7189
7198
|
if (pointA && !pointB) {
|
|
7190
|
-
xPoint =
|
|
7199
|
+
xPoint = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7191
7200
|
tooltipTitle = pointA.x.value;
|
|
7192
7201
|
|
|
7193
7202
|
if (!pointA.y.color) {
|
|
@@ -7197,12 +7206,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7197
7206
|
tooltipData.push(pointA.y);
|
|
7198
7207
|
|
|
7199
7208
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7200
|
-
tooltipTitle = d3.timeFormat(
|
|
7209
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7201
7210
|
}
|
|
7202
7211
|
}
|
|
7203
7212
|
|
|
7204
7213
|
if (pointB && !pointA) {
|
|
7205
|
-
xPoint =
|
|
7214
|
+
xPoint = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7206
7215
|
tooltipTitle = pointB.x.value;
|
|
7207
7216
|
|
|
7208
7217
|
if (!pointB.y.color) {
|
|
@@ -7212,14 +7221,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7212
7221
|
tooltipData.push(pointB.y);
|
|
7213
7222
|
|
|
7214
7223
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7215
|
-
tooltipTitle = d3.timeFormat(
|
|
7224
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7216
7225
|
}
|
|
7217
7226
|
}
|
|
7218
7227
|
|
|
7219
7228
|
if (pointA && pointB) {
|
|
7220
|
-
var d0 =
|
|
7229
|
+
var d0 = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7221
7230
|
|
|
7222
|
-
var d1 =
|
|
7231
|
+
var d1 = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7223
7232
|
|
|
7224
7233
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7225
7234
|
|
|
@@ -7228,7 +7237,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7228
7237
|
tooltipTitle = pointB.x.value;
|
|
7229
7238
|
|
|
7230
7239
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7231
|
-
tooltipTitle = d3.timeFormat(
|
|
7240
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7232
7241
|
}
|
|
7233
7242
|
|
|
7234
7243
|
if (!pointB.y.color) {
|
|
@@ -7241,7 +7250,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7241
7250
|
tooltipTitle = pointA.x.value;
|
|
7242
7251
|
|
|
7243
7252
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7244
|
-
tooltipTitle = d3.timeFormat(
|
|
7253
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7245
7254
|
}
|
|
7246
7255
|
|
|
7247
7256
|
if (!pointA.y.color) {
|
|
@@ -7355,7 +7364,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7355
7364
|
}, {
|
|
7356
7365
|
key: "render",
|
|
7357
7366
|
value: function render(options) {
|
|
7358
|
-
var
|
|
7367
|
+
var _this44 = this;
|
|
7359
7368
|
|
|
7360
7369
|
/* global d3 options WebsyUtils */
|
|
7361
7370
|
if (typeof options !== 'undefined') {
|
|
@@ -7424,7 +7433,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7424
7433
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7425
7434
|
return {
|
|
7426
7435
|
value: s.label || s.key,
|
|
7427
|
-
color: s.color ||
|
|
7436
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7428
7437
|
};
|
|
7429
7438
|
});
|
|
7430
7439
|
|
|
@@ -7706,7 +7715,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7706
7715
|
|
|
7707
7716
|
if (this.options.data.bottom.formatter) {
|
|
7708
7717
|
bAxisFunc.tickFormat(function (d) {
|
|
7709
|
-
return
|
|
7718
|
+
return _this44.options.data.bottom.formatter(d);
|
|
7710
7719
|
});
|
|
7711
7720
|
}
|
|
7712
7721
|
|
|
@@ -7732,8 +7741,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7732
7741
|
|
|
7733
7742
|
if (this.options.margin.axisLeft > 0) {
|
|
7734
7743
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7735
|
-
if (
|
|
7736
|
-
d =
|
|
7744
|
+
if (_this44.options.data.left.formatter) {
|
|
7745
|
+
d = _this44.options.data.left.formatter(d);
|
|
7737
7746
|
}
|
|
7738
7747
|
|
|
7739
7748
|
return d;
|
|
@@ -7770,8 +7779,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7770
7779
|
|
|
7771
7780
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7772
7781
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7773
|
-
if (
|
|
7774
|
-
d =
|
|
7782
|
+
if (_this44.options.data.right.formatter) {
|
|
7783
|
+
d = _this44.options.data.right.formatter(d);
|
|
7775
7784
|
}
|
|
7776
7785
|
|
|
7777
7786
|
return d;
|
|
@@ -7810,18 +7819,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7810
7819
|
this.renderedKeys = {};
|
|
7811
7820
|
this.options.data.series.forEach(function (series, index) {
|
|
7812
7821
|
if (!series.key) {
|
|
7813
|
-
series.key =
|
|
7822
|
+
series.key = _this44.createIdentity();
|
|
7814
7823
|
}
|
|
7815
7824
|
|
|
7816
7825
|
if (!series.color) {
|
|
7817
|
-
series.color =
|
|
7826
|
+
series.color = _this44.options.colors[index % _this44.options.colors.length];
|
|
7818
7827
|
}
|
|
7819
7828
|
|
|
7820
|
-
|
|
7829
|
+
_this44["render".concat(series.type || 'bar')](series, index);
|
|
7821
7830
|
|
|
7822
|
-
|
|
7831
|
+
_this44.renderLabels(series, index);
|
|
7823
7832
|
|
|
7824
|
-
|
|
7833
|
+
_this44.renderedKeys[series.key] = series.type;
|
|
7825
7834
|
});
|
|
7826
7835
|
}
|
|
7827
7836
|
}
|
|
@@ -7829,17 +7838,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7829
7838
|
}, {
|
|
7830
7839
|
key: "renderarea",
|
|
7831
7840
|
value: function renderarea(series, index) {
|
|
7832
|
-
var
|
|
7841
|
+
var _this45 = this;
|
|
7833
7842
|
|
|
7834
7843
|
/* global d3 series index */
|
|
7835
7844
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7836
7845
|
return d3.area().x(function (d) {
|
|
7837
|
-
return
|
|
7846
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
7838
7847
|
}).y0(function (d) {
|
|
7839
|
-
return
|
|
7848
|
+
return _this45[yAxis](0);
|
|
7840
7849
|
}).y1(function (d) {
|
|
7841
|
-
return
|
|
7842
|
-
}).curve(d3[curveStyle ||
|
|
7850
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7851
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7843
7852
|
};
|
|
7844
7853
|
|
|
7845
7854
|
var xAxis = 'bottomAxis';
|
|
@@ -7962,7 +7971,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7962
7971
|
}, {
|
|
7963
7972
|
key: "renderLabels",
|
|
7964
7973
|
value: function renderLabels(series, index) {
|
|
7965
|
-
var
|
|
7974
|
+
var _this46 = this;
|
|
7966
7975
|
|
|
7967
7976
|
/* global series index d3 WebsyDesigns */
|
|
7968
7977
|
var xAxis = 'bottomAxis';
|
|
@@ -7981,11 +7990,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7981
7990
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7982
7991
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7983
7992
|
labels.attr('x', function (d) {
|
|
7984
|
-
return getLabelX.call(
|
|
7993
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
7985
7994
|
}).attr('y', function (d) {
|
|
7986
|
-
return getLabelY.call(
|
|
7995
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
7987
7996
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7988
|
-
return
|
|
7997
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7989
7998
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7990
7999
|
return d.y.label || d.y.value;
|
|
7991
8000
|
}).each(function (d, i) {
|
|
@@ -8010,11 +8019,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8010
8019
|
}
|
|
8011
8020
|
});
|
|
8012
8021
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8013
|
-
return getLabelX.call(
|
|
8022
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8014
8023
|
}).attr('y', function (d) {
|
|
8015
|
-
return getLabelY.call(
|
|
8024
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8016
8025
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8017
|
-
return
|
|
8026
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8018
8027
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8019
8028
|
return d.y.label || d.y.value;
|
|
8020
8029
|
}).each(function (d, i) {
|
|
@@ -8071,16 +8080,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8071
8080
|
}, {
|
|
8072
8081
|
key: "renderline",
|
|
8073
8082
|
value: function renderline(series, index) {
|
|
8074
|
-
var
|
|
8083
|
+
var _this47 = this;
|
|
8075
8084
|
|
|
8076
8085
|
/* global series index d3 */
|
|
8077
8086
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8078
8087
|
return d3.line().x(function (d) {
|
|
8079
|
-
var adjustment =
|
|
8080
|
-
return
|
|
8088
|
+
var adjustment = _this47.options.data[xAxis].scale === 'Time' ? 0 : _this47["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8089
|
+
return _this47["".concat(xAxis, "Axis")](_this47.parseX(d.x.value)) + adjustment;
|
|
8081
8090
|
}).y(function (d) {
|
|
8082
|
-
return
|
|
8083
|
-
}).curve(d3[curveStyle ||
|
|
8091
|
+
return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8092
|
+
}).curve(d3[curveStyle || _this47.options.curveStyle]);
|
|
8084
8093
|
};
|
|
8085
8094
|
|
|
8086
8095
|
var xAxis = 'bottom';
|
|
@@ -8124,14 +8133,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8124
8133
|
}, {
|
|
8125
8134
|
key: "rendersymbol",
|
|
8126
8135
|
value: function rendersymbol(series, index) {
|
|
8127
|
-
var
|
|
8136
|
+
var _this48 = this;
|
|
8128
8137
|
|
|
8129
8138
|
/* global d3 series index series.key */
|
|
8130
8139
|
var drawSymbol = function drawSymbol(size) {
|
|
8131
8140
|
return d3.symbol() // .type(d => {
|
|
8132
8141
|
// return d3.symbols[0]
|
|
8133
8142
|
// })
|
|
8134
|
-
.size(size ||
|
|
8143
|
+
.size(size || _this48.options.symbolSize);
|
|
8135
8144
|
};
|
|
8136
8145
|
|
|
8137
8146
|
var xAxis = 'bottomAxis';
|
|
@@ -8149,7 +8158,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8149
8158
|
symbols.attr('d', function (d) {
|
|
8150
8159
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8151
8160
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8152
|
-
return "translate(".concat(
|
|
8161
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8153
8162
|
}); // Enter
|
|
8154
8163
|
|
|
8155
8164
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8158,7 +8167,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8158
8167
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8159
8168
|
return "symbol symbol_".concat(series.key);
|
|
8160
8169
|
}).attr('transform', function (d) {
|
|
8161
|
-
return "translate(".concat(
|
|
8170
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8162
8171
|
});
|
|
8163
8172
|
}
|
|
8164
8173
|
}, {
|
|
@@ -8313,7 +8322,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8313
8322
|
}, {
|
|
8314
8323
|
key: "resize",
|
|
8315
8324
|
value: function resize() {
|
|
8316
|
-
var
|
|
8325
|
+
var _this49 = this;
|
|
8317
8326
|
|
|
8318
8327
|
var el = document.getElementById(this.elementId);
|
|
8319
8328
|
|
|
@@ -8326,7 +8335,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8326
8335
|
// }
|
|
8327
8336
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8328
8337
|
html += this._data.map(function (d, i) {
|
|
8329
|
-
return
|
|
8338
|
+
return _this49.getLegendItemHTML(d);
|
|
8330
8339
|
}).join('');
|
|
8331
8340
|
html += "\n <div>\n ";
|
|
8332
8341
|
el.innerHTML = html;
|
|
@@ -8498,7 +8507,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8498
8507
|
}, {
|
|
8499
8508
|
key: "render",
|
|
8500
8509
|
value: function render() {
|
|
8501
|
-
var
|
|
8510
|
+
var _this50 = this;
|
|
8502
8511
|
|
|
8503
8512
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8504
8513
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8507,7 +8516,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8507
8516
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8508
8517
|
return {
|
|
8509
8518
|
value: s.label || s.key,
|
|
8510
|
-
color: s.color ||
|
|
8519
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8511
8520
|
};
|
|
8512
8521
|
});
|
|
8513
8522
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8571,7 +8580,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8571
8580
|
|
|
8572
8581
|
if (this.polygons) {
|
|
8573
8582
|
this.polygons.forEach(function (p) {
|
|
8574
|
-
return
|
|
8583
|
+
return _this50.map.removeLayer(p);
|
|
8575
8584
|
});
|
|
8576
8585
|
}
|
|
8577
8586
|
|
|
@@ -8629,18 +8638,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8629
8638
|
}
|
|
8630
8639
|
|
|
8631
8640
|
if (!p.options.color) {
|
|
8632
|
-
p.options.color =
|
|
8641
|
+
p.options.color = _this50.options.colors[i % _this50.options.colors.length];
|
|
8633
8642
|
}
|
|
8634
8643
|
|
|
8635
8644
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8636
8645
|
return c.map(function (d) {
|
|
8637
8646
|
return [d.Latitude, d.Longitude];
|
|
8638
8647
|
});
|
|
8639
|
-
}), p.options).addTo(
|
|
8648
|
+
}), p.options).addTo(_this50.map);
|
|
8640
8649
|
|
|
8641
|
-
|
|
8650
|
+
_this50.polygons.push(pol);
|
|
8642
8651
|
|
|
8643
|
-
|
|
8652
|
+
_this50.map.fitBounds(pol.getBounds());
|
|
8644
8653
|
});
|
|
8645
8654
|
} // if (this.data.markers.length > 0) {
|
|
8646
8655
|
// el.classList.remove('hidden')
|