@websy/websy-designs 1.0.0 → 1.0.3
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 +13 -3
- package/dist/server/websy-designs-server.js +0 -1
- package/dist/websy-designs.debug.js +132 -30
- package/dist/websy-designs.js +211 -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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
3
8
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
9
|
|
|
5
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -1172,11 +1177,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1172
1177
|
}, {
|
|
1173
1178
|
key: "handleClick",
|
|
1174
1179
|
value: function handleClick(event) {
|
|
1175
|
-
event.preventDefault();
|
|
1176
|
-
|
|
1177
1180
|
if (event.target.classList.contains('submit')) {
|
|
1181
|
+
event.preventDefault();
|
|
1178
1182
|
this.submitForm();
|
|
1179
1183
|
} else if (event.target.classList.contains('cancel')) {
|
|
1184
|
+
event.preventDefault();
|
|
1180
1185
|
this.cancelForm();
|
|
1181
1186
|
}
|
|
1182
1187
|
}
|
|
@@ -2676,18 +2681,6 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2676
2681
|
this.previousPath = this.groups[group].activeView;
|
|
2677
2682
|
}
|
|
2678
2683
|
|
|
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
2684
|
if (group && this.groups[group] && group !== this.options.defaultGroup) {
|
|
2692
2685
|
this.groups[group].activeView = newPath;
|
|
2693
2686
|
}
|
|
@@ -2708,6 +2701,18 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2708
2701
|
this.currentViewMain = this.options.defaultView;
|
|
2709
2702
|
}
|
|
2710
2703
|
|
|
2704
|
+
if (toggle === true) {
|
|
2705
|
+
if (this.previousPath !== '') {
|
|
2706
|
+
this.hideView(this.previousPath, group);
|
|
2707
|
+
}
|
|
2708
|
+
} else {
|
|
2709
|
+
this.hideView(this.previousView, group);
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
if (toggle === true && newPath === groupActiveView) {
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2711
2716
|
if (toggle === false) {
|
|
2712
2717
|
this.showView(this.currentView, this.currentParams);
|
|
2713
2718
|
} else if (newPath && newPath !== '') {
|
|
@@ -3296,13 +3301,17 @@ var WebsyUtils = {
|
|
|
3296
3301
|
return Math.floor(d.getTime() / 86400000 + 25570);
|
|
3297
3302
|
}
|
|
3298
3303
|
};
|
|
3304
|
+
/* global WebsyDesigns */
|
|
3299
3305
|
|
|
3300
3306
|
var WebsyTable = /*#__PURE__*/function () {
|
|
3301
3307
|
function WebsyTable(elementId, options) {
|
|
3308
|
+
var _this20 = this;
|
|
3309
|
+
|
|
3302
3310
|
_classCallCheck(this, WebsyTable);
|
|
3303
3311
|
|
|
3304
3312
|
var DEFAULTS = {
|
|
3305
|
-
pageSize: 20
|
|
3313
|
+
pageSize: 20,
|
|
3314
|
+
paging: 'scroll'
|
|
3306
3315
|
};
|
|
3307
3316
|
this.elementId = elementId;
|
|
3308
3317
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -3313,12 +3322,40 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3313
3322
|
var el = document.getElementById(this.elementId);
|
|
3314
3323
|
|
|
3315
3324
|
if (el) {
|
|
3316
|
-
|
|
3325
|
+
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 ");
|
|
3326
|
+
|
|
3327
|
+
if (this.options.paging === 'pages') {
|
|
3328
|
+
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 ");
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
var pageOptions = [10, 20, 50, 100, 200];
|
|
3332
|
+
el.innerHTML = html;
|
|
3333
|
+
|
|
3334
|
+
if (this.options.paging === 'pages') {
|
|
3335
|
+
this.pageSizeSelector = new WebsyDesigns.Dropdown("".concat(this.elementId, "_pageSizeSelector"), {
|
|
3336
|
+
selectedItems: [pageOptions.indexOf(this.options.pageSize)],
|
|
3337
|
+
items: pageOptions.map(function (p) {
|
|
3338
|
+
return {
|
|
3339
|
+
label: p.toString(),
|
|
3340
|
+
value: p
|
|
3341
|
+
};
|
|
3342
|
+
}),
|
|
3343
|
+
allowClear: false,
|
|
3344
|
+
disableSearch: true,
|
|
3345
|
+
onItemSelected: function onItemSelected(selectedItem) {
|
|
3346
|
+
if (_this20.options.onChangePageSize) {
|
|
3347
|
+
_this20.options.onChangePageSize(selectedItem.value);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3317
3353
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
3318
3354
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
3319
3355
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
3320
3356
|
var scrollEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
3321
3357
|
scrollEl.addEventListener('scroll', this.handleScroll.bind(this));
|
|
3358
|
+
this.loadingDialog = new WebsyDesigns.LoadingDialog("".concat(this.elementId, "_loadingContainer"));
|
|
3322
3359
|
this.render();
|
|
3323
3360
|
} else {
|
|
3324
3361
|
console.error("No element found with ID ".concat(this.elementId));
|
|
@@ -3328,22 +3365,23 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3328
3365
|
_createClass(WebsyTable, [{
|
|
3329
3366
|
key: "appendRows",
|
|
3330
3367
|
value: function appendRows(data) {
|
|
3331
|
-
var
|
|
3368
|
+
var _this21 = this;
|
|
3332
3369
|
|
|
3370
|
+
this.hideError();
|
|
3333
3371
|
var bodyHTML = '';
|
|
3334
3372
|
|
|
3335
3373
|
if (data) {
|
|
3336
3374
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
3337
3375
|
return '<tr>' + r.map(function (c, i) {
|
|
3338
|
-
if (
|
|
3376
|
+
if (_this21.options.columns[i].show !== false) {
|
|
3339
3377
|
var style = '';
|
|
3340
3378
|
|
|
3341
3379
|
if (c.style) {
|
|
3342
3380
|
style += c.style;
|
|
3343
3381
|
}
|
|
3344
3382
|
|
|
3345
|
-
if (
|
|
3346
|
-
style += "width: ".concat(
|
|
3383
|
+
if (_this21.options.columns[i].width) {
|
|
3384
|
+
style += "width: ".concat(_this21.options.columns[i].width, "; ");
|
|
3347
3385
|
}
|
|
3348
3386
|
|
|
3349
3387
|
if (c.backgroundColor) {
|
|
@@ -3354,18 +3392,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3354
3392
|
style += "color: ".concat(c.color, "; ");
|
|
3355
3393
|
}
|
|
3356
3394
|
|
|
3357
|
-
if (
|
|
3358
|
-
return "\n <td \n data-row-index='".concat(
|
|
3359
|
-
} else if (
|
|
3360
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
3395
|
+
if (_this21.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
3396
|
+
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 ");
|
|
3397
|
+
} else if ((_this21.options.columns[i].showAsNavigatorLink === true || _this21.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
3398
|
+
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 ");
|
|
3361
3399
|
} else {
|
|
3362
3400
|
var info = c.value;
|
|
3363
3401
|
|
|
3364
|
-
if (
|
|
3402
|
+
if (_this21.options.columns[i].showAsImage === true) {
|
|
3365
3403
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
3366
3404
|
}
|
|
3367
3405
|
|
|
3368
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
3406
|
+
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 ");
|
|
3369
3407
|
}
|
|
3370
3408
|
}
|
|
3371
3409
|
}).join('') + '</tr>';
|
|
@@ -3429,6 +3467,12 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3429
3467
|
if (this.options.onClick) {
|
|
3430
3468
|
this.options.onClick(event, this.data[rowIndex][_colIndex], this.data[rowIndex], this.options.columns[_colIndex]);
|
|
3431
3469
|
}
|
|
3470
|
+
} else if (event.target.classList.contains('websy-page-num')) {
|
|
3471
|
+
var pageNum = +event.target.getAttribute('data-page');
|
|
3472
|
+
|
|
3473
|
+
if (this.options.onSetPage) {
|
|
3474
|
+
this.options.onSetPage(pageNum);
|
|
3475
|
+
}
|
|
3432
3476
|
}
|
|
3433
3477
|
}
|
|
3434
3478
|
}, {
|
|
@@ -3456,10 +3500,24 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3456
3500
|
}, {
|
|
3457
3501
|
key: "handleScroll",
|
|
3458
3502
|
value: function handleScroll(event) {
|
|
3459
|
-
if (this.options.onScroll) {
|
|
3503
|
+
if (this.options.onScroll && this.options.paging === 'scroll') {
|
|
3460
3504
|
this.options.onScroll(event);
|
|
3461
3505
|
}
|
|
3462
3506
|
}
|
|
3507
|
+
}, {
|
|
3508
|
+
key: "hideError",
|
|
3509
|
+
value: function hideError() {
|
|
3510
|
+
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
3511
|
+
|
|
3512
|
+
if (containerEl) {
|
|
3513
|
+
containerEl.classList.remove('active');
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
}, {
|
|
3517
|
+
key: "hideLoading",
|
|
3518
|
+
value: function hideLoading() {
|
|
3519
|
+
this.loadingDialog.hide();
|
|
3520
|
+
}
|
|
3463
3521
|
}, {
|
|
3464
3522
|
key: "internalSort",
|
|
3465
3523
|
value: function internalSort(column, colIndex) {
|
|
@@ -3504,18 +3562,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3504
3562
|
}, {
|
|
3505
3563
|
key: "render",
|
|
3506
3564
|
value: function render(data) {
|
|
3507
|
-
var
|
|
3565
|
+
var _this22 = this;
|
|
3508
3566
|
|
|
3509
3567
|
if (!this.options.columns) {
|
|
3510
3568
|
return;
|
|
3511
3569
|
}
|
|
3512
3570
|
|
|
3571
|
+
this.hideError();
|
|
3513
3572
|
this.data = [];
|
|
3514
3573
|
this.rowCount = 0;
|
|
3515
3574
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
3516
3575
|
bodyEl.innerHTML = '';
|
|
3517
3576
|
|
|
3518
3577
|
if (this.options.allowDownload === true) {
|
|
3578
|
+
// doesn't do anything yet
|
|
3519
3579
|
var el = document.getElementById(this.elementId);
|
|
3520
3580
|
|
|
3521
3581
|
if (el) {
|
|
@@ -3527,24 +3587,84 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3527
3587
|
|
|
3528
3588
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
3529
3589
|
if (c.show !== false) {
|
|
3530
|
-
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 ?
|
|
3590
|
+
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 ");
|
|
3531
3591
|
}
|
|
3532
3592
|
}).join('') + '</tr>';
|
|
3533
3593
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
3534
|
-
headEl.innerHTML = headHTML;
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3594
|
+
headEl.innerHTML = headHTML; // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
|
|
3595
|
+
// if (c.show !== false) {
|
|
3596
|
+
// return `
|
|
3597
|
+
// <th></th>
|
|
3598
|
+
// `
|
|
3599
|
+
// }
|
|
3600
|
+
// }).join('') + '</tr>'
|
|
3601
|
+
// const footEl = document.getElementById(`${this.elementId}_foot`)
|
|
3602
|
+
// footEl.innerHTML = footHTML
|
|
3603
|
+
|
|
3604
|
+
if (this.options.paging === 'pages') {
|
|
3605
|
+
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3606
|
+
|
|
3607
|
+
if (pagingEl) {
|
|
3608
|
+
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
3609
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3610
|
+
});
|
|
3611
|
+
var startIndex = 0;
|
|
3612
|
+
|
|
3613
|
+
if (this.options.pageCount > 8) {
|
|
3614
|
+
startIndex = Math.max(0, this.options.pageNum - 4);
|
|
3615
|
+
pages = pages.splice(startIndex, 10);
|
|
3616
|
+
|
|
3617
|
+
if (startIndex > 0) {
|
|
3618
|
+
pages.splice(0, 0, "<li>Page </li><li data-page=\"0\" class=\"websy-page-num\">First</li><li>...</li>");
|
|
3619
|
+
} else {
|
|
3620
|
+
pages.splice(0, 0, '<li>Page </li>');
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
if (this.options.pageNum < this.options.pageCount - 1) {
|
|
3624
|
+
pages.push('<li>...</li>');
|
|
3625
|
+
pages.push("<li data-page=\"".concat(this.options.pageCount - 1, "\" class=\"websy-page-num\">Last</li>"));
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
pagingEl.innerHTML = pages.join('');
|
|
3538
3630
|
}
|
|
3539
|
-
}
|
|
3540
|
-
var footEl = document.getElementById("".concat(this.elementId, "_foot"));
|
|
3541
|
-
footEl.innerHTML = footHTML;
|
|
3631
|
+
}
|
|
3542
3632
|
|
|
3543
3633
|
if (data) {
|
|
3544
3634
|
// this.data = this.data.concat(data)
|
|
3545
3635
|
this.appendRows(data);
|
|
3546
3636
|
}
|
|
3547
3637
|
}
|
|
3638
|
+
}, {
|
|
3639
|
+
key: "showError",
|
|
3640
|
+
value: function showError(options) {
|
|
3641
|
+
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
3642
|
+
|
|
3643
|
+
if (containerEl) {
|
|
3644
|
+
containerEl.classList.add('active');
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
if (options.title) {
|
|
3648
|
+
var titleEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
|
|
3649
|
+
|
|
3650
|
+
if (titleEl) {
|
|
3651
|
+
titleEl.innerHTML = options.title;
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
if (options.message) {
|
|
3656
|
+
var messageEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
|
|
3657
|
+
|
|
3658
|
+
if (messageEl) {
|
|
3659
|
+
messageEl.innerHTML = options.message;
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
}, {
|
|
3664
|
+
key: "showLoading",
|
|
3665
|
+
value: function showLoading(options) {
|
|
3666
|
+
this.loadingDialog.show(options);
|
|
3667
|
+
}
|
|
3548
3668
|
}]);
|
|
3549
3669
|
|
|
3550
3670
|
return WebsyTable;
|
|
@@ -3554,7 +3674,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3554
3674
|
|
|
3555
3675
|
var WebsyChart = /*#__PURE__*/function () {
|
|
3556
3676
|
function WebsyChart(elementId, options) {
|
|
3557
|
-
var
|
|
3677
|
+
var _this23 = this;
|
|
3558
3678
|
|
|
3559
3679
|
_classCallCheck(this, WebsyChart);
|
|
3560
3680
|
|
|
@@ -3602,22 +3722,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3602
3722
|
this.invertOverride = function (input, input2) {
|
|
3603
3723
|
var xAxis = 'bottomAxis';
|
|
3604
3724
|
|
|
3605
|
-
if (
|
|
3725
|
+
if (_this23.options.orientation === 'horizontal') {
|
|
3606
3726
|
xAxis = 'leftAxis';
|
|
3607
3727
|
}
|
|
3608
3728
|
|
|
3609
|
-
var width =
|
|
3729
|
+
var width = _this23[xAxis].step();
|
|
3610
3730
|
|
|
3611
3731
|
var output;
|
|
3612
3732
|
|
|
3613
|
-
var domain = _toConsumableArray(
|
|
3733
|
+
var domain = _toConsumableArray(_this23[xAxis].domain());
|
|
3614
3734
|
|
|
3615
|
-
if (
|
|
3735
|
+
if (_this23.options.orientation === 'horizontal') {
|
|
3616
3736
|
domain = domain.reverse();
|
|
3617
3737
|
}
|
|
3618
3738
|
|
|
3619
3739
|
for (var j = 0; j < domain.length; j++) {
|
|
3620
|
-
var breakA =
|
|
3740
|
+
var breakA = _this23[xAxis](domain[j]) - width / 2;
|
|
3621
3741
|
var breakB = breakA + width;
|
|
3622
3742
|
|
|
3623
3743
|
if (input > breakA && input <= breakB) {
|
|
@@ -3717,10 +3837,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3717
3837
|
}, {
|
|
3718
3838
|
key: "handleEventMouseMove",
|
|
3719
3839
|
value: function handleEventMouseMove(event, d) {
|
|
3720
|
-
var
|
|
3840
|
+
var _this24 = this;
|
|
3721
3841
|
|
|
3722
3842
|
var bisectDate = d3.bisector(function (d) {
|
|
3723
|
-
return
|
|
3843
|
+
return _this24.parseX(d.x.value);
|
|
3724
3844
|
}).left;
|
|
3725
3845
|
|
|
3726
3846
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -3759,8 +3879,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3759
3879
|
}
|
|
3760
3880
|
|
|
3761
3881
|
this.options.data.series.forEach(function (s) {
|
|
3762
|
-
if (
|
|
3763
|
-
xPoint =
|
|
3882
|
+
if (_this24.options.data[xData].scale !== 'Time') {
|
|
3883
|
+
xPoint = _this24[xAxis](_this24.parseX(xLabel));
|
|
3764
3884
|
s.data.forEach(function (d) {
|
|
3765
3885
|
if (d.x.value === xLabel) {
|
|
3766
3886
|
if (!d.y.color) {
|
|
@@ -3775,13 +3895,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3775
3895
|
var pointA = s.data[index - 1];
|
|
3776
3896
|
var pointB = s.data[index];
|
|
3777
3897
|
|
|
3778
|
-
if (
|
|
3898
|
+
if (_this24.options.orientation === 'horizontal') {
|
|
3779
3899
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
3780
3900
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
3781
3901
|
}
|
|
3782
3902
|
|
|
3783
3903
|
if (pointA && !pointB) {
|
|
3784
|
-
xPoint =
|
|
3904
|
+
xPoint = _this24[xAxis](_this24.parseX(pointA.x.value));
|
|
3785
3905
|
tooltipTitle = pointA.x.value;
|
|
3786
3906
|
|
|
3787
3907
|
if (!pointA.y.color) {
|
|
@@ -3791,12 +3911,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3791
3911
|
tooltipData.push(pointA.y);
|
|
3792
3912
|
|
|
3793
3913
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
3794
|
-
tooltipTitle = d3.timeFormat(
|
|
3914
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
3795
3915
|
}
|
|
3796
3916
|
}
|
|
3797
3917
|
|
|
3798
3918
|
if (pointB && !pointA) {
|
|
3799
|
-
xPoint =
|
|
3919
|
+
xPoint = _this24[xAxis](_this24.parseX(pointB.x.value));
|
|
3800
3920
|
tooltipTitle = pointB.x.value;
|
|
3801
3921
|
|
|
3802
3922
|
if (!pointB.y.color) {
|
|
@@ -3806,14 +3926,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3806
3926
|
tooltipData.push(pointB.y);
|
|
3807
3927
|
|
|
3808
3928
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
3809
|
-
tooltipTitle = d3.timeFormat(
|
|
3929
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
3810
3930
|
}
|
|
3811
3931
|
}
|
|
3812
3932
|
|
|
3813
3933
|
if (pointA && pointB) {
|
|
3814
|
-
var d0 =
|
|
3934
|
+
var d0 = _this24[xAxis](_this24.parseX(pointA.x.value));
|
|
3815
3935
|
|
|
3816
|
-
var d1 =
|
|
3936
|
+
var d1 = _this24[xAxis](_this24.parseX(pointB.x.value));
|
|
3817
3937
|
|
|
3818
3938
|
var mid = Math.abs(d0 - d1) / 2;
|
|
3819
3939
|
|
|
@@ -3822,7 +3942,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3822
3942
|
tooltipTitle = pointB.x.value;
|
|
3823
3943
|
|
|
3824
3944
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
3825
|
-
tooltipTitle = d3.timeFormat(
|
|
3945
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
3826
3946
|
}
|
|
3827
3947
|
|
|
3828
3948
|
if (!pointB.y.color) {
|
|
@@ -3835,7 +3955,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3835
3955
|
tooltipTitle = pointA.x.value;
|
|
3836
3956
|
|
|
3837
3957
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
3838
|
-
tooltipTitle = d3.timeFormat(
|
|
3958
|
+
tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
3839
3959
|
}
|
|
3840
3960
|
|
|
3841
3961
|
if (!pointA.y.color) {
|
|
@@ -3940,7 +4060,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
3940
4060
|
}, {
|
|
3941
4061
|
key: "render",
|
|
3942
4062
|
value: function render(options) {
|
|
3943
|
-
var
|
|
4063
|
+
var _this25 = this;
|
|
3944
4064
|
|
|
3945
4065
|
/* global d3 options */
|
|
3946
4066
|
if (typeof options !== 'undefined') {
|
|
@@ -4009,7 +4129,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4009
4129
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
4010
4130
|
return {
|
|
4011
4131
|
value: s.label || s.key,
|
|
4012
|
-
color: s.color ||
|
|
4132
|
+
color: s.color || _this25.options.colors[i % _this25.options.colors.length]
|
|
4013
4133
|
};
|
|
4014
4134
|
});
|
|
4015
4135
|
|
|
@@ -4248,7 +4368,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4248
4368
|
|
|
4249
4369
|
if (this.options.data.bottom.formatter) {
|
|
4250
4370
|
bAxisFunc.tickFormat(function (d) {
|
|
4251
|
-
return
|
|
4371
|
+
return _this25.options.data.bottom.formatter(d);
|
|
4252
4372
|
});
|
|
4253
4373
|
}
|
|
4254
4374
|
|
|
@@ -4275,8 +4395,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4275
4395
|
|
|
4276
4396
|
if (this.options.margin.axisLeft > 0) {
|
|
4277
4397
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
4278
|
-
if (
|
|
4279
|
-
d =
|
|
4398
|
+
if (_this25.options.data.left.formatter) {
|
|
4399
|
+
d = _this25.options.data.left.formatter(d);
|
|
4280
4400
|
}
|
|
4281
4401
|
|
|
4282
4402
|
return d;
|
|
@@ -4313,8 +4433,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4313
4433
|
|
|
4314
4434
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
4315
4435
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
4316
|
-
if (
|
|
4317
|
-
d =
|
|
4436
|
+
if (_this25.options.data.right.formatter) {
|
|
4437
|
+
d = _this25.options.data.right.formatter(d);
|
|
4318
4438
|
}
|
|
4319
4439
|
|
|
4320
4440
|
return d;
|
|
@@ -4340,16 +4460,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4340
4460
|
|
|
4341
4461
|
this.options.data.series.forEach(function (series, index) {
|
|
4342
4462
|
if (!series.key) {
|
|
4343
|
-
series.key =
|
|
4463
|
+
series.key = _this25.createIdentity();
|
|
4344
4464
|
}
|
|
4345
4465
|
|
|
4346
4466
|
if (!series.color) {
|
|
4347
|
-
series.color =
|
|
4467
|
+
series.color = _this25.options.colors[index % _this25.options.colors.length];
|
|
4348
4468
|
}
|
|
4349
4469
|
|
|
4350
|
-
|
|
4470
|
+
_this25["render".concat(series.type || 'bar')](series, index);
|
|
4351
4471
|
|
|
4352
|
-
|
|
4472
|
+
_this25.renderLabels(series, index);
|
|
4353
4473
|
});
|
|
4354
4474
|
}
|
|
4355
4475
|
}
|
|
@@ -4357,17 +4477,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4357
4477
|
}, {
|
|
4358
4478
|
key: "renderarea",
|
|
4359
4479
|
value: function renderarea(series, index) {
|
|
4360
|
-
var
|
|
4480
|
+
var _this26 = this;
|
|
4361
4481
|
|
|
4362
4482
|
/* global d3 series index */
|
|
4363
4483
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
4364
4484
|
return d3.area().x(function (d) {
|
|
4365
|
-
return
|
|
4485
|
+
return _this26[xAxis](_this26.parseX(d.x.value));
|
|
4366
4486
|
}).y0(function (d) {
|
|
4367
|
-
return
|
|
4487
|
+
return _this26[yAxis](0);
|
|
4368
4488
|
}).y1(function (d) {
|
|
4369
|
-
return
|
|
4370
|
-
}).curve(d3[curveStyle ||
|
|
4489
|
+
return _this26[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
4490
|
+
}).curve(d3[curveStyle || _this26.options.curveStyle]);
|
|
4371
4491
|
};
|
|
4372
4492
|
|
|
4373
4493
|
var xAxis = 'bottomAxis';
|
|
@@ -4540,15 +4660,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4540
4660
|
}, {
|
|
4541
4661
|
key: "renderline",
|
|
4542
4662
|
value: function renderline(series, index) {
|
|
4543
|
-
var
|
|
4663
|
+
var _this27 = this;
|
|
4544
4664
|
|
|
4545
4665
|
/* global series index d3 */
|
|
4546
4666
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
4547
4667
|
return d3.line().x(function (d) {
|
|
4548
|
-
return
|
|
4668
|
+
return _this27[xAxis](_this27.parseX(d.x.value));
|
|
4549
4669
|
}).y(function (d) {
|
|
4550
|
-
return
|
|
4551
|
-
}).curve(d3[curveStyle ||
|
|
4670
|
+
return _this27[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
4671
|
+
}).curve(d3[curveStyle || _this27.options.curveStyle]);
|
|
4552
4672
|
};
|
|
4553
4673
|
|
|
4554
4674
|
var xAxis = 'bottomAxis';
|
|
@@ -4586,14 +4706,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4586
4706
|
}, {
|
|
4587
4707
|
key: "rendersymbol",
|
|
4588
4708
|
value: function rendersymbol(series, index) {
|
|
4589
|
-
var
|
|
4709
|
+
var _this28 = this;
|
|
4590
4710
|
|
|
4591
4711
|
/* global d3 series index series.key */
|
|
4592
4712
|
var drawSymbol = function drawSymbol(size) {
|
|
4593
4713
|
return d3.symbol() // .type(d => {
|
|
4594
4714
|
// return d3.symbols[0]
|
|
4595
4715
|
// })
|
|
4596
|
-
.size(size ||
|
|
4716
|
+
.size(size || _this28.options.symbolSize);
|
|
4597
4717
|
};
|
|
4598
4718
|
|
|
4599
4719
|
var xAxis = 'bottomAxis';
|
|
@@ -4611,7 +4731,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4611
4731
|
symbols.attr('d', function (d) {
|
|
4612
4732
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
4613
4733
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
4614
|
-
return "translate(".concat(
|
|
4734
|
+
return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
4615
4735
|
}); // Enter
|
|
4616
4736
|
|
|
4617
4737
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -4620,7 +4740,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4620
4740
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
4621
4741
|
return "symbol symbol_".concat(series.key);
|
|
4622
4742
|
}).attr('transform', function (d) {
|
|
4623
|
-
return "translate(".concat(
|
|
4743
|
+
return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
4624
4744
|
});
|
|
4625
4745
|
}
|
|
4626
4746
|
}, {
|
|
@@ -4775,7 +4895,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
4775
4895
|
}, {
|
|
4776
4896
|
key: "resize",
|
|
4777
4897
|
value: function resize() {
|
|
4778
|
-
var
|
|
4898
|
+
var _this29 = this;
|
|
4779
4899
|
|
|
4780
4900
|
var el = document.getElementById(this.elementId);
|
|
4781
4901
|
|
|
@@ -4788,7 +4908,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
4788
4908
|
// }
|
|
4789
4909
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
4790
4910
|
html += this._data.map(function (d, i) {
|
|
4791
|
-
return
|
|
4911
|
+
return _this29.getLegendItemHTML(d);
|
|
4792
4912
|
}).join('');
|
|
4793
4913
|
html += "\n <div>\n ";
|
|
4794
4914
|
el.innerHTML = html;
|
|
@@ -4961,7 +5081,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
4961
5081
|
}, {
|
|
4962
5082
|
key: "render",
|
|
4963
5083
|
value: function render() {
|
|
4964
|
-
var
|
|
5084
|
+
var _this30 = this;
|
|
4965
5085
|
|
|
4966
5086
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
4967
5087
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -4970,7 +5090,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
4970
5090
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
4971
5091
|
return {
|
|
4972
5092
|
value: s.label || s.key,
|
|
4973
|
-
color: s.color ||
|
|
5093
|
+
color: s.color || _this30.options.colors[i % _this30.options.colors.length]
|
|
4974
5094
|
};
|
|
4975
5095
|
});
|
|
4976
5096
|
var longestValue = legendData.map(function (s) {
|
|
@@ -5034,7 +5154,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
5034
5154
|
|
|
5035
5155
|
if (this.polygons) {
|
|
5036
5156
|
this.polygons.forEach(function (p) {
|
|
5037
|
-
return
|
|
5157
|
+
return _this30.map.removeLayer(p);
|
|
5038
5158
|
});
|
|
5039
5159
|
}
|
|
5040
5160
|
|
|
@@ -5092,18 +5212,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
5092
5212
|
}
|
|
5093
5213
|
|
|
5094
5214
|
if (!p.options.color) {
|
|
5095
|
-
p.options.color =
|
|
5215
|
+
p.options.color = _this30.options.colors[i % _this30.options.colors.length];
|
|
5096
5216
|
}
|
|
5097
5217
|
|
|
5098
5218
|
var pol = L.polygon(p.data.map(function (c) {
|
|
5099
5219
|
return c.map(function (d) {
|
|
5100
5220
|
return [d.Latitude, d.Longitude];
|
|
5101
5221
|
});
|
|
5102
|
-
}), p.options).addTo(
|
|
5222
|
+
}), p.options).addTo(_this30.map);
|
|
5103
5223
|
|
|
5104
|
-
|
|
5224
|
+
_this30.polygons.push(pol);
|
|
5105
5225
|
|
|
5106
|
-
|
|
5226
|
+
_this30.map.fitBounds(pol.getBounds());
|
|
5107
5227
|
});
|
|
5108
5228
|
} // if (this.data.markers.length > 0) {
|
|
5109
5229
|
// el.classList.remove('hidden')
|
|
@@ -5273,3 +5393,6 @@ function usePayPal() {
|
|
|
5273
5393
|
pps.src = '//www.paypal.com/sdk/js';
|
|
5274
5394
|
document.getElementsByTagName('body')[0].appendChild(pps);
|
|
5275
5395
|
}
|
|
5396
|
+
|
|
5397
|
+
var _default = WebsyDesigns;
|
|
5398
|
+
exports["default"] = _default;
|