@websy/websy-designs 1.0.1 → 1.0.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/server/routes/v1/shop.js +11 -1
- package/dist/server/websy-designs-server.js +0 -1
- package/dist/websy-designs.debug.js +83 -28
- package/dist/websy-designs.js +154 -88
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
- package/dist/server/helpers/v1/puppeteer-report/examples/package-lock.json +0 -972
package/dist/websy-designs.js
CHANGED
|
@@ -1172,11 +1172,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1172
1172
|
}, {
|
|
1173
1173
|
key: "handleClick",
|
|
1174
1174
|
value: function handleClick(event) {
|
|
1175
|
-
event.preventDefault();
|
|
1176
|
-
|
|
1177
1175
|
if (event.target.classList.contains('submit')) {
|
|
1176
|
+
event.preventDefault();
|
|
1178
1177
|
this.submitForm();
|
|
1179
1178
|
} else if (event.target.classList.contains('cancel')) {
|
|
1179
|
+
event.preventDefault();
|
|
1180
1180
|
this.cancelForm();
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
@@ -2676,18 +2676,6 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2676
2676
|
this.previousPath = this.groups[group].activeView;
|
|
2677
2677
|
}
|
|
2678
2678
|
|
|
2679
|
-
if (toggle === true) {
|
|
2680
|
-
if (this.previousPath !== '') {
|
|
2681
|
-
this.hideView(this.previousPath, group);
|
|
2682
|
-
}
|
|
2683
|
-
} else {
|
|
2684
|
-
this.hideView(this.previousView, group);
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
if (toggle === true && newPath === groupActiveView) {
|
|
2688
|
-
return;
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
2679
|
if (group && this.groups[group] && group !== this.options.defaultGroup) {
|
|
2692
2680
|
this.groups[group].activeView = newPath;
|
|
2693
2681
|
}
|
|
@@ -2708,6 +2696,18 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2708
2696
|
this.currentViewMain = this.options.defaultView;
|
|
2709
2697
|
}
|
|
2710
2698
|
|
|
2699
|
+
if (toggle === true) {
|
|
2700
|
+
if (this.previousPath !== '') {
|
|
2701
|
+
this.hideView(this.previousPath, group);
|
|
2702
|
+
}
|
|
2703
|
+
} else {
|
|
2704
|
+
this.hideView(this.previousView, group);
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
if (toggle === true && newPath === groupActiveView) {
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
2711
|
if (toggle === false) {
|
|
2712
2712
|
this.showView(this.currentView, this.currentParams);
|
|
2713
2713
|
} else if (newPath && newPath !== '') {
|
|
@@ -3300,10 +3300,13 @@ var WebsyUtils = {
|
|
|
3300
3300
|
|
|
3301
3301
|
var WebsyTable = /*#__PURE__*/function () {
|
|
3302
3302
|
function WebsyTable(elementId, options) {
|
|
3303
|
+
var _this20 = this;
|
|
3304
|
+
|
|
3303
3305
|
_classCallCheck(this, WebsyTable);
|
|
3304
3306
|
|
|
3305
3307
|
var DEFAULTS = {
|
|
3306
|
-
pageSize: 20
|
|
3308
|
+
pageSize: 20,
|
|
3309
|
+
paging: 'scroll'
|
|
3307
3310
|
};
|
|
3308
3311
|
this.elementId = elementId;
|
|
3309
3312
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -3314,7 +3317,34 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3314
3317
|
var el = document.getElementById(this.elementId);
|
|
3315
3318
|
|
|
3316
3319
|
if (el) {
|
|
3317
|
-
|
|
3320
|
+
var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table ").concat(this.options.paging === 'pages' ? 'with-paging' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <table>\n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n <tfoot id=\"").concat(this.elementId, "_foot\">\n </tfoot>\n </table> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
|
|
3321
|
+
|
|
3322
|
+
if (this.options.paging === 'pages') {
|
|
3323
|
+
html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
var pageOptions = [10, 20, 50, 100, 200];
|
|
3327
|
+
el.innerHTML = html;
|
|
3328
|
+
|
|
3329
|
+
if (this.options.paging === 'pages') {
|
|
3330
|
+
this.pageSizeSelector = new WebsyDesigns.Dropdown("".concat(this.elementId, "_pageSizeSelector"), {
|
|
3331
|
+
selectedItems: [pageOptions.indexOf(this.options.pageSize)],
|
|
3332
|
+
items: pageOptions.map(function (p) {
|
|
3333
|
+
return {
|
|
3334
|
+
label: p.toString(),
|
|
3335
|
+
value: p
|
|
3336
|
+
};
|
|
3337
|
+
}),
|
|
3338
|
+
allowClear: false,
|
|
3339
|
+
disableSearch: true,
|
|
3340
|
+
onItemSelected: function onItemSelected(selectedItem) {
|
|
3341
|
+
if (_this20.options.onChangePageSize) {
|
|
3342
|
+
_this20.options.onChangePageSize(selectedItem.value);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3318
3348
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
3319
3349
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
3320
3350
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
@@ -3330,7 +3360,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3330
3360
|
_createClass(WebsyTable, [{
|
|
3331
3361
|
key: "appendRows",
|
|
3332
3362
|
value: function appendRows(data) {
|
|
3333
|
-
var
|
|
3363
|
+
var _this21 = this;
|
|
3334
3364
|
|
|
3335
3365
|
this.hideError();
|
|
3336
3366
|
var bodyHTML = '';
|
|
@@ -3338,15 +3368,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3338
3368
|
if (data) {
|
|
3339
3369
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
3340
3370
|
return '<tr>' + r.map(function (c, i) {
|
|
3341
|
-
if (
|
|
3371
|
+
if (_this21.options.columns[i].show !== false) {
|
|
3342
3372
|
var style = '';
|
|
3343
3373
|
|
|
3344
3374
|
if (c.style) {
|
|
3345
3375
|
style += c.style;
|
|
3346
3376
|
}
|
|
3347
3377
|
|
|
3348
|
-
if (
|
|
3349
|
-
style += "width: ".concat(
|
|
3378
|
+
if (_this21.options.columns[i].width) {
|
|
3379
|
+
style += "width: ".concat(_this21.options.columns[i].width, "; ");
|
|
3350
3380
|
}
|
|
3351
3381
|
|
|
3352
3382
|
if (c.backgroundColor) {
|
|
@@ -3357,18 +3387,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3357
3387
|
style += "color: ".concat(c.color, "; ");
|
|
3358
3388
|
}
|
|
3359
3389
|
|
|
3360
|
-
if (
|
|
3361
|
-
return "\n <td \n data-row-index='".concat(
|
|
3362
|
-
} else if ((
|
|
3363
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
3390
|
+
if (_this21.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
3391
|
+
return "\n <td \n data-row-index='".concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this21.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this21.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this21.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
3392
|
+
} else if ((_this21.options.columns[i].showAsNavigatorLink === true || _this21.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
3393
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this21.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this21.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this21.options.columns[i].linkText || c.value, "</td>\n ");
|
|
3364
3394
|
} else {
|
|
3365
3395
|
var info = c.value;
|
|
3366
3396
|
|
|
3367
|
-
if (
|
|
3397
|
+
if (_this21.options.columns[i].showAsImage === true) {
|
|
3368
3398
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
3369
3399
|
}
|
|
3370
3400
|
|
|
3371
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
3401
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this21.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
3372
3402
|
}
|
|
3373
3403
|
}
|
|
3374
3404
|
}).join('') + '</tr>';
|
|
@@ -3432,6 +3462,12 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3432
3462
|
if (this.options.onClick) {
|
|
3433
3463
|
this.options.onClick(event, this.data[rowIndex][_colIndex], this.data[rowIndex], this.options.columns[_colIndex]);
|
|
3434
3464
|
}
|
|
3465
|
+
} else if (event.target.classList.contains('websy-page-num')) {
|
|
3466
|
+
var pageNum = +event.target.getAttribute('data-page');
|
|
3467
|
+
|
|
3468
|
+
if (this.options.onSetPage) {
|
|
3469
|
+
this.options.onSetPage(pageNum);
|
|
3470
|
+
}
|
|
3435
3471
|
}
|
|
3436
3472
|
}
|
|
3437
3473
|
}, {
|
|
@@ -3459,7 +3495,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3459
3495
|
}, {
|
|
3460
3496
|
key: "handleScroll",
|
|
3461
3497
|
value: function handleScroll(event) {
|
|
3462
|
-
if (this.options.onScroll) {
|
|
3498
|
+
if (this.options.onScroll && this.options.paging === 'scroll') {
|
|
3463
3499
|
this.options.onScroll(event);
|
|
3464
3500
|
}
|
|
3465
3501
|
}
|
|
@@ -3521,7 +3557,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3521
3557
|
}, {
|
|
3522
3558
|
key: "render",
|
|
3523
3559
|
value: function render(data) {
|
|
3524
|
-
var
|
|
3560
|
+
var _this22 = this;
|
|
3525
3561
|
|
|
3526
3562
|
if (!this.options.columns) {
|
|
3527
3563
|
return;
|
|
@@ -3546,18 +3582,48 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3546
3582
|
|
|
3547
3583
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
3548
3584
|
if (c.show !== false) {
|
|
3549
|
-
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ?
|
|
3585
|
+
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this22.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
3550
3586
|
}
|
|
3551
3587
|
}).join('') + '</tr>';
|
|
3552
3588
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
3553
|
-
headEl.innerHTML = headHTML;
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3589
|
+
headEl.innerHTML = headHTML; // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
|
|
3590
|
+
// if (c.show !== false) {
|
|
3591
|
+
// return `
|
|
3592
|
+
// <th></th>
|
|
3593
|
+
// `
|
|
3594
|
+
// }
|
|
3595
|
+
// }).join('') + '</tr>'
|
|
3596
|
+
// const footEl = document.getElementById(`${this.elementId}_foot`)
|
|
3597
|
+
// footEl.innerHTML = footHTML
|
|
3598
|
+
|
|
3599
|
+
if (this.options.paging === 'pages') {
|
|
3600
|
+
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3601
|
+
|
|
3602
|
+
if (pagingEl) {
|
|
3603
|
+
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
3604
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3605
|
+
});
|
|
3606
|
+
var startIndex = 0;
|
|
3607
|
+
|
|
3608
|
+
if (this.options.pageCount > 8) {
|
|
3609
|
+
startIndex = Math.max(0, this.options.pageNum - 4);
|
|
3610
|
+
pages = pages.splice(startIndex, 10);
|
|
3611
|
+
|
|
3612
|
+
if (startIndex > 0) {
|
|
3613
|
+
pages.splice(0, 0, "<li>Page </li><li data-page=\"0\" class=\"websy-page-num\">First</li><li>...</li>");
|
|
3614
|
+
} else {
|
|
3615
|
+
pages.splice(0, 0, '<li>Page </li>');
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
if (this.options.pageNum < this.options.pageCount - 1) {
|
|
3619
|
+
pages.push('<li>...</li>');
|
|
3620
|
+
pages.push("<li data-page=\"".concat(this.options.pageCount - 1, "\" class=\"websy-page-num\">Last</li>"));
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
pagingEl.innerHTML = pages.join('');
|
|
3557
3625
|
}
|
|
3558
|
-
}
|
|
3559
|
-
var footEl = document.getElementById("".concat(this.elementId, "_foot"));
|
|
3560
|
-
footEl.innerHTML = footHTML;
|
|
3626
|
+
}
|
|
3561
3627
|
|
|
3562
3628
|
if (data) {
|
|
3563
3629
|
// this.data = this.data.concat(data)
|
|
@@ -3603,7 +3669,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3603
3669
|
|
|
3604
3670
|
var WebsyChart = /*#__PURE__*/function () {
|
|
3605
3671
|
function WebsyChart(elementId, options) {
|
|
3606
|
-
var
|
|
3672
|
+
var _this23 = this;
|
|
3607
3673
|
|
|
3608
3674
|
_classCallCheck(this, WebsyChart);
|
|
3609
3675
|
|
|
@@ -3651,22 +3717,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3651
3717
|
this.invertOverride = function (input, input2) {
|
|
3652
3718
|
var xAxis = 'bottomAxis';
|
|
3653
3719
|
|
|
3654
|
-
if (
|
|
3720
|
+
if (_this23.options.orientation === 'horizontal') {
|
|
3655
3721
|
xAxis = 'leftAxis';
|
|
3656
3722
|
}
|
|
3657
3723
|
|
|
3658
|
-
var width =
|
|
3724
|
+
var width = _this23[xAxis].step();
|
|
3659
3725
|
|
|
3660
3726
|
var output;
|
|
3661
3727
|
|
|
3662
|
-
var domain = _toConsumableArray(
|
|
3728
|
+
var domain = _toConsumableArray(_this23[xAxis].domain());
|
|
3663
3729
|
|
|
3664
|
-
if (
|
|
3730
|
+
if (_this23.options.orientation === 'horizontal') {
|
|
3665
3731
|
domain = domain.reverse();
|
|
3666
3732
|
}
|
|
3667
3733
|
|
|
3668
3734
|
for (var j = 0; j < domain.length; j++) {
|
|
3669
|
-
var breakA =
|
|
3735
|
+
var breakA = _this23[xAxis](domain[j]) - width / 2;
|
|
3670
3736
|
var breakB = breakA + width;
|
|
3671
3737
|
|
|
3672
3738
|
if (input > breakA && input <= breakB) {
|
|
@@ -3766,10 +3832,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3766
3832
|
}, {
|
|
3767
3833
|
key: "handleEventMouseMove",
|
|
3768
3834
|
value: function handleEventMouseMove(event, d) {
|
|
3769
|
-
var
|
|
3835
|
+
var _this24 = this;
|
|
3770
3836
|
|
|
3771
3837
|
var bisectDate = d3.bisector(function (d) {
|
|
3772
|
-
return
|
|
3838
|
+
return _this24.parseX(d.x.value);
|
|
3773
3839
|
}).left;
|
|
3774
3840
|
|
|
3775
3841
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -3808,8 +3874,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3808
3874
|
}
|
|
3809
3875
|
|
|
3810
3876
|
this.options.data.series.forEach(function (s) {
|
|
3811
|
-
if (
|
|
3812
|
-
xPoint =
|
|
3877
|
+
if (_this24.options.data[xData].scale !== 'Time') {
|
|
3878
|
+
xPoint = _this24[xAxis](_this24.parseX(xLabel));
|
|
3813
3879
|
s.data.forEach(function (d) {
|
|
3814
3880
|
if (d.x.value === xLabel) {
|
|
3815
3881
|
if (!d.y.color) {
|
|
@@ -3824,13 +3890,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3824
3890
|
var pointA = s.data[index - 1];
|
|
3825
3891
|
var pointB = s.data[index];
|
|
3826
3892
|
|
|
3827
|
-
if (
|
|
3893
|
+
if (_this24.options.orientation === 'horizontal') {
|
|
3828
3894
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
3829
3895
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
3830
3896
|
}
|
|
3831
3897
|
|
|
3832
3898
|
if (pointA && !pointB) {
|
|
3833
|
-
xPoint =
|
|
3899
|
+
xPoint = _this24[xAxis](_this24.parseX(pointA.x.value));
|
|
3834
3900
|
tooltipTitle = pointA.x.value;
|
|
3835
3901
|
|
|
3836
3902
|
if (!pointA.y.color) {
|
|
@@ -3840,12 +3906,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3840
3906
|
tooltipData.push(pointA.y);
|
|
3841
3907
|
|
|
3842
3908
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
3843
|
-
tooltipTitle = d3.timeFormat(
|
|
3909
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
3844
3910
|
}
|
|
3845
3911
|
}
|
|
3846
3912
|
|
|
3847
3913
|
if (pointB && !pointA) {
|
|
3848
|
-
xPoint =
|
|
3914
|
+
xPoint = _this24[xAxis](_this24.parseX(pointB.x.value));
|
|
3849
3915
|
tooltipTitle = pointB.x.value;
|
|
3850
3916
|
|
|
3851
3917
|
if (!pointB.y.color) {
|
|
@@ -3855,14 +3921,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3855
3921
|
tooltipData.push(pointB.y);
|
|
3856
3922
|
|
|
3857
3923
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
3858
|
-
tooltipTitle = d3.timeFormat(
|
|
3924
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
3859
3925
|
}
|
|
3860
3926
|
}
|
|
3861
3927
|
|
|
3862
3928
|
if (pointA && pointB) {
|
|
3863
|
-
var d0 =
|
|
3929
|
+
var d0 = _this24[xAxis](_this24.parseX(pointA.x.value));
|
|
3864
3930
|
|
|
3865
|
-
var d1 =
|
|
3931
|
+
var d1 = _this24[xAxis](_this24.parseX(pointB.x.value));
|
|
3866
3932
|
|
|
3867
3933
|
var mid = Math.abs(d0 - d1) / 2;
|
|
3868
3934
|
|
|
@@ -3871,7 +3937,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3871
3937
|
tooltipTitle = pointB.x.value;
|
|
3872
3938
|
|
|
3873
3939
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
3874
|
-
tooltipTitle = d3.timeFormat(
|
|
3940
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
3875
3941
|
}
|
|
3876
3942
|
|
|
3877
3943
|
if (!pointB.y.color) {
|
|
@@ -3884,7 +3950,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3884
3950
|
tooltipTitle = pointA.x.value;
|
|
3885
3951
|
|
|
3886
3952
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
3887
|
-
tooltipTitle = d3.timeFormat(
|
|
3953
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
3888
3954
|
}
|
|
3889
3955
|
|
|
3890
3956
|
if (!pointA.y.color) {
|
|
@@ -3989,7 +4055,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3989
4055
|
}, {
|
|
3990
4056
|
key: "render",
|
|
3991
4057
|
value: function render(options) {
|
|
3992
|
-
var
|
|
4058
|
+
var _this25 = this;
|
|
3993
4059
|
|
|
3994
4060
|
/* global d3 options */
|
|
3995
4061
|
if (typeof options !== 'undefined') {
|
|
@@ -4058,7 +4124,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4058
4124
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
4059
4125
|
return {
|
|
4060
4126
|
value: s.label || s.key,
|
|
4061
|
-
color: s.color ||
|
|
4127
|
+
color: s.color || _this25.options.colors[i % _this25.options.colors.length]
|
|
4062
4128
|
};
|
|
4063
4129
|
});
|
|
4064
4130
|
|
|
@@ -4297,7 +4363,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4297
4363
|
|
|
4298
4364
|
if (this.options.data.bottom.formatter) {
|
|
4299
4365
|
bAxisFunc.tickFormat(function (d) {
|
|
4300
|
-
return
|
|
4366
|
+
return _this25.options.data.bottom.formatter(d);
|
|
4301
4367
|
});
|
|
4302
4368
|
}
|
|
4303
4369
|
|
|
@@ -4324,8 +4390,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4324
4390
|
|
|
4325
4391
|
if (this.options.margin.axisLeft > 0) {
|
|
4326
4392
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
4327
|
-
if (
|
|
4328
|
-
d =
|
|
4393
|
+
if (_this25.options.data.left.formatter) {
|
|
4394
|
+
d = _this25.options.data.left.formatter(d);
|
|
4329
4395
|
}
|
|
4330
4396
|
|
|
4331
4397
|
return d;
|
|
@@ -4362,8 +4428,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4362
4428
|
|
|
4363
4429
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
4364
4430
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
4365
|
-
if (
|
|
4366
|
-
d =
|
|
4431
|
+
if (_this25.options.data.right.formatter) {
|
|
4432
|
+
d = _this25.options.data.right.formatter(d);
|
|
4367
4433
|
}
|
|
4368
4434
|
|
|
4369
4435
|
return d;
|
|
@@ -4389,16 +4455,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4389
4455
|
|
|
4390
4456
|
this.options.data.series.forEach(function (series, index) {
|
|
4391
4457
|
if (!series.key) {
|
|
4392
|
-
series.key =
|
|
4458
|
+
series.key = _this25.createIdentity();
|
|
4393
4459
|
}
|
|
4394
4460
|
|
|
4395
4461
|
if (!series.color) {
|
|
4396
|
-
series.color =
|
|
4462
|
+
series.color = _this25.options.colors[index % _this25.options.colors.length];
|
|
4397
4463
|
}
|
|
4398
4464
|
|
|
4399
|
-
|
|
4465
|
+
_this25["render".concat(series.type || 'bar')](series, index);
|
|
4400
4466
|
|
|
4401
|
-
|
|
4467
|
+
_this25.renderLabels(series, index);
|
|
4402
4468
|
});
|
|
4403
4469
|
}
|
|
4404
4470
|
}
|
|
@@ -4406,17 +4472,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4406
4472
|
}, {
|
|
4407
4473
|
key: "renderarea",
|
|
4408
4474
|
value: function renderarea(series, index) {
|
|
4409
|
-
var
|
|
4475
|
+
var _this26 = this;
|
|
4410
4476
|
|
|
4411
4477
|
/* global d3 series index */
|
|
4412
4478
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
4413
4479
|
return d3.area().x(function (d) {
|
|
4414
|
-
return
|
|
4480
|
+
return _this26[xAxis](_this26.parseX(d.x.value));
|
|
4415
4481
|
}).y0(function (d) {
|
|
4416
|
-
return
|
|
4482
|
+
return _this26[yAxis](0);
|
|
4417
4483
|
}).y1(function (d) {
|
|
4418
|
-
return
|
|
4419
|
-
}).curve(d3[curveStyle ||
|
|
4484
|
+
return _this26[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
4485
|
+
}).curve(d3[curveStyle || _this26.options.curveStyle]);
|
|
4420
4486
|
};
|
|
4421
4487
|
|
|
4422
4488
|
var xAxis = 'bottomAxis';
|
|
@@ -4589,15 +4655,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4589
4655
|
}, {
|
|
4590
4656
|
key: "renderline",
|
|
4591
4657
|
value: function renderline(series, index) {
|
|
4592
|
-
var
|
|
4658
|
+
var _this27 = this;
|
|
4593
4659
|
|
|
4594
4660
|
/* global series index d3 */
|
|
4595
4661
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
4596
4662
|
return d3.line().x(function (d) {
|
|
4597
|
-
return
|
|
4663
|
+
return _this27[xAxis](_this27.parseX(d.x.value));
|
|
4598
4664
|
}).y(function (d) {
|
|
4599
|
-
return
|
|
4600
|
-
}).curve(d3[curveStyle ||
|
|
4665
|
+
return _this27[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
4666
|
+
}).curve(d3[curveStyle || _this27.options.curveStyle]);
|
|
4601
4667
|
};
|
|
4602
4668
|
|
|
4603
4669
|
var xAxis = 'bottomAxis';
|
|
@@ -4635,14 +4701,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4635
4701
|
}, {
|
|
4636
4702
|
key: "rendersymbol",
|
|
4637
4703
|
value: function rendersymbol(series, index) {
|
|
4638
|
-
var
|
|
4704
|
+
var _this28 = this;
|
|
4639
4705
|
|
|
4640
4706
|
/* global d3 series index series.key */
|
|
4641
4707
|
var drawSymbol = function drawSymbol(size) {
|
|
4642
4708
|
return d3.symbol() // .type(d => {
|
|
4643
4709
|
// return d3.symbols[0]
|
|
4644
4710
|
// })
|
|
4645
|
-
.size(size ||
|
|
4711
|
+
.size(size || _this28.options.symbolSize);
|
|
4646
4712
|
};
|
|
4647
4713
|
|
|
4648
4714
|
var xAxis = 'bottomAxis';
|
|
@@ -4660,7 +4726,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4660
4726
|
symbols.attr('d', function (d) {
|
|
4661
4727
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
4662
4728
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
4663
|
-
return "translate(".concat(
|
|
4729
|
+
return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
4664
4730
|
}); // Enter
|
|
4665
4731
|
|
|
4666
4732
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -4669,7 +4735,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4669
4735
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
4670
4736
|
return "symbol symbol_".concat(series.key);
|
|
4671
4737
|
}).attr('transform', function (d) {
|
|
4672
|
-
return "translate(".concat(
|
|
4738
|
+
return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
4673
4739
|
});
|
|
4674
4740
|
}
|
|
4675
4741
|
}, {
|
|
@@ -4824,7 +4890,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
4824
4890
|
}, {
|
|
4825
4891
|
key: "resize",
|
|
4826
4892
|
value: function resize() {
|
|
4827
|
-
var
|
|
4893
|
+
var _this29 = this;
|
|
4828
4894
|
|
|
4829
4895
|
var el = document.getElementById(this.elementId);
|
|
4830
4896
|
|
|
@@ -4837,7 +4903,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
4837
4903
|
// }
|
|
4838
4904
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
4839
4905
|
html += this._data.map(function (d, i) {
|
|
4840
|
-
return
|
|
4906
|
+
return _this29.getLegendItemHTML(d);
|
|
4841
4907
|
}).join('');
|
|
4842
4908
|
html += "\n <div>\n ";
|
|
4843
4909
|
el.innerHTML = html;
|
|
@@ -5010,7 +5076,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
5010
5076
|
}, {
|
|
5011
5077
|
key: "render",
|
|
5012
5078
|
value: function render() {
|
|
5013
|
-
var
|
|
5079
|
+
var _this30 = this;
|
|
5014
5080
|
|
|
5015
5081
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
5016
5082
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -5019,7 +5085,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
5019
5085
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
5020
5086
|
return {
|
|
5021
5087
|
value: s.label || s.key,
|
|
5022
|
-
color: s.color ||
|
|
5088
|
+
color: s.color || _this30.options.colors[i % _this30.options.colors.length]
|
|
5023
5089
|
};
|
|
5024
5090
|
});
|
|
5025
5091
|
var longestValue = legendData.map(function (s) {
|
|
@@ -5083,7 +5149,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
5083
5149
|
|
|
5084
5150
|
if (this.polygons) {
|
|
5085
5151
|
this.polygons.forEach(function (p) {
|
|
5086
|
-
return
|
|
5152
|
+
return _this30.map.removeLayer(p);
|
|
5087
5153
|
});
|
|
5088
5154
|
}
|
|
5089
5155
|
|
|
@@ -5141,18 +5207,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
5141
5207
|
}
|
|
5142
5208
|
|
|
5143
5209
|
if (!p.options.color) {
|
|
5144
|
-
p.options.color =
|
|
5210
|
+
p.options.color = _this30.options.colors[i % _this30.options.colors.length];
|
|
5145
5211
|
}
|
|
5146
5212
|
|
|
5147
5213
|
var pol = L.polygon(p.data.map(function (c) {
|
|
5148
5214
|
return c.map(function (d) {
|
|
5149
5215
|
return [d.Latitude, d.Longitude];
|
|
5150
5216
|
});
|
|
5151
|
-
}), p.options).addTo(
|
|
5217
|
+
}), p.options).addTo(_this30.map);
|
|
5152
5218
|
|
|
5153
|
-
|
|
5219
|
+
_this30.polygons.push(pol);
|
|
5154
5220
|
|
|
5155
|
-
|
|
5221
|
+
_this30.map.fitBounds(pol.getBounds());
|
|
5156
5222
|
});
|
|
5157
5223
|
} // if (this.data.markers.length > 0) {
|
|
5158
5224
|
// el.classList.remove('hidden')
|