@websy/websy-designs 1.4.2 → 1.4.4
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 +57 -19
- package/dist/websy-designs-es6.js +110 -75
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +66 -21
- package/dist/websy-designs.js +120 -78
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -158,7 +158,9 @@ class ButtonGroup {
|
|
|
158
158
|
const DEFAULTS = {
|
|
159
159
|
style: 'button',
|
|
160
160
|
subscribers: {},
|
|
161
|
-
activeItem:
|
|
161
|
+
activeItem: -1,
|
|
162
|
+
tag: 'div',
|
|
163
|
+
allowNone: false
|
|
162
164
|
}
|
|
163
165
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
164
166
|
const el = document.getElementById(this.elementId)
|
|
@@ -171,7 +173,7 @@ class ButtonGroup {
|
|
|
171
173
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
172
174
|
const index = +event.target.getAttribute('data-index')
|
|
173
175
|
if (this.options.activeItem !== index) {
|
|
174
|
-
if (this.options.onDeactivate) {
|
|
176
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
175
177
|
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem)
|
|
176
178
|
}
|
|
177
179
|
this.options.activeItem = index
|
|
@@ -187,7 +189,14 @@ class ButtonGroup {
|
|
|
187
189
|
})
|
|
188
190
|
event.target.classList.remove('inactive')
|
|
189
191
|
event.target.classList.add('active')
|
|
190
|
-
}
|
|
192
|
+
}
|
|
193
|
+
else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
194
|
+
if (this.options.onDeactivate) {
|
|
195
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem)
|
|
196
|
+
}
|
|
197
|
+
this.options.activeItem = -1
|
|
198
|
+
event.target.classList.remove('active')
|
|
199
|
+
}
|
|
191
200
|
}
|
|
192
201
|
}
|
|
193
202
|
on (event, fn) {
|
|
@@ -210,7 +219,7 @@ class ButtonGroup {
|
|
|
210
219
|
activeClass = i === this.options.activeItem ? 'active' : 'inactive'
|
|
211
220
|
}
|
|
212
221
|
return `
|
|
213
|
-
|
|
222
|
+
<${this.options.tag} ${(t.attributes || []).join(' ')} data-id="${t.id || t.label}" data-index="${i}" class="websy-button-group-item ${(t.classes || []).join(' ')} ${this.options.style}-style ${activeClass}">${t.label}</${this.options.tag}>
|
|
214
223
|
`
|
|
215
224
|
}).join('')
|
|
216
225
|
}
|
|
@@ -1606,7 +1615,9 @@ class WebsyDropdown {
|
|
|
1606
1615
|
if (el) {
|
|
1607
1616
|
el.style.zIndex = ''
|
|
1608
1617
|
}
|
|
1609
|
-
scrollEl
|
|
1618
|
+
if (scrollEl) {
|
|
1619
|
+
scrollEl.scrollTo(0, 0)
|
|
1620
|
+
}
|
|
1610
1621
|
maskEl.classList.remove('active')
|
|
1611
1622
|
contentEl.classList.remove('active')
|
|
1612
1623
|
contentEl.classList.remove('on-top')
|
|
@@ -5677,12 +5688,16 @@ class WebsyTable3 {
|
|
|
5677
5688
|
if (typeof sizingColumns[sizeIndex] === 'undefined') {
|
|
5678
5689
|
return // need to revisit this logic
|
|
5679
5690
|
}
|
|
5680
|
-
let style =
|
|
5681
|
-
let divStyle =
|
|
5691
|
+
let style = ''
|
|
5692
|
+
let divStyle = ''
|
|
5693
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
5694
|
+
style = `width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important; `
|
|
5695
|
+
divStyle = style
|
|
5696
|
+
}
|
|
5682
5697
|
if (cell.style) {
|
|
5683
5698
|
style += cell.style
|
|
5684
5699
|
}
|
|
5685
|
-
if (useWidths === true) {
|
|
5700
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
5686
5701
|
style += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
5687
5702
|
divStyle += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
5688
5703
|
}
|
|
@@ -5727,6 +5742,25 @@ class WebsyTable3 {
|
|
|
5727
5742
|
class='websy-table-cell-collapse'
|
|
5728
5743
|
>${WebsyDesigns.Icons.MinusFilled}</i>`
|
|
5729
5744
|
}
|
|
5745
|
+
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
5746
|
+
cell.value = `
|
|
5747
|
+
<a href='${cell.value}' target='${sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self'}'>${cell.displayText || sizingColumns[sizeIndex].linkText || cell.value}</a>
|
|
5748
|
+
`
|
|
5749
|
+
}
|
|
5750
|
+
if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
|
|
5751
|
+
cell.value = `
|
|
5752
|
+
<a data-view='${(cell.link || cell.value).replace(/'/g, '\'')}' class='websy-trigger'>${cell.value}</a>
|
|
5753
|
+
`
|
|
5754
|
+
}
|
|
5755
|
+
if (sizingColumns[sizeIndex].showAsImage === true) {
|
|
5756
|
+
cell.value = `
|
|
5757
|
+
<img
|
|
5758
|
+
style="width: ${sizingColumns[sizeIndex].imgWidth ? sizingColumns[sizeIndex].imgWidth : 'auto'}; height: ${sizingColumns[sizeIndex].imgHeight ? sizingColumns[sizeIndex].imgHeight : 'auto'};"
|
|
5759
|
+
src='${cell.value}'
|
|
5760
|
+
${sizingColumns[sizeIndex].errorImage ? 'onerror="this.src=\'' + sizingColumns[sizeIndex].errorImage + '\'"' : ''}
|
|
5761
|
+
/>
|
|
5762
|
+
`
|
|
5763
|
+
}
|
|
5730
5764
|
bodyHtml += `
|
|
5731
5765
|
${cell.value}
|
|
5732
5766
|
</div></td>`
|
|
@@ -5953,9 +5987,11 @@ class WebsyTable3 {
|
|
|
5953
5987
|
}
|
|
5954
5988
|
else if (data) {
|
|
5955
5989
|
let longest = ''
|
|
5956
|
-
for (let i = 0; i < Math.min(data.length, 1000); i++) {
|
|
5957
|
-
if (
|
|
5958
|
-
longest
|
|
5990
|
+
for (let i = 0; i < Math.min(data.length, 1000); i++) {
|
|
5991
|
+
if (data[i].length === this.options.columns[this.options.columns.length - 1].length) {
|
|
5992
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
5993
|
+
longest = data[i][colIndex].value
|
|
5994
|
+
}
|
|
5959
5995
|
}
|
|
5960
5996
|
}
|
|
5961
5997
|
output.push({value: longest})
|
|
@@ -6033,14 +6069,16 @@ class WebsyTable3 {
|
|
|
6033
6069
|
this.mouseXStart = null
|
|
6034
6070
|
}
|
|
6035
6071
|
handleScrollWheel (event) {
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6072
|
+
if (this.options.virtualScroll === true) {
|
|
6073
|
+
event.preventDefault()
|
|
6074
|
+
// console.log('scrollwheel', event)
|
|
6075
|
+
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
6076
|
+
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)))
|
|
6077
|
+
}
|
|
6078
|
+
else {
|
|
6079
|
+
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)))
|
|
6080
|
+
}
|
|
6081
|
+
}
|
|
6044
6082
|
}
|
|
6045
6083
|
hideError () {
|
|
6046
6084
|
const el = document.getElementById(`${this.elementId}_tableContainer`)
|
|
@@ -206,7 +206,9 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
206
206
|
var DEFAULTS = {
|
|
207
207
|
style: 'button',
|
|
208
208
|
subscribers: {},
|
|
209
|
-
activeItem:
|
|
209
|
+
activeItem: -1,
|
|
210
|
+
tag: 'div',
|
|
211
|
+
allowNone: false
|
|
210
212
|
};
|
|
211
213
|
this.options = _extends({}, DEFAULTS, options);
|
|
212
214
|
var el = document.getElementById(this.elementId);
|
|
@@ -224,7 +226,7 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
224
226
|
var index = +event.target.getAttribute('data-index');
|
|
225
227
|
|
|
226
228
|
if (this.options.activeItem !== index) {
|
|
227
|
-
if (this.options.onDeactivate) {
|
|
229
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
228
230
|
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
229
231
|
}
|
|
230
232
|
|
|
@@ -243,6 +245,13 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
243
245
|
});
|
|
244
246
|
event.target.classList.remove('inactive');
|
|
245
247
|
event.target.classList.add('active');
|
|
248
|
+
} else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
249
|
+
if (this.options.onDeactivate) {
|
|
250
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this.options.activeItem = -1;
|
|
254
|
+
event.target.classList.remove('active');
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
257
|
}
|
|
@@ -277,7 +286,7 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
277
286
|
activeClass = i === _this.options.activeItem ? 'active' : 'inactive';
|
|
278
287
|
}
|
|
279
288
|
|
|
280
|
-
return "\n <
|
|
289
|
+
return "\n <".concat(_this.options.tag, " ").concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(activeClass, "\">").concat(t.label, "</").concat(_this.options.tag, ">\n ");
|
|
281
290
|
}).join('');
|
|
282
291
|
}
|
|
283
292
|
}
|
|
@@ -1739,7 +1748,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1739
1748
|
el.style.zIndex = '';
|
|
1740
1749
|
}
|
|
1741
1750
|
|
|
1742
|
-
scrollEl
|
|
1751
|
+
if (scrollEl) {
|
|
1752
|
+
scrollEl.scrollTo(0, 0);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1743
1755
|
maskEl.classList.remove('active');
|
|
1744
1756
|
contentEl.classList.remove('active');
|
|
1745
1757
|
contentEl.classList.remove('on-top');
|
|
@@ -6174,14 +6186,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6174
6186
|
return; // need to revisit this logic
|
|
6175
6187
|
}
|
|
6176
6188
|
|
|
6177
|
-
var style =
|
|
6178
|
-
var divStyle =
|
|
6189
|
+
var style = '';
|
|
6190
|
+
var divStyle = '';
|
|
6191
|
+
|
|
6192
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6193
|
+
style = "width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important; ");
|
|
6194
|
+
divStyle = style;
|
|
6195
|
+
}
|
|
6179
6196
|
|
|
6180
6197
|
if (cell.style) {
|
|
6181
6198
|
style += cell.style;
|
|
6182
6199
|
}
|
|
6183
6200
|
|
|
6184
|
-
if (useWidths === true) {
|
|
6201
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6185
6202
|
style += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
|
|
6186
6203
|
divStyle += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
|
|
6187
6204
|
}
|
|
@@ -6216,6 +6233,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6216
6233
|
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>");
|
|
6217
6234
|
}
|
|
6218
6235
|
|
|
6236
|
+
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6237
|
+
cell.value = "\n <a href='".concat(cell.value, "' target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6240
|
+
if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
|
|
6241
|
+
cell.value = "\n <a data-view='".concat((cell.link || cell.value).replace(/'/g, '\''), "' class='websy-trigger'>").concat(cell.value, "</a>\n ");
|
|
6242
|
+
}
|
|
6243
|
+
|
|
6244
|
+
if (sizingColumns[sizeIndex].showAsImage === true) {
|
|
6245
|
+
cell.value = "\n <img \n style=\"width: ".concat(sizingColumns[sizeIndex].imgWidth ? sizingColumns[sizeIndex].imgWidth : 'auto', "; height: ").concat(sizingColumns[sizeIndex].imgHeight ? sizingColumns[sizeIndex].imgHeight : 'auto', ";\" \n src='").concat(cell.value, "'\n ").concat(sizingColumns[sizeIndex].errorImage ? 'onerror="this.src=\'' + sizingColumns[sizeIndex].errorImage + '\'"' : '', "\n />\n ");
|
|
6246
|
+
}
|
|
6247
|
+
|
|
6219
6248
|
bodyHtml += "\n ".concat(cell.value, "\n </div></td>");
|
|
6220
6249
|
});
|
|
6221
6250
|
bodyHtml += "</tr>";
|
|
@@ -6467,6 +6496,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6467
6496
|
}, {
|
|
6468
6497
|
key: "createSample",
|
|
6469
6498
|
value: function createSample(data) {
|
|
6499
|
+
var _this39 = this;
|
|
6500
|
+
|
|
6470
6501
|
var output = [];
|
|
6471
6502
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6472
6503
|
if (col.maxLength) {
|
|
@@ -6477,8 +6508,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6477
6508
|
var longest = '';
|
|
6478
6509
|
|
|
6479
6510
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6480
|
-
if (
|
|
6481
|
-
longest
|
|
6511
|
+
if (data[i].length === _this39.options.columns[_this39.options.columns.length - 1].length) {
|
|
6512
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
6513
|
+
longest = data[i][colIndex].value;
|
|
6514
|
+
}
|
|
6482
6515
|
}
|
|
6483
6516
|
}
|
|
6484
6517
|
|
|
@@ -6569,12 +6602,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6569
6602
|
}, {
|
|
6570
6603
|
key: "handleScrollWheel",
|
|
6571
6604
|
value: function handleScrollWheel(event) {
|
|
6572
|
-
|
|
6605
|
+
if (this.options.virtualScroll === true) {
|
|
6606
|
+
event.preventDefault(); // console.log('scrollwheel', event)
|
|
6573
6607
|
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6608
|
+
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
6609
|
+
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
6610
|
+
} else {
|
|
6611
|
+
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
|
|
6612
|
+
}
|
|
6578
6613
|
}
|
|
6579
6614
|
}
|
|
6580
6615
|
}, {
|
|
@@ -6868,7 +6903,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6868
6903
|
|
|
6869
6904
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6870
6905
|
function WebsyChart(elementId, options) {
|
|
6871
|
-
var
|
|
6906
|
+
var _this40 = this;
|
|
6872
6907
|
|
|
6873
6908
|
_classCallCheck(this, WebsyChart);
|
|
6874
6909
|
|
|
@@ -6919,22 +6954,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6919
6954
|
this.invertOverride = function (input, input2) {
|
|
6920
6955
|
var xAxis = 'bottomAxis';
|
|
6921
6956
|
|
|
6922
|
-
if (
|
|
6957
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6923
6958
|
xAxis = 'leftAxis';
|
|
6924
6959
|
}
|
|
6925
6960
|
|
|
6926
|
-
var width =
|
|
6961
|
+
var width = _this40[xAxis].step();
|
|
6927
6962
|
|
|
6928
6963
|
var output;
|
|
6929
6964
|
|
|
6930
|
-
var domain = _toConsumableArray(
|
|
6965
|
+
var domain = _toConsumableArray(_this40[xAxis].domain());
|
|
6931
6966
|
|
|
6932
|
-
if (
|
|
6967
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6933
6968
|
domain = domain.reverse();
|
|
6934
6969
|
}
|
|
6935
6970
|
|
|
6936
6971
|
for (var j = 0; j < domain.length; j++) {
|
|
6937
|
-
var breakA =
|
|
6972
|
+
var breakA = _this40[xAxis](domain[j]) - width / 2;
|
|
6938
6973
|
var breakB = breakA + width;
|
|
6939
6974
|
|
|
6940
6975
|
if (input > breakA && input <= breakB) {
|
|
@@ -7034,10 +7069,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7034
7069
|
}, {
|
|
7035
7070
|
key: "handleEventMouseMove",
|
|
7036
7071
|
value: function handleEventMouseMove(event, d) {
|
|
7037
|
-
var
|
|
7072
|
+
var _this41 = this;
|
|
7038
7073
|
|
|
7039
7074
|
var bisectDate = d3.bisector(function (d) {
|
|
7040
|
-
return
|
|
7075
|
+
return _this41.parseX(d.x.value);
|
|
7041
7076
|
}).left;
|
|
7042
7077
|
|
|
7043
7078
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7076,8 +7111,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7076
7111
|
}
|
|
7077
7112
|
|
|
7078
7113
|
this.options.data.series.forEach(function (s) {
|
|
7079
|
-
if (
|
|
7080
|
-
xPoint =
|
|
7114
|
+
if (_this41.options.data[xData].scale !== 'Time') {
|
|
7115
|
+
xPoint = _this41[xAxis](_this41.parseX(xLabel));
|
|
7081
7116
|
s.data.forEach(function (d) {
|
|
7082
7117
|
if (d.x.value === xLabel) {
|
|
7083
7118
|
if (!tooltipTitle) {
|
|
@@ -7096,13 +7131,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7096
7131
|
var pointA = s.data[index - 1];
|
|
7097
7132
|
var pointB = s.data[index];
|
|
7098
7133
|
|
|
7099
|
-
if (
|
|
7134
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
7100
7135
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7101
7136
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7102
7137
|
}
|
|
7103
7138
|
|
|
7104
7139
|
if (pointA && !pointB) {
|
|
7105
|
-
xPoint =
|
|
7140
|
+
xPoint = _this41[xAxis](_this41.parseX(pointA.x.value));
|
|
7106
7141
|
tooltipTitle = pointA.x.value;
|
|
7107
7142
|
|
|
7108
7143
|
if (!pointA.y.color) {
|
|
@@ -7112,12 +7147,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7112
7147
|
tooltipData.push(pointA.y);
|
|
7113
7148
|
|
|
7114
7149
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7115
|
-
tooltipTitle = d3.timeFormat(
|
|
7150
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7116
7151
|
}
|
|
7117
7152
|
}
|
|
7118
7153
|
|
|
7119
7154
|
if (pointB && !pointA) {
|
|
7120
|
-
xPoint =
|
|
7155
|
+
xPoint = _this41[xAxis](_this41.parseX(pointB.x.value));
|
|
7121
7156
|
tooltipTitle = pointB.x.value;
|
|
7122
7157
|
|
|
7123
7158
|
if (!pointB.y.color) {
|
|
@@ -7127,14 +7162,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7127
7162
|
tooltipData.push(pointB.y);
|
|
7128
7163
|
|
|
7129
7164
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7130
|
-
tooltipTitle = d3.timeFormat(
|
|
7165
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7131
7166
|
}
|
|
7132
7167
|
}
|
|
7133
7168
|
|
|
7134
7169
|
if (pointA && pointB) {
|
|
7135
|
-
var d0 =
|
|
7170
|
+
var d0 = _this41[xAxis](_this41.parseX(pointA.x.value));
|
|
7136
7171
|
|
|
7137
|
-
var d1 =
|
|
7172
|
+
var d1 = _this41[xAxis](_this41.parseX(pointB.x.value));
|
|
7138
7173
|
|
|
7139
7174
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7140
7175
|
|
|
@@ -7143,7 +7178,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7143
7178
|
tooltipTitle = pointB.x.value;
|
|
7144
7179
|
|
|
7145
7180
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7146
|
-
tooltipTitle = d3.timeFormat(
|
|
7181
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7147
7182
|
}
|
|
7148
7183
|
|
|
7149
7184
|
if (!pointB.y.color) {
|
|
@@ -7156,7 +7191,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7156
7191
|
tooltipTitle = pointA.x.value;
|
|
7157
7192
|
|
|
7158
7193
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7159
|
-
tooltipTitle = d3.timeFormat(
|
|
7194
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7160
7195
|
}
|
|
7161
7196
|
|
|
7162
7197
|
if (!pointA.y.color) {
|
|
@@ -7270,7 +7305,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7270
7305
|
}, {
|
|
7271
7306
|
key: "render",
|
|
7272
7307
|
value: function render(options) {
|
|
7273
|
-
var
|
|
7308
|
+
var _this42 = this;
|
|
7274
7309
|
|
|
7275
7310
|
/* global d3 options WebsyUtils */
|
|
7276
7311
|
if (typeof options !== 'undefined') {
|
|
@@ -7339,7 +7374,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7339
7374
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7340
7375
|
return {
|
|
7341
7376
|
value: s.label || s.key,
|
|
7342
|
-
color: s.color ||
|
|
7377
|
+
color: s.color || _this42.options.colors[i % _this42.options.colors.length]
|
|
7343
7378
|
};
|
|
7344
7379
|
});
|
|
7345
7380
|
|
|
@@ -7621,7 +7656,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7621
7656
|
|
|
7622
7657
|
if (this.options.data.bottom.formatter) {
|
|
7623
7658
|
bAxisFunc.tickFormat(function (d) {
|
|
7624
|
-
return
|
|
7659
|
+
return _this42.options.data.bottom.formatter(d);
|
|
7625
7660
|
});
|
|
7626
7661
|
}
|
|
7627
7662
|
|
|
@@ -7647,8 +7682,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7647
7682
|
|
|
7648
7683
|
if (this.options.margin.axisLeft > 0) {
|
|
7649
7684
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7650
|
-
if (
|
|
7651
|
-
d =
|
|
7685
|
+
if (_this42.options.data.left.formatter) {
|
|
7686
|
+
d = _this42.options.data.left.formatter(d);
|
|
7652
7687
|
}
|
|
7653
7688
|
|
|
7654
7689
|
return d;
|
|
@@ -7685,8 +7720,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7685
7720
|
|
|
7686
7721
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7687
7722
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7688
|
-
if (
|
|
7689
|
-
d =
|
|
7723
|
+
if (_this42.options.data.right.formatter) {
|
|
7724
|
+
d = _this42.options.data.right.formatter(d);
|
|
7690
7725
|
}
|
|
7691
7726
|
|
|
7692
7727
|
return d;
|
|
@@ -7725,18 +7760,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7725
7760
|
this.renderedKeys = {};
|
|
7726
7761
|
this.options.data.series.forEach(function (series, index) {
|
|
7727
7762
|
if (!series.key) {
|
|
7728
|
-
series.key =
|
|
7763
|
+
series.key = _this42.createIdentity();
|
|
7729
7764
|
}
|
|
7730
7765
|
|
|
7731
7766
|
if (!series.color) {
|
|
7732
|
-
series.color =
|
|
7767
|
+
series.color = _this42.options.colors[index % _this42.options.colors.length];
|
|
7733
7768
|
}
|
|
7734
7769
|
|
|
7735
|
-
|
|
7770
|
+
_this42["render".concat(series.type || 'bar')](series, index);
|
|
7736
7771
|
|
|
7737
|
-
|
|
7772
|
+
_this42.renderLabels(series, index);
|
|
7738
7773
|
|
|
7739
|
-
|
|
7774
|
+
_this42.renderedKeys[series.key] = series.type;
|
|
7740
7775
|
});
|
|
7741
7776
|
}
|
|
7742
7777
|
}
|
|
@@ -7744,17 +7779,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7744
7779
|
}, {
|
|
7745
7780
|
key: "renderarea",
|
|
7746
7781
|
value: function renderarea(series, index) {
|
|
7747
|
-
var
|
|
7782
|
+
var _this43 = this;
|
|
7748
7783
|
|
|
7749
7784
|
/* global d3 series index */
|
|
7750
7785
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7751
7786
|
return d3.area().x(function (d) {
|
|
7752
|
-
return
|
|
7787
|
+
return _this43[xAxis](_this43.parseX(d.x.value));
|
|
7753
7788
|
}).y0(function (d) {
|
|
7754
|
-
return
|
|
7789
|
+
return _this43[yAxis](0);
|
|
7755
7790
|
}).y1(function (d) {
|
|
7756
|
-
return
|
|
7757
|
-
}).curve(d3[curveStyle ||
|
|
7791
|
+
return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7792
|
+
}).curve(d3[curveStyle || _this43.options.curveStyle]);
|
|
7758
7793
|
};
|
|
7759
7794
|
|
|
7760
7795
|
var xAxis = 'bottomAxis';
|
|
@@ -7877,7 +7912,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7877
7912
|
}, {
|
|
7878
7913
|
key: "renderLabels",
|
|
7879
7914
|
value: function renderLabels(series, index) {
|
|
7880
|
-
var
|
|
7915
|
+
var _this44 = this;
|
|
7881
7916
|
|
|
7882
7917
|
/* global series index d3 WebsyDesigns */
|
|
7883
7918
|
var xAxis = 'bottomAxis';
|
|
@@ -7896,11 +7931,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7896
7931
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7897
7932
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7898
7933
|
labels.attr('x', function (d) {
|
|
7899
|
-
return getLabelX.call(
|
|
7934
|
+
return getLabelX.call(_this44, d, series.labelPosition);
|
|
7900
7935
|
}).attr('y', function (d) {
|
|
7901
|
-
return getLabelY.call(
|
|
7936
|
+
return getLabelY.call(_this44, d, series.labelPosition);
|
|
7902
7937
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7903
|
-
return
|
|
7938
|
+
return _this44.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7904
7939
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7905
7940
|
return d.y.label || d.y.value;
|
|
7906
7941
|
}).each(function (d, i) {
|
|
@@ -7925,11 +7960,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7925
7960
|
}
|
|
7926
7961
|
});
|
|
7927
7962
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
7928
|
-
return getLabelX.call(
|
|
7963
|
+
return getLabelX.call(_this44, d, series.labelPosition);
|
|
7929
7964
|
}).attr('y', function (d) {
|
|
7930
|
-
return getLabelY.call(
|
|
7965
|
+
return getLabelY.call(_this44, d, series.labelPosition);
|
|
7931
7966
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
7932
|
-
return
|
|
7967
|
+
return _this44.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7933
7968
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7934
7969
|
return d.y.label || d.y.value;
|
|
7935
7970
|
}).each(function (d, i) {
|
|
@@ -7986,16 +8021,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7986
8021
|
}, {
|
|
7987
8022
|
key: "renderline",
|
|
7988
8023
|
value: function renderline(series, index) {
|
|
7989
|
-
var
|
|
8024
|
+
var _this45 = this;
|
|
7990
8025
|
|
|
7991
8026
|
/* global series index d3 */
|
|
7992
8027
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7993
8028
|
return d3.line().x(function (d) {
|
|
7994
|
-
var adjustment =
|
|
7995
|
-
return
|
|
8029
|
+
var adjustment = _this45.options.data[xAxis].scale === 'Time' ? 0 : _this45["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8030
|
+
return _this45["".concat(xAxis, "Axis")](_this45.parseX(d.x.value)) + adjustment;
|
|
7996
8031
|
}).y(function (d) {
|
|
7997
|
-
return
|
|
7998
|
-
}).curve(d3[curveStyle ||
|
|
8032
|
+
return _this45["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8033
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7999
8034
|
};
|
|
8000
8035
|
|
|
8001
8036
|
var xAxis = 'bottom';
|
|
@@ -8039,14 +8074,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8039
8074
|
}, {
|
|
8040
8075
|
key: "rendersymbol",
|
|
8041
8076
|
value: function rendersymbol(series, index) {
|
|
8042
|
-
var
|
|
8077
|
+
var _this46 = this;
|
|
8043
8078
|
|
|
8044
8079
|
/* global d3 series index series.key */
|
|
8045
8080
|
var drawSymbol = function drawSymbol(size) {
|
|
8046
8081
|
return d3.symbol() // .type(d => {
|
|
8047
8082
|
// return d3.symbols[0]
|
|
8048
8083
|
// })
|
|
8049
|
-
.size(size ||
|
|
8084
|
+
.size(size || _this46.options.symbolSize);
|
|
8050
8085
|
};
|
|
8051
8086
|
|
|
8052
8087
|
var xAxis = 'bottomAxis';
|
|
@@ -8064,7 +8099,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8064
8099
|
symbols.attr('d', function (d) {
|
|
8065
8100
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8066
8101
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8067
|
-
return "translate(".concat(
|
|
8102
|
+
return "translate(".concat(_this46[xAxis](_this46.parseX(d.x.value)), ", ").concat(_this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8068
8103
|
}); // Enter
|
|
8069
8104
|
|
|
8070
8105
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8073,7 +8108,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8073
8108
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8074
8109
|
return "symbol symbol_".concat(series.key);
|
|
8075
8110
|
}).attr('transform', function (d) {
|
|
8076
|
-
return "translate(".concat(
|
|
8111
|
+
return "translate(".concat(_this46[xAxis](_this46.parseX(d.x.value)), ", ").concat(_this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8077
8112
|
});
|
|
8078
8113
|
}
|
|
8079
8114
|
}, {
|
|
@@ -8228,7 +8263,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8228
8263
|
}, {
|
|
8229
8264
|
key: "resize",
|
|
8230
8265
|
value: function resize() {
|
|
8231
|
-
var
|
|
8266
|
+
var _this47 = this;
|
|
8232
8267
|
|
|
8233
8268
|
var el = document.getElementById(this.elementId);
|
|
8234
8269
|
|
|
@@ -8241,7 +8276,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8241
8276
|
// }
|
|
8242
8277
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8243
8278
|
html += this._data.map(function (d, i) {
|
|
8244
|
-
return
|
|
8279
|
+
return _this47.getLegendItemHTML(d);
|
|
8245
8280
|
}).join('');
|
|
8246
8281
|
html += "\n <div>\n ";
|
|
8247
8282
|
el.innerHTML = html;
|
|
@@ -8413,7 +8448,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8413
8448
|
}, {
|
|
8414
8449
|
key: "render",
|
|
8415
8450
|
value: function render() {
|
|
8416
|
-
var
|
|
8451
|
+
var _this48 = this;
|
|
8417
8452
|
|
|
8418
8453
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8419
8454
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8422,7 +8457,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8422
8457
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8423
8458
|
return {
|
|
8424
8459
|
value: s.label || s.key,
|
|
8425
|
-
color: s.color ||
|
|
8460
|
+
color: s.color || _this48.options.colors[i % _this48.options.colors.length]
|
|
8426
8461
|
};
|
|
8427
8462
|
});
|
|
8428
8463
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8486,7 +8521,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8486
8521
|
|
|
8487
8522
|
if (this.polygons) {
|
|
8488
8523
|
this.polygons.forEach(function (p) {
|
|
8489
|
-
return
|
|
8524
|
+
return _this48.map.removeLayer(p);
|
|
8490
8525
|
});
|
|
8491
8526
|
}
|
|
8492
8527
|
|
|
@@ -8544,18 +8579,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8544
8579
|
}
|
|
8545
8580
|
|
|
8546
8581
|
if (!p.options.color) {
|
|
8547
|
-
p.options.color =
|
|
8582
|
+
p.options.color = _this48.options.colors[i % _this48.options.colors.length];
|
|
8548
8583
|
}
|
|
8549
8584
|
|
|
8550
8585
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8551
8586
|
return c.map(function (d) {
|
|
8552
8587
|
return [d.Latitude, d.Longitude];
|
|
8553
8588
|
});
|
|
8554
|
-
}), p.options).addTo(
|
|
8589
|
+
}), p.options).addTo(_this48.map);
|
|
8555
8590
|
|
|
8556
|
-
|
|
8591
|
+
_this48.polygons.push(pol);
|
|
8557
8592
|
|
|
8558
|
-
|
|
8593
|
+
_this48.map.fitBounds(pol.getBounds());
|
|
8559
8594
|
});
|
|
8560
8595
|
} // if (this.data.markers.length > 0) {
|
|
8561
8596
|
// el.classList.remove('hidden')
|