@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
package/dist/websy-designs.js
CHANGED
|
@@ -691,7 +691,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
691
691
|
var _this4 = this;
|
|
692
692
|
|
|
693
693
|
var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
694
|
-
console.trace();
|
|
695
694
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
696
695
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
697
696
|
var el = document.getElementById(this.elementId);
|
|
@@ -854,12 +853,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
854
853
|
var _this5 = this;
|
|
855
854
|
|
|
856
855
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
857
|
-
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
858
856
|
|
|
859
|
-
|
|
860
|
-
dateEls
|
|
861
|
-
|
|
862
|
-
dateEls
|
|
857
|
+
if (el) {
|
|
858
|
+
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
859
|
+
|
|
860
|
+
for (var i = 0; i < dateEls.length; i++) {
|
|
861
|
+
dateEls[i].classList.remove('selected');
|
|
862
|
+
dateEls[i].classList.remove('first');
|
|
863
|
+
dateEls[i].classList.remove('last');
|
|
864
|
+
}
|
|
863
865
|
}
|
|
864
866
|
|
|
865
867
|
if (this.selectedRange === 0) {
|
|
@@ -1527,13 +1529,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1527
1529
|
|
|
1528
1530
|
var el = document.getElementById(this.elementId);
|
|
1529
1531
|
var labelEl = document.getElementById("".concat(this.elementId, "_selectedRange"));
|
|
1530
|
-
var rangeEls = el.querySelectorAll(".websy-date-picker-range");
|
|
1531
1532
|
|
|
1532
|
-
|
|
1533
|
-
rangeEls
|
|
1533
|
+
if (el) {
|
|
1534
|
+
var rangeEls = el.querySelectorAll(".websy-date-picker-range");
|
|
1535
|
+
|
|
1536
|
+
for (var i = 0; i < rangeEls.length; i++) {
|
|
1537
|
+
rangeEls[i].classList.remove('active');
|
|
1534
1538
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1539
|
+
if (i === this.selectedRange) {
|
|
1540
|
+
rangeEls[i].classList.add('active');
|
|
1541
|
+
}
|
|
1537
1542
|
}
|
|
1538
1543
|
}
|
|
1539
1544
|
|
|
@@ -6604,7 +6609,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6604
6609
|
minHandleSize: 20,
|
|
6605
6610
|
maxColWidth: '50%',
|
|
6606
6611
|
allowPivoting: false,
|
|
6607
|
-
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>"
|
|
6612
|
+
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>",
|
|
6613
|
+
plusIcon: WebsyDesigns.Icons.PlusFilled,
|
|
6614
|
+
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
6608
6615
|
};
|
|
6609
6616
|
this.options = _extends({}, DEFAULTS, options);
|
|
6610
6617
|
this.sizes = {};
|
|
@@ -6671,6 +6678,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6671
6678
|
}, {
|
|
6672
6679
|
key: "buildBodyHtml",
|
|
6673
6680
|
value: function buildBodyHtml() {
|
|
6681
|
+
var _this40 = this;
|
|
6682
|
+
|
|
6674
6683
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6675
6684
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6676
6685
|
|
|
@@ -6738,11 +6747,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6738
6747
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6739
6748
|
|
|
6740
6749
|
if (cell.expandable === true) {
|
|
6741
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6750
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this40.options.plusIcon, "</i>");
|
|
6742
6751
|
}
|
|
6743
6752
|
|
|
6744
6753
|
if (cell.collapsable === true) {
|
|
6745
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6754
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this40.options.minusIcon, "</i>");
|
|
6746
6755
|
}
|
|
6747
6756
|
|
|
6748
6757
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6767,7 +6776,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6767
6776
|
}, {
|
|
6768
6777
|
key: "buildHeaderHtml",
|
|
6769
6778
|
value: function buildHeaderHtml() {
|
|
6770
|
-
var
|
|
6779
|
+
var _this41 = this;
|
|
6771
6780
|
|
|
6772
6781
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6773
6782
|
var headerHtml = '';
|
|
@@ -6782,7 +6791,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6782
6791
|
}
|
|
6783
6792
|
|
|
6784
6793
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6785
|
-
if (useWidths === false && rowIndex !==
|
|
6794
|
+
if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
|
|
6786
6795
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6787
6796
|
return;
|
|
6788
6797
|
}
|
|
@@ -6808,18 +6817,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6808
6817
|
// `
|
|
6809
6818
|
// }
|
|
6810
6819
|
|
|
6811
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6820
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this41.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6812
6821
|
});
|
|
6813
6822
|
headerHtml += "</tr>";
|
|
6814
6823
|
});
|
|
6815
6824
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6816
6825
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6817
6826
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6818
|
-
var testEl = document.getElementById("".concat(
|
|
6827
|
+
var testEl = document.getElementById("".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6819
6828
|
|
|
6820
6829
|
if (!testEl) {
|
|
6821
6830
|
var newE = document.createElement('div');
|
|
6822
|
-
newE.id = "".concat(
|
|
6831
|
+
newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6823
6832
|
newE.className = 'websy-modal-dropdown';
|
|
6824
6833
|
dropdownEl.appendChild(newE);
|
|
6825
6834
|
}
|
|
@@ -6835,7 +6844,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6835
6844
|
}, {
|
|
6836
6845
|
key: "buildTotalHtml",
|
|
6837
6846
|
value: function buildTotalHtml() {
|
|
6838
|
-
var
|
|
6847
|
+
var _this42 = this;
|
|
6839
6848
|
|
|
6840
6849
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6841
6850
|
|
|
@@ -6848,7 +6857,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6848
6857
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6849
6858
|
|
|
6850
6859
|
if (useWidths === true) {
|
|
6851
|
-
totalHtml += "\n style='width: ".concat(
|
|
6860
|
+
totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6852
6861
|
}
|
|
6853
6862
|
|
|
6854
6863
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6859,7 +6868,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6859
6868
|
}, {
|
|
6860
6869
|
key: "calculateSizes",
|
|
6861
6870
|
value: function calculateSizes() {
|
|
6862
|
-
var
|
|
6871
|
+
var _this43 = this;
|
|
6863
6872
|
|
|
6864
6873
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6865
6874
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6902,32 +6911,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6902
6911
|
rows.forEach(function (row, rowIndex) {
|
|
6903
6912
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6904
6913
|
var colSize = col.getBoundingClientRect();
|
|
6905
|
-
|
|
6914
|
+
_this43.sizes.cellHeight = colSize.height;
|
|
6906
6915
|
|
|
6907
|
-
if (
|
|
6908
|
-
if (!
|
|
6909
|
-
|
|
6916
|
+
if (_this43.options.columns[_this43.options.columns.length - 1][colIndex]) {
|
|
6917
|
+
if (!_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth) {
|
|
6918
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6910
6919
|
}
|
|
6911
6920
|
|
|
6912
|
-
|
|
6913
|
-
|
|
6921
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6922
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6914
6923
|
|
|
6915
|
-
if (colIndex >=
|
|
6916
|
-
firstNonPinnedColumnWidth =
|
|
6924
|
+
if (colIndex >= _this43.pinnedColumns) {
|
|
6925
|
+
firstNonPinnedColumnWidth = _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth;
|
|
6917
6926
|
}
|
|
6918
6927
|
}
|
|
6919
6928
|
});
|
|
6920
6929
|
});
|
|
6921
6930
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6922
|
-
if (colIndex <
|
|
6923
|
-
|
|
6931
|
+
if (colIndex < _this43.pinnedColumns) {
|
|
6932
|
+
_this43.sizes.scrollableWidth -= col.actualWidth;
|
|
6924
6933
|
}
|
|
6925
6934
|
});
|
|
6926
6935
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6927
6936
|
return a + (b.width || b.actualWidth);
|
|
6928
6937
|
}, 0);
|
|
6929
6938
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6930
|
-
return i >=
|
|
6939
|
+
return i >= _this43.pinnedColumns;
|
|
6931
6940
|
}).reduce(function (a, b) {
|
|
6932
6941
|
return a + (b.width || b.actualWidth);
|
|
6933
6942
|
}, 0);
|
|
@@ -6948,10 +6957,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6948
6957
|
c.actualWidth += equalWidth; // }
|
|
6949
6958
|
// }
|
|
6950
6959
|
|
|
6951
|
-
|
|
6960
|
+
_this43.sizes.totalWidth += c.width || c.actualWidth;
|
|
6952
6961
|
|
|
6953
|
-
if (i <
|
|
6954
|
-
|
|
6962
|
+
if (i < _this43.pinnedColumns) {
|
|
6963
|
+
_this43.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6955
6964
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6956
6965
|
|
|
6957
6966
|
});
|
|
@@ -7008,7 +7017,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7008
7017
|
}, {
|
|
7009
7018
|
key: "createSample",
|
|
7010
7019
|
value: function createSample(data) {
|
|
7011
|
-
var
|
|
7020
|
+
var _this44 = this;
|
|
7012
7021
|
|
|
7013
7022
|
var output = [];
|
|
7014
7023
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -7020,7 +7029,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7020
7029
|
var longest = '';
|
|
7021
7030
|
|
|
7022
7031
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7023
|
-
if (data[i].length ===
|
|
7032
|
+
if (data[i].length === _this44.options.columns[_this44.options.columns.length - 1].length) {
|
|
7024
7033
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7025
7034
|
longest = data[i][colIndex].value;
|
|
7026
7035
|
}
|
|
@@ -7415,7 +7424,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7415
7424
|
|
|
7416
7425
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7417
7426
|
function WebsyChart(elementId, options) {
|
|
7418
|
-
var
|
|
7427
|
+
var _this45 = this;
|
|
7419
7428
|
|
|
7420
7429
|
_classCallCheck(this, WebsyChart);
|
|
7421
7430
|
|
|
@@ -7466,22 +7475,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7466
7475
|
this.invertOverride = function (input, input2) {
|
|
7467
7476
|
var xAxis = 'bottomAxis';
|
|
7468
7477
|
|
|
7469
|
-
if (
|
|
7478
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7470
7479
|
xAxis = 'leftAxis';
|
|
7471
7480
|
}
|
|
7472
7481
|
|
|
7473
|
-
var width =
|
|
7482
|
+
var width = _this45[xAxis].step();
|
|
7474
7483
|
|
|
7475
7484
|
var output;
|
|
7476
7485
|
|
|
7477
|
-
var domain = _toConsumableArray(
|
|
7486
|
+
var domain = _toConsumableArray(_this45[xAxis].domain());
|
|
7478
7487
|
|
|
7479
|
-
if (
|
|
7488
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7480
7489
|
domain = domain.reverse();
|
|
7481
7490
|
}
|
|
7482
7491
|
|
|
7483
7492
|
for (var j = 0; j < domain.length; j++) {
|
|
7484
|
-
var breakA =
|
|
7493
|
+
var breakA = _this45[xAxis](domain[j]) - width / 2;
|
|
7485
7494
|
var breakB = breakA + width;
|
|
7486
7495
|
|
|
7487
7496
|
if (input > breakA && input <= breakB) {
|
|
@@ -7581,10 +7590,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7581
7590
|
}, {
|
|
7582
7591
|
key: "handleEventMouseMove",
|
|
7583
7592
|
value: function handleEventMouseMove(event, d) {
|
|
7584
|
-
var
|
|
7593
|
+
var _this46 = this;
|
|
7585
7594
|
|
|
7586
7595
|
var bisectDate = d3.bisector(function (d) {
|
|
7587
|
-
return
|
|
7596
|
+
return _this46.parseX(d.x.value);
|
|
7588
7597
|
}).left;
|
|
7589
7598
|
|
|
7590
7599
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7623,8 +7632,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7623
7632
|
}
|
|
7624
7633
|
|
|
7625
7634
|
this.options.data.series.forEach(function (s) {
|
|
7626
|
-
if (
|
|
7627
|
-
xPoint =
|
|
7635
|
+
if (_this46.options.data[xData].scale !== 'Time') {
|
|
7636
|
+
xPoint = _this46[xAxis](_this46.parseX(xLabel));
|
|
7628
7637
|
s.data.forEach(function (d) {
|
|
7629
7638
|
if (d.x.value === xLabel) {
|
|
7630
7639
|
if (!tooltipTitle) {
|
|
@@ -7643,13 +7652,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7643
7652
|
var pointA = s.data[index - 1];
|
|
7644
7653
|
var pointB = s.data[index];
|
|
7645
7654
|
|
|
7646
|
-
if (
|
|
7655
|
+
if (_this46.options.orientation === 'horizontal') {
|
|
7647
7656
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7648
7657
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7649
7658
|
}
|
|
7650
7659
|
|
|
7651
7660
|
if (pointA && !pointB) {
|
|
7652
|
-
xPoint =
|
|
7661
|
+
xPoint = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7653
7662
|
tooltipTitle = pointA.x.value;
|
|
7654
7663
|
|
|
7655
7664
|
if (!pointA.y.color) {
|
|
@@ -7659,12 +7668,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7659
7668
|
tooltipData.push(pointA.y);
|
|
7660
7669
|
|
|
7661
7670
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7662
|
-
tooltipTitle = d3.timeFormat(
|
|
7671
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7663
7672
|
}
|
|
7664
7673
|
}
|
|
7665
7674
|
|
|
7666
7675
|
if (pointB && !pointA) {
|
|
7667
|
-
xPoint =
|
|
7676
|
+
xPoint = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7668
7677
|
tooltipTitle = pointB.x.value;
|
|
7669
7678
|
|
|
7670
7679
|
if (!pointB.y.color) {
|
|
@@ -7674,14 +7683,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7674
7683
|
tooltipData.push(pointB.y);
|
|
7675
7684
|
|
|
7676
7685
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7677
|
-
tooltipTitle = d3.timeFormat(
|
|
7686
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7678
7687
|
}
|
|
7679
7688
|
}
|
|
7680
7689
|
|
|
7681
7690
|
if (pointA && pointB) {
|
|
7682
|
-
var d0 =
|
|
7691
|
+
var d0 = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7683
7692
|
|
|
7684
|
-
var d1 =
|
|
7693
|
+
var d1 = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7685
7694
|
|
|
7686
7695
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7687
7696
|
|
|
@@ -7690,7 +7699,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7690
7699
|
tooltipTitle = pointB.x.value;
|
|
7691
7700
|
|
|
7692
7701
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7693
|
-
tooltipTitle = d3.timeFormat(
|
|
7702
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7694
7703
|
}
|
|
7695
7704
|
|
|
7696
7705
|
if (!pointB.y.color) {
|
|
@@ -7703,7 +7712,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7703
7712
|
tooltipTitle = pointA.x.value;
|
|
7704
7713
|
|
|
7705
7714
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7706
|
-
tooltipTitle = d3.timeFormat(
|
|
7715
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7707
7716
|
}
|
|
7708
7717
|
|
|
7709
7718
|
if (!pointA.y.color) {
|
|
@@ -7817,7 +7826,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7817
7826
|
}, {
|
|
7818
7827
|
key: "render",
|
|
7819
7828
|
value: function render(options) {
|
|
7820
|
-
var
|
|
7829
|
+
var _this47 = this;
|
|
7821
7830
|
|
|
7822
7831
|
/* global d3 options WebsyUtils */
|
|
7823
7832
|
if (typeof options !== 'undefined') {
|
|
@@ -7886,7 +7895,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7886
7895
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7887
7896
|
return {
|
|
7888
7897
|
value: s.label || s.key,
|
|
7889
|
-
color: s.color ||
|
|
7898
|
+
color: s.color || _this47.options.colors[i % _this47.options.colors.length]
|
|
7890
7899
|
};
|
|
7891
7900
|
});
|
|
7892
7901
|
|
|
@@ -8168,7 +8177,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8168
8177
|
|
|
8169
8178
|
if (this.options.data.bottom.formatter) {
|
|
8170
8179
|
bAxisFunc.tickFormat(function (d) {
|
|
8171
|
-
return
|
|
8180
|
+
return _this47.options.data.bottom.formatter(d);
|
|
8172
8181
|
});
|
|
8173
8182
|
}
|
|
8174
8183
|
|
|
@@ -8194,8 +8203,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8194
8203
|
|
|
8195
8204
|
if (this.options.margin.axisLeft > 0) {
|
|
8196
8205
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8197
|
-
if (
|
|
8198
|
-
d =
|
|
8206
|
+
if (_this47.options.data.left.formatter) {
|
|
8207
|
+
d = _this47.options.data.left.formatter(d);
|
|
8199
8208
|
}
|
|
8200
8209
|
|
|
8201
8210
|
return d;
|
|
@@ -8232,8 +8241,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8232
8241
|
|
|
8233
8242
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8234
8243
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8235
|
-
if (
|
|
8236
|
-
d =
|
|
8244
|
+
if (_this47.options.data.right.formatter) {
|
|
8245
|
+
d = _this47.options.data.right.formatter(d);
|
|
8237
8246
|
}
|
|
8238
8247
|
|
|
8239
8248
|
return d;
|
|
@@ -8272,18 +8281,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8272
8281
|
this.renderedKeys = {};
|
|
8273
8282
|
this.options.data.series.forEach(function (series, index) {
|
|
8274
8283
|
if (!series.key) {
|
|
8275
|
-
series.key =
|
|
8284
|
+
series.key = _this47.createIdentity();
|
|
8276
8285
|
}
|
|
8277
8286
|
|
|
8278
8287
|
if (!series.color) {
|
|
8279
|
-
series.color =
|
|
8288
|
+
series.color = _this47.options.colors[index % _this47.options.colors.length];
|
|
8280
8289
|
}
|
|
8281
8290
|
|
|
8282
|
-
|
|
8291
|
+
_this47["render".concat(series.type || 'bar')](series, index);
|
|
8283
8292
|
|
|
8284
|
-
|
|
8293
|
+
_this47.renderLabels(series, index);
|
|
8285
8294
|
|
|
8286
|
-
|
|
8295
|
+
_this47.renderedKeys[series.key] = series.type;
|
|
8287
8296
|
});
|
|
8288
8297
|
}
|
|
8289
8298
|
}
|
|
@@ -8291,17 +8300,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8291
8300
|
}, {
|
|
8292
8301
|
key: "renderarea",
|
|
8293
8302
|
value: function renderarea(series, index) {
|
|
8294
|
-
var
|
|
8303
|
+
var _this48 = this;
|
|
8295
8304
|
|
|
8296
8305
|
/* global d3 series index */
|
|
8297
8306
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8298
8307
|
return d3.area().x(function (d) {
|
|
8299
|
-
return
|
|
8308
|
+
return _this48[xAxis](_this48.parseX(d.x.value));
|
|
8300
8309
|
}).y0(function (d) {
|
|
8301
|
-
return
|
|
8310
|
+
return _this48[yAxis](0);
|
|
8302
8311
|
}).y1(function (d) {
|
|
8303
|
-
return
|
|
8304
|
-
}).curve(d3[curveStyle ||
|
|
8312
|
+
return _this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8313
|
+
}).curve(d3[curveStyle || _this48.options.curveStyle]);
|
|
8305
8314
|
};
|
|
8306
8315
|
|
|
8307
8316
|
var xAxis = 'bottomAxis';
|
|
@@ -8424,7 +8433,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8424
8433
|
}, {
|
|
8425
8434
|
key: "renderLabels",
|
|
8426
8435
|
value: function renderLabels(series, index) {
|
|
8427
|
-
var
|
|
8436
|
+
var _this49 = this;
|
|
8428
8437
|
|
|
8429
8438
|
/* global series index d3 WebsyDesigns */
|
|
8430
8439
|
var xAxis = 'bottomAxis';
|
|
@@ -8443,11 +8452,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8443
8452
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8444
8453
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8445
8454
|
labels.attr('x', function (d) {
|
|
8446
|
-
return getLabelX.call(
|
|
8455
|
+
return getLabelX.call(_this49, d, series.labelPosition);
|
|
8447
8456
|
}).attr('y', function (d) {
|
|
8448
|
-
return getLabelY.call(
|
|
8457
|
+
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8449
8458
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8450
|
-
return
|
|
8459
|
+
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8451
8460
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8452
8461
|
return d.y.label || d.y.value;
|
|
8453
8462
|
}).each(function (d, i) {
|
|
@@ -8472,11 +8481,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8472
8481
|
}
|
|
8473
8482
|
});
|
|
8474
8483
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8475
|
-
return getLabelX.call(
|
|
8484
|
+
return getLabelX.call(_this49, d, series.labelPosition);
|
|
8476
8485
|
}).attr('y', function (d) {
|
|
8477
|
-
return getLabelY.call(
|
|
8486
|
+
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8478
8487
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8479
|
-
return
|
|
8488
|
+
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8480
8489
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8481
8490
|
return d.y.label || d.y.value;
|
|
8482
8491
|
}).each(function (d, i) {
|
|
@@ -8533,16 +8542,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8533
8542
|
}, {
|
|
8534
8543
|
key: "renderline",
|
|
8535
8544
|
value: function renderline(series, index) {
|
|
8536
|
-
var
|
|
8545
|
+
var _this50 = this;
|
|
8537
8546
|
|
|
8538
8547
|
/* global series index d3 */
|
|
8539
8548
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8540
8549
|
return d3.line().x(function (d) {
|
|
8541
|
-
var adjustment =
|
|
8542
|
-
return
|
|
8550
|
+
var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8551
|
+
return _this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment;
|
|
8543
8552
|
}).y(function (d) {
|
|
8544
|
-
return
|
|
8545
|
-
}).curve(d3[curveStyle ||
|
|
8553
|
+
return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8554
|
+
}).curve(d3[curveStyle || _this50.options.curveStyle]);
|
|
8546
8555
|
};
|
|
8547
8556
|
|
|
8548
8557
|
var xAxis = 'bottom';
|
|
@@ -8586,14 +8595,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8586
8595
|
}, {
|
|
8587
8596
|
key: "rendersymbol",
|
|
8588
8597
|
value: function rendersymbol(series, index) {
|
|
8589
|
-
var
|
|
8598
|
+
var _this51 = this;
|
|
8590
8599
|
|
|
8591
8600
|
/* global d3 series index series.key */
|
|
8592
8601
|
var drawSymbol = function drawSymbol(size) {
|
|
8593
8602
|
return d3.symbol() // .type(d => {
|
|
8594
8603
|
// return d3.symbols[0]
|
|
8595
8604
|
// })
|
|
8596
|
-
.size(size ||
|
|
8605
|
+
.size(size || _this51.options.symbolSize);
|
|
8597
8606
|
};
|
|
8598
8607
|
|
|
8599
8608
|
var xAxis = 'bottomAxis';
|
|
@@ -8611,7 +8620,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8611
8620
|
symbols.attr('d', function (d) {
|
|
8612
8621
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8613
8622
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8614
|
-
return "translate(".concat(
|
|
8623
|
+
return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8615
8624
|
}); // Enter
|
|
8616
8625
|
|
|
8617
8626
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8620,7 +8629,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8620
8629
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8621
8630
|
return "symbol symbol_".concat(series.key);
|
|
8622
8631
|
}).attr('transform', function (d) {
|
|
8623
|
-
return "translate(".concat(
|
|
8632
|
+
return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8624
8633
|
});
|
|
8625
8634
|
}
|
|
8626
8635
|
}, {
|
|
@@ -8775,7 +8784,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8775
8784
|
}, {
|
|
8776
8785
|
key: "resize",
|
|
8777
8786
|
value: function resize() {
|
|
8778
|
-
var
|
|
8787
|
+
var _this52 = this;
|
|
8779
8788
|
|
|
8780
8789
|
var el = document.getElementById(this.elementId);
|
|
8781
8790
|
|
|
@@ -8788,7 +8797,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8788
8797
|
// }
|
|
8789
8798
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8790
8799
|
html += this._data.map(function (d, i) {
|
|
8791
|
-
return
|
|
8800
|
+
return _this52.getLegendItemHTML(d);
|
|
8792
8801
|
}).join('');
|
|
8793
8802
|
html += "\n <div>\n ";
|
|
8794
8803
|
el.innerHTML = html;
|
|
@@ -8960,7 +8969,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8960
8969
|
}, {
|
|
8961
8970
|
key: "render",
|
|
8962
8971
|
value: function render() {
|
|
8963
|
-
var
|
|
8972
|
+
var _this53 = this;
|
|
8964
8973
|
|
|
8965
8974
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8966
8975
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8969,7 +8978,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8969
8978
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8970
8979
|
return {
|
|
8971
8980
|
value: s.label || s.key,
|
|
8972
|
-
color: s.color ||
|
|
8981
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
8973
8982
|
};
|
|
8974
8983
|
});
|
|
8975
8984
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9033,7 +9042,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9033
9042
|
|
|
9034
9043
|
if (this.polygons) {
|
|
9035
9044
|
this.polygons.forEach(function (p) {
|
|
9036
|
-
return
|
|
9045
|
+
return _this53.map.removeLayer(p);
|
|
9037
9046
|
});
|
|
9038
9047
|
}
|
|
9039
9048
|
|
|
@@ -9091,18 +9100,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9091
9100
|
}
|
|
9092
9101
|
|
|
9093
9102
|
if (!p.options.color) {
|
|
9094
|
-
p.options.color =
|
|
9103
|
+
p.options.color = _this53.options.colors[i % _this53.options.colors.length];
|
|
9095
9104
|
}
|
|
9096
9105
|
|
|
9097
9106
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9098
9107
|
return c.map(function (d) {
|
|
9099
9108
|
return [d.Latitude, d.Longitude];
|
|
9100
9109
|
});
|
|
9101
|
-
}), p.options).addTo(
|
|
9110
|
+
}), p.options).addTo(_this53.map);
|
|
9102
9111
|
|
|
9103
|
-
|
|
9112
|
+
_this53.polygons.push(pol);
|
|
9104
9113
|
|
|
9105
|
-
|
|
9114
|
+
_this53.map.fitBounds(pol.getBounds());
|
|
9106
9115
|
});
|
|
9107
9116
|
} // if (this.data.markers.length > 0) {
|
|
9108
9117
|
// el.classList.remove('hidden')
|